diff --git a/CMakeLists.txt b/CMakeLists.txt index 3a06a4a..9f41eae 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -24,7 +24,6 @@ set(C4CORE_SRC_FILES c4/char_traits.hpp c4/common.hpp c4/compiler.hpp - c4/compat/gcc-4.8.hpp c4/config.hpp c4/cpu.hpp c4/ctor_dtor.hpp diff --git a/cmake b/cmake index 43d47f9..3719823 160000 --- a/cmake +++ b/cmake @@ -1 +1 @@ -Subproject commit 43d47f9f53f8b989337ec80095c02ee5350bacaf +Subproject commit 371982300ff5a076d7c3199057ebed77bbe3472f diff --git a/compat.cmake b/compat.cmake index 184eab3..186b84e 100644 --- a/compat.cmake +++ b/compat.cmake @@ -4,12 +4,13 @@ if((CMAKE_CXX_COMPILER_ID STREQUAL "GNU") AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 4.8) AND (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0)) - # header injection, required to compile external projects (not necessary for c4core) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -include ${CMAKE_CURRENT_SOURCE_DIR}/src/c4/compat/gcc-4.8.hpp") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -include ${CMAKE_CURRENT_SOURCE_DIR}/src/c4/compat/gcc-4.8.hpp") + c4_install_files( + "${CMAKE_CURRENT_LIST_DIR}/cmake/compat/c4/gcc-4.8.hpp" + "include" + "${CMAKE_CURRENT_LIST_DIR}/cmake/compat") # c++17 compiler required set(C4CORE_BUILD_BENCHMARKS OFF CACHE BOOL "" FORCE) # LLVM required set(C4CORE_SANITIZE OFF CACHE BOOL "" FORCE) -endif() \ No newline at end of file +endif() diff --git a/src/c4/compat/gcc-4.8.hpp b/src/c4/compat/gcc-4.8.hpp deleted file mode 100644 index ede1442..0000000 --- a/src/c4/compat/gcc-4.8.hpp +++ /dev/null @@ -1,68 +0,0 @@ -#ifndef _C4_COMPAT_GCC_4_8_HPP_ -#define _C4_COMPAT_GCC_4_8_HPP_ - -#if __GNUC__ == 4 && __GNUC_MINOR__ >= 8 -/* STL polyfills for old GNU compilers */ - -_Pragma("GCC diagnostic ignored \"-Wshadow\"") - -#if __cplusplus -#include -#include - -namespace std { - -template -struct is_trivially_copyable : public integral_constant::value && __has_trivial_destructor(_Tp) && - (__has_trivial_constructor(_Tp) || __has_trivial_copy(_Tp) || __has_trivial_assign(_Tp))> -{ }; - -template -using is_trivially_copy_constructible = has_trivial_copy_constructor<_Tp>; - -template -using is_trivially_default_constructible = has_trivial_default_constructor<_Tp>; - -template -using is_trivially_copy_assignable = has_trivial_copy_assign<_Tp>; - -/* not supported */ -template -struct is_trivially_move_constructible : false_type -{ }; - -/* not supported */ -template -struct is_trivially_move_assignable : false_type -{ }; - -inline void *align(size_t __align, size_t __size, void*& __ptr, size_t& __space) noexcept -{ - if (__space < __size) - return nullptr; - const auto __intptr = reinterpret_cast(__ptr); - const auto __aligned = (__intptr - 1u + __align) & -__align; - const auto __diff = __aligned - __intptr; - if (__diff > (__space - __size)) - return nullptr; - else - { - __space -= __diff; - return __ptr = reinterpret_cast(__aligned); - } -} -typedef long double max_align_t ; - -} -#else // __cplusplus - -#include -// see https://sourceware.org/bugzilla/show_bug.cgi?id=25399 (ubuntu gcc-4.8) -#define memset(s, c, count) __builtin_memset(s, c, count) - -#endif // __cplusplus - -#endif // __GNUC__ == 4 && __GNUC_MINOR__ >= 8 - -#endif // _C4_COMPAT_GCC_4_8_HPP_ diff --git a/src/c4/compiler.hpp b/src/c4/compiler.hpp index 3f7ff1d..ba8e5b0 100644 --- a/src/c4/compiler.hpp +++ b/src/c4/compiler.hpp @@ -101,7 +101,8 @@ # endif # if __GNUC__ < 5 # if __GNUC__ == 4 && __GNUC_MINOR__ >= 8 -# include "c4/compat/gcc-4.8.hpp" +// provided by cmake sub-project +# include "c4/gcc-4.8.hpp" # else // we do not support GCC < 4.8: // * misses std::is_trivially_copyable diff --git a/tools/amalgamate.py b/tools/amalgamate.py index b9e3c4e..eabcb48 100644 --- a/tools/amalgamate.py +++ b/tools/amalgamate.py @@ -63,7 +63,7 @@ INSTRUCTIONS: "src/c4/cpu.hpp", "src/c4/compiler.hpp", am.injcode(required_gcc4_8_include), - "src/c4/compat/gcc-4.8.hpp", + "cmake/compat/c4/gcc-4.8.hpp", "src/c4/language.hpp", "src/c4/types.hpp", "src/c4/config.hpp",