]> Savannah Git Hosting - gnulib.git/commitdiff
stdbool-c99: Ensure that 'true' can be used in the preprocessor.
authorBruno Haible <bruno@clisp.org>
Sun, 18 Sep 2022 16:45:39 +0000 (18:45 +0200)
committerBruno Haible <bruno@clisp.org>
Sun, 18 Sep 2022 17:11:17 +0000 (19:11 +0200)
* lib/stdbool.in.h (true): Redefine if it does not evaluate to 1 in the
preprocessor.

ChangeLog
lib/stdbool.in.h

index 9b20b98d4a2ceac73a061afe83885f0692526ee8..3ea944f7d249d804694806c297032331f1a10045 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2022-09-18  Bruno Haible  <bruno@clisp.org>
+
+       stdbool-c99: 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>
 
        uni{case,ctype,gbrk,str}/base: Fix installed .h file (regr. 2022-09-10).
index 36f26560af4f07b3879a8ce758dcf44ca62aac9b..834c5f7e783eafa65526a215477b58d7217598b0 100644 (file)
@@ -109,6 +109,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