Fork Vasum on GitHub Official Vasum Wiki on Tizen.org
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
config.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
3  *
4  * Contact: Lukasz Pawelczyk (l.pawelczyk@partner.samsung.com)
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License
17  */
18 
26 #ifndef COMMON_CONFIG_HPP
27 #define COMMON_CONFIG_HPP
28 
29 
30 #ifdef __clang__
31 #define CLANG_VERSION (__clang__major__ * 10000 + __clang_minor__ * 100 + __clang_patchlevel__)
32 #endif // __clang__
33 
34 #if defined __GNUC__ && !defined __clang__ // clang also defines GCC versions
35 #define GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
36 #endif // __GNUC__
37 
38 
39 #ifdef GCC_VERSION
40 
41 #if GCC_VERSION < 40800
42 // GCC 4.8 is the first where those defines are not required for
43 // std::this_thread::sleep_for() and ::yield(). They might exist though
44 // in previous versions depending on the build configuration of the GCC.
45 #ifndef _GLIBCXX_USE_NANOSLEEP
46 #define _GLIBCXX_USE_NANOSLEEP
47 #endif // _GLIBCXX_USE_NANOSLEEP
48 #ifndef _GLIBCXX_USE_SCHED_YIELD
49 #define _GLIBCXX_USE_SCHED_YIELD
50 #endif // _GLIBCXX_USE_SCHED_YIELD
51 #endif // GCC_VERSION < 40800
52 
53 #if GCC_VERSION < 40700
54 // Those appeared in 4.7 with full c++11 support
55 #define final
56 #define override
57 #define thread_local __thread // use GCC extension instead of C++11
58 #define steady_clock monotonic_clock
59 #endif // GCC_VERSION < 40700
60 
61 #endif // GCC_VERSION
62 
63 // Variadic macros support for boost preprocessor should be enabled
64 // manually for clang since they are marked as untested feature
65 // (boost trunk if fixed but the latest 1.55 version is not,
66 // see boost/preprocessor/config/config.hpp)
67 #ifdef __clang__
68 #define BOOST_PP_VARIADICS 1
69 #endif
70 
71 // This has to be defined always when the boost has not been compiled
72 // using C++11. Headers detect that you are compiling using C++11 and
73 // blindly and wrongly assume that boost has been as well.
74 #ifndef BOOST_NO_CXX11_SCOPED_ENUMS
75 #define BOOST_NO_CXX11_SCOPED_ENUMS 1
76 #endif
77 
78 #endif // COMMON_CONFIG_HPP