Lunchbox
1.17.0
Multi-threaded C++ toolbox library for all application developers creating high-performance multi-threaded programs.
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
compiler.h
1
2
/* Copyright (c) 2010-2017, Stefan Eilemann <eile@eyescale.ch>
3
*
4
* This library is free software; you can redistribute it and/or modify it under
5
* the terms of the GNU Lesser General Public License version 2.1 as published
6
* by the Free Software Foundation.
7
*
8
* This library is distributed in the hope that it will be useful, but WITHOUT
9
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
10
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
11
* details.
12
*
13
* You should have received a copy of the GNU Lesser General Public License
14
* along with this library; if not, write to the Free Software Foundation, Inc.,
15
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16
*/
17
18
#pragma once
19
20
#ifdef __cplusplus
21
#include <boost/config.hpp>
22
#endif
23
// align macros
24
#ifdef _MSC_VER
25
#define LB_ALIGN8(var) __declspec(align(8)) var;
26
#define LB_ALIGN16(var) __declspec(align(16)) var;
27
#elif defined(__GNUC__)
28
#define LB_ALIGN8(var) var __attribute__((aligned(8)));
29
#define LB_ALIGN16(var) var __attribute__((aligned(16)));
30
#define LB_UNUSED __attribute__((unused))
31
#define LB_LIKELY(x) __builtin_expect((x), 1)
32
#define LB_UNLIKELY(x) __builtin_expect((x), 0)
33
#ifdef WARN_DEPRECATED // Set CMake option COMMON_WARN_DEPRECATED
34
#define LB_DEPRECATED __attribute__((deprecated))
35
#endif
36
#if ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 0)))
37
#define LB_GCC_4_0_OR_LATER
38
#endif
39
#if ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 1)))
40
#define LB_GCC_4_1_OR_LATER
41
#endif
42
#if ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 2)))
43
#define LB_GCC_4_2_OR_LATER
44
#endif
45
#if ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3)))
46
#define LB_GCC_4_3_OR_LATER
47
#endif
48
#if ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)))
49
#define LB_GCC_4_4_OR_LATER
50
#endif
51
#if ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 5)))
52
#define LB_GCC_4_5_OR_LATER
53
#endif
54
#if ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)))
55
#define LB_GCC_4_6_OR_LATER
56
#endif
57
#if ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)))
58
#define LB_GCC_4_7_OR_LATER
59
#endif
60
#if ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 8)))
61
#define LB_GCC_4_8_OR_LATER
62
#endif
63
#if ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 9)))
64
#define LB_GCC_4_9_OR_LATER
65
#endif
66
#if ((__GNUC__ < 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ < 3)))
67
#define LB_GCC_4_3_OR_OLDER
68
#endif
69
70
#if ((__GNUC__ == 4) && (__GNUC_MINOR__ == 2))
71
#define LB_GCC_4_2
72
#endif
73
#if ((__GNUC__ == 4) && (__GNUC_MINOR__ == 3))
74
#define LB_GCC_4_3
75
#endif
76
#if ((__GNUC__ == 4) && (__GNUC_MINOR__ == 4))
77
#define LB_GCC_4_4
78
#endif
79
#if ((__GNUC__ == 4) && (__GNUC_MINOR__ == 5))
80
#define LB_GCC_4_5
81
#endif
82
#if ((__GNUC__ == 4) && (__GNUC_MINOR__ == 6))
83
#define LB_GCC_4_6
84
#endif
85
#if ((__GNUC__ == 4) && (__GNUC_MINOR__ == 7))
86
#define LB_GCC_4_7
87
#endif
88
#if ((__GNUC__ == 4) && (__GNUC_MINOR__ == 8))
89
#define LB_GCC_4_8
90
#endif
91
#if ((__GNUC__ == 4) && (__GNUC_MINOR__ == 9))
92
#define LB_GCC_4_9
93
#endif
94
#else
95
#warning Unknown compiler, taking guesses
96
#define LB_ALIGN8(var) var __attribute__((aligned(8)));
97
#define LB_ALIGN16(var) var __attribute__((aligned(16)));
98
#endif // GCC
99
100
#ifndef LB_UNUSED
101
#define LB_UNUSED
102
#endif
103
#ifndef LB_LIKELY
104
#define LB_LIKELY(x) x
105
#define LB_UNLIKELY(x) x
106
#endif
107
#ifndef LB_PUSH_DEPRECATED
108
#ifdef LB_DEPRECATED
109
#define LB_PUSH_DEPRECATED \
110
_Pragma("clang diagnostic push") \
111
_Pragma("clang diagnostic ignored \"-Wdeprecated-declarations\"") \
112
_Pragma("GCC diagnostic push") _Pragma( \
113
"GCC diagnostic ignored \"-Wdeprecated-declarations\"")
114
115
#define LB_POP_DEPRECATED \
116
_Pragma("clang diagnostic pop") _Pragma("GCC diagnostic pop")
117
#else
118
#define LB_DEPRECATED
119
#define LB_PUSH_DEPRECATED
120
#define LB_POP_DEPRECATED
121
#endif
122
#endif
install
include
lunchbox
compiler.h
Generated on Wed Oct 3 2018 05:33:12 for Lunchbox by
1.8.11