[Libreoffice-commits] core.git: compilerplugins/clang compilerplugins/Makefile-clang.mk

Stephan Bergmann (via logerrit) logerrit at kemper.freedesktop.org
Thu Aug 15 13:52:31 UTC 2019


 compilerplugins/Makefile-clang.mk                 |    2 ++
 compilerplugins/clang/sharedvisitor/generator.cxx |    2 +-
 2 files changed, 3 insertions(+), 1 deletion(-)

New commits:
commit cd6698ca91c96c9c4823aecd132e2713ec069e24
Author:     Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Thu Aug 15 11:58:35 2019 +0200
Commit:     Stephan Bergmann <sbergman at redhat.com>
CommitDate: Thu Aug 15 15:51:16 2019 +0200

    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>(), "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 <sbergman at redhat.com>

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",


More information about the Libreoffice-commits mailing list