From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19327 invoked by alias); 20 Feb 2003 00:06:01 -0000 Mailing-List: contact gcc-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-prs-owner@gcc.gnu.org Received: (qmail 19312 invoked by uid 71); 20 Feb 2003 00:06:01 -0000 Date: Thu, 20 Feb 2003 00:06:00 -0000 Message-ID: <20030220000601.19311.qmail@sources.redhat.com> To: nobody@gcc.gnu.org Cc: gcc-prs@gcc.gnu.org, From: Ryan Mallon Subject: Re: preprocessor/9764: Varargs macro extension incorrectly expands if the varargs argument is the macro itself Reply-To: Ryan Mallon X-SW-Source: 2003-02/txt/msg00964.txt.bz2 List-Id: The following reply was made to PR preprocessor/9764; it has been noted by GNATS. From: Ryan Mallon To: neil@gcc.gnu.org, gcc-bugs@gcc.gnu.org, gcc-prs@gcc.gnu.org, nobody@gcc.gnu.org, gcc-gnats@gcc.gnu.org Cc: Subject: Re: preprocessor/9764: Varargs macro extension incorrectly expands if the varargs argument is the macro itself Date: Thu, 20 Feb 2003 13:04:50 +1300 neil@gcc.gnu.org wrote: >Synopsis: Varargs macro extension incorrectly expands if the varargs argument is the macro itself > >State-Changed-From-To: open->closed >State-Changed-By: neil >State-Changed-When: Wed Feb 19 23:48:50 2003 >State-Changed-Why: > 3.1 and later give the following, which is correct. I've not checked 3.0, but I expect it's similar. > > $ cat /tmp/bar.c > #define func(a, varargs...) _func(a, ##b) > Opps, I dont know how I missed that. The above line is incorrect, it should read: #define func(a, varargs...) _func(a, ##varargs) Which is valid and allows the following uses: func(a); func(a, b); func(a, b, c); Which preprocess correctly to: _func(a); _func(a, b); _func(a, b, c); The problems occurs when the macro name itself is used in the varargs part: e.g func(a, func(b, c)); Incorrectly expands to: _func(a, func(b, c)); Without the token paste opperator in the defintion it works as expected, but then I cannot have varargs=0. Im working with a large amount of existing code, so I cannot alter the actual calls on the macro definition. Sorry for the inconvience, Ryan Mallon