]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
gcc: appease gcc-7's implicit fallthrough warning
authorRoy Marples <roy@marples.name>
Wed, 6 Feb 2019 19:39:00 +0000 (19:39 +0000)
committerRoy Marples <roy@marples.name>
Wed, 6 Feb 2019 19:39:00 +0000 (19:39 +0000)
We now need to define __fallthrough for one part because
cpp strips comments from preprocessed code and I don't want to
enforce needing -C in CFLAGS to avoid this.

src/common.h
src/dhcp6.c
src/if-options.c
src/if.c

index 59ca112b00129b91f15595b14498bab0188e849a..7a968d179c04088fd3cc485492f95f990be2e456 100644 (file)
 #endif
 
 #if __GNUC__ > 2 || defined(__INTEL_COMPILER)
+# ifndef __fallthrough
+#  define __fallthrough __attribute__((fallthrough))
+# endif
 # ifndef __packed
 #  define __packed __attribute__((__packed__))
 # endif
 #  define __unused __attribute__((__unused__))
 # endif
 #else
+# ifndef __fallthrough
+#  define __fallthrough
+# endif
 # ifndef __packed
 #  define __packed
 # endif
index da82c6ae247578afa5473ce0e16e3560ac54eeab..b5b035f23dad138df60962544146210d4361064c 100644 (file)
@@ -3416,6 +3416,8 @@ dhcp6_recvif(struct interface *ifp, struct dhcp6_message *r, size_t len)
                        break;
                }
                return;
+#else
+               break;
 #endif
        default:
                logerrx("%s: invalid DHCP6 type %s (%d)",
index dd10cb59bc48c0ed26121c5cc87b6bf7d14536d1..06c47b0593c741039dbb2bfe363d3d1b0e004507 100644 (file)
@@ -1422,9 +1422,13 @@ parse_option(struct dhcpcd_ctx *ctx, const char *ifname, struct if_options *ifo,
                        ia->sla = NULL;
 #endif
                }
+
+#ifdef SMALL
+               break;
+#else
                if (ia->ia_type != D6_OPTION_IA_PD)
                        break;
-#ifndef SMALL
+
                for (p = fp; p; p = fp) {
                        fp = strwhite(p);
                        if (fp) {
index e8950d7ed822d74df268b57e3ab7fa9f47bf8087..f6a7bb1eaa786ded8d07e7553c065dadfc23463f 100644 (file)
--- a/src/if.c
+++ b/src/if.c
@@ -474,7 +474,7 @@ if_discover(struct dhcpcd_ctx *ctx, struct ifaddrs **ifaddrs,
                        case IFT_PPP: /* FALLTHROUGH */
 #endif
 #ifdef IFT_PROPVIRTUAL
-                       case IFT_PROPVIRTUAL: /* FALLTHROUGH */
+                       case IFT_PROPVIRTUAL:
 #endif
 #if defined(IFT_BRIDGE) || defined(IFT_PPP) || defined(IFT_PROPVIRTUAL)
                                /* Don't allow unless explicit */
@@ -488,6 +488,7 @@ if_discover(struct dhcpcd_ctx *ctx, struct ifaddrs **ifaddrs,
                                            ifp->name);
                                        active = IF_INACTIVE;
                                }
+                               __fallthrough; /* Appease gcc-7 */
                                /* FALLTHROUGH */
 #endif
 #ifdef IFT_L2VLAN