Oops, this patch produces a compilation error of 'test-math-c++':

In file included from /usr/include/x86_64-linux-gnu/sys/types.h:179,
                 from ../gllib/sys/types.h:46,
                 from /usr/include/stdlib.h:395,
                 from 
/media/develdata/darch/x86_64-linux-gnu/gnu-inst-gcc/13.2.0/include/c++/13.2.0/bits/std_abs.h:38,
                 from 
/media/develdata/darch/x86_64-linux-gnu/gnu-inst-gcc/13.2.0/include/c++/13.2.0/cmath:49,
                 from 
/media/develdata/darch/x86_64-linux-gnu/gnu-inst-gcc/13.2.0/include/c++/13.2.0/math.h:36,
                 from ../gllib/math.h:46,
                 from ../../gltests/test-math-c++.cc:22:
../gllib/math.h:1964:1: error: type of 'ldexp' is unknown
 1964 | _GL_CXXALIASWARN (ldexp);
      | ^~~~~~~~~~~~~~~~
../gllib/math.h:1964:1: error: 'int ldexp' redeclared as different kind of 
entity
 1964 | _GL_CXXALIASWARN (ldexp);
      | ^~~~~~~~~~~~~~~~
In file included from /usr/include/features.h:486,
                 from 
/media/develdata/darch/x86_64-linux-gnu/gnu-inst-gcc/13.2.0/include/c++/13.2.0/x86_64-pc-linux-gnu/bits/os_defines.h:39,
                 from 
/media/develdata/darch/x86_64-linux-gnu/gnu-inst-gcc/13.2.0/include/c++/13.2.0/x86_64-pc-linux-gnu/bits/c++config.h:679,
                 from 
/media/develdata/darch/x86_64-linux-gnu/gnu-inst-gcc/13.2.0/include/c++/13.2.0/bits/requires_hosted.h:31,
                 from 
/media/develdata/darch/x86_64-linux-gnu/gnu-inst-gcc/13.2.0/include/c++/13.2.0/cmath:41:
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:101:1: note: previous 
declaration 'double ldexp(double, int)'
  101 | __MATHCALL (ldexp,, (_Mdouble_ __x, int __exponent));
      | ^~~~~~~~~~
make[3]: *** [Makefile:24861: test-math-c++.o] Error 1

Fixed as follows.


2023-08-20  Bruno Haible  <[email protected]>

        ldexp: Fix compilation error in C++ mode.
        * lib/math.in.h (ldexp): Use _GL_CXXALIASWARN1, not _GL_CXXALIASWARN.

diff --git a/lib/math.in.h b/lib/math.in.h
index 96abf10b81..117bc993b5 100644
--- a/lib/math.in.h
+++ b/lib/math.in.h
@@ -1448,7 +1448,7 @@ _GL_CXXALIAS_RPL (ldexp, double, (double x, int exp));
 _GL_CXXALIAS_SYS (ldexp, double, (double x, int exp));
 # endif
 # if __GLIBC__ >= 2
-_GL_CXXALIASWARN (ldexp);
+_GL_CXXALIASWARN1 (ldexp, double, (double x, int exp));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef ldexp




Reply via email to