diff options
Diffstat (limited to 'src/corelib/global')
-rw-r--r-- | src/corelib/global/qglobal.cpp | 14 | ||||
-rw-r--r-- | src/corelib/global/qlogging.cpp | 2 | ||||
-rw-r--r-- | src/corelib/global/qnamespace.qdoc | 54 | ||||
-rw-r--r-- | src/corelib/global/qnumeric_p.h | 42 | ||||
-rw-r--r-- | src/corelib/global/qprocessordetection.h | 76 |
5 files changed, 110 insertions, 78 deletions
diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp index 6257376b62..a30250df81 100644 --- a/src/corelib/global/qglobal.cpp +++ b/src/corelib/global/qglobal.cpp @@ -892,13 +892,13 @@ bool qSharedBuild() \brief The QSysInfo class provides information about the system. \list - \o \l WordSize specifies the size of a pointer for the platform + \li \l WordSize specifies the size of a pointer for the platform on which the application is compiled. - \o \l ByteOrder specifies whether the platform is big-endian or + \li \l ByteOrder specifies whether the platform is big-endian or little-endian. - \o \l WindowsVersion specifies the version of the Windows operating + \li \l WindowsVersion specifies the version of the Windows operating system on which the application is run (Windows only) - \o \l MacintoshVersion specifies the version of the Macintosh + \li \l MacintoshVersion specifies the version of the Macintosh operating system on which the application is run (Mac only). \endlist @@ -2462,12 +2462,12 @@ int qrand() \a Flags can be one of the following: \list - \o \c Q_PRIMITIVE_TYPE specifies that \a Type is a POD (plain old + \li \c Q_PRIMITIVE_TYPE specifies that \a Type is a POD (plain old data) type with no constructor or destructor. - \o \c Q_MOVABLE_TYPE specifies that \a Type has a constructor + \li \c Q_MOVABLE_TYPE specifies that \a Type has a constructor and/or a destructor but can be moved in memory using \c memcpy(). - \o \c Q_COMPLEX_TYPE (the default) specifies that \a Type has + \li \c Q_COMPLEX_TYPE (the default) specifies that \a Type has constructors and/or a destructor and that it may not be moved in memory. \endlist diff --git a/src/corelib/global/qlogging.cpp b/src/corelib/global/qlogging.cpp index badccc947d..8cbd4528dc 100644 --- a/src/corelib/global/qlogging.cpp +++ b/src/corelib/global/qlogging.cpp @@ -309,7 +309,7 @@ QDebug QMessageLogger::critical() message handler has been installed, the message is printed to stderr. Under Windows, the message is sent to the debugger. - If you are using the \bold{default message handler} this function will + If you are using the \b{default message handler} this function will abort on Unix systems to create a core dump. On Windows, for debug builds, this function will report a _CRT_ERROR enabling you to connect a debugger to the application. diff --git a/src/corelib/global/qnamespace.qdoc b/src/corelib/global/qnamespace.qdoc index 895feb7f53..1df36f42e6 100644 --- a/src/corelib/global/qnamespace.qdoc +++ b/src/corelib/global/qnamespace.qdoc @@ -266,7 +266,7 @@ This enum provides shorter names for the keyboard modifier keys supported by Qt. - \bold{Note:} On Mac OS X, the \c CTRL value corresponds to + \b{Note:} On Mac OS X, the \c CTRL value corresponds to the Command keys on the Macintosh keyboard, and the \c META value corresponds to the Control keys. @@ -319,21 +319,21 @@ \table \row - \o \inlineimage qpen-solid.png - \o \inlineimage qpen-dash.png - \o \inlineimage qpen-dot.png + \li \inlineimage qpen-solid.png + \li \inlineimage qpen-dash.png + \li \inlineimage qpen-dot.png \row - \o Qt::SolidLine - \o Qt::DashLine - \o Qt::DotLine + \li Qt::SolidLine + \li Qt::DashLine + \li Qt::DotLine \row - \o \inlineimage qpen-dashdot.png - \o \inlineimage qpen-dashdotdot.png - \o \inlineimage qpen-custom.png + \li \inlineimage qpen-dashdot.png + \li \inlineimage qpen-dashdotdot.png + \li \inlineimage qpen-custom.png \row - \o Qt::DashDotLine - \o Qt::DashDotDotLine - \o Qt::CustomDashLine + \li Qt::DashDotLine + \li Qt::DashDotDotLine + \li Qt::CustomDashLine \endtable \value NoPen no line at all. For example, QPainter::drawRect() @@ -360,13 +360,13 @@ \table \row - \o \inlineimage qpen-square.png - \o \inlineimage qpen-flat.png - \o \inlineimage qpen-roundcap.png + \li \inlineimage qpen-square.png + \li \inlineimage qpen-flat.png + \li \inlineimage qpen-roundcap.png \row - \o Qt::SquareCap - \o Qt::FlatCap - \o Qt::RoundCap + \li Qt::SquareCap + \li Qt::FlatCap + \li Qt::RoundCap \endtable \value FlatCap a square line end that does not cover the end @@ -388,13 +388,13 @@ \table \row - \o \inlineimage qpen-bevel.png - \o \inlineimage qpen-miter.png - \o \inlineimage qpen-roundjoin.png + \li \inlineimage qpen-bevel.png + \li \inlineimage qpen-miter.png + \li \inlineimage qpen-roundjoin.png \row - \o Qt::BevelJoin - \o Qt::MiterJoin - \o Qt::RoundJoin + \li Qt::BevelJoin + \li Qt::MiterJoin + \li Qt::RoundJoin \endtable \value MiterJoin The outer edges of the lines are extended to @@ -968,7 +968,7 @@ \value WA_NoSystemBackground Indicates that the widget has no background, i.e. when the widget receives paint events, the background is not automatically repainted. \note Unlike WA_OpaquePaintEvent, newly exposed - areas are \bold never filled with the background (e.g., after showing a + areas are \b never filled with the background (e.g., after showing a window for the first time the user can see "through" it until the application processes the paint events). This flag is set or cleared by the widget's author. @@ -2653,7 +2653,7 @@ \value ElideNone Ellipsis should NOT appear in the text. Qt::ElideMiddle is normally the most appropriate choice for URLs (e.g., - "\l{http://bugreports.qt.nokia.com/browse/QTWEBSITE-13}{http://bugreports.qt.../QTWEBSITE-13/}"), + "\l{http://bugreports.qt-project.org/browse/QTWEBSITE-13}{http://bugreports.qt.../QTWEBSITE-13/}"), whereas Qt::ElideRight is appropriate for other strings (e.g., "\l{http://qt.nokia.com/doc/qq/qq09-mac-deployment.html}{Deploying Applications on Ma...}"). diff --git a/src/corelib/global/qnumeric_p.h b/src/corelib/global/qnumeric_p.h index 6b5ecf73e1..851c18203d 100644 --- a/src/corelib/global/qnumeric_p.h +++ b/src/corelib/global/qnumeric_p.h @@ -61,63 +61,43 @@ QT_BEGIN_NAMESPACE static const union { unsigned char c[8]; double d; } qt_be_inf_bytes = { { 0x7f, 0xf0, 0, 0, 0, 0, 0, 0 } }; static const union { unsigned char c[8]; double d; } qt_le_inf_bytes = { { 0, 0, 0, 0, 0, 0, 0xf0, 0x7f } }; -static const union { unsigned char c[8]; double d; } qt_armfpa_inf_bytes = { { 0, 0, 0xf0, 0x7f, 0, 0, 0, 0 } }; static inline double qt_inf() { -#ifdef QT_ARMFPA - return qt_armfpa_inf_bytes.d; -#else return (QSysInfo::ByteOrder == QSysInfo::BigEndian ? qt_be_inf_bytes.d : qt_le_inf_bytes.d); -#endif } // Signaling NAN static const union { unsigned char c[8]; double d; } qt_be_snan_bytes = { { 0x7f, 0xf8, 0, 0, 0, 0, 0, 0 } }; static const union { unsigned char c[8]; double d; } qt_le_snan_bytes = { { 0, 0, 0, 0, 0, 0, 0xf8, 0x7f } }; -static const union { unsigned char c[8]; double d; } qt_armfpa_snan_bytes = { { 0, 0, 0xf8, 0x7f, 0, 0, 0, 0 } }; static inline double qt_snan() { -#ifdef QT_ARMFPA - return qt_armfpa_snan_bytes.d; -#else return (QSysInfo::ByteOrder == QSysInfo::BigEndian ? qt_be_snan_bytes.d : qt_le_snan_bytes.d); -#endif } // Quiet NAN static const union { unsigned char c[8]; double d; } qt_be_qnan_bytes = { { 0xff, 0xf8, 0, 0, 0, 0, 0, 0 } }; static const union { unsigned char c[8]; double d; } qt_le_qnan_bytes = { { 0, 0, 0, 0, 0, 0, 0xf8, 0xff } }; -static const union { unsigned char c[8]; double d; } qt_armfpa_qnan_bytes = { { 0, 0, 0xf8, 0xff, 0, 0, 0, 0 } }; static inline double qt_qnan() { -#ifdef QT_ARMFPA - return qt_armfpa_qnan_bytes.d; -#else return (QSysInfo::ByteOrder == QSysInfo::BigEndian ? qt_be_qnan_bytes.d : qt_le_qnan_bytes.d); -#endif } #else // Q_CC_MIPS static const unsigned char qt_be_inf_bytes[] = { 0x7f, 0xf0, 0, 0, 0, 0, 0, 0 }; static const unsigned char qt_le_inf_bytes[] = { 0, 0, 0, 0, 0, 0, 0xf0, 0x7f }; -static const unsigned char qt_armfpa_inf_bytes[] = { 0, 0, 0xf0, 0x7f, 0, 0, 0, 0 }; static inline double qt_inf() { const unsigned char *bytes; -#ifdef QT_ARMFPA - bytes = qt_armfpa_inf_bytes; -#else bytes = (QSysInfo::ByteOrder == QSysInfo::BigEndian ? qt_be_inf_bytes : qt_le_inf_bytes); -#endif union { unsigned char c[8]; double d; } returnValue; qMemCopy(returnValue.c, bytes, sizeof(returnValue.c)); @@ -127,17 +107,12 @@ static inline double qt_inf() // Signaling NAN static const unsigned char qt_be_snan_bytes[] = { 0x7f, 0xf8, 0, 0, 0, 0, 0, 0 }; static const unsigned char qt_le_snan_bytes[] = { 0, 0, 0, 0, 0, 0, 0xf8, 0x7f }; -static const unsigned char qt_armfpa_snan_bytes[] = { 0, 0, 0xf8, 0x7f, 0, 0, 0, 0 }; static inline double qt_snan() { const unsigned char *bytes; -#ifdef QT_ARMFPA - bytes = qt_armfpa_snan_bytes; -#else bytes = (QSysInfo::ByteOrder == QSysInfo::BigEndian ? qt_be_snan_bytes : qt_le_snan_bytes); -#endif union { unsigned char c[8]; double d; } returnValue; qMemCopy(returnValue.c, bytes, sizeof(returnValue.c)); @@ -147,17 +122,12 @@ static inline double qt_snan() // Quiet NAN static const unsigned char qt_be_qnan_bytes[] = { 0xff, 0xf8, 0, 0, 0, 0, 0, 0 }; static const unsigned char qt_le_qnan_bytes[] = { 0, 0, 0, 0, 0, 0, 0xf8, 0xff }; -static const unsigned char qt_armfpa_qnan_bytes[] = { 0, 0, 0xf8, 0xff, 0, 0, 0, 0 }; static inline double qt_qnan() { const unsigned char *bytes; -#ifdef QT_ARMFPA - bytes = qt_armfpa_qnan_bytes; -#else bytes = (QSysInfo::ByteOrder == QSysInfo::BigEndian ? qt_be_qnan_bytes : qt_le_qnan_bytes); -#endif union { unsigned char c[8]; double d; } returnValue; qMemCopy(returnValue.c, bytes, sizeof(returnValue.c)); @@ -169,43 +139,31 @@ static inline double qt_qnan() static inline bool qt_is_inf(double d) { uchar *ch = (uchar *)&d; -#ifdef QT_ARMFPA - return (ch[3] & 0x7f) == 0x7f && ch[2] == 0xf0; -#else if (QSysInfo::ByteOrder == QSysInfo::BigEndian) { return (ch[0] & 0x7f) == 0x7f && ch[1] == 0xf0; } else { return (ch[7] & 0x7f) == 0x7f && ch[6] == 0xf0; } -#endif } static inline bool qt_is_nan(double d) { uchar *ch = (uchar *)&d; -#ifdef QT_ARMFPA - return (ch[3] & 0x7f) == 0x7f && ch[2] > 0xf0; -#else if (QSysInfo::ByteOrder == QSysInfo::BigEndian) { return (ch[0] & 0x7f) == 0x7f && ch[1] > 0xf0; } else { return (ch[7] & 0x7f) == 0x7f && ch[6] > 0xf0; } -#endif } static inline bool qt_is_finite(double d) { uchar *ch = (uchar *)&d; -#ifdef QT_ARMFPA - return (ch[3] & 0x7f) != 0x7f || (ch[2] & 0xf0) != 0xf0; -#else if (QSysInfo::ByteOrder == QSysInfo::BigEndian) { return (ch[0] & 0x7f) != 0x7f || (ch[1] & 0xf0) != 0xf0; } else { return (ch[7] & 0x7f) != 0x7f || (ch[6] & 0xf0) != 0xf0; } -#endif } static inline bool qt_is_inf(float d) diff --git a/src/corelib/global/qprocessordetection.h b/src/corelib/global/qprocessordetection.h index fd02f0e4c5..4213d5830e 100644 --- a/src/corelib/global/qprocessordetection.h +++ b/src/corelib/global/qprocessordetection.h @@ -53,16 +53,39 @@ The first is always defined. Defines for the various revisions/variants are optional and usually dependent on how the compiler was invoked. Variants that are a superset of another should have a define for the superset. + + In addition to the procesor family, variants, and revisions, we also set + Q_BYTE_ORDER appropriately for the target processor. For bi-endian + processors, we try to auto-detect the byte order using the __BIG_ENDIAN__, + __LITTLE_ENDIAN__, or __BYTE_ORDER__ preprocessor macros. */ +/* Machine byte-order, reuse preprocessor provided macros when available */ +#if defined(__ORDER_BIG_ENDIAN__) +# define Q_BIG_ENDIAN __ORDER_BIG_ENDIAN__ +#else +# define Q_BIG_ENDIAN 4321 +#endif +#if defined(__ORDER_LITTLE_ENDIAN__) +# define Q_LITTLE_ENDIAN __ORDER_LITTLE_ENDIAN__ +#else +# define Q_LITTLE_ENDIAN 1234 +#endif + /* Alpha family, no revisions or variants + + Alpha is bi-endian, use endianness auto-detection described above. */ // #elif defined(__alpha__) || defined(_M_ALPHA) // # define Q_PROCESSOR_ALPHA +// Q_BYTE_ORDER not defined, use endianness auto-detection /* - ARM family, known revisions: V5, V6, and V7 + ARM family, known revisions: V5, V6, and V7 + + ARM is bi-endian, detect using __ARMEL__ or __ARMEB__, falling back to + auto-detection described above. */ #if defined(__arm__) || defined(__TARGET_ARCH_ARM) # define Q_PROCESSOR_ARM @@ -88,37 +111,59 @@ || (__TARGET_ARCH_ARM-0 >= 5) # define Q_PROCESSOR_ARM_V5 # endif +# if defined(__ARMEL__) +# define Q_BYTE_ORDER Q_LITTLE_ENDIAN +# elif defined(__ARMEB__) +# define Q_BYTE_ORDER Q_BIG_ENDIAN +# else +// Q_BYTE_ORDER not defined, use endianness auto-detection +#endif /* AVR32 family, no revisions or variants + + AVR32 is big-endian. */ // #elif defined(__avr32__) // # define Q_PROCESSOR_AVR32 +// # define Q_BYTE_ORDER Q_BIG_ENDIAN /* Blackfin family, no revisions or variants + + Blackfin is little-endian. */ // #elif defined(__bfin__) // # define Q_PROCESSOR_BLACKFIN +// # define Q_BYTE_ORDER Q_LITTLE_ENDIAN /* X86 family, known variants: 32- and 64-bit + + X86 is little-endian. */ #elif defined(__i386) || defined(__i386__) || defined(_M_IX86) # define Q_PROCESSOR_X86 # define Q_PROCESSOR_X86_32 +# define Q_BYTE_ORDER Q_LITTLE_ENDIAN #elif defined(__x86_64) || defined(__x86_64__) || defined(__amd64) || defined(_M_X64) # define Q_PROCESSOR_X86 # define Q_PROCESSOR_X86_64 +# define Q_BYTE_ORDER Q_LITTLE_ENDIAN /* Itanium (IA-64) family, no revisions or variants + + Itanium is bi-endian, use endianness auto-detection described above. */ #elif defined(__ia64) || defined(__ia64__) || defined(_M_IA64) # define Q_PROCESSOR_IA64 +// Q_BYTE_ORDER not defined, use endianness auto-detection /* MIPS family, known revisions: I, II, III, IV, 32, 64 + + MIPS is bi-endian, use endianness auto-detection described above. */ #elif defined(__mips) || defined(__mips__) || defined(_M_MRX000) # define Q_PROCESSOR_MIPS @@ -143,6 +188,7 @@ # if defined(_MIPS_ARCH_MIPS64) || defined(__mips64) # define Q_PROCESSOR_MIPS_64 # endif +// Q_BYTE_ORDER not defined, use endianness auto-detection /* Power family, known variants: 32- and 64-bit @@ -150,6 +196,8 @@ There are many more known variants/revisions that we do not handle/detect. See http://en.wikipedia.org/wiki/Power_Architecture and http://en.wikipedia.org/wiki/File:PowerISA-evolution.svg + + Power is bi-endian, use endianness auto-detection described above. */ #elif defined(__ppc__) || defined(__ppc) || defined(__powerpc__) \ || defined(_ARCH_COM) || defined(_ARCH_PWR) || defined(_ARCH_PPC) \ @@ -160,34 +208,60 @@ # else # define Q_PROCESSOR_POWER_32 # endif +// Q_BYTE_ORDER not defined, use endianness auto-detection /* S390 family, known variant: S390X (64-bit) + + S390 is big-endian. */ // #elif defined(__s390__) // # define Q_PROCESSOR_S390 // # if defined(__s390x__) // # define Q_PROCESSOR_S390_X // # endif +// # define Q_BYTE_ORDER Q_BIG_ENDIAN /* SuperH family, optional revision: SH-4A + + SuperH is bi-endian, use endianness auto-detection descrived above. */ // #elif defined(__sh__) // # define Q_PROCESSOR_SH // # if defined(__sh4a__) // # define Q_PROCESSOR_SH_4A // # endif +// Q_BYTE_ORDER not defined, use endianness auto-detection /* SPARC family, optional revision: V9 + + SPARC is big-endian only prior to V9, while V9 is bi-endian with big-endian + as the default byte order. Assume all SPARC systems are big-endian. */ // #elif defined(__sparc__) // # define Q_PROCESSOR_SPARC // # if defined(__sparc_v9__) // # define Q_PROCESSOR_SPARC_V9 // # endif +// # define Q_BYTE_ORDER Q_BIG_ENDIAN + +#endif +// Some processors support either endian format, try to detect which we are using. +#if !defined(Q_BYTE_ORDER) +# if defined(__BYTE_ORDER__) && (__BYTE_ORDER__ == Q_BIG_ENDIAN || __BYTE_ORDER__ == Q_LITTLE_ENDIAN) +// Reuse __BYTE_ORDER__ as-is, since our Q_*_ENDIAN #defines match the preprocessor defaults +# define Q_BYTE_ORDER __BYTE_ORDER__ +# elif defined(__BIG_ENDIAN__) +# define Q_BYTE_ORDER Q_BIG_ENDIAN +# elif defined(__LITTLE_ENDIAN__) \ + || defined(Q_OS_WINCE) // Windows CE is always little-endian according to MSDN. +# define Q_BYTE_ORDER Q_LITTLE_ENDIAN +# else +# error "Unable to determine byte order!" +# endif #endif #endif // QPROCESSORDETECTION_H |