Enable warnings for CMake builds and fix some warnings that this
exposed.

Also add wxUSE_NATIVE_DATAVIEWCTRL option and change default GTK version
to 3 for CMake too.

See https://github.com/wxWidgets/wxWidgets/pull/1825
This commit is contained in:
Vadim Zeitlin
2020-05-06 14:34:34 +02:00
16 changed files with 59 additions and 33 deletions

View File

@@ -29,8 +29,8 @@ matrix:
name: wxGTK 2 clang Ubuntu 18.04
- dist: bionic
compiler: gcc
env: wxTOOLSET=cmake wxCMAKE_GENERATOR="Unix Makefiles"
name: wxGTK CMake Ubuntu 18.04
env: wxGTK_VERSION=3 wxTOOLSET=cmake wxCMAKE_GENERATOR="Unix Makefiles"
name: wxGTK 3 CMake Ubuntu 18.04
- os: osx
osx_image: xcode6.4
compiler: clang

View File

@@ -98,8 +98,15 @@ function(wx_set_common_target_properties target_name)
set(MSVC_WARNING_LEVEL "/W4")
endif()
target_compile_options(${target_name} PRIVATE ${MSVC_WARNING_LEVEL})
else()
# TODO: add warning flags for other compilers
elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" AND NOT wxCOMMON_TARGET_PROPS_DEFAULT_WARNINGS)
target_compile_options(${target_name} PRIVATE
-Wall
)
elseif("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang" AND NOT wxCOMMON_TARGET_PROPS_DEFAULT_WARNINGS)
target_compile_options(${target_name} PRIVATE
-Wall
-Wno-ignored-attributes
)
endif()
if(CMAKE_USE_PTHREADS_INIT)

View File

@@ -294,6 +294,7 @@ wx_option(wxUSE_COMBOBOX "use wxComboBox class")
wx_option(wxUSE_COMBOCTRL "use wxComboCtrl class")
wx_option(wxUSE_COMMANDLINKBUTTON "use wxCommmandLinkButton class")
wx_option(wxUSE_DATAVIEWCTRL "use wxDataViewCtrl class")
wx_option(wxUSE_NATIVE_DATAVIEWCTRL "use the native wxDataViewCtrl if available")
wx_option(wxUSE_DATEPICKCTRL "use wxDatePickerCtrl class")
wx_option(wxUSE_DETECT_SM "use code to detect X11 session manager" OFF)
wx_option(wxUSE_DIRPICKERCTRL "use wxDirPickerCtrl class")

View File

@@ -27,7 +27,7 @@ elseif(APPLE)
set(wxTOOLKIT_OPTIONS osx_cocoa gtk2 gtk3 gtk4 qt)
set(wxPLATFORM OSX)
elseif(UNIX)
set(wxDEFAULT_TOOLKIT gtk2)
set(wxDEFAULT_TOOLKIT gtk3)
set(wxTOOLKIT_OPTIONS gtk2 gtk3 gtk4 motif qt)
set(wxPLATFORM UNIX)
else()

View File

@@ -343,7 +343,7 @@ public:
{
}
virtual bool IsFrozen() const { return true; }
virtual bool IsFrozen() const wxOVERRIDE { return true; }
};
@@ -375,7 +375,7 @@ public:
{
}
virtual bool IsFrozen() const { return true; }
virtual bool IsFrozen() const wxOVERRIDE { return true; }
};

View File

@@ -211,6 +211,12 @@ struct WinStruct : public T
#include "wx/gdicmn.h"
#include "wx/colour.h"
#ifdef COM_DECLSPEC_NOTHROW
#define wxSTDMETHODIMP COM_DECLSPEC_NOTHROW STDMETHODIMP
#else
#define wxSTDMETHODIMP STDMETHODIMP
#endif
// make conversion from wxColour and COLORREF a bit less painful
inline COLORREF wxColourToRGB(const wxColour& c)
{

View File

@@ -28,7 +28,7 @@ bool WXDLLIMPEXP_CORE Initialize();
void WXDLLIMPEXP_CORE Uninitialize();
bool WXDLLIMPEXP_CORE GetActivationFactory(const wxString& activatableClassId, REFIID iid, void ** factory);
HRESULT WXDLLIMPEXP_CORE GetActivationFactory(const wxString& activatableClassId, REFIID iid, void ** factory);
// RAII class initializing WinRT in its ctor and undoing it in its dtor.
class WXDLLIMPEXP_CORE Initializer

View File

@@ -91,11 +91,13 @@ static wxLocale *wxSetLocale(wxLocale *pLocale);
namespace
{
#if defined(__UNIX__)
// get just the language part ("en" in "en_GB")
inline wxString ExtractLang(const wxString& langFull)
{
return langFull.BeforeFirst('_');
}
#endif
// helper functions of GetSystemLanguage()
#ifdef __UNIX__
@@ -606,7 +608,7 @@ bool wxLocale::Init(int language, int flags)
namespace
{
#ifndef __WXOSX__
#if defined(__UNIX__) && !defined(__WXOSX__)
// Small helper function: get the value of the given environment variable and
// return true only if the variable was found and has non-empty value.
inline bool wxGetNonEmptyEnvVar(const wxString& name, wxString* value)

View File

@@ -64,8 +64,12 @@ namespace
{
const int MILLISECONDS_PER_SECOND = 1000;
#if !defined(__WINDOWS__)
const int MICROSECONDS_PER_MILLISECOND = 1000;
#ifdef HAVE_GETTIMEOFDAY
const int MICROSECONDS_PER_SECOND = 1000*1000;
#endif
#endif
} // anonymous namespace
@@ -332,7 +336,7 @@ wxLongLong wxGetLocalTimeMillis()
double wxGetLocalTimeMillis()
{
return (double(clock()) / double(CLOCKS_PER_SEC)) * 1000.0;
return (double(clock()) / double(CLOCKS_PER_SEC)) * MILLISECONDS_PER_SECOND;
}
#endif // wxUSE_LONGLONG/!wxUSE_LONGLONG

View File

@@ -69,9 +69,6 @@ namespace
// Local functions
//-----------------------------------------------------------------------------
inline double dmin(double a, double b) { return a < b ? a : b; }
inline double dmax(double a, double b) { return a > b ? a : b; }
// translate a wxColour to a Color
inline Color wxColourToColor(const wxColour& col)
{

View File

@@ -385,13 +385,17 @@ class wxDirect2DFontFileEnumerator : public IDWriteFontFileEnumerator
public:
wxDirect2DFontFileEnumerator(IDWriteFactory* pFactory, const wxArrayString& fontCollection)
: m_factory(pFactory)
, m_nextIndex(0)
, m_filePaths(fontCollection)
, m_nextIndex(0)
{
}
virtual ~wxDirect2DFontFileEnumerator()
{
}
// IDWriteFontFileEnumerator methods
virtual HRESULT STDMETHODCALLTYPE MoveNext(BOOL* pHasCurrentFile) wxOVERRIDE
virtual wxSTDMETHODIMP MoveNext(BOOL* pHasCurrentFile) wxOVERRIDE
{
HRESULT hr = S_OK;
@@ -411,7 +415,7 @@ public:
return hr;
}
virtual HRESULT STDMETHODCALLTYPE GetCurrentFontFile(IDWriteFontFile** ppFontFile) wxOVERRIDE
virtual wxSTDMETHODIMP GetCurrentFontFile(IDWriteFontFile** ppFontFile) wxOVERRIDE
{
if ( m_currentFile )
{
@@ -449,8 +453,12 @@ public:
ms_isInitialized = true;
}
virtual ~wxDirect2DFontCollectionLoader()
{
}
// IDWriteFontCollectionLoader methods
virtual HRESULT STDMETHODCALLTYPE CreateEnumeratorFromKey(IDWriteFactory* pFactory,
virtual wxSTDMETHODIMP CreateEnumeratorFromKey(IDWriteFactory* pFactory,
void const* pCollectionKey, UINT32 collectionKeySize,
IDWriteFontFileEnumerator** pFontFileEnumerator) wxOVERRIDE
{

View File

@@ -80,6 +80,7 @@
//
// Some of these are not used but are kept here for future reference anyway
//---------------------------------------------------------------------------
wxCLANG_WARNING_SUPPRESS(unused-const-variable)
const IID IID_IActiveMovie = {0x05589FA2,0xC356,0x11CE,{0xBF,0x01,0x00,0xAA,0x00,0x55,0x59,0x5A}};
const IID IID_IActiveMovie2 = {0xB6CD6554,0xE9CB,0x11D0,{0x82,0x1F,0x00,0xA0,0xC9,0x1F,0x9C,0xA0}};
const IID IID_IActiveMovie3 = {0x265EC140,0xAE62,0x11D1,{0x85,0x00,0x00,0xA0,0xC9,0x1F,0x9C,0xA0}};
@@ -109,6 +110,7 @@ const IID IID_IFilterGraph = {0x56A8689F, 0x0AD4, 0x11CE,{0xB0, 0x3A,
const IID IID_IGraphBuilder = {0x56A868A9, 0x0AD4, 0x11CE,{0xB0, 0x3A, 0x00, 0x20, 0xAF, 0x0B, 0xA7, 0x70}};
const IID IID_IVMRFilterConfig9 = {0x5A804648, 0x4F66, 0x4867,{0x9C, 0x43, 0x4F, 0x5C, 0x82, 0x2C, 0xF1, 0xB8}};
const IID IID_IBaseFilter = {0x56A86895, 0x0AD4, 0x11CE,{0xB0, 0x3A, 0x00, 0x20, 0xAF, 0x0B, 0xA7, 0x70}};
wxCLANG_WARNING_RESTORE(unused-const-variable)
//---------------------------------------------------------------------------
// QUARTZ COM INTERFACES (dumped from quartz.idl from MSVC COM Browser)

View File

@@ -105,7 +105,6 @@ typedef struct ComponentInstanceRecord * ComponentInstance;
// constants respectively (translate each byte to ASCII to see it), but this is
// not accepted by non-Mac compilers, so use the numeric constants instead.
const OSType URLDataHandlerSubType = 0x75726c20;
const OSType VisualMediaCharacteristic = 0x65796573;
#endif
struct FSSpec

View File

@@ -89,6 +89,7 @@
// Various definitions dumped from wmp.IDL
//---------------------------------------------------------------------------
wxCLANG_WARNING_SUPPRESS(unused-const-variable)
// CLSID_WMP10ALT is on CE and in some MS docs - on others it is the plain ver
const CLSID CLSID_WMP10 = {0x6BF52A50,0x394A,0x11D3,{0xB1,0x53,0x00,0xC0,0x4F,0x79,0xFA,0xA6}};
const CLSID CLSID_WMP10ALT = {0x6BF52A52,0x394A,0x11D3,{0xB1,0x53,0x00,0xC0,0x4F,0x79,0xFA,0xA6}};
@@ -106,6 +107,7 @@ const IID IID_IWMPCore2 = {0xBC17E5B7,0x7561,0x4C18,{0xBB,0x90,0x17,0xD4,0x85,0x
const IID IID_IWMPCore3 = {0x7587C667,0x628F,0x499F,{0x88,0xE7,0x6A,0x6F,0x4E,0x88,0x84,0x64}};
const IID IID_IWMPNetwork = {0xEC21B779,0xEDEF,0x462D,{0xBB,0xA4,0xAD,0x9D,0xDE,0x2B,0x29,0xA7}};
const IID IID_IWMPControls2 = {0x6F030D25,0x0890,0x480F,{0x97, 0x75, 0x1F,0x7E,0x40,0xAB,0x5B,0x8E}};
wxCLANG_WARNING_RESTORE(unused-const-variable)
enum WMPOpenState
{

View File

@@ -215,19 +215,17 @@ void Uninitialize()
RTCore::Get().RoUninitialize();
}
bool GetActivationFactory(const wxString& activatableClassId, REFIID iid, void ** factory)
HRESULT GetActivationFactory(const wxString& activatableClassId, REFIID iid, void ** factory)
{
if ( !RTCore::IsAvailable() )
return false;
return CLASS_E_CLASSNOTAVAILABLE;
HRESULT hr = RTCore::Get().RoGetActivationFactory(TempStringRef(activatableClassId), iid, factory);
if ( FAILED(hr) )
{
wxLogDebug("RoGetActivationFactory failed %.8x", hr);
return false;
}
else
return true;
return hr;
}
// ----------------------------------------------------------------------------

View File

@@ -191,17 +191,17 @@ public:
wxTextCtrlOleCallback(wxTextCtrl *text) : m_textCtrl(text), m_menu(NULL) {}
virtual ~wxTextCtrlOleCallback() { DeleteContextMenuObject(); }
STDMETHODIMP ContextSensitiveHelp(BOOL WXUNUSED(enterMode)) wxOVERRIDE { return E_NOTIMPL; }
STDMETHODIMP DeleteObject(LPOLEOBJECT WXUNUSED(oleobj)) wxOVERRIDE { return E_NOTIMPL; }
STDMETHODIMP GetClipboardData(CHARRANGE* WXUNUSED(chrg), DWORD WXUNUSED(reco), LPDATAOBJECT* WXUNUSED(dataobj)) wxOVERRIDE { return E_NOTIMPL; }
STDMETHODIMP GetDragDropEffect(BOOL WXUNUSED(drag), DWORD WXUNUSED(grfKeyState), LPDWORD WXUNUSED(effect)) wxOVERRIDE { return E_NOTIMPL; }
STDMETHODIMP GetInPlaceContext(LPOLEINPLACEFRAME* WXUNUSED(frame), LPOLEINPLACEUIWINDOW* WXUNUSED(doc), LPOLEINPLACEFRAMEINFO WXUNUSED(frameInfo)) wxOVERRIDE { return E_NOTIMPL; }
STDMETHODIMP GetNewStorage(LPSTORAGE *WXUNUSED(stg)) wxOVERRIDE { return E_NOTIMPL; }
STDMETHODIMP QueryAcceptData(LPDATAOBJECT WXUNUSED(dataobj), CLIPFORMAT* WXUNUSED(format), DWORD WXUNUSED(reco), BOOL WXUNUSED(really), HGLOBAL WXUNUSED(hMetaPict)) wxOVERRIDE { return E_NOTIMPL; }
STDMETHODIMP QueryInsertObject(LPCLSID WXUNUSED(clsid), LPSTORAGE WXUNUSED(stg), LONG WXUNUSED(cp)) wxOVERRIDE { return E_NOTIMPL; }
STDMETHODIMP ShowContainerUI(BOOL WXUNUSED(show)) wxOVERRIDE { return E_NOTIMPL; }
wxSTDMETHODIMP ContextSensitiveHelp(BOOL WXUNUSED(enterMode)) wxOVERRIDE { return E_NOTIMPL; }
wxSTDMETHODIMP DeleteObject(LPOLEOBJECT WXUNUSED(oleobj)) wxOVERRIDE { return E_NOTIMPL; }
wxSTDMETHODIMP GetClipboardData(CHARRANGE* WXUNUSED(chrg), DWORD WXUNUSED(reco), LPDATAOBJECT* WXUNUSED(dataobj)) wxOVERRIDE { return E_NOTIMPL; }
wxSTDMETHODIMP GetDragDropEffect(BOOL WXUNUSED(drag), DWORD WXUNUSED(grfKeyState), LPDWORD WXUNUSED(effect)) wxOVERRIDE { return E_NOTIMPL; }
wxSTDMETHODIMP GetInPlaceContext(LPOLEINPLACEFRAME* WXUNUSED(frame), LPOLEINPLACEUIWINDOW* WXUNUSED(doc), LPOLEINPLACEFRAMEINFO WXUNUSED(frameInfo)) wxOVERRIDE { return E_NOTIMPL; }
wxSTDMETHODIMP GetNewStorage(LPSTORAGE *WXUNUSED(stg)) wxOVERRIDE { return E_NOTIMPL; }
wxSTDMETHODIMP QueryAcceptData(LPDATAOBJECT WXUNUSED(dataobj), CLIPFORMAT* WXUNUSED(format), DWORD WXUNUSED(reco), BOOL WXUNUSED(really), HGLOBAL WXUNUSED(hMetaPict)) wxOVERRIDE { return E_NOTIMPL; }
wxSTDMETHODIMP QueryInsertObject(LPCLSID WXUNUSED(clsid), LPSTORAGE WXUNUSED(stg), LONG WXUNUSED(cp)) wxOVERRIDE { return E_NOTIMPL; }
wxSTDMETHODIMP ShowContainerUI(BOOL WXUNUSED(show)) wxOVERRIDE { return E_NOTIMPL; }
STDMETHODIMP GetContextMenu(WORD WXUNUSED(seltype), LPOLEOBJECT WXUNUSED(oleobj), CHARRANGE* WXUNUSED(chrg), HMENU *menu) wxOVERRIDE
wxSTDMETHODIMP GetContextMenu(WORD WXUNUSED(seltype), LPOLEOBJECT WXUNUSED(oleobj), CHARRANGE* WXUNUSED(chrg), HMENU *menu) wxOVERRIDE
{
// 'menu' will be shown and destroyed by the caller. We need to keep
// its wx counterpart, the wxMenu instance, around until it is