diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2021-08-26 10:08:00 -0700 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2021-08-26 15:44:40 -0700 |
commit | 56b322516f8471584c8c67d2f749ae635560eeca (patch) | |
tree | bf63b196435c09a51e448097fcb41be365f71d2f /lib/regex.c | |
parent | 8fb3a827a2635915a9baa3926e6be6fad7b9ab2d (diff) | |
download | gnulib-56b322516f8471584c8c67d2f749ae635560eeca.tar.gz |
regex: use C99-style array arg syntax
This should help with some static checking.
Derived from a suggestion by Martin Sebor in:
https://sourceware.org/pipermail/libc-alpha/2021-August/130336.html
This also ports recent and relevant Glibc changes to Gnulib
and prepares to copy back.
* lib/cdefs.h (__ARG_NELTS): New macro.
* lib/regex.c: Ignore -Wvla for the whole file.
* lib/regex.h (_ARG_NELTS_, _Attr_access_): New macros.
Ignore -Wvla when declaring regexec.
* lib/regex.h (re_compile_pattern, re_search, re_search_2)
(re_match, re_match_2, regcomp, regerror):
Use _Attr_access_ where that could help static checking.
* lib/regexec.c (regexec, __compat_regexec, re_copy_regs)
(re_search_internal, proceed_next_node, push_fail_stack)
(pop_fail_stack, set_regs, update_regs):
Use __ARG_NELTS for each array parameter whose size is another arg,
but which might be null.
Diffstat (limited to 'lib/regex.c')
-rw-r--r-- | lib/regex.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/regex.c b/lib/regex.c index 7296be0f08..d32863972c 100644 --- a/lib/regex.c +++ b/lib/regex.c @@ -24,6 +24,7 @@ # if __GNUC_PREREQ (4, 6) # pragma GCC diagnostic ignored "-Wsuggest-attribute=pure" +# pragma GCC diagnostic ignored "-Wvla" # endif # if __GNUC_PREREQ (4, 3) # pragma GCC diagnostic ignored "-Wold-style-definition" |