1
0
mirror of https://github.com/osmarks/ngircd.git synced 2025-01-20 20:36:53 +00:00

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;
        |                          ~^~~~~~~~~~~~~~~~~~~~~
This commit is contained in:
Alexander Barton 2024-01-18 22:41:39 +01:00
parent 1d527eaf17
commit c83d55f758
3 changed files with 17 additions and 1 deletions

View File

@ -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;

View File

@ -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)) {

View File

@ -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 ||