Go to the documentation of this file.
12 #ifndef _QI_MACRO_HPP_
13 #define _QI_MACRO_HPP_
20 #if defined(__GNUC__) && !defined(QI_NO_API_DEPRECATED)
21 # define QI_API_DEPRECATED __attribute__((deprecated))
22 #elif defined(_MSC_VER) && !defined(QI_NO_API_DEPRECATED)
23 # define QI_API_DEPRECATED __declspec(deprecated)
25 # define QI_API_DEPRECATED
30 # define QI_NORETURN __attribute__((noreturn))
32 #elif defined(_MSC_VER)
33 # define QI_NORETURN __declspec(noreturn)
40 #if defined(__GNUC__) && !defined(__clang__)
41 # define QI_HAS_VARIABLE_LENGTH_ARRAY 1
43 # define QI_HAS_VARIABLE_LENGTH_ARRAY 0
66 #define QI_LIB_API(libname) _QI_LIB_API(BOOST_PP_CAT(libname, _EXPORTS), BOOST_PP_CAT(libname, _STATIC_BUILD))
68 #define _QI_LIB_API(IS_BUILDING_LIB, IS_LIB_STATIC_BUILD) \
69 QI_LIB_API_NORMALIZED(_QI_IS_ONE_OR_EMPTY(BOOST_PP_CAT(_ , IS_BUILDING_LIB)), _QI_IS_ONE_OR_EMPTY(BOOST_PP_CAT(_, IS_LIB_STATIC_BUILD)))
72 #if defined _WIN32 || defined __CYGWIN__
73 # define QI_EXPORT_API __declspec(dllexport)
74 # define QI_IMPORT_API __declspec(dllimport)
75 # define QI_LIB_API_NORMALIZED(exporting, isstatic) BOOST_PP_CAT(BOOST_PP_CAT(_QI_LIB_API_NORMALIZED_, exporting), isstatic)
76 # define _QI_LIB_API_NORMALIZED_00 QI_IMPORT_API
77 # define _QI_LIB_API_NORMALIZED_10 QI_EXPORT_API
78 # define _QI_LIB_API_NORMALIZED_11
79 # define _QI_LIB_API_NORMALIZED_01
81 # define QI_EXPORT_API __attribute__ ((visibility("default")))
82 # define QI_IMPORT_API QI_EXPORT_API
83 # define QI_LIB_API_NORMALIZED(a, b) QI_EXPORT_API
85 # define QI_IMPORT_API
86 # define QI_EXPORT_API
87 # define QI_LIB_API_NORMALIZED(a, b)
94 #define QI_DO_PRAGMA(x) __pragma(x)
95 #define __ALSTR2__(x) #x
96 #define __ALSTR1__(x) __ALSTR2__(x)
97 #define _ALMSVCLOC_ __FILE__ "("__ALSTR1__(__LINE__)") : "
98 #define QI_MSG_PRAGMA(_msg) QI_DO_PRAGMA(message (_ALMSVCLOC_ _msg))
99 #elif defined(__GNUC__)
100 #define QI_DO_PRAGMA(x) _Pragma (#x)
101 #define QI_MSG_PRAGMA(_msg) QI_DO_PRAGMA(message (_msg))
103 #define QI_DO_PRAGMA(x)
104 #define QI_MSG_PRAGMA(_msg)
110 #if defined(QI_NO_COMPILER_WARNING)
111 # define QI_COMPILER_WARNING(x)
113 # define QI_COMPILER_WARNING(x) QI_MSG_PRAGMA("Warning: " #x)
117 #if !defined(WITH_DEPRECATED) || defined(QI_NO_DEPRECATED_HEADER)
118 # define QI_DEPRECATED_HEADER(x)
120 # define QI_DEPRECATED_HEADER(x) QI_MSG_PRAGMA("\
121 This file includes at least one deprecated or antiquated ALDEBARAN header \
122 which may be removed without further notice in the next version. \
123 Please consult the changelog for details. " #x)
129 template <
typename T>
134 #define QI_DEPRECATE_MACRO(name) \
135 QI_COMPILER_WARNING(name macro is deprecated.)
138 #define QI_DISALLOW_COPY_AND_ASSIGN(type) \
139 QI_DEPRECATE_MACRO(QI_DISALLOW_COPY_AND_ASSIGN) \
140 type(type const &); \
141 void operator=(type const &); \
142 typedef int _qi_not_clonable; \
143 template<typename U> friend struct ::qi::IsClonable
146 #if defined(__GNUC__)
147 # define QI_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
149 # define QI_WARN_UNUSED_RESULT
152 #if defined(__GNUC__)
153 # define QI_ATTR_UNUSED __attribute__((unused))
155 # define QI_ATTR_UNUSED
162 #define _QI_UNIQ_DEF_LEVEL2(A, B) A ## __uniq__ ## B
163 #define _QI_UNIQ_DEF_LEVEL1(A, B) _QI_UNIQ_DEF_LEVEL2(A, B)
164 #define QI_UNIQ_DEF(A) _QI_UNIQ_DEF_LEVEL1(A, __LINE__)
167 #endif // _QI_MACRO_HPP_