Thrill  0.1
defines.hpp
Go to the documentation of this file.
1 /*******************************************************************************
2  * thrill/common/defines.hpp
3  *
4  * Define macros.
5  *
6  * Part of Project Thrill - http://project-thrill.org
7  *
8  * Copyright (C) 2015 Timo Bingmann <[email protected]>
9  *
10  * All rights reserved. Published under the BSD-2 license in the LICENSE file.
11  ******************************************************************************/
12 
13 #pragma once
14 #ifndef THRILL_COMMON_DEFINES_HEADER
15 #define THRILL_COMMON_DEFINES_HEADER
16 
17 #include <type_traits>
18 
19 namespace thrill {
20 namespace common {
21 
22 /******************************************************************************/
23 // detect ThreadSanitizer
24 
25 #ifndef THRILL_HAVE_THREAD_SANITIZER
26 
27 #if defined(__has_feature)
28 
29 // this works with clang
30 #if __has_feature(thread_sanitizer)
31 #define THRILL_HAVE_THREAD_SANITIZER 1
32 #else
33 #define THRILL_HAVE_THREAD_SANITIZER 0
34 #endif
35 
36 #else
37 
38 // gcc's sanitizers cannot be detected?
39 #define THRILL_HAVE_THREAD_SANITIZER 0
40 
41 #endif
42 
43 #endif // THRILL_HAVE_THREAD_SANITIZER
44 
45 /******************************************************************************/
46 // std::is_trivially_copyable<T> work-around for libstdc++ < 5.0
47 
48 #if defined(__GLIBCXX__)
49 template <typename T>
51  : std::integral_constant<bool, __has_trivial_copy(T)> { }; // NOLINT
52 #else // GLIBCXX work-around
53 template <typename T>
54 using is_trivially_copyable = std::is_trivially_copyable<T>;
55 #endif
56 
57 } // namespace common
58 } // namespace thrill
59 
60 #endif // !THRILL_COMMON_DEFINES_HEADER
61 
62 /******************************************************************************/
std::is_trivially_copyable< T > is_trivially_copyable
Definition: defines.hpp:54