From: Pedro Alves <palves@redhat.com>
To: Tom Tromey <tom@tromey.com>, gdb-patches@sourceware.org
Subject: Re: [RFA] Add support for __VA_OPT__
Date: Wed, 20 Sep 2017 16:43:00 -0000 [thread overview]
Message-ID: <31c997d6-8866-2080-5fd2-ebed0871c98f@redhat.com> (raw)
In-Reply-To: <20170918024223.5607-1-tom@tromey.com>
W00t, thanks for doing this (and the gcc side as well!)
On 09/18/2017 03:42 AM, Tom Tromey wrote:
> diff --git a/gdb/testsuite/gdb.base/macscp.exp b/gdb/testsuite/gdb.base/macscp.exp
> index 54b5ab2..a08ec46 100644
> --- a/gdb/testsuite/gdb.base/macscp.exp
> +++ b/gdb/testsuite/gdb.base/macscp.exp
> @@ -620,6 +620,10 @@ gdb_test_no_output "macro define va_gnu(args...) varfunc (fixedarg, args)" \
> gdb_test_no_output "macro define va2_gnu(args...) varfunc (fixedarg, ## args)" \
> "define fourth varargs helper"
>
> +gdb_test_no_output \
> + "macro define va3_cxx2a(x, ...) varfunc (x __VA_OPT__(,) __VA_ARGS__)" \
> + "define fifth varargs helper"
> +
> gdb_test "macro expand va_c99(one, two, three)" \
> "expands to: *varfunc \\(fixedarg, *one, two, three\\)" \
> "c99 varargs expansion"
> @@ -644,6 +648,14 @@ gdb_test "macro expand va2_gnu()" \
> "expands to: *varfunc \\(fixedarg\\)" \
> "gnu varargs expansion special splicing without an argument"
>
> +gdb_test "macro expand va3_cxx2a(23)" \
> + "expands to: *varfunc \\(23 \\)" \
> + "C++2a __VA_OPT__ handling without variable argument"
> +
> +gdb_test "macro expand va3_cxx2a(23, 24, 25)" \
> + "expands to: *varfunc \\(23, 24, 25\\)" \
> + "C++2a __VA_OPT__ handling with variable argument"
> +
The patch looks good to me, though I think it'd be nice to see
tests that make sure that ill-formed input doesn't send us
to the weeds. Like:
- does the state machine handle "__VA_OPT__)" gracefully?
I.e., ')' before '('.
- similarly: "__VA_OPT__)(,)"
- does the state machine handle multiple occurrences of
__VA_OPT__ in the same macro expansion? It looks like
it, but....
Also, does this handle:
__VA_OPT__(__VA_ARGS__)
correctly? I think so, but...
Thanks,
Pedro Alves
next prev parent reply other threads:[~2017-09-20 16:43 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-18 2:42 Tom Tromey
2017-09-20 16:43 ` Pedro Alves [this message]
2017-09-21 3:42 ` Tom Tromey
2017-09-21 9:01 ` Pedro Alves
2017-09-23 3:03 ` Tom Tromey
2017-09-27 11:32 ` Pedro Alves
2017-09-27 14:19 ` 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=31c997d6-8866-2080-5fd2-ebed0871c98f@redhat.com \
--to=palves@redhat.com \
--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