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

@@ -505,16 +505,20 @@ 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
dnl Deal with switch fallthrough warnings
AH_TOP([
#if defined(__GNUC__)
#if __GNUC__ >= 7
# define fallthrough __attribute__((fallthrough))
#if defined(DISPATCH_FALLTHROUGH)
# define HEIM_FALLTHROUGH DISPATCH_FALLTHROUGH
#else
# define fallthrough do {} while (0) /* fallthrough */
#endif
#else
# define fallthrough do {} while (0) /* fallthrough */
# if defined(__GNUC__)
# if __GNUC__ >= 7
# define HEIM_FALLTHROUGH __attribute__((fallthrough))
# else
# define HEIM_FALLTHROUGH do {} while (0) /* fallthrough */
# endif
# else
# define HEIM_FALLTHROUGH do {} while (0) /* fallthrough */
# endif
#endif
])