Modified: trunk/Tools/ChangeLog (203741 => 203742)
--- trunk/Tools/ChangeLog 2016-07-26 22:03:01 UTC (rev 203741)
+++ trunk/Tools/ChangeLog 2016-07-26 22:04:02 UTC (rev 203742)
@@ -1,3 +1,17 @@
+2016-07-26 David Kilzer <ddkil...@apple.com>
+
+ check-for-exit-time-destructors should be usable outside Xcode
+ <https://webkit.org/b/160195>
+
+ Reviewed by Darin Adler.
+
+ * Scripts/check-for-exit-time-destructors: Update to parse
+ -h|--help switch, or to take one argument to a binary to check
+ for exit time destructors on the command-line. The clang
+ compiler will find these at compile-time with the
+ -Wexit-time-destructors switch, but this script will check for
+ them after-the-fact.
+
2016-07-26 Lucas Forschler <lforsch...@apple.com>
Test svn.webkit.org functionality after maintenance.
Modified: trunk/Tools/Scripts/check-for-exit-time-destructors (203741 => 203742)
--- trunk/Tools/Scripts/check-for-exit-time-destructors 2016-07-26 22:03:01 UTC (rev 203741)
+++ trunk/Tools/Scripts/check-for-exit-time-destructors 2016-07-26 22:04:02 UTC (rev 203742)
@@ -1,30 +1,26 @@
#!/usr/bin/perl
-# Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
+# Copyright (C) 2006-2008, 2016 Apple Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
-#
# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
+# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-# 3. Neither the name of Apple Inc. ("Apple") nor the names of
-# its contributors may be used to endorse or promote products derived
-# from this software without specific prior written permission.
+# documentation and/or other materials provided with the distribution.
#
-# THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-# DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# "check-for-exit-time-destructors" script for WebKit Open Source Project
@@ -35,33 +31,54 @@
use strict;
use File::Basename;
+use File::Spec;
+use Getopt::Long;
sub touch($);
sub printFunctions($$);
-my $arch = $ENV{'CURRENT_ARCH'};
-my $configuration = $ENV{'CONFIGURATION'};
-my $target = $ENV{'TARGET_NAME'};
-my $variant = $ENV{'CURRENT_VARIANT'};
-my $coverageBuild = $ENV{'WEBKIT_COVERAGE_BUILD'};
-my $debugRoot = $ENV{'WEBKIT_DEBUG_ROOT'};
+my $coverageBuild;
+my $executablePath;
+my @files;
+my $showHelp;
+my $tempDir;
-my $executablePath = "$ENV{'TARGET_BUILD_DIR'}/$ENV{'EXECUTABLE_PATH'}";
+if (@ARGV) {
+ # Running in interactive mode with arguments.
+ my $result = GetOptions(
+ "h|help" => \$showHelp,
+ );
+ $executablePath = glob(shift @ARGV);
-my $buildTimestampPath = $ENV{'TARGET_TEMP_DIR'} . "/" . basename($0) . ".timestamp";
-my $buildTimestampAge = -M $buildTimestampPath;
-my $scriptAge = -M $0;
+ if (!$result || $showHelp || @ARGV > 0) {
+ print STDERR "Check for exit-time destructors.\n";
+ print STDERR "Usage: " . basename($0) . " [options] path/to/executable\n";
+ print STDERR <<END;
+ [-h|--help] show this help message
+END
+ exit 1;
+ }
-my $list = $ENV{"LINK_FILE_LIST_${variant}_${arch}"};
+ $tempDir = File::Spec->tmpdir();
+ @files = ($executablePath);
+} else {
+ # Running from Xcode build phase script with no arguments.
+ $coverageBuild = $ENV{'WEBKIT_COVERAGE_BUILD'};
+ $executablePath = "$ENV{'TARGET_BUILD_DIR'}/$ENV{'EXECUTABLE_PATH'}";
+ $tempDir = $ENV{'TARGET_TEMP_DIR'};
-if (!open LIST, $list) {
- print "ERROR: Could not open $list\n";
- exit 1;
+ my $arch = $ENV{'CURRENT_ARCH'};
+ my $variant = $ENV{'CURRENT_VARIANT'};
+ my $list = $ENV{"LINK_FILE_LIST_${variant}_${arch}"};
+ open LIST, $list || die "ERROR: Could not open $list\n";
+ @files = <LIST>;
+ chomp @files;
+ close LIST;
}
-my @files = <LIST>;
-chomp @files;
-close LIST;
+my $buildTimestampPath = File::Spec->catfile($tempDir, basename($0) . ".timestamp");
+my $buildTimestampAge = -M $buildTimestampPath;
+my $scriptAge = -M $0;
my $sawError = 0;