summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2022-09-18 22:12:23 +0200
committerBruno Haible <bruno@clisp.org>2022-09-18 22:12:23 +0200
commitecfb8c2c54348669b54bb39f55dfd282b60980d9 (patch)
tree31b4ddf13764d9850c89ca635c01fd231a0e1b73
parent7c2834fb49945d6cbf4b7410cc68abf2a21e0296 (diff)
downloadlibunistring-ecfb8c2c54348669b54bb39f55dfd282b60980d9.tar.gz
stdbool.mini.h: Improvements for MSVC 14 and Sun C++.
Applies gnulib changes 2022-09-04 Bruno Haible <bruno@clisp.org> * stdbool.in.h (_Bool, bool, false, true): In C++ mode with MSVC 14, don't define these as macros. 2022-09-18 Bruno Haible <bruno@clisp.org> * stdbool.in.h (true): Redefine if it does not evaluate to 1 in the preprocessor.
-rw-r--r--ChangeLog11
-rw-r--r--lib/stdbool.mini.h15
2 files changed, 23 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index f570f2a..0da0b8c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2022-09-18 Bruno Haible <bruno@clisp.org>
+
+ stdbool.mini.h: Improvements for MSVC 14 and Sun C++.
+ Applies gnulib changes
+ 2022-09-04 Bruno Haible <bruno@clisp.org>
+ * stdbool.in.h (_Bool, bool, false, true): In C++ mode with
+ MSVC 14, don't define these as macros.
+ 2022-09-18 Bruno Haible <bruno@clisp.org>
+ * stdbool.in.h (true): Redefine if it does not evaluate to 1 in
+ the preprocessor.
+
2022-07-18 Bruno Haible <bruno@clisp.org>
Move gnulib-tool invocation back from autopull.sh to autogen.sh.
diff --git a/lib/stdbool.mini.h b/lib/stdbool.mini.h
index 29736b7..7bdec72 100644
--- a/lib/stdbool.mini.h
+++ b/lib/stdbool.mini.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001-2003, 2006-2017 Free Software Foundation, Inc.
+/* Copyright (C) 2001-2003, 2006-2022 Free Software Foundation, Inc.
Written by Bruno Haible <haible@clisp.cons.org>, 2001.
This program is free software; you can redistribute it and/or modify
@@ -96,8 +96,17 @@
/* The other macros must be usable in preprocessor directives. */
#ifdef __cplusplus
-# define false false
-# define true true
+# if !defined _MSC_VER
+# 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
# undef false
# define false 0