diff --git a/.travis.yml b/.travis.yml index 7e990d75a8..4d770862a1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,9 +3,12 @@ # 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: +# Specify the default platform. +os: linux +dist: xenial + +jobs: include: - dist: trusty compiler: gcc @@ -21,7 +24,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 @@ -47,7 +50,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 @@ -59,7 +62,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 @@ -67,7 +70,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 @@ -101,6 +104,7 @@ branches: notifications: email: + if: repo = wxWidgets/wxWidgets recipients: - vadim@wxwidgets.org on_success: change @@ -108,4 +112,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 c618b08bbb..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 @@ -67,15 +67,45 @@ case $wxTOOLSET in fi echo 'travis_fold:end:configure' + if [ "$wxALLOW_WARNINGS" != 1 ]; then + 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") + else + wxMAKEFILE_ERROR_CXXFLAGS=() + fi + + wxMAKEFILE_FLAGS=() + if [ -n "$wxMAKEFILE_CXXFLAGS" ]; then + wxMAKEFILE_FLAGS+=("CXXFLAGS=$wxMAKEFILE_CXXFLAGS") + fi + if [ -n "$wxMAKEFILE_LDFLAGS" ]; then + wxMAKEFILE_FLAGS+=("LDFLAGS=$wxMAKEFILE_LDFLAGS") + fi + echo 'travis_fold:start:building' echo 'Building...' - make $wxBUILD_ARGS + 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 -C tests $wxBUILD_ARGS $wxMAKEFILE_FLAGS + make -k -C tests $wxBUILD_ARGS "${wxMAKEFILE_FLAGS[@]}" echo 'travis_fold:end:tests' if [ "$wxSKIP_TESTING" = 1 ]; then @@ -102,7 +132,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 "${wxMAKEFILE_FLAGS[@]}" samples echo 'travis_fold:end:samples' echo 'travis_fold:start:install' @@ -113,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 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(); } 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 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; 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 ); 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: 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 && diff --git a/src/unix/fontenum.cpp b/src/unix/fontenum.cpp index 01d4a61a75..3de33cfeeb 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 @@ -278,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; 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); 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.") ); 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()) { diff --git a/src/x11/pango_x.cpp b/src/x11/pango_x.cpp index f7b7903558..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, @@ -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; 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