2026-05-08 Paul Eggert <eggert@cs.ucla.edu>
+ regex-tests: pacify -Wshadow
+ * tests/test-regex-en.c (main): Remove unused local.
+ Nest one of the tests, to avoid shadowing the local ‘pat’.
+
Gnulib is now safe for -Wuseless-cast
* m4/gnulib-common.m4 (gl_CC_GNULIB_WARNINGS):
Remove -Wno-useless-cast.
main (int argc, char *argv[])
{
struct re_pattern_buffer regex;
- unsigned char folded_chars[UCHAR_MAX + 1];
const char *s;
struct re_registers regs;
GNU/Linux 3.1 x86, but it might catch the bug better
on other platforms and it shouldn't hurt to try the
test here. */
- static char const pat[] = "insert into";
- static char const data[] =
- "\xFF\0\x12\xA2\xAA\xC4\xB1,K\x12\xC4\xB1*\xACK";
- re_set_syntax (RE_SYNTAX_GREP | RE_HAT_LISTS_NOT_NEWLINE
- | RE_ICASE);
- memset (®ex, 0, sizeof regex);
- s = re_compile_pattern (pat, sizeof pat - 1, ®ex);
- if (s)
- report_error ("%s: %s", pat, s);
- else
- {
- memset (®s, 0, sizeof regs);
- int ret = re_search (®ex, data, sizeof data - 1,
- 0, sizeof data - 1, ®s);
- if (ret != -1)
- report_error ("re_search '%s' on '%s' returned %d",
- pat, data, ret);
- regfree (®ex);
- free (regs.start);
- free (regs.end);
- }
+ {
+ static char const pat[] = "insert into";
+ static char const data[] =
+ "\xFF\0\x12\xA2\xAA\xC4\xB1,K\x12\xC4\xB1*\xACK";
+ re_set_syntax (RE_SYNTAX_GREP | RE_HAT_LISTS_NOT_NEWLINE
+ | RE_ICASE);
+ memset (®ex, 0, sizeof regex);
+ s = re_compile_pattern (pat, sizeof pat - 1, ®ex);
+ if (s)
+ report_error ("%s: %s", pat, s);
+ else
+ {
+ memset (®s, 0, sizeof regs);
+ int ret = re_search (®ex, data, sizeof data - 1,
+ 0, sizeof data - 1, ®s);
+ if (ret != -1)
+ report_error ("re_search '%s' on '%s' returned %d",
+ pat, data, ret);
+ regfree (®ex);
+ free (regs.start);
+ free (regs.end);
+ }
+ }
if (really_utf8 ())
{