r343105 - [analyzer] scan-build: if --status-bugs is passed, don't forget about the exit status of the actual build
Roman Lebedev via cfe-commits
cfe-commits at lists.llvm.org
Wed Sep 26 06:08:44 PDT 2018
Author: lebedevri
Date: Wed Sep 26 06:08:44 2018
New Revision: 343105
URL: http://llvm.org/viewvc/llvm-project?rev=343105&view=rev
Log:
[analyzer] scan-build: if --status-bugs is passed, don't forget about the exit status of the actual build
Summary:
This has been bothering me for a while, but only now i have actually looked into this.
I'm using one CI job for static analysis - clang static analyzers as compilers + clang-tidy via cmake.
And i'd like for the build to fail if at least one of those finds issues.
If clang-tidy finds issues, it will fail the build since the warnings-as-errors is set.
If static analyzer finds anything, since --status-bugs is set, it will fail the build.
But if clang-tidy find anything, but static analyzer does not, the build succeeds :/
Reviewers: sylvestre.ledru, alexfh, jroelofs, ygribov, george.karpenkov, krememek
Reviewed By: jroelofs
Subscribers: xazax.hun, szepet, a.sidorin, mikhail.ramalho, Szelethus, cfe-commits
Differential Revision: https://reviews.llvm.org/D52530
Modified:
cfe/trunk/tools/scan-build/bin/scan-build
Modified: cfe/trunk/tools/scan-build/bin/scan-build
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/scan-build/bin/scan-build?rev=343105&r1=343104&r2=343105&view=diff
==============================================================================
--- cfe/trunk/tools/scan-build/bin/scan-build (original)
+++ cfe/trunk/tools/scan-build/bin/scan-build Wed Sep 26 06:08:44 2018
@@ -1207,7 +1207,7 @@ OPTIONS:
By default, the exit status of scan-build is the same as the executed build
command. Specifying this option causes the exit status of scan-build to be 1
- if it found potential bugs and 0 otherwise.
+ if it found potential bugs and the exit status of the build itself otherwise.
--exclude <path>
@@ -1908,7 +1908,7 @@ if (defined $Options{OutputFormat}) {
if ($Options{ExitStatusFoundBugs}) {
exit 1 if ($NumBugs > 0);
- exit 0;
+ exit $ExitStatus;
}
}
}
More information about the cfe-commits
mailing list