Skip to content

Commit 6304914

Browse files
author
H. Peter Anvin
committed
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 <[email protected]>
1 parent a5fc643 commit 6304914

File tree

1 file changed

+20
-16
lines changed

1 file changed

+20
-16
lines changed

asm/warnings.pl

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,9 @@ sub sort_warnings {
228228
'off' => 'Disabled',
229229
'err' => 'Enabled and promoted to error' );
230230

231+
my @indexinfo = ();
232+
my @outtxt = ();
233+
231234
foreach my $pfx (sort { $a cmp $b } keys(%prefixes)) {
232235
my $warn = $aliases{$pfx};
233236
my @doc;
@@ -236,25 +239,23 @@ sub sort_warnings {
236239
my @plist = sort { $a cmp $b } @{$prefixes{$pfx}};
237240
next if ( $#plist < 1 );
238241

239-
@doc = ("is a group alias for all warning classes prefixed by ".
240-
"\\c{".$pfx."-}; currently\n");
241-
for (my $i = 0; $i <= $#plist; $i++) {
242-
if ($i > 0) {
243-
if ($i < $#plist) {
244-
push(@doc, ", ");
245-
} else {
246-
push(@doc, ($i == 1) ? " and " : ", and ");
247-
}
248-
}
249-
push(@doc, '\c{'.$plist[$i].'}');
250-
}
251-
push(@doc, ".\n");
242+
@doc = ("all \\c{$pfx-} warnings\n\n",
243+
"\\> \\c{$pfx} is a group alias for all warning classes\n",
244+
"prefixed by \\c{$pfx-}; currently\n");
245+
# Just commas is bad grammar to be sure, but it is more
246+
# legible than the alternative.
247+
push(@doc, join(scalar(@plist) < 3 ? ' and ' : ',', @plist).".\n");
252248
} elsif ($pfx ne $warn->{name}) {
253-
@doc = ("is a backwards compatibility alias for \\c{",
254-
$warn->{name}, "}.\n");
249+
my $awarn = $aliases{$warn->{name}};
250+
@doc = ($awarn->{help}."\n\n",
251+
"\\> \\c{$pfx} is a backwards compatibility alias for \\c{".
252+
$warn->{name}."}.\n");
255253
} else {
256254
my $docdef = $whatdef{$warn->{def}};
257255

256+
@doc = ($warn->{help}."\n\n",
257+
"\\> \\c{".$warn->{name}."} ");
258+
258259
my $newpara = 0;
259260
foreach my $l (@{$warn->{doc}}) {
260261
if ($l =~ /^\s*$/) {
@@ -272,8 +273,11 @@ sub sort_warnings {
272273
}
273274
}
274275

275-
print $out "\\b \\i\\c{", $pfx, "} ", @doc, "\n";
276+
push(@indexinfo, "\\IR{w-$pfx} warning class, \\c{$pfx}\n");
277+
push(@outtxt, "\\b \\I{w-$pfx} \\c{$pfx}: ", @doc, "\n");
276278
}
279+
280+
print $out "\n", @indexinfo, "\n", @outtxt;
277281
}
278282

279283
close($out);

0 commit comments

Comments
 (0)