diff options
author | Andres Freund <andres@anarazel.de> | 2015-08-05 18:19:52 +0200 |
---|---|---|
committer | Andres Freund <andres@anarazel.de> | 2015-08-05 18:19:52 +0200 |
commit | de6fd1c898f6eca82c2130a9dbb42d00da68d79e (patch) | |
tree | 2387db94ee7d19f19ec45dbfc31c3a6c3494a62c /config/c-compiler.m4 | |
parent | a855118be3f0682a2061448db5a87dec50717af4 (diff) | |
download | postgresql-de6fd1c898f6eca82c2130a9dbb42d00da68d79e.tar.gz |
Rely on inline functions even if that causes warnings in older compilers.
So far we have worked around the fact that some very old compilers do
not support 'inline' functions by only using inline functions
conditionally (or not at all). Since such compilers are very rare by
now, we have decided to rely on inline functions from 9.6 onwards.
To avoid breaking these old compilers inline is defined away when not
supported. That'll cause "function x defined but not used" type of
warnings, but since nobody develops on such compilers anymore that's
ok.
This change in policy will allow us to more easily employ inline
functions.
I chose to remove code previously conditional on PG_USE_INLINE as it
seemed confusing to have code dependent on a define that's always
defined.
Blacklisting of compilers, like in c53f73879f, now has to be done
differently. A platform template can define PG_FORCE_DISABLE_INLINE to
force inline to be defined empty.
Discussion: 20150701161447.GB30708@awork2.anarazel.de
Diffstat (limited to 'config/c-compiler.m4')
-rw-r--r-- | config/c-compiler.m4 | 34 |
1 files changed, 0 insertions, 34 deletions
diff --git a/config/c-compiler.m4 b/config/c-compiler.m4 index 050bfa5c7d..397e1b0379 100644 --- a/config/c-compiler.m4 +++ b/config/c-compiler.m4 @@ -17,40 +17,6 @@ fi])# PGAC_C_SIGNED -# PGAC_C_INLINE -# ------------- -# Check if the C compiler understands inline functions without being -# noisy about unused static inline functions. Some older compilers -# understand inline functions (as tested by AC_C_INLINE) but warn about -# them if they aren't used in a translation unit. -# -# This test used to just define an inline function, but some compilers -# (notably clang) got too smart and now warn about unused static -# inline functions when defined inside a .c file, but not when defined -# in an included header. Since the latter is what we want to use, test -# to see if the warning appears when the function is in a header file. -# Not pretty, but it works. -# -# Defines: inline, PG_USE_INLINE -AC_DEFUN([PGAC_C_INLINE], -[AC_C_INLINE -AC_CACHE_CHECK([for quiet inline (no complaint if unreferenced)], pgac_cv_c_inline_quietly, - [pgac_cv_c_inline_quietly=no - if test "$ac_cv_c_inline" != no; then - pgac_c_inline_save_werror=$ac_c_werror_flag - ac_c_werror_flag=yes - AC_LINK_IFELSE([AC_LANG_PROGRAM([#include "$srcdir/config/test_quiet_include.h"],[])], - [pgac_cv_c_inline_quietly=yes]) - ac_c_werror_flag=$pgac_c_inline_save_werror - fi]) -if test "$pgac_cv_c_inline_quietly" != no; then - AC_DEFINE_UNQUOTED([PG_USE_INLINE], 1, - [Define to 1 if "static inline" works without unwanted warnings from ] - [compilations where static inline functions are defined but not called.]) -fi -])# PGAC_C_INLINE - - # PGAC_C_PRINTF_ARCHETYPE # ----------------------- # Set the format archetype used by gcc to check printf type functions. We |