Browse Source

dpkg: Add a comment on any switch case that falls through

Warned-by: gcc-7
Guillem Jover 7 years ago
parent
commit
63bf769375
3 changed files with 7 additions and 2 deletions
  1. 2 0
      debian/changelog
  2. 1 0
      src/archives.c
  3. 4 2
      src/depcon.c

+ 2 - 0
debian/changelog

@@ -7,6 +7,8 @@ dpkg (1.18.23) UNRELEASED; urgency=medium
     the same “__cxxabiv1” namespace as specified in the C++ ABI, instead
     of using the “abi” alias intended for use by userland.
     Thanks to Jörg Sonnenberger <joerg@netbsd.org>.
+  * Add a comment on any C code switch case that falls through. Fixes new
+    gcc-7 warnings.
   * Portability:
     - Do not redeclare sys_siglist in libcompat when the system does so.
       Thanks to Thomas Klausner <wiz@NetBSD.org>.

+ 1 - 0
src/archives.c

@@ -851,6 +851,7 @@ tarobject(void *ctx, struct tar_entry *ti)
       switch (otherpkg->clientdata->replacingfilesandsaid) {
       case 2:
         keepexisting = true;
+        /* Fall through. */
       case 1:
         continue;
       }

+ 4 - 2
src/depcon.c

@@ -420,8 +420,7 @@ depisok(struct dependency *dep, struct varbuf *whynot,
           case PKG_STAT_TRIGGERSAWAITED:
               if (canfixbytrigaw && versionsatisfied(&pkg_pos->installed, possi))
                 *canfixbytrigaw = pkg_pos;
-              /* Fall through to have a chance to return OK due to
-               * allowunconfigd and to fill the explanation */
+              /* Fall through. */
           case PKG_STAT_UNPACKED:
           case PKG_STAT_HALFCONFIGURED:
             if (allowunconfigd) {
@@ -581,6 +580,7 @@ depisok(struct dependency *dep, struct varbuf *whynot,
           case PKG_STAT_HALFCONFIGURED:
             if (dep->type == dep_breaks)
               break; /* No problem. */
+            /* Fall through. */
           case PKG_STAT_INSTALLED:
           case PKG_STAT_TRIGGERSPENDING:
           case PKG_STAT_TRIGGERSAWAITED:
@@ -651,6 +651,7 @@ depisok(struct dependency *dep, struct varbuf *whynot,
         case PKG_ISTOBE_DECONFIGURE:
           if (dep->type == dep_breaks)
             continue; /* Already deconfiguring. */
+          /* Fall through. */
         case PKG_ISTOBE_NORMAL:
         case PKG_ISTOBE_PREINSTALL:
           switch (provider->up->up->status) {
@@ -662,6 +663,7 @@ depisok(struct dependency *dep, struct varbuf *whynot,
           case PKG_STAT_HALFCONFIGURED:
             if (dep->type == dep_breaks)
               break; /* No problem. */
+            /* Fall through. */
           case PKG_STAT_INSTALLED:
           case PKG_STAT_TRIGGERSPENDING:
           case PKG_STAT_TRIGGERSAWAITED: