summaryrefslogtreecommitdiff
path: root/tools/scan-build
diff options
context:
space:
mode:
Diffstat (limited to 'tools/scan-build')
-rwxr-xr-xtools/scan-build/bin/scan-build28
-rwxr-xr-xtools/scan-build/libexec/ccc-analyzer4
-rw-r--r--tools/scan-build/man/scan-build.14
3 files changed, 26 insertions, 10 deletions
diff --git a/tools/scan-build/bin/scan-build b/tools/scan-build/bin/scan-build
index cbf3bf3d6f0be..c50f900cc45e6 100755
--- a/tools/scan-build/bin/scan-build
+++ b/tools/scan-build/bin/scan-build
@@ -51,6 +51,7 @@ my %Options = (
OutputDir => undef, # Parent directory to store HTML files.
HtmlTitle => basename($CurrentDir)." - scan-build results",
IgnoreErrors => 0, # Ignore build errors.
+ KeepCC => 0, # Do not override CC and CXX make variables
ViewResults => 0, # View results when the build terminates.
ExitStatusFoundBugs => 0, # Exit status reflects whether bugs were found
ShowDescription => 0, # Display the description of the defect in the list
@@ -1012,7 +1013,7 @@ sub RunXcodebuild {
}
close(DETECT_XCODE);
- # If --override-compiler is explicitely requested, resort to the old
+ # If --override-compiler is explicitly requested, resort to the old
# behavior regardless of Xcode version.
if ($Options{OverrideCompiler}) {
$oldBehavior = 1;
@@ -1062,6 +1063,7 @@ sub RunXcodebuild {
sub RunBuildCommand {
my $Args = shift;
my $IgnoreErrors = shift;
+ my $KeepCC = shift;
my $Cmd = $Args->[0];
my $CCAnalyzer = shift;
my $CXXAnalyzer = shift;
@@ -1099,8 +1101,10 @@ sub RunBuildCommand {
unshift @$Args, $CXXAnalyzer;
}
elsif ($Cmd eq "make" or $Cmd eq "gmake" or $Cmd eq "mingw32-make") {
- AddIfNotPresent($Args, "CC=$CCAnalyzer");
- AddIfNotPresent($Args, "CXX=$CXXAnalyzer");
+ if (!$KeepCC) {
+ AddIfNotPresent($Args, "CC=$CCAnalyzer");
+ AddIfNotPresent($Args, "CXX=$CXXAnalyzer");
+ }
if ($IgnoreErrors) {
AddIfNotPresent($Args,"-k");
AddIfNotPresent($Args,"-i");
@@ -1158,6 +1162,12 @@ OPTIONS:
currently supports make and xcodebuild. This is a convenience option; one
can specify this behavior directly using build options.
+ --keep-cc
+
+ Do not override CC and CXX make variables. Useful when running make in
+ autoconf-based (and similar) projects where configure can add extra flags
+ to those variables.
+
--html-title [title]
--html-title=[title]
@@ -1236,7 +1246,7 @@ ADVANCED OPTIONS:
-maxloop <loop count>
- Specifiy the number of times a block can be visited before giving up.
+ Specify the number of times a block can be visited before giving up.
Default is 4. Increase for more comprehensive coverage at a cost of speed.
-internal-stats
@@ -1532,6 +1542,12 @@ sub ProcessArgs {
next;
}
+ if ($arg eq "--keep-cc") {
+ shift @$Args;
+ $Options{KeepCC} = 1;
+ next;
+ }
+
if ($arg =~ /^--use-cc(=(.+))?$/) {
shift @$Args;
my $cc;
@@ -1838,8 +1854,8 @@ my %EnvVars = (
);
# Run the build.
-my $ExitStatus = RunBuildCommand(\@ARGV, $Options{IgnoreErrors}, $Cmd, $CmdCXX,
- \%EnvVars);
+my $ExitStatus = RunBuildCommand(\@ARGV, $Options{IgnoreErrors}, $Options{KeepCC},
+ $Cmd, $CmdCXX, \%EnvVars);
if (defined $Options{OutputFormat}) {
if ($Options{OutputFormat} =~ /plist/) {
diff --git a/tools/scan-build/libexec/ccc-analyzer b/tools/scan-build/libexec/ccc-analyzer
index b0ec7e7e7487e..73cd2ff3d9153 100755
--- a/tools/scan-build/libexec/ccc-analyzer
+++ b/tools/scan-build/libexec/ccc-analyzer
@@ -419,7 +419,7 @@ my %LangMap = (
'cc' => 'c++',
'C' => 'c++',
'ii' => 'c++-cpp-output',
- 'i' => $IsCXX ? 'c++-cpp-output' : 'c-cpp-output',
+ 'i' => $IsCXX ? 'c++-cpp-output' : 'cpp-output',
'm' => 'objective-c',
'mi' => 'objective-c-cpp-output',
'mm' => 'objective-c++',
@@ -439,7 +439,7 @@ my %LangsAccepted = (
"c" => 1,
"c++" => 1,
"objective-c++" => 1,
- "c-cpp-output" => 1,
+ "cpp-output" => 1,
"objective-c-cpp-output" => 1,
"c++-cpp-output" => 1
);
diff --git a/tools/scan-build/man/scan-build.1 b/tools/scan-build/man/scan-build.1
index fd18d1f5c70a2..3e3252e1b643e 100644
--- a/tools/scan-build/man/scan-build.1
+++ b/tools/scan-build/man/scan-build.1
@@ -1,6 +1,6 @@
.\" This file is distributed under the University of Illinois Open Source
.\" License. See LICENSE.TXT for details.
-.\" $Id: scan-build.1 253074 2015-11-13 20:34:15Z jroelofs $
+.\" $Id: scan-build.1 329399 2018-04-06 15:14:32Z alexfh $
.Dd May 25, 2012
.Dt SCAN-BUILD 1
.Os "clang" "3.5"
@@ -116,7 +116,7 @@ model is used. Specifying
uses a simpler, less powerful constraint model used by checker-0.160
and earlier.
.It Fl maxloop Ar N
-Specifiy the number of times a block can be visited before giving
+Specify the number of times a block can be visited before giving
up. Default is 4. Increase for more comprehensive coverage at a
cost of speed.
.It Fl no-failure-reports