[cfe-commits] r164033 - /cfe/trunk/lib/Sema/SemaDeclCXX.cpp

Axel Naumann Axel.Naumann at cern.ch
Mon Sep 17 23:47:27 PDT 2012


Hi Richard,

On 09/17/2012 10:22 PM, Richard Smith wrote:
> On Mon, Sep 17, 2012 at 7:26 AM, Axel Naumann <Axel.Naumann at cern.ch
> <mailto:Axel.Naumann at cern.ch>> wrote:
> 
>     Author: axel
>     Date: Mon Sep 17 09:26:53 2012
>     New Revision: 164033
> 
>     URL: http://llvm.org/viewvc/llvm-project?rev=164033&view=rev
>     Log:
>     Don't write uninitialized values even if nobody ever asks for it.
> 
> 
> It's not clear to me what the purpose of this change was: the variable
> is initialized by every case in the following switch, except the one
> with an llvm_unreachable. With this change, we'll not get a warning if
> one of the switch cases misses the initialization of the variable.

You're right. I fixed it because GCC 4.6.3 has issued a warning - but
that's a false positive. What do you prefer: silence GCC or get a proper
warning if needed?

Cheers, Axel.


>  
> 
>     Modified:
>         cfe/trunk/lib/Sema/SemaDeclCXX.cpp
> 
>     Modified: cfe/trunk/lib/Sema/SemaDeclCXX.cpp
>     URL:
>     http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclCXX.cpp?rev=164033&r1=164032&r2=164033&view=diff
>     ==============================================================================
>     --- cfe/trunk/lib/Sema/SemaDeclCXX.cpp (original)
>     +++ cfe/trunk/lib/Sema/SemaDeclCXX.cpp Mon Sep 17 09:26:53 2012
>     @@ -4086,7 +4086,7 @@
> 
>        // Compute argument constness, constexpr, and triviality.
>        bool CanHaveConstParam = false;
>     -  bool Trivial;
>     +  bool Trivial = false;
>        switch (CSM) {
>        case CXXDefaultConstructor:
>          Trivial = RD->hasTrivialDefaultConstructor();
> 
> 
>     _______________________________________________
>     cfe-commits mailing list
>     cfe-commits at cs.uiuc.edu <mailto:cfe-commits at cs.uiuc.edu>
>     http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
> 
> 




More information about the cfe-commits mailing list