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

Michael Stahl mstahl at redhat.com
Fri Oct 30 09:31:36 PDT 2015


 compilerplugins/clang/pluginhandler.cxx |    9 +++++++++
 1 file changed, 9 insertions(+)

New commits:
commit 048d47d54d72babe49920ea5e8ff934fe0032125
Author: Michael Stahl <mstahl at redhat.com>
Date:   Fri Oct 30 15:15:46 2015 +0100

    compilerplugins: check that we're not building ccache preprocessed
    
    ... input, which breaks because a) isInUnoIncludeFile() will not
    recognize the paths (which is actually fixable if it used
    getPresumedLoc() to get the path), and b) the isMacroBodyExpansion()
    check in salbool.cxx (which doesn't look fixable).
    
    So instead of printing lots of spurious warnings just abort.
    
    Change-Id: I77fd77b4986d2b099453309ecdf31be9cf93ceec
    Reviewed-on: https://gerrit.libreoffice.org/19693
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>
    Tested-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/compilerplugins/clang/pluginhandler.cxx b/compilerplugins/clang/pluginhandler.cxx
index 6506976..74260c5 100644
--- a/compilerplugins/clang/pluginhandler.cxx
+++ b/compilerplugins/clang/pluginhandler.cxx
@@ -168,6 +168,15 @@ void PluginHandler::HandleTranslationUnit( ASTContext& context )
     {
     if( context.getDiagnostics().hasErrorOccurred())
         return;
+    char const*const mainFileName = context.getSourceManager().getFileEntryForID(context.getSourceManager().getMainFileID())->getName();
+    size_t const len = strlen(mainFileName);
+    if (len > 3 && strncmp(mainFileName + len - 3, ".ii", 3) == 0)
+    {
+        report(DiagnosticsEngine::Fatal,
+            "input file has suffix .ii: \"%0\"\nhighly suspicious, probably ccache generated, this will break warning suppressions; export CCACHE_CPP2=1 to prevent this") << mainFileName;
+        return;
+    }
+
     for( int i = 0;
          i < pluginCount;
          ++i )


More information about the Libreoffice-commits mailing list