Skip to content

Commit

Permalink
Fix several warnings (#3438)
Browse files Browse the repository at this point in the history
* [cleanup] Fix warnings about unreachable code

* [cleanup] Remove warning "'clFileName::GetRemotePath': recursive on all control paths, function will cause runtime stack overflow" by removing unused methods.

* [cleanup] Fix warnings:
- unused variables
- possibly uninitialized variables

* [cleanup] Fix warnings:
- unused variable
- declaration of 'v' hides previous declaration

* [cleanup] Fix warning: "declaration of 'i' hides previous declaration"

* [cleanup] Fix warning: "type name first seen using 'class' now seen using 'struct'"

* [cleanup] Fix warning: "'where': local variable is initialized but not referenced"

* [cleanup] Fix warning: "type name first seen using 'class' now seen using 'struct'"
  • Loading branch information
Jarod42 authored Aug 2, 2024
1 parent eb4a462 commit 1e601a5
Show file tree
Hide file tree
Showing 18 changed files with 25 additions and 35 deletions.
3 changes: 2 additions & 1 deletion CMakePlugin/CMakeProjectSettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,9 @@
*
* @note Only "Unix Makefiles" generator is supported now.
*/
struct CMakeProjectSettings
class CMakeProjectSettings
{
public:
/// If CMake build is enabled.
bool enabled;

Expand Down
4 changes: 2 additions & 2 deletions CallGraph/callgraph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -290,11 +290,11 @@ wxString CallGraph::GetGprofPath()
return wxEmptyString;
#else
gprofPath = LocateApp(GPROF_FILENAME_EXE);
#endif

confData.SetGprofPath(gprofPath);
m_mgr->GetConfigTool()->WriteObject(wxT("CallGraph"), &confData);
return gprofPath;
#endif
}

//---- Get Dot Path -----------------------------------------------------------
Expand All @@ -313,13 +313,13 @@ wxString CallGraph::GetDotPath()
return wxEmptyString;
#else
dotPath = LocateApp(DOT_FILENAME_EXE);
#endif

confData.SetDotPath(dotPath);

m_mgr->GetConfigTool()->WriteObject(wxT("CallGraph"), &confData);

return dotPath;
#endif
}

//---- Show CallGraph event ---------------------------------------------------
Expand Down
1 change: 0 additions & 1 deletion CodeLite/PHP/PHPLookupTable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1203,7 +1203,6 @@ bool PHPLookupTable::CheckDiskImage(wxSQLite3Database& db, const wxFileName& fil
clWARNING() << "PHP: database image is corrupted:" << filename.GetFullPath() << clEndl;
return false;
}
return true;
}

void PHPLookupTable::EnsureIntegrity(const wxFileName& filename)
Expand Down
3 changes: 2 additions & 1 deletion CodeLite/SocketAPI/clConnectionString.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@ void clConnectionString::DoParse(const wxString& connectionString)
#ifdef __WXMSW__
clWARNING() << "unix protocol is not suppported on Windows" << clEndl;
return;
#endif
#else
m_protocol = kUnixLocalSocket;
#endif
} else {
clWARNING() << "Invalid protocol in connection string:" << connectionString << clEndl;
return;
Expand Down
1 change: 0 additions & 1 deletion CodeLite/SocketAPI/clSocketClientAsync.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ void* clSocketAsyncThread::Entry()
} else {
return ServerMain();
}
return nullptr;
}

void* clSocketAsyncThread::ServerMain()
Expand Down
6 changes: 0 additions & 6 deletions CodeLite/clFileName.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,3 @@ const wxString& clFileName::GetRemoteFullPath() const
}
return m_remotePath;
}

wxString clFileName::GetRemotePath() const { return wxFileName(GetRemotePath(), wxPATH_UNIX).GetPath(wxPATH_UNIX); }

wxString clFileName::GetRemoteFullName() const { return wxFileName(GetRemotePath(), wxPATH_UNIX).GetFullName(); }

wxString clFileName::GetRemoteName() const { return wxFileName(GetRemotePath(), wxPATH_UNIX).GetName(); }
3 changes: 0 additions & 3 deletions CodeLite/clFileName.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,6 @@ class WXDLLIMPEXP_CL clFileName : public wxFileName

inline bool IsRemote() const { return m_isRemote; }
const wxString& GetRemoteFullPath() const;
wxString GetRemoteFullName() const;
wxString GetRemoteName() const;
wxString GetRemotePath() const;
};

#endif // CLFILENAME_HPP
1 change: 0 additions & 1 deletion CodeLite/database/tags_storage_sqlite3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1869,7 +1869,6 @@ bool TagsStorageSQLite::CheckIntegrity() const
// this can only happen if we have a corrupt disk image
return false;
}
return true;
}

void TagsStorageSQLite::GetTagsByPathAndKind(const wxString& path, std::vector<TagEntryPtr>& tags,
Expand Down
1 change: 0 additions & 1 deletion DebugAdapterClient/DAPMainView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,6 @@ void DAPMainView::OnScopeItemExpanding(wxTreeEvent& event)
wxTreeItemId item = event.GetItem();
CHECK_ITEM_RET(item);

wxTreeItemIdValue cookie;
m_variablesTree->Begin();
if(m_variablesTree->ItemHasChildren(item)) {
m_variablesTree->DeleteChildren(item);
Expand Down
4 changes: 2 additions & 2 deletions DebugAdapterClient/DebugAdapterClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -986,9 +986,9 @@ void DebugAdapterClient::OnDapInitializeResponse(DAPEvent& event)
LOG_DEBUG(LOG) << "working directory:" << m_session.working_directory << endl;

// FIXME: apply the environment here
auto v = m_session.command;
LOG_DEBUG(LOG) << "Calling Launch() with command:" << v << endl;
LOG_DEBUG(LOG) << "Calling Launch() with command:" << m_session.command << endl;
if (m_session.dap_server.GetLaunchType() == DapLaunchType::LAUNCH) {
auto v = m_session.command;
m_client.Launch(std::move(v), m_session.working_directory, m_session.MakeEnvironment());

} else {
Expand Down
1 change: 0 additions & 1 deletion ExternalTools/externaltools.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,6 @@ void ExternalToolsPlugin::DoRecreateToolbar()
}

// Add the tools
int where = XRCID("external_tools_monitor");
for(size_t i = 0; i < tools.size(); i++) {
const ToolInfo& ti = tools[i];

Expand Down
8 changes: 6 additions & 2 deletions MemCheck/memcheckerror.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,9 @@ class MemCheckErrorLocationReferrer: public wxClientData
* @class MemCheckErrorLocation
* @brief Represents on record from error stacktrace.
*/
struct MemCheckErrorLocation {
class MemCheckErrorLocation
{
public:
bool operator==(const MemCheckErrorLocation & other) const;
bool operator!=(const MemCheckErrorLocation & other) const;

Expand Down Expand Up @@ -140,7 +142,9 @@ struct MemCheckErrorLocation {
*
* Aditional records have also stacttrace, so they are implemented same as errors. Auxiliary record implemented as list of error. Some tool have more than one auxiliary section. Type is used to distinguish between them.
*/
struct MemCheckError {
class MemCheckError
{
public:
enum Type { TYPE_ERROR, TYPE_AUXILIARY };
MemCheckError();

Expand Down
3 changes: 2 additions & 1 deletion Plugin/clRegistery.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,9 @@ wxString clRegistery::ReadValueString(const wxString& valueName)
wxString value;
m_regKey->QueryValue(valueName, value);
return value;
#endif
#else
return wxEmptyString;
#endif
}

wxString clRegistery::GetFirstChild()
Expand Down
3 changes: 2 additions & 1 deletion Plugin/wxCustomStatusBar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ void wxCustomStatusBarFieldText::SetText(const wxString& text)
#if defined(__WXOSX__) || defined(__WXMSW__)
m_parent->Refresh();
return;
#endif
#else
// Make sure we draw only when the "art" objects are in sync with the field
// and with the bar itself
if((m_rect.GetHeight() > 0) && (m_rect.GetWidth() > 0)) {
Expand Down Expand Up @@ -141,6 +141,7 @@ void wxCustomStatusBarFieldText::SetText(const wxString& text)
m_parent->PrepareDC(cdc);
cdc.DrawBitmap(bmp, m_rect.GetTopLeft(), true);
}
#endif
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions TestDir/makedir.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ int main(int argc, char** argv)
argument.Replace(wxT("\\"), wxT("/"));
wxArrayString arr = wxStringTokenize(argument, wxT("/"), wxTOKEN_STRTOK);
wxString path;
for(size_t i = 0; i < arr.GetCount(); i++) {
path << arr.Item(i) << wxT("/");
for (const auto& subdir : arr) {
path << subdir << wxT("/");
wxMkdir(path, 0777);
}
}
Expand Down
11 changes: 3 additions & 8 deletions codelite_vim/vimCommands.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1267,7 +1267,6 @@ bool VimCommand::Command_call()

case COMMANDVI::y0: {
int pos_init_yw = m_ctrl->GetCurrentPos();
int repeat_yw = std::max(1, m_repeat) * std::max(1, m_actions);
m_ctrl->Home();
int pos_end_yw = m_ctrl->GetCurrentPos();
m_listCopiedStr.push_back(m_ctrl->GetTextRange(pos_init_yw, pos_end_yw));
Expand All @@ -1279,7 +1278,6 @@ bool VimCommand::Command_call()
} break;
case COMMANDVI::y$: {
int pos_init_yw = m_ctrl->GetCurrentPos();
int repeat_yw = std::max(1, m_repeat) * std::max(1, m_actions);
m_ctrl->LineEnd();
int pos_end_yw = m_ctrl->GetCurrentPos();
m_listCopiedStr.push_back(m_ctrl->GetTextRange(pos_init_yw, pos_end_yw));
Expand All @@ -1291,7 +1289,6 @@ bool VimCommand::Command_call()
} break;
case COMMANDVI::y_caret: {
int pos_init_yw = m_ctrl->GetCurrentPos();
int repeat_yw = std::max(1, m_repeat) * std::max(1, m_actions);
m_ctrl->Home();
if(m_ctrl->GetCharAt(m_ctrl->GetCurrentPos()) <= 32)
m_ctrl->WordRight();
Expand Down Expand Up @@ -1896,10 +1893,9 @@ bool VimCommand::command_call_visual_block_mode()

wxString VimCommand::get_text_at_position(VimCommand::eTypeTextSearch typeTextToSearch)
{

long pos, start, end;

pos = m_ctrl->GetCurrentPos();
const long pos = m_ctrl->GetCurrentPos();
long start = 0;
long end = 0;

switch(typeTextToSearch) {
case kAllWord:
Expand Down Expand Up @@ -3071,7 +3067,6 @@ long VimCommand::goToMatchingParentesis(long start_pos)
'\"',
'\"',
};
SEARCH_DIRECTION direction;
long pos = start_pos;
long max_n_char = m_ctrl->GetTextLength();
wxChar currChar = m_ctrl->GetCharAt(pos);
Expand Down
2 changes: 2 additions & 0 deletions wxcrafter/src/wxcrafter_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -999,11 +999,13 @@ bool wxCrafterPlugin::IsMainViewActive()
{
return true; // IIUC this function was protecting against outside events being caught when in Tabbed mode and a
// different tab was active
#if 0
if(!m_mgr) {
return true;
} else {
return IsTabMode() && m_mainPanel && m_mgr->GetActivePage() == m_mainPanel;
}
#endif
}

// plugin menu
Expand Down
1 change: 0 additions & 1 deletion wxcrafter/src/wxgui_helpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,6 @@ wxString wxCrafter::ColourToCpp(const wxString& guiname)
}
return code;
}
return "";
}

wxString wxCrafter::ESCAPE(const wxString& s)
Expand Down

0 comments on commit 1e601a5

Please sign in to comment.