bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

qsort_r: Fix compilation error in C++ mode on FreeBSD 14.0/powerpc64


From: Bruno Haible
Subject: qsort_r: Fix compilation error in C++ mode on FreeBSD 14.0/powerpc64
Date: Fri, 12 Jan 2024 10:26:29 +0100

On FreeBSD 14.0/powerpc64 I see compilation errors like this in a testdir:

In file included from ../../gltests/test-stdlib-c++.cc:22:
../gllib/stdlib.h:1678:1: error: reference to overloaded function could not be 
resolved; did you mean to call it?
_GL_CXXALIASWARN (qsort_r);
^~~~~~~~~~~~~~~~~~~~~~~~~~
../gllib/signal.h:373:4: note: expanded from macro '_GL_CXXALIASWARN'
   _GL_CXXALIASWARN_1 (func, GNULIB_NAMESPACE)
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../gllib/signal.h:375:4: note: expanded from macro '_GL_CXXALIASWARN_1'
   _GL_CXXALIASWARN_2 (func, namespace)
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../gllib/signal.h:380:5: note: expanded from macro '_GL_CXXALIASWARN_2'
    _GL_WARN_ON_USE (func, \
    ^~~~~~~~~~~~~~~~~~~~~~~~
../gllib/signal.h:543:30: note: expanded from macro '_GL_WARN_ON_USE'
_GL_WARN_EXTERN_C __typeof__ (function) function \
                             ^~~~~~~~~~
/usr/include/stdlib.h:361:20: note: possible target for call
static inline void qsort_r(void *base, size_t nmemb, size_t size,
                   ^
/usr/include/stdlib.h:313:7: note: possible target for call
void     qsort_r(void *, size_t, size_t,
         ^
1 error generated.


This patch fixes it.


2024-01-12  Bruno Haible  <bruno@clisp.org>

        qsort_r: Fix compilation error in C++ mode on FreeBSD 14.0/powerpc64.
        * lib/stdlib.in.h (qsort_r): Enable the C++ alias warning only on glibc
        systems.

diff --git a/lib/stdlib.in.h b/lib/stdlib.in.h
index 5f929055e8..b901d175ae 100644
--- a/lib/stdlib.in.h
+++ b/lib/stdlib.in.h
@@ -1112,7 +1112,9 @@ _GL_CXXALIAS_SYS (qsort_r, void, (void *base, size_t 
nmemb, size_t size,
                                   _gl_qsort_r_compar_fn compare,
                                   void *arg));
 # endif
+# if __GLIBC__ >= 2
 _GL_CXXALIASWARN (qsort_r);
+# endif
 #elif defined GNULIB_POSIXCHECK
 # undef qsort_r
 # if HAVE_RAW_DECL_QSORT_R






reply via email to

[Prev in Thread] Current Thread [Next in Thread]