diff --git a/CMakeLists.txt b/CMakeLists.txt index 09f2138da..ddca3741a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,8 +5,6 @@ project(Magnum) include(CMakeDependentOption) option(TARGET_GLES "Build for OpenGL ES 2 instead of desktop OpenGL" OFF) -option(GCC44_COMPATIBILITY "Enable compatibility mode for GCC 4.4 (might disable some features)" OFF) -option(GCC45_COMPATIBILITY "Enable compatibility mode for GCC 4.5 (might disable some features)" OFF) # Parts of the library option(WITH_EVERYTHING "Build everything (doesn't include contexts)" ON) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 2e3c445f2..bad14abd8 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -5,21 +5,10 @@ if(TARGET_GLES) set(MAGNUM_TARGET_GLES 1) endif() -if(GCC44_COMPATIBILITY) - set(MAGNUM_GCC44_COMPATIBILITY 1) - set(GCC45_COMPATIBILITY 1) -endif() - -if(GCC45_COMPATIBILITY) - set(MAGNUM_GCC45_COMPATIBILITY 1) -endif() - # -Wdouble-promotion is supported from GCC 4.6 # TODO: do this with check_c_compiler_flags() -if(NOT GCC45_COMPATIBILITY) - if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wdouble-promotion") - endif() +if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" AND NOT "${CMAKE_CXX_COMPILER_VERSION}" VERSION_LESS "4.6.0") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wdouble-promotion") endif() configure_file(${CMAKE_CURRENT_SOURCE_DIR}/magnumConfigure.h.cmake diff --git a/src/Math/Matrix4.h b/src/Math/Matrix4.h index 027107400..58b67c4fa 100644 --- a/src/Math/Matrix4.h +++ b/src/Math/Matrix4.h @@ -130,7 +130,7 @@ template class Matrix4: public Matrix<4, T> { /** @brief Rotation and scaling part of the matrix */ inline Matrix3 rotationScaling() const { - #ifndef MAGNUM_GCC45_COMPATIBILITY /* GCC 4.5 badly optimizes this */ + #ifndef CORRADE_GCC45_COMPATIBILITY /* GCC 4.5 badly optimizes this */ return Matrix3::from( (*this)[0].xyz(), (*this)[1].xyz(), @@ -146,7 +146,7 @@ template class Matrix4: public Matrix<4, T> { /** @brief Rotation part of the matrix */ inline Matrix3 rotation() const { return Matrix3::from( - #ifndef MAGNUM_GCC45_COMPATIBILITY /* GCC 4.5 badly optimizes this */ + #ifndef CORRADE_GCC45_COMPATIBILITY /* GCC 4.5 badly optimizes this */ (*this)[0].xyz().normalized(), (*this)[1].xyz().normalized(), (*this)[2].xyz().normalized()); diff --git a/src/MeshTools/Clean.h b/src/MeshTools/Clean.h index 76104fcb2..c0ed5ce2f 100644 --- a/src/MeshTools/Clean.h +++ b/src/MeshTools/Clean.h @@ -66,7 +66,7 @@ template class Clean { and index of vertex in the face. */ std::unordered_map, HashedVertex, IndexHash> table; - #ifndef MAGNUM_GCC44_COMPATIBILITY + #ifndef CORRADE_GCC44_COMPATIBILITY /* Reserve space for all vertices */ table.reserve(vertices.size()); #endif diff --git a/src/MeshTools/CompressIndices.h b/src/MeshTools/CompressIndices.h index d67eb9a4f..6aacfc7aa 100644 --- a/src/MeshTools/CompressIndices.h +++ b/src/MeshTools/CompressIndices.h @@ -38,7 +38,7 @@ class CompressIndices { CompressIndices(const std::vector& indices): indices(indices) {} inline std::tuple operator()() const { - #ifndef MAGNUM_GCC44_COMPATIBILITY + #ifndef CORRADE_GCC44_COMPATIBILITY return SizeBasedCall(*std::max_element(indices.begin(), indices.end()))(indices); #else return SizeBasedCall, Compressor>(*std::max_element(indices.begin(), indices.end()))(indices); diff --git a/src/SizeTraits.h b/src/SizeTraits.h index 0ee09348b..8cf305700 100644 --- a/src/SizeTraits.h +++ b/src/SizeTraits.h @@ -97,7 +97,7 @@ based on data size: bar = SizeBasedCall(dataSize)(arg1, arg2, ...); @endcode */ -#ifndef MAGNUM_GCC44_COMPATIBILITY +#ifndef CORRADE_GCC44_COMPATIBILITY template struct SizeBasedCall: public Base { #else template struct SizeBasedCall: public Base { @@ -117,10 +117,10 @@ template struct SizeBasedCall: public Base { * is no suitable type for indexing given data size, prints message to * error output and returns default-constructed value. */ - #ifndef MAGNUM_GCC45_COMPATIBILITY + #ifndef CORRADE_GCC45_COMPATIBILITY template auto operator()(Args&&... arguments) -> decltype(Base::template run(std::forward(arguments)...)) { #else - #ifdef MAGNUM_GCC44_COMPATIBILITY + #ifdef CORRADE_GCC44_COMPATIBILITY template Return operator()(Args&& arguments) { #else template auto operator()(Args&& arguments) -> decltype(Base::template run(std::forward(arguments))) { @@ -128,20 +128,20 @@ template struct SizeBasedCall: public Base { #endif switch(Math::log(256, size)) { case 0: - #ifndef MAGNUM_GCC45_COMPATIBILITY + #ifndef CORRADE_GCC45_COMPATIBILITY return Base::template run(std::forward(arguments)...); #else return Base::template run(std::forward(arguments)); #endif case 1: - #ifndef MAGNUM_GCC45_COMPATIBILITY + #ifndef CORRADE_GCC45_COMPATIBILITY return Base::template run(std::forward(arguments)...); #else return Base::template run(std::forward(arguments)); #endif case 2: case 3: - #ifndef MAGNUM_GCC45_COMPATIBILITY + #ifndef CORRADE_GCC45_COMPATIBILITY return Base::template run(std::forward(arguments)...); #else return Base::template run(std::forward(arguments)); @@ -149,10 +149,10 @@ template struct SizeBasedCall: public Base { } Error() << "SizeBasedCall: no type able to index" << size << "elements."; - #ifndef MAGNUM_GCC45_COMPATIBILITY + #ifndef CORRADE_GCC45_COMPATIBILITY return decltype(Base::template run(std::forward(arguments)...))(); #else - #ifdef MAGNUM_GCC44_COMPATIBILITY + #ifdef CORRADE_GCC44_COMPATIBILITY return Return(); #else return decltype(Base::template run(std::forward(arguments)))(); diff --git a/src/Test/SwizzleTest.cpp b/src/Test/SwizzleTest.cpp index 765bdb9eb..fe9562135 100644 --- a/src/Test/SwizzleTest.cpp +++ b/src/Test/SwizzleTest.cpp @@ -52,7 +52,7 @@ void SwizzleTest::rgba() { void SwizzleTest::fromSmall() { /* Force compile-time evaluation for both */ constexpr Vector2 orig(1, 2); - #ifndef MAGNUM_GCC45_COMPATIBILITY + #ifndef CORRADE_GCC45_COMPATIBILITY CORRADE_VERIFY((integral_constant::value)); #endif CORRADE_COMPARE((swizzle<'g', 'x', 'r'>(orig)), Vector3(2, 1, 1)); diff --git a/src/magnumCompatibility.h b/src/magnumCompatibility.h index 311430e9e..70a8de0ed 100644 --- a/src/magnumCompatibility.h +++ b/src/magnumCompatibility.h @@ -17,7 +17,7 @@ #include "magnumConfigure.h" -#ifdef MAGNUM_GCC45_COMPATIBILITY +#ifdef CORRADE_GCC45_COMPATIBILITY #define constexpr #define nullptr 0 #endif diff --git a/src/magnumConfigure.h.cmake b/src/magnumConfigure.h.cmake index 6f1b1af54..9e8a3c7e8 100644 --- a/src/magnumConfigure.h.cmake +++ b/src/magnumConfigure.h.cmake @@ -1,3 +1 @@ #cmakedefine MAGNUM_TARGET_GLES -#cmakedefine MAGNUM_GCC44_COMPATIBILITY -#cmakedefine MAGNUM_GCC45_COMPATIBILITY