diff options
Diffstat (limited to 'src/corelib/global/qglobal.h')
-rw-r--r-- | src/corelib/global/qglobal.h | 222 |
1 files changed, 12 insertions, 210 deletions
diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index 0828a3dac3..a8547a3ab8 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -62,6 +62,10 @@ #include <QtCore/qconfig.h> #endif +/* These two macros makes it possible to turn the builtin line expander into a + * string literal. */ +#define QT_STRINGIFY2(x) #x +#define QT_STRINGIFY(x) QT_STRINGIFY2(x) #include <QtCore/qsystemdetection.h> #include <QtCore/qcompilerdetection.h> @@ -150,28 +154,6 @@ namespace QT_NAMESPACE {} # define QT_LARGEFILE_SUPPORT 64 #endif -#ifndef Q_PACKED -# define Q_PACKED -# undef Q_NO_PACKED_REFERENCE -#endif - -#ifndef Q_LIKELY -# define Q_LIKELY(x) (x) -#endif -#ifndef Q_UNLIKELY -# define Q_UNLIKELY(x) (x) -#endif -#ifndef Q_ASSUME -# define Q_ASSUME(expr) -#endif -#ifndef Q_UNREACHABLE -# define Q_UNREACHABLE() -#endif - -#ifndef Q_ALLOC_SIZE -# define Q_ALLOC_SIZE(x) -#endif - #ifndef Q_CONSTRUCTOR_FUNCTION # define Q_CONSTRUCTOR_FUNCTION0(AFUNC) \ namespace { \ @@ -194,14 +176,6 @@ namespace QT_NAMESPACE {} # define Q_DESTRUCTOR_FUNCTION(AFUNC) Q_DESTRUCTOR_FUNCTION0(AFUNC) #endif -#ifndef Q_REQUIRED_RESULT -# if defined(Q_CC_GNU) -# define Q_REQUIRED_RESULT __attribute__ ((warn_unused_result)) -# else -# define Q_REQUIRED_RESULT -# endif -#endif - QT_BEGIN_HEADER QT_BEGIN_NAMESPACE @@ -340,45 +314,6 @@ QT_END_INCLUDE_NAMESPACE # endif #endif -/* - Proper for-scoping in MIPSpro CC -*/ -#ifndef QT_NO_KEYWORDS -# if defined(Q_CC_MIPS) || (defined(Q_CC_HPACC) && defined(__ia64)) -# define for if(0){}else for -# endif -#endif - -/* - Workaround for static const members on MSVC++. -*/ - -#if defined(Q_CC_MSVC) -# define QT_STATIC_CONST static -# define QT_STATIC_CONST_IMPL -#else -# define QT_STATIC_CONST static const -# define QT_STATIC_CONST_IMPL const -#endif - -/* - Warnings and errors when using deprecated methods -*/ -#if defined(Q_CC_GNU) || defined(Q_CC_RVCT) -# define Q_DECL_DEPRECATED __attribute__ ((__deprecated__)) -#elif defined(Q_CC_MSVC) -# define Q_DECL_DEPRECATED __declspec(deprecated) -# if defined (Q_CC_INTEL) -# define Q_DECL_VARIABLE_DEPRECATED -# else -# endif -#else -# define Q_DECL_DEPRECATED -#endif -#ifndef Q_DECL_VARIABLE_DEPRECATED -# define Q_DECL_VARIABLE_DEPRECATED Q_DECL_DEPRECATED -#endif - #if defined(QT_NO_DEPRECATED) # undef QT_DEPRECATED # undef QT_DEPRECATED_VARIABLE @@ -448,46 +383,10 @@ QT_END_INCLUDE_NAMESPACE # define QT_FASTCALL #endif -#ifdef Q_COMPILER_NULLPTR -# define Q_NULLPTR nullptr -#else -# define Q_NULLPTR 0 -#endif - -#ifdef Q_COMPILER_DEFAULT_DELETE_MEMBERS -# define Q_DECL_EQ_DELETE = delete -#else -# define Q_DECL_EQ_DELETE -#endif - -#ifdef Q_COMPILER_CONSTEXPR -# define Q_DECL_CONSTEXPR constexpr -#else -# define Q_DECL_CONSTEXPR -#endif - -#ifdef Q_COMPILER_EXPLICIT_OVERRIDES -# define Q_DECL_OVERRIDE override -# define Q_DECL_FINAL final -# ifdef Q_COMPILER_DECLTYPE // required for class-level final to compile in qvariant_p.h -# define Q_DECL_FINAL_CLASS final -# else -# define Q_DECL_FINAL_CLASS -# endif -#else -# define Q_DECL_OVERRIDE -# define Q_DECL_FINAL -# define Q_DECL_FINAL_CLASS -#endif - -#if defined(Q_COMPILER_ALIGNOF) && !defined(Q_ALIGNOF) -# define Q_ALIGNOF(x) alignof(x) -#endif - //defines the type for the WNDPROC on windows //the alignment needs to be forced for sse2 to not crash with mingw #if defined(Q_OS_WIN) -# if defined(Q_CC_MINGW) +# if defined(Q_CC_MINGW) && !defined(Q_OS_WIN64) # define QT_ENSURE_STACK_ALIGNED_FOR_SSE __attribute__ ((force_align_arg_pointer)) # else # define QT_ENSURE_STACK_ALIGNED_FOR_SSE @@ -561,35 +460,6 @@ class QDataStream; #define QT_SUPPORTS(FEATURE) (!defined(QT_NO_##FEATURE)) -#if defined(Q_OS_LINUX) && defined(Q_CC_RVCT) -# define Q_DECL_EXPORT __attribute__((visibility("default"))) -# define Q_DECL_IMPORT __attribute__((visibility("default"))) -# define Q_DECL_HIDDEN __attribute__((visibility("hidden"))) -#endif - -#ifndef Q_DECL_EXPORT -# if defined(Q_OS_WIN) || defined(Q_CC_RVCT) -# define Q_DECL_EXPORT __declspec(dllexport) -# elif defined(QT_VISIBILITY_AVAILABLE) -# define Q_DECL_EXPORT __attribute__((visibility("default"))) -# define Q_DECL_HIDDEN __attribute__((visibility("hidden"))) -# endif -# ifndef Q_DECL_EXPORT -# define Q_DECL_EXPORT -# endif -#endif -#ifndef Q_DECL_IMPORT -# if defined(Q_OS_WIN) || defined(Q_CC_RVCT) -# define Q_DECL_IMPORT __declspec(dllimport) -# else -# define Q_DECL_IMPORT -# endif -#endif -#ifndef Q_DECL_HIDDEN -# define Q_DECL_HIDDEN -#endif - - /* Create Qt DLL if QT_DLL is defined (Windows only) */ @@ -764,58 +634,6 @@ class QDataStream; # endif #endif -// Functions marked as Q_GUI_EXPORT_INLINE were exported and inlined by mistake. -// Compilers like MinGW complain that the import attribute is ignored. -#if defined(Q_CC_MINGW) -# if defined(QT_BUILD_CORE_LIB) -# define Q_CORE_EXPORT_INLINE Q_CORE_EXPORT inline -# else -# define Q_CORE_EXPORT_INLINE inline -# endif -# if defined(QT_BUILD_GUI_LIB) -# define Q_GUI_EXPORT_INLINE Q_GUI_EXPORT inline -# else -# define Q_GUI_EXPORT_INLINE inline -# endif -# if defined(QT_BUILD_WIDGETS_LIB) -# define Q_WIDGETS_EXPORT_INLINE Q_WIDGETS_EXPORT inline -# else -# define Q_WIDGETS_EXPORT_INLINE inline -# endif -# if defined(QT_BUILD_PLATFORMSUPPORT_LIB) -# define Q_PLATFORMSUPPORT_EXPORT_INLINE Q_PLATFORMSUPPORT_EXPORT inline -# else -# define Q_PLATFORMSUPPORT_EXPORT_INLINE inline -# endif -# if defined(QT_BUILD_PRINTSUPPORT_LIB) -# define Q_PRINTSUPPORT_EXPORT_INLINE Q_PRINTSUPPORT_EXPORT inline -# else -# define Q_PRINTSUPPORT_EXPORT_INLINE inline -# endif -# if defined(QT_BUILD_COMPAT_LIB) -# define Q_COMPAT_EXPORT_INLINE Q_COMPAT_EXPORT inline -# else -# define Q_COMPAT_EXPORT_INLINE inline -# endif -#elif defined(Q_CC_RVCT) -// we force RVCT not to export inlines by passing --visibility_inlines_hidden -// so we need to just inline it, rather than exporting and inlining -// note: this affects the contents of the DEF files (ie. these functions do not appear) -# define Q_CORE_EXPORT_INLINE inline -# define Q_GUI_EXPORT_INLINE inline -# define Q_WIDGETS_EXPORT_INLINE inline -# define Q_PLATFORMSUPPORT_EXPORT_INLINE inline -# define Q_PRINTSUPPORT_EXPORT_INLINE inline -# define Q_COMPAT_EXPORT_INLINE inline -#else -# define Q_CORE_EXPORT_INLINE Q_CORE_EXPORT inline -# define Q_GUI_EXPORT_INLINE Q_GUI_EXPORT inline -# define Q_WIDGETS_EXPORT_INLINE Q_WIDGETS_EXPORT inline -# define Q_PLATFORMSUPPORT_EXPORT_INLINE Q_PLATFORMSUPPORT_EXPORT inline -# define Q_PRINTSUPPORT_EXPORT_INLINE Q_PRINTSUPPORT_EXPORT inline -# define Q_COMPAT_EXPORT_INLINE Q_COMPAT_EXPORT inline -#endif - /* No, this is not an evil backdoor. QT_BUILD_INTERNAL just exports more symbols for Qt's internal unit tests. If you want slower loading times and more @@ -896,6 +714,10 @@ inline void qUnused(T &x) { (void)x; } class QString; Q_CORE_EXPORT QString qt_error_string(int errorCode = -1); + +#ifndef Q_CC_MSVC +Q_NORETURN +#endif Q_CORE_EXPORT void qt_assert(const char *assertion, const char *file, int line); #if !defined(Q_ASSERT) @@ -910,6 +732,9 @@ Q_CORE_EXPORT void qt_assert(const char *assertion, const char *file, int line); #define QT_NO_PAINT_DEBUG #endif +#ifndef Q_CC_MSVC +Q_NORETURN +#endif Q_CORE_EXPORT void qt_assert_x(const char *where, const char *what, const char *file, int line); #if !defined(Q_ASSERT_X) @@ -952,29 +777,6 @@ Q_CORE_EXPORT void qBadAlloc(); template <typename T> inline T *q_check_ptr(T *p) { Q_CHECK_PTR(p); return p; } -#if (defined(Q_CC_GNU) && !defined(Q_OS_SOLARIS)) || defined(Q_CC_HPACC) || defined(Q_CC_DIAB) -# define Q_FUNC_INFO __PRETTY_FUNCTION__ -#elif defined(_MSC_VER) -# define Q_FUNC_INFO __FUNCSIG__ -#else -# if defined(Q_OS_SOLARIS) || defined(Q_CC_XLC) -# define Q_FUNC_INFO __FILE__ "(line number unavailable)" -# else - /* These two macros makes it possible to turn the builtin line expander into a - * string literal. */ -# define QT_STRINGIFY2(x) #x -# define QT_STRINGIFY(x) QT_STRINGIFY2(x) -# define Q_FUNC_INFO __FILE__ ":" QT_STRINGIFY(__LINE__) -# endif - /* The MIPSpro and RVCT compilers postpones macro expansion, - and therefore macros must be in scope when being used. */ -# if !defined(Q_CC_MIPS) && !defined(Q_CC_RVCT) -# undef QT_STRINGIFY2 -# undef QT_STRINGIFY -# endif -#endif - - typedef void (*QFunctionPointer)(); #if !defined(Q_UNIMPLEMENTED) |