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>
This commit is contained in:
H. Peter Anvin 2024-04-04 13:25:05 -07:00
parent 33ef63669c
commit d55d22996a

View File

@ -11,13 +11,21 @@ my %prefixes = ();
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 @@ if ($what eq 'c') {
$#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";