From cd6698ca91c96c9c4823aecd132e2713ec069e24 Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Thu, 15 Aug 2019 11:58:35 +0200 Subject: LLVM trunk requires C++14 now ...which caused failures like > [GEN] compilerplugins/clang/sharedvisitor/sharedvisitor.cxx > In file included from /data/sbergman/lo/core/compilerplugins/clang/badstatics.cxx:14: > In file included from /data/sbergman/lo/core/compilerplugins/clang/check.hxx:15: > In file included from /data/sbergman/llvm/inst/include/clang/AST/DeclBase.h:18: > In file included from /data/sbergman/llvm/inst/include/clang/AST/DeclarationName.h:16: > In file included from /data/sbergman/llvm/inst/include/clang/AST/Type.h:48: > /data/sbergman/llvm/inst/include/llvm/Support/TrailingObjects.h:252:24: error: no member named 'is_final' in namespace 'std' > static_assert(std::is_final(), "BaseTy must be final."); > ~~~~~^ [...] However, unconditionally using -std=c++14 in generator.cxx would cause failures for builds against older Clang (and with COMPILER_PLUGINS_CXX specifying -std=c++11) on machines that have an old C++11-only system libstdc++. Those machines typically use --gcc-toolchain to use a newer non-system libstdc++ (cf. e.g. setting CC and CXX in lode's bin/linux_clang_dbgutil_64.env), so one solution could be to propagate such an option from CXX through to generator.cxx. But the easier fix appears to be to instead propagate the -std option. Change-Id: Ib081754ce8ad567305d1520e3a1ff6700fb22755 Reviewed-on: https://gerrit.libreoffice.org/77502 Tested-by: Jenkins Reviewed-by: Stephan Bergmann --- compilerplugins/Makefile-clang.mk | 2 ++ compilerplugins/clang/sharedvisitor/generator.cxx | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) (limited to 'compilerplugins') diff --git a/compilerplugins/Makefile-clang.mk b/compilerplugins/Makefile-clang.mk index d2c07fd06dba..ef80cfc0812d 100644 --- a/compilerplugins/Makefile-clang.mk +++ b/compilerplugins/Makefile-clang.mk @@ -208,6 +208,8 @@ CLANGTOOLLIBS = -lclangTooling -lclangDriver -lclangFrontend -lclangParse -lclan -lclangAST -lclangLex -lclangSerialization -lclangBasic $(shell $(LLVMCONFIG) --ldflags --libs --system-libs) # Path to the clang system headers (no idea if there's a better way to get it). CLANGTOOLDEFS = -DCLANGSYSINCLUDE=$(shell $(LLVMCONFIG) --libdir)/clang/$(shell $(LLVMCONFIG) --version | sed 's/svn//')/include +# -std=c++11 is in line with the default value for COMPILER_PLUGINS_CXX in configure.ac: +CLANGTOOLDEFS += -DSTDOPTION=\"$(or $(filter -std=%,$(COMPILER_PLUGINS_CXX)),-std=c++11)\" ifneq ($(filter-out MACOSX WNT,$(OS)),) ifneq ($(CLANGDIR),/usr) # Help the generator find Clang shared libs, if Clang is built so and installed in a non-standard prefix. diff --git a/compilerplugins/clang/sharedvisitor/generator.cxx b/compilerplugins/clang/sharedvisitor/generator.cxx index b12939516d16..ddcd901f47b6 100644 --- a/compilerplugins/clang/sharedvisitor/generator.cxx +++ b/compilerplugins/clang/sharedvisitor/generator.cxx @@ -555,7 +555,7 @@ int main(int argc, char** argv) "-I" STRINGIFY(BUILDDIR) "/config_host", // plugin sources use e.g. config_global.h "-I" STRINGIFY(CLANGDIR) "/include", // clang's headers "-I" STRINGIFY(CLANGSYSINCLUDE), // clang system headers - "-std=c++11", + STDOPTION, "-D__STDC_CONSTANT_MACROS", // Clang headers require these. "-D__STDC_FORMAT_MACROS", "-D__STDC_LIMIT_MACROS", -- cgit