From dcc8cf2e65d1aa555cce12431a16547e66b469ee Mon Sep 17 00:00:00 2001 From: Steve Block Date: Tue, 27 Apr 2010 16:31:00 +0100 Subject: Merge webkit.org at r58033 : Initial merge by git Change-Id: If006c38561af287c50cd578d251629b51e4d8cd1 --- WebKitTools/Scripts/check-for-global-initializers | 24 +++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) (limited to 'WebKitTools/Scripts/check-for-global-initializers') diff --git a/WebKitTools/Scripts/check-for-global-initializers b/WebKitTools/Scripts/check-for-global-initializers index cf83048..0472901 100755 --- a/WebKitTools/Scripts/check-for-global-initializers +++ b/WebKitTools/Scripts/check-for-global-initializers @@ -37,6 +37,7 @@ use strict; use File::Basename; sub touch($); +sub demangle($); my $arch = $ENV{'CURRENT_ARCH'}; my $configuration = $ENV{'CONFIGURATION'}; @@ -78,9 +79,14 @@ for my $file (sort @files) { next; } my $sawGlobal = 0; + my @globals; while () { if (/^STDOUT:/) { - $sawGlobal = 1 if /__GLOBAL__I/; + my $line = $_; + if ($line =~ /__GLOBAL__I(.+)$/) { + $sawGlobal = 1; + push(@globals, demangle($1)); + } } else { print STDERR if $_ ne "nm: no name list\n"; } @@ -119,7 +125,7 @@ for my $file (sort @files) { } } - print "ERROR: $shortName has a global initializer in it! ($file)\n"; + print "ERROR: $shortName has one or more global initializers in it! ($file), near @globals\n"; $sawError = 1; } } @@ -138,3 +144,17 @@ sub touch($) open(TOUCH, ">", $path) or die "$!"; close(TOUCH); } + +sub demangle($) +{ + my ($symbol) = @_; + if (!open FILT, "c++filt $symbol |") { + print "ERROR: Could not open c++filt\n"; + return; + } + my $result = ; + close FILT; + chomp $result; + return $result; +} + -- cgit v1.1