1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Make qsort_r() flavor detecting work if qsort_r() is a macro

On FreeBSD we're going to switch to the GNU-ish version of qsort_r().
POSIX is also considering standardizing that one. To prevent faulty
calls, we have a macro in place to throw a compiler error if a BSD-style
qsort_r() call is performed on a patched system. Such an approach tends
to be permitted by POSIX.

The configure check we have in Ruby would fail if qsort_r() is a
function macro. Add parentheses around it to prevent macro expansion and
force the declaration of a prototype.

[Fix GH-1954]

From: Ed Schouten <ed@nuxi.nl>

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64732 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2018-09-13 11:00:55 +00:00
parent 38122275f3
commit cff6bdfcba

View file

@ -1950,7 +1950,7 @@ AS_IF([test "$ac_cv_func_qsort_r" != no], [
AC_CACHE_CHECK(whether qsort_r is GNU version, rb_cv_gnu_qsort_r,
[AC_TRY_COMPILE([
@%:@include <stdlib.h>
void qsort_r(void *base, size_t nmemb, size_t size,
void (qsort_r)(void *base, size_t nmemb, size_t size,
int (*compar)(const void *, const void *, void *),
void *arg);
],[ ],
@ -1960,7 +1960,7 @@ void qsort_r(void *base, size_t nmemb, size_t size,
AC_CACHE_CHECK(whether qsort_r is BSD version, rb_cv_bsd_qsort_r,
[AC_TRY_COMPILE([
@%:@include <stdlib.h>
void qsort_r(void *base, size_t nmemb, size_t size,
void (qsort_r)(void *base, size_t nmemb, size_t size,
void *arg, int (*compar)(void *, const void *, const void *));
],[ ],
[rb_cv_bsd_qsort_r=yes],