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@redhat.com>
Tested-by: Stephan Bergmann <sbergman@redhat.com>
This commit is contained in:
Michael Stahl
2015-10-30 15:15:46 +01:00
committed by Stephan Bergmann
parent 2b5ce52cdd
commit 048d47d54d

View File

@@ -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 )