From: Philippe Waroquiers <philippe.waroquiers@skynet.be>
To: Tom Tromey <tom@tromey.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [RFAv2 2/2] Add a selftest that checks documentation invariants.
Date: Tue, 06 Aug 2019 22:21:00 -0000 [thread overview]
Message-ID: <1565130113.1435.10.camel@skynet.be> (raw)
In-Reply-To: <874l2u9mah.fsf@tromey.com>
On Tue, 2019-08-06 at 12:33 -0600, Tom Tromey wrote:
> > > > > > "Philippe" == Philippe Waroquiers <philippe.waroquiers@skynet.be> writes:
>
> Philippe> gdb/ChangeLog
> Philippe> * unittests/help-doc-selftests.c: New file.
> Philippe> * Makefile.in: Add the new file.
>
> Thanks for doing this.
>
> Philippe> +static void
> Philippe> +broken_doc_invariant (const char *prefix, const char *name, const char *msg)
> Philippe> +{
> Philippe> + fprintf_filtered (gdb_stdout,
> Philippe> + "help doc broken invariant: command '%s%s' help doc %s\n",
> Philippe> + prefix, name, msg);
>
> Normally I'd probably complain about being i18n-unfriendly here, but TBH
> I don't think that matters much for unit tests.
>
> Philippe> + /* Walk through the commands. */
> Philippe> + for (c=commandlist;c;c=c->next)
fixed.
>
> This needs some spaces.
>
> Philippe> + while (*p && *p != '\n')
> Philippe> + p++;
>
> I think this could just be "p = strchr (p, '\n')".
I have kept the code above, as strchr returns NULL if no \n
is found, but it is normal to have a doc with just the
first line (not terminated by a LF).
In this case, we must still check that we have a . before
the terminating null byte.
I have put the following comment to clarify:
      /* Position p on the first LF, or on terminating null byte.  */
      while (*p && *p != '\n')
p++;
>
> This is ok with those things fixed.
I have pushed after having fixed the missing spaces and added
the comment.
Thanks for the reviews
Philippe
next prev parent reply other threads:[~2019-08-06 22:21 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-03 13:39 [RFAv2 0/2] Make first and last lines of 'command help documentation' consistent + add a test Philippe Waroquiers
2019-08-03 13:39 ` [RFAv2 1/2] Make first and last lines of 'command help documentation' consistent Philippe Waroquiers
2019-08-06 18:30 ` Tom Tromey
2019-08-03 13:39 ` [RFAv2 2/2] Add a selftest that checks documentation invariants Philippe Waroquiers
2019-08-06 18:43 ` Tom Tromey
2019-08-06 22:21 ` Philippe Waroquiers [this message]
2019-08-07 2:06 ` Tom Tromey
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1565130113.1435.10.camel@skynet.be \
--to=philippe.waroquiers@skynet.be \
--cc=gdb-patches@sourceware.org \
--cc=tom@tromey.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox