>From e73f9ba6b3286e4cf570c77cd38f6ceff00653ba Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sun, 18 Sep 2022 18:45:39 +0200 Subject: [PATCH 1/2] 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. --- ChangeLog | 6 ++++++ lib/stdbool.in.h | 7 +++++++ 2 files changed, 13 insertions(+) diff --git a/ChangeLog b/ChangeLog index 9b20b98d4a..3ea944f7d2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2022-09-18 Bruno Haible + + 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 uni{case,ctype,gbrk,str}/base: Fix installed .h file (regr. 2022-09-10). diff --git a/lib/stdbool.in.h b/lib/stdbool.in.h index 36f26560af..834c5f7e78 100644 --- a/lib/stdbool.in.h +++ b/lib/stdbool.in.h @@ -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 -- 2.34.1