[前][次][番号順一覧][スレッド一覧]

ruby-changes:52521

From: nobu <ko1@a...>
Date: Thu, 13 Sep 2018 20:01:00 +0900 (JST)
Subject: [ruby-changes:52521] nobu:r64732 (trunk): Make qsort_r() flavor detecting work if qsort_r() is a macro

nobu	2018-09-13 20:00:55 +0900 (Thu, 13 Sep 2018)

  New Revision: 64732

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=64732

  Log:
    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@n...>

  Modified files:
    trunk/configure.ac
Index: configure.ac
===================================================================
--- configure.ac	(revision 64731)
+++ configure.ac	(revision 64732)
@@ -1950,7 +1950,7 @@ AS_IF([test "$ac_cv_func_qsort_r" != no] https://github.com/ruby/ruby/blob/trunk/configure.ac#L1950
   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, s https://github.com/ruby/ruby/blob/trunk/configure.ac#L1960
   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],

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]