Use fallthrough statement attribute

This commit is contained in:
Nicolas Williams
2022-01-14 16:32:04 -06:00
parent 367f9ddd7d
commit ddc6113610
17 changed files with 41 additions and 3 deletions

View File

@@ -504,6 +504,19 @@ rk_WIN32_EXPORT(BUILD_ROKEN_LIB, ROKEN_LIB)
rk_WIN32_EXPORT(BUILD_GSSAPI_LIB, GSSAPI_LIB)
rk_WIN32_EXPORT(BUILD_KDC_LIB, KDC_LIB)
dnl Deal with switch FALLTHROUGH
AH_TOP([
#if defined(__GNUC__)
#if __GNUC__ >= 7
# define fallthrough __attribute__((fallthrough));
#else
# define fallthrough
#endif
#else
# define fallthrough
#endif
])
dnl Checks for libraries.
AC_FIND_FUNC_NO_LIBS(openpty, util,[

View File

@@ -32,6 +32,8 @@
#ifndef __CONFIG_H__
#define __CONFIG_H__
#define fallthrough
#ifndef RCSID
#define RCSID(msg) \
static const char *const rcsid[] = { (const char *)rcsid, "@(#)" msg }

View File

@@ -972,7 +972,8 @@ process_stream(krb5_context contextp,
INSIST(gctx.ctx == NULL);
gctx.inprogress = 1;
/* FALLTHROUGH */
fallthrough
/* FALLTHROUGH */
case RPG_CONTINUE_INIT: {
gss_name_t src_name = GSS_C_NO_NAME;
krb5_data in;

View File

@@ -62,6 +62,7 @@ copy_type (const char *from, const char *to, const Type *t, int preserve)
copy_primitive ("heim_integer", from, to);
break;
}
fallthrough
/* FALLTHROUGH */
case TBoolean:
case TEnumerated :

View File

@@ -929,6 +929,7 @@ OM_uint32 GSSAPI_CALLCONV _gsskrb5_init_sec_context
time_rec);
if (ret != GSS_S_COMPLETE)
break;
fallthrough
/* FALLTHROUGH */
case INITIATOR_RESTART:
ret = init_auth_restart(minor_status,

View File

@@ -424,7 +424,8 @@ int main(int argc, char **argv)
break;
case 'h':
s_exit_code = EXIT_SUCCESS;
/* FALLTHROUGH */
fallthrough
/* FALLTHROUGH */
default:
s_usage(argv[0]);
}

View File

@@ -2438,8 +2438,10 @@ hx509_verify_path(hx509_context context,
* EE checking below.
*/
type = EE_CERT;
fallthrough
/* FALLTHROUGH */
}
fallthrough
}
/* FALLTHROUGH */
case EE_CERT:

View File

@@ -182,6 +182,7 @@ fill_CMSIdentifier(const hx509_cert cert,
&id->u.subjectKeyIdentifier);
if (ret == 0)
break;
fallthrough
/* FALLTHROUGH */
case CMS_ID_NAME: {
hx509_name name;

View File

@@ -230,6 +230,7 @@ hx509_pem_read(hx509_context context,
where = INDATA;
goto indata;
}
fallthrough
/* FALLTHROUGH */
case INHEADER:
if (buf[0] == '\0') {

View File

@@ -209,6 +209,7 @@ _kafs_derive_des_key(krb5_enctype enctype, void *keydata, size_t keylen,
ret = compress_parity_bits(keydata, &keylen);
if (ret)
return ret;
fallthrough
/* FALLTHROUGH */
default:
if (enctype < 0)

View File

@@ -1192,6 +1192,7 @@ krb5_sendto_context(krb5_context context,
break;
}
action = KRB5_SENDTO_KRBHST;
fallthrough
/* FALLTHROUGH */
case KRB5_SENDTO_KRBHST:
if (ctx->krbhst == NULL) {
@@ -1214,6 +1215,7 @@ krb5_sendto_context(krb5_context context,
handle = heim_retain(ctx->krbhst);
}
action = KRB5_SENDTO_TIMEOUT;
fallthrough
/* FALLTHROUGH */
case KRB5_SENDTO_TIMEOUT:

View File

@@ -129,6 +129,7 @@ rk_fnmatch(const char *pattern, const char *string, int flags)
--pattern;
}
}
fallthrough
/* FALLTHROUGH */
default:
if (c != *string++)

View File

@@ -136,7 +136,8 @@ roken_get_homedir(char *home, size_t homesz)
}
return home;
}
/* Fallthru to return NULL */
fallthrough
/* FALLTHROUGH */
#else
#ifdef HAVE_GETPWNAM_R
size_t buflen = 2048;

View File

@@ -515,6 +515,7 @@ xyzprintf (struct snprintf_state *state, const char *char_format, va_list ap)
}
case '\0' :
--format;
fallthrough
/* FALLTHROUGH */
case '%' :
(*state->append_char)(state, c);

View File

@@ -377,6 +377,7 @@ strftime (char *buf, size_t maxsize, const char *format,
break;
case '\0' :
--format;
fallthrough
/* FALLTHROUGH */
case '%' :
ret = snprintf (buf, maxsize - n,

View File

@@ -424,6 +424,7 @@ strptime (const char *buf, const char *format, struct tm *timeptr)
abort ();
case '\0' :
--format;
fallthrough
/* FALLTHROUGH */
case '%' :
if (*buf == '%')

View File

@@ -205,17 +205,21 @@ wind_ucs4utf8(const uint32_t *in, size_t in_len, char *out, size_t *out_len)
case 4:
out[3] = (ch | 0x80) & 0xbf;
ch = ch >> 6;
fallthrough
/* FALLTHROUGH */
case 3:
out[2] = (ch | 0x80) & 0xbf;
ch = ch >> 6;
fallthrough
/* FALLTHROUGH */
case 2:
out[1] = (ch | 0x80) & 0xbf;
ch = ch >> 6;
fallthrough
/* FALLTHROUGH */
case 1:
out[0] = ch | first_char[len - 1];
fallthrough
/* FALLTHROUGH */
}
}
@@ -484,13 +488,16 @@ wind_ucs2utf8(const uint16_t *in, size_t in_len, char *out, size_t *out_len)
case 3:
out[2] = (ch | 0x80) & 0xbf;
ch = ch >> 6;
fallthrough
/* FALLTHROUGH */
case 2:
out[1] = (ch | 0x80) & 0xbf;
ch = ch >> 6;
fallthrough
/* FALLTHROUGH */
case 1:
out[0] = ch | first_char[len - 1];
fallthrough
/* FALLTHROUGH */
}
out += len;