+2025-04-13 Paul Eggert <eggert@cs.ucla.edu>
+
+ regex: match current Emacs behavior
+ * config/srclist.txt: Comment out regex.h, since we now
+ disagree with glibc.
+ * lib/regex.h (RE_SYNTAX_EMACS):
+ Match Emacs 21+ behavior, not Emacs 20-.
+ * m4/regex.m4 (gl_REGEX): Check for this Emacs fix.
+
2025-04-13 Bruno Haible <bruno@clisp.org>
getlogin_r tests: Avoid writing to a literal string.
#$LIBCSRC misc/sys/cdefs.h lib
#$LIBCSRC posix/regcomp.c lib
$LIBCSRC posix/regex.c lib
-$LIBCSRC posix/regex.h lib
+#$LIBCSRC posix/regex.h lib
#$LIBCSRC posix/regex_internal.c lib
#$LIBCSRC posix/regex_internal.h lib
#$LIBCSRC posix/regexec.c lib
The predefined syntaxes---taken directly from @file{regex.h}---are:
@smallexample
-#define RE_SYNTAX_EMACS 0
+# define RE_SYNTAX_EMACS \
+ (RE_CHAR_CLASSES | RE_INTERVALS)
#define RE_SYNTAX_AWK \
(RE_BACKSLASH_ESCAPE_IN_LISTS | RE_DOT_NOT_NULL \
/* The following bits are used to determine the regexp syntax we
recognize. The set/not-set meanings are chosen so that Emacs syntax
- remains the value 0. The bits are given in alphabetical order, and
- the definitions shifted by one from the previous bit; thus, when we
- add or remove a bit, only one other definition need change. */
+ is the value 0 for Emacs 20 (2000) and earlier, and the value
+ RE_SYNTAX_EMACS for Emacs 21 (2001) and later. */
typedef unsigned long int reg_syntax_t;
#ifdef __USE_GNU
(The [[[ comments delimit what gets put into the Texinfo file, so
don't delete them!) */
/* [[[begin syntaxes]]] */
-# define RE_SYNTAX_EMACS 0
+# define RE_SYNTAX_EMACS \
+ (RE_CHAR_CLASSES | RE_INTERVALS)
# define RE_SYNTAX_AWK \
(RE_BACKSLASH_ESCAPE_IN_LISTS | RE_DOT_NOT_NULL \
# regex.m4
-# serial 78
+# serial 79
dnl Copyright (C) 1996-2001, 2003-2025 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
/* Exit with distinguishable exit code. */
static void sigabrt_no_core (int sig) { raise (SIGTERM); }
#endif
+
+ #if RE_SYNTAX_EMACS != (RE_CHAR_CLASSES | RE_INTERVALS)
+ # error "RE_SYNTAX_EMACS does not match Emacs behavior"
+ #endif
]],
[[int result = 0;
static struct re_pattern_buffer regex;