This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 3/3] libctf: look for a qsort_r that functions properly


* Florian Weimer:

> * 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.

(I meant not just in a warning.)

Florian


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]