The preprocessor does not parse variadic macros correctly when they are used in source code generated by other macros. I think that directives within macros are non-standard, but some standard library functions are implemented as macros when using FORTIFY_SOURCE, which can cause problems in code that is otherwise valid.
For example, I am compiling code that uses macros to add extra code for handling formatted messages in some contexts, similar to the following example: #define printf(...) printf(stdout,__VA_ARGS__) #define PRINT_BEGIN(fmt) printf(fmt, #define PRINT_END ) PRINT_BEGIN("%d") 100 PRINT_END; The result is: tmp.c:9:1: error: unterminated argument list invoking macro "printf" Obviously, the code can be modified to use macros without splitting the printf() call into separate macro evaluations. However, given that the code is valid, it would be nice if system headers could use variadic macros without breaking valid code. For now, this may only happens when invoking non-standard features like FORTIFY_SOURCE, and not with standard system headers. If so, may really be a feature request, depending on whether those features are intended to be free of side effects. -- Summary: Variadic macros fail when generated by other macros. Product: gcc Version: 4.1.2 Status: UNCONFIRMED Severity: trivial Priority: P3 Component: preprocessor AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: jkrahn at nc dot rr dot com http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37373