Only try to remove the implicit conversion warning if it is supported
This commit is contained in:
parent
f7156a9d49
commit
b5adf5bb21
|
@ -160,4 +160,11 @@ if( CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
|
||||||
message( STATUS "Enabling warning -Wmismatched-tags" )
|
message( STATUS "Enabling warning -Wmismatched-tags" )
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
# See if the compiler will throw warnings on these conversions
|
||||||
|
CHECK_CXX_COMPILER_FLAG( "-Wimplicit-int-float-conversion" COMPILER_SUPPORTS_WIMPLICIT_FLOAT_CONVERSION )
|
||||||
|
|
||||||
|
if( COMPILER_SUPPORTS_WIMPLICIT_FLOAT_CONVERSION )
|
||||||
|
# This one is different, it is used to guard warning removal for this inside the code
|
||||||
|
set( HAVE_WIMPLICIT_FLOAT_CONVERSION true )
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
|
@ -49,6 +49,9 @@
|
||||||
#define strncasecmp strnicmp
|
#define strncasecmp strnicmp
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Does the compiler support the -Wimplicit-int-float-conversion warning
|
||||||
|
#cmakedefine HAVE_WIMPLICIT_FLOAT_CONVERSION
|
||||||
|
|
||||||
// Use Posix getc_unlocked() instead of getc() when it's available.
|
// Use Posix getc_unlocked() instead of getc() when it's available.
|
||||||
#cmakedefine HAVE_FGETC_NOLOCK
|
#cmakedefine HAVE_FGETC_NOLOCK
|
||||||
|
|
||||||
|
|
|
@ -36,6 +36,7 @@ target_link_libraries( kimath
|
||||||
)
|
)
|
||||||
|
|
||||||
target_include_directories( kimath PUBLIC
|
target_include_directories( kimath PUBLIC
|
||||||
|
${PROJECT_BINARY_DIR}
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/include
|
${CMAKE_CURRENT_SOURCE_DIR}/include
|
||||||
$<TARGET_PROPERTY:clipper,INTERFACE_INCLUDE_DIRECTORIES>
|
$<TARGET_PROPERTY:clipper,INTERFACE_INCLUDE_DIRECTORIES>
|
||||||
$<TARGET_PROPERTY:othermath,INTERFACE_INCLUDE_DIRECTORIES>
|
$<TARGET_PROPERTY:othermath,INTERFACE_INCLUDE_DIRECTORIES>
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
#ifndef UTIL_H
|
#ifndef UTIL_H
|
||||||
#define UTIL_H
|
#define UTIL_H
|
||||||
|
|
||||||
|
#include <config.h>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <limits>
|
#include <limits>
|
||||||
#include <typeinfo>
|
#include <typeinfo>
|
||||||
|
@ -53,7 +54,7 @@ template <typename T> inline const T& Clamp( const T& lower, const T& value, con
|
||||||
}
|
}
|
||||||
|
|
||||||
// Surpress an annoying warning that the explicit rounding we do is not precise
|
// Surpress an annoying warning that the explicit rounding we do is not precise
|
||||||
#if defined( __GNUC__ ) || defined( __CLANG__ )
|
#ifdef HAVE_WIMPLICIT_FLOAT_CONVERSION
|
||||||
_Pragma( "GCC diagnostic push" ) \
|
_Pragma( "GCC diagnostic push" ) \
|
||||||
_Pragma( "GCC diagnostic ignored \"-Wimplicit-int-float-conversion\"" )
|
_Pragma( "GCC diagnostic ignored \"-Wimplicit-int-float-conversion\"" )
|
||||||
#endif
|
#endif
|
||||||
|
@ -80,7 +81,7 @@ constexpr ret_type KiROUND( fp_type v )
|
||||||
return ret_type( max_ret( ret ) );
|
return ret_type( max_ret( ret ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined( __GNUC__ ) || defined( __CLANG__ )
|
#ifdef HAVE_WIMPLICIT_FLOAT_CONVERSION
|
||||||
_Pragma( "GCC diagnostic pop" )
|
_Pragma( "GCC diagnostic pop" )
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -11,5 +11,6 @@ target_include_directories( othermath
|
||||||
# kiround is needed
|
# kiround is needed
|
||||||
target_include_directories( othermath
|
target_include_directories( othermath
|
||||||
PRIVATE
|
PRIVATE
|
||||||
|
${PROJECT_BINARY_DIR}
|
||||||
${PROJECT_SOURCE_DIR}/libs/kimath/include
|
${PROJECT_SOURCE_DIR}/libs/kimath/include
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue