Remove checks for no longer supported GCC versions

Since commit f5e0186f865 (Raise C requirement to C11), we effectively
require at least GCC version 4.7, so checks for older versions can be
removed.

Reviewed-by: Andres Freund <andres@anarazel.de>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://www.postgresql.org/message-id/flat/a0f817ee-fb86-483a-8a14-b6f7f5991b6e%40eisentraut.org
This commit is contained in:
Peter Eisentraut 2025-09-11 11:55:29 +02:00
parent 368c38dd47
commit 4fbe015145
2 changed files with 6 additions and 6 deletions

View File

@ -259,8 +259,8 @@
* choose not to. But, if possible, don't force inlining in unoptimized
* debug builds.
*/
#if (defined(__GNUC__) && __GNUC__ > 3 && defined(__OPTIMIZE__)) || defined(__SUNPRO_C)
/* GCC > 3 and Sunpro support always_inline via __attribute__ */
#if (defined(__GNUC__) && defined(__OPTIMIZE__)) || defined(__SUNPRO_C)
/* GCC and Sunpro support always_inline via __attribute__ */
#define pg_attribute_always_inline __attribute__((always_inline)) inline
#elif defined(_MSC_VER)
/* MSVC has a special keyword for this */
@ -277,7 +277,7 @@
* above, this should be placed before the function's return type and name.
*/
/* GCC and Sunpro support noinline via __attribute__ */
#if (defined(__GNUC__) && __GNUC__ > 2) || defined(__SUNPRO_C)
#if defined(__GNUC__) || defined(__SUNPRO_C)
#define pg_noinline __attribute__((noinline))
/* msvc via declspec */
#elif defined(_MSC_VER)
@ -369,7 +369,7 @@
* These should only be used sparingly, in very hot code paths. It's very easy
* to mis-estimate likelihoods.
*/
#if __GNUC__ >= 3
#ifdef __GNUC__
#define likely(x) __builtin_expect((x) != 0, 1)
#define unlikely(x) __builtin_expect((x) != 0, 0)
#else

View File

@ -30,14 +30,14 @@
#define pg_compiler_barrier_impl() __asm__ __volatile__("" ::: "memory")
/*
* If we're on GCC 4.1.0 or higher, we should be able to get a memory barrier
* If we're on GCC, we should be able to get a memory barrier
* out of this compiler built-in. But we prefer to rely on platform specific
* definitions where possible, and use this only as a fallback.
*/
#if !defined(pg_memory_barrier_impl)
# if defined(HAVE_GCC__ATOMIC_INT32_CAS)
# define pg_memory_barrier_impl() __atomic_thread_fence(__ATOMIC_SEQ_CST)
# elif (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 1))
# elif defined(__GNUC__)
# define pg_memory_barrier_impl() __sync_synchronize()
# endif
#endif /* !defined(pg_memory_barrier_impl) */