compilerplugins/Makefile-clang.mk | 10 ++-- compilerplugins/Makefile.mk | 6 -- compilerplugins/clang/checkconfigmacros.cxx | 28 +++++------ compilerplugins/clang/compat.hxx | 54 +++++++++++------------ compilerplugins/clang/getimplementationname.cxx | 3 - compilerplugins/clang/implicitboolconversion.cxx | 4 - compilerplugins/clang/nullptr.cxx | 11 ++-- compilerplugins/clang/override.cxx | 18 +++---- compilerplugins/clang/pluginhandler.cxx | 2 compilerplugins/clang/pluginhandler.hxx | 2 compilerplugins/clang/refcounting.cxx | 2 compilerplugins/clang/salbool.cxx | 4 - compilerplugins/clang/sfxpoolitem.cxx | 4 - compilerplugins/clang/staticmethods.cxx | 2 compilerplugins/clang/store/stdexception.cxx | 2 compilerplugins/clang/stringconstant.cxx | 3 + compilerplugins/clang/unreffun.cxx | 4 - compilerplugins/clang/unuseddefaultparams.cxx | 2 compilerplugins/clang/unusedmethods.cxx | 2 compilerplugins/clang/unusedvariablecheck.cxx | 2 compilerplugins/clang/vclwidgets.cxx | 2 config_host.mk.in | 1 config_host/config_clang.h.in | 2 configure.ac | 2 24 files changed, 93 insertions(+), 79 deletions(-)
New commits: commit a2dcac011a38294a6acb21ae7c69163fef6b4cef Author: Stephan Bergmann <[email protected]> Date: Fri Feb 26 14:29:17 2016 +0100 New COMPILER_PLUGINS_CXX to specify compiler to build Clang plugins with ...instead of trying to second-guess what to strip off $(CXX) to make it fit. Keep the old way for existing build scripts that rely on it. Change-Id: I145bdcba6d02002a9b653b4deb6e7f5a9c76cc8f diff --git a/compilerplugins/Makefile-clang.mk b/compilerplugins/Makefile-clang.mk index 1e98309..868b5b0 100644 --- a/compilerplugins/Makefile-clang.mk +++ b/compilerplugins/Makefile-clang.mk @@ -10,10 +10,14 @@ CLANG_COMMA :=, -# You may occasionally want to override some of these +ifeq ($(COMPILER_PLUGINS_CXX),) CLANGCXX=$(filter-out -m32 -m64 -fsanitize=%,$(CXX)) +else +CLANGCXX=$(COMPILER_PLUGINS_CXX) +endif -# Compile flags ('make CLANGCXXFLAGS=-g' if you need to debug the plugin) +# Compile flags ('make CLANGCXXFLAGS=-g' if you need to debug the plugin); you +# may occasionally want to override these: CLANGCXXFLAGS=-O2 -Wall -Wextra -Wundef -g # The uninteresting rest. diff --git a/config_host.mk.in b/config_host.mk.in index 8becc9e..89081ca 100644 --- a/config_host.mk.in +++ b/config_host.mk.in @@ -68,6 +68,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_CXX=@COMPILER_PLUGINS_CXX@ export COM_IS_CLANG=@COM_IS_CLANG@ export CPPUNIT_CFLAGS=$(gb_SPACE)@CPPUNIT_CFLAGS@ export CPPUNIT_LIBS=$(gb_SPACE)@CPPUNIT_LIBS@ diff --git a/configure.ac b/configure.ac index 18c89ab..6b405e4 100644 --- a/configure.ac +++ b/configure.ac @@ -6735,6 +6735,7 @@ else fi fi AC_SUBST(COMPILER_PLUGINS) +AC_SUBST(COMPILER_PLUGINS_CXX) AC_SUBST(CLANGDIR) # Plugin to help linker. commit af89738d225f756bc37a6ff4fd647622f81e24ef Author: Stephan Bergmann <[email protected]> Date: Fri Feb 26 13:18:28 2016 +0100 -Werror=return-type Change-Id: I44e627fa9de9c48a534cbc9ade6cc9d567553709 diff --git a/compilerplugins/clang/nullptr.cxx b/compilerplugins/clang/nullptr.cxx index 8c14269..8003439 100644 --- a/compilerplugins/clang/nullptr.cxx +++ b/compilerplugins/clang/nullptr.cxx @@ -8,6 +8,7 @@ */ #include <cassert> +#include <cstdlib> #include <set> #include "compat.hxx" @@ -17,9 +18,6 @@ namespace { char const * kindName(Expr::NullPointerConstantKind kind) { switch (kind) { - case Expr::NPCK_NotNull: - assert(false); // cannot happen - // fall through case Expr::NPCK_ZeroExpression: return "ZeroExpression"; case Expr::NPCK_ZeroLiteral: @@ -28,6 +26,11 @@ char const * kindName(Expr::NullPointerConstantKind kind) { return "CXX11_nullptr"; case Expr::NPCK_GNUNull: return "GNUNull"; + case Expr::NPCK_NotNull: + assert(false); // cannot happen + // fall through + default: + std::abort(); } } commit 2db16f4bdc9f6e4136c20995ab688b75819d8b35 Author: Stephan Bergmann <[email protected]> Date: Fri Feb 26 13:12:01 2016 +0100 -Werror=return-type Change-Id: I7691fa50d827b688cab299c85c933adabb29994c diff --git a/compilerplugins/clang/stringconstant.cxx b/compilerplugins/clang/stringconstant.cxx index 0749abb..456413c 100644 --- a/compilerplugins/clang/stringconstant.cxx +++ b/compilerplugins/clang/stringconstant.cxx @@ -9,6 +9,7 @@ #include <algorithm> #include <cassert> +#include <cstdlib> #include <limits> #include <stack> #include <string> @@ -805,6 +806,8 @@ std::string StringConstant::describeChangeKind(ChangeKind kind) { return "string constant and matching length arguments"; case ChangeKind::SingleChar: return "ASCII sal_Unicode argument"; + default: + std::abort(); } } commit 8631cecb8631228e02badafb315a5294338c5c0c Author: Stephan Bergmann <[email protected]> Date: Fri Feb 26 13:10:41 2016 +0100 -Werror=maybe-uninitialized Change-Id: Ib456e717b65c3dce3aaca73b2d55872a53d30828 diff --git a/compilerplugins/clang/override.cxx b/compilerplugins/clang/override.cxx index d44af96..155f4ce 100644 --- a/compilerplugins/clang/override.cxx +++ b/compilerplugins/clang/override.cxx @@ -87,7 +87,7 @@ bool Override::VisitCXXMethodDecl(CXXMethodDecl const * decl) { // depend on the following token at the spelling location where // "SAL_OVERRIDE" is inserted, not on the following token in the fully- // macro-expanded view: - bool addSpace; + bool addSpace = bool(); SourceLocation loc; for (SourceLocation l(decl->getSourceRange().getBegin());;) { SourceLocation sl(compiler.getSourceManager().getSpellingLoc(l)); commit 34082fa5a8e389d71e099ae5563a6268d401c278 Author: Stephan Bergmann <[email protected]> Date: Fri Feb 26 13:08:00 2016 +0100 Silence -Werror=comment about a "multi-line comment" Change-Id: I19f09c7d253bb86bbe3b10083f762a5791e2f370 diff --git a/compilerplugins/clang/override.cxx b/compilerplugins/clang/override.cxx index b4c4b6e..d44af96 100644 --- a/compilerplugins/clang/override.cxx +++ b/compilerplugins/clang/override.cxx @@ -97,14 +97,14 @@ bool Override::VisitCXXMethodDecl(CXXMethodDecl const * decl) { //TODO: Looks like a Clang bug that in some cases like // (filter/source/svg/svgexport.cxx) // - // #define TEXT_FIELD_GET_CLASS_NAME_METHOD( class_name ) \ - // virtual OUString getClassName() const \ - // { \ - // static const char className[] = #class_name; \ - // return OUString( className ); \ - // } - // - // TEXT_FIELD_GET_CLASS_NAME_METHOD( TextField ) + // | #define TEXT_FIELD_GET_CLASS_NAME_METHOD( class_name ) \ | + // | virtual OUString getClassName() const \ | + // | { \ | + // | static const char className[] = #class_name; \ | + // | return OUString( className ); \ | + // | } | + // | | + // | TEXT_FIELD_GET_CLASS_NAME_METHOD( TextField ) | // // where "\<NL>" is followed directly by a real token without // intervening whitespace, tokens "\<NL>virtual" and "\<NL>{" are commit 01f3b95884ab652a61a621a0c9dc3e2e0b7c3e4b Author: Stephan Bergmann <[email protected]> Date: Fri Feb 26 12:50:16 2016 +0100 These version checks are about the Clang the plugins are built /against/ ...not the (Clang) compiler they are being built /with/. (Also simplifies the checking #if code.) Change-Id: I416321be4ef4478785be40571f81500fd3b6feb8 diff --git a/compilerplugins/Makefile-clang.mk b/compilerplugins/Makefile-clang.mk index b914d37..1e98309 100644 --- a/compilerplugins/Makefile-clang.mk +++ b/compilerplugins/Makefile-clang.mk @@ -14,7 +14,7 @@ CLANG_COMMA :=, CLANGCXX=$(filter-out -m32 -m64 -fsanitize=%,$(CXX)) # Compile flags ('make CLANGCXXFLAGS=-g' if you need to debug the plugin) -CLANGCXXFLAGS=-O2 -Wall -Wextra -g +CLANGCXXFLAGS=-O2 -Wall -Wextra -Wundef -g # The uninteresting rest. diff --git a/compilerplugins/clang/checkconfigmacros.cxx b/compilerplugins/clang/checkconfigmacros.cxx index cde3a42..5baea1e 100644 --- a/compilerplugins/clang/checkconfigmacros.cxx +++ b/compilerplugins/clang/checkconfigmacros.cxx @@ -34,7 +34,7 @@ class CheckConfigMacros public: explicit CheckConfigMacros( const InstantiationData& data ); virtual void run() override; -#if __clang_major__ < 3 || __clang_major__ == 3 && __clang_minor__ < 3 +#if CLANG_VERSION < 30300 virtual void MacroDefined( const Token& macroToken, const MacroInfo* info ) override; virtual void MacroUndefined( const Token& macroToken, const MacroInfo* info ) override; virtual void Ifdef( SourceLocation location, const Token& macroToken ) override; @@ -42,7 +42,7 @@ class CheckConfigMacros virtual void Defined( const Token& macroToken ) override; #else virtual void MacroDefined( const Token& macroToken, const MacroDirective* info ) override; -#if __clang_major__ == 3 && __clang_minor__ < 7 +#if CLANG_VERSION < 30700 virtual void MacroUndefined( const Token& macroToken, const MacroDirective* info ) override; virtual void Ifdef( SourceLocation location, const Token& macroToken, const MacroDirective* info ) override; virtual void Ifndef( SourceLocation location, const Token& macroToken, const MacroDirective* info ) override; @@ -51,9 +51,9 @@ class CheckConfigMacros virtual void Ifdef( SourceLocation location, const Token& macroToken, const MacroDefinition& info ) override; virtual void Ifndef( SourceLocation location, const Token& macroToken, const MacroDefinition& info ) override; #endif -#if __clang_major__ == 3 && __clang_minor__ < 4 +#if CLANG_VERSION < 30400 virtual void Defined( const Token& macroToken, const MacroDirective* info ) override; -#elif __clang_major__ == 3 && __clang_minor__ < 7 +#elif CLANG_VERSION < 30700 virtual void Defined( const Token& macroToken, const MacroDirective* info, SourceRange Range ) override; #else virtual void Defined( const Token& macroToken, const MacroDefinition& info, SourceRange Range ) override; @@ -76,7 +76,7 @@ void CheckConfigMacros::run() // nothing, only check preprocessor usage } -#if __clang_major__ < 3 || __clang_major__ == 3 && __clang_minor__ < 3 +#if CLANG_VERSION < 30300 void CheckConfigMacros::MacroDefined( const Token& macroToken, const MacroInfo* info ) { SourceLocation location = info->getDefinitionLoc(); @@ -95,9 +95,9 @@ void CheckConfigMacros::MacroDefined( const Token& macroToken, const MacroDirect } } -#if __clang_major__ < 3 || __clang_major__ == 3 && __clang_minor__ < 3 +#if CLANG_VERSION < 30300 void CheckConfigMacros::MacroUndefined( const Token& macroToken, const MacroInfo* ) -#elif __clang_major__ == 3 && __clang_minor__ < 7 +#elif CLANG_VERSION < 30700 void CheckConfigMacros::MacroUndefined( const Token& macroToken, const MacroDirective* ) #else void CheckConfigMacros::MacroUndefined( const Token& macroToken, const MacroDefinition& ) @@ -106,9 +106,9 @@ void CheckConfigMacros::MacroUndefined( const Token& macroToken, const MacroDefi configMacros.erase( macroToken.getIdentifierInfo()->getName()); } -#if __clang_major__ < 3 || __clang_major__ == 3 && __clang_minor__ < 3 +#if CLANG_VERSION < 30300 void CheckConfigMacros::Ifdef( SourceLocation location, const Token& macroToken ) -#elif __clang_major__ == 3 && __clang_minor__ < 7 +#elif CLANG_VERSION < 30700 void CheckConfigMacros::Ifdef( SourceLocation location, const Token& macroToken, const MacroDirective* ) #else void CheckConfigMacros::Ifdef( SourceLocation location, const Token& macroToken, const MacroDefinition& ) @@ -117,9 +117,9 @@ void CheckConfigMacros::Ifdef( SourceLocation location, const Token& macroToken, checkMacro( macroToken, location ); } -#if __clang_major__ < 3 || __clang_major__ == 3 && __clang_minor__ < 3 +#if CLANG_VERSION < 30300 void CheckConfigMacros::Ifndef( SourceLocation location, const Token& macroToken ) -#elif __clang_major__ == 3 && __clang_minor__ < 7 +#elif CLANG_VERSION < 30700 void CheckConfigMacros::Ifndef( SourceLocation location, const Token& macroToken, const MacroDirective* ) #else void CheckConfigMacros::Ifndef( SourceLocation location, const Token& macroToken, const MacroDefinition& ) @@ -128,11 +128,11 @@ void CheckConfigMacros::Ifndef( SourceLocation location, const Token& macroToken checkMacro( macroToken, location ); } -#if __clang_major__ < 3 || __clang_major__ == 3 && __clang_minor__ < 3 +#if CLANG_VERSION < 30300 void CheckConfigMacros::Defined( const Token& macroToken ) -#elif __clang_major__ == 3 && __clang_minor__ < 4 +#elif CLANG_VERSION < 30400 void CheckConfigMacros::Defined( const Token& macroToken, const MacroDirective* ) -#elif __clang_major__ == 3 && __clang_minor__ < 7 +#elif CLANG_VERSION < 30700 void CheckConfigMacros::Defined( const Token& macroToken, const MacroDirective* , SourceRange ) #else void CheckConfigMacros::Defined( const Token& macroToken, const MacroDefinition& , SourceRange ) diff --git a/compilerplugins/clang/compat.hxx b/compilerplugins/clang/compat.hxx index 9b352db..0b451c8 100644 --- a/compilerplugins/clang/compat.hxx +++ b/compilerplugins/clang/compat.hxx @@ -30,7 +30,9 @@ #include "llvm/Support/FileSystem.h" #include "llvm/Support/raw_ostream.h" -#if (__clang_major__ == 3 && __clang_minor__ >= 4) || __clang_major__ > 3 +#include "config_clang.h" + +#if CLANG_VERSION >= 30400 #define LO_COMPILERPLUGINS_CLANG_COMPAT_HAVE_isAtEndOfImmediateMacroExpansion \ true #else @@ -42,7 +44,7 @@ namespace compat { inline bool isLookupContext(clang::DeclContext const & ctxt) { -#if (__clang_major__ == 3 && __clang_minor__ >= 7) || __clang_major__ > 3 +#if CLANG_VERSION >= 30700 return ctxt.isLookupContext(); #else return !ctxt.isFunctionOrMethod() @@ -51,7 +53,7 @@ inline bool isLookupContext(clang::DeclContext const & ctxt) { } inline bool isExternCContext(clang::DeclContext const & ctxt) { -#if (__clang_major__ == 3 && __clang_minor__ >= 4) || __clang_major__ > 3 +#if CLANG_VERSION >= 30400 return ctxt.isExternCContext(); #else for (clang::DeclContext const * c = &ctxt; @@ -67,7 +69,7 @@ inline bool isExternCContext(clang::DeclContext const & ctxt) { } inline bool isInExternCContext(clang::FunctionDecl const & decl) { -#if (__clang_major__ == 3 && __clang_minor__ >= 4) || __clang_major__ > 3 +#if CLANG_VERSION >= 30400 return decl.isInExternCContext(); #else return isExternCContext(*decl.getCanonicalDecl()->getDeclContext()); @@ -80,7 +82,7 @@ inline bool forallBases( void* callbackParam, bool AllowShortCircuit) { -#if (__clang_major__ == 3 && __clang_minor__ > 7) || __clang_major__ > 3 +#if CLANG_VERSION >= 30700 (void) callbackParam; return decl.forallBases(BaseMatches, AllowShortCircuit); #else @@ -88,14 +90,14 @@ inline bool forallBases( #endif } -#if (__clang_major__ == 3 && __clang_minor__ >= 3) || __clang_major__ > 3 +#if CLANG_VERSION >= 30300 typedef clang::LinkageInfo LinkageInfo; #else typedef clang::NamedDecl::LinkageInfo LinkageInfo; #endif inline clang::Linkage getLinkage(LinkageInfo const & info) { -#if (__clang_major__ == 3 && __clang_minor__ >= 3) || __clang_major__ > 3 +#if CLANG_VERSION >= 30300 return info.getLinkage(); #else return info.linkage(); @@ -103,7 +105,7 @@ inline clang::Linkage getLinkage(LinkageInfo const & info) { } inline clang::Visibility getVisibility(LinkageInfo const & info) { -#if (__clang_major__ == 3 && __clang_minor__ >= 3) || __clang_major__ > 3 +#if CLANG_VERSION >= 30300 return info.getVisibility(); #else return info.visibility(); @@ -111,7 +113,7 @@ inline clang::Visibility getVisibility(LinkageInfo const & info) { } inline bool isFirstDecl(clang::FunctionDecl const & decl) { -#if (__clang_major__ == 3 && __clang_minor__ >= 4) || __clang_major__ > 3 +#if CLANG_VERSION >= 30400 return decl.isFirstDecl(); #else return decl.isFirstDeclaration(); @@ -119,7 +121,7 @@ inline bool isFirstDecl(clang::FunctionDecl const & decl) { } inline clang::QualType getReturnType(clang::FunctionDecl const & decl) { -#if (__clang_major__ == 3 && __clang_minor__ >= 5) || __clang_major__ > 3 +#if CLANG_VERSION >= 30500 return decl.getReturnType(); #else return decl.getResultType(); @@ -127,7 +129,7 @@ inline clang::QualType getReturnType(clang::FunctionDecl const & decl) { } inline clang::QualType getReturnType(clang::FunctionProtoType const & type) { -#if (__clang_major__ == 3 && __clang_minor__ >= 5) || __clang_major__ > 3 +#if CLANG_VERSION >= 30500 return type.getReturnType(); #else return type.getResultType(); @@ -135,7 +137,7 @@ inline clang::QualType getReturnType(clang::FunctionProtoType const & type) { } inline unsigned getNumParams(clang::FunctionProtoType const & type) { -#if (__clang_major__ == 3 && __clang_minor__ >= 5) || __clang_major__ > 3 +#if CLANG_VERSION >= 30500 return type.getNumParams(); #else return type.getNumArgs(); @@ -145,7 +147,7 @@ inline unsigned getNumParams(clang::FunctionProtoType const & type) { inline clang::QualType getParamType( clang::FunctionProtoType const & type, unsigned i) { -#if (__clang_major__ == 3 && __clang_minor__ >= 5) || __clang_major__ > 3 +#if CLANG_VERSION >= 30500 return type.getParamType(i); #else return type.getArgType(i); @@ -155,7 +157,7 @@ inline clang::QualType getParamType( inline clang::Stmt::const_child_iterator begin( clang::Stmt::const_child_range const & range) { -#if (__clang_major__ == 3 && __clang_minor__ > 7) || __clang_major__ > 3 +#if CLANG_VERSION >= 30700 return range.begin(); #else return range.first; @@ -165,7 +167,7 @@ inline clang::Stmt::const_child_iterator begin( inline clang::Stmt::const_child_iterator end( clang::Stmt::const_child_range const & range) { -#if (__clang_major__ == 3 && __clang_minor__ > 7) || __clang_major__ > 3 +#if CLANG_VERSION >= 30700 return range.end(); #else return range.second; @@ -173,7 +175,7 @@ inline clang::Stmt::const_child_iterator end( } inline unsigned getBuiltinCallee(clang::CallExpr const & expr) { -#if (__clang_major__ == 3 && __clang_minor__ >= 5) || __clang_major__ > 3 +#if CLANG_VERSION >= 30500 return expr.getBuiltinCallee(); #else return expr.isBuiltinCall(); @@ -183,7 +185,7 @@ inline unsigned getBuiltinCallee(clang::CallExpr const & expr) { inline bool isInMainFile( clang::SourceManager const & manager, clang::SourceLocation Loc) { -#if (__clang_major__ == 3 && __clang_minor__ >= 4) || __clang_major__ > 3 +#if CLANG_VERSION >= 30400 return manager.isInMainFile(Loc); #else return manager.isFromMainFile(Loc); @@ -194,7 +196,7 @@ inline unsigned getCustomDiagID( clang::DiagnosticsEngine & engine, clang::DiagnosticsEngine::Level L, llvm::StringRef FormatString) { -#if (__clang_major__ == 3 && __clang_minor__ >= 5) || __clang_major__ > 3 +#if CLANG_VERSION >= 30500 return engine.getDiagnosticIDs()->getCustomDiagID( static_cast<clang::DiagnosticIDs::Level>(L), FormatString); #else @@ -205,13 +207,13 @@ inline unsigned getCustomDiagID( inline std::unique_ptr<llvm::raw_fd_ostream> create_raw_fd_ostream( char const * Filename, std::string & ErrorInfo) { -#if (__clang_major__ == 3 && __clang_minor__ >= 6) || __clang_major__ > 3 +#if CLANG_VERSION >= 30600 std::error_code ec; std::unique_ptr<llvm::raw_fd_ostream> s( new llvm::raw_fd_ostream(Filename, ec, llvm::sys::fs::F_None)); ErrorInfo = ec ? "error: " + ec.message() : std::string(); return s; -#elif __clang_major__ == 3 && __clang_minor__ == 5 +#elif CLANG_VERSION >= 30500 return std::unique_ptr<llvm::raw_fd_ostream>( new llvm::raw_fd_ostream(Filename, ErrorInfo, llvm::sys::fs::F_None)); #else @@ -220,7 +222,7 @@ inline std::unique_ptr<llvm::raw_fd_ostream> create_raw_fd_ostream( #endif } -#if (__clang_major__ == 3 && __clang_minor__ >= 7) || __clang_major__ > 3 +#if CLANG_VERSION >= 30700 typedef clang::DeclContext::lookup_result DeclContextLookupResult; typedef clang::DeclContext::lookup_iterator DeclContextLookupIterator; #else @@ -229,7 +231,7 @@ typedef clang::DeclContext::lookup_const_iterator DeclContextLookupIterator; #endif inline DeclContextLookupIterator begin(DeclContextLookupResult const & result) { -#if (__clang_major__ == 3 && __clang_minor__ >= 3) || __clang_major__ > 3 +#if CLANG_VERSION >= 30300 return result.begin(); #else return result.first; @@ -237,7 +239,7 @@ inline DeclContextLookupIterator begin(DeclContextLookupResult const & result) { } inline DeclContextLookupIterator end(DeclContextLookupResult const & result) { -#if (__clang_major__ == 3 && __clang_minor__ >= 3) || __clang_major__ > 3 +#if CLANG_VERSION >= 30300 return result.end(); #else return result.second; @@ -247,7 +249,7 @@ inline DeclContextLookupIterator end(DeclContextLookupResult const & result) { inline void addPPCallbacks( clang::Preprocessor & preprocessor, clang::PPCallbacks * C) { -#if (__clang_major__ == 3 && __clang_minor__ >= 6) || __clang_major__ > 3 +#if CLANG_VERSION >= 30600 preprocessor.addPPCallbacks(std::unique_ptr<clang::PPCallbacks>(C)); #else preprocessor.addPPCallbacks(C); @@ -256,7 +258,7 @@ inline void addPPCallbacks( inline bool isMacroBodyExpansion(clang::CompilerInstance& compiler, clang::SourceLocation location) { -#if (__clang_major__ == 3 && __clang_minor__ >= 3) || __clang_major__ > 3 +#if CLANG_VERSION >= 30300 return compiler.getSourceManager().isMacroBodyExpansion(location); #else return location.isMacroID() @@ -266,7 +268,7 @@ inline bool isMacroBodyExpansion(clang::CompilerInstance& compiler, clang::Sourc inline auto getAsTagDecl(clang::Type const& t) -> clang::TagDecl * { -#if (__clang_major__ == 3 && __clang_minor__ > 5) || __clang_major__ > 3 +#if CLANG_VERSION >= 30500 // TODO not sure if it works with clang 3.6, trunk is known to work return t.getAsTagDecl(); #else diff --git a/compilerplugins/clang/getimplementationname.cxx b/compilerplugins/clang/getimplementationname.cxx index 7e90b38..b887396 100644 --- a/compilerplugins/clang/getimplementationname.cxx +++ b/compilerplugins/clang/getimplementationname.cxx @@ -12,7 +12,8 @@ #if defined(__unix__) // only compile this on clang 3.7 or higher, which is known to work // there were problems on clang 3.5 at least -#if (__clang_major__ > 3 || (__clang_major__ == 3 && __clang_minor__ >= 7)) +#include "config_clang.h" +#if CLANG_VERSION >= 30700 #include <cassert> #include <stdlib.h> #include <string> diff --git a/compilerplugins/clang/implicitboolconversion.cxx b/compilerplugins/clang/implicitboolconversion.cxx index bd1874e..8aa6543 100644 --- a/compilerplugins/clang/implicitboolconversion.cxx +++ b/compilerplugins/clang/implicitboolconversion.cxx @@ -18,7 +18,7 @@ #include "compat.hxx" #include "plugin.hxx" -#if __clang_major__ == 3 && __clang_minor__ < 7 +#if CLANG_VERSION < 30700 template<> struct std::iterator_traits<ExprIterator> { typedef std::ptrdiff_t difference_type; @@ -230,7 +230,7 @@ bool hasCLanguageLinkageType(FunctionDecl const * decl) { if (decl->isExternC()) { return true; } -#if (__clang_major__ == 3 && __clang_minor__ >= 3) || __clang_major__ > 3 +#if CLANG_VERSION >= 30300 if (decl->isInExternCContext()) { return true; } diff --git a/compilerplugins/clang/nullptr.cxx b/compilerplugins/clang/nullptr.cxx index 6bf4e54..8c14269 100644 --- a/compilerplugins/clang/nullptr.cxx +++ b/compilerplugins/clang/nullptr.cxx @@ -193,7 +193,7 @@ bool Nullptr::isFromCIncludeFile(SourceLocation spellingLocation) const { } bool Nullptr::isMacroBodyExpansion(SourceLocation location) const { -#if (__clang_major__ == 3 && __clang_minor__ >= 3) || __clang_major__ > 3 +#if CLANG_VERSION >= 30300 return compiler.getSourceManager().isMacroBodyExpansion(location); #else return location.isMacroID() diff --git a/compilerplugins/clang/pluginhandler.cxx b/compilerplugins/clang/pluginhandler.cxx index 54a181e..32651e1 100644 --- a/compilerplugins/clang/pluginhandler.cxx +++ b/compilerplugins/clang/pluginhandler.cxx @@ -250,7 +250,7 @@ void PluginHandler::HandleTranslationUnit( ASTContext& context ) } } -#if (__clang_major__ == 3 && __clang_minor__ >= 6) || __clang_major__ > 3 +#if CLANG_VERSION >= 30600 std::unique_ptr<ASTConsumer> LibreOfficeAction::CreateASTConsumer( CompilerInstance& Compiler, StringRef ) { return llvm::make_unique<PluginHandler>( Compiler, _args ); diff --git a/compilerplugins/clang/pluginhandler.hxx b/compilerplugins/clang/pluginhandler.hxx index b4fc0c3..3992a70 100644 --- a/compilerplugins/clang/pluginhandler.hxx +++ b/compilerplugins/clang/pluginhandler.hxx @@ -54,7 +54,7 @@ class LibreOfficeAction : public PluginASTAction { public: -#if (__clang_major__ == 3 && __clang_minor__ >= 6) || __clang_major__ > 3 +#if CLANG_VERSION >= 30600 virtual std::unique_ptr<ASTConsumer> CreateASTConsumer( CompilerInstance& Compiler, StringRef InFile ); #else virtual ASTConsumer* CreateASTConsumer( CompilerInstance& Compiler, StringRef InFile ); diff --git a/compilerplugins/clang/refcounting.cxx b/compilerplugins/clang/refcounting.cxx index 61854e4..0e899f3 100644 --- a/compilerplugins/clang/refcounting.cxx +++ b/compilerplugins/clang/refcounting.cxx @@ -83,7 +83,7 @@ bool isDerivedFrom(const CXXRecordDecl *decl, const char *pString) { !decl->hasAnyDependentBases() && !compat::forallBases( *decl, -#if __clang_major__ == 3 && __clang_minor__ <= 7 +#if CLANG_VERSION < 30800 BaseCheckNotSubclass, #else [pString](const CXXRecordDecl *BaseDefinition) -> bool diff --git a/compilerplugins/clang/salbool.cxx b/compilerplugins/clang/salbool.cxx index fd7dc93..dfead35 100644 --- a/compilerplugins/clang/salbool.cxx +++ b/compilerplugins/clang/salbool.cxx @@ -30,7 +30,7 @@ bool isSalBool(QualType type) { // class body.") but mis-classifies salhelper::Timer's isTicking, isExpired, and // expiresBefore members as defined in salhelper/source/timer.cxx as inlined: bool isInlined(FunctionDecl const & decl) { -#if (__clang_major__ == 3 && __clang_minor__ >= 3) || __clang_major__ > 3 +#if CLANG_VERSION >= 30300 return decl.isInlined(); #else (void)decl; @@ -53,7 +53,7 @@ bool hasCLanguageLinkageType(FunctionDecl const * decl) { if (decl->isExternC()) { return true; } -#if (__clang_major__ == 3 && __clang_minor__ >= 3) || __clang_major__ > 3 +#if CLANG_VERSION >= 30300 if (decl->isInExternCContext()) { return true; } diff --git a/compilerplugins/clang/sfxpoolitem.cxx b/compilerplugins/clang/sfxpoolitem.cxx index d6942eb..f01adf5 100644 --- a/compilerplugins/clang/sfxpoolitem.cxx +++ b/compilerplugins/clang/sfxpoolitem.cxx @@ -34,7 +34,7 @@ public: bool BaseCheckNotSfxPoolItemSubclass( const CXXRecordDecl *BaseDefinition -#if __clang_major__ == 3 && __clang_minor__ <= 7 +#if CLANG_VERSION < 30800 , void * #endif ) @@ -65,7 +65,7 @@ bool isDerivedFromSfxPoolItem(const CXXRecordDecl *decl) { bool BaseCheckNotSwMsgPoolItemSubclass( const CXXRecordDecl *BaseDefinition -#if __clang_major__ == 3 && __clang_minor__ <= 7 +#if CLANG_VERSION < 30800 , void * #endif ) diff --git a/compilerplugins/clang/staticmethods.cxx b/compilerplugins/clang/staticmethods.cxx index bb8eac6..d4edb1a 100644 --- a/compilerplugins/clang/staticmethods.cxx +++ b/compilerplugins/clang/staticmethods.cxx @@ -38,7 +38,7 @@ private: bool BaseCheckNotTestFixtureSubclass( const CXXRecordDecl *BaseDefinition -#if __clang_major__ == 3 && __clang_minor__ <= 7 +#if CLANG_VERSION < 30800 , void * #endif ) diff --git a/compilerplugins/clang/store/stdexception.cxx b/compilerplugins/clang/store/stdexception.cxx index 3f93b27..824d645 100644 --- a/compilerplugins/clang/store/stdexception.cxx +++ b/compilerplugins/clang/store/stdexception.cxx @@ -185,7 +185,7 @@ found: } bool StdException::isInMainFile(SourceLocation spellingLocation) const { -#if (__clang_major__ == 3 && __clang_minor__ >= 4) || __clang_major__ > 3 +#if CLANG_VERSION >= 30400 return compiler.getSourceManager().isInMainFile(spellingLocation); #else return compiler.getSourceManager().isFromMainFile(spellingLocation); diff --git a/compilerplugins/clang/unreffun.cxx b/compilerplugins/clang/unreffun.cxx index ff746bf..36e1816 100644 --- a/compilerplugins/clang/unreffun.cxx +++ b/compilerplugins/clang/unreffun.cxx @@ -33,7 +33,7 @@ bool hasCLanguageLinkageType(FunctionDecl const * decl) { if (decl->isExternC()) { return true; } -#if (__clang_major__ == 3 && __clang_minor__ >= 3) || __clang_major__ > 3 +#if CLANG_VERSION >= 30300 if (decl->isInExternCContext()) { return true; } @@ -147,7 +147,7 @@ bool UnrefFun::VisitFunctionDecl(FunctionDecl const * decl) { report( DiagnosticsEngine::Warning, (canon->isDefined() -#if (__clang_major__ == 3 && __clang_minor__ >= 4) || __clang_major__ > 3 +#if CLANG_VERSION >= 30400 ? (canon->isExternallyVisible() ? "Unreferenced externally visible function%0 definition" : "Unreferenced externally invisible function%0 definition") diff --git a/compilerplugins/clang/unuseddefaultparams.cxx b/compilerplugins/clang/unuseddefaultparams.cxx index 548720f..6906a93 100644 --- a/compilerplugins/clang/unuseddefaultparams.cxx +++ b/compilerplugins/clang/unuseddefaultparams.cxx @@ -81,7 +81,7 @@ MyFuncInfo UnusedDefaultParams::niceName(const FunctionDecl* functionDecl) else if (functionDecl->getClassScopeSpecializationPattern()) functionDecl = functionDecl->getClassScopeSpecializationPattern(); // workaround clang-3.5 issue -#if __clang_major__ > 3 || ( __clang_major__ == 3 && __clang_minor__ >= 6 ) +#if CLANG_VERSION >= 30600 else if (functionDecl->getTemplateInstantiationPattern()) functionDecl = functionDecl->getTemplateInstantiationPattern(); #endif diff --git a/compilerplugins/clang/unusedmethods.cxx b/compilerplugins/clang/unusedmethods.cxx index c2785dd..e0b9718 100644 --- a/compilerplugins/clang/unusedmethods.cxx +++ b/compilerplugins/clang/unusedmethods.cxx @@ -119,7 +119,7 @@ MyFuncInfo UnusedMethods::niceName(const FunctionDecl* functionDecl) else if (functionDecl->getClassScopeSpecializationPattern()) functionDecl = functionDecl->getClassScopeSpecializationPattern(); // workaround clang-3.5 issue -#if __clang_major__ > 3 || ( __clang_major__ == 3 && __clang_minor__ >= 6 ) +#if CLANG_VERSION >= 30600 else if (functionDecl->getTemplateInstantiationPattern()) functionDecl = functionDecl->getTemplateInstantiationPattern(); #endif diff --git a/compilerplugins/clang/unusedvariablecheck.cxx b/compilerplugins/clang/unusedvariablecheck.cxx index ce35afe..8642032 100644 --- a/compilerplugins/clang/unusedvariablecheck.cxx +++ b/compilerplugins/clang/unusedvariablecheck.cxx @@ -51,7 +51,7 @@ void UnusedVariableCheck::run() bool BaseCheckNotDialogSubclass( const CXXRecordDecl *BaseDefinition -#if __clang_major__ == 3 && __clang_minor__ <= 7 +#if CLANG_VERSION < 30800 , void * #endif ) diff --git a/compilerplugins/clang/vclwidgets.cxx b/compilerplugins/clang/vclwidgets.cxx index 89f80a5..b368b18 100644 --- a/compilerplugins/clang/vclwidgets.cxx +++ b/compilerplugins/clang/vclwidgets.cxx @@ -59,7 +59,7 @@ static bool startsWith(const std::string& s, const char* other) bool BaseCheckNotWindowSubclass( const CXXRecordDecl *BaseDefinition -#if __clang_major__ == 3 && __clang_minor__ <= 7 +#if CLANG_VERSION < 30800 , void * #endif ) diff --git a/config_host/config_clang.h.in b/config_host/config_clang.h.in index 3bbda7a..c19c087 100644 --- a/config_host/config_clang.h.in +++ b/config_host/config_clang.h.in @@ -11,6 +11,8 @@ Settings related to Clang compiler plugins. #undef SRCDIR #undef WORKDIR +#undef CLANG_VERSION + /* This is actually unused, but it should change whenever Clang changes, thus causing update of this .h file and triggering rebuild of our Clang plugin. */ #undef CLANG_FULL_VERSION diff --git a/configure.ac b/configure.ac index de6eaae..18c89ab 100644 --- a/configure.ac +++ b/configure.ac @@ -3784,6 +3784,7 @@ if test "$COM_IS_CLANG" = TRUE; then CLANG_FULL_VERSION=`echo __clang_version__ | ${CC%-cl.exe*} -E -P -` CLANGVER=`echo $clang_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'` AC_MSG_RESULT([Clang $CLANG_FULL_VERSION, $CLANGVER]) + AC_DEFINE_UNQUOTED(CLANG_VERSION,$CLANGVER) AC_DEFINE_UNQUOTED(CLANG_FULL_VERSION,$CLANG_FULL_VERSION) fi AC_SUBST(COM_IS_CLANG) commit cd2725de90517cd63a17ccbf2c59c1e07eca5744 Author: Stephan Bergmann <[email protected]> Date: Fri Feb 26 12:34:01 2016 +0100 Revert "compilerplugins: Build them in parallel." This reverts commit 4101fa184150663ddee6688c19eb4a44e341e8d4. Just configure --without-parallelism and always use an explicit make -jN, and be done with it. I just can't stand that "make[1]: Entering/Leaving directory" noise around each "[build CXX] compilerplugins/clang/*.cxx" line any more. diff --git a/compilerplugins/Makefile.mk b/compilerplugins/Makefile.mk index 5da6967..dc0b1c2 100644 --- a/compilerplugins/Makefile.mk +++ b/compilerplugins/Makefile.mk @@ -21,11 +21,7 @@ else ifeq ($(COM_IS_CLANG),TRUE) -compilerplugins: - $(MAKE) $(PARALLELISM_OPTION) -f $(SRCDIR)/compilerplugins/Makefile-clang.mk compilerplugins - -compilerplugins-clean: - $(MAKE) -f $(SRCDIR)/compilerplugins/Makefile-clang.mk compilerplugins-clean +include $(SRCDIR)/compilerplugins/Makefile-clang.mk compilerplugins.clean: compilerplugins-clean _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
