diff options
| author | Alexander Barton <alex@barton.de> | 2024-01-18 22:41:39 +0100 |
|---|---|---|
| committer | Alexander Barton <alex@barton.de> | 2024-01-18 22:49:48 +0100 |
| commit | c83d55f75884130367f9d3f4db262bccb2049abe (patch) | |
| tree | f57906d663942c263f074634f2a073c97f714cd5 | |
| parent | 1d527eaf17435089e70b530955e271bbd0440fe4 (diff) | |
| download | ngircd-c83d55f75884130367f9d3f4db262bccb2049abe.tar.gz ngircd-c83d55f75884130367f9d3f4db262bccb2049abe.zip | |
Annotate "fall through" cases to silence warnings
Add a "/* fall through */" annotation to "case" statements which
actually should "fall through" to silences GCC warning like this:
hash.c: In function ‘jenkins_hash’:
hash.c:110:27: warning: this statement may fall through
[-Wimplicit-fallthrough=]
110 | case 12: c+=((UINT32)k[11])<<24;
| ~^~~~~~~~~~~~~~~~~~~~~
| -rw-r--r-- | src/ngircd/hash.c | 11 | ||||
| -rw-r--r-- | src/ngircd/irc-info.c | 2 | ||||
| -rw-r--r-- | src/ngircd/irc-mode.c | 5 |
3 files changed, 17 insertions, 1 deletions
diff --git a/src/ngircd/hash.c b/src/ngircd/hash.c index cdac5e8d..c078443b 100644 --- a/src/ngircd/hash.c +++ b/src/ngircd/hash.c @@ -108,16 +108,27 @@ jenkins_hash(UINT8 *k, UINT32 length, UINT32 initval) { case 12: c+=((UINT32)k[11])<<24; + /* fall through */ case 11: c+=((UINT32)k[10]<<16); + /* fall through */ case 10: c+=((UINT32)k[9]<<8); + /* fall through */ case 9 : c+=k[8]; + /* fall through */ case 8 : b+=((UINT32)k[7]<<24); + /* fall through */ case 7 : b+=((UINT32)k[6]<<16); + /* fall through */ case 6 : b+=((UINT32)k[5]<<8); + /* fall through */ case 5 : b+=k[4]; + /* fall through */ case 4 : a+=((UINT32)k[3]<<24); + /* fall through */ case 3 : a+=((UINT32)k[2]<<16); + /* fall through */ case 2 : a+=((UINT32)k[1]<<8); + /* fall through */ case 1 : a+=k[0]; break; case 0 : return c; diff --git a/src/ngircd/irc-info.c b/src/ngircd/irc-info.c index 8fcd1b11..9a531bb0 100644 --- a/src/ngircd/irc-info.c +++ b/src/ngircd/irc-info.c @@ -910,7 +910,7 @@ IRC_STATS( CLIENT *Client, REQUEST *Req ) if (!Op_Check(from, Req)) return Op_NoPrivileges(from, Req); more_links = true; - + /* fall through */ case 'l': /* Link status (servers and own link) */ time_now = time(NULL); for (con = Conn_First(); con != NONE; con = Conn_Next(con)) { diff --git a/src/ngircd/irc-mode.c b/src/ngircd/irc-mode.c index b505aee5..89a07042 100644 --- a/src/ngircd/irc-mode.c +++ b/src/ngircd/irc-mode.c @@ -575,6 +575,7 @@ Channel_Mode(CLIENT *Client, REQUEST *Req, CLIENT *Origin, CHANNEL *Channel) Client_ID(Origin), Channel_Name(Channel)); goto chan_exit; } + /* fall through */ case 'i': /* Invite only */ case 'V': /* Invite disallow */ case 'M': /* Only identified nicks can write */ @@ -747,6 +748,7 @@ Channel_Mode(CLIENT *Client, REQUEST *Req, CLIENT *Origin, CHANNEL *Channel) Channel_Name(Channel)); goto chan_exit; } + /* fall through */ case 'a': /* Channel admin */ if(!is_oper && !is_machine && !is_owner && !is_admin) { connected = IRC_WriteErrClient(Origin, @@ -755,6 +757,7 @@ Channel_Mode(CLIENT *Client, REQUEST *Req, CLIENT *Origin, CHANNEL *Channel) Channel_Name(Channel)); goto chan_exit; } + /* fall through */ case 'o': /* Channel operator */ if(!is_oper && !is_machine && !is_owner && !is_admin && !is_op) { @@ -764,6 +767,7 @@ Channel_Mode(CLIENT *Client, REQUEST *Req, CLIENT *Origin, CHANNEL *Channel) Channel_Name(Channel)); goto chan_exit; } + /* fall through */ case 'h': /* Half Op */ if(!is_oper && !is_machine && !is_owner && !is_admin && !is_op) { @@ -773,6 +777,7 @@ Channel_Mode(CLIENT *Client, REQUEST *Req, CLIENT *Origin, CHANNEL *Channel) Channel_Name(Channel)); goto chan_exit; } + /* fall through */ case 'v': /* Voice */ if (arg_arg > mode_arg) { if (is_oper || is_machine || is_owner || |