rkday created this revision.
rkday added a reviewer: dcoughlin.
Herald added a subscriber: cfe-commits.
I recently spent some time resolving an issue where the --status-bugs parameter 
conflicted with -plist, and scan-build always returned 0 even when there were 
errors.

This change means that scan-build rejects these as incompatible arguments.

I've tested that this works with this test program:

  $ cat test.c
  int abcd(char* x, char* y)
  {
        strcpy(x, y);
  }
  
  int main()
  {
        return 0;
  }

and these two commands:

  ./bin/scan-build --status-bugs -enable-checker security --use-analyzer 
/usr/bin/clang clang test.c; echo $?



  ./bin/scan-build --status-bugs -plist -enable-checker security --use-analyzer 
/usr/bin/clang clang test.c; echo $?


Repository:
  rC Clang

https://reviews.llvm.org/D56410

Files:
  bin/scan-build


Index: bin/scan-build
===================================================================
--- bin/scan-build
+++ bin/scan-build
@@ -1849,6 +1849,10 @@
   DieDiag("'c++-analyzer' does not exist at '$CmdCXX'\n") if(! -e $CmdCXX);
 }
 
+if ($Options{ExitStatusFoundBugs} == 1 && !($Options{OutputFormat} =~ /html/)) 
{
+  DieDiag("--status-bugs is only supported with the HTML output format\n");
+}
+
 Diag("Using '$Clang' for static analysis\n");
 
 SetHtmlEnv(\@ARGV, $Options{OutputDir});


Index: bin/scan-build
===================================================================
--- bin/scan-build
+++ bin/scan-build
@@ -1849,6 +1849,10 @@
   DieDiag("'c++-analyzer' does not exist at '$CmdCXX'\n") if(! -e $CmdCXX);
 }
 
+if ($Options{ExitStatusFoundBugs} == 1 && !($Options{OutputFormat} =~ /html/)) {
+  DieDiag("--status-bugs is only supported with the HTML output format\n");
+}
+
 Diag("Using '$Clang' for static analysis\n");
 
 SetHtmlEnv(\@ARGV, $Options{OutputDir});
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to