I noticed some code that uses __inline__ (which IIUC is a gcc extension) as well as a related configure check. "inline" was first added to C99, and we now require C11, so we can just assume it's there, right? FWIW it looks like meson builds don't bother checking this.
-- nathan
>From daf8dd4a9364ea9c1d6c060c545f4f1cad682b7a Mon Sep 17 00:00:00 2001 From: Nathan Bossart <[email protected]> Date: Thu, 19 Feb 2026 11:15:18 -0600 Subject: [PATCH v1 1/1] Assume availability of "inline" keyword. --- configure | 42 ----------------------------- configure.ac | 1 - src/include/pg_config.h.in | 6 ----- src/include/port/atomics/arch-x86.h | 2 +- src/include/storage/s_lock.h | 24 ++++++++--------- 5 files changed, 13 insertions(+), 62 deletions(-) diff --git a/configure b/configure index a6eab396299..e1a08129974 100755 --- a/configure +++ b/configure @@ -14741,48 +14741,6 @@ $as_echo "#define AC_APPLE_UNIVERSAL_BUILD 1" >>confdefs.h presetting ac_cv_c_bigendian=no (or yes) will help" "$LINENO" 5 ;; esac -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for inline" >&5 -$as_echo_n "checking for inline... " >&6; } -if ${ac_cv_c_inline+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_cv_c_inline=no -for ac_kw in inline __inline__ __inline; do - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#ifndef __cplusplus -typedef int foo_t; -static $ac_kw foo_t static_foo () {return 0; } -$ac_kw foo_t foo () {return 0; } -#endif - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_c_inline=$ac_kw -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - test "$ac_cv_c_inline" != no && break -done - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_inline" >&5 -$as_echo "$ac_cv_c_inline" >&6; } - -case $ac_cv_c_inline in - inline | yes) ;; - *) - case $ac_cv_c_inline in - no) ac_val=;; - *) ac_val=$ac_cv_c_inline;; - esac - cat >>confdefs.h <<_ACEOF -#ifndef __cplusplus -#define inline $ac_val -#endif -_ACEOF - ;; -esac - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for C printf format archetype" >&5 $as_echo_n "checking for C printf format archetype... " >&6; } if ${pgac_cv_printf_archetype+:} false; then : diff --git a/configure.ac b/configure.ac index 455ba31f1d1..cc85c233c03 100644 --- a/configure.ac +++ b/configure.ac @@ -1712,7 +1712,6 @@ fi m4_defun([AC_PROG_CC_STDC], []) dnl We don't want that. AC_C_BIGENDIAN -AC_C_INLINE PGAC_PRINTF_ARCHETYPE PGAC_CXX_PRINTF_ARCHETYPE PGAC_C_STATEMENT_EXPRESSIONS diff --git a/src/include/pg_config.h.in b/src/include/pg_config.h.in index 339268dc8ef..3824a5571bb 100644 --- a/src/include/pg_config.h.in +++ b/src/include/pg_config.h.in @@ -780,12 +780,6 @@ /* Define for large files, on AIX-style hosts. */ #undef _LARGE_FILES -/* Define to `__inline__' or `__inline' if that's what the C compiler - calls it, or to nothing if 'inline' is not supported under any name. */ -#ifndef __cplusplus -#undef inline -#endif - /* Define to keyword to use for C99 restrict support, or to nothing if not supported */ #undef pg_restrict diff --git a/src/include/port/atomics/arch-x86.h b/src/include/port/atomics/arch-x86.h index 43a8e90b2d2..bd6f4f56ca2 100644 --- a/src/include/port/atomics/arch-x86.h +++ b/src/include/port/atomics/arch-x86.h @@ -104,7 +104,7 @@ typedef struct pg_atomic_uint64 */ #if defined(__GNUC__) || defined(__INTEL_COMPILER) #define PG_HAVE_SPIN_DELAY -static __inline__ void +static inline void pg_spin_delay_impl(void) { __asm__ __volatile__(" rep; nop \n"); diff --git a/src/include/storage/s_lock.h b/src/include/storage/s_lock.h index 3d9070e79d4..62364586d60 100644 --- a/src/include/storage/s_lock.h +++ b/src/include/storage/s_lock.h @@ -134,7 +134,7 @@ typedef unsigned char slock_t; #define TAS(lock) tas(lock) -static __inline__ int +static inline int tas(volatile slock_t *lock) { slock_t _res = 1; @@ -164,7 +164,7 @@ tas(volatile slock_t *lock) #define SPIN_DELAY() spin_delay() -static __inline__ void +static inline void spin_delay(void) { /* @@ -215,7 +215,7 @@ typedef unsigned char slock_t; */ #define TAS_SPIN(lock) (*(lock) ? 1 : TAS(lock)) -static __inline__ int +static inline int tas(volatile slock_t *lock) { slock_t _res = 1; @@ -231,7 +231,7 @@ tas(volatile slock_t *lock) #define SPIN_DELAY() spin_delay() -static __inline__ void +static inline void spin_delay(void) { /* @@ -259,7 +259,7 @@ spin_delay(void) typedef int slock_t; -static __inline__ int +static inline int tas(volatile slock_t *lock) { return __sync_lock_test_and_set(lock, 1); @@ -277,7 +277,7 @@ tas(volatile slock_t *lock) #define SPIN_DELAY() spin_delay() -static __inline__ void +static inline void spin_delay(void) { /* @@ -302,7 +302,7 @@ typedef unsigned int slock_t; #define TAS(lock) tas(lock) -static __inline__ int +static inline int tas(volatile slock_t *lock) { int _res = 0; @@ -331,7 +331,7 @@ typedef unsigned char slock_t; #define TAS(lock) tas(lock) -static __inline__ int +static inline int tas(volatile slock_t *lock) { slock_t _res; @@ -416,7 +416,7 @@ typedef unsigned int slock_t; * But if the spinlock is in ordinary memory, we can use lwsync instead for * better performance. */ -static __inline__ int +static inline int tas(volatile slock_t *lock) { slock_t _t; @@ -482,7 +482,7 @@ typedef unsigned int slock_t; #define MIPS_SET_MIPS2 #endif -static __inline__ int +static inline int tas(volatile slock_t *lock) { volatile slock_t *_l = lock; @@ -544,7 +544,7 @@ do \ typedef int slock_t; -static __inline__ int +static inline int tas(volatile slock_t *lock) { return __sync_lock_test_and_set(lock, 1); @@ -559,7 +559,7 @@ tas(volatile slock_t *lock) typedef char slock_t; -static __inline__ int +static inline int tas(volatile slock_t *lock) { return __sync_lock_test_and_set(lock, 1); -- 2.50.1 (Apple Git-155)
