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

Conversation

jpf91
Copy link
Contributor

@jpf91 jpf91 commented Feb 1, 2019

In GCC, we'll simply use the configure script to check if qsort_r is available and set Have_Qsort_R in gcc.config. Upstream druntime doesn't have an advanced build system which supports such checks, so just continue to assume the glibc supports qsort_r.

Can't use a version here, cause defining it with static if will lead to version defined after use errors.

Original bug report: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88127

ping @ibuclaw

@dlang-bot
Copy link
Contributor

Thanks for your pull request and interest in making D better, @jpf91! We are looking forward to reviewing it, and you should be hearing from a maintainer soon.
Please verify that your PR follows this checklist:

  • My PR is fully covered with tests (you can see the annotated coverage diff directly on GitHub with CodeCov's browser extension
  • My PR is as minimal as possible (smaller, focused PRs are easier to review than big ones)
  • I have provided a detailed rationale explaining my changes
  • New or modified functions have Ddoc comments (with Params: and Returns:)

Please see CONTRIBUTING.md for more information.


If you have addressed all reviews or aren't sure how to proceed, don't hesitate to ping us with a simple comment.

Bugzilla references

Auto-close Bugzilla Severity Description

Testing this PR locally

If you don't have a local development environment setup, you can use Digger to test this PR:

dub fetch digger
dub run digger -- build "master + druntime#2480"

@dlang-bot dlang-bot merged commit 088ccf2 into dlang:master Feb 2, 2019
@jpf91
Copy link
Contributor Author

jpf91 commented Feb 2, 2019

Thanks!

@jpf91 jpf91 deleted the 88127 branch February 2, 2019 09:45
@ibuclaw
Copy link
Member

ibuclaw commented Feb 2, 2019

I suspect that other platforms may require similar treatment depending on how far back we want to support things.

@jpf91
Copy link
Contributor Author

jpf91 commented Feb 2, 2019

Hmm, well I could wrap everything in a static if, if you prefer that?

// qsort_r may not be available
version (GNU)
    import gcc.config : Have_Qsort_R;
else
    enum Have_Qsort_R = true;

static if (Have_Qsort_R)
{
    version (CRuntime_Glibc)
    {
        enum Use_Qsort_R = true;
        ...
    }
    else version (FreeBSD)
    {
        enum Use_Qsort_R = true;
        ...
    }
    else version (DragonFlyBSD)
    {
        enum Use_Qsort_R = true;
        ...
    }
    else
    {
        enum Use_Qsort_R = false;
    }
}

static if (!Use_Qsort_R)
{
    //qsort implementation
}

However, I don't know how long qsort_r has been available on the other platforms.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
6 participants