From de8817ddbcb3e3ecc0e81c1d5fdd973064d41563 Mon Sep 17 00:00:00 2001 From: "H. Peter Anvin (Intel)" Date: Sat, 27 Jun 2020 22:30:50 -0700 Subject: doc: clean up warnings formatting When a warning documentation message contains more than one paragraph, we have to indent the subsequent paragraphs using \> unless they are a code paragraph (\c). Improve a few warnings doc messages. Signed-off-by: H. Peter Anvin (Intel) --- asm/preproc.c | 2 +- asm/stdscan.c | 2 +- asm/warnings.pl | 13 ++++++++++++- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/asm/preproc.c b/asm/preproc.c index 69c87087..a2c57883 100644 --- a/asm/preproc.c +++ b/asm/preproc.c @@ -5946,7 +5946,7 @@ static MMacro *is_mmacro(Token * tline, int *nparamp, Token ***paramsp) *! The legacy behavior is quite strange and highly context-dependent, *! and can be disabled with: *!- - *! \c %pragma preproc sane_empty_expansion true + *! \c %pragma preproc sane_empty_expansion true *!- *! It is highly recommended to use this option in new code. */ diff --git a/asm/stdscan.c b/asm/stdscan.c index c1c38f42..cbc0fc77 100644 --- a/asm/stdscan.c +++ b/asm/stdscan.c @@ -164,7 +164,7 @@ int stdscan(void *private_data, struct tokenval *tv) *!ptr [on] non-NASM keyword used in other assemblers *! warns about keywords used in other assemblers that might *! indicate a mistake in the source code. Currently only the MASM - *! \c{PTR} keyword is recognized. + *! \c{PTR} keyword is recognized. See also \k{pkg_masm}. */ nasm_warn(WARN_PTR, "`%s' is not a NASM keyword", tv->t_charptr); diff --git a/asm/warnings.pl b/asm/warnings.pl index a609e132..8a79568a 100755 --- a/asm/warnings.pl +++ b/asm/warnings.pl @@ -253,7 +253,18 @@ if ($what eq 'c') { } else { my $docdef = $whatdef{$warn->{def}}; - @doc = @{$warn->{doc}}; + my $newpara = 0; + foreach my $l (@{$warn->{doc}}) { + if ($l =~ /^\s*$/) { + $newpara = 1; + } else { + if ($newpara && $l !~ /^\\c\s+/) { + $l = '\> ' . $l; + } + $newpara = 0; + } + push(@doc, $l); + } if (defined($docdef)) { push(@doc, "\n", "\\> $docdef by default.\n"); } -- cgit v1.2.1