1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-03-09 15:50:02 +00:00

Fix many GCC -Wimplicit-fallthrough warnings (#243)

This commit adds '/* FALLTHROUGH */' comments to fix many
GCC warnings when compiling with -Wimplicit-fallthrough.
Additionally, the existing fallthrough comments have been
changed for consistency.
This commit is contained in:
Johnothan King 2021-03-30 13:49:20 -07:00 committed by GitHub
parent f30da49564
commit ed478ab7e3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
73 changed files with 271 additions and 158 deletions

View file

@ -66,12 +66,19 @@ Sflong_t v; /* the value to be written */
{ switch(n)
{
case 8 : *ps++ = *s++;
/* FALLTHROUGH */
case 7 : *ps++ = *s++;
/* FALLTHROUGH */
case 6 : *ps++ = *s++;
/* FALLTHROUGH */
case 5 : *ps++ = *s++;
/* FALLTHROUGH */
case 4 : *ps++ = *s++;
/* FALLTHROUGH */
case 3 : *ps++ = *s++;
/* FALLTHROUGH */
case 2 : *ps++ = *s++;
/* FALLTHROUGH */
case 1 : *ps++ = *s++;
}
f->next = ps;

View file

@ -62,12 +62,19 @@ Sfulong_t m; /* the max value of the range */
{ switch(n)
{
case 8 : *ps++ = *s++;
/* FALLTHROUGH */
case 7 : *ps++ = *s++;
/* FALLTHROUGH */
case 6 : *ps++ = *s++;
/* FALLTHROUGH */
case 5 : *ps++ = *s++;
/* FALLTHROUGH */
case 4 : *ps++ = *s++;
/* FALLTHROUGH */
case 3 : *ps++ = *s++;
/* FALLTHROUGH */
case 2 : *ps++ = *s++;
/* FALLTHROUGH */
case 1 : *ps++ = *s++;
}
f->next = ps;

View file

@ -59,12 +59,19 @@ Sfulong_t v; /* the unsigned value to be written */
{ switch(n)
{
case 8 : *ps++ = *s++;
/* FALLTHROUGH */
case 7 : *ps++ = *s++;
/* FALLTHROUGH */
case 6 : *ps++ = *s++;
/* FALLTHROUGH */
case 5 : *ps++ = *s++;
/* FALLTHROUGH */
case 4 : *ps++ = *s++;
/* FALLTHROUGH */
case 3 : *ps++ = *s++;
/* FALLTHROUGH */
case 2 : *ps++ = *s++;
/* FALLTHROUGH */
case 1 : *ps++ = *s++;
}
f->next = ps;

View file

@ -1132,24 +1132,36 @@ typedef struct _sftab_
#define MEMCPY(to,fr,n) \
switch(n) \
{ default : memcpy((Void_t*)to,(Void_t*)fr,n); to += n; fr += n; break; \
case 7 : *to++ = *fr++; \
case 6 : *to++ = *fr++; \
case 5 : *to++ = *fr++; \
case 4 : *to++ = *fr++; \
case 3 : *to++ = *fr++; \
case 2 : *to++ = *fr++; \
case 1 : *to++ = *fr++; \
case 7 : *to++ = *fr++; \
/* FALLTHROUGH */ \
case 6 : *to++ = *fr++; \
/* FALLTHROUGH */ \
case 5 : *to++ = *fr++; \
/* FALLTHROUGH */ \
case 4 : *to++ = *fr++; \
/* FALLTHROUGH */ \
case 3 : *to++ = *fr++; \
/* FALLTHROUGH */ \
case 2 : *to++ = *fr++; \
/* FALLTHROUGH */ \
case 1 : *to++ = *fr++; \
}
#define MEMSET(s,c,n) \
switch(n) \
{ default : memset((Void_t*)s,(int)c,n); s += n; break; \
case 7 : *s++ = c; \
case 6 : *s++ = c; \
case 5 : *s++ = c; \
case 4 : *s++ = c; \
case 3 : *s++ = c; \
case 2 : *s++ = c; \
case 1 : *s++ = c; \
case 7 : *s++ = c; \
/* FALLTHROUGH */ \
case 6 : *s++ = c; \
/* FALLTHROUGH */ \
case 5 : *s++ = c; \
/* FALLTHROUGH */ \
case 4 : *s++ = c; \
/* FALLTHROUGH */ \
case 3 : *s++ = c; \
/* FALLTHROUGH */ \
case 2 : *s++ = c; \
/* FALLTHROUGH */ \
case 1 : *s++ = c; \
}
_BEGIN_EXTERNS_

View file

@ -537,7 +537,7 @@ reg int local; /* a local call */
break;
}
/* fall thru */
/* FALLTHROUGH */
case SF_READ: /* switching to SF_WRITE */
if(wanted != SF_WRITE)

View file

@ -78,7 +78,7 @@ Sfio_t* f;
/* 2-way pipe, must clear read buffer */
(void)_sfmode(f,SF_READ,1);
/* fall through */
/* FALLTHROUGH */
case SF_READ:
if(f->extent >= 0 && f->endb > f->next)
{ f->here -= f->endb-f->next;

View file

@ -303,7 +303,7 @@ Sfdisc_t* disc;
case SF_EDISC :
if(!local && !(f->flags&SF_STRING))
goto do_continue;
/* else fall thru */
/* FALLTHROUGH */
case SF_ESTACK :
SFMTXRETURN(f, -1);
}

View file

@ -178,7 +178,8 @@ int type; /* >0: scanf, =0: printf, -1: internal */
}
else if(*form != '*')
goto loop_flags;
else form += 1; /* drop thru below */
else form += 1;
/* FALLTHROUGH */
case '*' :
form = sffmtint(form,&n);

View file

@ -367,8 +367,9 @@ loop_fmt :
}
else if(*form != '*')
goto loop_flags;
do_star:
form += 1; /* fall thru for '*' */
do_star: /* for '*' */
form += 1;
/* FALLTHROUGH */
case '*' :
form = (*_Sffmtintf)(form,&n);
if(*form == '$')
@ -674,6 +675,7 @@ loop_fmt :
case 'S':
flags = (flags & ~(SFFMT_TYPES|SFFMT_LDOUBLE)) | SFFMT_LONG;
/* FALLTHROUGH */
case 's':
#if _has_multibyte && defined(mbwidth)
wc = (flags & SFFMT_LDOUBLE) && mbwide();
@ -833,6 +835,7 @@ loop_fmt :
case 'C':
flags = (flags & ~(SFFMT_TYPES|SFFMT_LDOUBLE)) | SFFMT_LONG;
/* FALLTHROUGH */
case 'c':
#if _has_multibyte && defined(mbwidth)
wc = (flags & SFFMT_LDOUBLE) && mbwide();
@ -959,6 +962,7 @@ loop_fmt :
goto int_arg;
case 'X':
ssp = "0123456789ABCDEF";
/* FALLTHROUGH */
case 'x':
base = 16; n_s = 15; n = 4;
flags &= ~(SFFMT_SIGN|SFFMT_BLANK);
@ -974,6 +978,7 @@ loop_fmt :
goto d_format;
case 'u':
flags &= ~(SFFMT_SIGN|SFFMT_BLANK);
/* FALLTHROUGH */
case 'd':
d_format:
#if _PACKAGE_ast

View file

@ -238,7 +238,7 @@ Sfdisc_t* disc;
case SF_EDISC :
if(!local && !(f->flags&SF_STRING))
goto do_continue;
/* else fall thru */
/* FALLTHROUGH */
case SF_ESTACK :
SFMTXRETURN(f, (ssize_t)(-1));
}