summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2022-09-18 18:45:39 +0200
committerBruno Haible <bruno@clisp.org>2022-09-18 21:24:36 +0200
commit64b2b36762ac434e74bd5c65c1ac7a8fdd3c9788 (patch)
treebfead63e01441b05841b33ef1d48842bba145293
parenta945847ddc036d188e23a3e6cde7ba5364c628bf (diff)
downloadgnulib-64b2b36762ac434e74bd5c65c1ac7a8fdd3c9788.tar.gz
stdbool: Ensure that 'true' can be used in the preprocessor.
* lib/stdbool.in.h (true): Redefine if it does not evaluate to 1 in the preprocessor.
-rw-r--r--ChangeLog6
-rw-r--r--lib/stdbool.in.h7
2 files changed, 13 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index a3cd50b84f..a5c9606cc8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
2022-09-18 Bruno Haible <bruno@clisp.org>
+ stdbool: Ensure that 'true' can be used in the preprocessor.
+ * lib/stdbool.in.h (true): Redefine if it does not evaluate to 1 in the
+ preprocessor.
+
+2022-09-18 Bruno Haible <bruno@clisp.org>
+
signal: Fix a C++ compilation error due to sched_yield on OpenBSD 6.0.
* lib/signal.in.h: On OpenBSD, include <sys/param.h>. Don't include
<pthread.h> on OpenBSD ≥ 5.1.
diff --git a/lib/stdbool.in.h b/lib/stdbool.in.h
index b1613d4f02..125de5a25e 100644
--- a/lib/stdbool.in.h
+++ b/lib/stdbool.in.h
@@ -126,6 +126,13 @@ typedef enum { _Bool_must_promote_to_int = -1, false = 0, true = 1 } _Bool;
# define false false
# define true true
# endif
+/* In Sun C++ 5.11 (Solaris Studio 12.2) and older, 'true' as a preprocessor
+ expression evaluates to 0, not 1. Fix this by overriding 'true'. Note that
+ the replacement has to be of type 'bool'. */
+# if defined __SUNPRO_CC && true != 1
+# undef true
+# define true (!false)
+# endif
#else
# define false 0
# define true 1