Try using -Wsuggest-override in the CI builds

This is a useful warning and we want to ensure that wx compiles cleanly
with it.

Note that it can't be used for gcc < 11 (it is supported by it since 5.1
but there are tons of false positives for the macros from wx/rtti.h with
the older versions) and only relatively recent clang supports this
gcc-compatible option.
This commit is contained in:
Vadim Zeitlin
2025-05-20 16:48:01 +02:00
parent de68f5bee0
commit 813d36f024
3 changed files with 7 additions and 3 deletions

View File

@@ -105,21 +105,25 @@ jobs:
container: ubuntu:20.04
compiler: clang++-10
configure_flags: --disable-sys-libs
extra_warnings: -Winconsistent-missing-override
use_xvfb: true
- name: Ubuntu 22.04 wxGTK with wx containers
runner: ubuntu-22.04
configure_flags: --enable-compat30 --disable-std_containers
extra_warnings: -Wsuggest-override
use_xvfb: true
check_headers: true
- name: Ubuntu 24.04 wxGTK with ASAN
runner: ubuntu-24.04
configure_flags: --disable-compat32 --disable-sys-libs
extra_warnings: -Wsuggest-override
skip_samples: true
use_asan: true
use_xvfb: true
- name: Ubuntu 24.04 wxGTK with UBSAN
runner: ubuntu-24.04
configure_flags: --with-cxx=20
extra_warnings: -Wsuggest-override
use_ubsan: true
use_xvfb: true
build_out_of_tree_samples: true
@@ -270,7 +274,7 @@ jobs:
if [ -z ${{ matrix.allow_warnings }} ]; then
if [ -z ${{ matrix.allow_extra_warnings }} ]; then
error_opts="-Wextra"
error_opts="-Wextra ${{ matrix.extra_warnings }}"
fi
error_opts="$error_opts -Werror $allow_warn_opt"
echo "wxMAKEFILE_ERROR_CXXFLAGS=$error_opts" >> $GITHUB_ENV

View File

@@ -141,7 +141,7 @@ jobs:
;;
esac
if [ -z ${{ matrix.allow_warnings }} ]; then
error_opts="-Werror $allow_warn_opt"
error_opts="-Werror -Wsuggest-override $allow_warn_opt"
echo "wxMAKEFILE_ERROR_CXXFLAGS=$error_opts" >> $GITHUB_ENV
echo "wxMAKEFILE_CXXFLAGS=$wxMAKEFILE_CXXFLAGS $error_opts" >> $GITHUB_ENV
fi

View File

@@ -176,7 +176,7 @@ jobs:
cmake -G "MinGW Makefiles" \
-DCMAKE_C_COMPILER=clang.exe \
-DCMAKE_CXX_COMPILER=clang++.exe \
-DCMAKE_CXX_FLAGS=-Werror \
-DCMAKE_CXX_FLAGS="-Werror -Wsuggest-override" \
-DCMAKE_BUILD_TYPE=Release \
-DwxBUILD_SAMPLES=ALL \
-DwxBUILD_TESTS=ALL \