[RFA] Add support for __VA_OPT__
Pedro Alves
palves@redhat.com
Thu Sep 21 09:01:00 GMT 2017
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
More information about the Gdb-patches
mailing list