aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorH. Peter Anvin (Intel) <hpa@zytor.com>2019-08-09 13:30:19 -0700
committerH. Peter Anvin (Intel) <hpa@zytor.com>2019-08-09 13:30:19 -0700
commit177a05d0ce75eeee49a98944b9c7e7efa971a0a6 (patch)
tree041859be3209522e20fc7a9164a36048e42e5d88
parent2503cc09a2f749669609e5c2b3a744426720acd1 (diff)
downloadnasm-177a05d0ce75eeee49a98944b9c7e7efa971a0a6.tar.gz
nasm-177a05d0ce75eeee49a98944b9c7e7efa971a0a6.tar.xz
nasm-177a05d0ce75eeee49a98944b9c7e7efa971a0a6.zip
perl files: clean up warnings
Clean up some perl warnings, some of which were legitimate (apparently undef doesn't actually take a list of arguments, a common enough mistake that it is mentioned in the man page!, and a list of variables after "my" can be cantankerous), and some of which were nuisance but were easy enough to clean up. Maybe this can resolve the problems with very old version of Perl? Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
-rwxr-xr-xasm/pptok.pl2
-rwxr-xr-xasm/tokhash.pl5
-rwxr-xr-xasm/warnings.pl8
-rwxr-xr-xmacros/macros.pl11
-rwxr-xr-xnasmlib/perfhash.pl6
-rw-r--r--perllib/phash.ph6
-rwxr-xr-xtools/mkdep.pl4
-rwxr-xr-xversion.pl6
-rwxr-xr-xx86/insns.pl25
-rwxr-xr-xx86/regs.pl3
10 files changed, 38 insertions, 38 deletions
diff --git a/asm/pptok.pl b/asm/pptok.pl
index 1dd5733a..2c28508f 100755
--- a/asm/pptok.pl
+++ b/asm/pptok.pl
@@ -174,8 +174,6 @@ if ($what eq 'c') {
verify_hash_table(\%tokens, \@hashinfo);
($n, $sv, $g) = @hashinfo;
- $sv2 = $sv+2;
-
die if ($n & ($n-1));
print OUT "#include \"compiler.h\"\n";
diff --git a/asm/tokhash.pl b/asm/tokhash.pl
index 72f3fee4..4636e12e 100755
--- a/asm/tokhash.pl
+++ b/asm/tokhash.pl
@@ -100,7 +100,8 @@ while (defined($line = <RD>)) {
$reg_suffix = $4;
} else {
$nregs = 1;
- undef $reg_prefix, $reg_suffix;
+ undef $reg_prefix;
+ undef $reg_suffix;
}
while ($nregs--) {
@@ -196,8 +197,6 @@ if ($output eq 'h') {
verify_hash_table(\%tokens, \@hashinfo);
($n, $sv, $g) = @hashinfo;
- $sv2 = $sv+2;
-
die if ($n & ($n-1));
print "/*\n";
diff --git a/asm/warnings.pl b/asm/warnings.pl
index 6eac60cd..9a3d39f5 100755
--- a/asm/warnings.pl
+++ b/asm/warnings.pl
@@ -13,7 +13,7 @@ my $nwarn = 0;
sub quote_for_c($) {
my $s = join('', @_);
- $s =~ s/([\"\'\\])/\\\1/g;
+ $s =~ s/([\"\'\\])/\\$1/g;
return $s;
}
@@ -93,7 +93,7 @@ sub find_warnings {
add_alias($name, $this);
$nwarn++;
}
- } elsif (defined($this) && $str =~ /^\=([\w-,]+)\s*$/) {
+ } elsif (defined($this) && $str =~ /^\=([-\w,]+)\s*$/) {
# Alias names for warnings
for my $a (split(/,+/, $1)) {
add_alias($a, $this);
@@ -147,7 +147,7 @@ if ($what eq 'c') {
print $out ",\n\t\"", $warn->{name}, "\"";
}
print $out "\n};\n\n";
- printf $out "const struct warning_alias warning_alias[NUM_WARNING_ALIAS] = {",
+ printf $out "const struct warning_alias warning_alias[%d] = {",
scalar(%aliases);
my $sep = '';
foreach my $alias (sort { $a cmp $b } keys(%aliases)) {
@@ -200,7 +200,7 @@ if ($what eq 'c') {
print $out "enum warn_const {\n";
printf $out "\tWARN_%-27s = %3d << WARN_SHR", 'NONE', 0;
- my $n = 1;
+ $n = 1;
foreach my $warn (@warn_noall) {
printf $out ",\n\tWARN_%-27s = %3d << WARN_SHR", $warn->{cname}, $n++;
}
diff --git a/macros/macros.pl b/macros/macros.pl
index d4bfa9fa..2f5d40d1 100755
--- a/macros/macros.pl
+++ b/macros/macros.pl
@@ -51,7 +51,7 @@ my $tasm_count = 0;
#
sub charcify(@) {
my $l = '';
- my $c, $o;
+ my ($c, $o);
my $space = 1;
my $quote = 0;
@@ -109,6 +109,7 @@ my @pkg_list = ();
my %pkg_number = ();
my $pkg;
my @out_list = ();
+my @std_list = ();
my $outfmt;
my $lastname;
my $z;
@@ -145,8 +146,6 @@ foreach $args ( @ARGV ) {
print OUT "\nconst unsigned char ${name}[] = {\n";
print OUT " /* From $fname */\n";
$lastname = $fname;
- push(@out_list, $out_alias[0]);
- $out_index{$out_alias[0]} = $index;
} elsif (m/^STD:\s*(.*\S)\s*$/) {
undef $pkg;
my @out_alias = split(/\s+/, $1);
@@ -161,8 +160,6 @@ foreach $args ( @ARGV ) {
print OUT "\nconst unsigned char ${name}[] = {\n";
print OUT " /* From $fname */\n";
$lastname = $fname;
- push(@std_list, $out_alias[0]);
- $std_index{$std_alias[0]} = $index;
} elsif (m/^USE:\s*(\S+)\s*$/) {
$pkg = $1;
if (defined($pkg_number{$pkg})) {
@@ -185,7 +182,7 @@ foreach $args ( @ARGV ) {
printf OUT " /* %4d */ %s0,\n", $index, charcify($z);
$index += length($z)+1;
} elsif (m/^\s*((\s*([^\"\';\s]+|\"[^\"]*\"|\'[^\']*\'))*)\s*(;.*)?$/) {
- my $s1, $s2, $pd, $ws;
+ my($s1, $s2, $pd, $ws);
if (!defined($name)) {
die "$0: $fname: macro declarations outside a known block\n";
@@ -216,7 +213,7 @@ foreach $args ( @ARGV ) {
$index += length($s2)+1;
}
} else {
- die "$fname:$line: error unterminated quote";
+ die "$fname:$line: error: unterminated quote\n";
}
}
close(INPUT);
diff --git a/nasmlib/perfhash.pl b/nasmlib/perfhash.pl
index 639b347f..8df21f69 100755
--- a/nasmlib/perfhash.pl
+++ b/nasmlib/perfhash.pl
@@ -211,9 +211,9 @@ foreach my $s (keys(%strings)) {
} else {
$enumvals{$v} = $es;
}
- $max_enum = $v if ($v > $max_enum || !defined($max_enum));
- $tbloffs = $v if ($v < $tbloffs || !defined($tbloffs));
- $tbllen = $v+1 if ($v >= $tbllen || !defined($tbllen));
+ $max_enum = $v if (!defined($max_enum) || $v > $max_enum);
+ $tbloffs = $v if (!defined($tbloffs) || $v < $tbloffs);
+ $tbllen = $v+1 if (!defined($tbllen) || $v >= $tbllen);
}
foreach my $s (keys(%specials)) {
my $es = $prefix . $s; # No string mangling here
diff --git a/perllib/phash.ph b/perllib/phash.ph
index 8142c4ef..644e13c7 100644
--- a/perllib/phash.ph
+++ b/perllib/phash.ph
@@ -62,9 +62,9 @@ sub walk_graph($$$$) {
sub gen_hash_n($$$$) {
my($n, $sv, $href, $run) = @_;
my @keys = keys(%{$href});
- my $i, $sv;
+ my $i;
my $gr;
- my $k, $v;
+ my ($k, $v);
my $gsize = 2*$n;
my @nodeval;
my @nodeneigh;
@@ -140,7 +140,7 @@ sub gen_perfect_hash($) {
my($href) = @_;
my @keys = keys(%{$href});
my @hashinfo;
- my $n, $i, $j, $sv, $maxj;
+ my ($n, $i, $j, $sv, $maxj);
my $run = 1;
# Minimal power of 2 value for N with enough wiggle room.
diff --git a/tools/mkdep.pl b/tools/mkdep.pl
index 8c89f39a..1966660d 100755
--- a/tools/mkdep.pl
+++ b/tools/mkdep.pl
@@ -49,7 +49,7 @@ use Fcntl;
$barrier = "#-- Everything below is generated by mkdep.pl - do not edit --#\n";
# This converts from filenames to full pathnames for our dependencies
-%dep_path = {};
+%dep_path = ();
# List of files that cannot be found; these *must* be excluded
@must_exclude = ();
@@ -134,7 +134,7 @@ sub _insert_deps($$) {
open(my $in, '<', $file)
or die "$0: Cannot open input: $file\n";
- my $line, $parm, $val;
+ my ($line, $parm, $val);
my $obj = '.o'; # Defaults
my $sep = '/';
my $cont = "\\";
diff --git a/version.pl b/version.pl
index 579ba7b5..f6a9c7f7 100755
--- a/version.pl
+++ b/version.pl
@@ -70,7 +70,11 @@
$line = <STDIN>;
chomp $line;
-undef $man, $min, $smin, $plvl, $tail;
+undef $maj;
+undef $min;
+undef $smin;
+undef $plvl;
+undef $tail;
$is_rc = 0;
if ( $line =~ /^([0-9]+)\.([0-9]+)(.*)$/ ) {
diff --git a/x86/insns.pl b/x86/insns.pl
index 9cf6512a..5716d540 100755
--- a/x86/insns.pl
+++ b/x86/insns.pl
@@ -441,9 +441,10 @@ sub count_bytecodes(@) {
sub format_insn($$$$$) {
my ($opcode, $operands, $codes, $flags, $relax) = @_;
- my $num, $nd = 0, $rawflags, $flagsindex;
+ my $nd = 0;
+ my ($num, $flagsindex);
my @bytecode;
- my $op, @ops, $opp, @opx, @oppx, @decos, @opevex;
+ my ($op, @ops, $opp, @opx, @oppx, @decos, @opevex);
return (undef, undef) if $operands eq "ignore";
@@ -615,20 +616,20 @@ sub hexstr(@) {
# \24x \250 skip EVEX control bytes
sub startseq($$) {
my ($codestr, $relax) = @_;
- my $word, @range;
+ my $word;
my @codes = ();
my $c = $codestr;
- my $c0, $c1, $i;
+ my($c0, $c1, $i);
my $prefix = '';
@codes = decodify($codestr, $relax);
- while ($c0 = shift(@codes)) {
+ while (defined($c0 = shift(@codes))) {
$c1 = $codes[0];
if ($c0 >= 01 && $c0 <= 04) {
# Fixed byte string
my $fbs = $prefix;
- while (1) {
+ while (defined($c0)) {
if ($c0 >= 01 && $c0 <= 04) {
while ($c0--) {
$fbs .= sprintf("%02X", shift(@codes));
@@ -662,7 +663,7 @@ sub startseq($$) {
return $prefix;
} elsif (($c0 & ~3) == 0260 || $c0 == 0270 ||
($c0 & ~3) == 0240 || $c0 == 0250) {
- my $c,$m,$wlp;
+ my($c,$m,$wlp);
$m = shift(@codes);
$wlp = shift(@codes);
$c = ($m >> 6);
@@ -740,7 +741,7 @@ sub byte_code_compile($$) {
my $litix = undef;
my %oppos = ();
my $i;
- my $op, $oq;
+ my ($op, $oq);
my $opex;
my %imm_codes = (
@@ -813,11 +814,11 @@ sub byte_code_compile($$) {
unless ($str =~ /^(([^\s:]*)\:*([^\s:]*)\:|)\s*(.*\S)\s*$/) {
die "$fname:$line: cannot parse: [$str]\n";
}
- $opr = "\L$2";
- $tuple = "\L$3"; # Tuple type for AVX512
- $opc = "\L$4";
+ $opr = lc($2);
+ $tuple = lc($3); # Tuple type for AVX512
+ $opc = lc($4);
- my $op = 0;
+ $op = 0;
for ($i = 0; $i < length($opr); $i++) {
my $c = substr($opr,$i,1);
if ($c eq '+') {
diff --git a/x86/regs.pl b/x86/regs.pl
index 3a1b56f5..31a3fb32 100755
--- a/x86/regs.pl
+++ b/x86/regs.pl
@@ -64,7 +64,8 @@ sub process_line($) {
$reg_suffix = $4;
} else {
$nregs = 1;
- undef $reg_prefix, $reg_suffix;
+ undef $reg_prefix;
+ undef $reg_suffix;
}
while ($nregs--) {