InspIRCd  3.0
compat.h
1 /*
2  * InspIRCd -- Internet Relay Chat Daemon
3  *
4  * Copyright (C) 2013-2014, 2017 Sadie Powell <[email protected]>
5  * Copyright (C) 2013-2014, 2016 Attila Molnar <[email protected]>
6  *
7  * This file is part of InspIRCd. InspIRCd is free software: you can
8  * redistribute it and/or modify it under the terms of the GNU General Public
9  * License as published by the Free Software Foundation, version 2.
10  *
11  * This program is distributed in the hope that it will be useful, but WITHOUT
12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13  * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
14  * details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program. If not, see <http://www.gnu.org/licenses/>.
18  */
19 
20 
21 #pragma once
22 
27 #if defined _LIBCPP_VERSION || defined _WIN32
28 # define TR1NS std
29 # include <array>
30 # include <functional>
31 # include <unordered_map>
32 # include <type_traits>
33 #else
34 # define TR1NS std::tr1
35 # include <tr1/array>
36 # include <tr1/functional>
37 # include <tr1/unordered_map>
38 # include <tr1/type_traits>
39 #endif
40 
46 #if defined __clang__ || defined __GNUC__
47 # define CUSTOM_PRINTF(stringpos, firstpos) __attribute__((format(printf, stringpos, firstpos)))
48 #else
49 # define CUSTOM_PRINTF(stringpos, firstpos)
50 #endif
51 
56 #if __cplusplus >= 201103L
57 # define HAS_CXX11_FINAL_OVERRIDE
58 #elif defined __clang__
59 # if __has_feature(cxx_override_control)
60 # define HAS_CXX11_FINAL_OVERRIDE
61 # endif
62 #elif (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 7)
63 # if defined __GXX_EXPERIMENTAL_CXX0X__
64 # define HAS_CXX11_FINAL_OVERRIDE
65 # endif
66 #elif _MSC_VER >= 1700
67 # define HAS_CXX11_FINAL_OVERRIDE
68 #endif
69 
70 #if defined HAS_CXX11_FINAL_OVERRIDE
71 # define CXX11_FINAL final
72 # define CXX11_OVERRIDE override
73 #else
74 # define CXX11_FINAL
75 # define CXX11_OVERRIDE
76 #endif
77 
82 #if defined __clang__ || defined __GNUC__
83 # define DEPRECATED_METHOD(function) function __attribute__((deprecated))
84 #elif defined _MSC_VER
85 # define DEPRECATED_METHOD(function) __declspec(deprecated) function
86 #else
87 # define DEPRECATED_METHOD(function) function
88 #endif
89 
94 #if defined _WIN32
95 # include "inspircd_win32wrapper.h"
96 # include "threadengines/threadengine_win32.h"
97 #else
98 # define ENTRYPOINT int main(int argc, char** argv)
99 # define DllExport __attribute__ ((visibility ("default")))
100 # define CoreExport __attribute__ ((visibility ("default")))
101 # include <unistd.h>
102 # include "threadengines/threadengine_pthread.h"
103 #endif