[PATCH] D52530: [analyzer] scan-build: if --status-bugs is passed, don't forget about the exit status of the actual build

Roman Lebedev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 26 00:26:55 PDT 2018


lebedev.ri created this revision.
lebedev.ri added reviewers: sylvestre.ledru, alexfh, jroelofs, ygribov.
Herald added subscribers: Szelethus, mikhail.ramalho, a.sidorin, szepet, xazax.hun.
Herald added a reviewer: george.karpenkov.

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 :/


Repository:
  rC Clang

https://reviews.llvm.org/D52530

Files:
  tools/scan-build/bin/scan-build


Index: tools/scan-build/bin/scan-build
===================================================================
--- tools/scan-build/bin/scan-build
+++ tools/scan-build/bin/scan-build
@@ -1908,7 +1908,7 @@
 
     if ($Options{ExitStatusFoundBugs}) {
       exit 1 if ($NumBugs > 0);
-      exit 0;
+      exit $ExitStatus;
     }
   }
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D52530.167056.patch
Type: text/x-patch
Size: 333 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180926/fecace97/attachment.bin>


More information about the cfe-commits mailing list