This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFA] Add support for __VA_OPT__
- From: Pedro Alves <palves at redhat dot com>
- To: Tom Tromey <tom at tromey dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Thu, 21 Sep 2017 10:01:16 +0100
- Subject: Re: [RFA] Add support for __VA_OPT__
- Authentication-results: sourceware.org; auth=none
- Authentication-results: ext-mx05.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com
- Authentication-results: ext-mx05.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=palves at redhat dot com
- Dmarc-filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 70B2F1297
- References: <20170918024223.5607-1-tom@tromey.com> <31c997d6-8866-2080-5fd2-ebed0871c98f@redhat.com> <874lrwsonf.fsf@tromey.com>
On 09/21/2017 04:42 AM, Tom Tromey wrote:
> Pedro> The patch looks good to me, though I think it'd be nice to see
> Pedro> tests that make sure that ill-formed input doesn't send us
> Pedro> to the weeds. Like:
> Pedro> - does the state machine handle "__VA_OPT__)" gracefully?
> Pedro> I.e., ')' before '('.
> Pedro> - similarly: "__VA_OPT__)(,)"
> Pedro> - does the state machine handle multiple occurrences of
> Pedro> __VA_OPT__ in the same macro expansion? It looks like
> Pedro> it, but....
> Pedro> Also, does this handle:
> Pedro> __VA_OPT__(__VA_ARGS__)
> Pedro> correctly? I think so, but...
>
> I've added all of these.
Great, thanks!
>
> But I wonder if gdb should just error() on the invalid ones.
> My first thought was no, why make life harder -- but at the same time,
> the invalid cases really aren't that useful either.
Yeah, error might be better - e.g., for someone trying
to write a "macro define" interactively (without
going via the compiler first), and puzzling about why it
doesn't exactly work [due to some typo]. But we can
decide to do that incrementally. Fine with me to push
as is if you'd like.
Thanks,
Pedro Alves