Config.hpp
Go to the documentation of this file.
1 //
3 // Aurora C++ Library
4 // Copyright (c) 2012-2016 Jan Haller
5 //
6 // This software is provided 'as-is', without any express or implied
7 // warranty. In no event will the authors be held liable for any damages
8 // arising from the use of this software.
9 //
10 // Permission is granted to anyone to use this software for any purpose,
11 // including commercial applications, and to alter it and redistribute it
12 // freely, subject to the following restrictions:
13 //
14 // 1. The origin of this software must not be misrepresented; you must not
15 // claim that you wrote the original software. If you use this software
16 // in a product, an acknowledgment in the product documentation would be
17 // appreciated but is not required.
18 //
19 // 2. Altered source versions must be plainly marked as such, and must not be
20 // misrepresented as being the original software.
21 //
22 // 3. This notice may not be removed or altered from any source distribution.
23 //
25 
28 
29 #ifndef AURORA_CONFIG_HPP
30 #define AURORA_CONFIG_HPP
31 
32 
33 // Version of the library
34 #define AURORA_VERSION_MAJOR 1
35 #define AURORA_VERSION_MINOR 0
36 
37 
38 // Mislead doxygen to keep documentation clean from internals
39 #define AURORA_FAKE_DOC(real, fake) real
40 #define AURORA_IMPL_DEF(...) __VA_ARGS__
41 
42 
43 // Tell the compiler that a code path is unreachable, to disable warnings and enable optimizations
44 // Most common case: default label in switch statements
45 #if defined(_MSC_VER)
46  #define AURORA_UNREACHABLE __assume(false)
47 #elif defined(__GNUC__) || defined(__clang__)
48  #define AURORA_UNREACHABLE __builtin_unreachable()
49 #endif
50 
51 
52 // Output useful error message if MSVC, Clang or g++ compilers do not support C++11
53 // Cascaded because symbols are not 100% reliable, clang sometimes defines g++ macros
54 #if defined(_MSC_VER)
55  #if _MSC_VER < 1600
56  #error At least Visual Studio 2010 is required.
57  #endif
58 #elif defined(__clang__)
59  #if 100*__clang_major__ + __clang_minor__ < 301
60  #error At least Clang 3.1 is required.
61  #endif
62 #elif defined(__GNUC__)
63  #if 100*__GNUC__ + __GNUC_MINOR__ < 406
64  #error At least g++ 4.6 is required.
65  #endif
66 #endif
67 
68 
69 // Find out whether variadic templates are supported (VC++, gcc, clang)
70 #if defined(_MSC_VER) && _MSC_VER >= 1800
71  #define AURORA_HAS_VARIADIC_TEMPLATES
72 #elif defined(__clang__)
73  #if __has_feature(cxx_variadic_templates)
74  #define AURORA_HAS_VARIADIC_TEMPLATES
75  #endif
76 #elif defined(__GNUG__) && (defined(__VARIADIC_TEMPLATES) || __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4 && defined(__GXX_EXPERIMENTAL_CXX0X__)))
77  #define AURORA_HAS_VARIADIC_TEMPLATES
78 #endif
79 
80 #endif // AURORA_CONFIG_HPP