[cfe-commits] r38697 - in /cfe/cfe/trunk: Lex/Preprocessor.cpp include/clang/Basic/DiagnosticKinds.def
sabre at cs.uiuc.edu
sabre at cs.uiuc.edu
Wed Jul 11 09:23:54 PDT 2007
Author: sabre
Date: Wed Jul 11 11:23:54 2007
New Revision: 38697
URL: http://llvm.org/viewvc/llvm-project?rev=38697&view=rev
Log:
ext-warn on empty macro arguments if in pre-c99 mode
Modified:
cfe/cfe/trunk/Lex/Preprocessor.cpp
cfe/cfe/trunk/include/clang/Basic/DiagnosticKinds.def
Modified: cfe/cfe/trunk/Lex/Preprocessor.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/Lex/Preprocessor.cpp?rev=38697&r1=38696&r2=38697&view=diff
==============================================================================
--- cfe/cfe/trunk/Lex/Preprocessor.cpp (original)
+++ cfe/cfe/trunk/Lex/Preprocessor.cpp Wed Jul 11 11:23:54 2007
@@ -727,7 +727,10 @@
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 @@
// 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);
Modified: cfe/cfe/trunk/include/clang/Basic/DiagnosticKinds.def
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/include/clang/Basic/DiagnosticKinds.def?rev=38697&r1=38696&r2=38697&view=diff
==============================================================================
--- cfe/cfe/trunk/include/clang/Basic/DiagnosticKinds.def (original)
+++ cfe/cfe/trunk/include/clang/Basic/DiagnosticKinds.def Wed Jul 11 11:23:54 2007
@@ -127,6 +127,8 @@
"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")
More information about the cfe-commits
mailing list