From 99570a58b09fca5d0b328733ab8b6717a1a04f4a Mon Sep 17 00:00:00 2001 From: Matt Beaumont-Gay Date: Wed, 15 Aug 2012 19:53:19 +0000 Subject: [PATCH] Allow 'static' and type qualifiers in K&R parameter type lists. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161980 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Sema/SemaType.cpp | 3 ++- test/Sema/static-array.c | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/Sema/SemaType.cpp b/lib/Sema/SemaType.cpp index 7b7cc99dff..54f8dbaf01 100644 --- a/lib/Sema/SemaType.cpp +++ b/lib/Sema/SemaType.cpp @@ -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. diff --git a/test/Sema/static-array.c b/test/Sema/static-array.c index be8957c254..5ca693b2bf 100644 --- a/test/Sema/static-array.c +++ b/test/Sema/static-array.c @@ -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 +{} -- 2.50.1