]> granicus.if.org Git - clang/commitdiff
Allow 'static' and type qualifiers in K&R parameter type lists.
authorMatt Beaumont-Gay <matthewbg@google.com>
Wed, 15 Aug 2012 19:53:19 +0000 (19:53 +0000)
committerMatt Beaumont-Gay <matthewbg@google.com>
Wed, 15 Aug 2012 19:53:19 +0000 (19:53 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161980 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaType.cpp
test/Sema/static-array.c

index 7b7cc99dffb993e851db8c50099e60e5f5641d89..54f8dbaf01275c79a0f2fd013ae6a0bb56ea6520 100644 (file)
@@ -2263,7 +2263,8 @@ static TypeSourceInfo *GetFullTypeForDeclarator(TypeProcessingState &state,
       // 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.
index be8957c254f4563af4e648abacbe442b19aa4903..5ca693b2bf54ad38efc46a7d35342e9a25b30c81 100644 (file)
@@ -51,3 +51,7 @@ void n(int *(x)[static 10]); // no-warning
 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
+{}