[nasm:master] warnings.pl: format the warning class list better

nasm-bot for H. Peter Anvin hpa at zytor.com
Tue Nov 8 17:58:54 PST 2022


Commit-ID:  63049146f6d8359096605fb879ca0e4d0aa4b0f1
Gitweb:     http://repo.or.cz/w/nasm.git?a=commitdiff;h=63049146f6d8359096605fb879ca0e4d0aa4b0f1
Author:     H. Peter Anvin <hpa at zytor.com>
AuthorDate: Tue, 8 Nov 2022 15:26:03 -0800
Committer:  H. Peter Anvin <hpa at zytor.com>
CommitDate: Tue, 8 Nov 2022 15:26:03 -0800

warnings.pl: format the warning class list better

Better formatting for the warning class list (a little bit less like
trying to be prose.)

Signed-off-by: H. Peter Anvin <hpa at zytor.com>


---
 asm/warnings.pl | 36 ++++++++++++++++++++----------------
 1 file changed, 20 insertions(+), 16 deletions(-)

diff --git a/asm/warnings.pl b/asm/warnings.pl
index 4f0433d4..e127307c 100755
--- a/asm/warnings.pl
+++ b/asm/warnings.pl
@@ -228,6 +228,9 @@ if ($what eq 'c') {
 		    'off' => 'Disabled',
 		    'err' => 'Enabled and promoted to error' );
 
+    my @indexinfo = ();
+    my @outtxt    = ();
+
     foreach my $pfx (sort { $a cmp $b } keys(%prefixes)) {
 	my $warn = $aliases{$pfx};
 	my @doc;
@@ -236,25 +239,23 @@ if ($what eq 'c') {
 	    my @plist = sort { $a cmp $b } @{$prefixes{$pfx}};
 	    next if ( $#plist < 1 );
 
-	    @doc = ("is a group alias for all warning classes prefixed by ".
-		    "\\c{".$pfx."-}; currently\n");
-	    for (my $i = 0; $i <= $#plist; $i++) {
-		if ($i > 0) {
-		    if ($i < $#plist) {
-			push(@doc, ", ");
-		    } else {
-			push(@doc, ($i == 1) ? " and " : ", and ");
-		    }
-		}
-		push(@doc, '\c{'.$plist[$i].'}');
-	    }
-	    push(@doc, ".\n");
+	    @doc = ("all \\c{$pfx-} warnings\n\n",
+		    "\\> \\c{$pfx} is a group alias for all warning classes\n",
+		    "prefixed by \\c{$pfx-}; currently\n");
+	    # Just commas is bad grammar to be sure, but it is more
+	    # legible than the alternative.
+	    push(@doc, join(scalar(@plist) < 3 ? ' and ' : ',', @plist).".\n");
 	} elsif ($pfx ne $warn->{name}) {
-	    @doc = ("is a backwards compatibility alias for \\c{",
-		    $warn->{name}, "}.\n");
+	    my $awarn = $aliases{$warn->{name}};
+	    @doc = ($awarn->{help}."\n\n",
+		    "\\> \\c{$pfx} is a backwards compatibility alias for \\c{".
+		    $warn->{name}."}.\n");
 	} else {
 	    my $docdef = $whatdef{$warn->{def}};
 
+	    @doc = ($warn->{help}."\n\n",
+		    "\\> \\c{".$warn->{name}."} ");
+
 	    my $newpara = 0;
 	    foreach my $l (@{$warn->{doc}}) {
 		if ($l =~ /^\s*$/) {
@@ -272,8 +273,11 @@ if ($what eq 'c') {
 	    }
 	}
 
-	print $out "\\b \\i\\c{", $pfx, "} ", @doc, "\n";
+	push(@indexinfo, "\\IR{w-$pfx} warning class, \\c{$pfx}\n");
+	push(@outtxt, "\\b \\I{w-$pfx} \\c{$pfx}: ", @doc, "\n");
     }
+
+    print $out "\n", @indexinfo, "\n", @outtxt;
 }
 
 close($out);


More information about the Nasm-commits mailing list