[cfe-commits] r49071 - /cfe/trunk/utils/scan-build
Sam Bishop
sam at bishop.dhs.org
Tue Apr 1 20:35:43 PDT 2008
Author: sbishop
Date: Tue Apr 1 22:35:43 2008
New Revision: 49071
URL: http://llvm.org/viewvc/llvm-project?rev=49071&view=rev
Log:
a bunch of random cleanups
Modified:
cfe/trunk/utils/scan-build
Modified: cfe/trunk/utils/scan-build
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/utils/scan-build?rev=49071&r1=49070&r2=49071&view=diff
==============================================================================
--- cfe/trunk/utils/scan-build (original)
+++ cfe/trunk/utils/scan-build Tue Apr 1 22:35:43 2008
@@ -23,7 +23,7 @@
# GetHTMLRunDir - Construct an HTML directory name for the current run.
##----------------------------------------------------------------------------##
-sub GetHTMLRunDir() {
+sub GetHTMLRunDir {
die "Not enough arguments." if (@_ == 0);
@@ -46,8 +46,7 @@
if (-d $Dir) {
if (! -r $Dir) {
- print STDERR "error: '$Dir' exists but is not readable.\n";
- exit 0;
+ die "error: '$Dir' exists but is not readable.\n";
}
# Iterate over all files in the specified directory.
@@ -77,8 +76,7 @@
else {
if (-x $Dir) {
- print STDERR "error: '$Dir' exists but is not a directory.\n";
- exit 0;
+ die "error: '$Dir' exists but is not a directory.\n";
}
# $Dir does not exist. It will be automatically created by the
@@ -94,7 +92,7 @@
return "$Dir/$DateString-$RunNumber";
}
-sub SetHtmlEnv() {
+sub SetHtmlEnv {
die "Wrong number of arguments." if (scalar(@_) != 2);
@@ -120,7 +118,7 @@
# Postprocess - Postprocess the results of an analysis scan.
##----------------------------------------------------------------------------##
-sub Postprocess() {
+sub Postprocess {
my $Dir = shift;
@@ -147,34 +145,36 @@
# DisplayHelp - Utility function to display all help options.
##----------------------------------------------------------------------------##
-sub DisplayHelp() {
+sub DisplayHelp {
print <<ENDTEXT
-USAGE: scan-build [options] <build command> [build options]
+USAGE: $Prog [options] <build command> [build options]
OPTIONS:
-o - Target directory for HTML report files. Subdirectories
- Will be created as needed to represent separate "runs" of
+ will be created as needed to represent separate "runs" of
the analyzer. If this option is not specified, a directory
is created in /tmp to store the reports.
- -? - Display this message.
+ -?, -h - Display this message.
--help
-k - Add "keep on going option" to the specified build command.
- --keep-going This command currently supports "make" and "xcodebuild." You
- can also directly specify the corresponding option to the build command.
+ --keep-going This command currently supports "make" and "xcodebuild." You
+ can also directly specify the corresponding option to the
+ build command.
- -v - Verbose output from scan-build and the analyzer. A second
+ -v - Verbose output from $Prog and the analyzer. A second
"-v" increases verbosity.
BUILD OPTIONS
- You can specify any build option acceptable to the build command. For example:
+ You can specify any build option acceptable to the build command. For
+ example:
- scan-build -o /tmp/myhtmldir make -j4
+ $Prog -o /tmp/myhtmldir make -j4
The above causes analysis reports to be deposited in /tmp/myhtmldir (or
rather a subdirectory corresponding to this particular running of the
@@ -196,7 +196,7 @@
if (!@ARGV) {
DisplayHelp();
- exit 1
+ exit 1;
}
while (@ARGV) {
@@ -205,17 +205,16 @@
my $arg = $ARGV[0];
- if ($arg eq "-?" or $arg eq "--help") {
+ if ($arg eq "-?" or $arg eq "-h" or $arg eq "--help") {
DisplayHelp();
- exit 1;
+ exit 0;
}
if ($arg eq "-o") {
shift @ARGV;
if (!@ARGV) {
- print STDERR "'-o' option requires a target directory name.";
- exit 0;
+ die "'-o' option requires a target directory name.";
}
$HtmlDir = shift @ARGV;
@@ -240,18 +239,17 @@
if (!@ARGV) {
print STDERR "$Prog: No build command specified.\n\n";
DisplayHelp();
- exit 0;
+ exit 1;
}
# Determine the output directory for the HTML reports.
if (!defined($HtmlDir)) {
- $HtmlDir = mkdtemp("/tmp/scan-build-XXXXXX");
+ $HtmlDir = mkdtemp("/tmp/$Prog-XXXXXX");
if (!defined($HtmlDir)) {
- print STDERR "error: Cannot create HTML directory in /tmp.\n";
- exit 0;
+ die "error: Cannot create HTML directory in /tmp.\n";
}
if (!$Verbose) {
@@ -259,11 +257,11 @@
}
}
-$HtmlDir = &GetHTMLRunDir($HtmlDir);
+$HtmlDir = GetHTMLRunDir($HtmlDir);
# Set the appropriate environment variables.
-&SetHtmlEnv(\@ARGV, $HtmlDir);
+SetHtmlEnv(\@ARGV, $HtmlDir);
$ENV{'CC'} = "ccc-analyzer";
@@ -277,4 +275,4 @@
# Postprocess the HTML directory.
-&Postprocess($HtmlDir);
+Postprocess($HtmlDir);
More information about the cfe-commits
mailing list