bug-gnulib@gnu.org mirror (unofficial)
 help / color / mirror / code / Atom feed
* unitypes: Fix trouble caused by installed older versions of unitypes.h
@ 2021-06-20  1:18 Bruno Haible
  0 siblings, 0 replies; only message in thread
From: Bruno Haible @ 2021-06-20  1:18 UTC (permalink / raw)
  To: bug-gnulib

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)
 



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-06-20  1:19 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-20  1:18 unitypes: Fix trouble caused by installed older versions of unitypes.h Bruno Haible

Code repositories for project(s) associated with this inbox:

	../../../mirrors/gnulib.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).