[nasm:nasm-2.16.xx] warnings: strip nasmdoc makeup from help strings
nasm-bot for H. Peter Anvin
hpa at zytor.com
Thu Apr 4 13:27:04 PDT 2024
Commit-ID: d55d22996a6f20f4c44c56c7a7261fae4e14a131
Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=d55d22996a6f20f4c44c56c7a7261fae4e14a131
Author: H. Peter Anvin <hpa at zytor.com>
AuthorDate: Thu, 4 Apr 2024 13:25:05 -0700
Committer: H. Peter Anvin <hpa at zytor.com>
CommitDate: Thu, 4 Apr 2024 13:25:05 -0700
warnings: strip nasmdoc makeup from help strings
When displaying command line help strings, strip nasmdoc markup.
Signed-off-by: H. Peter Anvin <hpa at zytor.com>
---
asm/warnings.pl | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/asm/warnings.pl b/asm/warnings.pl
index 599a42d2..bff566c0 100755
--- a/asm/warnings.pl
+++ b/asm/warnings.pl
@@ -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";
More information about the Nasm-commits
mailing list