[cfe-commits] r161980 - in /cfe/trunk: lib/Sema/SemaType.cpp test/Sema/static-array.c
Matt Beaumont-Gay
matthewbg at google.com
Wed Aug 15 12:53:20 PDT 2012
Author: matthewbg
Date: Wed Aug 15 14:53:19 2012
New Revision: 161980
URL: http://llvm.org/viewvc/llvm-project?rev=161980&view=rev
Log:
Allow 'static' and type qualifiers in K&R parameter type lists.
Modified:
cfe/trunk/lib/Sema/SemaType.cpp
cfe/trunk/test/Sema/static-array.c
Modified: cfe/trunk/lib/Sema/SemaType.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaType.cpp?rev=161980&r1=161979&r2=161980&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaType.cpp (original)
+++ cfe/trunk/lib/Sema/SemaType.cpp Wed Aug 15 14:53:19 2012
@@ -2263,7 +2263,8 @@
// shall appear only in a declaration of a function parameter with an
// array type, ...
if (ASM == ArrayType::Static || ATI.TypeQuals) {
- if (!D.isPrototypeContext()) {
+ if (!(D.isPrototypeContext() ||
+ D.getContext() == Declarator::KNRTypeListContext)) {
S.Diag(DeclType.Loc, diag::err_array_static_outside_prototype) <<
(ASM == ArrayType::Static ? "'static'" : "type qualifier");
// Remove the 'static' and the type qualifiers.
Modified: cfe/trunk/test/Sema/static-array.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/static-array.c?rev=161980&r1=161979&r2=161980&view=diff
==============================================================================
--- cfe/trunk/test/Sema/static-array.c (original)
+++ cfe/trunk/test/Sema/static-array.c Wed Aug 15 14:53:19 2012
@@ -51,3 +51,7 @@
void o(int (x[static 10])(void)); // expected-error{{'x' declared as array of functions of type 'int (void)'}}
void p(int (^x)[static 10]); // expected-error{{block pointer to non-function type is invalid}}
void q(int (^x[static 10])()); // no-warning
+
+void r(x)
+ int x[restrict]; // no-warning
+{}
More information about the cfe-commits
mailing list