diff --git a/crypto/bio/fd.c b/crypto/bio/fd.c index ea5bfd8c..fed5228f 100644 --- a/crypto/bio/fd.c +++ b/crypto/bio/fd.c @@ -73,6 +73,7 @@ OPENSSL_MSVC_PRAGMA(warning(pop)) #include #include "internal.h" +#include "../internal.h" static int bio_fd_non_fatal_error(int err) { diff --git a/crypto/bio/file.c b/crypto/bio/file.c index 278be188..f61dbe4f 100644 --- a/crypto/bio/file.c +++ b/crypto/bio/file.c @@ -81,6 +81,8 @@ #include #include +#include "../internal.h" + #define BIO_FP_READ 0x02 #define BIO_FP_WRITE 0x04 diff --git a/crypto/cipher_extra/e_rc2.c b/crypto/cipher_extra/e_rc2.c index 0b2caf55..221a9c92 100644 --- a/crypto/cipher_extra/e_rc2.c +++ b/crypto/cipher_extra/e_rc2.c @@ -57,6 +57,8 @@ #include #include +#include "../internal.h" + #define c2l(c, l) \ do { \ diff --git a/crypto/fipsmodule/des/internal.h b/crypto/fipsmodule/des/internal.h index 4d65ff1d..1ae3f22a 100644 --- a/crypto/fipsmodule/des/internal.h +++ b/crypto/fipsmodule/des/internal.h @@ -59,6 +59,8 @@ #include +#include "../../internal.h" + #if defined(__cplusplus) extern "C" { #endif diff --git a/crypto/internal.h b/crypto/internal.h index 95b8d289..067f3bb0 100644 --- a/crypto/internal.h +++ b/crypto/internal.h @@ -172,6 +172,20 @@ typedef __uint128_t uint128_t; #define OPENSSL_ARRAY_SIZE(array) (sizeof(array) / sizeof((array)[0])) +// Have a generic fall-through for different versions of C/C++. +#if defined(__cplusplus) && __cplusplus >= 201703L +#define OPENSSL_FALLTHROUGH [[fallthrough]] +#elif defined(__cplusplus) && __cplusplus >= 201103L && defined(__clang__) +#define OPENSSL_FALLTHROUGH [[clang::fallthrough]] +#elif defined(__cplusplus) && __cplusplus >= 201103L && defined(__GNUC__) && \ + __GNUC__ >= 7 +#define OPENSSL_FALLTHROUGH [[gnu::fallthrough]] +#elif defined(__GNUC__) && __GNUC__ >= 7 // gcc 7 +#define OPENSSL_FALLTHROUGH __attribute__ ((fallthrough)) +#else // C++11 on gcc 6, and all other cases +#define OPENSSL_FALLTHROUGH +#endif + // buffers_alias returns one if |a| and |b| alias and zero otherwise. static inline int buffers_alias(const uint8_t *a, size_t a_len, const uint8_t *b, size_t b_len) { diff --git a/decrepit/macros.h b/decrepit/macros.h index c4ebeec9..7888f0d1 100644 --- a/decrepit/macros.h +++ b/decrepit/macros.h @@ -57,6 +57,8 @@ #ifndef OPENSSL_HEADER_DECREPIT_MACROS_H #define OPENSSL_HEADER_DECREPIT_MACROS_H +#include "../crypto/internal.h" + // NOTE - c is not incremented as per n2l #define n2ln(c, l1, l2, n) \ diff --git a/include/openssl/base.h b/include/openssl/base.h index dea069ab..8db72d81 100644 --- a/include/openssl/base.h +++ b/include/openssl/base.h @@ -223,20 +223,6 @@ extern "C" { #endif #endif -// Have a generic fall-through for different versions of C/C++. -#if defined(__cplusplus) && __cplusplus >= 201703L -#define OPENSSL_FALLTHROUGH [[fallthrough]] -#elif defined(__cplusplus) && __cplusplus >= 201103L && defined(__clang__) -#define OPENSSL_FALLTHROUGH [[clang::fallthrough]] -#elif defined(__cplusplus) && __cplusplus >= 201103L && defined(__GNUC__) && \ - __GNUC__ >= 7 -#define OPENSSL_FALLTHROUGH [[gnu::fallthrough]] -#elif defined(__GNUC__) && __GNUC__ >= 7 // gcc 7 -#define OPENSSL_FALLTHROUGH __attribute__ ((fallthrough)) -#else // C++11 on gcc 6, and all other cases -#define OPENSSL_FALLTHROUGH -#endif - // CRYPTO_THREADID is a dummy value. typedef int CRYPTO_THREADID;