forked from Mirrors/openclonk
gcc: build fixes
parent
c551d67956
commit
7465fb057a
|
@ -64,6 +64,8 @@ if(CMAKE_COMPILER_IS_GNUCXX)
|
|||
if(USE_GCC_STD_0X)
|
||||
list(APPEND OC_CXX_FLAGS "-std=gnu++0x")
|
||||
endif()
|
||||
# isilkor 10-10-04: disable a useless warning
|
||||
list(APPEND OC_CXX_FLAGS "-Wno-non-template-friend")
|
||||
endif()
|
||||
|
||||
# ck 09-09-20: CMAKE_REQUIRED_FLAGS requires a string, not a list.
|
||||
|
@ -79,8 +81,8 @@ set(SAFE_CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}")
|
|||
set(CMAKE_REQUIRED_FLAGS ${OC_REQUIRED_FLAGS})
|
||||
CHECK_CXX_SOURCE_COMPILES("void f(struct D&&); int main() { return 0; }" HAVE_RVALUE_REF)
|
||||
CHECK_CXX_SOURCE_COMPILES("int main() { void *d = nullptr; }" HAVE_NULLPTR)
|
||||
set(CMAKE_REQUIRED_FLAGS "${SAFE_CMAKE_REQUIRED_FLAGS}")
|
||||
CHECK_CXX_SOURCE_COMPILES("int main() { static_assert(true, \"\"); }" HAVE_STATIC_ASSERT)
|
||||
set(CMAKE_REQUIRED_FLAGS "${SAFE_CMAKE_REQUIRED_FLAGS}")
|
||||
|
||||
if(MSVC_VERSION GREATER 1499)
|
||||
# Activate minimal rebuild
|
||||
|
@ -701,6 +703,11 @@ if(NOT Boost_INCLUDE_DIR)
|
|||
message(SEND_ERROR "Could not find the Boost C++ Libraries")
|
||||
else()
|
||||
include_directories(SYSTEM ${Boost_INCLUDE_DIR})
|
||||
set(CMAKE_REQUIRED_INCLUDES ${Boost_INCLUDE_DIR})
|
||||
CHECK_CXX_SOURCE_COMPILES("
|
||||
#include <boost/type_traits/is_pod.hpp>
|
||||
struct Pod {}; struct NonPod { NonPod() {} };
|
||||
int main() { int a[boost::is_pod<Pod>::value * 2 - 1], b[1 - 2 * boost::is_pod<NonPod>::value]; }" HAVE_WORKING_IS_POD)
|
||||
endif()
|
||||
|
||||
include(FindThreads)
|
||||
|
|
|
@ -194,3 +194,5 @@
|
|||
/* Define to 1 if your compiler supports static_assert */
|
||||
#cmakedefine HAVE_STATIC_ASSERT 1
|
||||
|
||||
/* Define to 1 if your compiler correctly supports boost::is_pod */
|
||||
#cmakedefine HAVE_WORKING_IS_POD 1
|
||||
|
|
|
@ -54,6 +54,8 @@
|
|||
#include <C4GameControl.h>
|
||||
#include <C4MeshAnimation.h>
|
||||
|
||||
#include <limits>
|
||||
|
||||
//========================== Some Support Functions =======================================
|
||||
|
||||
const long MaxFnStringParLen=500;
|
||||
|
@ -5894,7 +5896,7 @@ static Nillable<int> FnInt(C4AulContext *ctx, C4Real f)
|
|||
{
|
||||
if (f < std::numeric_limits<int>::min() || f > std::numeric_limits<int>::max())
|
||||
return C4VNull;
|
||||
return f;
|
||||
return static_cast<int>(f);
|
||||
}
|
||||
|
||||
static C4Real FnFloat(C4AulContext *ctx, int i)
|
||||
|
|
|
@ -142,7 +142,9 @@ public:
|
|||
struct StorageTypeSelector<T, boost::true_type> { typename T::StorageType v; };
|
||||
|
||||
typedef StorageTypeSelector<C4RealImpl, typename boost::is_class<C4RealImpl>::type> StorageType;
|
||||
#ifdef HAVE_WORKING_IS_POD
|
||||
static_assert(boost::is_pod<StorageType>::value, "C4RealBase: StorageType is not a POD type");
|
||||
#endif
|
||||
|
||||
friend bool operator==(StorageType lhs, StorageType rhs) { return lhs.v == rhs.v; }
|
||||
|
||||
|
|
|
@ -109,8 +109,8 @@ C4RealImpl_SSE C4RealImpl_SSE::SinCos(bool cosine) const
|
|||
// and 360 deg
|
||||
// relative error less than 1.2e-7 between -260 deg and 260 deg.
|
||||
// absolute error less than 6.0e-8 between -4.2e7 and 4.2e7 deg.
|
||||
assert(float_radians == 0.0f || std::abs((rv.f[sinidx] - std::sinf(float_radians)) / std::sinf(float_radians)) < 1.1e-6f);
|
||||
assert(float_radians == 0.0f || std::abs((rv.f[cosidx] - std::cosf(float_radians)) / std::cosf(float_radians)) < 1.1e-6f);
|
||||
assert(float_radians == 0.0f || std::abs((rv.f[sinidx] - std::sin(float_radians)) / std::sin(float_radians)) < 1.1e-6f);
|
||||
assert(float_radians == 0.0f || std::abs((rv.f[cosidx] - std::cos(float_radians)) / std::cos(float_radians)) < 1.1e-6f);
|
||||
|
||||
uint32_t cosine_mask = cosine * ~0;
|
||||
int idx = (cosine_mask & cosidx) | (~cosine_mask & sinidx);
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#include <stdlib.h>
|
||||
#include <ctype.h>
|
||||
#include <C4Log.h>
|
||||
#include <limits>
|
||||
|
||||
// *** StdCompiler
|
||||
|
||||
|
|
Loading…
Reference in New Issue