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
This commit is contained in:
ozone10 2024-05-31 18:40:18 +02:00 committed by Don Ho
parent fedaabf0f8
commit 6cd6aa3843
6 changed files with 32 additions and 29 deletions

View File

@ -58,7 +58,7 @@ SUBMAKEFLAGS := -O --no-print-directory
ifeq "$(filter-out 0,$(DEBUG))" "" ifeq "$(filter-out 0,$(DEBUG))" ""
BUILD_TYPE := release BUILD_TYPE := release
BUILD_SUFFIX := BUILD_SUFFIX :=
CXXFLAGS += -O3 -Wno-alloc-size-larger-than -Wconversion CXXFLAGS += -O3 -Wconversion
CPP_DEFINE += NDEBUG CPP_DEFINE += NDEBUG
LDFLAGS += -s LDFLAGS += -s
else else
@ -68,6 +68,23 @@ CXXFLAGS += -Og -g -Wpedantic -Wall -Wextra -Wno-cast-function-type -Wno-overloa
CPP_DEFINE += DEBUG CPP_DEFINE += DEBUG
endif 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))" "" ifneq "$(filter-out 0,$(CLANGANALYZE))" ""
CXXFLAGS += --analyze -Xanalyzer -analyzer-output=text CXXFLAGS += --analyze -Xanalyzer -analyzer-output=text
endif endif

View File

@ -250,9 +250,6 @@ void Searching::displaySectionCentered(size_t posStart, size_t posEnd, Scintilla
WNDPROC FindReplaceDlg::originalFinderProc = nullptr; WNDPROC FindReplaceDlg::originalFinderProc = nullptr;
WNDPROC FindReplaceDlg::originalComboEditProc = nullptr; WNDPROC FindReplaceDlg::originalComboEditProc = nullptr;
// important : to activate all styles
const int STYLING_MASK = 255;
FindReplaceDlg::~FindReplaceDlg() FindReplaceDlg::~FindReplaceDlg()
{ {
_tab.destroy(); _tab.destroy();

View File

@ -34,21 +34,21 @@ public:
DockingDlgInterface() = default; DockingDlgInterface() = default;
explicit DockingDlgInterface(int dlgID): _dlgID(dlgID) {} explicit DockingDlgInterface(int dlgID): _dlgID(dlgID) {}
virtual void init(HINSTANCE hInst, HWND parent) { void init(HINSTANCE hInst, HWND parent) override {
StaticDialog::init(hInst, parent); StaticDialog::init(hInst, parent);
TCHAR temp[MAX_PATH]; TCHAR temp[MAX_PATH];
::GetModuleFileName(hInst, temp, MAX_PATH); ::GetModuleFileName(hInst, temp, MAX_PATH);
_moduleName = ::PathFindFileName(temp); _moduleName = ::PathFindFileName(temp);
} }
void create(tTbData* data, bool isRTL = false) { void create(tTbData* data, bool isRTL = false) {
assert(data != nullptr); assert(data != nullptr);
StaticDialog::create(_dlgID, isRTL); StaticDialog::create(_dlgID, isRTL);
TCHAR temp[MAX_PATH]; TCHAR temp[MAX_PATH];
::GetWindowText(_hSelf, temp, MAX_PATH); ::GetWindowText(_hSelf, temp, MAX_PATH);
_pluginName = temp; _pluginName = temp;
// user information // user information
data->hClient = _hSelf; data->hClient = _hSelf;
data->pszName = _pluginName.c_str(); data->pszName = _pluginName.c_str();
@ -63,14 +63,10 @@ public:
::SendMessage(_hParent, NPPM_DMMUPDATEDISPINFO, 0, reinterpret_cast<LPARAM>(_hSelf)); ::SendMessage(_hParent, NPPM_DMMUPDATEDISPINFO, 0, reinterpret_cast<LPARAM>(_hSelf));
} }
virtual void destroy() {
StaticDialog::destroy();
}
virtual void setBackgroundColor(COLORREF) {} virtual void setBackgroundColor(COLORREF) {}
virtual void setForegroundColor(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<LPARAM>(_hSelf)); ::SendMessage(_hParent, toShow ? NPPM_DMMSHOW : NPPM_DMMHIDE, 0, reinterpret_cast<LPARAM>(_hSelf));
} }
@ -94,7 +90,7 @@ protected :
generic_string _pluginName; generic_string _pluginName;
bool _isClosed = false; 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) switch (message)
{ {
case WM_ERASEBKGND: case WM_ERASEBKGND:

View File

@ -120,25 +120,18 @@ class FileBrowser : public DockingDlgInterface {
public: public:
FileBrowser(): DockingDlgInterface(IDD_FILEBROWSER) {}; FileBrowser(): DockingDlgInterface(IDD_FILEBROWSER) {};
~FileBrowser(); ~FileBrowser();
void init(HINSTANCE hInst, HWND hPere) {
DockingDlgInterface::init(hInst, hPere);
}
virtual void display(bool toShow = true) const { void setParent(HWND parent2set){
DockingDlgInterface::display(toShow); _hParent = parent2set;
}; };
void setParent(HWND parent2set){ void setBackgroundColor(COLORREF bgColour) override {
_hParent = parent2set;
};
virtual void setBackgroundColor(COLORREF bgColour) {
TreeView_SetBkColor(_treeView.getHSelf(), bgColour); TreeView_SetBkColor(_treeView.getHSelf(), bgColour);
}; };
virtual void setForegroundColor(COLORREF fgColour) { void setForegroundColor(COLORREF fgColour) override {
TreeView_SetTextColor(_treeView.getHSelf(), fgColour); TreeView_SetTextColor(_treeView.getHSelf(), fgColour);
}; };
generic_string getNodePath(HTREEITEM node) const; generic_string getNodePath(HTREEITEM node) const;
generic_string getNodeName(HTREEITEM node) const; generic_string getNodeName(HTREEITEM node) const;

View File

@ -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 //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 //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 //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); ::SendMessage(_hSelf, WM_HSCROLL, wParam, 0);
wParam = MAKEWPARAM(SB_ENDSCROLL, index - 1); wParam = MAKEWPARAM(SB_ENDSCROLL, index - 1);

View File

@ -58,7 +58,7 @@
<ItemDefinitionGroup Condition="'$(PlatformToolset)'=='ClangCL'"> <ItemDefinitionGroup Condition="'$(PlatformToolset)'=='ClangCL'">
<ClCompile> <ClCompile>
<TreatWarningAsError>false</TreatWarningAsError> <TreatWarningAsError>false</TreatWarningAsError>
<AdditionalOptions>-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)</AdditionalOptions> <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)</AdditionalOptions>
</ClCompile> </ClCompile>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)'=='Debug'"> <ItemDefinitionGroup Condition="'$(Configuration)'=='Debug'">