]> Savannah Git Hosting - gnulib.git/commitdiff
quotearg: pacify -Wswitch-enum
authorPaul Eggert <eggert@cs.ucla.edu>
Sun, 2 Feb 2025 23:32:15 +0000 (15:32 -0800)
committerPaul Eggert <eggert@cs.ucla.edu>
Sun, 2 Feb 2025 23:36:13 +0000 (15:36 -0800)
* 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.

ChangeLog
lib/quotearg.c

index 2b02191a57d3711b6189349770d7ed04ba70a319..0d94556ba02b1ef14235134116f11d5523d852e3 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2025-02-02  Paul Eggert  <eggert@cs.ucla.edu>
 
+       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.
index d7b549e4786ac00fad6865e92c31d064dbe75713..a31ea3d1003dee779a9a0b603e7d965fcb8784c9 100644 (file)
@@ -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;
                                 }
                           }