From 235aec793b51987574741a6b8346980b9396cfde Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Wed, 18 Jul 2007 03:18:31 +0000 Subject: [PATCH] Use strict and all warnings. Fix warnings that this triggers. --- src/language/expressions/ChangeLog | 17 +++++++++++++++++ src/language/expressions/evaluate.h.pl | 5 +++++ src/language/expressions/evaluate.inc.pl | 6 ++++++ src/language/expressions/generate.pl | 4 ++-- src/language/expressions/operations.h.pl | 4 ++++ src/language/expressions/optimize.inc.pl | 4 ++++ src/language/expressions/parse.inc.pl | 9 ++++++++- 7 files changed, 46 insertions(+), 3 deletions(-) diff --git a/src/language/expressions/ChangeLog b/src/language/expressions/ChangeLog index a2bdf385..a5895b66 100644 --- a/src/language/expressions/ChangeLog +++ b/src/language/expressions/ChangeLog @@ -1,3 +1,20 @@ +2007-07-17 Ben Pfaff + + Patch #19335. Reviewed by John Darrington. + + * evaluate.h.pl: Use strict and all warnings. Fix warnings that + this triggers. + + * evaluate.inc.pl: Ditto. + + * generate.pl: Ditto. + + * operations.h.pl: Ditto. + + * optimize.inc.pl: Ditto. + + * parse.inc.pl: Ditto. + 2007-04-15 Ben Pfaff * parse.c (expr_get_function): New function. diff --git a/src/language/expressions/evaluate.h.pl b/src/language/expressions/evaluate.h.pl index e1a762fc..c26a7cc9 100644 --- a/src/language/expressions/evaluate.h.pl +++ b/src/language/expressions/evaluate.h.pl @@ -1,5 +1,10 @@ +use strict; +use warnings 'all'; + do 'generate.pl'; +our (%ops); +our (@order); sub generate_output { print "#include \"helpers.h\"\n\n"; diff --git a/src/language/expressions/evaluate.inc.pl b/src/language/expressions/evaluate.inc.pl index 7b6b1a3e..e2fccab8 100644 --- a/src/language/expressions/evaluate.inc.pl +++ b/src/language/expressions/evaluate.inc.pl @@ -1,5 +1,11 @@ +use strict; +use warnings 'all'; + do 'generate.pl'; +our (@order); +our (%ops); + sub generate_output { for my $opname (@order) { my ($op) = $ops{$opname}; diff --git a/src/language/expressions/generate.pl b/src/language/expressions/generate.pl index c730cf07..def34255 100644 --- a/src/language/expressions/generate.pl +++ b/src/language/expressions/generate.pl @@ -16,7 +16,7 @@ init_all_types (); # Parse input file. our (%ops); -our (@funcs, @opers); +our (@funcs, @opers, @order); parse_input (); # Produce output. @@ -380,7 +380,7 @@ sub parse_input { $ops{$a}->{OPNAME} cmp $ops{$b}->{OPNAME}} @funcs; @opers = sort {$ops{$a}->{NAME} cmp $ops{$b}->{NAME}} @opers; - our (@order) = (@funcs, @opers); + @order = (@funcs, @opers); } # Reads the next token into $token, $toktype. diff --git a/src/language/expressions/operations.h.pl b/src/language/expressions/operations.h.pl index d43a5021..8e6e120b 100644 --- a/src/language/expressions/operations.h.pl +++ b/src/language/expressions/operations.h.pl @@ -1,4 +1,8 @@ +use strict; +use warnings 'all'; + do 'generate.pl'; +our (@types, @funcs, @opers); sub generate_output { print "#include \n"; diff --git a/src/language/expressions/optimize.inc.pl b/src/language/expressions/optimize.inc.pl index fce530f7..c4417745 100644 --- a/src/language/expressions/optimize.inc.pl +++ b/src/language/expressions/optimize.inc.pl @@ -1,4 +1,8 @@ +use strict; +use warnings 'all'; + do 'generate.pl'; +our (@order, %ops); sub generate_output { for my $opname (@order) { diff --git a/src/language/expressions/parse.inc.pl b/src/language/expressions/parse.inc.pl index bab06d24..4e7243c1 100644 --- a/src/language/expressions/parse.inc.pl +++ b/src/language/expressions/parse.inc.pl @@ -1,4 +1,8 @@ +use strict; +use warnings 'all'; + do 'generate.pl'; +our (@types, @order, %ops); sub generate_output { my (@members) = ("\"\"", "\"\"", 0, 0, 0, "{}", 0, 0); @@ -7,7 +11,10 @@ sub generate_output { for my $type (@types) { next if $type->{ROLE} eq 'fixed'; - my (@members) = ("\"$type->{NAME}\"", "\"$type->{HUMAN_NAME}\"", + my ($human_name) = $type->{HUMAN_NAME}; + $human_name = "" if !defined $human_name; + + my (@members) = ("\"$type->{NAME}\"", "\"\"", 0, "OP_$type->{NAME}", 0, "{}", 0, 0); print "{", join (', ', @members), "},\n"; } -- 2.30.2