[PATCH 3/3] libctf: look for a qsort_r that functions properly
Florian Weimer
fweimer@redhat.com
Tue Jun 4 09:55:00 GMT 2019
* Nick Alcock:
> +AC_CACHE_CHECK([for qsort_r with arg last], ac_cv_libctf_qsort_r_arg_last,
> +[AC_RUN_IFELSE(
> + [AC_LANG_PROGRAM(
> + [#include <stdlib.h>
> + int do_not_call (const void *a, const void *b, void *arg)
> + {
> + return (a < b);
> + }
> + static int works = 0;
> + int conftest_compar (const void *a, const void *b, void *arg)
> + {
> + if (arg == do_not_call)
> + works = 1;
> + return (a < b);
> + }
> + int foo[[2]] = { 0, 1 };],
> + [qsort_r (foo, 2, sizeof (int), conftest_compar, do_not_call);
> + return (works == 0);])],
> + [ac_cv_libctf_qsort_r_arg_last=yes],
> + [ac_cv_libctf_qsort_r_arg_last=no],
> + [ac_cv_libctf_qsort_r_arg_last=no])])
Can you use a compile test with the expected declaration, trying to
compile this?
#undef qsort_r
#include <stdlib.h>
void qsort_r (void *, size_t, size_t,
int (*) (const void *, const void *, void *),
void *);
And:
#undef qsort_r
#include <stdlib.h>
void qsort_r (void *, size_t, size_t, void *,
int (*) (const void *, const void *, void *));
This will result in a hard compiler error, not just in an error.
Thanks,
Florian
More information about the Binutils
mailing list