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 f1eb753..70c4772 100644
--- a/Sema/SemaDecl.cpp
+++ b/Sema/SemaDecl.cpp
@@ -470,7 +470,6 @@
// 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 @@
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.