[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
float: Fix compilation error when gnulib's float.h exists twice
From: |
Bruno Haible |
Subject: |
float: Fix compilation error when gnulib's float.h exists twice |
Date: |
Sun, 20 Dec 2020 14:44:48 +0100 |
User-agent: |
KMail/5.1.3 (Linux/4.4.0-197-generic; KDE/5.18.0; x86_64; ; ) |
Santiago Vila reported a build of gettext-0.21, which failed due to gnulib's
generated float.h:
/bin/bash ../libtool --tag=CC --mode=compile gcc
-DLOCALEDIR=\"/usr/share/locale\" -DBISON_LOCALEDIR=\"/usr/share/locale\"
-DLOCALE_ALIAS_PATH=\"/usr/share/locale\" -DUSEJAVA=0
-DGETTEXTJAR=\"/usr/share/gettext/gettext.jar\"
-DLIBDIR=\"/usr/lib/powerpc64le-linux-gnu\"
-DGETTEXTDATADIR=\"/usr/share/gettext\"
-DPROJECTSDIR=\"/usr/share/gettext/projects\" -DEXEEXT=\"\" -DHAVE_CONFIG_H -I.
-I.. -I. -I. -I.. -I.. -I../libgrep -I../gnulib-lib -I../gnulib-lib -I../intl
-I../../gettext-runtime/intl -I../libgettextpo -I../libgettextpo
-I///usr/include/libxml2 -Wdate-time -D_FORTIFY_SOURCE=2 -g -O2
-fdebug-prefix-map=/<<PKGBUILDDIR>>=. -fstack-protector-strong -Wformat
-Werror=format-security -c -o libgettextsrc_la-format-kde-kuit.lo `test -f
'format-kde-kuit.c' || echo './'`format-kde-kuit.c
libtool: compile: gcc -DLOCALEDIR=\"/usr/share/locale\"
-DBISON_LOCALEDIR=\"/usr/share/locale\"
-DLOCALE_ALIAS_PATH=\"/usr/share/locale\" -DUSEJAVA=0
-DGETTEXTJAR=\"/usr/share/gettext/gettext.jar\"
-DLIBDIR=\"/usr/lib/powerpc64le-linux-gnu\"
-DGETTEXTDATADIR=\"/usr/share/gettext\"
-DPROJECTSDIR=\"/usr/share/gettext/projects\" -DEXEEXT=\"\" -DHAVE_CONFIG_H -I.
-I.. -I. -I. -I.. -I.. -I../libgrep -I../gnulib-lib -I../gnulib-lib -I../intl
-I../../gettext-runtime/intl -I../libgettextpo -I../libgettextpo
-I///usr/include/libxml2 -Wdate-time -D_FORTIFY_SOURCE=2 -g -O2
-fdebug-prefix-map=/<<PKGBUILDDIR>>=. -fstack-protector-strong -Wformat
-Werror=format-security -c format-kde-kuit.c -fPIC -DPIC -o
.libs/libgettextsrc_la-format-kde-kuit.o
In file included from /usr/include/unicode/utypes.h:41,
from /usr/include/unicode/ucnv_err.h:88,
from /usr/include/unicode/ucnv.h:52,
from ///usr/include/libxml2/libxml/encoding.h:31,
from ///usr/include/libxml2/libxml/parser.h:810,
from format-kde-kuit.c:43:
../gnulib-lib/float.h:150:7: error: redefinition of ‘union gl_long_double_union’
150 | union gl_long_double_union
| ^~~~~~~~~~~~~~~~~~~~
In file included from ../gnulib-lib/float.h:27,
from /usr/include/unicode/utypes.h:41,
from /usr/include/unicode/ucnv_err.h:88,
from /usr/include/unicode/ucnv.h:52,
from ///usr/include/libxml2/libxml/encoding.h:31,
from ///usr/include/libxml2/libxml/parser.h:810,
from format-kde-kuit.c:43:
../libgettextpo/float.h:150:7: note: originally defined here
150 | union gl_long_double_union
| ^~~~~~~~~~~~~~~~~~~~
This patch should fix it.
2020-12-20 Bruno Haible <bruno@clisp.org>
float: Fix compilation error when gnulib's float.h exists twice.
Reported by Santiago Vila <sanvila@unex.es>.
* lib/float.in.h (GNULIB_defined_long_double_union): New macro.
diff --git a/lib/float.in.h b/lib/float.in.h
index 8e4d47d..7988cc7 100644
--- a/lib/float.in.h
+++ b/lib/float.in.h
@@ -93,11 +93,14 @@
extern const long double LDBL_MAX;
Unfortunately, this is not a constant expression. */
+# if !GNULIB_defined_long_double_union
union gl_long_double_union
{
struct { unsigned int lo; unsigned int hi; unsigned int exponent; } xd;
long double ld;
};
+# define GNULIB_defined_long_double_union 1
+# endif
extern const union gl_long_double_union gl_LDBL_MAX;
# define LDBL_MAX (gl_LDBL_MAX.ld)
/* Minimum e such that 10^e is in the range of normalized numbers. */
- float: Fix compilation error when gnulib's float.h exists twice,
Bruno Haible <=