[kaffe] CVS kaffe (doogie): Rewritten to be a 'bit' more modular.

Kaffe CVS cvs-commits at kaffe.org
Thu Dec 9 21:11:05 PST 2004


PatchSet 5590 
Date: 2004/12/10 05:07:01
Author: doogie
Branch: HEAD
Tag: (none) 
Log:
Rewritten to be a 'bit' more modular.

Members: 
	ChangeLog:1.3135->1.3136 
	scripts/GCCWarning.pm:INITIAL->1.1 
	scripts/JikesWarning.pm:INITIAL->1.1 
	scripts/LogWarning.pm:INITIAL->1.1 
	scripts/sort-warnings.pl:1.6->1.7 

Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.3135 kaffe/ChangeLog:1.3136
--- kaffe/ChangeLog:1.3135	Fri Dec 10 04:54:25 2004
+++ kaffe/ChangeLog	Fri Dec 10 05:07:01 2004
@@ -1,4 +1,9 @@
 2004-12-09  Adam Heath  <doogie at brainfood.com>
+	* scripts/sort-warnings.pl, scripts/LogWarning.pm,
+	  scripts/JikesWarning.pm, scripts/GCCWarning.pm:
+	  Rewritten to be a 'bit' more modular.
+
+2004-12-09  Adam Heath  <doogie at brainfood.com>
 
 	* scripts/sort-warnings.pl: Several new warnings detected, including
 	  some from jikes.
===================================================================
Checking out kaffe/scripts/GCCWarning.pm
RCS:  /home/cvs/kaffe/kaffe/scripts/GCCWarning.pm,v
VERS: 1.1
***************
--- /dev/null	Sun Aug  4 19:57:58 2002
+++ kaffe/scripts/GCCWarning.pm	Fri Dec 10 05:11:05 2004
@@ -0,0 +1,19 @@
+#!/usr/bin/perl -w
+package GCCWarning;
+
+use strict;
+use warnings;
+
+use base qw( LogWarning );
+use vars qw( $prefix_regex $prefix_regex_noparam $prefix_regex2 );
+
+$prefix_regex = qr/^([^:\n]+):(\d+):(?:\d+:)? warning: /m;
+$prefix_regex_noparam = qr/^(?:[^:\n]+):(?:\d+): warning: /m;
+
+sub new {
+    my $class = shift;
+	my ( $name, $regex, $description ) = @_;
+    return $class->SUPER::new( 'gcc', $name, qr/${prefix_regex}$regex/, $description );
+}
+
+1;
===================================================================
Checking out kaffe/scripts/JikesWarning.pm
RCS:  /home/cvs/kaffe/kaffe/scripts/JikesWarning.pm,v
VERS: 1.1
***************
--- /dev/null	Sun Aug  4 19:57:58 2002
+++ kaffe/scripts/JikesWarning.pm	Fri Dec 10 05:11:05 2004
@@ -0,0 +1,18 @@
+#!/usr/bin/perl -w
+
+package JikesWarning;
+
+use strict;
+use warnings;
+
+use base qw( LogWarning );
+use vars qw( $jikes_prefix );
+$jikes_prefix = qr/([^:\n]+):(\d+):\d+:\d+:\d+: (?:Lexical|Semantic) (?:Caution|Warning): /m;
+
+sub new {
+    my $class = shift;
+	my ( $name, $regex, $description ) = @_;
+    return $class->SUPER::new( 'jikes', $name, qr/${jikes_prefix}$regex/, $description );
+}
+
+1;
===================================================================
Checking out kaffe/scripts/LogWarning.pm
RCS:  /home/cvs/kaffe/kaffe/scripts/LogWarning.pm,v
VERS: 1.1
***************
--- /dev/null	Sun Aug  4 19:57:58 2002
+++ kaffe/scripts/LogWarning.pm	Fri Dec 10 05:11:05 2004
@@ -0,0 +1,52 @@
+#!/usr/bin/perl -w
+package LogWarning;
+
+use strict;
+use warnings;
+
+sub new {
+	my $class = shift;
+	return bless( {
+		'compiler'	    => $_[ 0 ],
+		'simple-name'	=> $_[ 1 ],
+		'regex'		    => $_[ 2 ],
+		'description'	=> $_[ 3 ]
+	}, $class );
+}
+
+sub compiler {
+    my $self = shift;
+    if ( $_[ 0 ] ) {
+        $self->{ 'compiler' } = $_[ 0 ];
+    } else {
+	    return $self->{ 'compiler' };
+    }
+}
+
+sub name {
+    my $self = shift;
+    my $compiler = $self->compiler();
+	return ( $compiler ? $compiler . "/" : "" ) . $self->{ 'simple-name' } . $self->index();
+}
+
+sub index {
+    my $self = shift;
+    if ( $_[ 0 ] ) {
+        $self->{ 'index' } = $_[ 0 ];
+    } else {
+        my $index = $self->{ 'index' };
+        return $index ? ":$index" : "";
+    }
+}
+
+sub regex {
+    my $self = shift;
+	return $self->{ 'regex' };
+}
+
+sub description {
+    my $self = shift;
+	return $self->{ 'description' };
+}
+
+1;
Index: kaffe/scripts/sort-warnings.pl
diff -u kaffe/scripts/sort-warnings.pl:1.6 kaffe/scripts/sort-warnings.pl:1.7
--- kaffe/scripts/sort-warnings.pl:1.6	Fri Dec 10 02:31:55 2004
+++ kaffe/scripts/sort-warnings.pl	Fri Dec 10 05:07:03 2004
@@ -3,102 +3,171 @@
 use strict;
 use warnings;
 use Data::Dumper;
-my $prefix_regex = qr/^([^:\n]+):(\d+): warning: /m;
-my $prefix_regex_noparam = qr/^(?:[^:\n]+):(?:\d+): warning: /m;
-my $prefix_regex2 = qr/^([^:\n]+):(\d+):(?:\d+): warning: /m;
-my $jikes_prefix = qr/([^:\n]+):(\d+):\d+:\d+:\d+: (?:Lexical|Semantic) (?:Caution|Warning): /m;
+BEGIN {
+    my $prog = $0;
+    $prog =~ s,/[^/]*,,;
+    unshift( @INC, $prog );
+}
+use LogWarning;
+use JikesWarning;
+use GCCWarning;
 
 #<robilad> guilhem: ~3000 unique ones with -Wall -W -Wtraditional -Wundef -Wshadow -Wpointer-arith -Wbad-function-cast -Wcast-qual
 #          -Wcast-align -Wwrite-strings -Wconversion -Wsign-compare -Waggregate-return -Wstrict-prototypes -Wmissing-prototypes
 #          -Wmissing-declarations -Wmissing-noreturn -Wredundant-decls -Wnested-externs -Winline -Wlong-long
 
+my $path_prefix_regex = qr/\/?([^\/]*\/)*?/;
+my $prog_regex = qr/(${path_prefix_regex})(kaffeh|config\.status|rm|mv|mkdir|ar|ranlib|echo|gmake|sh|sed|cd)\b| ?gcc/;
+my $kjc_regex = qr/\[ (?:start compilation|compilation ended|parsed|checked body|optimized and generated|checked interfaces)/;
+my $shell_keywords = qr/(?:for|then|if) /;
+my $make_regex = qr/make\[\d+\]: (?:(?:Entering|Leaving) directory|Nothing to be done for)/;
+
+my $skip_line_regex = qr,
+    (
+        ^(
+            \(cd\ \.libs|
+            In\ file\ included\ from|
+            \ *from|
+            checking\ |
+            $shell_keywords|
+            $prog_regex|
+            creating|
+            Making|
+            source|
+            $make_regex|
+            depmode|
+            depfile|
+            \ \ adding:|
+            $kjc_regex|
+            <GC|
+            Compiling\ classes\ from|
+            \ [0-9][0-9]+\.[0-9]%
+        )|
+        awaiting\ finalization>$
+    ),x;
+
 my @warning_types = (
-	'java:throws-unchecked'		=> qr/${jikes_prefix}Since type "([^"]+)" is an unchecked exception, it does not need to be listed in the throws clause.$/m,
-	'java:modifier-order'		=> qr/${jikes_prefix}The modifier "([^"]+)" did not appear in the recommended order public\/protected\/private, abstract, static, final, synchronized, transient, volatile, strictfp.$/m,
-	'java:public-in-interface'	=> qr/${jikes_prefix}The use of the "([^"]+)" modifier in this context is redundant and strongly discouraged as a matter of style.$/m,
-	'java:exception-superclass'	=> qr/${jikes_prefix}The listing of type "([^"]+)" in the throws clause is not necessary, since its superclass, "([^"]+)", is also listed.$/m,
-	'java:override-default'		=> qr/${jikes_prefix}Method "([^"]+)" in class "([^"]+)" does not override or hide the corresponding method with default access in class "([^"]+)".$/m,
-	'java:invalid-zip:1'		=> qr/${jikes_prefix}The file "([^"]+)" does not exist or else is not a valid zip file.$/m,
-	'java:invalid-zip:2'		=> qr/${jikes_prefix}I\/O warning: "No such file or directory" while trying to open (.*)\.$/m,
-	'java:negative-shift-count'	=> qr/${jikes_prefix}The shift count (-\d+) is negative; it will be masked to the appropriate width and behave as a positive shift count.$/m,
-	'java:large-shift-count'	=> qr/${jikes_prefix}The shift count of (\d+) is >= the (\d+-bit) width of the type.$/m,
-	'java:method-is-constructor'	=> qr/${jikes_prefix}The name of this method "([^"]+)" matches the name of the containing class. However, the method is not a constructor since its declarator is qualified with a type.$/m,
-	'java:use-parens'		=> qr/${jikes_prefix}Suggest parentheses around assignment used as truth value.$/m,
-	'java:instance-static-access:1'	=> qr/${jikes_prefix}Invoking the class method "([^"]+)" via an instance is discouraged because the method invoked will be the one in the variable's declared type, not the instance's dynamic type.$/m,
-	'java:instance-static-access:2'	=> qr/${jikes_prefix}Accessing the class field "([^"]+)" via an instance is discouraged because the field accessed will be the one in the variable's declared type, not the instance's dynamic type.$/m,
-	'java:static-variable-init'	=> qr/${jikes_prefix}Final field "([^"]+)" is initialized with a constant expression and could be made static to save space.$/m,
-	'java:lexical:invalid-char'	=> qr/${jikes_prefix}The use of "([^"]+)" in an identifier, while legal, is strongly discouraged, since it can conflict with compiler-generated names. If you are trying to access a nested type, use "([^"]+)" instead of "(?:[^"]+)".$/m,
-
-	'missing-prototypes-mismatch'	=> qr/${prefix_regex}no previous prototype for `([^']+)'\n${prefix_regex_noparam}type mismatch with previous implicit declaration\n${prefix_regex}previous implicit declaration of `[^']+'\n${prefix_regex_noparam}`[^']+' was previously implicitly declared to return `([^']+)'$/m,
-
-	'-Wformat-nonliteral:1'		=> qr/${prefix_regex}format not a string literal, argument types not checked$/m,
-	'-Wformat-nonliteral:2'		=> qr/${prefix_regex}format not a string literal and no format arguments$/m,
-	'-Wimplicit-func-decl'		=> qr/${prefix_regex}implicit declaration of function `([^']+)'$/m,
-	'-Wmissing-braces'		=> qr/${prefix_regex}missing initializer\n${prefix_regex_noparam}\(near initialization for `([^']+)'\)$/m,
-	'-Wunused-parameter'		=> qr/${prefix_regex}unused parameter `([^']+)'$/m,
-	'-Wunused-variable'		=> qr/${prefix_regex}unused variable `([^']+)'$/m,
-
-	'-Wfloat-equal'			=> qr/${prefix_regex}comparing floating point with == or != is unsafe$/m,
-
-	'-Wshadow:1'			=> qr/${prefix_regex}declaration of `([^']+)' shadows a global declaration\n${prefix_regex}shadowed declaration is here$/m,
-	'-Wshadow:2'			=> qr/${prefix_regex}declaration of `([^']+)' shadows a previous local\n${prefix_regex}shadowed declaration is here$/m,
-	'-Wpointer-arith:1'		=> qr/${prefix_regex}pointer of type `([^']+)' used in arithmetic$/m,
-	'-Wpointer-arith:2'		=> qr/${prefix_regex}pointer of type `([^']+)' used in subtraction$/m,
-	'-Wbad-function-cast'		=> qr/${prefix_regex}cast does not match function type$/m,
-	'-Wcast-qual:1'			=> qr/${prefix_regex}cast discards qualifiers from pointer target type$/m,
-	'-Wcast-qual:2'			=> qr/${prefix_regex}initialization discards qualifiers from pointer target type$/m,
-	'-Wcast-qual:3'			=> qr/${prefix_regex}passing arg (\d+) of `([^']+)' discards qualifiers from pointer target type$/m,
-	'-Wcast-qual:4'			=> qr/${prefix_regex}return discards qualifiers from pointer target type$/m,
-	'-Wcast-qual:5'			=> qr/${prefix_regex}assignment discards qualifiers from pointer target type$/m,
-	'-Wcast-qual:6'			=> qr/${prefix_regex}assignment makes qualified function pointer from unqualified$/m,
-	'-Wcast-align:1'		=> qr/${prefix_regex}padding struct size to alignment boundary$/m,
-	'-Wconversion:1'		=> qr/${prefix_regex}negative integer implicitly converted to unsigned type$/m,
-	'-Wconversion:2'		=> qr/${prefix_regex}passing arg (\d+) of `([^']+)' makes (integer|pointer) from (integer|pointer) without a cast$/m,
-	'-W:sign-compare'		=> qr/${prefix_regex}comparison of unsigned expression < 0 is always false$/m,
-	'-Wsign-compare:1'		=> qr/${prefix_regex}comparison between signed and unsigned$/m,
-	'-Wsign-compare:2'		=> qr/${prefix_regex}signed and unsigned type in conditional expression$/m,
-	'-Waggregate-return:1'		=> qr/${prefix_regex}function call has aggregate value$/m,
-	'-Waggregate-return:2'		=> qr/${prefix_regex}function returns an aggregate$/m,
-	'-Wstrict-prototypes:1'		=> qr/${prefix_regex}non-static declaration for `([^']+)' follows static$/m,
-	'-Wstrict-prototypes:2'		=> qr/${prefix_regex}function declaration isn't a prototype$/m,
-	'-Wmissing-prototypes'		=> qr/${prefix_regex}no previous prototype for `([^']+)'$/m,
-	'-Wmissing-declarations:1'	=> qr/${prefix_regex2}"([^"]+)" is not defined\s*$/m,
-	'-Wmissing-declarations:2'	=> qr/${prefix_regex2}`([^']+)' is not defined\s*$/m,
-	'-Wmissing-noreturn:1'		=> qr/${prefix_regex}function might be possible candidate for attribute `(noreturn)'$/m,
-	'-Wmissing-noreturn:2'		=> qr/${prefix_regex}`([^']+)' function does return$/m,
-	'-Wmissing-format-attribute'	=> qr/${prefix_regex}function might be possible candidate for `printf' format attribute$/m,
-	'-Wpadded'			=> qr/${prefix_regex}padding struct to align `([^']+)'$/m,
-	'-Wredundant-decls'		=> qr/${prefix_regex}redundant redeclaration of `([^']+)' in same scope\n${prefix_regex}previous declaration of `[^']+'$/m,
-	'-Wnested-externs'		=> qr/${prefix_regex}nested extern declaration of `([^']+)'$/m,
-	'-Wunreachable-code'		=> qr/${prefix_regex}will never be executed$/m,
-	'-Winline'			=> qr/${prefix_regex}inlining failed in call to `([^']+)'\n${prefix_regex}called from here$/m,
+	new JikesWarning( 'throws-uncheck', qr/Since type "([^"]+)" is an unchecked exception, it does not need to be listed in the throws clause.$/m, '' ),
+	new JikesWarning( 'throws-unchecked', qr/Since type "([^"]+)" is an unchecked exception, it does not need to be listed in the throws clause.$/m ),
+	new JikesWarning( 'modifier-order', qr/The modifier "([^"]+)" did not appear in the recommended order public\/protected\/private, abstract, static, final, synchronized, transient, volatile, strictfp.$/m ),
+	new JikesWarning( 'public-in-interface', qr/The use of the "([^"]+)" modifier in this context is redundant and strongly discouraged as a matter of style.$/m ),
+	new JikesWarning( 'exception-superclass', qr/The listing of type "([^"]+)" in the throws clause is not necessary, since its superclass, "([^"]+)", is also listed.$/m ),
+	new JikesWarning( 'override-default', qr/Method "([^"]+)" in class "([^"]+)" does not override or hide the corresponding method with default access in class "([^"]+)".$/m ),
+	new JikesWarning( 'invalid-zip', qr/The file "([^"]+)" does not exist or else is not a valid zip file.$/m ),
+	new JikesWarning( 'invalid-zip', qr/I\/O warning: "No such file or directory" while trying to open (.*)\.$/m ),
+	new JikesWarning( 'negative-shift-count', qr/The shift count (-\d+) is negative; it will be masked to the appropriate width and behave as a positive shift count.$/m ),
+	new JikesWarning( 'large-shift-count', qr/The shift count of (\d+) is >= the (\d+-bit) width of the type.$/m ),
+	new JikesWarning( 'method-is-constructor', qr/The name of this method "([^"]+)" matches the name of the containing class. However, the method is not a constructor since its declarator is qualified with a type.$/m ),
+	new JikesWarning( 'use-parens', qr/Suggest parentheses around assignment used as truth value.$/m ),
+	new JikesWarning( 'instance-static-access', qr/Invoking the class method "([^"]+)" via an instance is discouraged because the method invoked will be the one in the variable's declared type, not the instance's dynamic type.$/m ),
+	new JikesWarning( 'instance-static-access', qr/Accessing the class field "([^"]+)" via an instance is discouraged because the field accessed will be the one in the variable's declared type, not the instance's dynamic type.$/m ),
+	new JikesWarning( 'static-variable-init', qr/Final field "([^"]+)" is initialized with a constant expression and could be made static to save space.$/m ),
+	new JikesWarning( 'lexical:invalid-char', qr/The use of "([^"]+)" in an identifier, while legal, is strongly discouraged, since it can conflict with compiler-generated names. If you are trying to access a nested type, use "([^"]+)" instead of "(?:[^"]+)".$/m ),
+
+	new GCCWarning( 'missing-prototypes-mismatch', qr/no previous prototype for `([^']+)'\n${GCCWarning::prefix_regex_noparam}type mismatch with previous implicit declaration\n${GCCWarning::prefix_regex}previous implicit declaration of `[^']+'\n${GCCWarning::prefix_regex_noparam}`[^']+' was previously implicitly declared to return `([^']+)'$/m ),
+
+	new GCCWarning( '-Wformat-nonliteral', qr/format not a string literal, argument types not checked$/m ),
+	new GCCWarning( '-Wformat-nonliteral', qr/format not a string literal and no format arguments$/m ),
+	new GCCWarning( '-Wimplicit-func-decl', qr/implicit declaration of function `([^']+)'$/m ),
+	new GCCWarning( '-Wmissing-braces', qr/missing initializer\n${GCCWarning::prefix_regex_noparam}\(near initialization for `([^']+)'\)$/m ),
+	new GCCWarning( '-Wunused-parameter', qr/unused parameter `([^']+)'$/m ),
+	new GCCWarning( '-Wunused-variable', qr/unused variable `([^']+)'$/m ),
+
+	new GCCWarning( '-Wfloat-equal', qr/comparing floating point with == or != is unsafe$/m ),
+
+	new GCCWarning( '-Wshadow', qr/declaration of `([^']+)' shadows a global declaration\n${GCCWarning::prefix_regex}shadowed declaration is here$/m ),
+	new GCCWarning( '-Wshadow', qr/declaration of `([^']+)' shadows a previous local\n${GCCWarning::prefix_regex}shadowed declaration is here$/m ),
+	new GCCWarning( '-Wpointer-arith', qr/pointer of type `([^']+)' used in arithmetic$/m ),
+	new GCCWarning( '-Wpointer-arith', qr/pointer of type `([^']+)' used in subtraction$/m ),
+	new GCCWarning( '-Wbad-function-cast', qr/cast does not match function type$/m ),
+	new GCCWarning( '-Wcast-qual', qr/cast discards qualifiers from pointer target type$/m ),
+	new GCCWarning( '-Wcast-qual', qr/initialization discards qualifiers from pointer target type$/m ),
+	new GCCWarning( '-Wcast-qual', qr/passing arg (\d+) of `([^']+)' discards qualifiers from pointer target type$/m ),
+	new GCCWarning( '-Wcast-qual', qr/return discards qualifiers from pointer target type$/m ),
+	new GCCWarning( '-Wcast-qual', qr/assignment discards qualifiers from pointer target type$/m ),
+	new GCCWarning( '-Wcast-qual', qr/assignment makes qualified function pointer from unqualified$/m ),
+	new GCCWarning( '-Wcast-align', qr/padding struct size to alignment boundary$/m ),
+	new GCCWarning( '-Wconversion', qr/negative integer implicitly converted to unsigned type$/m ),
+	new GCCWarning( '-Wconversion', qr/passing arg (\d+) of `([^']+)' makes (integer|pointer) from (integer|pointer) without a cast$/m ),
+	new GCCWarning( '-Wsign-compare', qr/comparison of unsigned expression < 0 is always false$/m ),
+	new GCCWarning( '-Wsign-compare', qr/comparison between signed and unsigned$/m ),
+	new GCCWarning( '-Wsign-compare', qr/signed and unsigned type in conditional expression$/m ),
+	new GCCWarning( '-Waggregate-return', qr/function call has aggregate value$/m ),
+	new GCCWarning( '-Waggregate-return', qr/function returns an aggregate$/m ),
+	new GCCWarning( '-Wstrict-prototypes', qr/non-static declaration for `([^']+)' follows static$/m ),
+	new GCCWarning( '-Wstrict-prototypes', qr/function declaration isn't a prototype$/m ),
+	new GCCWarning( '-Wmissing-prototypes', qr/no previous prototype for `([^']+)'$/m ),
+	new GCCWarning( '-Wmissing-declarations'	=> qr/"([^"]+)" is not defined\s*$/m ),
+	new GCCWarning( '-Wmissing-declarations'	=> qr/`([^']+)' is not defined\s*$/m ),
+	new GCCWarning( '-Wmissing-noreturn', qr/function might be possible candidate for attribute `(noreturn)'$/m ),
+	new GCCWarning( '-Wmissing-noreturn', qr/`([^']+)' function does return$/m ),
+	new GCCWarning( '-Wmissing-format-attribute', qr/function might be possible candidate for `printf' format attribute$/m ),
+	new GCCWarning( '-Wpadded', qr/padding struct to align `([^']+)'$/m ),
+	new GCCWarning( '-Wredundant-decls', qr/redundant redeclaration of `([^']+)' in same scope\n${GCCWarning::prefix_regex}previous declaration of `[^']+'$/m ),
+	new GCCWarning( '-Wnested-externs', qr/nested extern declaration of `([^']+)'$/m ),
+	new GCCWarning( '-Wunreachable-code', qr/will never be executed$/m ),
+	new GCCWarning( '-Winline', qr/inlining failed in call to `([^']+)'\n${GCCWarning::prefix_regex}called from here$/m ),
 
 
 
 
 
-	'traditional-1'			=> qr/${prefix_regex}passing arg (\d+) of (?:`([^']+)'|(pointer to function)) with different width due to prototype$/m,
-	'traditional-2'			=> qr/${prefix_regex}passing arg (\d+) of (?:`([^']+)'|(pointer to function)) as (unsigned|signed) due to prototype$/m,
-	'traditional-3'			=> qr/${prefix_regex}passing arg (\d+) of `([^']+)' as `([^']+)' rather than `([^']+)' due to prototype$/m,
-	'traditional-4'			=> qr/${prefix_regex}macro arg `([^']+)' would be stringified with -traditional\.$/m,
-	'traditional-5'			=> qr/${prefix_regex}passing arg (\d+) of `([^']+)' as (floating|integer) rather than (floating|integer) due to prototype$/m,
-	'traditional-6'			=> qr/${prefix_regex}passing arg (\d+) of (?:`([^']+)'|(pointer to function)) as `([^']+)' rather than `([^']+)' due to prototype$/m,
-	'traditional-7'			=> qr/${prefix_regex}passing arg (\d+) of (?:`([^']+)'|(pointer to function)) from incompatible pointer type$/m,
-
-
-	'deprecated-lvalue'		=> qr/${prefix_regex}use of (compound|conditional|cast) expressions as lvalues is deprecated$/m,
-
-	'foo-1'				=> qr/${prefix_regex}`([^']+)' declared inside parameter list$/m,
-	'foo-2'				=> qr/${prefix_regex}(assignment|initialization) from incompatible pointer type$/m,
-	'foo-4'				=> qr/${prefix_regex}integer constant is too large for "([^"]+)" type$/m,
+	new GCCWarning( 'traditional', qr/passing arg (\d+) of (?:`([^']+)'|(pointer to function)) with different width due to prototype$/m ),
+	new GCCWarning( 'traditional', qr/passing arg (\d+) of (?:`([^']+)'|(pointer to function)) as (unsigned|signed) due to prototype$/m ),
+	new GCCWarning( 'traditional', qr/passing arg (\d+) of `([^']+)' as `([^']+)' rather than `([^']+)' due to prototype$/m ),
+	new GCCWarning( 'traditional', qr/macro arg `([^']+)' would be stringified with -traditional\.$/m ),
+	new GCCWarning( 'traditional', qr/passing arg (\d+) of `([^']+)' as (floating|integer) rather than (floating|integer) due to prototype$/m ),
+	new GCCWarning( 'traditional', qr/passing arg (\d+) of (?:`([^']+)'|(pointer to function)) as `([^']+)' rather than `([^']+)' due to prototype$/m ),
+	new GCCWarning( 'traditional', qr/passing arg (\d+) of (?:`([^']+)'|(pointer to function)) from incompatible pointer type$/m ),
+
+
+	new GCCWarning( 'deprecated-lvalue', qr/use of (compound|conditional|cast) expressions as lvalues is deprecated$/m ),
+
+	new GCCWarning( 'foo', qr/`([^']+)' declared inside parameter list$/m ),
+	new GCCWarning( 'foo', qr/(assignment|initialization) from incompatible pointer type$/m ),
+	new GCCWarning( 'foo', qr/integer constant is too large for "([^"]+)" type$/m ),
 
 );
 
+# No User Servicable Parts Below
+
+my %disabled;
+
+# <auto-number duplicate entries>
+my %duplicated_warnings;
+for ( my $i = 0; $i < @warning_types; $i++ ) {
+	my $warning = $warning_types[ $i ];
+    my $warning_group = $duplicated_warnings{ $warning->compiler() } ||= {};
+    my $warning_name = $warning->name();
+    if ( !$warning_group->{ $warning_name } ) {
+        $warning_group->{ $warning_name } = $warning;
+    } else {
+        if ( ref( $warning_group->{ $warning_name } ) ) {
+            $warning_group->{ $warning_name }->index( 1 );
+            $warning_group->{ $warning_name } = 2;
+        }
+        $warning->index( $warning_group->{ $warning_name }++ );
+    }
+}
+# </auto-number duplicate entries>
+
 #print( STDERR join(',', keys( %warning_types ) )."\n" );
 my $text;
+my $removeNext = 0;
 while (<>) {
 #	chomp;
-	next if ( m,(^(\(cd \.libs|In file included from| *from|config\.status|checking |for |then |if |rm|mv|mkdir|ar|ranlib|creating|echo|gmake| ?gcc|Making|source|depmode|depfile|../kaffe/kaffeh/kaffeh |/bin/sh|  adding:|\[ (start compilation|compilation ended|parsed|checked body|optimized and generated|checked interfaces)|<GC|Compiling classes from| [0-9][0-9]+\.[0-9]%)|awaiting finalization>$), );
+	if ( $removeNext ) {
+        $removeNext = 0 if ( !m/\\$/ );
+        next;
+    }
+    if ( m/$skip_line_regex/ ) {
+        if ( m/\\$/ ) {
+            $removeNext = 1;
+        } else {
+            $removeNext = 0;
+        }
+        next;
+    }
 	$text .= $_;
 }
 print( STDERR "done loading: " . length( $text ) . "\n" );
@@ -108,10 +177,13 @@
 my %errors;
 my $total_errors = 0;
 
-for ( my $i = 0; $i + 1 < @warning_types; $i += 2 ) {
-	my ( $type, $regex ) = @warning_types[ $i .. $i+1 ];
+for ( my $i = 0; $i < @warning_types; $i++ ) {
+	my $warning = $warning_types[ $i ];
+    my $compiler = $warning->compiler();
+    my $type = $warning->name();
+    my $regex = $warning->regex();
 
-print( STDERR "\t$type\t\t" );
+print( STDERR "\t$type\t\t" ) if ( !$disabled{ $compiler } );
 	my @matches;
 	my $scanned = '';
 	my $count = 0;
@@ -123,14 +195,15 @@
 #print( STDERR "1='$1' [@matches]\n" );
 		my ( $file, $line, ) = ( shift( @matches ), shift( @matches ) );
 		$file =~ s,(?:(?:\.\./)+|/tmp/topic/)(include|kaffe|libraries|config)/,$1/,;
-		next if ( $file =~ m,^/, );
+        # skip files if they are absolute, on the assumption they are system files.
+		next if ( $file =~ m,^/, || $disabled{ $compiler } );
 		push( @{ $errors{ $type }{ $file }{ $line } }, [ grep( { defined( $_ ) } @matches ) ] );
 		$file_errors{ $file }++;
 		$error_counts{ $type }++;
 		$count++;
 		$total_errors++;
 	}
-print( STDERR "$count\n" );
+print( STDERR "$count\n" ) if ( !$disabled{ $compiler } );
 	$text = $scanned . $text;
 }
 #print( STDERR join( "\n", keys( %file_errors ) ) . "\n" );




More information about the kaffe mailing list