rewrite fallthrough to HEIM_FALLTHROUGH to deal with new Apple SDKs
Apple clang version 14.0.0 (clang-1400.0.17.3.1) fails the build because stds.h defines `fallthrough` as a macro which is then expanded when base.h evaluates # if __has_attribute(fallthrough) && __clang_major__ >= 5 The macOS SDK defines `DISPATCH_FALLTHROUGH` as the macro instead of `fallthrough`. This change replaces the use of `fallthrough` in the tree with `HEIM_FALLTHROUGH` and updates the declaration in configure logic to define `HEIM_FALLTHROUGH` based upon existing definitions (if any) of `fallthrough` or `DISPATCH_FALLTHROUGH`.
This commit is contained in:

committed by
Jeffrey Altman

parent
f6d26bce66
commit
133f517482
20
configure.ac
20
configure.ac
@@ -505,16 +505,20 @@ 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
|
dnl Deal with switch fallthrough warnings
|
||||||
AH_TOP([
|
AH_TOP([
|
||||||
#if defined(__GNUC__)
|
#if defined(DISPATCH_FALLTHROUGH)
|
||||||
#if __GNUC__ >= 7
|
# define HEIM_FALLTHROUGH DISPATCH_FALLTHROUGH
|
||||||
# define fallthrough __attribute__((fallthrough))
|
|
||||||
#else
|
#else
|
||||||
# define fallthrough do {} while (0) /* fallthrough */
|
# if defined(__GNUC__)
|
||||||
#endif
|
# if __GNUC__ >= 7
|
||||||
#else
|
# define HEIM_FALLTHROUGH __attribute__((fallthrough))
|
||||||
# define fallthrough do {} while (0) /* fallthrough */
|
# else
|
||||||
|
# define HEIM_FALLTHROUGH do {} while (0) /* fallthrough */
|
||||||
|
# endif
|
||||||
|
# else
|
||||||
|
# define HEIM_FALLTHROUGH do {} while (0) /* fallthrough */
|
||||||
|
# endif
|
||||||
#endif
|
#endif
|
||||||
])
|
])
|
||||||
|
|
||||||
|
@@ -26,13 +26,13 @@
|
|||||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||||
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
|
|
||||||
#ifndef __CONFIG_H__
|
#ifndef __CONFIG_H__
|
||||||
#define __CONFIG_H__
|
#define __CONFIG_H__
|
||||||
|
|
||||||
#define fallthrough do {} while(0) /* fallthrough */
|
#define HEIM_FALLTHROUGH do {} while(0) /* fallthrough */
|
||||||
|
|
||||||
#ifndef RCSID
|
#ifndef RCSID
|
||||||
#define RCSID(msg) \
|
#define RCSID(msg) \
|
||||||
|
@@ -972,7 +972,7 @@ process_stream(krb5_context contextp,
|
|||||||
INSIST(gctx.ctx == NULL);
|
INSIST(gctx.ctx == NULL);
|
||||||
|
|
||||||
gctx.inprogress = 1;
|
gctx.inprogress = 1;
|
||||||
fallthrough;
|
HEIM_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,7 +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;
|
HEIM_FALLTHROUGH;
|
||||||
case TBoolean:
|
case TBoolean:
|
||||||
case TEnumerated :
|
case TEnumerated :
|
||||||
fprintf(codefile, "*(%s) = *(%s);\n", to, from);
|
fprintf(codefile, "*(%s) = *(%s);\n", to, from);
|
||||||
|
@@ -56,7 +56,7 @@ free_type (const char *name, const Type *t, int preserve)
|
|||||||
free_primitive ("heim_integer", name);
|
free_primitive ("heim_integer", name);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
/* fallthrough; */
|
/* HEIM_FALLTHROUGH; */
|
||||||
case TBoolean:
|
case TBoolean:
|
||||||
case TEnumerated :
|
case TEnumerated :
|
||||||
case TNull:
|
case TNull:
|
||||||
|
@@ -932,7 +932,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;
|
HEIM_FALLTHROUGH;
|
||||||
case INITIATOR_RESTART:
|
case INITIATOR_RESTART:
|
||||||
ret = init_auth_restart(minor_status,
|
ret = init_auth_restart(minor_status,
|
||||||
cred,
|
cred,
|
||||||
|
@@ -2441,10 +2441,10 @@ hx509_verify_path(hx509_context context,
|
|||||||
* EE checking below.
|
* EE checking below.
|
||||||
*/
|
*/
|
||||||
type = EE_CERT;
|
type = EE_CERT;
|
||||||
fallthrough;
|
HEIM_FALLTHROUGH;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fallthrough;
|
HEIM_FALLTHROUGH;
|
||||||
case EE_CERT:
|
case EE_CERT:
|
||||||
/*
|
/*
|
||||||
* If there where any proxy certificates in the chain
|
* If there where any proxy certificates in the chain
|
||||||
|
@@ -182,7 +182,7 @@ fill_CMSIdentifier(const hx509_cert cert,
|
|||||||
&id->u.subjectKeyIdentifier);
|
&id->u.subjectKeyIdentifier);
|
||||||
if (ret == 0)
|
if (ret == 0)
|
||||||
break;
|
break;
|
||||||
fallthrough;
|
HEIM_FALLTHROUGH;
|
||||||
case CMS_ID_NAME: {
|
case CMS_ID_NAME: {
|
||||||
hx509_name name;
|
hx509_name name;
|
||||||
|
|
||||||
|
@@ -230,7 +230,7 @@ hx509_pem_read(hx509_context context,
|
|||||||
where = INDATA;
|
where = INDATA;
|
||||||
goto indata;
|
goto indata;
|
||||||
}
|
}
|
||||||
fallthrough;
|
HEIM_FALLTHROUGH;
|
||||||
case INHEADER:
|
case INHEADER:
|
||||||
if (buf[0] == '\0') {
|
if (buf[0] == '\0') {
|
||||||
where = INDATA;
|
where = INDATA;
|
||||||
|
@@ -1046,7 +1046,7 @@ authorize_feat(hx509_request req, abitstring a, size_t n, int idx)
|
|||||||
switch (ret) {
|
switch (ret) {
|
||||||
case 0:
|
case 0:
|
||||||
req->nauthorized++;
|
req->nauthorized++;
|
||||||
fallthrough;
|
HEIM_FALLTHROUGH;
|
||||||
case -1:
|
case -1:
|
||||||
return 0;
|
return 0;
|
||||||
default:
|
default:
|
||||||
@@ -1063,7 +1063,7 @@ reject_feat(hx509_request req, abitstring a, size_t n, int idx)
|
|||||||
switch (ret) {
|
switch (ret) {
|
||||||
case 0:
|
case 0:
|
||||||
req->nauthorized--;
|
req->nauthorized--;
|
||||||
fallthrough;
|
HEIM_FALLTHROUGH;
|
||||||
case -1:
|
case -1:
|
||||||
return 0;
|
return 0;
|
||||||
default:
|
default:
|
||||||
@@ -1245,7 +1245,7 @@ san_map_type(GeneralName *san)
|
|||||||
if (der_heim_oid_cmp(&san->u.otherName.type_id, map[i].oid) == 0)
|
if (der_heim_oid_cmp(&san->u.otherName.type_id, map[i].oid) == 0)
|
||||||
return map[i].type;
|
return map[i].type;
|
||||||
}
|
}
|
||||||
fallthrough;
|
HEIM_FALLTHROUGH;
|
||||||
default: return HX509_SAN_TYPE_UNSUPPORTED;
|
default: return HX509_SAN_TYPE_UNSUPPORTED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1360,7 +1360,7 @@ hx509_request_get_san(hx509_request req,
|
|||||||
case HX509_SAN_TYPE_REGISTERED_ID:
|
case HX509_SAN_TYPE_REGISTERED_ID:
|
||||||
return der_print_heim_oid(&san->u.registeredID, '.', out);
|
return der_print_heim_oid(&san->u.registeredID, '.', out);
|
||||||
case HX509_SAN_TYPE_XMPP:
|
case HX509_SAN_TYPE_XMPP:
|
||||||
fallthrough;
|
HEIM_FALLTHROUGH;
|
||||||
case HX509_SAN_TYPE_MS_UPN: {
|
case HX509_SAN_TYPE_MS_UPN: {
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
@@ -209,7 +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;
|
HEIM_FALLTHROUGH;
|
||||||
default:
|
default:
|
||||||
if (enctype < 0)
|
if (enctype < 0)
|
||||||
return KRB5_PROG_ETYPE_NOSUPP;
|
return KRB5_PROG_ETYPE_NOSUPP;
|
||||||
|
@@ -1192,7 +1192,7 @@ krb5_sendto_context(krb5_context context,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
action = KRB5_SENDTO_KRBHST;
|
action = KRB5_SENDTO_KRBHST;
|
||||||
fallthrough;
|
HEIM_FALLTHROUGH;
|
||||||
case KRB5_SENDTO_KRBHST:
|
case KRB5_SENDTO_KRBHST:
|
||||||
if (ctx->krbhst == NULL) {
|
if (ctx->krbhst == NULL) {
|
||||||
ret = krb5_krbhst_init_flags(context, realm, type,
|
ret = krb5_krbhst_init_flags(context, realm, type,
|
||||||
@@ -1214,7 +1214,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;
|
HEIM_FALLTHROUGH;
|
||||||
case KRB5_SENDTO_TIMEOUT:
|
case KRB5_SENDTO_TIMEOUT:
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@@ -471,7 +471,7 @@ heim_digest_generate_challenge(heim_digest_t context)
|
|||||||
break;
|
break;
|
||||||
case HEIM_DIGEST_TYPE_AUTO:
|
case HEIM_DIGEST_TYPE_AUTO:
|
||||||
context->type = HEIM_DIGEST_TYPE_RFC2831;
|
context->type = HEIM_DIGEST_TYPE_RFC2831;
|
||||||
fallthrough;
|
HEIM_FALLTHROUGH;
|
||||||
case HEIM_DIGEST_TYPE_RFC2831:
|
case HEIM_DIGEST_TYPE_RFC2831:
|
||||||
asprintf(&challenge, "realm=\"%s\",nonce=\"%s\",qop=\"%s\",algorithm=md5-sess,charset=utf-8,maxbuf=%s",
|
asprintf(&challenge, "realm=\"%s\",nonce=\"%s\",qop=\"%s\",algorithm=md5-sess,charset=utf-8,maxbuf=%s",
|
||||||
context->serverRealm, context->serverNonce, context->serverQOP, context->serverMaxbuf);
|
context->serverRealm, context->serverNonce, context->serverQOP, context->serverMaxbuf);
|
||||||
|
@@ -100,10 +100,10 @@ rk_base32_encode(const void *data, int size, char **str, enum rk_base32_flags fl
|
|||||||
p[6] = chars[(c & 0x0000000000000003e0ULL) >> 5];
|
p[6] = chars[(c & 0x0000000000000003e0ULL) >> 5];
|
||||||
p[7] = chars[(c & 0x00000000000000001fULL) >> 0];
|
p[7] = chars[(c & 0x00000000000000001fULL) >> 0];
|
||||||
switch (i - size) {
|
switch (i - size) {
|
||||||
case 4: p[2] = p[3] = '='; fallthrough;
|
case 4: p[2] = p[3] = '='; HEIM_FALLTHROUGH;
|
||||||
case 3: p[4] = '='; fallthrough;
|
case 3: p[4] = '='; HEIM_FALLTHROUGH;
|
||||||
case 2: p[5] = p[6] = '='; fallthrough;
|
case 2: p[5] = p[6] = '='; HEIM_FALLTHROUGH;
|
||||||
case 1: p[7] = '='; fallthrough;
|
case 1: p[7] = '='; HEIM_FALLTHROUGH;
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
p += 8;
|
p += 8;
|
||||||
|
@@ -148,7 +148,7 @@ int teardown_test(void)
|
|||||||
|
|
||||||
strcmp(dirname + len + 1 - sizeof(TESTDIR)/sizeof(char), TESTDIR) == 0) {
|
strcmp(dirname + len + 1 - sizeof(TESTDIR)/sizeof(char), TESTDIR) == 0) {
|
||||||
|
|
||||||
fallthrough;
|
HEIM_FALLTHROUGH;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
/* did we create the directory? */
|
/* did we create the directory? */
|
||||||
@@ -162,7 +162,7 @@ int teardown_test(void)
|
|||||||
fprintf(stderr, "Can't change to test directory. Aborting cleanup.\n");
|
fprintf(stderr, "Can't change to test directory. Aborting cleanup.\n");
|
||||||
return -1;
|
return -1;
|
||||||
} else {
|
} else {
|
||||||
fallthrough;
|
HEIM_FALLTHROUGH;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return -1;
|
return -1;
|
||||||
|
@@ -129,7 +129,7 @@ rk_fnmatch(const char *pattern, const char *string, int flags)
|
|||||||
--pattern;
|
--pattern;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fallthrough;
|
HEIM_FALLTHROUGH;
|
||||||
default:
|
default:
|
||||||
if (c != *string++)
|
if (c != *string++)
|
||||||
return (FNM_NOMATCH);
|
return (FNM_NOMATCH);
|
||||||
|
@@ -136,7 +136,7 @@ roken_get_homedir(char *home, size_t homesz)
|
|||||||
}
|
}
|
||||||
return home;
|
return home;
|
||||||
}
|
}
|
||||||
fallthrough;
|
HEIM_FALLTHROUGH;
|
||||||
#else
|
#else
|
||||||
#ifdef HAVE_GETPWNAM_R
|
#ifdef HAVE_GETPWNAM_R
|
||||||
size_t buflen = 2048;
|
size_t buflen = 2048;
|
||||||
|
@@ -515,7 +515,7 @@ xyzprintf (struct snprintf_state *state, const char *char_format, va_list ap)
|
|||||||
}
|
}
|
||||||
case '\0' :
|
case '\0' :
|
||||||
--format;
|
--format;
|
||||||
fallthrough;
|
HEIM_FALLTHROUGH;
|
||||||
case '%' :
|
case '%' :
|
||||||
(*state->append_char)(state, c);
|
(*state->append_char)(state, c);
|
||||||
++len;
|
++len;
|
||||||
|
@@ -377,7 +377,7 @@ strftime (char *buf, size_t maxsize, const char *format,
|
|||||||
break;
|
break;
|
||||||
case '\0' :
|
case '\0' :
|
||||||
--format;
|
--format;
|
||||||
fallthrough;
|
HEIM_FALLTHROUGH;
|
||||||
case '%' :
|
case '%' :
|
||||||
ret = snprintf (buf, maxsize - n,
|
ret = snprintf (buf, maxsize - n,
|
||||||
"%%");
|
"%%");
|
||||||
|
@@ -424,7 +424,7 @@ strptime (const char *buf, const char *format, struct tm *timeptr)
|
|||||||
abort ();
|
abort ();
|
||||||
case '\0' :
|
case '\0' :
|
||||||
--format;
|
--format;
|
||||||
fallthrough;
|
HEIM_FALLTHROUGH;
|
||||||
case '%' :
|
case '%' :
|
||||||
if (*buf == '%')
|
if (*buf == '%')
|
||||||
++buf;
|
++buf;
|
||||||
|
@@ -205,18 +205,18 @@ 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;
|
HEIM_FALLTHROUGH;
|
||||||
case 3:
|
case 3:
|
||||||
out[2] = (ch | 0x80) & 0xbf;
|
out[2] = (ch | 0x80) & 0xbf;
|
||||||
ch = ch >> 6;
|
ch = ch >> 6;
|
||||||
fallthrough;
|
HEIM_FALLTHROUGH;
|
||||||
case 2:
|
case 2:
|
||||||
out[1] = (ch | 0x80) & 0xbf;
|
out[1] = (ch | 0x80) & 0xbf;
|
||||||
ch = ch >> 6;
|
ch = ch >> 6;
|
||||||
fallthrough;
|
HEIM_FALLTHROUGH;
|
||||||
case 1:
|
case 1:
|
||||||
out[0] = ch | first_char[len - 1];
|
out[0] = ch | first_char[len - 1];
|
||||||
fallthrough;
|
HEIM_FALLTHROUGH;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -486,14 +486,14 @@ 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;
|
HEIM_FALLTHROUGH;
|
||||||
case 2:
|
case 2:
|
||||||
out[1] = (ch | 0x80) & 0xbf;
|
out[1] = (ch | 0x80) & 0xbf;
|
||||||
ch = ch >> 6;
|
ch = ch >> 6;
|
||||||
fallthrough;
|
HEIM_FALLTHROUGH;
|
||||||
case 1:
|
case 1:
|
||||||
out[0] = ch | first_char[len - 1];
|
out[0] = ch | first_char[len - 1];
|
||||||
fallthrough;
|
HEIM_FALLTHROUGH;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user