This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [PATCH 3/3] libctf: look for a qsort_r that functions properly
- From: Florian Weimer <fweimer at redhat dot com>
- To: Nick Alcock <nick dot alcock at oracle dot com>
- Cc: binutils at sourceware dot org, jose dot marchesi at oracle dot com, John dot W dot Marshall at glasgow dot ac dot uk, sebastian dot huber at embedded-brains dot de
- Date: Tue, 04 Jun 2019 11:55:16 +0200
- Subject: Re: [PATCH 3/3] libctf: look for a qsort_r that functions properly
- References: <20190603204735.203510-1-nick.alcock@oracle.com> <20190603204735.203510-3-nick.alcock@oracle.com>
* 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