bug-gnulib
[Top][All Lists]
Advanced

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

signbit: fix compilation error when gnulib's math.h exists twice


From: Bruno Haible
Subject: signbit: fix compilation error when gnulib's math.h exists twice
Date: Sat, 13 Apr 2019 01:06:48 +0200
User-agent: KMail/5.1.3 (Linux/4.4.0-141-generic; KDE/5.18.0; x86_64; ; )

When a package has two invocations of gnulib-tool, and both lead to a
<math.h> override, the two overrides conflict: The first override defines
gl_signbitf, gl_signbitd, gl_signbitld as macros, and the second override
then chokes with error messages such as:

../gnulib-lib/math.h:2858: error: expected identifier or '(' before '{' token
../gnulib-lib/math.h:2859: error: expected identifier or '(' before '{' token
../gnulib-lib/math.h:2860: error: expected identifier or '(' before '{' token


2019-04-12  Bruno Haible  <address@hidden>

        signbit: Fix compilation error when gnulib's math.h exists twice.
        * lib/math.in.h (GNULIB_defined_signbit): New macro.

diff --git a/lib/math.in.h b/lib/math.in.h
index aa03ea3..99a2c6a 100644
--- a/lib/math.in.h
+++ b/lib/math.in.h
@@ -2379,7 +2379,7 @@ _GL_WARN_REAL_FLOATING_DECL (isnan);
     sizeof (x) == sizeof (double) ? __builtin_signbit (x) : \
     __builtin_signbitf (x))
 # endif
-# if @REPLACE_SIGNBIT@
+# if @REPLACE_SIGNBIT@ && !GNULIB_defined_signbit
 #  undef signbit
 _GL_EXTERN_C int gl_signbitf (float arg);
 _GL_EXTERN_C int gl_signbitd (double arg);
@@ -2422,6 +2422,7 @@ _GL_EXTERN_C int gl_signbitl (long double arg);
    (sizeof (x) == sizeof (long double) ? gl_signbitl (x) : \
     sizeof (x) == sizeof (double) ? gl_signbitd (x) : \
     gl_signbitf (x))
+#  define GNULIB_defined_signbit 1
 # endif
 # ifdef __cplusplus
 #  if defined signbit || defined GNULIB_NAMESPACE




reply via email to

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