compilerplugins/Makefile-clang.mk | 8 ++++++++ config_host.mk.in | 1 + configure.ac | 14 ++++++++++++++ 3 files changed, 23 insertions(+)
New commits: commit bce14e97a6dad7686643d094995433c77e4aee7e Author: Stephan Bergmann <[email protected]> AuthorDate: Fri Feb 14 16:28:53 2020 +0100 Commit: Stephan Bergmann <[email protected]> CommitDate: Fri Feb 14 19:24:32 2020 +0100 Prevent -Werror,-Wunknown-warning-option when building compilerplugins ...with --enable-werror (seen it fail with a local build against a locally built Clang 5.0.2). (bin/gen-boost-headers faces a similar dilemma with Clang needing to silence -Wunknown-warning-option and GCC failing upon the silencing incantation. There, we were able to hack around that with a preceding #pragma GCC diagnostic ignored "-Wpragmas" Here, the easiest approach appears to be a new COMPILER_PLUGINS_COM_IS_CLANG analoguous to the existing COM_IS_CLANG.) Change-Id: I9036261fdd238c8a020a1d88b4e75fd444f9e030 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88725 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <[email protected]> diff --git a/compilerplugins/Makefile-clang.mk b/compilerplugins/Makefile-clang.mk index 543ec27aad44..266919cf02b8 100644 --- a/compilerplugins/Makefile-clang.mk +++ b/compilerplugins/Makefile-clang.mk @@ -101,6 +101,14 @@ CLANGWERROR := #TODO: /WX else CLANGWERROR := -Werror +# When COMPILER_PLUGINS_CXXFLAGS (obtained via `llvm-config --cxxflags`) contains options like +# -Wno-maybe-uninitialized that are targeting GCC (when LLVM was actually built with GCC), and +# COMPILER_PLUGINS_CXX (defaulting to CXX) deonotes a Clang that does not understand those options, +# it fails with -Werror,-Wunknown-warning-option, so we need -Wno-unknown-warning-option (but which +# GCC does not understand) at least with -Werror: +ifeq ($(COMPILER_PLUGINS_COM_IS_CLANG),TRUE) +CLANGWERROR += -Wno-unknown-warning-option +endif endif endif diff --git a/config_host.mk.in b/config_host.mk.in index 9dd4b72c421c..ef612734da3c 100644 --- a/config_host.mk.in +++ b/config_host.mk.in @@ -78,6 +78,7 @@ export COMMONS_LOGGING_JAR=@COMMONS_LOGGING_JAR@ export COMMONS_LOGGING_VERSION=@COMMONS_LOGGING_VERSION@ export COMPATH=@COMPATH@ export COMPILER_PLUGINS=@COMPILER_PLUGINS@ +export COMPILER_PLUGINS_COM_IS_CLANG=@COMPILER_PLUGINS_COM_IS_CLANG@ export COMPILER_PLUGINS_CXX=@COMPILER_PLUGINS_CXX@ export COMPILER_PLUGINS_CXXFLAGS=@COMPILER_PLUGINS_CXXFLAGS@ export COMPILER_PLUGINS_CXX_LINKFLAGS=@COMPILER_PLUGINS_CXX_LINKFLAGS@ diff --git a/configure.ac b/configure.ac index 3fa8fc760e3f..e186f6d3eb73 100644 --- a/configure.ac +++ b/configure.ac @@ -7218,6 +7218,7 @@ if test "$COM_IS_CLANG" != "TRUE"; then fi fi +COMPILER_PLUGINS_COM_IS_CLANG= if test "$COM_IS_CLANG" = "TRUE"; then if test -n "$enable_compiler_plugins"; then compiler_plugins="$enable_compiler_plugins" @@ -7336,6 +7337,18 @@ if test "$COM_IS_CLANG" = "TRUE"; then LDFLAGS=$save_LDFLAGS LIBS="$save_LIBS" AC_LANG_POP([C++]) + + AC_MSG_CHECKING([whether the compiler for building compilerplugins is actually Clang]) + AC_COMPILE_IFELSE([AC_LANG_SOURCE([[ + #ifndef __clang__ + you lose + #endif + int foo=42; + ]])], + [AC_MSG_RESULT([yes]) + COMPILER_PLUGINS_COM_IS_CLANG=TRUE], + [AC_MSG_RESULT([no])]) + AC_SUBST(COMPILER_PLUGINS_COM_IS_CLANG) fi else if test "$enable_compiler_plugins" = "yes"; then @@ -7343,6 +7356,7 @@ else fi fi AC_SUBST(COMPILER_PLUGINS) +AC_SUBST(COMPILER_PLUGINS_COM_IS_CLANG) AC_SUBST(COMPILER_PLUGINS_CXX) AC_SUBST(COMPILER_PLUGINS_CXXFLAGS) AC_SUBST(COMPILER_PLUGINS_CXX_LINKFLAGS) _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
