Clean up the C89/C++ warnings about C99 array features to not
emit duplicate diags (some in parser and some in sema) and to
warn about use of typequals in array sizes. This implements
PR2759.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61197 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaType.cpp b/lib/Sema/SemaType.cpp
index 3f911f5..a6441c8 100644
--- a/lib/Sema/SemaType.cpp
+++ b/lib/Sema/SemaType.cpp
@@ -416,11 +416,13 @@
T = Context.getConstantArrayType(T, ConstVal, ASM, ATI.TypeQuals);
}
// If this is not C99, extwarn about VLA's and C99 array size modifiers.
- if (!getLangOptions().C99 &&
- (ASM != ArrayType::Normal ||
- (ArraySize && !ArraySize->isValueDependent() &&
- !ArraySize->isIntegerConstantExpr(Context))))
- Diag(D.getIdentifierLoc(), diag::ext_vla);
+ if (!getLangOptions().C99) {
+ if (ArraySize && !ArraySize->isValueDependent() &&
+ !ArraySize->isIntegerConstantExpr(Context))
+ Diag(D.getIdentifierLoc(), diag::ext_vla);
+ else if (ASM != ArrayType::Normal || ATI.TypeQuals != 0)
+ Diag(D.getIdentifierLoc(), diag::ext_c99_array_usage);
+ }
break;
}
case DeclaratorChunk::Function: