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
commit a3f61f973d
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
# 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

View File

@ -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

View File

@ -241,7 +241,7 @@ public:
grid->SetCellValue(row, col, m_value);
}
virtual wxGridCellEditor *Clone() const
virtual wxGridCellEditor *Clone() const wxOVERRIDE
{
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
// 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<cairo_t*>(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

View File

@ -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;

View File

@ -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

View File

@ -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 );

View File

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

View File

@ -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 &&

View File

@ -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;

View File

@ -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);

View File

@ -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.") );

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;
switch (m_pen.GetCap())
{

View File

@ -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;

View File

@ -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