From: Paul Eggert Date: Sat, 9 May 2026 01:46:02 +0000 (-0700) Subject: regex-tests: pacify -Wshadow X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d849a2828aabc5bcb4cc90043dc749071fe7e87f;p=thirdparty%2Fgnulib.git regex-tests: pacify -Wshadow * tests/test-regex-en.c (main): Remove unused local. Nest one of the tests, to avoid shadowing the local ‘pat’. --- diff --git a/ChangeLog b/ChangeLog index 4b6abd889d..e555d66ed9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2026-05-08 Paul Eggert + 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. diff --git a/tests/test-regex-en.c b/tests/test-regex-en.c index ad3790ce10..7317961bc5 100644 --- a/tests/test-regex-en.c +++ b/tests/test-regex-en.c @@ -165,7 +165,6 @@ int main (int argc, char *argv[]) { struct re_pattern_buffer regex; - unsigned char folded_chars[UCHAR_MAX + 1]; const char *s; struct re_registers regs; @@ -191,27 +190,29 @@ main (int argc, char *argv[]) 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 ()) {