warnings: strip nasmdoc makeup from help strings When displaying command line help strings, strip nasmdoc markup. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
diff --git a/asm/warnings.pl b/asm/warnings.pl index 599a42d..bff566c 100755 --- a/asm/warnings.pl +++ b/asm/warnings.pl
@@ -11,13 +11,21 @@ my $err = 0; my $nwarn = 0; -sub quote_for_c($) { +sub quote_for_c(@) { my $s = join('', @_); $s =~ s/([\"\'\\])/\\$1/g; return $s; } +sub remove_markup(@) { + my $s = join('', @_); + + $s =~ s/\\[\w+](\{((?:(?>[^{}]+)|(?1))*)\})?/$2/g; + $s =~ s/\\(\W)/$1/g; + return $s; +} + sub add_alias($$) { my($a, $this) = @_; my @comp = split(/-/, $a); @@ -162,7 +170,7 @@ $#warnings + 2; print $out "\tNULL"; foreach my $warn (@warnings) { - my $help = quote_for_c($warn->{help}); + my $help = quote_for_c(remove_markup($warn->{help})); print $out ",\n\t\"", $help, "\""; } print $out "\n};\n\n";