]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
We no longer need to test for GCC versions this old
authorBob Beck <beck@openssl.org>
Wed, 17 Jun 2026 23:05:05 +0000 (17:05 -0600)
committerNeil Horman <nhorman@openssl.org>
Fri, 10 Jul 2026 11:47:13 +0000 (07:47 -0400)
The minimum gcc to compile our code appears to be version 9, and
we are now C99.

All these older checks become a tautology on anything that will
build a modern OpenSSL tree, so clean this up.

Reviewed-by: Milan Broz <mbroz@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Neil Horman <nhorman@openssl.org>
MergeDate: Fri Jul 10 11:47:17 2026
(Merged from https://github.com/openssl/openssl/pull/31677)

21 files changed:
Configurations/10-main.conf
crypto/armcap.c
crypto/bn/asm/x86_64-gcc.c
crypto/bn/bn_div.c
crypto/bn/bn_local.h
crypto/chacha/chacha_enc.c
crypto/des/des_local.h
crypto/ec/curve448/curve448.c
crypto/ppccap.c
crypto/rc5/rc5_local.h
crypto/riscvcap.c
crypto/sha/sha256.c
crypto/sha/sha512.c
crypto/sm3/sm3_local.h
crypto/sparcv9cap.c
crypto/whrlpool/wp_block.c
include/crypto/modes.h
include/openssl/e_os2.h
include/openssl/macros.h
providers/fips/self_test_kats.c
providers/implementations/rands/seeding/rand_unix.c

index 6b2d1cffe415b1ba759522675f270c4347ae5165..4dd4250d1b55d9c4109a241e51cdc80dcba7b97a 100644 (file)
@@ -906,7 +906,6 @@ my %targets = (
         perlasm_scheme   => 'void',
     },
     "linux64-sparcv9" => {
-        # GCC 3.1 is a requirement
         inherit_from     => [ "linux-generic64" ],
         cflags           => add("-m64 -mcpu=ultrasparc"),
         cxxflags         => add("-m64 -mcpu=ultrasparc"),
index 1b8ebb5025f58a9f0c83707071eaa5a4c5ae8307..31b17f06a573d243785914c4753fada9f8b311b0 100644 (file)
@@ -69,7 +69,7 @@ uint32_t OPENSSL_rdtsc(void)
 
 /* First determine if getauxval() is available (OSSL_IMPLEMENT_GETAUXVAL) */
 
-#if defined(__GNUC__) && __GNUC__ >= 2
+#if defined(__GNUC__)
 void OPENSSL_cpuid_setup(void) __attribute__((constructor));
 #endif
 
index 7edb77806ed072ba2b81f72fbed069e7d48b116b..03299a7b72ea9a5640486752977f2c852c99b152 100644 (file)
@@ -8,7 +8,7 @@
  */
 
 #include "../bn_local.h"
-#if !(defined(__GNUC__) && __GNUC__ >= 2)
+#if !defined(__GNUC__)
 /* clang-format off */
 # include "../bn_asm.c"         /* kind of dirty hack for Sun Studio */
 /* clang-format on */
index 2b2ace05e30b764b0b19ca20f0f7c47aad718e36..a731b2d37ddbf6fabd4302384e45879d575688ba 100644 (file)
@@ -160,7 +160,7 @@ static int bn_left_align(BIGNUM *num)
 
 #if !defined(OPENSSL_NO_ASM) && !defined(OPENSSL_NO_INLINE_ASM) \
     && !defined(PEDANTIC) && !defined(BN_DIV3W)
-#if defined(__GNUC__) && __GNUC__ >= 2
+#if defined(__GNUC__)
 #if defined(__i386) || defined(__i386__)
 /*-
  * There were two reasons for implementing this template:
index db027111327bb4e1827773419c244c816d686661..4602cdcaba0fcb84ac7f3692fcac9365ea00b288 100644 (file)
@@ -380,7 +380,7 @@ struct bn_gencb_st {
 #if defined(__DECC)
 #include <c_asm.h>
 #define BN_UMULT_HIGH(a, b) (BN_ULONG)asm("umulh %a0,%a1,%v0", (a), (b))
-#elif defined(__GNUC__) && __GNUC__ >= 2
+#elif defined(__GNUC__)
 #define BN_UMULT_HIGH(a, b) ({     \
         register BN_ULONG ret;          \
         asm ("umulh     %1,%2,%0"       \
@@ -389,7 +389,7 @@ struct bn_gencb_st {
         ret; })
 #endif /* compiler */
 #elif defined(_ARCH_PPC64) && defined(SIXTY_FOUR_BIT_LONG)
-#if defined(__GNUC__) && __GNUC__ >= 2
+#if defined(__GNUC__)
 #define BN_UMULT_HIGH(a, b) ({     \
         register BN_ULONG ret;          \
         asm ("mulhdu    %0,%1,%2"       \
@@ -398,7 +398,7 @@ struct bn_gencb_st {
         ret; })
 #endif /* compiler */
 #elif (defined(__x86_64) || defined(__x86_64__)) && (defined(SIXTY_FOUR_BIT_LONG) || defined(SIXTY_FOUR_BIT))
-#if defined(__GNUC__) && __GNUC__ >= 2
+#if defined(__GNUC__)
 #define BN_UMULT_HIGH(a, b) ({     \
         register BN_ULONG ret,discard;  \
         asm ("mulq      %3"             \
@@ -422,7 +422,7 @@ unsigned __int64 _umul128(unsigned __int64 a, unsigned __int64 b,
 #define BN_UMULT_LOHI(low, high, a, b) ((low) = _umul128((a), (b), &(high)))
 #endif
 #elif defined(__mips) && (defined(SIXTY_FOUR_BIT) || defined(SIXTY_FOUR_BIT_LONG))
-#if defined(__GNUC__) && __GNUC__ >= 2
+#if defined(__GNUC__)
 #define BN_UMULT_HIGH(a, b) ({       \
         register BN_ULONG ret;          \
         asm ("dmultu    %1,%2"          \
@@ -435,7 +435,7 @@ unsigned __int64 _umul128(unsigned __int64 a, unsigned __int64 b,
         : "r"(a), "r"(b));
 #endif
 #elif defined(__aarch64__) && defined(SIXTY_FOUR_BIT_LONG)
-#if defined(__GNUC__) && __GNUC__ >= 2
+#if defined(__GNUC__)
 #define BN_UMULT_HIGH(a, b) ({     \
         register BN_ULONG ret;          \
         asm ("umulh     %0,%1,%2"       \
index e9a4d3263a5600888cc3927c08f254dca1cb33d8..c7c36b9c5485f30348974a27253f9e58b9de7097 100644 (file)
@@ -24,7 +24,7 @@ typedef union {
 #define ROTATE(v, n) (((v) << (n)) | ((v) >> (32 - (n))))
 
 #ifndef PEDANTIC
-#if defined(__GNUC__) && __GNUC__ >= 2 && !defined(OPENSSL_NO_ASM) && !defined(OPENSSL_NO_INLINE_ASM)
+#if defined(__GNUC__) && !defined(OPENSSL_NO_ASM) && !defined(OPENSSL_NO_INLINE_ASM)
 #if defined(__riscv_zbb) || defined(__riscv_zbkb)
 #if __riscv_xlen == 64
 #undef ROTATE
index 0fee059ec47060f26531404c51dd216292478c6c..fa368c359c2c8cc033ee1b06ecf962dfffd8d9c5 100644 (file)
@@ -32,7 +32,7 @@
 #define ROTATE(a, n) (_lrotr(a, n))
 #elif defined(__ICC)
 #define ROTATE(a, n) (_rotr(a, n))
-#elif defined(__GNUC__) && __GNUC__ >= 2 && !defined(__STRICT_ANSI__) && !defined(OPENSSL_NO_ASM) && !defined(OPENSSL_NO_INLINE_ASM) && !defined(PEDANTIC)
+#elif defined(__GNUC__) && !defined(__STRICT_ANSI__) && !defined(OPENSSL_NO_ASM) && !defined(OPENSSL_NO_INLINE_ASM) && !defined(PEDANTIC)
 #if defined(__i386) || defined(__i386__) || defined(__x86_64) || defined(__x86_64__)
 #define ROTATE(a, n) ({        \
     register unsigned int ret; \
index 1a31f86355985fa96785e08090eb9b7f427b7adc..29edb317f13e46d679de3ffc9f65945627a86b9c 100644 (file)
@@ -502,7 +502,7 @@ struct smvt_control {
     int power, addend;
 };
 
-#if defined(__GNUC__) && (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 3))
+#if defined(__GNUC__)
 #define NUMTRAILINGZEROS __builtin_ctz
 #else
 #define NUMTRAILINGZEROS numtrailingzeros
index a2acf6b6ed2965152a99d2417b3f2b5b85001c3b..e029eb3051af68194ed9e79f14552ee059955a3e 100644 (file)
@@ -134,7 +134,7 @@ static unsigned long getauxval(unsigned long key)
 #define HWCAP_ARCH_3_00 (1U << 23)
 #define HWCAP_ARCH_3_1 (1U << 18)
 
-#if defined(__GNUC__) && __GNUC__ >= 2
+#if defined(__GNUC__)
 __attribute__((constructor))
 #endif
 void OPENSSL_cpuid_setup(void)
index a1fbe61fecb1bb43d703d73c83a218a338ff1771..7b5f8c847bc3c5635cb2c62897a1006baef36a74 100644 (file)
@@ -19,7 +19,7 @@
 #elif defined(__ICC)
 #define ROTATE_l32(a, n) _rotl(a, n)
 #define ROTATE_r32(a, n) _rotr(a, n)
-#elif defined(__GNUC__) && __GNUC__ >= 2 && !defined(__STRICT_ANSI__) && !defined(OPENSSL_NO_ASM) && !defined(OPENSSL_NO_INLINE_ASM) && !defined(PEDANTIC)
+#elif defined(__GNUC__) && !defined(__STRICT_ANSI__) && !defined(OPENSSL_NO_ASM) && !defined(OPENSSL_NO_INLINE_ASM) && !defined(PEDANTIC)
 #if defined(__i386) || defined(__i386__) || defined(__x86_64) || defined(__x86_64__)
 #define ROTATE_l32(a, n) ({              \
     register unsigned int ret;           \
index cdec9a021630777f362a66bfa987e3dd185ffdcf..760fc5b0dd51c7c2017292b5b3b0af998dd4bcbf 100644 (file)
@@ -129,7 +129,7 @@ size_t riscv_vlen(void)
     return vlen;
 }
 
-#if defined(__GNUC__) && __GNUC__ >= 2
+#if defined(__GNUC__)
 __attribute__((constructor))
 #endif
 void OPENSSL_cpuid_setup(void)
index eab94876225415bec217949b15b8f7bf4839f084..8cbbfdbb30e3437c4dda24a8d72397c2206b1f70 100644 (file)
@@ -164,7 +164,7 @@ static const SHA_LONG K256[64] = {
 };
 
 #ifndef PEDANTIC
-#if defined(__GNUC__) && __GNUC__ >= 2 && !defined(OPENSSL_NO_ASM) && !defined(OPENSSL_NO_INLINE_ASM)
+#if defined(__GNUC__) && !defined(OPENSSL_NO_ASM) && !defined(OPENSSL_NO_INLINE_ASM)
 #if defined(__riscv_zknh)
 #define Sigma0(x) ({ MD32_REG_T ret;            \
                         asm ("sha256sum0 %0, %1"    \
index 6ccc0070e039eeb3158897b74a372c7765aa8225..9ba32f292642477b72fff0622152e21c0ac00b72 100644 (file)
@@ -343,7 +343,7 @@ static const SHA_LONG64 K512[80] = {
 };
 
 #ifndef PEDANTIC
-#if defined(__GNUC__) && __GNUC__ >= 2 && !defined(OPENSSL_NO_ASM) && !defined(OPENSSL_NO_INLINE_ASM)
+#if defined(__GNUC__) && !defined(OPENSSL_NO_ASM) && !defined(OPENSSL_NO_INLINE_ASM)
 #if defined(__x86_64) || defined(__x86_64__)
 #define ROTR(a, n) ({ SHA_LONG64 ret;             \
                                 asm ("rorq %1,%0"       \
index 6cb8dca61b1957fc35f225fb54b8191d3a652141..41639b3c95be7e729a197d4d927becf224064b70 100644 (file)
@@ -77,7 +77,7 @@ void ossl_sm3_transform(SM3_CTX *c, const unsigned char *data);
 /* clang-format on */
 
 #ifndef PEDANTIC
-#if defined(__GNUC__) && __GNUC__ >= 2 && !defined(OPENSSL_NO_ASM) && !defined(OPENSSL_NO_INLINE_ASM)
+#if defined(__GNUC__) && !defined(OPENSSL_NO_ASM) && !defined(OPENSSL_NO_INLINE_ASM)
 #if defined(__riscv_zksh)
 #define P0(x) ({ MD32_REG_T ret;        \
                        asm ("sm3p0 %0, %1" \
index c9cc2b9575ed6feed1bb5a5ef8383d981e49c942..cea44ada9b841c220e9ff65eef073f3b7e296e75 100644 (file)
@@ -71,7 +71,7 @@ static void common_handler(int sig)
 }
 
 #if defined(__sun) && defined(__SVR4)
-#if defined(__GNUC__) && __GNUC__ >= 2
+#if defined(__GNUC__)
 extern unsigned int getisax(unsigned int vec[], unsigned int sz) __attribute__((weak));
 #elif defined(__SUNPRO_C)
 #pragma weak getisax
index 13b3f7b37fedb1df8ff436815801cde7241b8b9b..62fa849dad84a8bed7a61647a89f6810962a95e1 100644 (file)
@@ -103,7 +103,7 @@ typedef uint64_t u64_aX;
 #pragma intrinsic(_rotl64)
 #define ROTATE(a, n) _rotl64((a), n)
 #endif
-#elif defined(__GNUC__) && __GNUC__ >= 2
+#elif defined(__GNUC__)
 #if defined(__x86_64) || defined(__x86_64__)
 #if defined(L_ENDIAN)
 #define ROTATE(a, n) ({ uint64_t ret; asm ("rolq %1,%0"   \
index d749eed77dfbff4c72d6bd69b63b4d684e25da11..baa0f3a6c14eee37ef11c5c259c1195575ee48b9 100644 (file)
@@ -31,7 +31,7 @@
 #endif
 
 #if !defined(PEDANTIC) && !defined(OPENSSL_NO_ASM) && !defined(OPENSSL_NO_INLINE_ASM)
-#if defined(__GNUC__) && __GNUC__ >= 2
+#if defined(__GNUC__)
 #if defined(__x86_64) || defined(__x86_64__)
 #define BSWAP8(x) ({ uint64_t ret_=(x);                   \
                         asm ("bswapq %0"                \
index 5f390037d78b5f4f45692077bbcb7baa95c8397c..f3cda73da168adfd9ce95324e3591e906ebf9f04 100644 (file)
@@ -253,7 +253,7 @@ typedef uint64_t ossl_uintmax_t;
 #if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
 /* just use inline */
 #define ossl_inline inline
-#elif defined(__GNUC__) && __GNUC__ >= 2
+#elif defined(__GNUC__)
 #define ossl_inline __inline__
 #elif defined(_MSC_VER)
 /*
@@ -271,7 +271,7 @@ typedef uint64_t ossl_uintmax_t;
 
 #if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L && !defined(__cplusplus)
 #define ossl_noreturn _Noreturn
-#elif defined(__GNUC__) && __GNUC__ >= 2
+#elif defined(__GNUC__)
 #define ossl_noreturn __attribute__((noreturn))
 #else
 #define ossl_noreturn
index 40f067c8ab50db4673799a07f5fad4989d1333b1..7e820875e228a26a535ab722825353fe56b9b876 100644 (file)
     __pragma(warning(push)) __pragma(warning(disable : 4996))
 #define OSSL_END_ALLOW_DEPRECATED __pragma(warning(pop))
 #elif defined(__GNUC__)
-/*
- * According to GCC documentation, deprecations with message appeared in
- * GCC 4.5.0
- */
-#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5)
 #define OSSL_DEPRECATED(since) \
     __attribute__((deprecated("Since OpenSSL " #since)))
 #define OSSL_DEPRECATED_FOR(since, message) \
     __attribute__((deprecated("Since OpenSSL " #since ";" message)))
 #define OSSL_DEPRECATED_MESSAGE(message) __attribute__((deprecated(message)))
-#elif __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 0)
-#define OSSL_DEPRECATED(since) __attribute__((deprecated))
-#define OSSL_DEPRECATED_FOR(since, message) __attribute__((deprecated))
-#define OSSL_DEPRECATED_MESSAGE(message) __attribute__((deprecated))
-#endif
 #define OSSL_BEGIN_ALLOW_DEPRECATED \
     _Pragma("GCC diagnostic push")  \
         _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"")
 #if defined(__STDC_VERSION__)
 #if __STDC_VERSION__ >= 199901L
 #define OPENSSL_FUNC __func__
-#elif defined(__GNUC__) && __GNUC__ >= 2
+#elif defined(__GNUC__)
 #define OPENSSL_FUNC __FUNCTION__
 #endif
 #elif defined(_MSC_VER)
index 17f79b9d0c43044ff78963478ae22b4277055150..f2d5c439d9eb49c77b4bb8e38bf7f7b8866804b6 100644 (file)
@@ -213,7 +213,7 @@ err:
     return ret;
 }
 
-#if defined(__GNUC__) && __GNUC__ >= 4
+#if defined(__GNUC__)
 #define SENTINEL __attribute__((sentinel))
 #endif
 
index 95742eb8482c48d0ead51fdafc261324f2446811..67b38cb719910c2c4bbe5e6fe9eb7fcf82774628 100644 (file)
@@ -354,7 +354,7 @@ static ssize_t syscall_random(void *buf, size_t buflen)
      * internally. So we need to check errno for ENOSYS
      */
 #if !defined(__DragonFly__) && !defined(__NetBSD__) && !defined(__FreeBSD__)
-#if defined(__GNUC__) && __GNUC__ >= 2 && defined(__ELF__) && !defined(__hpux)
+#if defined(__GNUC__) && defined(__ELF__) && !defined(__hpux)
     extern int getentropy(void *buffer, size_t length) __attribute__((weak));
 
     if (getentropy != NULL) {