From e0cfd39728b58e6edb4fe963267397bee5c24c6c Mon Sep 17 00:00:00 2001 From: Jesse Smith Date: Fri, 4 May 2018 14:51:40 -0300 Subject: [PATCH] Added "Fall through" comments to some switch statements where multiple approaches are tried in order to prevent warnings from GCC 7 (and newer). Added includes on Linux for sys/sysmacros.h as the old defines in the sys/types.h file will be removed in the future. --- doc/Changelog | 4 ++++ src/consoles.c | 1 + src/hddown.c | 1 + src/init.c | 1 + src/killall5.c | 1 + src/shutdown.c | 3 +++ src/sulogin.c | 3 +++ 7 files changed, 14 insertions(+) diff --git a/doc/Changelog b/doc/Changelog index 05903f9..8744731 100644 --- a/doc/Changelog +++ b/doc/Changelog @@ -25,6 +25,10 @@ sysvinit (2.90) UNRELEASED; urgency=low can be used to make sure init does not have any files open. However, it also means we cannot switch run levels or bring down the system. The pipe can be re-opened by sending init the SIGUSR1 signal. + * Added "Fall through" comments to some switch statements where multiple + approaches are tried in order to prevent warnings from GCC 7 (and newer). + * Added includes on Linux for sys/sysmacros.h as the old defines in + the sys/types.h file will be removed in the future. sysvinit (2.89) world; urgency=low diff --git a/src/consoles.c b/src/consoles.c index 2a28f0f..9d3538e 100644 --- a/src/consoles.c +++ b/src/consoles.c @@ -33,6 +33,7 @@ # include # include # include +#include #endif #include #include diff --git a/src/hddown.c b/src/hddown.c index 0039444..7a2cf28 100644 --- a/src/hddown.c +++ b/src/hddown.c @@ -233,6 +233,7 @@ static int do_standby_disk(char *device, unsigned int flags) case DISK_EXTFLUSH: if ((ret = ioctl(fd, HDIO_DRIVE_CMD, &flush1)) == 0) break; + /* Else Fall through */ /* Extend flush rejected, try standard flush */ default: ret = ioctl(fd, HDIO_DRIVE_CMD, &flush2) && diff --git a/src/init.c b/src/init.c index 3d78b32..455ebc3 100644 --- a/src/init.c +++ b/src/init.c @@ -1318,6 +1318,7 @@ void startup(CHILD *ch) case POWERFAIL: case ONCE: if (ch->flags & XECUTED) break; + /* Fall through */ case ONDEMAND: case RESPAWN: ch->flags |= RUNNING; diff --git a/src/killall5.c b/src/killall5.c index 2db8614..9b99495 100644 --- a/src/killall5.c +++ b/src/killall5.c @@ -653,6 +653,7 @@ int readproc(int do_stat) case DO_NETFS: if ((p->nfs = check4nfs(path, buf))) goto link; + /* else fall through */ case DO_STAT: if (stat(path, &st) != 0) { char * ptr; diff --git a/src/shutdown.c b/src/shutdown.c index 548b67f..0829a36 100644 --- a/src/shutdown.c +++ b/src/shutdown.c @@ -41,6 +41,9 @@ #include #include #include +#ifdef __linux__ +#include /* brought in my LFS patch */ +#endif #include #include #include diff --git a/src/sulogin.c b/src/sulogin.c index 57bea92..483fce6 100644 --- a/src/sulogin.c +++ b/src/sulogin.c @@ -32,6 +32,9 @@ #include #include #include +#ifdef __linux__ +#include +#endif #include #include #include