From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 52316 invoked by alias); 20 Sep 2017 16:43:17 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 50815 invoked by uid 89); 20 Sep 2017 16:43:16 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=fifth, Hx-languages-length:1780 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 20 Sep 2017 16:43:14 +0000 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4326B267D4; Wed, 20 Sep 2017 16:43:13 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 4326B267D4 Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=palves@redhat.com Received: from [127.0.0.1] (ovpn04.gateway.prod.ext.ams2.redhat.com [10.39.146.4]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8E3E360241; Wed, 20 Sep 2017 16:43:12 +0000 (UTC) Subject: Re: [RFA] Add support for __VA_OPT__ To: Tom Tromey , gdb-patches@sourceware.org References: <20170918024223.5607-1-tom@tromey.com> From: Pedro Alves Message-ID: <31c997d6-8866-2080-5fd2-ebed0871c98f@redhat.com> Date: Wed, 20 Sep 2017 16:43:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <20170918024223.5607-1-tom@tromey.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-SW-Source: 2017-09/txt/msg00506.txt.bz2 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