On Tue, Apr 28, 2015 at 12:22 PM, David Blaikie <[email protected]> wrote: > On Tue, Apr 28, 2015 at 5:36 AM, Aaron Ballman <[email protected]> wrote: >> Author: aaronballman >> Date: Tue Apr 28 07:36:54 2015 >> New Revision: 235981 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=235981&view=rev >> Log: >> Silencing a spurious -Wuninitialized warning with this local; NFC. > > Which compiler warned on this?
I believe it's gcc, but I do not have the version information handy. It's the bot responsible for building our attribute documentation, which I keep warning-free. (Tanya would probably be able to get that information for us if it was important.) > It looks like this initialization is not needed - the switch over > ImpCaptureStyle (speaking of which, the declaration of this variable > could be moved down to closer to this switch - it isn't used before > the switch) seems to initialize the variable on all paths that are > reachable. Correct, that's why I called it a spurious warning. ;-) > (the usual "excessive initialization hampers checkers like msan and > doesn't make the code better because the default value is never > intended to be used - so the program's already off the rails if it's > used") Also agreed. If you have a better idea of how to silence the warning so that build remains warning-free, I would welcome suggestions. ~Aaron > >> >> Modified: >> cfe/trunk/lib/Sema/SemaLambda.cpp >> >> Modified: cfe/trunk/lib/Sema/SemaLambda.cpp >> URL: >> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaLambda.cpp?rev=235981&r1=235980&r2=235981&view=diff >> ============================================================================== >> --- cfe/trunk/lib/Sema/SemaLambda.cpp (original) >> +++ cfe/trunk/lib/Sema/SemaLambda.cpp Tue Apr 28 07:36:54 2015 >> @@ -1482,7 +1482,7 @@ ExprResult Sema::BuildLambdaExpr(SourceL >> // Collect information from the lambda scope. >> SmallVector<LambdaCapture, 4> Captures; >> SmallVector<Expr *, 4> CaptureInits; >> - LambdaCaptureDefault CaptureDefault; >> + LambdaCaptureDefault CaptureDefault = LCD_None; >> SourceLocation CaptureDefaultLoc; >> CXXRecordDecl *Class; >> CXXMethodDecl *CallOperator; >> >> >> _______________________________________________ >> cfe-commits mailing list >> [email protected] >> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits _______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
