Use fallthrough statement attribute
This commit is contained in:
		
							
								
								
									
										13
									
								
								configure.ac
									
									
									
									
									
								
							
							
						
						
									
										13
									
								
								configure.ac
									
									
									
									
									
								
							| @@ -504,6 +504,19 @@ rk_WIN32_EXPORT(BUILD_ROKEN_LIB, ROKEN_LIB) | |||||||
| rk_WIN32_EXPORT(BUILD_GSSAPI_LIB, GSSAPI_LIB) | rk_WIN32_EXPORT(BUILD_GSSAPI_LIB, GSSAPI_LIB) | ||||||
| rk_WIN32_EXPORT(BUILD_KDC_LIB, KDC_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. | dnl Checks for libraries. | ||||||
|  |  | ||||||
| AC_FIND_FUNC_NO_LIBS(openpty, util,[ | AC_FIND_FUNC_NO_LIBS(openpty, util,[ | ||||||
|   | |||||||
| @@ -32,6 +32,8 @@ | |||||||
| #ifndef __CONFIG_H__ | #ifndef __CONFIG_H__ | ||||||
| #define __CONFIG_H__ | #define __CONFIG_H__ | ||||||
|  |  | ||||||
|  | #define fallthrough | ||||||
|  |  | ||||||
| #ifndef RCSID | #ifndef RCSID | ||||||
| #define RCSID(msg) \ | #define RCSID(msg) \ | ||||||
| static const char *const rcsid[] = { (const char *)rcsid, "@(#)" msg } | static const char *const rcsid[] = { (const char *)rcsid, "@(#)" msg } | ||||||
|   | |||||||
| @@ -972,7 +972,8 @@ process_stream(krb5_context contextp, | |||||||
| 	    INSIST(gctx.ctx == NULL); | 	    INSIST(gctx.ctx == NULL); | ||||||
|  |  | ||||||
| 	    gctx.inprogress = 1; | 	    gctx.inprogress = 1; | ||||||
| 	    /* FALLTHROUGH */ | 	    fallthrough | ||||||
|  |             /* FALLTHROUGH */ | ||||||
| 	case RPG_CONTINUE_INIT: { | 	case RPG_CONTINUE_INIT: { | ||||||
| 	    gss_name_t src_name = GSS_C_NO_NAME; | 	    gss_name_t src_name = GSS_C_NO_NAME; | ||||||
| 	    krb5_data in; | 	    krb5_data in; | ||||||
|   | |||||||
| @@ -62,6 +62,7 @@ copy_type (const char *from, const char *to, const Type *t, int preserve) | |||||||
| 	    copy_primitive ("heim_integer", from, to); | 	    copy_primitive ("heim_integer", from, to); | ||||||
| 	    break; | 	    break; | ||||||
| 	} | 	} | ||||||
|  |         fallthrough | ||||||
|         /* FALLTHROUGH */ |         /* FALLTHROUGH */ | ||||||
|     case TBoolean: |     case TBoolean: | ||||||
|     case TEnumerated : |     case TEnumerated : | ||||||
|   | |||||||
| @@ -929,6 +929,7 @@ OM_uint32 GSSAPI_CALLCONV _gsskrb5_init_sec_context | |||||||
| 			time_rec); | 			time_rec); | ||||||
| 	if (ret != GSS_S_COMPLETE) | 	if (ret != GSS_S_COMPLETE) | ||||||
| 	    break; | 	    break; | ||||||
|  |         fallthrough | ||||||
| 	/* FALLTHROUGH */ | 	/* FALLTHROUGH */ | ||||||
|     case INITIATOR_RESTART: |     case INITIATOR_RESTART: | ||||||
| 	ret = init_auth_restart(minor_status, | 	ret = init_auth_restart(minor_status, | ||||||
|   | |||||||
| @@ -424,7 +424,8 @@ int main(int argc, char **argv) | |||||||
|             break; |             break; | ||||||
|          case 'h': |          case 'h': | ||||||
|             s_exit_code = EXIT_SUCCESS; |             s_exit_code = EXIT_SUCCESS; | ||||||
|          /* FALLTHROUGH */ |             fallthrough | ||||||
|  |             /* FALLTHROUGH */ | ||||||
|          default: |          default: | ||||||
|             s_usage(argv[0]); |             s_usage(argv[0]); | ||||||
|          } |          } | ||||||
|   | |||||||
| @@ -2438,8 +2438,10 @@ hx509_verify_path(hx509_context context, | |||||||
| 		 * EE checking below. | 		 * EE checking below. | ||||||
| 		 */ | 		 */ | ||||||
| 		type = EE_CERT; | 		type = EE_CERT; | ||||||
|  |                 fallthrough | ||||||
|                 /* FALLTHROUGH */ |                 /* FALLTHROUGH */ | ||||||
| 	    } | 	    } | ||||||
|  |             fallthrough | ||||||
| 	} | 	} | ||||||
|         /* FALLTHROUGH */ |         /* FALLTHROUGH */ | ||||||
| 	case EE_CERT: | 	case EE_CERT: | ||||||
|   | |||||||
| @@ -182,6 +182,7 @@ fill_CMSIdentifier(const hx509_cert cert, | |||||||
| 						   &id->u.subjectKeyIdentifier); | 						   &id->u.subjectKeyIdentifier); | ||||||
| 	if (ret == 0) | 	if (ret == 0) | ||||||
| 	    break; | 	    break; | ||||||
|  |         fallthrough | ||||||
| 	/* FALLTHROUGH */ | 	/* FALLTHROUGH */ | ||||||
|     case CMS_ID_NAME: { |     case CMS_ID_NAME: { | ||||||
| 	hx509_name name; | 	hx509_name name; | ||||||
|   | |||||||
| @@ -230,6 +230,7 @@ hx509_pem_read(hx509_context context, | |||||||
| 		where = INDATA; | 		where = INDATA; | ||||||
| 		goto indata; | 		goto indata; | ||||||
| 	    } | 	    } | ||||||
|  |             fallthrough | ||||||
| 	    /* FALLTHROUGH */ | 	    /* FALLTHROUGH */ | ||||||
| 	case INHEADER: | 	case INHEADER: | ||||||
| 	    if (buf[0] == '\0') { | 	    if (buf[0] == '\0') { | ||||||
|   | |||||||
| @@ -209,6 +209,7 @@ _kafs_derive_des_key(krb5_enctype enctype, void *keydata, size_t keylen, | |||||||
| 	ret = compress_parity_bits(keydata, &keylen); | 	ret = compress_parity_bits(keydata, &keylen); | ||||||
| 	if (ret) | 	if (ret) | ||||||
| 	    return ret; | 	    return ret; | ||||||
|  |         fallthrough | ||||||
| 	/* FALLTHROUGH */ | 	/* FALLTHROUGH */ | ||||||
|     default: |     default: | ||||||
| 	if (enctype < 0) | 	if (enctype < 0) | ||||||
|   | |||||||
| @@ -1192,6 +1192,7 @@ krb5_sendto_context(krb5_context context, | |||||||
| 		break; | 		break; | ||||||
| 	    } | 	    } | ||||||
| 	    action = KRB5_SENDTO_KRBHST; | 	    action = KRB5_SENDTO_KRBHST; | ||||||
|  |             fallthrough | ||||||
| 	    /* FALLTHROUGH */ | 	    /* FALLTHROUGH */ | ||||||
| 	case KRB5_SENDTO_KRBHST: | 	case KRB5_SENDTO_KRBHST: | ||||||
| 	    if (ctx->krbhst == NULL) { | 	    if (ctx->krbhst == NULL) { | ||||||
| @@ -1214,6 +1215,7 @@ krb5_sendto_context(krb5_context context, | |||||||
| 		handle = heim_retain(ctx->krbhst); | 		handle = heim_retain(ctx->krbhst); | ||||||
| 	    } | 	    } | ||||||
| 	    action = KRB5_SENDTO_TIMEOUT; | 	    action = KRB5_SENDTO_TIMEOUT; | ||||||
|  |             fallthrough | ||||||
| 	    /* FALLTHROUGH */ | 	    /* FALLTHROUGH */ | ||||||
| 	case KRB5_SENDTO_TIMEOUT: | 	case KRB5_SENDTO_TIMEOUT: | ||||||
|  |  | ||||||
|   | |||||||
| @@ -129,6 +129,7 @@ rk_fnmatch(const char *pattern, const char *string, int flags) | |||||||
| 					--pattern; | 					--pattern; | ||||||
| 				} | 				} | ||||||
| 			} | 			} | ||||||
|  |                         fallthrough | ||||||
| 			/* FALLTHROUGH */ | 			/* FALLTHROUGH */ | ||||||
| 		default: | 		default: | ||||||
| 			if (c != *string++) | 			if (c != *string++) | ||||||
|   | |||||||
| @@ -136,7 +136,8 @@ roken_get_homedir(char *home, size_t homesz) | |||||||
|         } |         } | ||||||
|         return home; |         return home; | ||||||
|     } |     } | ||||||
|     /* Fallthru to return NULL */ |     fallthrough | ||||||
|  |     /* FALLTHROUGH */ | ||||||
| #else | #else | ||||||
| #ifdef HAVE_GETPWNAM_R | #ifdef HAVE_GETPWNAM_R | ||||||
|     size_t buflen = 2048; |     size_t buflen = 2048; | ||||||
|   | |||||||
| @@ -515,6 +515,7 @@ xyzprintf (struct snprintf_state *state, const char *char_format, va_list ap) | |||||||
| 	    } | 	    } | ||||||
| 	    case '\0' : | 	    case '\0' : | ||||||
| 		--format; | 		--format; | ||||||
|  |                 fallthrough | ||||||
| 		/* FALLTHROUGH */ | 		/* FALLTHROUGH */ | ||||||
| 	    case '%' : | 	    case '%' : | ||||||
| 		(*state->append_char)(state, c); | 		(*state->append_char)(state, c); | ||||||
|   | |||||||
| @@ -377,6 +377,7 @@ strftime (char *buf, size_t maxsize, const char *format, | |||||||
| 		break; | 		break; | ||||||
| 	    case '\0' : | 	    case '\0' : | ||||||
| 		--format; | 		--format; | ||||||
|  |                 fallthrough | ||||||
| 		/* FALLTHROUGH */ | 		/* FALLTHROUGH */ | ||||||
| 	    case '%' : | 	    case '%' : | ||||||
| 		ret = snprintf (buf, maxsize - n, | 		ret = snprintf (buf, maxsize - n, | ||||||
|   | |||||||
| @@ -424,6 +424,7 @@ strptime (const char *buf, const char *format, struct tm *timeptr) | |||||||
| 		abort (); | 		abort (); | ||||||
| 	    case '\0' : | 	    case '\0' : | ||||||
| 		--format; | 		--format; | ||||||
|  |                 fallthrough | ||||||
| 		/* FALLTHROUGH */ | 		/* FALLTHROUGH */ | ||||||
| 	    case '%' : | 	    case '%' : | ||||||
| 		if (*buf == '%') | 		if (*buf == '%') | ||||||
|   | |||||||
| @@ -205,17 +205,21 @@ wind_ucs4utf8(const uint32_t *in, size_t in_len, char *out, size_t *out_len) | |||||||
| 	    case 4: | 	    case 4: | ||||||
| 		out[3] = (ch | 0x80) & 0xbf; | 		out[3] = (ch | 0x80) & 0xbf; | ||||||
| 		ch = ch >> 6; | 		ch = ch >> 6; | ||||||
|  |                 fallthrough | ||||||
|                 /* FALLTHROUGH */ |                 /* FALLTHROUGH */ | ||||||
| 	    case 3: | 	    case 3: | ||||||
| 		out[2] = (ch | 0x80) & 0xbf; | 		out[2] = (ch | 0x80) & 0xbf; | ||||||
| 		ch = ch >> 6; | 		ch = ch >> 6; | ||||||
|  |                 fallthrough | ||||||
|                 /* FALLTHROUGH */ |                 /* FALLTHROUGH */ | ||||||
| 	    case 2: | 	    case 2: | ||||||
| 		out[1] = (ch | 0x80) & 0xbf; | 		out[1] = (ch | 0x80) & 0xbf; | ||||||
| 		ch = ch >> 6; | 		ch = ch >> 6; | ||||||
|  |                 fallthrough | ||||||
|                 /* FALLTHROUGH */ |                 /* FALLTHROUGH */ | ||||||
| 	    case 1: | 	    case 1: | ||||||
| 		out[0] = ch | first_char[len - 1]; | 		out[0] = ch | first_char[len - 1]; | ||||||
|  |                 fallthrough | ||||||
|                 /* FALLTHROUGH */ |                 /* FALLTHROUGH */ | ||||||
| 	    } | 	    } | ||||||
| 	} | 	} | ||||||
| @@ -484,13 +488,16 @@ wind_ucs2utf8(const uint16_t *in, size_t in_len, char *out, size_t *out_len) | |||||||
| 	    case 3: | 	    case 3: | ||||||
| 		out[2] = (ch | 0x80) & 0xbf; | 		out[2] = (ch | 0x80) & 0xbf; | ||||||
| 		ch = ch >> 6; | 		ch = ch >> 6; | ||||||
|  |                 fallthrough | ||||||
|                 /* FALLTHROUGH */ |                 /* FALLTHROUGH */ | ||||||
| 	    case 2: | 	    case 2: | ||||||
| 		out[1] = (ch | 0x80) & 0xbf; | 		out[1] = (ch | 0x80) & 0xbf; | ||||||
| 		ch = ch >> 6; | 		ch = ch >> 6; | ||||||
|  |                 fallthrough | ||||||
|                 /* FALLTHROUGH */ |                 /* FALLTHROUGH */ | ||||||
| 	    case 1: | 	    case 1: | ||||||
| 		out[0] = ch | first_char[len - 1]; | 		out[0] = ch | first_char[len - 1]; | ||||||
|  |                 fallthrough | ||||||
|                 /* FALLTHROUGH */ |                 /* FALLTHROUGH */ | ||||||
| 	    } | 	    } | ||||||
| 	    out += len; | 	    out += len; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Nicolas Williams
					Nicolas Williams