[cfe-commits] r39240 - in /cfe/cfe/trunk: AST/SemaType.cpp Sema/SemaType.cpp
sabre at cs.uiuc.edu
sabre at cs.uiuc.edu
Wed Jul 11 09:41:45 PDT 2007
Author: sabre
Date: Wed Jul 11 11:41:45 2007
New Revision: 39240
URL: http://llvm.org/viewvc/llvm-project?rev=39240&view=rev
Log:
Enforce C99 6.7.5.3p3, rejecting code like:
void foo(void (*q)(a,b,c)) {}
Modified:
cfe/cfe/trunk/AST/SemaType.cpp
cfe/cfe/trunk/Sema/SemaType.cpp
Modified: cfe/cfe/trunk/AST/SemaType.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/AST/SemaType.cpp?rev=39240&r1=39239&r2=39240&view=diff
==============================================================================
--- cfe/cfe/trunk/AST/SemaType.cpp (original)
+++ cfe/cfe/trunk/AST/SemaType.cpp Wed Jul 11 11:41:45 2007
@@ -133,6 +133,11 @@
if (!FTI.hasPrototype) {
// Simple void foo(), where the incoming T is the result type.
T = Context.getFunctionTypeNoProto(T);
+
+ // C99 6.7.5.3p3: Reject int(x,y,z) when it's not a function definition.
+ if (FTI.NumArgs != 0)
+ Diag(FTI.ArgInfo[0].IdentLoc, diag::err_ident_list_in_fn_declaration);
+
} else {
// Otherwise, we have a function with an argument list that is
// potentially variadic.
Modified: cfe/cfe/trunk/Sema/SemaType.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/Sema/SemaType.cpp?rev=39240&r1=39239&r2=39240&view=diff
==============================================================================
--- cfe/cfe/trunk/Sema/SemaType.cpp (original)
+++ cfe/cfe/trunk/Sema/SemaType.cpp Wed Jul 11 11:41:45 2007
@@ -133,6 +133,11 @@
if (!FTI.hasPrototype) {
// Simple void foo(), where the incoming T is the result type.
T = Context.getFunctionTypeNoProto(T);
+
+ // C99 6.7.5.3p3: Reject int(x,y,z) when it's not a function definition.
+ if (FTI.NumArgs != 0)
+ Diag(FTI.ArgInfo[0].IdentLoc, diag::err_ident_list_in_fn_declaration);
+
} else {
// Otherwise, we have a function with an argument list that is
// potentially variadic.
More information about the cfe-commits
mailing list