From: Paul Eggert Date: Sun, 2 Feb 2025 23:32:15 +0000 (-0800) Subject: quotearg: pacify -Wswitch-enum X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=b00b18c2da72363089e52af2a83acea77a7b77d9;p=gnulib.git quotearg: pacify -Wswitch-enum * lib/quotearg.c (quotearg_buffer_restyled): Use switch (+E), and omit default case, to pacify gcc -Wswitch-enum. This is a good way to pacify -Wswitch-enum when we don’t want to enumerate all the enum values. Omit unnecessary ‘default: break;’s. --- diff --git a/ChangeLog b/ChangeLog index 2b02191a57..0d94556ba0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ 2025-02-02 Paul Eggert + quotearg: pacify -Wswitch-enum + * lib/quotearg.c (quotearg_buffer_restyled): Use switch (+E), and + omit default case, to pacify gcc -Wswitch-enum. This is a good + way to pacify -Wswitch-enum when we don’t want to enumerate + all the enum values. Omit unnecessary ‘default: break;’s. + test-gettext-h: check call results * tests/test-gettext-h.c: Include string.h. (main): Check return values of calls. diff --git a/lib/quotearg.c b/lib/quotearg.c index d7b549e478..a31ea3d100 100644 --- a/lib/quotearg.c +++ b/lib/quotearg.c @@ -443,7 +443,7 @@ quotearg_buffer_restyled (char *buffer, size_t buffersize, break; case '?': - switch (quoting_style) + switch (+quoting_style) { case shell_always_quoting_style: if (elide_outer_quotes) @@ -469,14 +469,8 @@ quotearg_buffer_restyled (char *buffer, size_t buffersize, STORE ('"'); STORE ('?'); break; - - default: - break; } break; - - default: - break; } break; @@ -654,9 +648,6 @@ quotearg_buffer_restyled (char *buffer, size_t buffersize, case '[': case '\\': case '^': case '`': case '|': goto force_outer_quoting_style; - - default: - break; } }