Skip to content
This repository has been archived by the owner on Oct 12, 2022. It is now read-only.

GCC bug 88127: qsort_r is not available in old glibc #2480

Merged
merged 1 commit into from
Feb 2, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions src/rt/qsort.d
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,25 @@ else version (TVOS)
else version (WatchOS)
version = Darwin;

// qsort_r was added in glibc in 2.8. https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88127
version (CRuntime_Glibc)
{
version (GNU)
{
import gcc.config : Have_Qsort_R;
enum Glibc_Qsort_R = Have_Qsort_R;
}
else
{
enum Glibc_Qsort_R = true;
}
}
else
{
enum Glibc_Qsort_R = false;
}

static if (Glibc_Qsort_R)
{
alias extern (C) int function(scope const void *, scope const void *, scope void *) Cmp;
extern (C) void qsort_r(scope void *base, size_t nmemb, size_t size, Cmp cmp, scope void *arg);
Expand Down