Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 344517

Summary: C Syntax parser does not understand expansion of variadic macros
Product: [Tools] CDT Reporter: Pavel.A <pavel.aronsky+ecl>
Component: cdt-parserAssignee: Project Inbox <cdt-parser-inbox>
Status: RESOLVED INVALID QA Contact: Markus Schorn <mschorn.eclipse>
Severity: enhancement    
Priority: P3 CC: cdtdoug
Version: 8.0   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Whiteboard:

Description Pavel.A CLA 2011-05-02 21:02:36 EDT
Parser does not understand and marks as syntax error expansion of macros like this:

#define dprintf(fmt, ...) printf(fmt, ## __VA_ARGS__)

dprintf( "foo %d\n", 123);  <<< marked as error
 
( Compiles OK with any decent gcc )


-- Configuration Details --
Product: Eclipse 1.4.0.20110319-2300 (org.eclipse.epp.package.cpp.product)
Installed Features:
 org.eclipse.cvs 1.3.100.v20110207-7B78FGB8sF7BB7I8H58WG5
Comment 1 Markus Schorn CLA 2011-05-03 13:01:21 EDT
I cannot reproduce the problem, the parser does understand these kind of macro expansions. If used outside of a function body the line is certainly a syntax error.

If you still think you have found a bug in CDT, then please provide 
* a code snippet that actually compiles 
* a description on how this is marked as an error (e.g. what does the hover   
  show when you move the mouse pointer over the error marker).
and reopen the bug.