mirror of
https://github.com/biojppm/c4core.git
synced 2026-01-18 13:31:19 +01:00
use gcc-4.8.hpp from cmake sub-project
This commit is contained in:
@@ -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
|
||||
|
||||
2
cmake
2
cmake
Submodule cmake updated: 43d47f9f53...371982300f
@@ -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()
|
||||
endif()
|
||||
|
||||
@@ -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 <cstdint>
|
||||
#include <type_traits>
|
||||
|
||||
namespace std {
|
||||
|
||||
template<typename _Tp>
|
||||
struct is_trivially_copyable : public integral_constant<bool,
|
||||
is_destructible<_Tp>::value && __has_trivial_destructor(_Tp) &&
|
||||
(__has_trivial_constructor(_Tp) || __has_trivial_copy(_Tp) || __has_trivial_assign(_Tp))>
|
||||
{ };
|
||||
|
||||
template<typename _Tp>
|
||||
using is_trivially_copy_constructible = has_trivial_copy_constructor<_Tp>;
|
||||
|
||||
template<typename _Tp>
|
||||
using is_trivially_default_constructible = has_trivial_default_constructor<_Tp>;
|
||||
|
||||
template<typename _Tp>
|
||||
using is_trivially_copy_assignable = has_trivial_copy_assign<_Tp>;
|
||||
|
||||
/* not supported */
|
||||
template<typename _Tp>
|
||||
struct is_trivially_move_constructible : false_type
|
||||
{ };
|
||||
|
||||
/* not supported */
|
||||
template<typename _Tp>
|
||||
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<uintptr_t>(__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<void*>(__aligned);
|
||||
}
|
||||
}
|
||||
typedef long double max_align_t ;
|
||||
|
||||
}
|
||||
#else // __cplusplus
|
||||
|
||||
#include <string.h>
|
||||
// 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_
|
||||
@@ -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
|
||||
|
||||
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user