This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

preprocessor/5234: Variable arguments list in macro fail with another macro inclusion



>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:


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]