From: Roy Marples Date: Wed, 6 Feb 2019 19:39:00 +0000 (+0000) Subject: gcc: appease gcc-7's implicit fallthrough warning X-Git-Tag: v7.1.1~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d210717aae06367698d607408eab1877e906146d;p=thirdparty%2Fdhcpcd.git gcc: appease gcc-7's implicit fallthrough warning 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. --- diff --git a/src/common.h b/src/common.h index 59ca112b..7a968d17 100644 --- a/src/common.h +++ b/src/common.h @@ -115,6 +115,9 @@ #endif #if __GNUC__ > 2 || defined(__INTEL_COMPILER) +# ifndef __fallthrough +# define __fallthrough __attribute__((fallthrough)) +# endif # ifndef __packed # define __packed __attribute__((__packed__)) # endif @@ -122,6 +125,9 @@ # define __unused __attribute__((__unused__)) # endif #else +# ifndef __fallthrough +# define __fallthrough +# endif # ifndef __packed # define __packed # endif diff --git a/src/dhcp6.c b/src/dhcp6.c index da82c6ae..b5b035f2 100644 --- a/src/dhcp6.c +++ b/src/dhcp6.c @@ -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)", diff --git a/src/if-options.c b/src/if-options.c index dd10cb59..06c47b05 100644 --- a/src/if-options.c +++ b/src/if-options.c @@ -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) { diff --git a/src/if.c b/src/if.c index e8950d7e..f6a7bb1e 100644 --- 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