summaryrefslogtreecommitdiffstats
path: root/src/corelib
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib')
-rw-r--r--src/corelib/arch/qatomic_armv6.h2
-rw-r--r--src/corelib/global/qcompilerdetection.h164
-rw-r--r--src/corelib/global/qglobal.cpp57
-rw-r--r--src/corelib/global/qglobal.h27
-rw-r--r--src/corelib/global/qisenum.h6
-rw-r--r--src/corelib/thread/qatomic.h4
-rw-r--r--src/corelib/thread/qmutex_linux.cpp37
-rw-r--r--src/corelib/tools/qlocale.cpp2
-rw-r--r--src/corelib/tools/qlocale.h7
-rw-r--r--src/corelib/tools/qlocale.qdoc8
-rw-r--r--src/corelib/tools/qlocale_data_p.h10
-rw-r--r--src/corelib/tools/qlocale_icu.cpp29
-rw-r--r--src/corelib/tools/qsimd_p.h16
13 files changed, 268 insertions, 101 deletions
diff --git a/src/corelib/arch/qatomic_armv6.h b/src/corelib/arch/qatomic_armv6.h
index 41f145ad0d..b290a6a008 100644
--- a/src/corelib/arch/qatomic_armv6.h
+++ b/src/corelib/arch/qatomic_armv6.h
@@ -387,6 +387,7 @@ bool QBasicAtomicOps<2>::testAndSetRelaxed(T &_q_value, T expectedValue, T newVa
asm volatile("0:\n"
"ldrexh %[result], [%[_q_value]]\n"
"eors %[result], %[result], %[expectedValue]\n"
+ "itt eq\n"
"strexheq %[result], %[newValue], [%[_q_value]]\n"
"teqeq %[result], #1\n"
"beq 0b\n"
@@ -497,6 +498,7 @@ bool QBasicAtomicOps<8>::testAndSetRelaxed(T &_q_value, T expectedValue, T newVa
"eor %[result], %[result], %[expectedValue]\n"
"eor %H[result], %H[result], %H[expectedValue]\n"
"orrs %[result], %[result], %H[result]\n"
+ "itt eq\n"
"strexdeq %[result], %[newValue], %H[newValue], [%[_q_value]]\n"
"teqeq %[result], #1\n"
"beq 0b\n"
diff --git a/src/corelib/global/qcompilerdetection.h b/src/corelib/global/qcompilerdetection.h
index b3787261be..c9f59454b2 100644
--- a/src/corelib/global/qcompilerdetection.h
+++ b/src/corelib/global/qcompilerdetection.h
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Intel Corporation
** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
@@ -87,6 +88,8 @@
# define Q_NO_TEMPLATE_FRIENDS
# define Q_ALIGNOF(type) __alignof(type)
# define Q_DECL_ALIGN(n) __declspec(align(n))
+# define Q_ASSUME(expr) __assume(expr)
+# define Q_UNREACHABLE() __assume(0)
/* Intel C++ disguising as Visual C++: the `using' keyword avoids warnings */
# if defined(__INTEL_COMPILER)
# define Q_CC_INTEL
@@ -140,11 +143,19 @@
# if defined(__INTEL_COMPILER)
/* Intel C++ also masquerades as GCC */
# define Q_CC_INTEL
-# endif
-# if defined(__clang__)
+# define Q_ASSUME(expr) __assume(expr)
+# define Q_UNREACHABLE() __assume(0)
+# elif defined(__clang__)
/* Clang also masquerades as GCC */
# define Q_CC_CLANG
+# define Q_ASSUME(expr) if (expr){} else __builtin_unreachable()
+# define Q_UNREACHABLE() __builtin_unreachable()
+# else
+/* Plain GCC */
+# define Q_ASSUME(expr) if (expr){} else __builtin_unreachable()
+# define Q_UNREACHABLE() __builtin_unreachable()
# endif
+
# define Q_ALIGNOF(type) __alignof__(type)
# define Q_TYPEOF(expr) __typeof__(expr)
# define Q_DECL_ALIGN(n) __attribute__((__aligned__(n)))
@@ -157,45 +168,9 @@
# define QT_NO_ARM_EABI
# endif
# endif
-# if (__GNUC__ * 100 + __GNUC_MINOR__) >= 403
+# if (__GNUC__ * 100 + __GNUC_MINOR__) >= 403 && !defined(Q_CC_CLANG)
# define Q_ALLOC_SIZE(x) __attribute__((alloc_size(x)))
# endif
-# if defined(__GXX_EXPERIMENTAL_CXX0X__) && !defined(__clang__) /* clang C++11 enablers are found below, don't do them here */
-# if (__GNUC__ * 100 + __GNUC_MINOR__) >= 403
- /* C++0x features supported in GCC 4.3: */
-# define Q_COMPILER_VARIADIC_MACROS
-# define Q_COMPILER_RVALUE_REFS
-# define Q_COMPILER_DECLTYPE
-# define Q_COMPILER_STATIC_ASSERT
-# endif
-# if (__GNUC__ * 100 + __GNUC_MINOR__) >= 404
- /* C++0x features supported in GCC 4.4: */
-# define Q_COMPILER_UNICODE_STRINGS
-# define Q_COMPILER_VARIADIC_TEMPLATES
-# define Q_COMPILER_AUTO_TYPE
-# define Q_COMPILER_EXTERN_TEMPLATES
-# define Q_COMPILER_DEFAULT_DELETE_MEMBERS
-# define Q_COMPILER_CLASS_ENUM
-# define Q_COMPILER_INITIALIZER_LISTS
-# define Q_COMPILER_ATOMICS
-# endif
-# if (__GNUC__ * 100 + __GNUC_MINOR__) >= 405
- /* C++0x features supported in GCC 4.5: */
-# define Q_COMPILER_LAMBDA
-# endif
-# if (__GNUC__ * 100 + __GNUC_MINOR__) >= 406
- /* C++0x features supported in GCC 4.6: */
-# define Q_COMPILER_NULLPTR
-# define Q_COMPILER_CONSTEXPR
-# define Q_COMPILER_UNRESTRICTED_UNIONS
-# define Q_COMPILER_RANGE_FOR
-# endif
-# if (__GNUC__ * 100 + __GNUC_MINOR__) >= 407
- /* C++0x features supported in GCC 4.7: */
-# define Q_COMPILER_EXPLICIT_OVERRIDES
-# endif
-
-# endif
/* IBM compiler versions are a bit messy. There are actually two products:
the C product, and the C++ product. The C++ compiler is always packaged
@@ -420,22 +395,66 @@
# error "Qt has not been tested with this compiler - see http://www.qt-project.org/"
#endif
+/*
+ * C++11 support
+ *
+ * Paper Macro
+ * N2341 Q_COMPILER_ALIGNAS
+ * N2341 Q_COMPILER_ALIGNOF
+ * N2427 Q_COMPILER_ATOMICS
+ * N2761 Q_COMPILER_ATTRIBUTES
+ * N2541 Q_COMPILER_AUTO_FUNCTION
+ * N1984 N2546 Q_COMPILER_AUTO_TYPE
+ * N2437 Q_COMPILER_CLASS_ENUM
+ * N2235 N3276 Q_COMPILER_DECLTYPE
+ * N2346 Q_COMPILER_DEFAULT_DELETE_MEMBERS
+ * N1986 Q_COMPILER_DELEGATING_CONSTRUCTORS
+ * N3206 N3272 Q_COMPILER_EXPLICIT_OVERRIDES (v0.9 and above only)
+ * N1987 Q_COMPILER_EXTERN_TEMPLATES
+ * N2540 Q_COMPILER_INHERITING_CONSTRUCTORS
+ * N2672 Q_COMPILER_INITIALIZER_LISTS
+ * N2658 N2927 Q_COMPILER_LAMBDA (v1.0 and above only)
+ * N2756 Q_COMPILER_NONSTATIC_MEMBER_INIT
+ * N2431 Q_COMPILER_NULLPTR
+ * N2930 Q_COMPILER_RANGE_FOR
+ * N2442 Q_COMPILER_RAW_STRINGS
+ * N2439 Q_COMPILER_REF_QUALIFIERS
+ * N2118 N2844 N3053 Q_COMPILER_RVALUE_REFS (Note: GCC 4.3 implements only the oldest)
+ * N1720 Q_COMPILER_STATIC_ASSERT
+ * N2258 Q_COMPILER_TEMPLATE_ALIAS
+ * N2659 Q_COMPILER_THREAD_LOCAL
+ * N2756 Q_COMPILER_UDL
+ * N2442 Q_COMPILER_UNICODE_STRINGS
+ * N2544 Q_COMPILER_UNRESTRICTED_UNIONS
+ * N1653 Q_COMPILER_VARIADIC_MACROS
+ * N2242 N2555 Q_COMPILER_VARIADIC_TEMPLATES
+ */
#ifdef Q_CC_INTEL
# if __INTEL_COMPILER < 1200
# define Q_NO_TEMPLATE_FRIENDS
# endif
-# if defined(__GXX_EXPERIMENTAL_CXX0X__) || defined(__GXX_EXPERIMENTAL_CPP0X__)
+# if defined(_CHAR16T) || __cplusplus >= 201103L
+# define Q_COMPILER_VARIADIC_MACROS
# if __INTEL_COMPILER >= 1200
-# define Q_COMPILER_RVALUE_REFS
-# define Q_COMPILER_EXTERN_TEMPLATES
-# define Q_COMPILER_DECLTYPE
-# define Q_COMPILER_VARIADIC_TEMPLATES
# define Q_COMPILER_AUTO_TYPE
-# define Q_COMPILER_DEFAULT_DELETE_MEMBERS
# define Q_COMPILER_CLASS_ENUM
+# define Q_COMPILER_DECLTYPE
+# define Q_COMPILER_DEFAULT_DELETE_MEMBERS
+# define Q_COMPILER_EXTERN_TEMPLATES
# define Q_COMPILER_LAMBDA
+# define Q_COMPILER_RVALUE_REFS
# define Q_COMPILER_STATIC_ASSERT
+# define Q_COMPILER_THREAD_LOCAL
+# define Q_COMPILER_VARIADIC_MACROS
+# endif
+# if __INTEL_COMPILER >= 1210
+# define Q_COMPILER_ATTRIBUTES
+# define Q_COMPILER_AUTO_FUNCTION
+# define Q_COMPILER_NULLPTR
+# define Q_COMPILER_TEMPLATE_ALIAS
+# define Q_COMPILER_UNICODE_STRINGS
+# define Q_COMPILER_VARIADIC_TEMPLATES
# endif
# endif
#endif
@@ -463,6 +482,7 @@
# define Q_COMPILER_CLASS_ENUM
/* defaulted members in 3.0, deleted members in 2.9 */
# define Q_COMPILER_DEFAULT_DELETE_MEMBERS
+# define Q_COMPILER_DELEGATING_CONSTRUCTORS
# define Q_COMPILER_EXPLICIT_OVERRIDES
# define Q_COMPILER_NULLPTR
# define Q_COMPILER_RANGE_FOR
@@ -487,6 +507,60 @@
# endif
#endif // Q_CC_CLANG
+#if defined(Q_CC_GNU) && !defined(Q_CC_INTEL) && !defined(Q_CC_CLANG)
+# if defined(__GXX_EXPERIMENTAL_CXX0X__) || __cplusplus >= 201103L
+# if (__GNUC__ * 100 + __GNUC_MINOR__) >= 403
+ /* C++11 features supported in GCC 4.3: */
+# define Q_COMPILER_DECLTYPE
+# define Q_COMPILER_RVALUE_REFS
+# define Q_COMPILER_STATIC_ASSERT
+# define Q_COMPILER_VARIADIC_MACROS
+# endif
+# if (__GNUC__ * 100 + __GNUC_MINOR__) >= 404
+ /* C++11 features supported in GCC 4.4: */
+# define Q_COMPILER_ATOMICS
+# define Q_COMPILER_AUTO_FUNCTION
+# define Q_COMPILER_AUTO_TYPE
+# define Q_COMPILER_CLASS_ENUM
+# define Q_COMPILER_DEFAULT_DELETE_MEMBERS
+# define Q_COMPILER_EXTERN_TEMPLATES
+# define Q_COMPILER_INITIALIZER_LISTS
+# define Q_COMPILER_UNICODE_STRINGS
+# define Q_COMPILER_VARIADIC_TEMPLATES
+# endif
+# if (__GNUC__ * 100 + __GNUC_MINOR__) >= 405
+ /* C++11 features supported in GCC 4.5: */
+# define Q_COMPILER_LAMBDA
+# define Q_COMPILER_RAW_STRINGS
+# endif
+# if (__GNUC__ * 100 + __GNUC_MINOR__) >= 406
+ /* C++11 features supported in GCC 4.6: */
+# define Q_COMPILER_CONSTEXPR
+# define Q_COMPILER_NULLPTR
+# define Q_COMPILER_UNRESTRICTED_UNIONS
+# define Q_COMPILER_RANGE_FOR
+# endif
+# if (__GNUC__ * 100 + __GNUC_MINOR__) >= 407
+ /* C++11 features supported in GCC 4.7: */
+# define Q_COMPILER_NONSTATIC_MEMBER_INIT
+# define Q_COMPILER_DELEGATING_CONSTRUCTORS
+# define Q_COMPILER_EXPLICIT_OVERRIDES
+# define Q_COMPILER_TEMPLATE_ALIAS
+# define Q_COMPILER_UDL
+# endif
+# endif
+#endif
+
+#if defined(Q_CC_MSVC) && _MSC_VER >= 1600 && !defined(Q_CC_INTEL)
+# define Q_COMPILER_AUTO_TYPE
+# define Q_COMPILER_LAMBDA
+# define Q_COMPILER_DECLTYPE
+# define Q_COMPILER_RVALUE_REFS
+# define Q_COMPILER_STATIC_ASSERT
+// MSVC has std::initilizer_list, but does not support the braces initialization
+//# define Q_COMPILER_INITIALIZER_LISTS
+#endif
+
#ifndef Q_COMPILER_MANGLES_RETURN_TYPE
# if defined(Q_CC_MSVC)
# define Q_COMPILER_MANGLES_RETURN_TYPE
diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp
index 09d178639d..f89b0b3421 100644
--- a/src/corelib/global/qglobal.cpp
+++ b/src/corelib/global/qglobal.cpp
@@ -1799,6 +1799,63 @@ const QSysInfo::WinVersion QSysInfo::WindowsVersion = QSysInfo::windowsVersion()
*/
/*!
+ \macro void Q_ASSUME(bool expr)
+ \relates <QtGlobal>
+ \since 5.0
+
+ Causes the compiler to assume that \a expr is true. This macro is useful
+ for improving code generation, by providing the compiler with hints about
+ conditions that it would not otherwise know about. However, there is no
+ guarantee that the compiler will actually use those hints.
+
+ This macro could be considered a "lighter" version of \ref Q_ASSERT. While
+ Q_ASSERT will abort the program's execution if the condition is false,
+ Q_ASSUME will tell the compiler not to generate code for those conditions.
+ Therefore, it is important that the assumptions always hold, otherwise
+ undefined behaviour may occur.
+
+ If \a expr is a constantly false condition, Q_ASSUME will tell the compiler
+ that the current code execution cannot be reached. That is, Q_ASSUME(false)
+ is equivalent to Q_UNREACHABLE().
+
+ \note Q_LIKELY() tells the compiler that the expression is likely, but not
+ the only possibility. Q_ASSUME tells the compiler that it is the only
+ possibility.
+
+ \sa Q_ASSERT(), Q_UNREACHABLE(), Q_LIKELY()
+*/
+
+/*!
+ \macro void Q_UNREACHABLE()
+ \relates <QtGlobal>
+ \since 5.0
+
+ Tells the compiler that the current point cannot be reached by any
+ execution, so it may optimise any code paths leading here as dead code, as
+ well as code continuing from here.
+
+ This macro is useful to mark impossible conditions. For example, given the
+ following enum:
+
+ \snippet doc/src/snippets/code/src_corelib_global_qglobal.cpp qunreachable-enum
+
+ One can write a switch table like so:
+
+ \snippet doc/src/snippets/code/src_corelib_global_qglobal.cpp qunreachable-switch
+
+ The advantage of inserting Q_UNREACHABLE() at that point is that the
+ compiler is told not to generate code for a shape variable containing that
+ value. If the macro is missing, the compiler will still generate the
+ necessary comparisons for that value. If the case label were removed, some
+ compilers could produce a warning that some enum values were not checked.
+
+ By using this macro in impossible conditions, code coverage may be improved
+ as dead code paths may be eliminated.
+
+ \sa Q_ASSERT(), Q_ASSUME(), qFatal()
+*/
+
+/*!
\macro void Q_CHECK_PTR(void *pointer)
\relates <QtGlobal>
diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h
index ee577a7563..24e05fc72c 100644
--- a/src/corelib/global/qglobal.h
+++ b/src/corelib/global/qglobal.h
@@ -163,6 +163,12 @@ namespace QT_NAMESPACE {}
#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)
@@ -476,6 +482,10 @@ QT_END_INCLUDE_NAMESPACE
# 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)
@@ -866,7 +876,7 @@ Q_CORE_EXPORT bool qSharedBuild();
Avoid "unused parameter" warnings
*/
-#if defined(Q_CC_INTEL) && !defined(Q_OS_WIN) || defined(Q_CC_RVCT)
+#if defined(Q_CC_RVCT)
template <typename T>
inline void qUnused(T &x) { (void)x; }
# define Q_UNUSED(x) qUnused(x);
@@ -1355,20 +1365,7 @@ template <typename T>
inline const QForeachContainer<T> *qForeachContainer(const QForeachContainerBase *base, const T *)
{ return static_cast<const QForeachContainer<T> *>(base); }
-#if defined(Q_CC_MIPS)
-/*
- Proper for-scoping in MIPSpro CC
-*/
-# define Q_FOREACH(variable,container) \
- if(0){}else \
- for (const QForeachContainerBase &_container_ = qForeachContainerNew(container); \
- qForeachContainer(&_container_, true ? 0 : qForeachPointer(container))->condition(); \
- ++qForeachContainer(&_container_, true ? 0 : qForeachPointer(container))->i) \
- for (variable = *qForeachContainer(&_container_, true ? 0 : qForeachPointer(container))->i; \
- qForeachContainer(&_container_, true ? 0 : qForeachPointer(container))->brk; \
- --qForeachContainer(&_container_, true ? 0 : qForeachPointer(container))->brk)
-
-#elif defined(Q_CC_DIAB)
+#if defined(Q_CC_DIAB)
// VxWorks DIAB generates unresolvable symbols, if container is a function call
# define Q_FOREACH(variable,container) \
if(0){}else \
diff --git a/src/corelib/global/qisenum.h b/src/corelib/global/qisenum.h
index ef1ccc81a8..53b856e1c2 100644
--- a/src/corelib/global/qisenum.h
+++ b/src/corelib/global/qisenum.h
@@ -44,9 +44,6 @@
#ifndef QISENUM_H
#define QISENUM_H
-QT_BEGIN_HEADER
-QT_BEGIN_NAMESPACE
-
#ifndef Q_IS_ENUM
# if defined(Q_CC_GNU) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
# define Q_IS_ENUM(x) __is_enum(x)
@@ -64,7 +61,4 @@ QT_BEGIN_NAMESPACE
# define Q_IS_ENUM(x) QtPrivate::is_enum<x>::value
#endif
-QT_END_HEADER
-QT_END_NAMESPACE
-
#endif // QISENUM_H
diff --git a/src/corelib/thread/qatomic.h b/src/corelib/thread/qatomic.h
index 94cef790db..a8e321b46a 100644
--- a/src/corelib/thread/qatomic.h
+++ b/src/corelib/thread/qatomic.h
@@ -51,7 +51,7 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-#if defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__ >= 406)
+#if defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__ >= 406) && !defined(Q_CC_INTEL)
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wextra"
#endif
@@ -157,7 +157,7 @@ public:
#endif
};
-#if defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__ >= 406)
+#if defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__ >= 406) && !defined(Q_CC_INTEL)
# pragma GCC diagnostic pop
#endif
diff --git a/src/corelib/thread/qmutex_linux.cpp b/src/corelib/thread/qmutex_linux.cpp
index b1618f7fc9..1bb5e77e77 100644
--- a/src/corelib/thread/qmutex_linux.cpp
+++ b/src/corelib/thread/qmutex_linux.cpp
@@ -45,15 +45,47 @@
#ifndef QT_NO_THREAD
#include "qatomic.h"
#include "qmutex_p.h"
-# include "qelapsedtimer.h"
+#include "qelapsedtimer.h"
#include <linux/futex.h>
#include <sys/syscall.h>
#include <unistd.h>
#include <errno.h>
+#ifndef QT_LINUX_FUTEX
+# error "Qt build is broken: qmutex_linux.cpp is being built but futex support is not wanted"
+#endif
+
QT_BEGIN_NAMESPACE
+static inline int futexFlags()
+{
+ int value = 0;
+#if defined(FUTEX_PRIVATE_FLAG)
+ // check if the kernel supports extra futex flags
+ // FUTEX_PRIVATE_FLAG appeared in v2.6.22
+ static QBasicAtomicInt futexFlagSupport = Q_BASIC_ATOMIC_INITIALIZER(-1);
+
+ value = futexFlagSupport.load();
+ if (value == -1) {
+ // try an operation that has no side-effects: wake up 42 threads
+ // futex will return -1 (errno==ENOSYS) if the flag isn't supported
+ // there should be no other error conditions
+ value = syscall(SYS_futex, &futexFlagSupport,
+ FUTEX_WAKE | FUTEX_PRIVATE_FLAG,
+ 42, 0, 0, 0);
+ if (value != -1) {
+ value = FUTEX_PRIVATE_FLAG;
+ futexFlagSupport.store(value);
+ return value;
+ }
+ value = 0;
+ futexFlagSupport.store(value);
+ }
+#endif
+ return value;
+}
+
static inline int _q_futex(void *addr, int op, int val, const struct timespec *timeout)
{
volatile int *int_addr = reinterpret_cast<volatile int *>(addr);
@@ -62,7 +94,8 @@ static inline int _q_futex(void *addr, int op, int val, const struct timespec *t
#endif
int *addr2 = 0;
int val2 = 0;
- return syscall(SYS_futex, int_addr, op, val, timeout, addr2, val2);
+
+ return syscall(SYS_futex, int_addr, op | futexFlags(), val, timeout, addr2, val2);
}
static inline QMutexData *dummyFutexValue()
diff --git a/src/corelib/tools/qlocale.cpp b/src/corelib/tools/qlocale.cpp
index e40917c5d8..2d1444c315 100644
--- a/src/corelib/tools/qlocale.cpp
+++ b/src/corelib/tools/qlocale.cpp
@@ -2080,7 +2080,7 @@ QLocale::MeasurementSystem QLocalePrivate::measurementSystem() const
for (int i = 0; i < ImperialMeasurementSystemsCount; ++i) {
if (ImperialMeasurementSystems[i].languageId == m_language_id
&& ImperialMeasurementSystems[i].countryId == m_country_id) {
- return QLocale::ImperialSystem;
+ return ImperialMeasurementSystems[i].system;
}
}
return QLocale::MetricSystem;
diff --git a/src/corelib/tools/qlocale.h b/src/corelib/tools/qlocale.h
index c029f627b2..6c97a05ba8 100644
--- a/src/corelib/tools/qlocale.h
+++ b/src/corelib/tools/qlocale.h
@@ -565,7 +565,12 @@ public:
};
// GENERATED PART ENDS HERE
- enum MeasurementSystem { MetricSystem, ImperialSystem };
+ enum MeasurementSystem {
+ MetricSystem,
+ ImperialUSSystem,
+ ImperialUKSystem,
+ ImperialSystem = ImperialUSSystem // Qt 4 compatibility
+ };
enum FormatType { LongFormat, ShortFormat, NarrowFormat };
enum NumberOption {
diff --git a/src/corelib/tools/qlocale.qdoc b/src/corelib/tools/qlocale.qdoc
index ff994ca2f3..32822c2e6e 100644
--- a/src/corelib/tools/qlocale.qdoc
+++ b/src/corelib/tools/qlocale.qdoc
@@ -672,9 +672,11 @@
\value MetricSystem This value indicates metric units, such as meters,
centimeters and millimeters.
- \value ImperialSystem This value indicates imperial units, such as inches and
- miles. There are several distinct imperial systems in the world; this
- value stands for the official United States imperial units.
+ \value ImperialUSSystem This value indicates imperial units, such as inches and
+ miles as they are used in the United States.
+ \value ImperialUKSystem This value indicates imperial units, such as inches and
+ miles as they are used in the United Kingdom.
+ \value ImperialSystem Provided for compatibility. Same as ImperialUSSystem
\since 4.4
*/
diff --git a/src/corelib/tools/qlocale_data_p.h b/src/corelib/tools/qlocale_data_p.h
index 7841b0aaff..977f54f151 100644
--- a/src/corelib/tools/qlocale_data_p.h
+++ b/src/corelib/tools/qlocale_data_p.h
@@ -62,12 +62,14 @@ struct CountryLanguage
{
quint16 languageId;
quint16 countryId;
+ QLocale::MeasurementSystem system;
};
static const CountryLanguage ImperialMeasurementSystems[] = {
- { 31, 225 },
- { 31, 226 },
- { 111, 225 },
- { 163, 225 }
+ { QLocale::English, QLocale::UnitedStates, QLocale::ImperialUSSystem },
+ { QLocale::English, QLocale::UnitedStatesMinorOutlyingIslands, QLocale::ImperialUSSystem },
+ { QLocale::Spanish, QLocale::UnitedStates, QLocale::ImperialUSSystem },
+ { QLocale::Hawaiian, QLocale::UnitedStates, QLocale::ImperialUSSystem },
+ { QLocale::English, QLocale::UnitedKingdom, QLocale::ImperialUKSystem }
};
static const int ImperialMeasurementSystemsCount =
sizeof(ImperialMeasurementSystems)/sizeof(ImperialMeasurementSystems[0]);
diff --git a/src/corelib/tools/qlocale_icu.cpp b/src/corelib/tools/qlocale_icu.cpp
index ee2e5f436a..b3b8836f11 100644
--- a/src/corelib/tools/qlocale_icu.cpp
+++ b/src/corelib/tools/qlocale_icu.cpp
@@ -81,9 +81,19 @@ bool qt_initIcu(const QString &localeString)
if (status == NotLoaded) {
// resolve libicui18n
- QLibrary lib(QLatin1String("icui18n"), QLatin1String(U_ICU_VERSION_SHORT));
+ const QString version = QString::fromLatin1(U_ICU_VERSION_SHORT);
+#ifdef Q_OS_WIN
+ // QLibrary on Windows does not use the version number, the libraries
+ // are named "icuin<version>.dll", though.
+ QString libName = QStringLiteral("icuin") + version;
+#else
+ QString libName = QStringLiteral("icui18n");
+#endif
+ QLibrary lib(libName, version);
if (!lib.load()) {
- qWarning() << "Unable to load library icui18n" << lib.errorString();
+ qWarning("Unable to load library '%s' version %s: %s",
+ qPrintable(libName), qPrintable(version),
+ qPrintable(lib.errorString()));
status = ErrorLoading;
return false;
}
@@ -104,15 +114,22 @@ bool qt_initIcu(const QString &localeString)
ptr_ucol_close = 0;
ptr_ucol_strcoll = 0;
- qWarning("Unable to find symbols in icui18n");
+ qWarning("Unable to find symbols in '%s'.", qPrintable(libName));
status = ErrorLoading;
return false;
}
// resolve libicuuc
- QLibrary ucLib(QLatin1String("icuuc"), QLatin1String(U_ICU_VERSION_SHORT));
+#ifdef Q_OS_WIN
+ libName = QStringLiteral("icuuc") + version;
+#else
+ libName = QStringLiteral("icuuc");
+#endif
+ QLibrary ucLib(libName, version);
if (!ucLib.load()) {
- qWarning() << "Unable to load library icuuc" << ucLib.errorString();
+ qWarning("Unable to load library '%s' version %s: %s",
+ qPrintable(libName), qPrintable(version),
+ qPrintable(ucLib.errorString()));
status = ErrorLoading;
return false;
}
@@ -129,7 +146,7 @@ bool qt_initIcu(const QString &localeString)
ptr_u_strToUpper = 0;
ptr_u_strToLower = 0;
- qWarning("Unable to find symbols in icuuc");
+ qWarning("Unable to find symbols in '%s'", qPrintable(libName));
status = ErrorLoading;
return false;
}
diff --git a/src/corelib/tools/qsimd_p.h b/src/corelib/tools/qsimd_p.h
index baf697a6f5..88ac7597e2 100644
--- a/src/corelib/tools/qsimd_p.h
+++ b/src/corelib/tools/qsimd_p.h
@@ -44,24 +44,8 @@
#include <qglobal.h>
-
QT_BEGIN_HEADER
-
-#if defined(QT_NO_MAC_XARCH) || (defined(Q_OS_DARWIN) && (defined(__ppc__) || defined(__ppc64__)))
-// Disable MMX and SSE on Mac/PPC builds, or if the compiler
-// does not support -Xarch argument passing
-#undef QT_HAVE_SSE
-#undef QT_HAVE_SSE2
-#undef QT_HAVE_SSE3
-#undef QT_HAVE_SSSE3
-#undef QT_HAVE_SSE4_1
-#undef QT_HAVE_SSE4_2
-#undef QT_HAVE_AVX
-#undef QT_HAVE_3DNOW
-#undef QT_HAVE_MMX
-#endif
-
#ifdef __MINGW64_VERSION_MAJOR
#include <intrin.h>
#endif