Skip to content

Commit d55d229

Browse files
author
H. Peter Anvin
committed
warnings: strip nasmdoc makeup from help strings
When displaying command line help strings, strip nasmdoc markup. Signed-off-by: H. Peter Anvin <[email protected]>
1 parent 33ef636 commit d55d229

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

asm/warnings.pl

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,21 @@
1111
my $err = 0;
1212
my $nwarn = 0;
1313

14-
sub quote_for_c($) {
14+
sub quote_for_c(@) {
1515
my $s = join('', @_);
1616

1717
$s =~ s/([\"\'\\])/\\$1/g;
1818
return $s;
1919
}
2020

21+
sub remove_markup(@) {
22+
my $s = join('', @_);
23+
24+
$s =~ s/\\[\w+](\{((?:(?>[^{}]+)|(?1))*)\})?/$2/g;
25+
$s =~ s/\\(\W)/$1/g;
26+
return $s;
27+
}
28+
2129
sub add_alias($$) {
2230
my($a, $this) = @_;
2331
my @comp = split(/-/, $a);
@@ -162,7 +170,7 @@ sub sort_warnings {
162170
$#warnings + 2;
163171
print $out "\tNULL";
164172
foreach my $warn (@warnings) {
165-
my $help = quote_for_c($warn->{help});
173+
my $help = quote_for_c(remove_markup($warn->{help}));
166174
print $out ",\n\t\"", $help, "\"";
167175
}
168176
print $out "\n};\n\n";

0 commit comments

Comments
 (0)