From 6cd6aa38432c6c33a8bc762ccc5b59a198a6438b Mon Sep 17 00:00:00 2001 From: ozone10 Date: Fri, 31 May 2024 18:40:18 +0200 Subject: [PATCH] Make clang warnings flags in makefile and msvc consistent PR #15189 added option to use clang with gcc makefile. This PR makes clang warnings flags in makefile and msvc consistent. Close #15227 --- PowerEditor/gcc/makefile | 19 ++++++++++++++++- .../src/ScintillaComponent/FindReplaceDlg.cpp | 3 --- .../DockingWnd/DockingDlgInterface.h | 14 +++++-------- .../src/WinControls/FileBrowser/fileBrowser.h | 21 +++++++------------ PowerEditor/src/WinControls/TabBar/TabBar.cpp | 2 +- PowerEditor/visual.net/notepadPlus.Cpp.props | 2 +- 6 files changed, 32 insertions(+), 29 deletions(-) diff --git a/PowerEditor/gcc/makefile b/PowerEditor/gcc/makefile index 89628cd8f..5a976190a 100644 --- a/PowerEditor/gcc/makefile +++ b/PowerEditor/gcc/makefile @@ -58,7 +58,7 @@ SUBMAKEFLAGS := -O --no-print-directory ifeq "$(filter-out 0,$(DEBUG))" "" BUILD_TYPE := release BUILD_SUFFIX := -CXXFLAGS += -O3 -Wno-alloc-size-larger-than -Wconversion +CXXFLAGS += -O3 -Wconversion CPP_DEFINE += NDEBUG LDFLAGS += -s else @@ -68,6 +68,23 @@ CXXFLAGS += -Og -g -Wpedantic -Wall -Wextra -Wno-cast-function-type -Wno-overloa CPP_DEFINE += DEBUG endif +ifeq ($(CXX),clang++) + CXXFLAGS += -Wimplicit-fallthrough \ + -Wformat=2 \ + -Wno-c++98-compat \ + -Wno-c++98-compat-pedantic \ + -Wno-reserved-id-macro \ + -Wno-pragma-pack \ + -Wno-unknown-pragmas \ + -Wno-unused-command-line-argument \ + -Wno-overloaded-virtual \ + -Wno-sign-conversion \ + -Wno-c99-extensions \ + -Wno-deprecated-declarations +else ifeq ($(BUILD_TYPE),release) + CXXFLAGS += -Wno-alloc-size-larger-than +endif + ifneq "$(filter-out 0,$(CLANGANALYZE))" "" CXXFLAGS += --analyze -Xanalyzer -analyzer-output=text endif diff --git a/PowerEditor/src/ScintillaComponent/FindReplaceDlg.cpp b/PowerEditor/src/ScintillaComponent/FindReplaceDlg.cpp index 43f3bdacd..782ca4197 100644 --- a/PowerEditor/src/ScintillaComponent/FindReplaceDlg.cpp +++ b/PowerEditor/src/ScintillaComponent/FindReplaceDlg.cpp @@ -250,9 +250,6 @@ void Searching::displaySectionCentered(size_t posStart, size_t posEnd, Scintilla WNDPROC FindReplaceDlg::originalFinderProc = nullptr; WNDPROC FindReplaceDlg::originalComboEditProc = nullptr; -// important : to activate all styles -const int STYLING_MASK = 255; - FindReplaceDlg::~FindReplaceDlg() { _tab.destroy(); diff --git a/PowerEditor/src/WinControls/DockingWnd/DockingDlgInterface.h b/PowerEditor/src/WinControls/DockingWnd/DockingDlgInterface.h index f67eadd80..2b0ae81b3 100644 --- a/PowerEditor/src/WinControls/DockingWnd/DockingDlgInterface.h +++ b/PowerEditor/src/WinControls/DockingWnd/DockingDlgInterface.h @@ -34,21 +34,21 @@ public: DockingDlgInterface() = default; explicit DockingDlgInterface(int dlgID): _dlgID(dlgID) {} - virtual void init(HINSTANCE hInst, HWND parent) { + void init(HINSTANCE hInst, HWND parent) override { StaticDialog::init(hInst, parent); TCHAR temp[MAX_PATH]; ::GetModuleFileName(hInst, temp, MAX_PATH); _moduleName = ::PathFindFileName(temp); } - void create(tTbData* data, bool isRTL = false) { + void create(tTbData* data, bool isRTL = false) { assert(data != nullptr); StaticDialog::create(_dlgID, isRTL); TCHAR temp[MAX_PATH]; ::GetWindowText(_hSelf, temp, MAX_PATH); _pluginName = temp; - // user information + // user information data->hClient = _hSelf; data->pszName = _pluginName.c_str(); @@ -63,14 +63,10 @@ public: ::SendMessage(_hParent, NPPM_DMMUPDATEDISPINFO, 0, reinterpret_cast(_hSelf)); } - virtual void destroy() { - StaticDialog::destroy(); - } - virtual void setBackgroundColor(COLORREF) {} virtual void setForegroundColor(COLORREF) {} - virtual void display(bool toShow = true) const { + void display(bool toShow = true) const override { ::SendMessage(_hParent, toShow ? NPPM_DMMSHOW : NPPM_DMMHIDE, 0, reinterpret_cast(_hSelf)); } @@ -94,7 +90,7 @@ protected : generic_string _pluginName; bool _isClosed = false; - virtual intptr_t CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam) { + intptr_t CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam) override { switch (message) { case WM_ERASEBKGND: diff --git a/PowerEditor/src/WinControls/FileBrowser/fileBrowser.h b/PowerEditor/src/WinControls/FileBrowser/fileBrowser.h index bc8a7b8f5..570125431 100644 --- a/PowerEditor/src/WinControls/FileBrowser/fileBrowser.h +++ b/PowerEditor/src/WinControls/FileBrowser/fileBrowser.h @@ -120,25 +120,18 @@ class FileBrowser : public DockingDlgInterface { public: FileBrowser(): DockingDlgInterface(IDD_FILEBROWSER) {}; ~FileBrowser(); - void init(HINSTANCE hInst, HWND hPere) { - DockingDlgInterface::init(hInst, hPere); - } - virtual void display(bool toShow = true) const { - DockingDlgInterface::display(toShow); - }; + void setParent(HWND parent2set){ + _hParent = parent2set; + }; - void setParent(HWND parent2set){ - _hParent = parent2set; - }; - - virtual void setBackgroundColor(COLORREF bgColour) { + void setBackgroundColor(COLORREF bgColour) override { TreeView_SetBkColor(_treeView.getHSelf(), bgColour); - }; + }; - virtual void setForegroundColor(COLORREF fgColour) { + void setForegroundColor(COLORREF fgColour) override { TreeView_SetTextColor(_treeView.getHSelf(), fgColour); - }; + }; generic_string getNodePath(HTREEITEM node) const; generic_string getNodeName(HTREEITEM node) const; diff --git a/PowerEditor/src/WinControls/TabBar/TabBar.cpp b/PowerEditor/src/WinControls/TabBar/TabBar.cpp index 0b1746b29..b01ebf4aa 100644 --- a/PowerEditor/src/WinControls/TabBar/TabBar.cpp +++ b/PowerEditor/src/WinControls/TabBar/TabBar.cpp @@ -195,7 +195,7 @@ void TabBar::deletItemAt(size_t index) //Doesn't really seem to be documented anywhere, but the values do match the message parameters //The up/down control really is just some sort of scrollbar //There seems to be no negative effect on any internal state of the tab control or the up/down control - int wParam = MAKEWPARAM(SB_THUMBPOSITION, index - 1); + WPARAM wParam = MAKEWPARAM(SB_THUMBPOSITION, index - 1); ::SendMessage(_hSelf, WM_HSCROLL, wParam, 0); wParam = MAKEWPARAM(SB_ENDSCROLL, index - 1); diff --git a/PowerEditor/visual.net/notepadPlus.Cpp.props b/PowerEditor/visual.net/notepadPlus.Cpp.props index 526604586..ba6e78585 100644 --- a/PowerEditor/visual.net/notepadPlus.Cpp.props +++ b/PowerEditor/visual.net/notepadPlus.Cpp.props @@ -58,7 +58,7 @@ false - -Wextra -Wimplicit-fallthrough -Wformat=2 -Wno-c++98-compat -Wno-c++98-compat-pedantic -Wno-reserved-id-macro -Wno-pragma-pack -Wno-unknown-pragmas -Wno-unused-command-line-argument -Wno-overloaded-virtual %(AdditionalOptions) + -Wpedantic -Wall -Wextra -Wimplicit-fallthrough -Wformat=2 -Wno-c++98-compat -Wno-c++98-compat-pedantic -Wno-reserved-id-macro -Wno-pragma-pack -Wno-unknown-pragmas -Wno-unused-command-line-argument -Wno-overloaded-virtual -Wno-sign-conversion -Wno-c99-extensions -Wno-deprecated-declarations %(AdditionalOptions)