From: Ted Kremenek Date: Tue, 15 Jul 2008 22:03:09 +0000 (+0000) Subject: Added --status-bugs option to scan-build. By default, the exit status of X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=363dc3f40ffc4cc71fb3a04087cf627aeb6918d4;p=clang Added --status-bugs option to scan-build. By default, the exit status of scan-build is the same as the exit status of the executed build command. With this option, the exit status of scan-build is 1 if the analyzer flagged any bugs, and 0 otherwise. This addresses: git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53642 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/utils/scan-build b/utils/scan-build index ae64768b37..6ee89decc9 100755 --- a/utils/scan-build +++ b/utils/scan-build @@ -364,7 +364,7 @@ sub Postprocess { if (! -d $Dir) { Diag("No bugs found.\n"); - return; + return 0; } opendir(DIR, $Dir); @@ -379,7 +379,7 @@ sub Postprocess { system ("rm", "-f", $BaseDir); Diag("No bugs found.\n"); - return; + return 0; } # Scan each report file and build an index. @@ -558,6 +558,8 @@ ENDTEXT if ($Num > 0 && -r "$Dir/index.html") { Diag("Open '$Dir/index.html' to examine bug reports.\n"); } + + return $Num; } ##----------------------------------------------------------------------------## @@ -643,35 +645,40 @@ ENDTEXT print < 0); + exit 0; +} + exit $ExitStatus;