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:
Daria Phoebe Brashear
2022-09-16 09:57:24 -04:00
committed by Jeffrey Altman
parent f6d26bce66
commit 133f517482
21 changed files with 48 additions and 44 deletions

View File

@@ -2441,10 +2441,10 @@ hx509_verify_path(hx509_context context,
* EE checking below.
*/
type = EE_CERT;
fallthrough;
HEIM_FALLTHROUGH;
}
}
fallthrough;
HEIM_FALLTHROUGH;
case EE_CERT:
/*
* If there where any proxy certificates in the chain

View File

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

View File

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

View File

@@ -1046,7 +1046,7 @@ authorize_feat(hx509_request req, abitstring a, size_t n, int idx)
switch (ret) {
case 0:
req->nauthorized++;
fallthrough;
HEIM_FALLTHROUGH;
case -1:
return 0;
default:
@@ -1063,7 +1063,7 @@ reject_feat(hx509_request req, abitstring a, size_t n, int idx)
switch (ret) {
case 0:
req->nauthorized--;
fallthrough;
HEIM_FALLTHROUGH;
case -1:
return 0;
default:
@@ -1245,7 +1245,7 @@ san_map_type(GeneralName *san)
if (der_heim_oid_cmp(&san->u.otherName.type_id, map[i].oid) == 0)
return map[i].type;
}
fallthrough;
HEIM_FALLTHROUGH;
default: return HX509_SAN_TYPE_UNSUPPORTED;
}
}
@@ -1360,7 +1360,7 @@ hx509_request_get_san(hx509_request req,
case HX509_SAN_TYPE_REGISTERED_ID:
return der_print_heim_oid(&san->u.registeredID, '.', out);
case HX509_SAN_TYPE_XMPP:
fallthrough;
HEIM_FALLTHROUGH;
case HX509_SAN_TYPE_MS_UPN: {
int ret;