From d2e03dec77e6124a5e4e29c587a65bdbd35ff0a7 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 6 Jul 2020 00:30:41 +0200 Subject: [PATCH 01/31] Treat warnings as errors in Travis CI builds This will allow detecting any new warnings immediately. --- build/tools/travis-ci.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/build/tools/travis-ci.sh b/build/tools/travis-ci.sh index c618b08bbb..4196115770 100755 --- a/build/tools/travis-ci.sh +++ b/build/tools/travis-ci.sh @@ -56,6 +56,7 @@ case $wxTOOLSET in ;; *) echo 'travis_fold:start:configure' + export CXXFLAGS=-Werror echo 'Configuring...' ./configure --disable-optimise --disable-debug_info $wxCONFIGURE_FLAGS || rc=$? if [ -n "$rc" ]; then From de6b4e4095d97bfcdad1a8f2766eb0b2f3875faa Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 6 Jul 2020 12:32:38 +0200 Subject: [PATCH 02/31] Use LocaleSetter class in wxTextCtrl test case Replace manual calls to setlocale() with the existing helper class. This makes the code slightly simpler and avoids -Wnoexcept-type warnings due to using setlocale as template argument as a welcome side effect. --- tests/controls/textctrltest.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tests/controls/textctrltest.cpp b/tests/controls/textctrltest.cpp index 1353f7dde2..e07c218d67 100644 --- a/tests/controls/textctrltest.cpp +++ b/tests/controls/textctrltest.cpp @@ -24,7 +24,6 @@ #endif // WX_PRECOMP #include "wx/scopedptr.h" -#include "wx/scopeguard.h" #include "wx/uiaction.h" #if wxUSE_CLIPBOARD @@ -290,8 +289,7 @@ void TextCtrlTestCase::StreamInput() #ifndef __WXOSX__ { // Ensure we use decimal point and not a comma. - char * const locOld = setlocale(LC_NUMERIC, "C"); - wxON_BLOCK_EXIT2( setlocale, (int)LC_NUMERIC, locOld ); + LocaleSetter setCLocale("C"); *m_text << "stringinput" << 10 From 1b9f57621d94644b0187ce9f18aec45dba6df57c Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 6 Jul 2020 12:34:42 +0200 Subject: [PATCH 03/31] Add a forgotten wxOVERRIDE in the grid sample Fix -Winconsistent-missing-override when building this sample. --- samples/grid/griddemo.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/grid/griddemo.cpp b/samples/grid/griddemo.cpp index 77b645cc6d..142a364f22 100644 --- a/samples/grid/griddemo.cpp +++ b/samples/grid/griddemo.cpp @@ -241,7 +241,7 @@ public: grid->SetCellValue(row, col, m_value); } - virtual wxGridCellEditor *Clone() const + virtual wxGridCellEditor *Clone() const wxOVERRIDE { return new MyGridStarEditor(); } From 3fc15101beda8dcf336f645a82482fb116d27fa0 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 6 Jul 2020 12:40:03 +0200 Subject: [PATCH 04/31] Fix unhelpful unused parameter warning in wxX11 wxFontEnumerator This warning can't really be avoided in this case, unless we decided not to return any fonts at all if we can't test whether they're monospaced or not, but this would probably be even less useful. --- src/unix/fontenum.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/unix/fontenum.cpp b/src/unix/fontenum.cpp index 01d4a61a75..f28eca94df 100644 --- a/src/unix/fontenum.cpp +++ b/src/unix/fontenum.cpp @@ -62,6 +62,10 @@ wxCompareFamilies (const void *a, const void *b) bool wxFontEnumerator::EnumerateFacenames(wxFontEncoding encoding, bool fixedWidthOnly) { + // This parameter may be unused when pango_font_family_is_monospace() is + // not available, suppress the (unavoidable) warning in this case. + wxUnusedVar(fixedWidthOnly); + if ( encoding != wxFONTENCODING_SYSTEM && encoding != wxFONTENCODING_UTF8 ) { // Pango supports only UTF-8 encoding (and system means any, so we From b48515d5cc0422bd06605cf338e9adf61c1e5ac8 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 6 Jul 2020 12:44:25 +0200 Subject: [PATCH 05/31] squash! Treat warnings as errors in Travis CI builds Add wxALLOW_WARNINGS which can be set to prevent this from happening for the ports where we don't want to avoids warnings anyhow because they indicate real problems in the code, such as wxDFB. --- .travis.yml | 2 +- build/tools/travis-ci.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 7e990d75a8..d73bc85e50 100644 --- a/.travis.yml +++ b/.travis.yml @@ -59,7 +59,7 @@ matrix: name: wxX11 Ubuntu 18.04 - dist: bionic compiler: gcc - env: wxCONFIGURE_FLAGS="--with-directfb --enable-pch --disable-stc" wxSKIP_SAMPLES=1 + env: wxCONFIGURE_FLAGS="--with-directfb --enable-pch --disable-stc" wxSKIP_SAMPLES=1 wxALLOW_WARNINGS=1 name: wxDFB Ubuntu 18.04 - dist: bionic compiler: gcc diff --git a/build/tools/travis-ci.sh b/build/tools/travis-ci.sh index 4196115770..ce02523dde 100755 --- a/build/tools/travis-ci.sh +++ b/build/tools/travis-ci.sh @@ -56,7 +56,7 @@ case $wxTOOLSET in ;; *) echo 'travis_fold:start:configure' - export CXXFLAGS=-Werror + [ "$wxALLOW_WARNINGS" = 1 ] || export CXXFLAGS=-Werror echo 'Configuring...' ./configure --disable-optimise --disable-debug_info $wxCONFIGURE_FLAGS || rc=$? if [ -n "$rc" ]; then From 31a1779a8603269ce3d5e010a17a0bbd176a9cd2 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 6 Jul 2020 12:45:57 +0200 Subject: [PATCH 06/31] Keep building libraries/samples/tests in Travis CI tests This is useful to see all the warnings at once instead of having to run many builds to see them all. --- build/tools/travis-ci.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/build/tools/travis-ci.sh b/build/tools/travis-ci.sh index ce02523dde..7ea4a21cd4 100755 --- a/build/tools/travis-ci.sh +++ b/build/tools/travis-ci.sh @@ -70,13 +70,13 @@ case $wxTOOLSET in echo 'travis_fold:start:building' echo 'Building...' - make $wxBUILD_ARGS + make -k $wxBUILD_ARGS echo 'travis_fold:end:building' echo 'travis_fold:start:tests' echo 'Building tests...' [ "$wxSKIP_GUI" = 1 ] || make -C tests $wxBUILD_ARGS failtest - make -C tests $wxBUILD_ARGS $wxMAKEFILE_FLAGS + make -k -C tests $wxBUILD_ARGS $wxMAKEFILE_FLAGS echo 'travis_fold:end:tests' if [ "$wxSKIP_TESTING" = 1 ]; then @@ -103,7 +103,7 @@ case $wxTOOLSET in echo 'travis_fold:start:samples' echo 'Building samples...' - (test "$wxSKIP_SAMPLES" && echo 'SKIPPED') || make samples + (test "$wxSKIP_SAMPLES" && echo 'SKIPPED') || make -k samples echo 'travis_fold:end:samples' echo 'travis_fold:start:install' From 20e385e7bbeb6e9edca556eade254fd0f469c500 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 6 Jul 2020 12:52:01 +0200 Subject: [PATCH 07/31] Do not make explicit #warnings fatal in Travis CI builds Don't give errors for the intentional warnings from #warning directives. --- build/tools/travis-ci.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/tools/travis-ci.sh b/build/tools/travis-ci.sh index 7ea4a21cd4..9b691d3fab 100755 --- a/build/tools/travis-ci.sh +++ b/build/tools/travis-ci.sh @@ -56,7 +56,7 @@ case $wxTOOLSET in ;; *) echo 'travis_fold:start:configure' - [ "$wxALLOW_WARNINGS" = 1 ] || export CXXFLAGS=-Werror + [ "$wxALLOW_WARNINGS" = 1 ] || export CXXFLAGS='-Werror -Wno-error=cpp' echo 'Configuring...' ./configure --disable-optimise --disable-debug_info $wxCONFIGURE_FLAGS || rc=$? if [ -n "$rc" ]; then From e7bb37436ae3c256117016deb95269a0a02e2f46 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 6 Jul 2020 12:53:07 +0200 Subject: [PATCH 08/31] Warn if wxCairoContext(wxPrinterDC) ctor is not implemented Use an explicit #warning to explain the problem. This is more informative and avoids errors when building with -Werror (but also -Wno-error=cpp). --- src/generic/graphicc.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/generic/graphicc.cpp b/src/generic/graphicc.cpp index 244330580a..b98a62ecf7 100644 --- a/src/generic/graphicc.cpp +++ b/src/generic/graphicc.cpp @@ -1917,9 +1917,7 @@ wxCairoContext::wxCairoContext( wxGraphicsRenderer* renderer, const wxPrinterDC& // Since we switched from MM_ANISOTROPIC to MM_TEXT mapping mode // we have to apply rescaled DC's device origin to Cairo context. ApplyTransformFromDC(dc, Apply_scaled_dev_origin); -#endif // __WXMSW__ - -#ifdef __WXGTK20__ +#elif defined(__WXGTK20__) const wxDCImpl *impl = dc.GetImpl(); cairo_t* cr = static_cast(impl->GetCairoContext()); Init(cr ? cairo_reference(cr) : NULL); @@ -1930,6 +1928,9 @@ wxCairoContext::wxCairoContext( wxGraphicsRenderer* renderer, const wxPrinterDC& // Transfer transformation settings from source DC to Cairo context. ApplyTransformFromDC(dc); +#else + #warning "Constructing wxCairoContext from wxPrinterDC not implemented." + wxUnusedVar(dc); #endif } #endif From 698c356050c0aa0647396f92ab21dc4a10480942 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 6 Jul 2020 12:57:14 +0200 Subject: [PATCH 09/31] Fix -Wwrite-strings warning in non-Pango wxFontEnumerator code Don't convert wxString::c_str() to decltype(wxT("*")), which is non-const "wchar_t *". Just pass wxString to Printf() directly instead, this is simpler and more efficient anyhow. --- src/unix/fontenum.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/unix/fontenum.cpp b/src/unix/fontenum.cpp index f28eca94df..3de33cfeeb 100644 --- a/src/unix/fontenum.cpp +++ b/src/unix/fontenum.cpp @@ -282,7 +282,7 @@ bool wxFontEnumerator::EnumerateEncodings(const wxString& family) #else wxString pattern; pattern.Printf(wxT("-*-%s-*-*-*-*-*-*-*-*-*-*-*-*"), - family.empty() ? wxT("*") : family.c_str()); + family.empty() ? wxString("*") : family); // get the list of all fonts int nFonts; From 7c268092bd1bef2cefc9702aca1c8f3106e9ddfa Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 6 Jul 2020 13:03:09 +0200 Subject: [PATCH 10/31] Avoid an unused variable warning in wxUIActionSimulatorX11 This happens in wxMotif build, where this class probably doesn't work anyhow, so just suppress it. --- src/unix/uiactionx11.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/unix/uiactionx11.cpp b/src/unix/uiactionx11.cpp index 62640b0a3c..aaee4eaf56 100644 --- a/src/unix/uiactionx11.cpp +++ b/src/unix/uiactionx11.cpp @@ -172,7 +172,11 @@ protected: return; focus = (Window)(win->GetHandle()); - #endif // __WXGTK__ + #else + // We probably need to do something similar here for the other ports, + // but for now just avoid the warning about an unused variable. + wxUnusedVar(win); + #endif // platform wxLogTrace("focus", "SetInputFocusToXWindow on Window 0x%ul.", focus); From 3004e594b93538be5d326dccae10639dbd452307 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 6 Jul 2020 13:04:18 +0200 Subject: [PATCH 11/31] Replace deprecated wxDEFAULT with wxFONTFAMILY_DEFAULT in wxMotif Just avoid a -Wdeprecated-declarations warning. --- src/motif/font.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/motif/font.cpp b/src/motif/font.cpp index 0fafa047b2..519afe68cb 100644 --- a/src/motif/font.cpp +++ b/src/motif/font.cpp @@ -171,7 +171,7 @@ void wxFontRefData::Init(double pointSize, const wxString& faceName, wxFontEncoding encoding) { - if (family == wxDEFAULT) + if (family == wxFONTFAMILY_DEFAULT) m_family = wxFONTFAMILY_SWISS; else m_family = family; From 655b343246bc9ed5d066d7499d04932de0d7ced3 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 6 Jul 2020 13:06:03 +0200 Subject: [PATCH 12/31] Avoid unused variable warning in wxRibbon with wxUSE_TOOLTIPS==0 --- src/ribbon/buttonbar.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/ribbon/buttonbar.cpp b/src/ribbon/buttonbar.cpp index f4648c6a87..7e631d88a0 100644 --- a/src/ribbon/buttonbar.cpp +++ b/src/ribbon/buttonbar.cpp @@ -1303,6 +1303,8 @@ void wxRibbonButtonBar::OnMouseMove(wxMouseEvent& evt) { SetToolTip(tooltipButton->base->help_string); } +#else + wxUnusedVar(tooltipButton); #endif if(new_hovered != m_hovered_button || (m_hovered_button != NULL && From 42108c64f6fd9f88035a1d68802e245aa0a5b924 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 6 Jul 2020 13:06:57 +0200 Subject: [PATCH 13/31] Avoid warnings about literals-to-char* conversions in wxMotif Suppress -Wwrite-strings warnings. --- src/motif/toplevel.cpp | 2 +- src/motif/window.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/motif/toplevel.cpp b/src/motif/toplevel.cpp index 248b5465c1..a3458c64a7 100644 --- a/src/motif/toplevel.cpp +++ b/src/motif/toplevel.cpp @@ -118,7 +118,7 @@ bool wxTopLevelWindowMotif::Create( wxWindow *parent, wxWindowID id, // Intercept CLOSE messages from the window manager Widget shell = (Widget)GetShellWidget(); Atom WM_DELETE_WINDOW = XmInternAtom( XtDisplay( shell ), - "WM_DELETE_WINDOW", False ); + (char*)"WM_DELETE_WINDOW", False ); // Remove and add WM_DELETE_WINDOW so ours is only handler // This only appears to be necessary for wxDialog, but does not hurt diff --git a/src/motif/window.cpp b/src/motif/window.cpp index 023770f093..523ac5afe3 100644 --- a/src/motif/window.cpp +++ b/src/motif/window.cpp @@ -2608,7 +2608,7 @@ void wxGetTextExtent(const wxWindow* window, const wxString& str, if (table == NULL) table = XmeGetDefaultRenderTable(w, XmTEXT_RENDER_TABLE); - rendition = XmRenderTableGetRendition( table, "" ); + rendition = XmRenderTableGetRendition( table, (char*)"" ); XtSetArg( args[count], XmNfont, 0 ); ++count; XtSetArg( args[count], XmNfontType, 0 ); ++count; XmRenditionRetrieve( rendition, args, count ); From b91d3e35cf3be24fe5ed263dd86d42869e5b4f62 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 6 Jul 2020 13:13:35 +0200 Subject: [PATCH 14/31] Only use -Werror for building, not configuring Use of -Werror results in failures of configure tests that should normally succeed, e.g. testing for va_copy() when cross-compiling for iOS, so don't do it and just enable -Werror for building our own code. --- build/tools/travis-ci.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/build/tools/travis-ci.sh b/build/tools/travis-ci.sh index 9b691d3fab..2f711ca42d 100755 --- a/build/tools/travis-ci.sh +++ b/build/tools/travis-ci.sh @@ -56,7 +56,6 @@ case $wxTOOLSET in ;; *) echo 'travis_fold:start:configure' - [ "$wxALLOW_WARNINGS" = 1 ] || export CXXFLAGS='-Werror -Wno-error=cpp' echo 'Configuring...' ./configure --disable-optimise --disable-debug_info $wxCONFIGURE_FLAGS || rc=$? if [ -n "$rc" ]; then @@ -68,6 +67,8 @@ case $wxTOOLSET in fi echo 'travis_fold:end:configure' + [ "$wxALLOW_WARNINGS" = 1 ] || export CXXFLAGS='-Werror -Wno-error=cpp' + echo 'travis_fold:start:building' echo 'Building...' make -k $wxBUILD_ARGS From cb9e1f4ac09bb83b6762c1a75dac7987c550b77b Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 6 Jul 2020 17:45:03 +0200 Subject: [PATCH 15/31] Only notify about Travis build status for the main repository It's annoying to receive notifications about build status in the forks. --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 7e990d75a8..d0169e2cad 100644 --- a/.travis.yml +++ b/.travis.yml @@ -101,6 +101,7 @@ branches: notifications: email: + if: repo = wxWidgets/wxWidgets recipients: - vadim@wxwidgets.org on_success: change From 76e16ad372c6ad6ec33a501ec35e3ce5e7be9189 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 6 Jul 2020 17:45:34 +0200 Subject: [PATCH 16/31] Remove deprecated "sudo" key from Travis CI configuration This doesn't seem to do anything any more. --- .travis.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index d0169e2cad..b20de6dc0e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,7 +3,6 @@ # It is used automatically for the repositories on Github if it's found in the # root directory of the project. language: cpp -sudo: required matrix: include: From 4cb949d9b55e14b51821383d46eceed210747dd2 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 6 Jul 2020 17:45:58 +0200 Subject: [PATCH 17/31] Use "jobs" synonym for the old "matrix" keyword for Travis CI Get rid of another validator notice. --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index b20de6dc0e..3462e1cc09 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,7 +4,7 @@ # root directory of the project. language: cpp -matrix: +jobs: include: - dist: trusty compiler: gcc From cfaec20ae319f34abfcb5e395dacc48ae77e112a Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 6 Jul 2020 17:50:39 +0200 Subject: [PATCH 18/31] Specify default Travis CI build platform explicitly This doesn't really change anything right now, as Ubuntu Xenial is used by default anyhow, but removes the last message from the validator at https://config.travis-ci.com/explore so still worth having. --- .travis.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.travis.yml b/.travis.yml index 3462e1cc09..f689f123a9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,6 +4,10 @@ # root directory of the project. language: cpp +# Specify the default platform. +os: linux +dist: xenial + jobs: include: - dist: trusty From c4152869f525977c1827df7775f3d3cff4ffb197 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 6 Jul 2020 15:34:30 +0200 Subject: [PATCH 19/31] Split wxMAKEFILE_FLAGS in separate CXX/LDFLAGS variables This will allow appending extra CXXFLAGS to use with make in the upcoming commit. --- .travis.yml | 2 +- build/tools/travis-ci.sh | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index d73bc85e50..f372103130 100644 --- a/.travis.yml +++ b/.travis.yml @@ -21,7 +21,7 @@ matrix: name: wxGTK 2 UTF-8 Ubuntu 18.04 - dist: bionic compiler: gcc - env: wxGTK_VERSION=3 wxCONFIGURE_FLAGS="--enable-cxx11 --enable-stl --disable-webview" wxMAKEFILE_FLAGS="CXXFLAGS=-std=c++11 LDFLAGS=-Wl,--no-as-needed" wxUSE_XVFB=1 + env: wxGTK_VERSION=3 wxCONFIGURE_FLAGS="--enable-cxx11 --enable-stl --disable-webview" wxMAKEFILE_CXXFLAGS=-std=c++11 wxMAKEFILE_LDFLAGS=-Wl,--no-as-needed wxUSE_XVFB=1 name: wxGTK 3 STL Ubuntu 18.04 - dist: bionic compiler: clang diff --git a/build/tools/travis-ci.sh b/build/tools/travis-ci.sh index 2f711ca42d..6858ef60d8 100755 --- a/build/tools/travis-ci.sh +++ b/build/tools/travis-ci.sh @@ -69,6 +69,13 @@ case $wxTOOLSET in [ "$wxALLOW_WARNINGS" = 1 ] || export CXXFLAGS='-Werror -Wno-error=cpp' + if [ -n "$wxMAKEFILE_CXXFLAGS" ]; then + wxMAKEFILE_FLAGS="CXXFLAGS=$wxMAKEFILE_CXXFLAGS" + fi + if [ -n "$wxMAKEFILE_LDFLAGS" ]; then + wxMAKEFILE_FLAGS="$wxMAKEFILE_FLAGS LDFLAGS=$wxMAKEFILE_LDFLAGS" + fi + echo 'travis_fold:start:building' echo 'Building...' make -k $wxBUILD_ARGS From 437b8eebec50645c54f4fe51aa9a042801585e43 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 6 Jul 2020 15:36:41 +0200 Subject: [PATCH 20/31] Pass -Werror on make command line Setting CXXFLAGS=-Werror in the environment wasn't enough, it was still overridden by the empty CXXFLAGS in the makefile. Ideal would be to get rid of the empty flags there, but for now override them on make command line explicitly. --- build/tools/travis-ci.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/build/tools/travis-ci.sh b/build/tools/travis-ci.sh index 6858ef60d8..adb2ddc8d6 100755 --- a/build/tools/travis-ci.sh +++ b/build/tools/travis-ci.sh @@ -67,7 +67,11 @@ case $wxTOOLSET in fi echo 'travis_fold:end:configure' - [ "$wxALLOW_WARNINGS" = 1 ] || export CXXFLAGS='-Werror -Wno-error=cpp' + if [ "$wxALLOW_WARNINGS" != 1 ]; then + error_opts="-Werror -Wno-error=cpp" + wxMAKEFILE_CXXFLAGS="$wxMAKEFILE_CXXFLAGS $error_opts" + wxMAKEFILE_ERROR_CXXFLAGS="CXXFLAGS=$error_opts" + fi if [ -n "$wxMAKEFILE_CXXFLAGS" ]; then wxMAKEFILE_FLAGS="CXXFLAGS=$wxMAKEFILE_CXXFLAGS" @@ -78,7 +82,7 @@ case $wxTOOLSET in echo 'travis_fold:start:building' echo 'Building...' - make -k $wxBUILD_ARGS + make -k $wxBUILD_ARGS $wxMAKEFILE_ERROR_CXXFLAGS echo 'travis_fold:end:building' echo 'travis_fold:start:tests' From 85ad131adbf56308918c46c1827f2d57a11d8116 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 6 Jul 2020 15:37:38 +0200 Subject: [PATCH 21/31] Fix not handling #warning as errors for clang clang uses "#warnings" warning category instead of "cpp" as gcc does and complains about unknown "cpp" warning option if we use it with it. --- build/tools/travis-ci.sh | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/build/tools/travis-ci.sh b/build/tools/travis-ci.sh index adb2ddc8d6..81722a2017 100755 --- a/build/tools/travis-ci.sh +++ b/build/tools/travis-ci.sh @@ -68,7 +68,21 @@ case $wxTOOLSET in echo 'travis_fold:end:configure' if [ "$wxALLOW_WARNINGS" != 1 ]; then - error_opts="-Werror -Wno-error=cpp" + case "$TRAVIS_COMPILER" in + clang) + allow_warn_opt="-Wno-error=#warnings" + ;; + + gcc) + allow_warn_opt="-Wno-error=cpp" + ;; + + *) + echo "*** Unknown compiler: $TRAVIS_COMPILER ***" + ;; + esac + + error_opts="-Werror $allow_warn_opt" wxMAKEFILE_CXXFLAGS="$wxMAKEFILE_CXXFLAGS $error_opts" wxMAKEFILE_ERROR_CXXFLAGS="CXXFLAGS=$error_opts" fi From a4c1e542aaa2e86e7b16aecccbd5078dd266a29b Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 6 Jul 2020 15:38:18 +0200 Subject: [PATCH 22/31] Use makefile flags when building the samples too This will notably detect all warnings in them. --- build/tools/travis-ci.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/tools/travis-ci.sh b/build/tools/travis-ci.sh index 81722a2017..b804e53bef 100755 --- a/build/tools/travis-ci.sh +++ b/build/tools/travis-ci.sh @@ -129,7 +129,7 @@ case $wxTOOLSET in echo 'travis_fold:start:samples' echo 'Building samples...' - (test "$wxSKIP_SAMPLES" && echo 'SKIPPED') || make -k samples + (test "$wxSKIP_SAMPLES" && echo 'SKIPPED') || make -k $wxMAKEFILE_FLAGS samples echo 'travis_fold:end:samples' echo 'travis_fold:start:install' From 1cdfdcc3a846aa7ed0cf31e45c09728ab1d456e1 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 6 Jul 2020 17:08:38 +0200 Subject: [PATCH 23/31] Allow warnings in iOS build, there are too many of them Mostly there are warnings about unused parameters because of unimplemented functionality, but we don't have a simple way to disable just those, so just don't use -Werror with this build at all. --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index f372103130..0cd5c11766 100644 --- a/.travis.yml +++ b/.travis.yml @@ -47,7 +47,7 @@ matrix: name: wxOSX Xcode 11.3 - os: osx osx_image: xcode11.4 - env: wxCONFIGURE_FLAGS="--enable-monolithic --with-cxx=17 --host=i686-apple-darwin_sim --build=x86_64-apple-darwin17.7.0 --with-osx_iphone --with-macosx-version-min=10.0 --with-macosx-sdk=$(xcrun --sdk iphonesimulator --show-sdk-path) --enable-stl --disable-sys-libs" wxSKIP_GUI=1 wxSKIP_TESTING=1 wxSKIP_SAMPLES=1 + env: wxCONFIGURE_FLAGS="--enable-monolithic --with-cxx=17 --host=i686-apple-darwin_sim --build=x86_64-apple-darwin17.7.0 --with-osx_iphone --with-macosx-version-min=10.0 --with-macosx-sdk=$(xcrun --sdk iphonesimulator --show-sdk-path) --enable-stl --disable-sys-libs" wxALLOW_WARNINGS=1 wxSKIP_GUI=1 wxSKIP_TESTING=1 wxSKIP_SAMPLES=1 name: wxOSX iOS Xcode 11.4 - os: osx osx_image: xcode11.4 From eaee5416cf5a05d6dbf65132a62383838b1343bd Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 6 Jul 2020 17:18:43 +0200 Subject: [PATCH 24/31] Remove unused PangoContext variable from X11 code It's has been there since basically always, but seems to never have been used, so remove it to avoid warnings. --- src/x11/pango_x.cpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/x11/pango_x.cpp b/src/x11/pango_x.cpp index f7b7903558..41d320224b 100644 --- a/src/x11/pango_x.cpp +++ b/src/x11/pango_x.cpp @@ -96,12 +96,9 @@ x11_draw_layout_line_with_colors( Drawable drawable, PangoRectangle overall_rect; PangoRectangle logical_rect; PangoRectangle ink_rect; - PangoContext *context; gint x_off = 0; gint rise = 0; - context = pango_layout_get_context (line->layout); - pango_layout_line_get_extents (line,NULL, &overall_rect); GSList *tmp_list = line->runs; From 6119a7c6303b5ccb4ba26800002e391e23263a9b Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 6 Jul 2020 17:22:25 +0200 Subject: [PATCH 25/31] Suppress warnings about deprecated pango_xft_get_context() We can still use it as long as it exists, there is no benefit whatsoever in using the new functions as the old one does exactly the same thing anyhow. --- src/x11/app.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/x11/app.cpp b/src/x11/app.cpp index b7c8a12636..6b88ce9e96 100644 --- a/src/x11/app.cpp +++ b/src/x11/app.cpp @@ -721,8 +721,16 @@ PangoContext* wxApp::GetPangoContext() Display *dpy = wxGlobalDisplay(); int xscreen = DefaultScreen(dpy); + // Calling pango_xft_get_context() is exactly the same as doing + // pango_font_map_create_context(pango_xft_get_font_map(dpy, xscreen)) + // so continue to use it even if it's deprecated to not bother with + // checking for Pango 1.2 in configure and just disable the warning. + wxGCC_WARNING_SUPPRESS(deprecated-declarations) + s_pangoContext = pango_xft_get_context(dpy, xscreen); + wxGCC_WARNING_RESTORE(deprecated-declarations) + if (!PANGO_IS_CONTEXT(s_pangoContext)) { wxLogError( wxT("No pango context.") ); From b1f5203a084c20339caeef8059a3208eb1f78ac0 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 6 Jul 2020 17:25:20 +0200 Subject: [PATCH 26/31] Add an explicit #warning for missing dashes support in wxX11 wxDC This is better than warnings about unused dash-related variables. --- src/x11/dcclient.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/x11/dcclient.cpp b/src/x11/dcclient.cpp index 4ffef1b17e..b3f7d8c8c5 100644 --- a/src/x11/dcclient.cpp +++ b/src/x11/dcclient.cpp @@ -1965,6 +1965,10 @@ void wxWindowDCImpl::SetPen( const wxPen &pen ) } } + wxUnusedVar(req_dash); + wxUnusedVar(req_nb_dash); + #warning "TODO: support for dashed lines in wxX11" + int capStyle = CapRound; switch (m_pen.GetCap()) { From 80ba460b1f0ee34c1643a6e6bb1e6fcee8e503b7 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 6 Jul 2020 17:25:57 +0200 Subject: [PATCH 27/31] Suppress unused parameter warning in wxX11 It seems better to keep it for consistency, as all the other functions take both Drawable and GC, but it isn't being used in this particular function. --- src/x11/pango_x.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/x11/pango_x.cpp b/src/x11/pango_x.cpp index 41d320224b..ead07fc387 100644 --- a/src/x11/pango_x.cpp +++ b/src/x11/pango_x.cpp @@ -57,7 +57,7 @@ x11_pango_get_item_properties( PangoItem *item, void x11_draw_glyphs( Drawable drawable, - GC gc, + GC WXUNUSED(gc), PangoFont *font, int x, int y, From 589e043358c6058cb8f0cc013931f63b72cd7155 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 6 Jul 2020 17:30:13 +0200 Subject: [PATCH 28/31] Add an explicit warning about missing OpenGL support in wxQt This is better than a bunch of warnings about unused parameters due to many wxGLCanvas methods being just empty stubs. --- src/qt/glcanvas.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/qt/glcanvas.cpp b/src/qt/glcanvas.cpp index f89645c014..4cd442504c 100644 --- a/src/qt/glcanvas.cpp +++ b/src/qt/glcanvas.cpp @@ -14,6 +14,9 @@ #include +#warning "OpenGL support is not implemented in wxQt" +wxGCC_WARNING_SUPPRESS(unused-parameter) + class wxQtGLWidget : public wxQtEventSignalHandler< QGLWidget, wxGLCanvas > { public: From 403884e1d8828785343d6a2c3c2477481702ce1e Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 6 Jul 2020 17:38:11 +0200 Subject: [PATCH 29/31] Fix quoting of CXXFLAGS passed to make Use arrays to simplify passing CXXFLAGS and LDFLAGS, both of them may contain spaces, separately on make command line. Simpler solution of just using individual variable doesn't work because of bash/POSIX word splitting behaviour (zsh should be blamed for spoiling me with its much more reasonable behaviour and allowing me to forget about this insanity in the first place). In principle, we could work around this by temporarily resetting IFS, but using arrays is arguably more clear and this script already uses bashisms, in spite of its shebang line. --- build/tools/travis-ci.sh | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/build/tools/travis-ci.sh b/build/tools/travis-ci.sh index b804e53bef..37eb8b94f6 100755 --- a/build/tools/travis-ci.sh +++ b/build/tools/travis-ci.sh @@ -84,25 +84,28 @@ case $wxTOOLSET in error_opts="-Werror $allow_warn_opt" wxMAKEFILE_CXXFLAGS="$wxMAKEFILE_CXXFLAGS $error_opts" - wxMAKEFILE_ERROR_CXXFLAGS="CXXFLAGS=$error_opts" + wxMAKEFILE_ERROR_CXXFLAGS=("CXXFLAGS=$error_opts") + else + wxMAKEFILE_ERROR_CXXFLAGS=() fi + wxMAKEFILE_FLAGS=() if [ -n "$wxMAKEFILE_CXXFLAGS" ]; then - wxMAKEFILE_FLAGS="CXXFLAGS=$wxMAKEFILE_CXXFLAGS" + wxMAKEFILE_FLAGS+=("CXXFLAGS=$wxMAKEFILE_CXXFLAGS") fi if [ -n "$wxMAKEFILE_LDFLAGS" ]; then - wxMAKEFILE_FLAGS="$wxMAKEFILE_FLAGS LDFLAGS=$wxMAKEFILE_LDFLAGS" + wxMAKEFILE_FLAGS+=("LDFLAGS=$wxMAKEFILE_LDFLAGS") fi echo 'travis_fold:start:building' echo 'Building...' - make -k $wxBUILD_ARGS $wxMAKEFILE_ERROR_CXXFLAGS + make -k $wxBUILD_ARGS "${wxMAKEFILE_ERROR_CXXFLAGS[@]}" echo 'travis_fold:end:building' echo 'travis_fold:start:tests' echo 'Building tests...' [ "$wxSKIP_GUI" = 1 ] || make -C tests $wxBUILD_ARGS failtest - make -k -C tests $wxBUILD_ARGS $wxMAKEFILE_FLAGS + make -k -C tests $wxBUILD_ARGS "${wxMAKEFILE_FLAGS[@]}" echo 'travis_fold:end:tests' if [ "$wxSKIP_TESTING" = 1 ]; then @@ -129,7 +132,7 @@ case $wxTOOLSET in echo 'travis_fold:start:samples' echo 'Building samples...' - (test "$wxSKIP_SAMPLES" && echo 'SKIPPED') || make -k $wxMAKEFILE_FLAGS samples + (test "$wxSKIP_SAMPLES" && echo 'SKIPPED') || make -k "${wxMAKEFILE_FLAGS[@]}" samples echo 'travis_fold:end:samples' echo 'travis_fold:start:install' @@ -140,7 +143,7 @@ case $wxTOOLSET in echo 'travis_fold:start:testinstall' echo 'Testing installation...' make -C samples/minimal -f makefile.unx clean - make -C samples/minimal -f makefile.unx $wxMAKEFILE_FLAGS + make -C samples/minimal -f makefile.unx "${wxMAKEFILE_FLAGS[@]}" echo 'travis_fold:end:testinstall' ;; esac From 30582f4be4f09406e3afab6ca09267c84de8c1d9 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Tue, 7 Jul 2020 02:38:21 +0200 Subject: [PATCH 30/31] Disable OpenGL support in wxQt build It's not implemented anyhow and results in warnings about GK_GLEXT_VERSION redefinition due to include both the standard GL/glext.h and Qt QtGui/qopenglext.h (which seems to be a slightly different version of the same file). This probably should be fixed by not including GL/gl.h at all, but for now just disable it. --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 0cd5c11766..791fc8e4ee 100644 --- a/.travis.yml +++ b/.travis.yml @@ -67,7 +67,7 @@ matrix: name: wxMotif Ubuntu 18.04 - dist: bionic compiler: gcc - env: wxCONFIGURE_FLAGS="--with-qt --enable-pch" wxSKIP_SAMPLES=1 + env: wxCONFIGURE_FLAGS="--with-qt --enable-pch --without-opengl" wxSKIP_SAMPLES=1 name: wxQt Ubuntu 18.04 - os: linux arch: arm64 From 9fde10f53ee6e5ddd60ab7e394ce2adad4cb1cad Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Tue, 7 Jul 2020 12:43:12 +0200 Subject: [PATCH 31/31] Use #!/bin/bash for Travis build script which requires bash It uses arithmetic expansion and, now, arrays, neither of which exists in POSIX sh. --- .travis.yml | 2 +- build/tools/travis-ci.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 791fc8e4ee..3003776be8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -108,4 +108,4 @@ notifications: before_install: ./build/tools/before_install.sh -script: bash build/tools/travis-ci.sh +script: ./build/tools/travis-ci.sh diff --git a/build/tools/travis-ci.sh b/build/tools/travis-ci.sh index 37eb8b94f6..2fc69fc6a8 100755 --- a/build/tools/travis-ci.sh +++ b/build/tools/travis-ci.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # # This script is used by Travis CI to configure, build and test wxWidgets