[PATCH] D56410: Forbid combination of --status-bugs and non-HTML output

Rob Day via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 7 13:56:59 PST 2019


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});


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D56410.180546.patch
Type: text/x-patch
Size: 488 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190107/a3724c9b/attachment.bin>


More information about the cfe-commits mailing list