[Lldb-commits] [lldb] 92b475f - [lldb] silence -Wsometimes-uninitialized warnings

Michał Górny via lldb-commits lldb-commits at lists.llvm.org
Tue Sep 28 00:45:31 PDT 2021


On Tue, 2021-09-28 at 09:37 +0200, Krasimir Georgiev wrote:
> Thank you David. I just initialized these variables as suggested by
> the warnings, without considering this case.
> Michał, could you please double check this case?

Hmm, you're probably right.  The diagnostic should probably print
msbit_str and lsbit_str instead.  I'm sorry for missing that.

That said, I think the function really needs refactoring to avoid that
whole if/else hell.  I'll make a patch for that.

Still, thanks for fixing the immediate problem.

> On Mon, Sep 27, 2021 at 9:09 PM David Blaikie <dblaikie at gmail.com> wrote:
> 
> > Maybe this isn't the right fix - msbit and lsbit probably shouldn't be
> > printed if to_integer returns false in the diagnostic on line 195. If that
> > diagnostic didn't use the variables, then I don't think this'd warn?
> > 
> > On Mon, Sep 27, 2021 at 12:38 AM Krasimir Georgiev via lldb-commits <
> > lldb-commits at lists.llvm.org> wrote:
> > 
> > > 
> > > Author: Krasimir Georgiev
> > > Date: 2021-09-27T09:35:58+02:00
> > > New Revision: 92b475f0b079e125c588b121dc50116ea5d6d9f2
> > > 
> > > URL:
> > > https://github.com/llvm/llvm-project/commit/92b475f0b079e125c588b121dc50116ea5d6d9f2
> > > DIFF:
> > > https://github.com/llvm/llvm-project/commit/92b475f0b079e125c588b121dc50116ea5d6d9f2.diff
> > > 
> > > LOG: [lldb] silence -Wsometimes-uninitialized warnings
> > > 
> > > No functional changes intended.
> > > 
> > > Silence warnings from
> > > 
> > > https://github.com/llvm/llvm-project/commit/3a6ba3675177cb5e47dee325f300aced4cd864ed
> > > .
> > > 
> > > Added:
> > > 
> > > 
> > > Modified:
> > >     lldb/source/Plugins/Process/Utility/DynamicRegisterInfo.cpp
> > > 
> > > Removed:
> > > 
> > > 
> > > 
> > > 
> > > ################################################################################
> > > diff  --git a/lldb/source/Plugins/Process/Utility/DynamicRegisterInfo.cpp
> > > b/lldb/source/Plugins/Process/Utility/DynamicRegisterInfo.cpp
> > > index a3a9d963c2213..f6a2cdf309815 100644
> > > --- a/lldb/source/Plugins/Process/Utility/DynamicRegisterInfo.cpp
> > > +++ b/lldb/source/Plugins/Process/Utility/DynamicRegisterInfo.cpp
> > > @@ -141,8 +141,8 @@ DynamicRegisterInfo::SetRegisterInfo(const
> > > StructuredData::Dictionary &dict,
> > >            std::string reg_name_str = matches[1].str();
> > >            std::string msbit_str = matches[2].str();
> > >            std::string lsbit_str = matches[3].str();
> > > -          uint32_t msbit;
> > > -          uint32_t lsbit;
> > > +          uint32_t msbit = 0;
> > > +          uint32_t lsbit = 0;
> > >            if (llvm::to_integer(msbit_str, msbit) &&
> > >                llvm::to_integer(lsbit_str, lsbit)) {
> > >              if (msbit > lsbit) {
> > > 
> > > 
> > > 
> > > _______________________________________________
> > > lldb-commits mailing list
> > > lldb-commits at lists.llvm.org
> > > https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
> > > 
> > 

-- 
Best regards,
Michał Górny




More information about the lldb-commits mailing list