From: Anders Carlsson Date: Wed, 5 Dec 2007 04:57:06 +0000 (+0000) Subject: Revert DidWarn change - It won't catch all cases anyway and GCC warns for every exces... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=677cda19bc3f390d802b945c3428fe22507af221;p=clang Revert DidWarn change - It won't catch all cases anyway and GCC warns for every excess element. Maybe later we can add back the limit and make it smarter. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44603 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/Sema/SemaDecl.cpp b/Sema/SemaDecl.cpp index f1eb753523..70c4772a23 100644 --- a/Sema/SemaDecl.cpp +++ b/Sema/SemaDecl.cpp @@ -470,7 +470,6 @@ void Sema::CheckConstantInitList(QualType DeclType, InitListExpr *IList, // The empty init list "{ }" is treated specially below. unsigned numInits = IList->getNumInits(); if (numInits) { - bool DidWarn = false; for (unsigned i = 0; i < numInits; i++) { Expr *expr = IList->getInit(i); @@ -483,12 +482,9 @@ void Sema::CheckConstantInitList(QualType DeclType, InitListExpr *IList, totalInits--; // decrement the total number of initializers. // Check if we have space for another initializer. - if (((nInitsAtLevel > maxElementsAtThisLevel) || (totalInits < 0)) && - !DidWarn) { + if (((nInitsAtLevel > maxElementsAtThisLevel) || (totalInits < 0))) Diag(expr->getLocStart(), diag::warn_excess_initializers, expr->getSourceRange()); - DidWarn = true; - } } } if (nInitsAtLevel < maxElementsAtThisLevel) // fill the remaining elements.