Skip to content

Commit

Permalink
Silence some wrong compiler warnings
Browse files Browse the repository at this point in the history
For every available module call implementation, we got this:

Modules.cpp: In member function ‘bool CModules::OnGetAvailableMods(std::__debug::set<CModInfo>&, CModInfo::EModuleType)’:
Modules.cpp:149:72: error: ‘pNetwork’ may be used uninitialized in this function [-Werror=uninitialized]
Modules.cpp:808:260: note: ‘pNetwork’ was declared here
Modules.cpp:148:54: error: ‘pOldUser’ may be used uninitialized in this function [-Werror=uninitialized]
Modules.cpp:808:168: note: ‘pOldUser’ was declared here

I guess GCC saw that m_pNetwork and m_pUser could be changed by the module call
to a non-NULL value which means we would really use an uninitialized value...

Signed-off-by: Uli Schlachter <psychon@znc.in>
  • Loading branch information
psychon committed Aug 29, 2011
1 parent dc33283 commit 6016929
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Modules.cpp
Expand Up @@ -26,12 +26,12 @@
CModule* pMod = (CModule *) (*this)[a]; \
CClient* pOldClient = pMod->GetClient(); \
pMod->SetClient(m_pClient); \
CUser* pOldUser; \
CUser* pOldUser = NULL; \
if (m_pUser) { \
pOldUser = pMod->GetUser(); \
pMod->SetUser(m_pUser); \
} \
CIRCNetwork* pNetwork; \
CIRCNetwork* pNetwork = NULL; \
if (m_pNetwork) { \
pNetwork = pMod->GetNetwork(); \
pMod->SetNetwork(m_pNetwork); \
Expand All @@ -58,12 +58,12 @@
CModule::EModRet e = CModule::CONTINUE; \
CClient* pOldClient = pMod->GetClient(); \
pMod->SetClient(m_pClient); \
CUser* pOldUser; \
CUser* pOldUser = NULL; \
if (m_pUser) { \
pOldUser = pMod->GetUser(); \
pMod->SetUser(m_pUser); \
} \
CIRCNetwork* pNetwork; \
CIRCNetwork* pNetwork = NULL; \
if (m_pNetwork) { \
pNetwork = pMod->GetNetwork(); \
pMod->SetNetwork(m_pNetwork); \
Expand Down

0 comments on commit 6016929

Please sign in to comment.