On 2025-04-13 20:39, Paul Eggert wrote:

   - Will they change RE_BACKSLASH_ESCAPE_IN_LISTS from
       ((unsigned long int) 1)
     to
       (1UL)
     in order to make the RE_* values usable in preprocessor expressions?

No; I followed up with a later patch to remove that assumption.

Oops, sorry, I misunderstood your comment. You're right, we need a patch to do that. I just installed the attached .
From 23c09f69c9d6e43d614934c4de94c294a811fdf0 Mon Sep 17 00:00:00 2001
From: Paul Eggert <egg...@cs.ucla.edu>
Date: Sun, 13 Apr 2025 20:47:54 -0700
Subject: [PATCH] regex: make RE_* usable in #if

* lib/regex.h (RE_BACKSLASH_ESCAPE_IN_LISTS):
Define to 1ul so that the RE_* macros can be used in #if.
---
 ChangeLog   | 2 ++
 lib/regex.h | 2 +-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index e202b14530..210be85262 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -3,6 +3,8 @@
 	regex: pacify gcc -Wcalloc-transposed-args
 	* lib/regcomp.c (init_dfa, parse_bracket_exp)
 	(build_charclass_op):
+	* lib/regex.h (RE_BACKSLASH_ESCAPE_IN_LISTS):
+	Define to 1ul so that the RE_* macros can be used in #if.
 	* lib/regex_internal.c (create_ci_newstate, create_cd_newstate):
 	* lib/regexec.c (get_subexp, build_trtable):
 	When calling calloc, put size argument last.
diff --git a/lib/regex.h b/lib/regex.h
index c4c6089a8c..ff7e43b534 100644
--- a/lib/regex.h
+++ b/lib/regex.h
@@ -73,7 +73,7 @@ typedef unsigned long int reg_syntax_t;
 #ifdef __USE_GNU
 /* If this bit is not set, then \ inside a bracket expression is literal.
    If set, then such a \ quotes the following character.  */
-# define RE_BACKSLASH_ESCAPE_IN_LISTS ((unsigned long int) 1)
+# define RE_BACKSLASH_ESCAPE_IN_LISTS 1ul
 
 /* If this bit is not set, then + and ? are operators, and \+ and \? are
      literals.
-- 
2.45.2

Reply via email to