Merge branches 'travis-warning-errors' and 'travis-cleanup'

Fail CI builds if any warnings (other than those given by an explicit
preprocessor #warning directive) are encountered.

Also cleanup Travis config a bit.

See https://github.com/wxWidgets/wxWidgets/pull/1933,
    https://github.com/wxWidgets/wxWidgets/pull/1935
This commit is contained in:
Vadim Zeitlin
2020-07-07 12:45:58 +02:00
15 changed files with 83 additions and 28 deletions

View File

@@ -3,9 +3,12 @@
# It is used automatically for the repositories on Github if it's found in the # It is used automatically for the repositories on Github if it's found in the
# root directory of the project. # root directory of the project.
language: cpp language: cpp
sudo: required
matrix: # Specify the default platform.
os: linux
dist: xenial
jobs:
include: include:
- dist: trusty - dist: trusty
compiler: gcc compiler: gcc
@@ -21,7 +24,7 @@ matrix:
name: wxGTK 2 UTF-8 Ubuntu 18.04 name: wxGTK 2 UTF-8 Ubuntu 18.04
- dist: bionic - dist: bionic
compiler: gcc 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 name: wxGTK 3 STL Ubuntu 18.04
- dist: bionic - dist: bionic
compiler: clang compiler: clang
@@ -47,7 +50,7 @@ matrix:
name: wxOSX Xcode 11.3 name: wxOSX Xcode 11.3
- os: osx - os: osx
osx_image: xcode11.4 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 name: wxOSX iOS Xcode 11.4
- os: osx - os: osx
osx_image: xcode11.4 osx_image: xcode11.4
@@ -59,7 +62,7 @@ matrix:
name: wxX11 Ubuntu 18.04 name: wxX11 Ubuntu 18.04
- dist: bionic - dist: bionic
compiler: gcc 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 name: wxDFB Ubuntu 18.04
- dist: bionic - dist: bionic
compiler: gcc compiler: gcc
@@ -67,7 +70,7 @@ matrix:
name: wxMotif Ubuntu 18.04 name: wxMotif Ubuntu 18.04
- dist: bionic - dist: bionic
compiler: gcc 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 name: wxQt Ubuntu 18.04
- os: linux - os: linux
arch: arm64 arch: arm64
@@ -101,6 +104,7 @@ branches:
notifications: notifications:
email: email:
if: repo = wxWidgets/wxWidgets
recipients: recipients:
- vadim@wxwidgets.org - vadim@wxwidgets.org
on_success: change on_success: change
@@ -108,4 +112,4 @@ notifications:
before_install: ./build/tools/before_install.sh before_install: ./build/tools/before_install.sh
script: bash build/tools/travis-ci.sh script: ./build/tools/travis-ci.sh

View File

@@ -1,4 +1,4 @@
#!/bin/sh #!/bin/bash
# #
# This script is used by Travis CI to configure, build and test wxWidgets # This script is used by Travis CI to configure, build and test wxWidgets
@@ -67,15 +67,45 @@ case $wxTOOLSET in
fi fi
echo 'travis_fold:end:configure' 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 'travis_fold:start:building'
echo 'Building...' echo 'Building...'
make $wxBUILD_ARGS make -k $wxBUILD_ARGS "${wxMAKEFILE_ERROR_CXXFLAGS[@]}"
echo 'travis_fold:end:building' echo 'travis_fold:end:building'
echo 'travis_fold:start:tests' echo 'travis_fold:start:tests'
echo 'Building tests...' echo 'Building tests...'
[ "$wxSKIP_GUI" = 1 ] || make -C tests $wxBUILD_ARGS failtest [ "$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' echo 'travis_fold:end:tests'
if [ "$wxSKIP_TESTING" = 1 ]; then if [ "$wxSKIP_TESTING" = 1 ]; then
@@ -102,7 +132,7 @@ case $wxTOOLSET in
echo 'travis_fold:start:samples' echo 'travis_fold:start:samples'
echo 'Building 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:end:samples'
echo 'travis_fold:start:install' echo 'travis_fold:start:install'
@@ -113,7 +143,7 @@ case $wxTOOLSET in
echo 'travis_fold:start:testinstall' echo 'travis_fold:start:testinstall'
echo 'Testing installation...' echo 'Testing installation...'
make -C samples/minimal -f makefile.unx clean 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' echo 'travis_fold:end:testinstall'
;; ;;
esac esac

View File

@@ -241,7 +241,7 @@ public:
grid->SetCellValue(row, col, m_value); grid->SetCellValue(row, col, m_value);
} }
virtual wxGridCellEditor *Clone() const virtual wxGridCellEditor *Clone() const wxOVERRIDE
{ {
return new MyGridStarEditor(); return new MyGridStarEditor();
} }

View File

@@ -1917,9 +1917,7 @@ wxCairoContext::wxCairoContext( wxGraphicsRenderer* renderer, const wxPrinterDC&
// Since we switched from MM_ANISOTROPIC to MM_TEXT mapping mode // Since we switched from MM_ANISOTROPIC to MM_TEXT mapping mode
// we have to apply rescaled DC's device origin to Cairo context. // we have to apply rescaled DC's device origin to Cairo context.
ApplyTransformFromDC(dc, Apply_scaled_dev_origin); ApplyTransformFromDC(dc, Apply_scaled_dev_origin);
#endif // __WXMSW__ #elif defined(__WXGTK20__)
#ifdef __WXGTK20__
const wxDCImpl *impl = dc.GetImpl(); const wxDCImpl *impl = dc.GetImpl();
cairo_t* cr = static_cast<cairo_t*>(impl->GetCairoContext()); cairo_t* cr = static_cast<cairo_t*>(impl->GetCairoContext());
Init(cr ? cairo_reference(cr) : NULL); 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. // Transfer transformation settings from source DC to Cairo context.
ApplyTransformFromDC(dc); ApplyTransformFromDC(dc);
#else
#warning "Constructing wxCairoContext from wxPrinterDC not implemented."
wxUnusedVar(dc);
#endif #endif
} }
#endif #endif

View File

@@ -171,7 +171,7 @@ void wxFontRefData::Init(double pointSize,
const wxString& faceName, const wxString& faceName,
wxFontEncoding encoding) wxFontEncoding encoding)
{ {
if (family == wxDEFAULT) if (family == wxFONTFAMILY_DEFAULT)
m_family = wxFONTFAMILY_SWISS; m_family = wxFONTFAMILY_SWISS;
else else
m_family = family; m_family = family;

View File

@@ -118,7 +118,7 @@ bool wxTopLevelWindowMotif::Create( wxWindow *parent, wxWindowID id,
// Intercept CLOSE messages from the window manager // Intercept CLOSE messages from the window manager
Widget shell = (Widget)GetShellWidget(); Widget shell = (Widget)GetShellWidget();
Atom WM_DELETE_WINDOW = XmInternAtom( XtDisplay( shell ), 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 // Remove and add WM_DELETE_WINDOW so ours is only handler
// This only appears to be necessary for wxDialog, but does not hurt // This only appears to be necessary for wxDialog, but does not hurt

View File

@@ -2608,7 +2608,7 @@ void wxGetTextExtent(const wxWindow* window, const wxString& str,
if (table == NULL) if (table == NULL)
table = XmeGetDefaultRenderTable(w, XmTEXT_RENDER_TABLE); table = XmeGetDefaultRenderTable(w, XmTEXT_RENDER_TABLE);
rendition = XmRenderTableGetRendition( table, "" ); rendition = XmRenderTableGetRendition( table, (char*)"" );
XtSetArg( args[count], XmNfont, 0 ); ++count; XtSetArg( args[count], XmNfont, 0 ); ++count;
XtSetArg( args[count], XmNfontType, 0 ); ++count; XtSetArg( args[count], XmNfontType, 0 ); ++count;
XmRenditionRetrieve( rendition, args, count ); XmRenditionRetrieve( rendition, args, count );

View File

@@ -14,6 +14,9 @@
#include <QtOpenGL/QGLWidget> #include <QtOpenGL/QGLWidget>
#warning "OpenGL support is not implemented in wxQt"
wxGCC_WARNING_SUPPRESS(unused-parameter)
class wxQtGLWidget : public wxQtEventSignalHandler< QGLWidget, wxGLCanvas > class wxQtGLWidget : public wxQtEventSignalHandler< QGLWidget, wxGLCanvas >
{ {
public: public:

View File

@@ -1303,6 +1303,8 @@ void wxRibbonButtonBar::OnMouseMove(wxMouseEvent& evt)
{ {
SetToolTip(tooltipButton->base->help_string); SetToolTip(tooltipButton->base->help_string);
} }
#else
wxUnusedVar(tooltipButton);
#endif #endif
if(new_hovered != m_hovered_button || (m_hovered_button != NULL && if(new_hovered != m_hovered_button || (m_hovered_button != NULL &&

View File

@@ -62,6 +62,10 @@ wxCompareFamilies (const void *a, const void *b)
bool wxFontEnumerator::EnumerateFacenames(wxFontEncoding encoding, bool wxFontEnumerator::EnumerateFacenames(wxFontEncoding encoding,
bool fixedWidthOnly) 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 ) if ( encoding != wxFONTENCODING_SYSTEM && encoding != wxFONTENCODING_UTF8 )
{ {
// Pango supports only UTF-8 encoding (and system means any, so we // Pango supports only UTF-8 encoding (and system means any, so we
@@ -278,7 +282,7 @@ bool wxFontEnumerator::EnumerateEncodings(const wxString& family)
#else #else
wxString pattern; wxString pattern;
pattern.Printf(wxT("-*-%s-*-*-*-*-*-*-*-*-*-*-*-*"), pattern.Printf(wxT("-*-%s-*-*-*-*-*-*-*-*-*-*-*-*"),
family.empty() ? wxT("*") : family.c_str()); family.empty() ? wxString("*") : family);
// get the list of all fonts // get the list of all fonts
int nFonts; int nFonts;

View File

@@ -172,7 +172,11 @@ protected:
return; return;
focus = (Window)(win->GetHandle()); 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); wxLogTrace("focus", "SetInputFocusToXWindow on Window 0x%ul.", focus);

View File

@@ -721,8 +721,16 @@ PangoContext* wxApp::GetPangoContext()
Display *dpy = wxGlobalDisplay(); Display *dpy = wxGlobalDisplay();
int xscreen = DefaultScreen(dpy); 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); s_pangoContext = pango_xft_get_context(dpy, xscreen);
wxGCC_WARNING_RESTORE(deprecated-declarations)
if (!PANGO_IS_CONTEXT(s_pangoContext)) if (!PANGO_IS_CONTEXT(s_pangoContext))
{ {
wxLogError( wxT("No pango context.") ); wxLogError( wxT("No pango context.") );

View File

@@ -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; int capStyle = CapRound;
switch (m_pen.GetCap()) switch (m_pen.GetCap())
{ {

View File

@@ -57,7 +57,7 @@ x11_pango_get_item_properties( PangoItem *item,
void void
x11_draw_glyphs( Drawable drawable, x11_draw_glyphs( Drawable drawable,
GC gc, GC WXUNUSED(gc),
PangoFont *font, PangoFont *font,
int x, int x,
int y, int y,
@@ -96,12 +96,9 @@ x11_draw_layout_line_with_colors( Drawable drawable,
PangoRectangle overall_rect; PangoRectangle overall_rect;
PangoRectangle logical_rect; PangoRectangle logical_rect;
PangoRectangle ink_rect; PangoRectangle ink_rect;
PangoContext *context;
gint x_off = 0; gint x_off = 0;
gint rise = 0; gint rise = 0;
context = pango_layout_get_context (line->layout);
pango_layout_line_get_extents (line,NULL, &overall_rect); pango_layout_line_get_extents (line,NULL, &overall_rect);
GSList *tmp_list = line->runs; GSList *tmp_list = line->runs;

View File

@@ -24,7 +24,6 @@
#endif // WX_PRECOMP #endif // WX_PRECOMP
#include "wx/scopedptr.h" #include "wx/scopedptr.h"
#include "wx/scopeguard.h"
#include "wx/uiaction.h" #include "wx/uiaction.h"
#if wxUSE_CLIPBOARD #if wxUSE_CLIPBOARD
@@ -290,8 +289,7 @@ void TextCtrlTestCase::StreamInput()
#ifndef __WXOSX__ #ifndef __WXOSX__
{ {
// Ensure we use decimal point and not a comma. // Ensure we use decimal point and not a comma.
char * const locOld = setlocale(LC_NUMERIC, "C"); LocaleSetter setCLocale("C");
wxON_BLOCK_EXIT2( setlocale, (int)LC_NUMERIC, locOld );
*m_text << "stringinput" *m_text << "stringinput"
<< 10 << 10