KDECore
kdemacros.h.cmake
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00028 #ifndef _KDE_MACROS_H_
00029 #define _KDE_MACROS_H_
00030
00031 #cmakedefine __KDE_HAVE_GCC_VISIBILITY
00032
00072 #ifdef __KDE_HAVE_GCC_VISIBILITY
00073 #define KDE_NO_EXPORT __attribute__ ((visibility("hidden")))
00074 #define KDE_EXPORT __attribute__ ((visibility("default")))
00075 #define KDE_IMPORT __attribute__ ((visibility("default")))
00076 #elif defined(_WIN32) || defined(_WIN64)
00077 #define KDE_NO_EXPORT
00078 #define KDE_EXPORT __declspec(dllexport)
00079 #define KDE_IMPORT __declspec(dllimport)
00080 #else
00081 #define KDE_NO_EXPORT
00082 #define KDE_EXPORT
00083 #define KDE_IMPORT
00084 #endif
00085
00094 #ifdef __GNUC__
00095 #define KDE_PACKED __attribute__((__packed__))
00096 #else
00097 #define KDE_PACKED
00098 #endif
00099
00161 #ifdef __cplusplus
00162 # include <QtCore/qglobal.h>
00163 # ifndef KDE_DEPRECATED
00164 # ifdef KDE_DEPRECATED_WARNINGS
00165 # define KDE_DEPRECATED Q_DECL_DEPRECATED
00166 # else
00167 # define KDE_DEPRECATED
00168 # endif
00169 # endif
00170 #endif
00171
00198 #ifndef KDE_CONSTRUCTOR_DEPRECATED
00199 # ifdef __GNUC__
00200 # if __GNUC__ == 3 && __GNUC_MINOR__ <= 3
00201
00202 # define KDE_CONSTRUCTOR_DEPRECATED
00203 # else
00204 # define KDE_CONSTRUCTOR_DEPRECATED Q_DECL_CONSTRUCTOR_DEPRECATED
00205 # endif
00206 # else
00207 # define KDE_CONSTRUCTOR_DEPRECATED Q_DECL_CONSTRUCTOR_DEPRECATED
00208 # endif
00209 #endif
00210
00271 #if defined(__GNUC__) && __GNUC__ - 0 >= 3
00272 # define KDE_ISLIKELY( x ) __builtin_expect(!!(x),1)
00273 # define KDE_ISUNLIKELY( x ) __builtin_expect(!!(x),0)
00274 #else
00275 # define KDE_ISLIKELY( x ) ( x )
00276 # define KDE_ISUNLIKELY( x ) ( x )
00277 #endif
00278
00279
00292 #define RESERVE_VIRTUAL_1 \
00293 virtual void reservedVirtual1() {}
00294
00297 #define RESERVE_VIRTUAL_2 \
00298 virtual void reservedVirtual2() {} \
00299 RESERVE_VIRTUAL_1
00300
00303 #define RESERVE_VIRTUAL_3 \
00304 virtual void reservedVirtual3() {} \
00305 RESERVE_VIRTUAL_2
00306
00309 #define RESERVE_VIRTUAL_4 \
00310 virtual void reservedVirtual4() {} \
00311 RESERVE_VIRTUAL_3
00312
00315 #define RESERVE_VIRTUAL_5 \
00316 virtual void reservedVirtual5() {} \
00317 RESERVE_VIRTUAL_4
00318
00321 #define RESERVE_VIRTUAL_6 \
00322 virtual void reservedVirtual6() {} \
00323 RESERVE_VIRTUAL_5
00324
00327 #define RESERVE_VIRTUAL_7 \
00328 virtual void reservedVirtual7() {} \
00329 RESERVE_VIRTUAL_6
00330
00333 #define RESERVE_VIRTUAL_8 \
00334 virtual void reservedVirtual8() {} \
00335 RESERVE_VIRTUAL_7
00336
00339 #define RESERVE_VIRTUAL_9 \
00340 virtual void reservedVirtual9() {} \
00341 RESERVE_VIRTUAL_8
00342 #define RESERVE_VIRTUAL_10 \
00343 virtual void reservedVirtual10() {} \
00344 RESERVE_VIRTUAL_9
00345
00387 #ifdef KDE_FULL_TEMPLATE_EXPORT_INSTANTIATION
00388 # define KDE_DUMMY_COMPARISON_OPERATOR(C) \
00389 bool operator==(const C&) const { \
00390 qWarning(#C"::operator==(const "#C"&) was called"); \
00391 return false; \
00392 }
00393 # define KDE_DUMMY_QHASH_FUNCTION(C) \
00394 inline uint qHash(const C) { \
00395 qWarning("inline uint qHash(const "#C") was called"); \
00396 return 0; \
00397 }
00398 #else
00399 # define KDE_DUMMY_COMPARISON_OPERATOR(C)
00400 # define KDE_DUMMY_QHASH_FUNCTION(C)
00401 #endif
00402
00425 #ifdef Q_CC_MSVC
00426 # define KDE_BF_ENUM(a) unsigned int
00427 # define KDE_CAST_BF_ENUM(a,b) static_cast<a>(b)
00428 #else
00429 # define KDE_BF_ENUM(a) a
00430 # define KDE_CAST_BF_ENUM(a,b) b
00431 #endif
00432
00442 #ifdef __GNUC__
00443 #define KDE_WEAK_SYMBOL __attribute__((__weak__))
00444 #else
00445 #define KDE_WEAK_SYMBOL
00446 #endif
00447
00448
00457 #ifdef __GNUC__
00458 #define KDE_MUST_USE_RESULT __attribute__((__warn_unused_result__))
00459 #else
00460 #define KDE_MUST_USE_RESULT
00461 #endif
00462
00463
00464
00465 #endif