From 363dc3f40ffc4cc71fb3a04087cf627aeb6918d4 Mon Sep 17 00:00:00 2001 From: Ted Kremenek Date: Tue, 15 Jul 2008 22:03:09 +0000 Subject: [PATCH] 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 --- utils/scan-build | 66 +++++++++++++++++++++++++++++++----------------- 1 file changed, 43 insertions(+), 23 deletions(-) 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; -- 2.50.1