summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2019-10-03 22:18:35 -0700
committerH. Peter Anvin <hpa@zytor.com>2019-10-03 22:18:35 -0700
commit7ad824be7a64fd9421e340b770773ca50005a031 (patch)
tree561e60ef1d55e3a14f26dccc4d53410d917190dd
parent97ea4adcf0d862472857a4d2e2211edabf8a69df (diff)
downloadnasm-7ad824be7a64fd9421e340b770773ca50005a031.tar.gz
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>
-rw-r--r--asm/parser.c3
-rwxr-xr-xasm/warnings.pl74
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");
}