bug-gnulib
[Top][All Lists]
Advanced

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

unitypes: Fix trouble caused by installed older versions of unitypes.h


From: Bruno Haible
Subject: unitypes: Fix trouble caused by installed older versions of unitypes.h
Date: Sun, 20 Jun 2021 03:18:50 +0200
User-agent: KMail/5.1.3 (Linux/4.4.0-210-generic; KDE/5.18.0; x86_64; ; )

When building code that using unistr.h, which depends on unitypes.h,
on a machine that has an older libunistring installed, I get these compilation
errors:

"../gnulib-lib/unistr.h", line 377.38: 1506-275 (S) Unexpected text dest 
encountered.
"../gnulib-lib/unistr.h", line 379.40: 1506-275 (S) Unexpected text dest 
encountered.
"../gnulib-lib/unistr.h", line 381.40: 1506-275 (S) Unexpected text dest 
encountered.
"../gnulib-lib/unistr.h", line 532.41: 1506-275 (S) Unexpected text dest 
encountered.
"../gnulib-lib/unistr.h", line 534.43: 1506-275 (S) Unexpected text dest 
encountered.
"../gnulib-lib/unistr.h", line 536.43: 1506-275 (S) Unexpected text dest 
encountered.
"../gnulib-lib/unistr.h", line 541.41: 1506-275 (S) Unexpected text dest 
encountered.
"../gnulib-lib/unistr.h", line 543.43: 1506-275 (S) Unexpected text dest 
encountered.
"../gnulib-lib/unistr.h", line 545.43: 1506-275 (S) Unexpected text dest 
encountered.
"../gnulib-lib/unistr.h", line 550.42: 1506-275 (S) Unexpected text dest 
encountered.
"../gnulib-lib/unistr.h", line 552.44: 1506-275 (S) Unexpected text dest 
encountered.
"../gnulib-lib/unistr.h", line 554.44: 1506-275 (S) Unexpected text dest 
encountered.
"../gnulib-lib/unistr.h", line 560.42: 1506-275 (S) Unexpected text dest 
encountered.
"../gnulib-lib/unistr.h", line 562.44: 1506-275 (S) Unexpected text dest 
encountered.
"../gnulib-lib/unistr.h", line 564.44: 1506-275 (S) Unexpected text dest 
encountered.
"../gnulib-lib/unistr.h", line 569.41: 1506-275 (S) Unexpected text dest 
encountered.
"../gnulib-lib/unistr.h", line 571.43: 1506-275 (S) Unexpected text dest 
encountered.
"../gnulib-lib/unistr.h", line 573.43: 1506-275 (S) Unexpected text dest 
encountered.
"../gnulib-lib/unistr.h", line 578.42: 1506-275 (S) Unexpected text dest 
encountered.
"../gnulib-lib/unistr.h", line 580.44: 1506-275 (S) Unexpected text dest 
encountered.

The cause is that uniname.h has been included from the install location,
which included "unitypes.h" also from the install location. So, the
unitypes.h file in the build directory was ignored.

It is hard to come up with a general fix of this; but this workaround
fixes the issue.


2021-06-19  Bruno Haible  <bruno@clisp.org>

        unitypes: Fix trouble caused by installed older versions of unitypes.h.
        * modules/unitypes (configure.ac): Define _UC_RESTRICT through config.h.

diff --git a/modules/unitypes b/modules/unitypes
index 8d3ccf0..46ed80d 100644
--- a/modules/unitypes
+++ b/modules/unitypes
@@ -11,6 +11,22 @@ stdint
 configure.ac:
 gl_LIBUNISTRING_LIBHEADER([0.9.11], [unitypes.h])
 
+AH_VERBATIM([unitypes_restrict], [
+/* This definition is a duplicate of the one in unitypes.h.
+   It is here so that we can cope with an older version of unitypes.h
+   that does not contain this definition and that is pre-installed among
+   the public header files.  */
+# if defined __restrict \
+     || 2 < __GNUC__ + (95 <= __GNUC_MINOR__) \
+     || __clang_major__ >= 3
+#  define _UC_RESTRICT __restrict
+# elif 199901L <= __STDC_VERSION__ || defined restrict
+#  define _UC_RESTRICT restrict
+# else
+#  define _UC_RESTRICT
+# endif
+])
+
 Makefile.am:
 BUILT_SOURCES += $(LIBUNISTRING_UNITYPES_H)
 




reply via email to

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