]> git.ipfire.org Git - thirdparty/gnulib.git/commitdiff
maint: allow false/true in C macros
authorPaul Eggert <eggert@cs.ucla.edu>
Sun, 7 Sep 2025 23:34:43 +0000 (16:34 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Sun, 7 Sep 2025 23:34:43 +0000 (16:34 -0700)
* top/maint.mk (sc_Wundef_boolean): Allow false and true in C
macro definiens.  C23 requires support for false and true, and the
‘bool’ module makes it easy to support this in older compilers.

ChangeLog
top/maint.mk

index 2ff90ef8b74c2cf98658c70b21a8b660a6ff97b3..0c132816f4076ca72a0439082b32c905cc51f8a1 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2025-09-07  Paul Eggert  <eggert@cs.ucla.edu>
+
+       maint: allow false/true in C macros
+       * top/maint.mk (sc_Wundef_boolean): Allow false and true in C
+       macro definiens.  C23 requires support for false and true, and the
+       ‘bool’ module makes it easy to support this in older compilers.
+
 2025-09-07  Bruno Haible  <bruno@clisp.org>
 
        bootstrap: Improve efficiency of "git clone".
index e03e887cbafcbba1c9c00baaa8ed69863b49f775..1a6511b4f8f41a2d2ee3deeb24b19b11d90f7f49 100644 (file)
@@ -1454,10 +1454,13 @@ sc_prohibit_reversed_compare_failure:
 # That would be flagged by using -Wundef, however gnulib currently
 # tests many undefined macros, and so we can't enable that option.
 # So at least preclude common boolean strings as macro values.
+# Although this rule formerly also complained about 'true' and 'false',
+# that complaint is now incorrect given that C23 has blessed this practice
+# and the 'bool' module supports it.
 sc_Wundef_boolean:
-       @prohibit='^#define.*(yes|no|true|false)$$'                     \
+       @prohibit='^#define.*(yes|no)$$'                                \
        in_files='$(CONFIG_INCLUDE)'                                    \
-       halt='Use 0 or 1 for macro values'                              \
+       halt='Use 0/1 or false/true for macro values'                   \
          $(_sc_search_regexp)
 
 # Even if you use pathmax.h to guarantee that PATH_MAX is defined, it might