diff options
author | Chris Lattner <sabre@nondot.org> | 2008-12-18 06:50:14 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2008-12-18 06:50:14 +0000 |
commit | a1fcbadf4f930c22bb171fb90ed886f5f359d010 (patch) | |
tree | b7ad43c1e4e61b571d5c7f4f83d4011e010ef3d0 /lib/Sema/SemaType.cpp | |
parent | 62b585701d626dec90b0aa0dfd8c2b75ffe29265 (diff) |
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
Diffstat (limited to 'lib/Sema/SemaType.cpp')
-rw-r--r-- | lib/Sema/SemaType.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/lib/Sema/SemaType.cpp b/lib/Sema/SemaType.cpp index 3f911f5b0c..a6441c8d70 100644 --- a/lib/Sema/SemaType.cpp +++ b/lib/Sema/SemaType.cpp @@ -416,11 +416,13 @@ QualType Sema::GetTypeForDeclarator(Declarator &D, Scope *S, unsigned Skip) { 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: |