This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
preprocessor/5234: Variable arguments list in macro fail with another macro inclusion
- From: david dot taillandier at domainename dot com
- To: gcc-gnats at gcc dot gnu dot org
- Date: 1 Jan 2002 18:36:32 -0000
- Subject: preprocessor/5234: Variable arguments list in macro fail with another macro inclusion
- Reply-to: david dot taillandier at domainename dot com
>Number: 5234
>Category: preprocessor
>Synopsis: Variable arguments list in macro fail with another macro inclusion
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: unassigned
>State: open
>Class: rejects-legal
>Submitter-Id: net
>Arrival-Date: Tue Jan 01 10:46:01 PST 2002
>Closed-Date:
>Last-Modified:
>Originator: David TAILLANDIER
>Release: gcc version 2.95.3 20010315/djgpp (release)
>Organization:
>Environment:
Win95 / MS-DOS 6 / Win98
>Description:
In one case, clearly identified, when using variable
arguments list macro with another macro inside the first
one, the preprocessing process (duh) gives an error.
See sample, it's very simple.
Hope I don't miss something.
david.taillandier@domainename.com
>How-To-Repeat:
#include <stdio.h>
#define _(text_to_translate) text_to_translate
#define PROBLEM_HERE( text, vargs... ) printf( text _("ending string\n"), ## vargs )
#define NO_PROBLEM_HERE( text, vargs... ) printf( text _("ending string\n") , ## vargs )
#define NOR_HERE( text, vargs... ) printf( text, ## vargs )
/* the only difference is the space before the comma witch is not present in PROBLEM_HERE */
int
main( void )
{
PROBLEM_HERE( "123" );
NO_PROBLEM_HERE( "456" );
NOR_HERE( "789" );
return 0;
}
>Fix:
I don't know how to fix this, sorry.
But a workaround is to add a space before the comma
preceding the ##
>Release-Note:
>Audit-Trail:
>Unformatted: