mirror of
https://github.com/netwide-assembler/nasm.git
synced 2024-11-27 08:10:07 +08:00
warnings: make it possible to put blank lines in doc text
rdsrc.pl requires blank lines around \c paragraph, but warnings.pl would strip them. Create a *!- prefix to force a blank line. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
This commit is contained in:
parent
97ea4adcf0
commit
7ad824be7a
@ -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");
|
||||
}
|
||||
|
@ -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 ($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;
|
||||
|
||||
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;
|
||||
|
||||
my $cname = uc($name);
|
||||
$cname =~ s/[^A-Z0-9_]+/_/g;
|
||||
$this = {name => $name, cname => $cname,
|
||||
def => $def, help => $help,
|
||||
doc => [], file => $infile, line => $nline};
|
||||
|
||||
$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 (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");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user