diff options
| author | Tom Lane | 2014-05-01 20:16:36 +0000 |
|---|---|---|
| committer | Tom Lane | 2014-05-01 20:16:36 +0000 |
| commit | 4c8aa8b5aea1e032f569222d4b6c1019e84622dc (patch) | |
| tree | 116edf673f0cd928a621b39fbf89e297440bb5fa /config/c-compiler.m4 | |
| parent | 3f8c8e3c61cef5729980ee4372ec159862a979f1 (diff) | |
Fix "quiet inline" configure test for newer clang compilers.
This test used to just define an unused static inline function and check
whether that causes a warning. But newer clang versions warn about
unused static inline functions when defined inside a .c file, but not
when defined in an included header, which is the case we care about.
Change the test to cope.
Andres Freund
Diffstat (limited to 'config/c-compiler.m4')
| -rw-r--r-- | config/c-compiler.m4 | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/config/c-compiler.m4 b/config/c-compiler.m4 index 4ba3236ef46..802f5539d34 100644 --- a/config/c-compiler.m4 +++ b/config/c-compiler.m4 @@ -19,7 +19,18 @@ fi])# PGAC_C_SIGNED # PGAC_C_INLINE # ------------- -# Check if the C compiler understands inline functions. +# 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 @@ -28,7 +39,7 @@ AC_CACHE_CHECK([for quiet inline (no complaint if unreferenced)], pgac_cv_c_inli 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([static inline int fun () {return 0;}],[])], + 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]) |
