diff options
author | Thiago Macieira <thiago.macieira@nokia.com> | 2009-06-26 08:32:17 (GMT) |
---|---|---|
committer | Thiago Macieira <thiago.macieira@nokia.com> | 2009-06-26 08:33:34 (GMT) |
commit | 54c03220afeacf6c9f561872d48e7746d97f8349 (patch) | |
tree | 8a74a9be59f71f0a6e47b45512a6826db16c03f6 /src | |
parent | 56fbd7644b6f292dcd7d8d215bd469d94a0948ae (diff) | |
download | Qt-54c03220afeacf6c9f561872d48e7746d97f8349.zip Qt-54c03220afeacf6c9f561872d48e7746d97f8349.tar.gz Qt-54c03220afeacf6c9f561872d48e7746d97f8349.tar.bz2 |
Add some macro expressions to qglobal.h for typeof, alignof and aligned().
These expressions aren't used anywhere yet, but I am sure we will find
use for them very soon now. I checked the compiler manuals for the
three commercial Unix compilers to verify which versions support these
macros.
Reviewed-by: Bradley T. Hughes
Diffstat (limited to 'src')
-rw-r--r-- | src/corelib/global/qglobal.h | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index b4b98e1..afc3f58 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -385,6 +385,9 @@ namespace QT_NAMESPACE {} # define Q_OUTOFLINE_TEMPLATE inline # define Q_NO_TEMPLATE_FRIENDS # define QT_NO_PARTIAL_TEMPLATE_SPECIALIZATION +# define Q_ALIGNOF(type) __alignof(type) +# define Q_DECL_ALIGN(n) __declspec(align(n)) + /* Visual C++.Net issues for _MSC_VER >= 1300 */ # if _MSC_VER >= 1300 # define Q_CC_MSVC_NET @@ -471,6 +474,11 @@ namespace QT_NAMESPACE {} # define Q_NO_USING_KEYWORD # define QT_NO_STL_WCHAR # endif +# if __GNUC__ >= 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95) +# define Q_ALIGNOF(type) __alignof__(type) +# define Q_TYPEOF(expr) __typeof__(expr) +# define Q_DECL_ALIGN(n) __attribute__((__aligned__(n))) +# endif /* GCC 3.1 and GCC 3.2 wrongly define _SB_CTYPE_MACROS on HP-UX */ # if defined(Q_OS_HPUX) && __GNUC__ == 3 && __GNUC_MINOR__ >= 1 # define Q_WRONG_SB_CTYPE_MACROS @@ -524,6 +532,11 @@ namespace QT_NAMESPACE {} # define Q_OUTOFLINE_TEMPLATE inline # define Q_BROKEN_TEMPLATE_SPECIALIZATION # define Q_CANNOT_DELETE_CONSTANT +# elif __xlC__ >= 0x0600 +# define Q_ALIGNOF(type) __alignof__(type) +# define Q_TYPEOF(expr) __typeof__(expr) +# define Q_DECL_ALIGN(n) __attribute__((__aligned__(n))) +# define Q_PACKED __attribute__((__packed__)) # endif /* Older versions of DEC C++ do not define __EDG__ or __EDG - observed @@ -647,6 +660,13 @@ namespace QT_NAMESPACE {} # if __SUNPRO_CC < 0x570 # define QT_NO_TEMPLATE_TEMPLATE_PARAMETERS # endif + /* see http://developers.sun.com/sunstudio/support/Ccompare.html */ +# if __SUNPRO_CC >= 0x590 +# define Q_ALIGNOF(type) __alignof__(type) +# define Q_TYPEOF(expr) __typeof__(expr) +# define Q_DECL_ALIGN(n) __attribute__((__aligned__(n))) +# define Q_DECL_EXPORT __attribute__((__visibility__("default"))) +# endif # if !defined(_BOOL) # define Q_NO_BOOL_TYPE # endif @@ -676,8 +696,17 @@ namespace QT_NAMESPACE {} # if defined(__HP_aCC) || __cplusplus >= 199707L # define Q_NO_TEMPLATE_FRIENDS # define Q_CC_HPACC -# ifdef QT_ARCH_PARISC +# if __HP_aCC-0 < 060000 # define QT_NO_TEMPLATE_TEMPLATE_PARAMETERS +# define Q_DECL_EXPORT __declspec(dllexport) +# define Q_DECL_IMPORT __declspec(dllimport) +# endif +# if __HP_aCC-0 >= 061200 +# define Q_DECL_ALIGNED(n) __attribute__((aligned(n))) +# endif +# if __HP_aCC-0 >= 062000 +# define Q_DECL_EXPORT __attribute__((visibility("default")) +# define Q_DECL_IMPORT Q_DECL_EXPORT # endif # else # define Q_CC_HP |