From cff6bdfcba57995e1879c7a2003f9949aec29632 Mon Sep 17 00:00:00 2001 From: nobu Date: Thu, 13 Sep 2018 11:00:55 +0000 Subject: [PATCH] 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 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64732 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- configure.ac | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index f401fd5669..14fe5279c7 100644 --- a/configure.ac +++ b/configure.ac @@ -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 -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 -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],