1
0
mirror of https://github.com/systemd/systemd.git synced 2024-10-31 16:21:26 +03:00

tree-wide: adjust fall through comments so that gcc is happy

gcc 7 adds -Wimplicit-fallthrough=3 to -Wextra. There are a few ways
we could deal with that. After we take into account the need to stay compatible
with older versions of the compiler (and other compilers), I don't think adding
__attribute__((fallthrough)), even as a macro, is worth the trouble. It sticks
out too much, a comment is just as good. But gcc has some very specific
requiremnts how the comment should look. Adjust it the specific form that it
likes. I don't think the extra stuff we had in those comments was adding much
value.

(Note: the documentation seems to be wrong, and seems to describe a different
pattern from the one that is actually used. I guess either the docs or the code
will have to change before gcc 7 is finalized.)
This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2017-01-27 00:50:10 -05:00
parent 9ce6d1b319
commit ec251fe7d5
8 changed files with 15 additions and 6 deletions

View File

@ -127,18 +127,25 @@ void siphash24_compress(const void *_in, size_t inlen, struct siphash *state) {
switch (left) {
case 7:
state->padding |= ((uint64_t) in[6]) << 48;
/* fall through */
case 6:
state->padding |= ((uint64_t) in[5]) << 40;
/* fall through */
case 5:
state->padding |= ((uint64_t) in[4]) << 32;
/* fall through */
case 4:
state->padding |= ((uint64_t) in[3]) << 24;
/* fall through */
case 3:
state->padding |= ((uint64_t) in[2]) << 16;
/* fall through */
case 2:
state->padding |= ((uint64_t) in[1]) << 8;
/* fall through */
case 1:
state->padding |= ((uint64_t) in[0]);
/* fall through */
case 0:
break;
}

View File

@ -1271,7 +1271,7 @@ bool clock_supported(clockid_t clock) {
if (!clock_boottime_supported())
return false;
/* fall through, after checking the cached value for CLOCK_BOOTTIME. */
/* fall through */
default:
/* For everything else, check properly */

View File

@ -2668,6 +2668,7 @@ const char* socket_port_type_to_string(SocketPort *p) {
if (socket_address_family(&p->address) == AF_NETLINK)
return "Netlink";
/* fall through */
default:
return NULL;
}

View File

@ -422,7 +422,8 @@ static void timer_enter_waiting(Timer *t, bool initial) {
}
/* In a container we don't want to include the time the host
* was already up when the container started, so count from
* our own startup. Fall through. */
* our own startup. */
/* fall through */
case TIMER_STARTUP:
base = UNIT(t)->manager->userspace_timestamp.monotonic;
break;

View File

@ -285,7 +285,7 @@ static int journal_file_set_online(JournalFile *f) {
continue;
/* Canceled restart from offlining, must wait for offlining to complete however. */
/* fall through to wait */
/* fall through */
default: {
int r;

View File

@ -999,7 +999,7 @@ static int client_receive_message(
break;
}
/* fall through for Soliciation Rapid Commit option check */
/* fall through */ /* for Soliciation Rapid Commit option check */
case DHCP6_STATE_REQUEST:
case DHCP6_STATE_RENEW:
case DHCP6_STATE_REBIND:

View File

@ -560,7 +560,7 @@ int device_read_uevent_file(sd_device *device) {
value = &uevent[i];
state = VALUE;
/* fall through to handle empty property */
/* fall through */ /* to handle empty property */
case VALUE:
if (strchr(NEWLINE, uevent[i])) {
uevent[i] = '\0';

View File

@ -1917,7 +1917,7 @@ static int wait_for_container(pid_t pid, ContainerStatus *container) {
return 0;
}
/* CLD_KILLED fallthrough */
/* fall through */
case CLD_DUMPED:
log_error("Container %s terminated by signal %s.", arg_machine, signal_to_string(status.si_status));