[LLVMbugs] [Bug 12845] New: Incorrect expansion of a macro defining a function with variable arguments
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Wed May 16 03:40:42 PDT 2012
http://llvm.org/bugs/show_bug.cgi?id=12845
Bug #: 12845
Summary: Incorrect expansion of a macro defining a function
with variable arguments
Product: clang
Version: trunk
Platform: PC
OS/Version: Windows NT
Status: NEW
Severity: enhancement
Priority: P
Component: C++
AssignedTo: unassignedclangbugs at nondot.org
ReportedBy: eremeev at viva64.com
CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
Classification: Unclassified
When passing a single argument to a macro which defines a function with a
variable arguments list as its' second argument, Clang will incorrectly
preprocess such code, leaving the unnecessary comma after the first argument,
thus making the resulting code uncompilable. Consider the example:
bool MsgAlert(bool yes_no, int Style, const char* format, ...)
{return true;}
#define PanicAlert(format, ...) MsgAlert(false, 1, format, __VA_ARGS__)
void func()
{PanicAlert("text");}
Clang preprocessor (the -E flag, in MS compatibility mode) will generate the
following (note the excessive comma after "text"):
void func()
{MsgAlert(false, 1, "text", );}
In comparison, the MSVC preprocessor (cl.exe) will generate the correct code:
void func()
{MsgAlert(false, 1, "text" );}
--
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
More information about the llvm-bugs
mailing list