diff options
-rw-r--r-- | asm/parser.c | 3 | ||||
-rwxr-xr-x | asm/warnings.pl | 74 |
2 files changed, 37 insertions, 40 deletions
diff --git a/asm/parser.c b/asm/parser.c index 012364ac..ba5081ac 100644 --- a/asm/parser.c +++ b/asm/parser.c @@ -1167,11 +1167,12 @@ is_expression: *! permitted, and do not trigger this warning. Some registers which \e{do not} imply *! a specific size, such as \c{K0}, may need this specification unless the instruction *! itself implies the instruction size: - *! + *!- *! \c KMOVW K0,[foo] ; Permitted, KMOVW implies 16 bits *! \c KMOV WORD K0,[foo] ; Permitted, WORD K0 specifies instruction size *! \c KMOV K0,WORD [foo] ; Permitted, WORD [foo] specifies instruction size *! \c KMOV K0,[foo] ; Not permitted, instruction size ambiguous + *!- */ nasm_warn(WARN_REGSIZE, "invalid register size specification ignored"); } diff --git a/asm/warnings.pl b/asm/warnings.pl index ba4f5906..7987ab4c 100755 --- a/asm/warnings.pl +++ b/asm/warnings.pl @@ -64,47 +64,46 @@ sub find_warnings { # End block comment $in_comment = 0; undef $this; - } elsif ($l =~ /^\s*\/?\*\!(\s*)(.*?)\s*$/) { - my $ws = $1; + } elsif ($l =~ /^\s*\/?\*\!(\-|\=|\s*)(.*?)\s*$/) { + my $opr = $1; my $str = $2; - next if ($str eq ''); - - if (!defined($this) || ($ws eq '' && $str ne '')) { - if ($str =~ /^([\w-]+)\s+\[(\w+)\]\s(.*\S)\s*$/) { - my $name = $1; - my $def = $2; - my $help = $3; - - my $cname = uc($name); - $cname =~ s/[^A-Z0-9_]+/_/g; - - $this = {name => $name, cname => $cname, - def => $def, help => $help, - doc => [], file => $infile, line => $nline}; - - if (defined(my $that = $aliases{$name})) { - # Duplicate defintion?! - printf STDERR "%s:%s: warning %s previously defined at %s:%s\n", - $infile, $nline, $name, $that->{file}, $that->{line}; - } else { - push(@warnings, $this); - # Every warning name is also a valid warning alias - add_alias($name, $this); - $nwarn++; - } - } elsif (defined($this) && $str =~ /^\=([-\w,]+)\s*$/) { - # Alias names for warnings - for my $a (split(/,+/, $1)) { - add_alias($a, $this); - } + if ($opr eq '' && $str eq '') { + next; + } elsif ((!defined($this) || ($opr eq '')) && + ($str =~ /^([\w\-]+)\s+\[(\w+)\]\s(.*\S)\s*$/)) { + my $name = $1; + my $def = $2; + my $help = $3; + + my $cname = uc($name); + $cname =~ s/[^A-Z0-9_]+/_/g; + + $this = {name => $name, cname => $cname, + def => $def, help => $help, + doc => [], file => $infile, line => $nline}; + + if (defined(my $that = $aliases{$name})) { + # Duplicate defintion?! + printf STDERR "%s:%s: warning %s previously defined at %s:%s\n", + $infile, $nline, $name, $that->{file}, $that->{line}; } else { - print STDERR "$infile:$nline: malformed warning definition\n"; - print STDERR " $l\n"; - $err++; + push(@warnings, $this); + # Every warning name is also a valid warning alias + add_alias($name, $this); + $nwarn++; } - } else { + } elsif ($opr eq '=') { + # Alias names for warnings + for my $a (split(/,+/, $1)) { + add_alias($a, $this); + } + } elsif ($opr =~ /^[\-\s]/) { push(@{$this->{doc}}, "$str\n"); + } else { + print STDERR "$infile:$nline: malformed warning definition\n"; + print STDERR " $l\n"; + $err++; } } else { undef $this; @@ -255,9 +254,6 @@ if ($what eq 'c') { my $docdef = $whatdef{$warn->{def}}; @doc = @{$warn->{doc}}; - shift @doc while ($doc[0] =~ /^\s*$/); - pop @doc while ($doc[$#doc] =~ /^\s*$/); - if (defined($docdef)) { push(@doc, "$docdef by default.\n"); } |