[cfe-commits] r44603 - /cfe/trunk/Sema/SemaDecl.cpp

Anders Carlsson andersca at mac.com
Tue Dec 4 20:57:07 PST 2007


Author: andersca
Date: Tue Dec  4 22:57:06 2007
New Revision: 44603

URL: http://llvm.org/viewvc/llvm-project?rev=44603&view=rev
Log:
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.

Modified:
    cfe/trunk/Sema/SemaDecl.cpp

Modified: cfe/trunk/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Sema/SemaDecl.cpp?rev=44603&r1=44602&r2=44603&view=diff

==============================================================================
--- cfe/trunk/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/Sema/SemaDecl.cpp Tue Dec  4 22:57:06 2007
@@ -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.





More information about the cfe-commits mailing list