diff options
author | Ariadne Conill <ariadne@dereferenced.org> | 2022-04-04 08:21:05 -0500 |
---|---|---|
committer | Ariadne Conill <ariadne@dereferenced.org> | 2022-04-04 08:21:05 -0500 |
commit | 8eddaeefa1478c1bebb89f435626565429797b04 (patch) | |
tree | 68a05354ab1c3f86a911692a6beb2df0dbec08db /portability/meson.build | |
parent | 55e20d3e5b48eea29523b633492a167118dcc3bd (diff) | |
download | apk-tools-fix/portability-broken-qsort-r.tar.gz apk-tools-fix/portability-broken-qsort-r.tar.bz2 apk-tools-fix/portability-broken-qsort-r.tar.xz apk-tools-fix/portability-broken-qsort-r.zip |
portability: check for qsort_r which does not match POSIX-next definitionfix/portability-broken-qsort-r
FreeBSD (and also Darwin) introduced its own qsort_r, which has different
semantics than the one slated for inclusion in POSIX. Add a portability
thunk to deal with translating between implementations.
Diffstat (limited to 'portability/meson.build')
-rw-r--r-- | portability/meson.build | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/portability/meson.build b/portability/meson.build index d077345..9c9e39c 100644 --- a/portability/meson.build +++ b/portability/meson.build @@ -21,6 +21,20 @@ foreach f : check_functions endforeach +# Check for wrong (non-POSIX) qsort_r prototype +qsort_r_test = ''' + #define _GNU_SOURCE + #include <stdlib.h> + _Static_assert(_Generic((qsort_r), + void (*)(void *, size_t, size_t, void *, + int (*)(void *, const void *, const void *)) : 1, default: 0), + "Bad prototype not matched"); +''' +if cc.compiles(qsort_r_test, name: 'Test qsort_r non-POSIX prototype') + add_project_arguments('-DHAVE_BROKEN_QSORT_R', language: 'c') +endif + + if libportability_src.length() > 0 libportability = static_library( 'portability', |