From: Rhys Kidd Date: Sat, 2 Feb 2019 22:53:33 +0000 (-0500) Subject: config: Conditionalize -finline-functions on compiler support X-Git-Tag: VALGRIND_3_15_0~61 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=71cf18c1200b5bbc6796f016165f790e8e85d88e;p=thirdparty%2Fvalgrind.git config: Conditionalize -finline-functions on compiler support Certain clang compiler versions do not support -finline-functions, so only apply this compiler option conditionally if supported. Warnings with Apple LLVM version 8.0.0 (clang-800.0.42.1), based on upstream clang 3.9.0: clang: warning: optimization flag '-finline-functions' is not supported clang: warning: argument unused during compilation: '-finline-functions' Fixes: 7dd9a7f ("Add -finline-functions to standard build flags, so gcc will consider all functions as candidates for inlining.") Signed-off-by: Rhys Kidd --- diff --git a/Makefile.all.am b/Makefile.all.am index 8ea95a6118..2ad54034f0 100644 --- a/Makefile.all.am +++ b/Makefile.all.am @@ -97,7 +97,7 @@ clean-noinst_DSYMS: # -fno-builtin is important for defeating LLVM's idiom recognition # that somehow causes VG_(memset) to get into infinite recursion. AM_CFLAGS_BASE = \ - -O2 -finline-functions -g \ + -O2 -g \ -Wall \ -Wmissing-prototypes \ -Wshadow \ @@ -116,6 +116,7 @@ AM_CFLAGS_BASE = \ @FLAG_W_LOGICAL_OP@ \ @FLAG_W_ENUM_CONVERSION@ \ @FLAG_W_OLD_STYLE_DECLARATION@ \ + @FLAG_FINLINE_FUNCTIONS@ \ @FLAG_FNO_STACK_PROTECTOR@ \ @FLAG_FSANITIZE@ \ -fno-strict-aliasing \ diff --git a/configure.ac b/configure.ac index d0b68b46be..8779cf0297 100644 --- a/configure.ac +++ b/configure.ac @@ -2200,6 +2200,27 @@ CFLAGS=$safe_CFLAGS AC_SUBST(FLAG_FNO_STACK_PROTECTOR) +# does this compiler support -finline-functions ? +AC_MSG_CHECKING([if gcc accepts -finline-functions]) + +safe_CFLAGS=$CFLAGS +CFLAGS="-finline-functions -Werror" + +AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ + return 0; +]])], [ +inline_functions=yes +FLAG_FINLINE_FUNCTIONS="-finline-functions" +AC_MSG_RESULT([yes]) +], [ +inline_functions=no +FLAG_FINLINE_FUNCTIONS="" +AC_MSG_RESULT([no]) +]) +CFLAGS=$safe_CFLAGS + +AC_SUBST(FLAG_FINLINE_FUNCTIONS) + # Does GCC support disabling Identical Code Folding? # We want to disabled Identical Code Folding for the # tools preload shared objects to get better backraces.