-
Notifications
You must be signed in to change notification settings - Fork 13.5k
Missing __VA_ARGS__ extension in Microsoft mode #13217
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
gcc has a very similar extension... but not quite the same. :( |
Note that MS will allow empty argument list and remove the trailing comma even when compiling with /Za (disable language extensions). |
Also, the trailing comma is removed, even if the VA_ARGS is followed by the pasting operator:
|
Patch: avakar/clang@bug_12845 |
Can you send your patch to cfe-commits? |
Sure, I'll write tests for it and send it. |
This seems to be working now. |
mentioned in issue llvm/llvm-bugzilla-archive#13707 |
Extended Description
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" );}
The text was updated successfully, but these errors were encountered: