forked from OSchip/llvm-project
ext-warn on empty macro arguments if in pre-c99 mode
llvm-svn: 38697
This commit is contained in:
parent
370c135dce
commit
a12dd15b56
|
@ -727,7 +727,10 @@ ReadFunctionLikeMacroFormalArgs(LexerToken &MacroName, MacroInfo *MI) {
|
|||
ArgTokens.push_back(Tok);
|
||||
}
|
||||
|
||||
// FIXME: If not in C99 mode, empty arguments should be ext-warned about!
|
||||
// Empty arguments are standard in C99 and supported as an extension in
|
||||
// other modes.
|
||||
if (ArgTokens.empty() && !Features.C99)
|
||||
Diag(Tok, diag::ext_empty_fnmacro_arg);
|
||||
|
||||
// Remember the tokens that make up this argument. This destroys ArgTokens.
|
||||
Args->addArgument(ArgTokens);
|
||||
|
@ -757,7 +760,11 @@ ReadFunctionLikeMacroFormalArgs(LexerToken &MacroName, MacroInfo *MI) {
|
|||
// is ok because it is an empty argument. Add it explicitly.
|
||||
std::vector<LexerToken> ArgTokens;
|
||||
Args->addArgument(ArgTokens);
|
||||
// FIXME: Ext-Warn in C90 mode.
|
||||
|
||||
// Empty arguments are standard in C99 and supported as an extension in
|
||||
// other modes.
|
||||
if (ArgTokens.empty() && !Features.C99)
|
||||
Diag(Tok, diag::ext_empty_fnmacro_arg);
|
||||
} else {
|
||||
// Otherwise, emit the error.
|
||||
Diag(Tok, diag::err_too_few_formals_in_macro_invoc);
|
||||
|
|
|
@ -127,6 +127,8 @@ DIAG(ext_embedded_directive, EXTENSION,
|
|||
"embedding a directive within macro arguments is not portable")
|
||||
DIAG(ext_missing_varargs_arg, EXTENSION,
|
||||
"varargs argument missing, but tolerated as an extension")
|
||||
DIAG(ext_empty_fnmacro_arg, EXTENSION,
|
||||
"empty macro arguments were standardized in C99")
|
||||
|
||||
DIAG(ext_pp_base_file, EXTENSION,
|
||||
"__BASE_FILE__ is a language extension")
|
||||
|
|
Loading…
Reference in New Issue