Enable warnings on msvc

This commit is contained in:
qu1ck 2023-02-17 18:13:10 -08:00 committed by Mark Roszko
parent 32a747374f
commit a6d10c8e97
5 changed files with 60 additions and 12 deletions

View File

@ -141,8 +141,8 @@ struct RAYSEG2D
bool IntersectSegment( const SFVEC2F &aStartA, const SFVEC2F &aEnd_minus_startA, bool IntersectSegment( const SFVEC2F &aStartA, const SFVEC2F &aEnd_minus_startA,
const SFVEC2F &aStartB, const SFVEC2F &aEnd_minus_startB ); const SFVEC2F &aStartB, const SFVEC2F &aEnd_minus_startB );
#if(GLM_ARCH != GLM_ARCH_PURE)
/* /*
#if(GLM_ARCH != GLM_ARCH_PURE)
struct RAY4 struct RAY4
{ {
glm::simdVec4 m_orgX; ///< x coordinate of ray origin glm::simdVec4 m_orgX; ///< x coordinate of ray origin
@ -155,9 +155,10 @@ struct RAY4
glm::simdVec4 m_tnear; ///< Start of ray segment glm::simdVec4 m_tnear; ///< Start of ray segment
glm::simdVec4 m_tfar; ///< End of ray segment glm::simdVec4 m_tfar; ///< End of ray segment
};*/ };
#endif #endif
*/
#endif // RAY_H #endif // RAY_H

View File

@ -21,7 +21,7 @@
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
# #
# Only configure warnings for Clang and GCC # Configure warnings for Clang and GCC
if( CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang" ) if( CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
# The SWIG-generated files tend to throw a lot of warnings, so # The SWIG-generated files tend to throw a lot of warnings, so
# we do not add the warnings directly to the flags here but instead # we do not add the warnings directly to the flags here but instead
@ -189,3 +189,54 @@ if( CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
endif() endif()
endif() endif()
# MSVC specific warnings
if( MSVC )
set( COMPILER_SUPPORTS_WARNINGS TRUE )
# Establish /Wall early and selectively disable some very common warnings in kicad code
# or warnings that really shouldn't be warnings. Also some warnings like implicit fallthrough
# in case statements happen in msvc std lib and despite /external:env:INCLUDE leak
# into build log generating thousands of noise entries.
# Unlike gcc /Wall actually enables all warnings on msvc.
# Warnings for C are not enabled since C files are mostly generated
# set( WARN_FLAGS_C "/external:W0 /external:env:INCLUDE /external:I${CMAKE_SOURCE_DIR}/thirdparty /Wall" )
set( WARN_FLAGS_CXX "/external:W0 /external:env:INCLUDE /external:I${CMAKE_SOURCE_DIR}/thirdparty /Wall" )
# disable "function not inlined"
string( APPEND WARN_FLAGS_CXX " /wd4710" )
# disable "bytes padding added"
string( APPEND WARN_FLAGS_CXX " /wd4820" )
# disable "unreferenced formal parameter"
string( APPEND WARN_FLAGS_CXX " /wd4100" )
# disable default/copy/move constructor/assignment implicitly defined as deleted
string( APPEND WARN_FLAGS_CXX " /wd4623 /wd4625 /wd5026 /wd4626 /wd5027" )
# disable "compiler will insert Spectre mitigation for..."
string( APPEND WARN_FLAGS_CXX " /wd5045" )
# disable "enumerator in switch for enum is not explicitly handled"
string( APPEND WARN_FLAGS_CXX " /wd4061" )
# disable "conversion from 'type_1' to 'type_2', signed/unsigned mismatch"
string( APPEND WARN_FLAGS_CXX " /wd4245 /wd4365" )
# disable "conversion from 'type1' to 'type2', possible loss of data"
string( APPEND WARN_FLAGS_CXX " /wd4242 /wd5219" )
# disable "no override available for virtual member function, function is hidden"
string( APPEND WARN_FLAGS_CXX " /wd4266" )
# disable "class has virtual functions, but its (non)trivial destructor is not virtual"
string( APPEND WARN_FLAGS_CXX " /wd5204 /wd4265" )
# disable "layout of class may have changed from a previous version of the compiler"
string( APPEND WARN_FLAGS_CXX " /wd4371" )
# disable "relative include path contains '..'"
string( APPEND WARN_FLAGS_CXX " /wd4464" )
# disable "'const' variable is not used"
string( APPEND WARN_FLAGS_CXX " /wd5264" )
# disable "implicit fall-through occurs here" in case statement
string( APPEND WARN_FLAGS_CXX " /wd5262" )
# disable "unreferenced inline function has been removed"
string( APPEND WARN_FLAGS_CXX " /wd4514" )
# disable "compiler may not enforce left-to-right evaluation order in ..."
string( APPEND WARN_FLAGS_CXX " /wd4868 /wd4866" )
# disable "XXX is not defined as a preprocessor macro, replacing with '0'"
string( APPEND WARN_FLAGS_CXX " /wd4668" )
endif()

View File

@ -82,6 +82,7 @@ static size_t stream_write_callback( void* aContents, size_t aSize, size_t aNmem
return realsize; return realsize;
} }
#if LIBCURL_VERSION_NUM >= 0x072000 // 7.32.0
static int xferinfo( void* aProgress, curl_off_t aDLtotal, curl_off_t aDLnow, curl_off_t aULtotal, static int xferinfo( void* aProgress, curl_off_t aDLtotal, curl_off_t aDLnow, curl_off_t aULtotal,
curl_off_t aULnow ) curl_off_t aULnow )
@ -100,12 +101,14 @@ static int xferinfo( void* aProgress, curl_off_t aDLtotal, curl_off_t aDLnow, cu
return CURLE_OK; return CURLE_OK;
} }
#if LIBCURL_VERSION_NUM < 0x072000 // 7.32.0 #else
static int progressinfo( void* aProgress, double aDLtotal, double aDLnow, double aULtotal, double aULnow ) static int progressinfo( void* aProgress, double aDLtotal, double aDLnow, double aULtotal, double aULnow )
{ {
return xferinfo( aProgress, static_cast<curl_off_t>( aDLtotal ), static_cast<curl_off_t>( aDLnow ), return xferinfo( aProgress, static_cast<curl_off_t>( aDLtotal ), static_cast<curl_off_t>( aDLnow ),
static_cast<curl_off_t>( aULtotal ), static_cast<curl_off_t>( aULnow ) ); static_cast<curl_off_t>( aULtotal ), static_cast<curl_off_t>( aULnow ) );
} }
#endif #endif

View File

@ -128,10 +128,3 @@ double CONSTANT_ZOOM_CONTROLLER::GetScaleForRotation( int aRotation )
return zoom_scale; return zoom_scale;
} }
// need these until C++17
constexpr ACCELERATING_ZOOM_CONTROLLER::TIMEOUT ACCELERATING_ZOOM_CONTROLLER::DEFAULT_TIMEOUT;
constexpr double CONSTANT_ZOOM_CONTROLLER::MAC_SCALE;
constexpr double CONSTANT_ZOOM_CONTROLLER::GTK3_SCALE;
constexpr double CONSTANT_ZOOM_CONTROLLER::MSW_SCALE;

View File

@ -264,7 +264,7 @@ public:
*/ */
char SetStringDelimiter( char aStringDelimiter ) char SetStringDelimiter( char aStringDelimiter )
{ {
int old = stringDelimiter; char old = stringDelimiter;
if( specctraMode ) if( specctraMode )
stringDelimiter = aStringDelimiter; stringDelimiter = aStringDelimiter;