diff --git a/src/core/stdc/stdlib.d b/src/core/stdc/stdlib.d index 088aeaf227..ac8b301d37 100644 --- a/src/core/stdc/stdlib.d +++ b/src/core/stdc/stdlib.d @@ -29,10 +29,14 @@ else version (WatchOS) extern (C): @system: -/* Placed outside @nogc in order to not constrain what the callback does. +/* Placed outside `nothrow` and `@nogc` in order to not constrain what the callback does. */ /// -alias int function(const void*, const void*) _compare_fp_t; +alias _compare_fp_t = int function(const void*, const void*); + +nothrow: +@nogc: + /// inout(void)* bsearch(const void* key, inout(void)* base, size_t nmemb, size_t size, _compare_fp_t compar); /// @@ -51,9 +55,6 @@ void qsort(void* base, size_t nmemb, size_t size, _compare_fp_t compar); bsearch(&key, arr.ptr, arr[0].sizeof, arr.length, &S.cmp); } -nothrow: -@nogc: - /// struct div_t { diff --git a/src/rt/profilegc.d b/src/rt/profilegc.d index a5ec1a8396..7c88d83a78 100644 --- a/src/rt/profilegc.d +++ b/src/rt/profilegc.d @@ -113,7 +113,7 @@ shared static ~this() Entry entry; // qsort() comparator to sort by count field - extern (C) static int qsort_cmp(scope const void *r1, scope const void *r2) + extern (C) static int qsort_cmp(scope const void *r1, scope const void *r2) @nogc nothrow { auto result1 = cast(Result*)r1; auto result2 = cast(Result*)r2; diff --git a/src/rt/trace.d b/src/rt/trace.d index f73a45abbc..4d19dbe8ad 100644 --- a/src/rt/trace.d +++ b/src/rt/trace.d @@ -156,7 +156,7 @@ private void stack_free(Stack *s) ////////////////////////////////////// // Qsort() comparison routine for array of pointers to SymPair's. -private int sympair_cmp(scope const void* e1, scope const void* e2) +private int sympair_cmp(scope const void* e1, scope const void* e2) nothrow @nogc { auto count1 = (*cast(SymPair**)e1).count; auto count2 = (*cast(SymPair**)e2).count; @@ -271,7 +271,7 @@ private void trace_array(Symbol*[] psymbols, Symbol *s, ref uint u) ////////////////////////////////////// // Qsort() comparison routine for array of pointers to Symbol's. -private int symbol_cmp(scope const void* e1, scope const void* e2) +private int symbol_cmp(scope const void* e1, scope const void* e2) nothrow @nogc { auto ps1 = cast(Symbol **)e1; auto ps2 = cast(Symbol **)e2;