Disable inconsistent missing override warnings in qa mocks

turtlemocks doesn't seem to provide a way to annotate that these methods
override a base class method, so it triggers a lot of warnings about
missing override when the classes are instantiated.
This commit is contained in:
Ian McInerney 2022-09-24 02:11:41 +01:00
parent c71c192372
commit b8ef9ec178
4 changed files with 31 additions and 0 deletions

View File

@ -52,6 +52,10 @@ if( CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
if( COMPILER_SUPPORTS_WINCONSISTENT_MISSING_OVERRIDE )
set( WARN_FLAGS_CXX "${WARN_FLAGS_CXX} -Winconsistent-missing-override" )
# Also use this to guard warning removal of the warning inside the code
set( HAVE_WINCONSISTENT_MISSING_OVERRIDE true )
message( STATUS "Enabling warning -Winconsistent-missing-override" )
endif()

View File

@ -52,6 +52,9 @@
// Does the compiler support the -Wimplicit-int-float-conversion warning
#cmakedefine HAVE_WIMPLICIT_FLOAT_CONVERSION
// Does the compiler support the -Winconsistent-missing-override
#cmakedefine HAVE_WINCONSISTENT_MISSING_OVERRIDE
// Use Posix getc_unlocked() instead of getc() when it's available.
#cmakedefine HAVE_FGETC_NOLOCK

View File

@ -24,6 +24,14 @@
#pragma once
#include <qa_utils/wx_utils/unit_test_utils.h>
#include <kiface_base.h>
#include <config.h>
// Suppress a warning that the mock methods don't override the base class methods because
// turtlemocks doesn't seem to provide a way to actually annotate the methods with override.
#ifdef HAVE_WINCONSISTENT_MISSING_OVERRIDE
_Pragma( "GCC diagnostic push" ) \
_Pragma( "GCC diagnostic ignored \"-Winconsistent-missing-override\"" )
#endif
MOCK_BASE_CLASS( MOCK_KIFACE_BASE, KIFACE_BASE )
{
@ -35,3 +43,7 @@ MOCK_BASE_CLASS( MOCK_KIFACE_BASE, KIFACE_BASE )
MOCK_METHOD( CreateWindow, 4, wxWindow*( wxWindow*, int, KIWAY*, int ) );
MOCK_METHOD( IfaceOrAddress, 1, void*( int ) );
};
#ifdef HAVE_WINCONSISTENT_MISSING_OVERRIDE
_Pragma( "GCC diagnostic pop" )
#endif

View File

@ -24,6 +24,14 @@
#pragma once
#include <qa_utils/wx_utils/unit_test_utils.h>
#include <pgm_base.h>
#include <config.h>
// Suppress a warning that the mock methods don't override the base class methods because
// turtlemocks doesn't seem to provide a way to actually annotate the methods with override.
#ifdef HAVE_WINCONSISTENT_MISSING_OVERRIDE
_Pragma( "GCC diagnostic push" ) \
_Pragma( "GCC diagnostic ignored \"-Winconsistent-missing-override\"" )
#endif
MOCK_BASE_CLASS( MOCK_PGM_BASE, PGM_BASE )
{
@ -62,3 +70,7 @@ MOCK_BASE_CLASS( MOCK_PGM_BASE, PGM_BASE )
// MOCK_CONST_METHOD( GetExecutablePath, 0, const wxString&() );
// MOCK_METHOD( GetSettingsManager, 0, SETTINGS_MANAGER&() );
};
#ifdef HAVE_WINCONSISTENT_MISSING_OVERRIDE
_Pragma( "GCC diagnostic pop" )
#endif