Package: clang
Version: 1:3.5-25
Severity: wishlist
Tags: patch

Dear Maintainer,

as already reported in https://llvm.org/bugs/show_bug.cgi?id=4312 the option
'--status-bugs' returns no failure if the build fails. I therefore propose a
new option '--status-bugs-or-build-error' that returns an exit code != 0 if
either the build failed or scan-build has detected errors.



-- System Information:
Debian Release: 8.1
  APT prefers stable
  APT policy: (900, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 3.16.0-4-amd64 (SMP w/8 CPU cores)
Locale: LANG=en_US.utf8, LC_CTYPE=en_US.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages clang depends on:
ii  clang-3.5  1:3.5-10

clang recommends no packages.

clang suggests no packages.

-- no debconf information
Index: llvm-toolchain-snapshot-3.7~svn239806/clang/tools/scan-build/scan-build
===================================================================
--- llvm-toolchain-snapshot-3.7~svn239806.orig/clang/tools/scan-build/scan-build
+++ llvm-toolchain-snapshot-3.7~svn239806/clang/tools/scan-build/scan-build
@@ -1132,6 +1132,14 @@ OPTIONS:
    command. Specifying this option causes the exit status of scan-build to be 1
    if it found potential bugs and 0 otherwise.
 
+ --status-bugs-or-build-error
+
+   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 scan-build found potential bugs
+     * the exit status of the executed build command if the build failed
+     * 0 otherwise.
+
  --use-cc [compiler path]
  --use-cc=[compiler path]
 
@@ -1372,6 +1380,7 @@ my $HtmlDir;           # Parent director
 my $IgnoreErrors = 0;  # Ignore build errors.
 my $ViewResults  = 0;  # View results when the build terminates.
 my $ExitStatusFoundBugs = 0; # Exit status reflects whether bugs were found
+my $ExitStatusBugsOrBuildError = 0; # Exit status reflects whether bugs were found or build status
 my $KeepEmpty    = 0;  # Don't remove output directory even with 0 results.
 my @AnalysesToRun;
 my $StoreModel;
@@ -1497,6 +1506,12 @@ while (@ARGV) {
     next;
   }
 
+  if ($arg eq "--status-bugs-or-build-error") {
+    shift @ARGV;
+    $ExitStatusBugsOrBuildError = 1;
+    next;
+  }
+
   if ($arg eq "-store") {
     shift @ARGV;
     $StoreModel = shift @ARGV;
@@ -1736,6 +1751,9 @@ if (defined $OutputFormat) {
       exit 1 if ($NumBugs > 0);
       exit 0;
     }
+    if ($ExitStatusBugsOrBuildError) {
+      exit 1 if ($NumBugs > 0);
+    }
   }
 }
 

Reply via email to