[Development] Header diff for QtCore

Thiago Macieira thiago.macieira at intel.com
Wed Jun 26 22:49:36 CEST 2013


diff --git a/src/corelib/animation/qabstractanimation.h b/src/corelib/animation/qabstractanimation.h
index 3ae7485..f1aa6c0 100644
--- a/src/corelib/animation/qabstractanimation.h
+++ b/src/corelib/animation/qabstractanimation.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtCore module of the Qt Toolkit.
@@ -44,8 +44,6 @@
 
 #include <QtCore/qobject.h>
 
-QT_BEGIN_HEADER
-
 QT_BEGIN_NAMESPACE
 
 
@@ -177,6 +175,4 @@ private:
 
 QT_END_NAMESPACE
 
-QT_END_HEADER
-
 #endif // QABSTRACTANIMATION_H
diff --git a/src/corelib/animation/qanimationgroup.h b/src/corelib/animation/qanimationgroup.h
index e370fdf..cf32f84 100644
--- a/src/corelib/animation/qanimationgroup.h
+++ b/src/corelib/animation/qanimationgroup.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtCore module of the Qt Toolkit.
@@ -44,8 +44,6 @@
 
 #include <QtCore/qabstractanimation.h>
 
-QT_BEGIN_HEADER
-
 QT_BEGIN_NAMESPACE
 
 
@@ -82,6 +80,4 @@ private:
 
 QT_END_NAMESPACE
 
-QT_END_HEADER
-
 #endif //QANIMATIONGROUP_H
diff --git a/src/corelib/animation/qparallelanimationgroup.h b/src/corelib/animation/qparallelanimationgroup.h
index 95521da..31810cf 100644
--- a/src/corelib/animation/qparallelanimationgroup.h
+++ b/src/corelib/animation/qparallelanimationgroup.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtCore module of the Qt Toolkit.
@@ -44,8 +44,6 @@
 
 #include <QtCore/qanimationgroup.h>
 
-QT_BEGIN_HEADER
-
 QT_BEGIN_NAMESPACE
 
 
@@ -80,6 +78,4 @@ private:
 
 QT_END_NAMESPACE
 
-QT_END_HEADER
-
 #endif // QPARALLELANIMATIONGROUP
diff --git a/src/corelib/animation/qpauseanimation.h b/src/corelib/animation/qpauseanimation.h
index d37388f..5c77001 100644
--- a/src/corelib/animation/qpauseanimation.h
+++ b/src/corelib/animation/qpauseanimation.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtCore module of the Qt Toolkit.
@@ -44,8 +44,6 @@
 
 #include <QtCore/qanimationgroup.h>
 
-QT_BEGIN_HEADER
-
 QT_BEGIN_NAMESPACE
 
 
@@ -78,6 +76,4 @@ private:
 
 QT_END_NAMESPACE
 
-QT_END_HEADER
-
 #endif // QPAUSEANIMATION_H
diff --git a/src/corelib/animation/qpropertyanimation.h b/src/corelib/animation/qpropertyanimation.h
index 3ced349c..f6b92cb 100644
--- a/src/corelib/animation/qpropertyanimation.h
+++ b/src/corelib/animation/qpropertyanimation.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtCore module of the Qt Toolkit.
@@ -44,8 +44,6 @@
 
 #include <QtCore/qvariantanimation.h>
 
-QT_BEGIN_HEADER
-
 QT_BEGIN_NAMESPACE
 
 
@@ -83,6 +81,4 @@ private:
 
 QT_END_NAMESPACE
 
-QT_END_HEADER
-
 #endif // QPROPERTYANIMATION_H
diff --git a/src/corelib/animation/qsequentialanimationgroup.h b/src/corelib/animation/qsequentialanimationgroup.h
index f2f1268..51b4227 100644
--- a/src/corelib/animation/qsequentialanimationgroup.h
+++ b/src/corelib/animation/qsequentialanimationgroup.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtCore module of the Qt Toolkit.
@@ -44,8 +44,6 @@
 
 #include <QtCore/qanimationgroup.h>
 
-QT_BEGIN_HEADER
-
 QT_BEGIN_NAMESPACE
 
 
@@ -90,6 +88,4 @@ private:
 
 QT_END_NAMESPACE
 
-QT_END_HEADER
-
 #endif //QSEQUENTIALANIMATIONGROUP_H
diff --git a/src/corelib/animation/qvariantanimation.h b/src/corelib/animation/qvariantanimation.h
index 7df8859..83018c3 100644
--- a/src/corelib/animation/qvariantanimation.h
+++ b/src/corelib/animation/qvariantanimation.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtCore module of the Qt Toolkit.
@@ -48,8 +48,6 @@
 #include <QtCore/qvariant.h>
 #include <QtCore/qpair.h>
 
-QT_BEGIN_HEADER
-
 QT_BEGIN_NAMESPACE
 
 
@@ -124,6 +122,4 @@ void qRegisterAnimationInterpolator(QVariant (*func)(const T &from, const T &to,
 
 QT_END_NAMESPACE
 
-QT_END_HEADER
-
 #endif //QVARIANTANIMATION_H
diff --git a/src/corelib/arch/qatomic_alpha.h b/src/corelib/arch/qatomic_alpha.h
index a2857d1..71cb112 100644
--- a/src/corelib/arch/qatomic_alpha.h
+++ b/src/corelib/arch/qatomic_alpha.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtCore module of the Qt Toolkit.
@@ -44,10 +44,17 @@
 
 #include <QtCore/qoldbasicatomic.h>
 
-QT_BEGIN_HEADER
-
 QT_BEGIN_NAMESPACE
 
+#if 0
+// silence syncqt warnings
+QT_END_NAMESPACE
+QT_END_HEADER
+
+#pragma qt_sync_skip_header_check
+#pragma qt_sync_stop_processing
+#endif
+
 #define Q_ATOMIC_INT_REFERENCE_COUNTING_IS_ALWAYS_NATIVE
 
 inline bool QBasicAtomicInt::isReferenceCountingNative()
@@ -517,6 +524,4 @@ Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddOrdered(qptrdiff valueTo
 
 QT_END_NAMESPACE
 
-QT_END_HEADER
-
 #endif // QATOMIC_ALPHA_H
diff --git a/src/corelib/arch/qatomic_armv5.h b/src/corelib/arch/qatomic_armv5.h
index b5ec00d..e0a50b3 100644
--- a/src/corelib/arch/qatomic_armv5.h
+++ b/src/corelib/arch/qatomic_armv5.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Copyright (C) 2011 Thiago Macieira <thiago at kde.org>
 ** Contact: http://www.qt-project.org/legal
 **
@@ -45,15 +45,12 @@
 
 #include <QtCore/qgenericatomic.h>
 
-QT_BEGIN_HEADER
-
 QT_BEGIN_NAMESPACE
 
 #if 0
 // silence syncqt warnings
 QT_END_NAMESPACE
-QT_END_HEADER
-
+#pragma qt_sync_skip_header_check
 #pragma qt_sync_stop_processing
 #endif
 
@@ -167,12 +164,20 @@ __asm T QBasicAtomicOps<4>::fetchAndStoreRelaxed(T &_q_value, T newValue) Q_DECL
 template<> template <typename T> inline
 T QBasicAtomicOps<4>::fetchAndStoreRelaxed(T &_q_value, T newValue) Q_DECL_NOTHROW
 {
+#if defined(__thumb__)
+    register T originalValue;
+    do {
+        originalValue = _q_value;
+    } while (_q_cmpxchg(originalValue, newValue, &_q_value) != 0);
+    return originalValue;
+#else
     T originalValue;
     asm volatile("swp %0,%2,[%3]"
                  : "=&r"(originalValue), "=m" (_q_value)
                  : "r"(newValue), "r"(&_q_value)
                  : "cc", "memory");
     return originalValue;
+#endif
 }
 #endif // Q_CC_RVCT
 
@@ -190,6 +195,4 @@ T QBasicAtomicOps<4>::fetchAndAddRelaxed(T &_q_value, typename QAtomicAdditiveTy
 
 QT_END_NAMESPACE
 
-QT_END_HEADER
-
 #endif // QATOMIC_ARMV5_H
diff --git a/src/corelib/arch/qatomic_armv6.h b/src/corelib/arch/qatomic_armv6.h
index 7c96600..7f5939e 100644
--- a/src/corelib/arch/qatomic_armv6.h
+++ b/src/corelib/arch/qatomic_armv6.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Copyright (C) 2011 Thiago Macieira <thiago at kde.org>
 ** Contact: http://www.qt-project.org/legal
 **
@@ -45,15 +45,12 @@
 
 #include <QtCore/qgenericatomic.h>
 
-QT_BEGIN_HEADER
-
 QT_BEGIN_NAMESPACE
 
 #if 0
 // silence syncqt warnings
 QT_END_NAMESPACE
-QT_END_HEADER
-
+#pragma qt_sync_skip_header_check
 #pragma qt_sync_stop_processing
 #endif
 
@@ -729,6 +726,4 @@ void QBasicAtomicOps<size>::orderedMemoryFence(const T &) Q_DECL_NOTHROW
 
 QT_END_NAMESPACE
 
-QT_END_HEADER
-
 #endif // QATOMIC_ARMV6_H
diff --git a/src/corelib/arch/qatomic_armv7.h b/src/corelib/arch/qatomic_armv7.h
index e28a1fc..1929ae0 100644
--- a/src/corelib/arch/qatomic_armv7.h
+++ b/src/corelib/arch/qatomic_armv7.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtCore module of the Qt Toolkit.
@@ -54,11 +54,12 @@
 
 #if 0
 // silence syncqt warnings
-QT_BEGIN_HEADER
 QT_BEGIN_NAMESPACE
 
 QT_END_NAMESPACE
-QT_END_HEADER
+
+#pragma qt_sync_skip_header_check
+#pragma qt_sync_stop_processing
 #endif
 
 #endif // QATOMIC_ARMV7_H
diff --git a/src/corelib/arch/qatomic_bfin.h b/src/corelib/arch/qatomic_bfin.h
index e09528c..7951930 100644
--- a/src/corelib/arch/qatomic_bfin.h
+++ b/src/corelib/arch/qatomic_bfin.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtCore module of the Qt Toolkit.
@@ -44,10 +44,17 @@
 
 #include <QtCore/qoldbasicatomic.h>
 
-QT_BEGIN_HEADER
-
 QT_BEGIN_NAMESPACE
 
+#if 0
+// silence syncqt warnings
+QT_END_NAMESPACE
+QT_END_HEADER
+
+#pragma qt_sync_skip_header_check
+#pragma qt_sync_stop_processing
+#endif
+
 #define Q_ATOMIC_INT_REFERENCE_COUNTING_IS_NOT_NATIVE
 
 inline bool QBasicAtomicInt::isReferenceCountingNative()
@@ -340,6 +347,4 @@ Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddRelease(qptrdiff valueTo
 
 QT_END_NAMESPACE
 
-QT_END_HEADER
-
 #endif // QATOMIC_BFIN_H
diff --git a/src/corelib/arch/qatomic_bootstrap.h b/src/corelib/arch/qatomic_bootstrap.h
index 3a6b6a9..160e0ab 100644
--- a/src/corelib/arch/qatomic_bootstrap.h
+++ b/src/corelib/arch/qatomic_bootstrap.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Copyright (C) 2011 Thiago Macieira <thiago at kde.org>
 ** Contact: http://www.qt-project.org/legal
 **
@@ -45,15 +45,12 @@
 
 #include <QtCore/qgenericatomic.h>
 
-QT_BEGIN_HEADER
-
 QT_BEGIN_NAMESPACE
 
 #if 0
 // silence syncqt warnings
 QT_END_NAMESPACE
-QT_END_HEADER
-
+#pragma qt_sync_skip_header_check
 #pragma qt_sync_stop_processing
 #endif
 
@@ -98,6 +95,4 @@ template <typename T> struct QAtomicOps: QGenericAtomicOps<QAtomicOps<T> >
 
 QT_END_NAMESPACE
 
-QT_END_HEADER
-
 #endif // QATOMIC_BOOTSTRAP_H
diff --git a/src/corelib/arch/qatomic_cxx11.h b/src/corelib/arch/qatomic_cxx11.h
index f7a7ba4..3119eda 100644
--- a/src/corelib/arch/qatomic_cxx11.h
+++ b/src/corelib/arch/qatomic_cxx11.h
@@ -45,14 +45,12 @@
 #include <QtCore/qgenericatomic.h>
 #include <atomic>
 
-QT_BEGIN_HEADER
 QT_BEGIN_NAMESPACE
 
 #if 0
 // silence syncqt warnings
 QT_END_NAMESPACE
-QT_END_HEADER
-
+#pragma qt_sync_skip_header_check
 #pragma qt_sync_stop_processing
 #endif
 
@@ -247,6 +245,5 @@ template <typename T> struct QAtomicOps
 #endif
 
 QT_END_NAMESPACE
-QT_END_HEADER
 
 #endif // QATOMIC_CXX0X_H
diff --git a/src/corelib/arch/qatomic_gcc.h b/src/corelib/arch/qatomic_gcc.h
index 0940ed0..bd29605 100644
--- a/src/corelib/arch/qatomic_gcc.h
+++ b/src/corelib/arch/qatomic_gcc.h
@@ -44,14 +44,12 @@
 
 #include <QtCore/qgenericatomic.h>
 
-QT_BEGIN_HEADER
 QT_BEGIN_NAMESPACE
 
 #if 0
 // silence syncqt warnings
 QT_END_NAMESPACE
-QT_END_HEADER
-
+#pragma qt_sync_skip_header_check
 #pragma qt_sync_stop_processing
 #endif
 
@@ -132,6 +130,4 @@ template <typename T> struct QAtomicOps: QGenericAtomicOps<QAtomicOps<T> >
 };
 
 QT_END_NAMESPACE
-QT_END_HEADER
-
 #endif // QATOMIC_GCC_H
diff --git a/src/corelib/arch/qatomic_ia64.h b/src/corelib/arch/qatomic_ia64.h
index e06588a..ed72036 100644
--- a/src/corelib/arch/qatomic_ia64.h
+++ b/src/corelib/arch/qatomic_ia64.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Copyright (C) 2011 Thiago Macieira <thiago at kde.org>
 ** Contact: http://www.qt-project.org/legal
 **
@@ -45,15 +45,12 @@
 
 #include <QtCore/qgenericatomic.h>
 
-QT_BEGIN_HEADER
-
 QT_BEGIN_NAMESPACE
 
 #if 0
 // silence syncqt warnings
 QT_END_NAMESPACE
-QT_END_HEADER
-
+#pragma qt_sync_skip_header_check
 #pragma qt_sync_stop_processing
 #endif
 
@@ -222,28 +219,28 @@ inline int QBasicAtomicInt::fetchAndStoreAcquire(int newValue)
 inline bool QBasicAtomicInt::testAndSetRelaxed(int expectedValue, int newValue)
 {
     register int expectedValueCopy = expectedValue;
-    return (static_cast<int>(_InterlockedCompareExchange(&_q_value, 
-							 newValue, 
-							 expectedValueCopy))
-	    == expectedValue);
+    return (static_cast<int>(_InterlockedCompareExchange(&_q_value,
+                                                         newValue,
+                                                         expectedValueCopy))
+            == expectedValue);
 }
 
 inline bool QBasicAtomicInt::testAndSetAcquire(int expectedValue, int newValue)
 {
     register int expectedValueCopy = expectedValue;
-    return (static_cast<int>(_InterlockedCompareExchange_acq(reinterpret_cast<volatile uint *>(&_q_value), 
-							     newValue, 
-							     expectedValueCopy)) 
-	    == expectedValue);
+    return (static_cast<int>(_InterlockedCompareExchange_acq(reinterpret_cast<volatile uint *>(&_q_value),
+                                                             newValue,
+                                                             expectedValueCopy))
+            == expectedValue);
 }
 
 inline bool QBasicAtomicInt::testAndSetRelease(int expectedValue, int newValue)
 {
     register int expectedValueCopy = expectedValue;
-    return (static_cast<int>(_InterlockedCompareExchange_rel(reinterpret_cast<volatile uint *>(&_q_value), 
-							     newValue, 
-							     expectedValueCopy)) 
-	    == expectedValue);
+    return (static_cast<int>(_InterlockedCompareExchange_rel(reinterpret_cast<volatile uint *>(&_q_value),
+                                                             newValue,
+                                                             expectedValueCopy))
+            == expectedValue);
 }
 
 inline int QBasicAtomicInt::fetchAndAddAcquire(int valueToAdd)
@@ -289,10 +286,10 @@ template <typename T>
 Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetRelaxed(T *expectedValue, T *newValue)
 {
     register T *expectedValueCopy = expectedValue;
-    return (_InterlockedCompareExchangePointer(reinterpret_cast<void * volatile*>(&_q_value), 
-					       newValue, 
-					       expectedValueCopy)
-	    == expectedValue);
+    return (_InterlockedCompareExchangePointer(reinterpret_cast<void * volatile*>(&_q_value),
+                                               newValue,
+                                               expectedValueCopy)
+            == expectedValue);
 }
 
 template <typename T>
@@ -304,7 +301,7 @@ Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetAcquire(T *expectedValu
     };
     x = &_q_value;
     register T *expectedValueCopy = expectedValue;
-    return (_InterlockedCompareExchange64_acq(p, quintptr(newValue), quintptr(expectedValueCopy)) 
+    return (_InterlockedCompareExchange64_acq(p, quintptr(newValue), quintptr(expectedValueCopy))
 	    == quintptr(expectedValue));
 }
 
@@ -1089,6 +1086,4 @@ T QBasicAtomicOps<size>::fetchAndAddOrdered(T &_q_value, typename QAtomicAdditiv
 
 QT_END_NAMESPACE
 
-QT_END_HEADER
-
 #endif // QATOMIC_IA64_H
diff --git a/src/corelib/arch/qatomic_integrity.h b/src/corelib/arch/qatomic_integrity.h
index d041f44..f8cfc8c 100644
--- a/src/corelib/arch/qatomic_integrity.h
+++ b/src/corelib/arch/qatomic_integrity.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtGui module of the Qt Toolkit.
@@ -45,10 +45,17 @@
 #include <QtCore/qoldbasicatomic.h>
 #include <INTEGRITY.h>
 
-QT_BEGIN_HEADER
-
 QT_BEGIN_NAMESPACE
 
+#if 0
+// silence syncqt warnings
+QT_END_NAMESPACE
+QT_END_HEADER
+
+#pragma qt_sync_skip_header_check
+#pragma qt_sync_stop_processing
+#endif
+
 #define qt_i2addr(a) reinterpret_cast<Address *>(const_cast<int *>(a))
 #define qt_p2addr(a) reinterpret_cast<Address *>(const_cast<void *>(a))
 #define qt_addr(a) reinterpret_cast<Address>(a)
@@ -284,7 +291,5 @@ Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddRelease(qptrdiff valueTo
 
 QT_END_NAMESPACE
 
-QT_END_HEADER
-
 #endif // QATOMIC_INTEGRITY_H
 
diff --git a/src/corelib/arch/qatomic_mips.h b/src/corelib/arch/qatomic_mips.h
index 2e65334..7716750 100644
--- a/src/corelib/arch/qatomic_mips.h
+++ b/src/corelib/arch/qatomic_mips.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Copyright (C) 2011 Thiago Macieira <thiago at kde.org>
 ** Contact: http://www.qt-project.org/legal
 **
@@ -45,15 +45,12 @@
 
 #include <QtCore/qgenericatomic.h>
 
-QT_BEGIN_HEADER
-
 QT_BEGIN_NAMESPACE
 
 #if 0
 // silence syncqt warnings
 QT_END_NAMESPACE
-QT_END_HEADER
-
+#pragma qt_sync_skip_header_check
 #pragma qt_sync_stop_processing
 #endif
 
@@ -362,6 +359,4 @@ T QBasicAtomicOps<8>::fetchAndAddRelaxed(T &_q_value, typename QAtomicAdditiveTy
 
 QT_END_NAMESPACE
 
-QT_END_HEADER
-
 #endif // QATOMIC_MIPS_H
diff --git a/src/corelib/arch/qatomic_msvc.h b/src/corelib/arch/qatomic_msvc.h
index bd653fc..4f91e3d 100644
--- a/src/corelib/arch/qatomic_msvc.h
+++ b/src/corelib/arch/qatomic_msvc.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtCore module of the Qt Toolkit.
@@ -214,14 +214,12 @@ extern "C" {
 
 ////////////////////////////////////////////////////////////////////////////////////////////////////
 
-QT_BEGIN_HEADER
 QT_BEGIN_NAMESPACE
 
 #if 0
 // silence syncqt warnings
 QT_END_NAMESPACE
-QT_END_HEADER
-
+#pragma qt_sync_skip_header_check
 #pragma qt_sync_stop_processing
 #endif
 
@@ -383,6 +381,4 @@ inline T *QAtomicOps<T *>::fetchAndAddRelaxed(T *&_q_value, qptrdiff valueToAdd)
 #undef QT_INTERLOCKED_EXCHANGE_ADD_POINTER
 
 QT_END_NAMESPACE
-QT_END_HEADER
-
 #endif // QATOMIC_MSVC_H
diff --git a/src/corelib/arch/qatomic_power.h b/src/corelib/arch/qatomic_power.h
index 67291c7..ad1c619 100644
--- a/src/corelib/arch/qatomic_power.h
+++ b/src/corelib/arch/qatomic_power.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtCore module of the Qt Toolkit.
@@ -44,10 +44,17 @@
 
 #include <QtCore/qoldbasicatomic.h>
 
-QT_BEGIN_HEADER
-
 QT_BEGIN_NAMESPACE
 
+#if 0
+// silence syncqt warnings
+QT_END_NAMESPACE
+QT_END_HEADER
+
+#pragma qt_sync_skip_header_check
+#pragma qt_sync_stop_processing
+#endif
+
 #define Q_ATOMIC_INT_REFERENCE_COUNTING_IS_ALWAYS_NATIVE
 
 inline bool QBasicAtomicInt::isReferenceCountingNative()
@@ -511,6 +518,4 @@ Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddOrdered(qptrdiff valueTo
 
 QT_END_NAMESPACE
 
-QT_END_HEADER
-
 #endif // QATOMIC_POWER_H
diff --git a/src/corelib/arch/qatomic_s390.h b/src/corelib/arch/qatomic_s390.h
index 4f4570c..0469f44 100644
--- a/src/corelib/arch/qatomic_s390.h
+++ b/src/corelib/arch/qatomic_s390.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtCore module of the Qt Toolkit.
@@ -44,10 +44,17 @@
 
 #include <QtCore/qoldbasicatomic.h>
 
-QT_BEGIN_HEADER
-
 QT_BEGIN_NAMESPACE
 
+#if 0
+// silence syncqt warnings
+QT_END_NAMESPACE
+QT_END_HEADER
+
+#pragma qt_sync_skip_header_check
+#pragma qt_sync_stop_processing
+#endif
+
 #define Q_ATOMIC_INT_REFERENCE_COUNTING_IS_ALWAYS_NATIVE
 
 inline bool QBasicAtomicInt::isReferenceCountingNative()
@@ -423,6 +430,4 @@ Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddRelease(qptrdiff valueTo
 
 QT_END_NAMESPACE
 
-QT_END_HEADER
-
 #endif // QATOMIC_S390_H
diff --git a/src/corelib/arch/qatomic_sh4a.h b/src/corelib/arch/qatomic_sh4a.h
index 127cd1d..08f75e4 100644
--- a/src/corelib/arch/qatomic_sh4a.h
+++ b/src/corelib/arch/qatomic_sh4a.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtCore module of the Qt Toolkit.
@@ -44,14 +44,15 @@
 
 #include <QtCore/qoldbasicatomic.h>
 
-QT_BEGIN_HEADER
-
 QT_BEGIN_NAMESPACE
 
 
 QT_END_NAMESPACE
 
-QT_END_HEADER
+#if 0
+#pragma qt_sync_skip_header_check
+#pragma qt_sync_stop_processing
+#endif
 
 #define Q_ATOMIC_INT_REFERENCE_COUNTING_IS_ALWAYS_NATIVE
 
diff --git a/src/corelib/arch/qatomic_sparc.h b/src/corelib/arch/qatomic_sparc.h
index dca8122..8aea33c 100644
--- a/src/corelib/arch/qatomic_sparc.h
+++ b/src/corelib/arch/qatomic_sparc.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtCore module of the Qt Toolkit.
@@ -44,10 +44,17 @@
 
 #include <QtCore/qoldbasicatomic.h>
 
-QT_BEGIN_HEADER
-
 QT_BEGIN_NAMESPACE
 
+#if 0
+// silence syncqt warnings
+QT_END_NAMESPACE
+QT_END_HEADER
+
+#pragma qt_sync_skip_header_check
+#pragma qt_sync_stop_processing
+#endif
+
 #if defined(_LP64)
 
 #define Q_ATOMIC_INT_REFERENCE_COUNTING_IS_ALWAYS_NATIVE
@@ -522,6 +529,4 @@ Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddRelease(qptrdiff valueTo
 
 QT_END_NAMESPACE
 
-QT_END_HEADER
-
 #endif // QATOMIC_SPARC_H
diff --git a/src/corelib/arch/qatomic_unix.h b/src/corelib/arch/qatomic_unix.h
index 2f9cc18..03c7d2e 100644
--- a/src/corelib/arch/qatomic_unix.h
+++ b/src/corelib/arch/qatomic_unix.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtCore module of the Qt Toolkit.
@@ -44,14 +44,12 @@
 
 #include <QtCore/qgenericatomic.h>
 
-QT_BEGIN_HEADER
 QT_BEGIN_NAMESPACE
 
 #if 0
 // silence syncqt warnings
 QT_END_NAMESPACE
-QT_END_HEADER
-
+#pragma qt_sync_skip_header_check
 #pragma qt_sync_stop_processing
 #endif
 
@@ -112,6 +110,4 @@ struct QAtomicOps<T *> : QGenericAtomicOps<QAtomicOps<T *> >
 };
 
 QT_END_NAMESPACE
-QT_END_HEADER
-
 #endif // QATOMIC_UNIX_H
diff --git a/src/corelib/arch/qatomic_vxworks.h b/src/corelib/arch/qatomic_vxworks.h
index 22e4731..57e3b6a 100644
--- a/src/corelib/arch/qatomic_vxworks.h
+++ b/src/corelib/arch/qatomic_vxworks.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the qmake spec of the Qt Toolkit.
@@ -42,8 +42,6 @@
 #ifndef QATOMIC_VXWORKS_H
 #define QATOMIC_VXWORKS_H
 
-QT_BEGIN_HEADER
-
 #if defined(__ppc)
 #  include <QtCore/qatomic_power.h>
 #else // generic implementation with taskLock()
@@ -56,14 +54,28 @@ QT_BEGIN_HEADER
 #  include <vxWorksCommon.h>
 #  include <taskLib.h>
 #else
+#if defined(_WRS_KERNEL)
 extern "C" int taskLock();
 extern "C" int taskUnlock();
+#else
+inline int taskLock() { return 0; }
+inline int taskUnlock() { return 0; }
+#endif
 #endif
 
 
 
 QT_BEGIN_NAMESPACE
 
+#if 0
+// silence syncqt warnings
+QT_END_NAMESPACE
+QT_END_HEADER
+
+#pragma qt_sync_skip_header_check
+#pragma qt_sync_stop_processing
+#endif
+
 #define Q_ATOMIC_INT_REFERENCE_COUNTING_IS_NOT_NATIVE
 
 inline bool QBasicAtomicInt::isReferenceCountingNative()
@@ -315,6 +327,4 @@ QT_END_NAMESPACE
 
 #endif // generic implementation with taskLock()
 
-QT_END_HEADER
-
 #endif // QATOMIC_VXWORKS_H
diff --git a/src/corelib/arch/qatomic_x86.h b/src/corelib/arch/qatomic_x86.h
index 5cef44b..f8180ad 100644
--- a/src/corelib/arch/qatomic_x86.h
+++ b/src/corelib/arch/qatomic_x86.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Copyright (C) 2011 Thiago Macieira <thiago at kde.org>
 ** Contact: http://www.qt-project.org/legal
 **
@@ -45,15 +45,12 @@
 
 #include <QtCore/qgenericatomic.h>
 
-QT_BEGIN_HEADER
-
 QT_BEGIN_NAMESPACE
 
 #if 0
 // silence syncqt warnings
 QT_END_NAMESPACE
-QT_END_HEADER
-
+#pragma qt_sync_skip_header_check
 #pragma qt_sync_stop_processing
 #endif
 
@@ -423,6 +420,4 @@ template <> struct QBasicAtomicOps<8>: QGenericAtomicOps<QBasicAtomicOps<8> >
 
 QT_END_NAMESPACE
 
-QT_END_HEADER
-
 #endif // QATOMIC_X86_H
diff --git a/src/corelib/codecs/qtextcodec.h b/src/corelib/codecs/qtextcodec.h
index f34fd19..35ff83a 100644
--- a/src/corelib/codecs/qtextcodec.h
+++ b/src/corelib/codecs/qtextcodec.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtCore module of the Qt Toolkit.
@@ -45,8 +45,6 @@
 #include <QtCore/qstring.h>
 #include <QtCore/qlist.h>
 
-QT_BEGIN_HEADER
-
 QT_BEGIN_NAMESPACE
 
 
@@ -166,6 +164,4 @@ private:
 
 QT_END_NAMESPACE
 
-QT_END_HEADER
-
 #endif // QTEXTCODEC_H
diff --git a/src/corelib/global/qcompilerdetection.h b/src/corelib/global/qcompilerdetection.h
index 7fae3d9..b685c1f 100644
--- a/src/corelib/global/qcompilerdetection.h
+++ b/src/corelib/global/qcompilerdetection.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Copyright (C) 2012 Intel Corporation
 ** Contact: http://www.qt-project.org/legal
 **
@@ -94,8 +94,8 @@
 #  define Q_FUNC_INFO __FUNCSIG__
 #  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)
+#  define Q_ASSUME_IMPL(expr) __assume(expr)
+#  define Q_UNREACHABLE_IMPL() __assume(0)
 #  define Q_NORETURN __declspec(noreturn)
 #  define Q_DECL_DEPRECATED __declspec(deprecated)
 #  define Q_DECL_EXPORT __declspec(dllexport)
@@ -150,18 +150,22 @@
 #  if defined(__INTEL_COMPILER)
 /* Intel C++ also masquerades as GCC */
 #    define Q_CC_INTEL
-#    define Q_ASSUME(expr)  __assume(expr)
-#    define Q_UNREACHABLE() __assume(0)
+#    define Q_ASSUME_IMPL(expr)  __assume(expr)
+#    define Q_UNREACHABLE_IMPL() __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()
+#    define Q_ASSUME_IMPL(expr)  if (expr){} else __builtin_unreachable()
+#    define Q_UNREACHABLE_IMPL() __builtin_unreachable()
+#    if !defined(__has_extension)
+#      /* Compatibility with older Clang versions */
+#      define __has_extension __has_feature
+#    endif
 #  else
 /* Plain GCC */
 #    if (__GNUC__ * 100 + __GNUC_MINOR__) >= 405
-#      define Q_ASSUME(expr)  if (expr){} else __builtin_unreachable()
-#      define Q_UNREACHABLE() __builtin_unreachable()
+#      define Q_ASSUME_IMPL(expr)  if (expr){} else __builtin_unreachable()
+#      define Q_UNREACHABLE_IMPL() __builtin_unreachable()
 #    endif
 #  endif
 
@@ -179,6 +183,7 @@
 #  define Q_TYPEOF(expr)    __typeof__(expr)
 #  define Q_DECL_DEPRECATED __attribute__ ((__deprecated__))
 #  define Q_DECL_ALIGN(n)   __attribute__((__aligned__(n)))
+#  define Q_DECL_UNUSED     __attribute__((__unused__))
 #  define Q_LIKELY(expr)    __builtin_expect(!!(expr), true)
 #  define Q_UNLIKELY(expr)  __builtin_expect(!!(expr), false)
 #  define Q_NORETURN        __attribute__((__noreturn__))
@@ -462,7 +467,7 @@
 #  if __INTEL_COMPILER < 1200
 #    define Q_NO_TEMPLATE_FRIENDS
 #  endif
-#  if defined(_CHAR16T) || __cplusplus >= 201103L
+#  if __cplusplus >= 201103L
 #    define Q_COMPILER_VARIADIC_MACROS
 #    if __INTEL_COMPILER >= 1200
 #      define Q_COMPILER_AUTO_TYPE
@@ -613,7 +618,6 @@
 #    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
@@ -637,6 +641,11 @@
 #      define Q_COMPILER_RANGE_FOR
 #    endif
 #    if (__GNUC__ * 100 + __GNUC_MINOR__) >= 407
+       /* GCC 4.4 implemented <atomic> and std::atomic using its old intrinsics.
+        * However, the implementation is incomplete for most platforms until GCC 4.7:
+        * instead, std::atomic would use an external lock. Since we need an std::atomic
+        * that is behavior-compatible with QBasicAtomic, we only enable it here */
+#      define Q_COMPILER_ATOMICS
        /* GCC 4.6.x has problems dealing with noexcept expressions,
         * so turn the feature on for 4.7 and above, only */
 #      define Q_COMPILER_NOEXCEPT
@@ -653,7 +662,11 @@
 #      define Q_COMPILER_ALIGNOF
 #      define Q_COMPILER_INHERITING_CONSTRUCTORS
 #      define Q_COMPILER_THREAD_LOCAL
+#      if (__GNUC__ * 100 + __GNUC_MINOR__) > 408 || __GNUC_PATCHLEVEL__ >= 1
+#         define Q_COMPILER_REF_QUALIFIERS
+#      endif
 #    endif
+     /* C++11 features are complete as of GCC 4.8.1 */
 #  endif
 #endif
 
@@ -673,6 +686,7 @@
 #    endif
 #    if _MSC_VER >= 1600
        /* C++11 features supported in VC10 = VC2010: */
+#      define Q_COMPILER_AUTO_FUNCTION
 #      define Q_COMPILER_AUTO_TYPE
 #      define Q_COMPILER_LAMBDA
 #      define Q_COMPILER_DECLTYPE
@@ -693,7 +707,7 @@
 #endif /* Q_CC_MSVC */
 
 #ifdef __cplusplus
-# if defined(Q_OS_BLACKBERRY) || defined(Q_OS_QNX)
+# if defined(Q_OS_QNX)
 #  include <utility>
 #  if defined(_YVALS) || defined(_LIBCPP_VER)
 // QNX: libcpp (Dinkumware-based) doesn't have the <initializer_list>
@@ -702,9 +716,12 @@
 #    ifdef Q_COMPILER_INITIALIZER_LISTS
 #      undef Q_COMPILER_INITIALIZER_LISTS
 #    endif
+#    ifdef Q_COMPILER_RVALUE_REFS
+#      undef Q_COMPILER_RVALUE_REFS
+#    endif
 #  endif
 # endif
-#endif // Q_OS_BLACKBERRY || Q_OS_QNX
+#endif // Q_OS_QNX
 
 /*
  * C++11 keywords and expressions
@@ -785,11 +802,11 @@
 #ifndef Q_UNLIKELY
 #  define Q_UNLIKELY(x) (x)
 #endif
-#ifndef Q_ASSUME
-#  define Q_ASSUME(expr) qt_noop()
+#ifndef Q_ASSUME_IMPL
+#  define Q_ASSUME_IMPL(expr) qt_noop()
 #endif
-#ifndef Q_UNREACHABLE
-#  define Q_UNREACHABLE() qt_noop()
+#ifndef Q_UNREACHABLE_IMPL
+#  define Q_UNREACHABLE_IMPL() qt_noop()
 #endif
 #ifndef Q_ALLOC_SIZE
 #  define Q_ALLOC_SIZE(x)
@@ -812,6 +829,9 @@
 #ifndef Q_DECL_HIDDEN
 #  define Q_DECL_HIDDEN
 #endif
+#ifndef Q_DECL_UNUSED
+#  define Q_DECL_UNUSED
+#endif
 #ifndef Q_FUNC_INFO
 #  if defined(Q_OS_SOLARIS) || defined(Q_CC_XLC)
 #    define Q_FUNC_INFO __FILE__ "(line number unavailable)"
@@ -847,4 +867,18 @@
 #define qMove(x) (x)
 #endif
 
+#define Q_UNREACHABLE() \
+    do {\
+        Q_ASSERT_X(false, "Q_UNREACHABLE()", "Q_UNREACHABLE was reached");\
+        Q_UNREACHABLE_IMPL();\
+    } while (0)
+
+#define Q_ASSUME(Expr) \
+    do {\
+        const bool valueOfExpression = Expr;\
+        Q_ASSERT_X(valueOfExpression, "Q_ASSUME()", "Assumption in Q_ASSUME(\"" #Expr "\") was not correct");\
+        Q_ASSUME_IMPL(valueOfExpression);\
+        Q_UNUSED(valueOfExpression); /* the value may not be used if Q_ASSERT_X and Q_ASSUME_IMPL are noop */\
+    } while (0)
+
 #endif // QCOMPILERDETECTION_H
diff --git a/src/corelib/global/qconfig-dist.h b/src/corelib/global/qconfig-dist.h
index 3d95e94..7b49102 100644
--- a/src/corelib/global/qconfig-dist.h
+++ b/src/corelib/global/qconfig-dist.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtCore module of the Qt Toolkit.
diff --git a/src/corelib/global/qconfig-large.h b/src/corelib/global/qconfig-large.h
index b621104..584be07 100644
--- a/src/corelib/global/qconfig-large.h
+++ b/src/corelib/global/qconfig-large.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtCore module of the Qt Toolkit.
diff --git a/src/corelib/global/qconfig-medium.h b/src/corelib/global/qconfig-medium.h
index c62d700..132c8ce 100644
--- a/src/corelib/global/qconfig-medium.h
+++ b/src/corelib/global/qconfig-medium.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtCore module of the Qt Toolkit.
diff --git a/src/corelib/global/qconfig-minimal.h b/src/corelib/global/qconfig-minimal.h
index 6a21492..cc5ac99 100644
--- a/src/corelib/global/qconfig-minimal.h
+++ b/src/corelib/global/qconfig-minimal.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtCore module of the Qt Toolkit.
diff --git a/src/corelib/global/qconfig-nacl.h b/src/corelib/global/qconfig-nacl.h
index 9dac73e..c2854b2 100644
--- a/src/corelib/global/qconfig-nacl.h
+++ b/src/corelib/global/qconfig-nacl.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtCore module of the Qt Toolkit.
diff --git a/src/corelib/global/qconfig-small.h b/src/corelib/global/qconfig-small.h
index 405521c..f730b3d 100644
--- a/src/corelib/global/qconfig-small.h
+++ b/src/corelib/global/qconfig-small.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtCore module of the Qt Toolkit.
diff --git a/src/corelib/global/qendian.h b/src/corelib/global/qendian.h
index 166774f..9b939fe 100644
--- a/src/corelib/global/qendian.h
+++ b/src/corelib/global/qendian.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtCore module of the Qt Toolkit.
@@ -52,8 +52,6 @@
 #include <byteswap.h>
 #endif
 
-QT_BEGIN_HEADER
-
 QT_BEGIN_NAMESPACE
 
 
@@ -80,7 +78,10 @@ template <typename T> inline void qbswap(const T src, uchar *dest)
 // If you want to avoid the memcopy, you must write specializations for this function
 template <typename T> inline void qToUnaligned(const T src, uchar *dest)
 {
-    memcpy(dest, &src, sizeof(T));
+    // Using sizeof(T) inside memcpy function produces internal compiler error with
+    // MSVC2008/ARM in tst_endian -> use extra indirection to resolve size of T.
+    const size_t size = sizeof(T);
+    memcpy(dest, &src, size);
 }
 
 /* T qFromLittleEndian(const uchar *src)
@@ -386,6 +387,4 @@ template <> inline qint8 qbswap<qint8>(qint8 source)
 
 QT_END_NAMESPACE
 
-QT_END_HEADER
-
 #endif // QENDIAN_H
diff --git a/src/corelib/global/qfeatures.h b/src/corelib/global/qfeatures.h
index a63d3a3..f2e5dc7 100644
--- a/src/corelib/global/qfeatures.h
+++ b/src/corelib/global/qfeatures.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtCore module of the Qt Toolkit.
@@ -154,6 +154,9 @@
 // Properties
 //#define QT_NO_PROPERTIES
 
+// QRegularExpression
+//#define QT_NO_REGULAREXPRESSION
+
 // Resize Handler
 //#define QT_NO_RESIZEHANDLER
 
@@ -298,6 +301,11 @@
 #define QT_NO_IM
 #endif
 
+// QImageIOPlugin
+#if !defined(QT_NO_IMAGEFORMATPLUGIN) && (defined(QT_NO_LIBRARY))
+#define QT_NO_IMAGEFORMATPLUGIN
+#endif
+
 // QLocalServer
 #if !defined(QT_NO_LOCALSERVER) && (defined(QT_NO_TEMPORARYFILE))
 #define QT_NO_LOCALSERVER
@@ -378,7 +386,7 @@
 #define QT_NO_CONTEXTMENU
 #endif
 
-// QtDBus module
+// Qt D-Bus module
 #if !defined(QT_NO_DBUS) && (defined(QT_NO_PROPERTIES) || defined(QT_NO_DOM))
 #define QT_NO_DBUS
 #endif
diff --git a/src/corelib/global/qflags.h b/src/corelib/global/qflags.h
index cbd7185..5b7edba 100644
--- a/src/corelib/global/qflags.h
+++ b/src/corelib/global/qflags.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtCore module of the Qt Toolkit.
@@ -47,8 +47,6 @@
 #include <QtCore/qtypeinfo.h>
 #include <QtCore/qtypetraits.h>
 
-QT_BEGIN_HEADER
-
 QT_BEGIN_NAMESPACE
 
 class QFlag
@@ -81,11 +79,11 @@ class QFlags
 {
     Q_STATIC_ASSERT_X((sizeof(Enum) <= sizeof(int)),
                       "QFlags uses an int as storage, so an enum with underlying "
-                      "long long would overflow. Qt 5.1 will have support for 64bit enums.");
+                      "long long will overflow.");
     struct Private;
     typedef int (Private::*Zero);
 public:
-#ifndef qdoc
+#ifndef Q_QDOC
     typedef typename QtPrivate::if_<
             QtPrivate::is_unsigned<Enum>::value,
             unsigned int,
@@ -94,36 +92,37 @@ public:
 #endif
     typedef Enum enum_type;
     // compiler-generated copy/move ctor/assignment operators are fine!
-#ifdef qdoc
+#ifdef Q_QDOC
     typedef int Int; // the real typedef above is too complex for qdoc
     inline QFlags(const QFlags &other);
     inline QFlags &operator=(const QFlags &other);
 #endif
-    Q_DECL_CONSTEXPR inline QFlags(Enum f) : i(f) {}
+    Q_DECL_CONSTEXPR inline QFlags(Enum f) : i(Int(f)) {}
     Q_DECL_CONSTEXPR inline QFlags(Zero = 0) : i(0) {}
     Q_DECL_CONSTEXPR inline QFlags(QFlag f) : i(f) {}
 
     inline QFlags &operator&=(int mask) { i &= mask; return *this; }
     inline QFlags &operator&=(uint mask) { i &= mask; return *this; }
+    inline QFlags &operator&=(Enum mask) { i &= Int(mask); return *this; }
     inline QFlags &operator|=(QFlags f) { i |= f.i; return *this; }
-    inline QFlags &operator|=(Enum f) { i |= f; return *this; }
+    inline QFlags &operator|=(Enum f) { i |= Int(f); return *this; }
     inline QFlags &operator^=(QFlags f) { i ^= f.i; return *this; }
-    inline QFlags &operator^=(Enum f) { i ^= f; return *this; }
+    inline QFlags &operator^=(Enum f) { i ^= Int(f); return *this; }
 
     Q_DECL_CONSTEXPR  inline operator Int() const { return i; }
 
     Q_DECL_CONSTEXPR inline QFlags operator|(QFlags f) const { return QFlags(Enum(i | f.i)); }
-    Q_DECL_CONSTEXPR inline QFlags operator|(Enum f) const { return QFlags(Enum(i | f)); }
+    Q_DECL_CONSTEXPR inline QFlags operator|(Enum f) const { return QFlags(Enum(i | Int(f))); }
     Q_DECL_CONSTEXPR inline QFlags operator^(QFlags f) const { return QFlags(Enum(i ^ f.i)); }
-    Q_DECL_CONSTEXPR inline QFlags operator^(Enum f) const { return QFlags(Enum(i ^ f)); }
+    Q_DECL_CONSTEXPR inline QFlags operator^(Enum f) const { return QFlags(Enum(i ^ Int(f))); }
     Q_DECL_CONSTEXPR inline QFlags operator&(int mask) const { return QFlags(Enum(i & mask)); }
     Q_DECL_CONSTEXPR inline QFlags operator&(uint mask) const { return QFlags(Enum(i & mask)); }
-    Q_DECL_CONSTEXPR inline QFlags operator&(Enum f) const { return QFlags(Enum(i & f)); }
+    Q_DECL_CONSTEXPR inline QFlags operator&(Enum f) const { return QFlags(Enum(i & Int(f))); }
     Q_DECL_CONSTEXPR inline QFlags operator~() const { return QFlags(Enum(~i)); }
 
     Q_DECL_CONSTEXPR inline bool operator!() const { return !i; }
 
-    Q_DECL_CONSTEXPR inline bool testFlag(Enum f) const { return (i & f) == f && (f != 0 || i == Int(f) ); }
+    Q_DECL_CONSTEXPR inline bool testFlag(Enum f) const { return (i & Int(f)) == Int(f) && (Int(f) != 0 || i == Int(f) ); }
 private:
     Int i;
 };
@@ -152,6 +151,4 @@ typedef uint Flags;
 
 QT_END_NAMESPACE
 
-QT_END_HEADER
-
 #endif // QFLAGS_H
diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h
index 6c2900e..79e32fe 100644
--- a/src/corelib/global/qglobal.h
+++ b/src/corelib/global/qglobal.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Copyright (C) 2012 Intel Corporation.
 ** Contact: http://www.qt-project.org/legal
 **
@@ -45,11 +45,11 @@
 
 #include <stddef.h>
 
-#define QT_VERSION_STR   "5.0.0"
+#define QT_VERSION_STR   "5.1.0"
 /*
    QT_VERSION is (major << 16) + (minor << 8) + patch.
 */
-#define QT_VERSION 0x050000
+#define QT_VERSION 0x050100
 /*
    can be used like #if (QT_VERSION >= QT_VERSION_CHECK(4, 4, 0))
 */
@@ -151,6 +151,7 @@ namespace QT_NAMESPACE {}
 
 #endif /* __cplusplus */
 
+// ### Qt6: remove me.
 #define QT_BEGIN_HEADER
 #define QT_END_HEADER
 
@@ -158,7 +159,6 @@ namespace QT_NAMESPACE {}
 #  define QT_LARGEFILE_SUPPORT 64
 #endif
 
-QT_BEGIN_HEADER
 QT_BEGIN_NAMESPACE
 
 /*
@@ -203,7 +203,11 @@ typedef quint64 qulonglong;
 QT_BEGIN_INCLUDE_NAMESPACE
 typedef unsigned char uchar;
 typedef unsigned short ushort;
+#if defined(Q_QDOC) || !defined(Q_OS_ANDROID)
 typedef unsigned int uint;
+#else
+# include <sys/types.h>
+#endif
 typedef unsigned long ulong;
 QT_END_INCLUDE_NAMESPACE
 
@@ -470,7 +474,7 @@ typedef qptrdiff qintptr;
 #  else
 #    define QT_ENSURE_STACK_ALIGNED_FOR_SSE
 #  endif
-#  define QT_WIN_CALLBACK CALLBACK QT_ENSURE_STACK_ALIGNED_FOR_SSE 
+#  define QT_WIN_CALLBACK CALLBACK QT_ENSURE_STACK_ALIGNED_FOR_SSE
 #endif
 
 typedef int QNoImplicitBoolCast;
@@ -512,6 +516,16 @@ template <typename T>
 Q_DECL_CONSTEXPR inline const T &qBound(const T &min, const T &val, const T &max)
 { return qMax(min, qMin(max, val)); }
 
+#ifdef Q_OS_DARWIN
+#  define QT_MAC_PLATFORM_SDK_EQUAL_OR_ABOVE(osx, ios) \
+    (defined(__MAC_OS_X_VERSION_MAX_ALLOWED) && __MAC_OS_X_VERSION_MAX_ALLOWED >= osx) || \
+    (defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= ios)
+
+#  define QT_MAC_DEPLOYMENT_TARGET_BELOW(osx, ios) \
+    (defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && osx != __MAC_NA && __MAC_OS_X_VERSION_MIN_REQUIRED < osx) || \
+    (defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && ios != __IPHONE_NA && __IPHONE_OS_VERSION_MIN_REQUIRED < ios)
+#endif
+
 /*
    Data stream functions are provided by many classes (defined in qdatastream.h)
 */
@@ -664,133 +678,14 @@ typedef void (*QFunctionPointer)();
 #  define Q_UNIMPLEMENTED() qWarning("%s:%d: %s: Unimplemented code.", __FILE__, __LINE__, Q_FUNC_INFO)
 #endif
 
-#if defined(QT_NO_THREAD)
-
-template <typename T>
-class QGlobalStatic
-{
-public:
-    T *pointer;
-    inline QGlobalStatic(T *p) : pointer(p) { }
-    inline ~QGlobalStatic() { pointer = 0; }
-};
-
-#define Q_GLOBAL_STATIC(TYPE, NAME)                                  \
-    static TYPE *NAME()                                              \
-    {                                                                \
-        static TYPE thisVariable;                                    \
-        static QGlobalStatic<TYPE > thisGlobalStatic(&thisVariable); \
-        return thisGlobalStatic.pointer;                             \
-    }
-
-#define Q_GLOBAL_STATIC_WITH_ARGS(TYPE, NAME, ARGS)                  \
-    static TYPE *NAME()                                              \
-    {                                                                \
-        static TYPE thisVariable ARGS;                               \
-        static QGlobalStatic<TYPE > thisGlobalStatic(&thisVariable); \
-        return thisGlobalStatic.pointer;                             \
-    }
-
-#define Q_GLOBAL_STATIC_WITH_INITIALIZER(TYPE, NAME, INITIALIZER)    \
-    static TYPE *NAME()                                              \
-    {                                                                \
-        static TYPE thisVariable;                                    \
-        static QGlobalStatic<TYPE > thisGlobalStatic(0);             \
-        if (!thisGlobalStatic.pointer) {                             \
-            TYPE *x = thisGlobalStatic.pointer = &thisVariable;      \
-            INITIALIZER;                                             \
-        }                                                            \
-        return thisGlobalStatic.pointer;                             \
-    }
-
-#else
-
-// forward declaration, since qatomic.h needs qglobal.h
-template <typename T> class QBasicAtomicPointer;
-
-// POD for Q_GLOBAL_STATIC
-template <typename T>
-class QGlobalStatic
-{
-public:
-    QBasicAtomicPointer<T> pointer;
-    bool destroyed;
-};
-
-// Created as a function-local static to delete a QGlobalStatic<T>
-template <typename T>
-class QGlobalStaticDeleter
-{
-public:
-    QGlobalStatic<T> &globalStatic;
-    QGlobalStaticDeleter(QGlobalStatic<T> &_globalStatic)
-        : globalStatic(_globalStatic)
-    { }
-
-    inline ~QGlobalStaticDeleter()
-    {
-        delete globalStatic.pointer.load();
-        globalStatic.pointer.store(0);
-        globalStatic.destroyed = true;
-    }
-};
-
-#define Q_GLOBAL_STATIC(TYPE, NAME)                                           \
-    static TYPE *NAME()                                                       \
-    {                                                                         \
-        static QGlobalStatic<TYPE > thisGlobalStatic                          \
-                            = { Q_BASIC_ATOMIC_INITIALIZER(0), false };       \
-        if (!thisGlobalStatic.pointer.load() && !thisGlobalStatic.destroyed) { \
-            TYPE *x = new TYPE;                                               \
-            if (!thisGlobalStatic.pointer.testAndSetOrdered(0, x))            \
-                delete x;                                                     \
-            else                                                              \
-                static QGlobalStaticDeleter<TYPE > cleanup(thisGlobalStatic); \
-        }                                                                     \
-        return thisGlobalStatic.pointer.load();                               \
-    }
-
-#define Q_GLOBAL_STATIC_WITH_ARGS(TYPE, NAME, ARGS)                           \
-    static TYPE *NAME()                                                       \
-    {                                                                         \
-        static QGlobalStatic<TYPE > thisGlobalStatic                          \
-                            = { Q_BASIC_ATOMIC_INITIALIZER(0), false };       \
-        if (!thisGlobalStatic.pointer.load() && !thisGlobalStatic.destroyed) {       \
-            TYPE *x = new TYPE ARGS;                                          \
-            if (!thisGlobalStatic.pointer.testAndSetOrdered(0, x))            \
-                delete x;                                                     \
-            else                                                              \
-                static QGlobalStaticDeleter<TYPE > cleanup(thisGlobalStatic); \
-        }                                                                     \
-        return thisGlobalStatic.pointer.load();                               \
-    }
-
-#define Q_GLOBAL_STATIC_WITH_INITIALIZER(TYPE, NAME, INITIALIZER)             \
-    static TYPE *NAME()                                                       \
-    {                                                                         \
-        static QGlobalStatic<TYPE > thisGlobalStatic                          \
-                            = { Q_BASIC_ATOMIC_INITIALIZER(0), false };       \
-        if (!thisGlobalStatic.pointer.load() && !thisGlobalStatic.destroyed) {       \
-            QScopedPointer<TYPE > x(new TYPE);                                \
-            INITIALIZER;                                                      \
-            if (thisGlobalStatic.pointer.testAndSetOrdered(0, x.data())) {    \
-                static QGlobalStaticDeleter<TYPE > cleanup(thisGlobalStatic); \
-                x.take();                                                     \
-            }                                                                 \
-        }                                                                     \
-        return thisGlobalStatic.pointer.load();                               \
-    }
-
-#endif
-
 Q_DECL_CONSTEXPR static inline bool qFuzzyCompare(double p1, double p2)
 {
-    return (qAbs(p1 - p2) <= 0.000000000001 * qMin(qAbs(p1), qAbs(p2)));
+    return (qAbs(p1 - p2) * 1000000000000. <= qMin(qAbs(p1), qAbs(p2)));
 }
 
 Q_DECL_CONSTEXPR static inline bool qFuzzyCompare(float p1, float p2)
 {
-    return (qAbs(p1 - p2) <= 0.00001f * qMin(qAbs(p1), qAbs(p2)));
+    return (qAbs(p1 - p2) * 100000.f <= qMin(qAbs(p1), qAbs(p2)));
 }
 
 /*!
@@ -1053,6 +948,7 @@ Q_CORE_EXPORT QString qtTrId(const char *id, int n = -1);
 class QByteArray;
 Q_CORE_EXPORT QByteArray qgetenv(const char *varName);
 Q_CORE_EXPORT bool qputenv(const char *varName, const QByteArray& value);
+Q_CORE_EXPORT bool qunsetenv(const char *varName);
 
 Q_CORE_EXPORT bool qEnvironmentVariableIsEmpty(const char *varName) Q_DECL_NOEXCEPT;
 Q_CORE_EXPORT bool qEnvironmentVariableIsSet(const char *varName) Q_DECL_NOEXCEPT;
@@ -1087,7 +983,8 @@ template <typename T> struct QEnableIf<true, T> { typedef T Type; };
 }
 
 QT_END_NAMESPACE
-QT_END_HEADER
+// Q_GLOBAL_STATIC
+#include <QtCore/qglobalstatic.h>
 
 // qDebug and friends
 #include <QtCore/qlogging.h>
diff --git a/src/corelib/global/qisenum.h b/src/corelib/global/qisenum.h
index 104c5a4..577007b 100644
--- a/src/corelib/global/qisenum.h
+++ b/src/corelib/global/qisenum.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtCore module of the Qt Toolkit.
@@ -62,9 +62,6 @@
 #endif
 
 // shut up syncqt
-QT_BEGIN_HEADER
 QT_BEGIN_NAMESPACE
 QT_END_NAMESPACE
-QT_END_HEADER
-
 #endif // QISENUM_H
diff --git a/src/corelib/global/qlibraryinfo.h b/src/corelib/global/qlibraryinfo.h
index a574b4b..b275e01 100644
--- a/src/corelib/global/qlibraryinfo.h
+++ b/src/corelib/global/qlibraryinfo.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtCore module of the Qt Toolkit.
@@ -45,8 +45,6 @@
 #include <QtCore/qstring.h>
 #include <QtCore/qdatetime.h>
 
-QT_BEGIN_HEADER
-
 QT_BEGIN_NAMESPACE
 
 class Q_CORE_EXPORT QLibraryInfo
@@ -84,6 +82,7 @@ public:
         SysrootPath,
         HostPrefixPath,
         HostBinariesPath,
+        HostLibrariesPath,
         HostDataPath,
         TargetSpecPath,
         HostSpecPath,
@@ -103,6 +102,4 @@ private:
 
 QT_END_NAMESPACE
 
-QT_END_HEADER
-
 #endif // QLIBRARYINFO_H
diff --git a/src/corelib/global/qlogging.h b/src/corelib/global/qlogging.h
index 4a4eb26..2b798f9 100644
--- a/src/corelib/global/qlogging.h
+++ b/src/corelib/global/qlogging.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtCore module of the Qt Toolkit.
@@ -49,7 +49,6 @@
 #pragma qt_no_master_include
 #endif
 
-QT_BEGIN_HEADER
 QT_BEGIN_NAMESPACE
 
 /*
@@ -95,22 +94,38 @@ public:
 
     void debug(const char *msg, ...) const
 #if defined(Q_CC_GNU) && !defined(__INSURE__)
+#  if defined(Q_CC_MINGW) && !defined(Q_CC_CLANG)
+    __attribute__ ((format (gnu_printf, 2, 3)))
+#  else
     __attribute__ ((format (printf, 2, 3)))
+#  endif
 #endif
     ;
     void noDebug(const char *, ...) const
 #if defined(Q_CC_GNU) && !defined(__INSURE__)
+#  if defined(Q_CC_MINGW) && !defined(Q_CC_CLANG)
+    __attribute__ ((format (gnu_printf, 2, 3)))
+#  else
     __attribute__ ((format (printf, 2, 3)))
+#  endif
 #endif
     {}
     void warning(const char *msg, ...) const
 #if defined(Q_CC_GNU) && !defined(__INSURE__)
+#  if defined(Q_CC_MINGW) && !defined(Q_CC_CLANG)
+    __attribute__ ((format (gnu_printf, 2, 3)))
+#  else
     __attribute__ ((format (printf, 2, 3)))
+#  endif
 #endif
     ;
     void critical(const char *msg, ...) const
 #if defined(Q_CC_GNU) && !defined(__INSURE__)
+#  if defined(Q_CC_MINGW) && !defined(Q_CC_CLANG)
+    __attribute__ ((format (gnu_printf, 2, 3)))
+#  else
     __attribute__ ((format (printf, 2, 3)))
+#  endif
 #endif
     ;
 
@@ -119,7 +134,11 @@ public:
 #endif
     void fatal(const char *msg, ...) const Q_DECL_NOTHROW
 #if defined(Q_CC_GNU) && !defined(__INSURE__)
+#  if defined(Q_CC_MINGW) && !defined(Q_CC_CLANG)
+    __attribute__ ((format (gnu_printf, 2, 3)))
+#  else
     __attribute__ ((format (printf, 2, 3)))
+#  endif
 #endif
     ;
 
@@ -172,6 +191,4 @@ Q_CORE_EXPORT QtMessageHandler qInstallMessageHandler(QtMessageHandler);
 Q_CORE_EXPORT void qSetMessagePattern(const QString &messagePattern);
 
 QT_END_NAMESPACE
-QT_END_HEADER
-
 #endif // QLOGGING_H
diff --git a/src/corelib/global/qnamespace.h b/src/corelib/global/qnamespace.h
index d071bd2..25c47d5 100644
--- a/src/corelib/global/qnamespace.h
+++ b/src/corelib/global/qnamespace.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtCore module of the Qt Toolkit.
@@ -44,8 +44,6 @@
 
 #include <QtCore/qglobal.h>
 
-QT_BEGIN_HEADER
-
 QT_BEGIN_NAMESPACE
 
 
@@ -65,7 +63,7 @@ Qt {
     Q_ENUMS(ScrollBarPolicy FocusPolicy ContextMenuPolicy)
     Q_ENUMS(ArrowType ToolButtonStyle PenStyle PenCapStyle PenJoinStyle BrushStyle)
     Q_ENUMS(FillRule MaskMode BGMode ClipOperation SizeMode)
-    Q_ENUMS(Axis Corner LayoutDirection SizeHint Orientation DropAction)
+    Q_ENUMS(Axis Corner Edge LayoutDirection SizeHint Orientation DropAction)
     Q_FLAGS(Alignment Orientations DropActions)
     Q_FLAGS(DockWidgetAreas ToolBarAreas)
     Q_ENUMS(DockWidgetArea ToolBarArea)
@@ -140,6 +138,10 @@ public:
     Q_DECLARE_FLAGS(KeyboardModifiers, KeyboardModifier)
 
     //shorter names for shortcuts
+    // The use of all-caps identifiers has the potential for clashing with
+    // user-defined or third-party macros. More so when the identifiers are not
+    // "namespace"-prefixed. This is considered bad practice and is why
+    // KeypadModifier was not added to the Modifier enum.
     enum Modifier {
         META          = Qt::MetaModifier,
         SHIFT         = Qt::ShiftModifier,
@@ -286,11 +288,13 @@ public:
         SplashScreen = ToolTip | Dialog,
         Desktop = 0x00000010 | Window,
         SubWindow = 0x00000012,
+        ForeignWindow = 0x00000020 | Window,
 
         WindowType_Mask = 0x000000ff,
         MSWindowsFixedSizeDialogHint = 0x00000100,
         MSWindowsOwnDC = 0x00000200,
-        X11BypassWindowManagerHint = 0x00000400,
+        BypassWindowManagerHint = 0x00000400,
+        X11BypassWindowManagerHint = BypassWindowManagerHint,
         FramelessWindowHint = 0x00000800,
         WindowTitleHint = 0x00001000,
         WindowSystemMenuHint = 0x00002000,
@@ -327,6 +331,15 @@ public:
 
     Q_DECLARE_FLAGS(WindowStates, WindowState)
 
+    enum ApplicationState {
+        ApplicationSuspended    = 0x00000000,
+        ApplicationHidden       = 0x00000001,
+        ApplicationInactive     = 0x00000002,
+        ApplicationActive       = 0x00000004
+    };
+
+    Q_DECLARE_FLAGS(ApplicationStates, ApplicationState)
+
     enum ScreenOrientation {
         PrimaryOrientation           = 0x00000000,
         PortraitOrientation          = 0x00000001,
@@ -490,6 +503,7 @@ public:
         AA_X11InitThreads = 10,
         AA_SynthesizeTouchForUnhandledMouseEvents = 11,
         AA_SynthesizeMouseForUnhandledTouchEvents = 12,
+        AA_UseHighDpiPixmaps = 13,
 
         // Add new attributes before this line
         AA_AttributeCount
@@ -966,6 +980,8 @@ public:
         Key_TouchpadOn = 0x01000111,
         Key_TouchpadOff = 0x01000112,
 
+        Key_MicMute = 0x01000113,
+
         Key_MediaLast = 0x0100ffff,
 
         // Keypad navigation keys
@@ -1194,6 +1210,13 @@ public:
         BottomRightCorner = 0x00003
     };
 
+    enum Edge {
+        TopEdge = 0x00001,
+        LeftEdge = 0x00002,
+        RightEdge = 0x00004,
+        BottomEdge = 0x00008
+    };
+
     enum ConnectionType {
         AutoConnection,
         DirectConnection,
@@ -1300,6 +1323,8 @@ public:
 
         ImhPreferLatin = 0x200,
 
+        ImhMultiLine = 0x400,
+
         ImhDigitsOnly = 0x10000,
         ImhFormattedNumbersOnly = 0x20000,
         ImhUppercaseOnly = 0x40000,
@@ -1397,7 +1422,8 @@ public:
         ItemIsDropEnabled = 8,
         ItemIsUserCheckable = 16,
         ItemIsEnabled = 32,
-        ItemIsTristate = 64
+        ItemIsTristate = 64,
+        ItemNeverHasChildren = 128
     };
     Q_DECLARE_FLAGS(ItemFlags, ItemFlag)
 
@@ -1603,6 +1629,4 @@ public:
 
 QT_END_NAMESPACE
 
-QT_END_HEADER
-
 #endif // QNAMESPACE_H
diff --git a/src/corelib/global/qnumeric.h b/src/corelib/global/qnumeric.h
index 2b1c60b..25db544 100644
--- a/src/corelib/global/qnumeric.h
+++ b/src/corelib/global/qnumeric.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtCore module of the Qt Toolkit.
@@ -44,8 +44,6 @@
 
 #include <QtCore/qglobal.h>
 
-QT_BEGIN_HEADER
-
 QT_BEGIN_NAMESPACE
 
 
@@ -65,6 +63,4 @@ Q_CORE_EXPORT double qInf();
 
 QT_END_NAMESPACE
 
-QT_END_HEADER
-
 #endif // QNUMERIC_H
diff --git a/src/corelib/global/qprocessordetection.h b/src/corelib/global/qprocessordetection.h
index b59954b..21f9c8f 100644
--- a/src/corelib/global/qprocessordetection.h
+++ b/src/corelib/global/qprocessordetection.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtCore module of the Qt Toolkit.
@@ -101,6 +101,8 @@
       || defined(__ARM_ARCH_7A__) \
       || defined(__ARM_ARCH_7R__) \
       || defined(__ARM_ARCH_7M__) \
+      || defined(__ARM_ARCH_7S__) \
+      || defined(_ARM_ARCH_7) \
       || (defined(__TARGET_ARCH_ARM) && __TARGET_ARCH_ARM-0 >= 7) \
       || (defined(_M_ARM) && _M_ARM-0 >= 7)
 #    define Q_PROCESSOR_ARM_V7
@@ -118,6 +120,7 @@
 #    define Q_PROCESSOR_ARM_V6
 #    define Q_PROCESSOR_ARM_V5
 #  elif defined(__ARM_ARCH_5TEJ__) \
+        || defined(__ARM_ARCH_5TE__) \
         || (defined(__TARGET_ARCH_ARM) && __TARGET_ARCH_ARM-0 >= 5) \
         || (defined(_M_ARM) && _M_ARM-0 >= 5)
 #    define Q_PROCESSOR_ARM_V5
@@ -279,9 +282,9 @@
 #  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__)
+#  elif defined(__BIG_ENDIAN__) || defined(_big_endian__) || defined(_BIG_ENDIAN)
 #    define Q_BYTE_ORDER Q_BIG_ENDIAN
-#  elif defined(__LITTLE_ENDIAN__)  \
+#  elif defined(__LITTLE_ENDIAN__) || defined(_little_endian__) || defined(_LITTLE_ENDIAN) \
         || defined(_WIN32_WCE) // Windows CE is always little-endian according to MSDN.
 #    define Q_BYTE_ORDER Q_LITTLE_ENDIAN
 #  else
diff --git a/src/corelib/global/qsysinfo.h b/src/corelib/global/qsysinfo.h
index 867acd4..a6accdf 100644
--- a/src/corelib/global/qsysinfo.h
+++ b/src/corelib/global/qsysinfo.h
@@ -1,9 +1,9 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
-** This file is part of the FOO module of the Qt Toolkit.
+** This file is part of the QtCore module of the Qt Toolkit.
 **
 ** $QT_BEGIN_LICENSE:LGPL$
 ** Commercial License Usage
@@ -44,7 +44,6 @@
 #ifndef QSYSINFO_H
 #define QSYSINFO_H
 
-QT_BEGIN_HEADER
 QT_BEGIN_NAMESPACE
 
 /*
@@ -70,7 +69,7 @@ public:
         BigEndian,
         LittleEndian
 
-#  ifdef qdoc
+#  ifdef Q_QDOC
         , ByteOrder = <platform-dependent>
 #  elif Q_BYTE_ORDER == Q_BIG_ENDIAN
         , ByteOrder = BigEndian
@@ -133,6 +132,7 @@ public:
         MV_10_6 = 0x0008,
         MV_10_7 = 0x0009,
         MV_10_8 = 0x000A,
+        MV_10_9 = 0x000B,
 
         /* codenames */
         MV_CHEETAH = MV_10_0,
@@ -143,7 +143,8 @@ public:
         MV_LEOPARD = MV_10_5,
         MV_SNOWLEOPARD = MV_10_6,
         MV_LION = MV_10_7,
-        MV_MOUNTAINLION = MV_10_8
+        MV_MOUNTAINLION = MV_10_8,
+        MV_MAVERICKS = MV_10_9
     };
     static const MacVersion MacintoshVersion;
     static MacVersion macVersion();
@@ -151,6 +152,4 @@ public:
 };
 
 QT_END_NAMESPACE
-QT_END_HEADER
-
 #endif // QSYSINFO_H
diff --git a/src/corelib/global/qsystemdetection.h b/src/corelib/global/qsystemdetection.h
index 6bd921e..cb55fa8 100644
--- a/src/corelib/global/qsystemdetection.h
+++ b/src/corelib/global/qsystemdetection.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtCore module of the Qt Toolkit.
@@ -50,6 +50,9 @@
    The operating system, must be one of: (Q_OS_x)
 
      DARWIN   - Darwin OS (synonym for Q_OS_MAC)
+     MAC      - OS X or iOS (synonym for Q_OS_DARWIN)
+     MACX     - OS X
+     IOS      - iOS
      MSDOS    - MS-DOS and Windows
      OS2      - OS/2
      OS2EMX   - XFree86 on OS/2 (not PM)
@@ -78,6 +81,7 @@
      LYNX     - LynxOS
      BSD4     - Any BSD 4.4 system
      UNIX     - Any UNIX BSD/SYSV system
+     ANDROID  - Android platform
 */
 
 #if defined(__APPLE__) && (defined(__GNUC__) || defined(__xlC__) || defined(__xlc__))
@@ -88,6 +92,9 @@
 #  else
 #    define Q_OS_DARWIN32
 #  endif
+#elif defined(ANDROID)
+#  define Q_OS_ANDROID
+#  define Q_OS_LINUX
 #elif defined(__CYGWIN__)
 #  define Q_OS_CYGWIN
 #elif !defined(SAG_COM) && (defined(WIN64) || defined(_WIN64) || defined(__WIN64__))
@@ -160,12 +167,17 @@
 
 #if defined(Q_OS_DARWIN)
 #  define Q_OS_MAC
-#  define Q_OS_MACX /* Q_OS_MACX is only for compatibility.*/
 #  if defined(Q_OS_DARWIN64)
 #     define Q_OS_MAC64
 #  elif defined(Q_OS_DARWIN32)
 #     define Q_OS_MAC32
 #  endif
+#  include <TargetConditionals.h>
+#  if defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE
+#     define Q_OS_IOS
+#  else
+#     define Q_OS_MACX
+#  endif
 #endif
 
 #if defined(Q_OS_WIN)
@@ -175,31 +187,60 @@
 #endif
 
 #ifdef Q_OS_DARWIN
-#  ifdef MAC_OS_X_VERSION_MIN_REQUIRED
-#    undef MAC_OS_X_VERSION_MIN_REQUIRED
+#  include <Availability.h>
+#  if !defined(__MAC_OS_X_VERSION_MIN_REQUIRED) || __MAC_OS_X_VERSION_MIN_REQUIRED < __MAC_10_6
+#     undef __MAC_OS_X_VERSION_MIN_REQUIRED
+#     define __MAC_OS_X_VERSION_MIN_REQUIRED __MAC_10_6
 #  endif
-#  define MAC_OS_X_VERSION_MIN_REQUIRED MAC_OS_X_VERSION_10_4
 #  include <AvailabilityMacros.h>
-#  if !defined(MAC_OS_X_VERSION_10_3)
-#     define MAC_OS_X_VERSION_10_3 MAC_OS_X_VERSION_10_2 + 1
+#  if !defined(MAC_OS_X_VERSION_MIN_REQUIRED) || MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_6
+#     undef MAC_OS_X_VERSION_MIN_REQUIRED
+#     define MAC_OS_X_VERSION_MIN_REQUIRED MAC_OS_X_VERSION_10_6
 #  endif
-#  if !defined(MAC_OS_X_VERSION_10_4)
-#       define MAC_OS_X_VERSION_10_4 MAC_OS_X_VERSION_10_3 + 1
+#
+#  // Numerical checks are preferred to named checks, but to be safe
+#  // we define the missing version names in case Qt uses them.
+#
+#  if !defined(__MAC_10_7)
+#       define __MAC_10_7 1070
 #  endif
-#  if !defined(MAC_OS_X_VERSION_10_5)
-#       define MAC_OS_X_VERSION_10_5 MAC_OS_X_VERSION_10_4 + 1
+#  if !defined(__MAC_10_8)
+#       define __MAC_10_8 1080
 #  endif
-#  if !defined(MAC_OS_X_VERSION_10_6)
-#       define MAC_OS_X_VERSION_10_6 MAC_OS_X_VERSION_10_5 + 1
+#  if !defined(__MAC_10_9)
+#       define __MAC_10_9 1090
 #  endif
 #  if !defined(MAC_OS_X_VERSION_10_7)
-#       define MAC_OS_X_VERSION_10_7 MAC_OS_X_VERSION_10_6 + 1
+#       define MAC_OS_X_VERSION_10_7 1070
 #  endif
 #  if !defined(MAC_OS_X_VERSION_10_8)
-#       define MAC_OS_X_VERSION_10_8 MAC_OS_X_VERSION_10_7 + 1
+#       define MAC_OS_X_VERSION_10_8 1080
+#  endif
+#  if !defined(MAC_OS_X_VERSION_10_9)
+#       define MAC_OS_X_VERSION_10_9 1090
+#  endif
+#
+#  if !defined(__IPHONE_4_3)
+#       define __IPHONE_4_3 40300
+#  endif
+#  if !defined(__IPHONE_5_0)
+#       define __IPHONE_5_0 50000
+#  endif
+#  if !defined(__IPHONE_5_1)
+#       define __IPHONE_5_1 50100
+#  endif
+#  if !defined(__IPHONE_6_0)
+#       define __IPHONE_6_0 60000
+#  endif
+#  if !defined(__IPHONE_6_1)
+#       define __IPHONE_6_1 60100
+#  endif
+#  if !defined(__IPHONE_7_0)
+#       define __IPHONE_7_0 70000
 #  endif
-#  if (MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_8)
-#    warning "This version of Mac OS X is unsupported"
+#
+#  if (__MAC_OS_X_VERSION_MAX_ALLOWED > __MAC_10_8)
+#    warning "This version of OS X is unsupported"
 #  endif
 #endif
 
diff --git a/src/corelib/global/qt_windows.h b/src/corelib/global/qt_windows.h
index 00a511a..c3266c5 100644
--- a/src/corelib/global/qt_windows.h
+++ b/src/corelib/global/qt_windows.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtCore module of the Qt Toolkit.
@@ -42,6 +42,11 @@
 #ifndef QT_WINDOWS_H
 #define QT_WINDOWS_H
 
+#if 0
+#pragma qt_sync_skip_header_check
+#pragma qt_sync_stop_processing
+#endif
+
 #if defined(Q_CC_BOR)
 // Borland's windows.h does not set these correctly, resulting in
 // unusable WinSDK standard dialogs
diff --git a/src/corelib/global/qtypeinfo.h b/src/corelib/global/qtypeinfo.h
index 68df50a..8e34c97 100644
--- a/src/corelib/global/qtypeinfo.h
+++ b/src/corelib/global/qtypeinfo.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtCore module of the Qt Toolkit.
@@ -44,7 +44,6 @@
 #ifndef QTYPEINFO_H
 #define QTYPEINFO_H
 
-QT_BEGIN_HEADER
 QT_BEGIN_NAMESPACE
 
 /*
@@ -241,6 +240,4 @@ Q_DECLARE_TYPEINFO(long double, Q_PRIMITIVE_TYPE);
 #endif
 
 QT_END_NAMESPACE
-QT_END_HEADER
-
 #endif // QTYPEINFO_H
diff --git a/src/corelib/global/qtypetraits.h b/src/corelib/global/qtypetraits.h
index 0183f33..2ae66da 100644
--- a/src/corelib/global/qtypetraits.h
+++ b/src/corelib/global/qtypetraits.h
@@ -102,13 +102,13 @@
 //  - Use Qt macros for long long type differences on Windows.
 //  - Enclose in QtPrivate namespace.
 
+#include "QtCore/qglobal.h"
+
 #ifndef QTYPETRAITS_H
 #define QTYPETRAITS_H
 
 #include <utility>                  // For pair
-#include "QtCore/qglobal.h"
 
-QT_BEGIN_HEADER
 QT_BEGIN_NAMESPACE
 
 namespace QtPrivate {
@@ -245,6 +245,10 @@ template<> struct is_integral<unsigned long long> : true_type { };
 template <class T> struct is_integral<const T> : is_integral<T> { };
 template <class T> struct is_integral<volatile T> : is_integral<T> { };
 template <class T> struct is_integral<const volatile T> : is_integral<T> { };
+#if defined (Q_COMPILER_UNICODE_STRINGS)
+template<> struct is_integral<char16_t> : true_type { };
+template<> struct is_integral<char32_t> : true_type { };
+#endif
 
 // is_floating_point is false except for the built-in floating-point types.
 // A cv-qualified type is integral if and only if the underlying type is.
@@ -504,6 +508,4 @@ Q_STATIC_ASSERT(( is_signed<qint64>::value));
 } // namespace QtPrivate
 
 QT_END_NAMESPACE
-QT_END_HEADER
-
 #endif  // QTYPETRAITS_H
diff --git a/src/corelib/io/qbuffer.h b/src/corelib/io/qbuffer.h
index d53deed..de0fe9f 100644
--- a/src/corelib/io/qbuffer.h
+++ b/src/corelib/io/qbuffer.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtCore module of the Qt Toolkit.
@@ -45,8 +45,6 @@
 #include <QtCore/qiodevice.h>
 #include <QtCore/qbytearray.h>
 
-QT_BEGIN_HEADER
-
 QT_BEGIN_NAMESPACE
 
 
@@ -106,6 +104,4 @@ inline void QBuffer::setData(const char *adata, int alen)
 
 QT_END_NAMESPACE
 
-QT_END_HEADER
-
 #endif // QBUFFER_H
diff --git a/src/corelib/io/qdatastream.h b/src/corelib/io/qdatastream.h
index 7fe2598..969cdf4 100644
--- a/src/corelib/io/qdatastream.h
+++ b/src/corelib/io/qdatastream.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtCore module of the Qt Toolkit.
@@ -50,8 +50,6 @@
 #error qdatastream.h must be included before any header file that defines Status
 #endif
 
-QT_BEGIN_HEADER
-
 QT_BEGIN_NAMESPACE
 
 
@@ -87,8 +85,9 @@ public:
         Qt_4_7 = Qt_4_6,
         Qt_4_8 = Qt_4_7,
         Qt_4_9 = Qt_4_8,
-        Qt_5_0 = 13
-#if QT_VERSION >= 0x050100
+        Qt_5_0 = 13,
+        Qt_5_1 = 14
+#if QT_VERSION >= 0x050200
 #error Add the datastream version for this Qt version
 #endif
     };
@@ -369,7 +368,7 @@ Q_OUTOFLINE_TEMPLATE QDataStream &operator<<(QDataStream &out, const QHash<Key,
     }
     return out;
 }
-#ifdef qdoc
+#ifdef Q_QDOC
 template <class Key, class T>
 Q_OUTOFLINE_TEMPLATE QDataStream &operator>>(QDataStream &in, QMap<Key, T> &map)
 #else
@@ -434,6 +433,4 @@ inline QDataStream& operator<<(QDataStream& s, const QPair<T1, T2>& p)
 
 QT_END_NAMESPACE
 
-QT_END_HEADER
-
 #endif // QDATASTREAM_H
diff --git a/src/corelib/io/qdebug.h b/src/corelib/io/qdebug.h
index 4c8f961..9ed5f6e 100644
--- a/src/corelib/io/qdebug.h
+++ b/src/corelib/io/qdebug.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtCore module of the Qt Toolkit.
@@ -53,14 +53,13 @@
 #include <QtCore/qset.h>
 #include <QtCore/qcontiguouscache.h>
 
-QT_BEGIN_HEADER
-
 QT_BEGIN_NAMESPACE
 
 
 class Q_CORE_EXPORT QDebug
 {
     friend class QMessageLogger;
+    friend class QDebugStateSaverPrivate;
     struct Stream {
         Stream(QIODevice *device) : ts(device), ref(1), type(QtDebugMsg), space(true), message_output(false) {}
         Stream(QString *string) : ts(string, QIODevice::WriteOnly), ref(1), type(QtDebugMsg), space(true), message_output(false) {}
@@ -132,6 +131,17 @@ public:
 
 Q_DECLARE_SHARED(QDebug)
 
+class QDebugStateSaverPrivate;
+class Q_CORE_EXPORT QDebugStateSaver
+{
+public:
+    QDebugStateSaver(QDebug &dbg);
+    ~QDebugStateSaver();
+private:
+    Q_DISABLE_COPY(QDebugStateSaver)
+    QScopedPointer<QDebugStateSaverPrivate> d;
+};
+
 class QNoDebug
 {
 public:
@@ -270,7 +280,7 @@ inline QDebug operator<<(QDebug debug, const QFlags<T> &flags)
                 debug.nospace() << '|';
             else
                 needSeparator = true;
-            debug.nospace() << "0x" << QByteArray::number(T(1 << i), 16).constData();
+            debug.nospace() << "0x" << QByteArray::number(typename QFlags<T>::Int(1) << i, 16).constData();
         }
     }
     debug << ')';
@@ -279,6 +289,4 @@ inline QDebug operator<<(QDebug debug, const QFlags<T> &flags)
 
 QT_END_NAMESPACE
 
-QT_END_HEADER
-
 #endif // QDEBUG_H
diff --git a/src/corelib/io/qdir.h b/src/corelib/io/qdir.h
index 7a44c83..dbb6d93 100644
--- a/src/corelib/io/qdir.h
+++ b/src/corelib/io/qdir.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtCore module of the Qt Toolkit.
@@ -47,8 +47,6 @@
 #include <QtCore/qstringlist.h>
 #include <QtCore/qshareddata.h>
 
-QT_BEGIN_HEADER
-
 QT_BEGIN_NAMESPACE
 
 
@@ -236,6 +234,4 @@ Q_CORE_EXPORT QDebug operator<<(QDebug debug, const QDir &dir);
 
 QT_END_NAMESPACE
 
-QT_END_HEADER
-
 #endif // QDIR_H
diff --git a/src/corelib/io/qdiriterator.h b/src/corelib/io/qdiriterator.h
index 45995ca..4a96005 100644
--- a/src/corelib/io/qdiriterator.h
+++ b/src/corelib/io/qdiriterator.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtCore module of the Qt Toolkit.
@@ -44,8 +44,6 @@
 
 #include <QtCore/qdir.h>
 
-QT_BEGIN_HEADER
-
 QT_BEGIN_NAMESPACE
 
 
@@ -91,6 +89,4 @@ Q_DECLARE_OPERATORS_FOR_FLAGS(QDirIterator::IteratorFlags)
 
 QT_END_NAMESPACE
 
-QT_END_HEADER
-
 #endif
diff --git a/src/corelib/io/qfile.h b/src/corelib/io/qfile.h
index 56c8d8b..2e75e29 100644
--- a/src/corelib/io/qfile.h
+++ b/src/corelib/io/qfile.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtCore module of the Qt Toolkit.
@@ -50,8 +50,6 @@
 #error qfile.h must be included before any header file that defines open
 #endif
 
-QT_BEGIN_HEADER
-
 QT_BEGIN_NAMESPACE
 
 class QTemporaryFile;
@@ -154,6 +152,4 @@ private:
 
 QT_END_NAMESPACE
 
-QT_END_HEADER
-
 #endif // QFILE_H
diff --git a/src/corelib/io/qfiledevice.h b/src/corelib/io/qfiledevice.h
index e1ea5b8..fc27790 100644
--- a/src/corelib/io/qfiledevice.h
+++ b/src/corelib/io/qfiledevice.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtCore module of the Qt Toolkit.
@@ -45,8 +45,6 @@
 #include <QtCore/qiodevice.h>
 #include <QtCore/qstring.h>
 
-QT_BEGIN_HEADER
-
 QT_BEGIN_NAMESPACE
 
 class QFileDevicePrivate;
@@ -142,6 +140,4 @@ Q_DECLARE_OPERATORS_FOR_FLAGS(QFileDevice::Permissions)
 
 QT_END_NAMESPACE
 
-QT_END_HEADER
-
 #endif // QFILEDEVICE_H
diff --git a/src/corelib/io/qfileinfo.h b/src/corelib/io/qfileinfo.h
index ae963ed..211c18d 100644
--- a/src/corelib/io/qfileinfo.h
+++ b/src/corelib/io/qfileinfo.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtCore module of the Qt Toolkit.
@@ -47,8 +47,6 @@
 #include <QtCore/qshareddata.h>
 #include <QtCore/qmetatype.h>
 
-QT_BEGIN_HEADER
-
 QT_BEGIN_NAMESPACE
 
 
@@ -159,6 +157,4 @@ QT_END_NAMESPACE
 
 Q_DECLARE_METATYPE(QFileInfo)
 
-QT_END_HEADER
-
 #endif // QFILEINFO_H
diff --git a/src/corelib/io/qfilesystemwatcher.h b/src/corelib/io/qfilesystemwatcher.h
index 6fbbdae..5a32607 100644
--- a/src/corelib/io/qfilesystemwatcher.h
+++ b/src/corelib/io/qfilesystemwatcher.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtCore module of the Qt Toolkit.
@@ -46,8 +46,6 @@
 
 #ifndef QT_NO_FILESYSTEMWATCHER
 
-QT_BEGIN_HEADER
-
 QT_BEGIN_NAMESPACE
 
 
@@ -73,12 +71,12 @@ public:
 
 Q_SIGNALS:
     void fileChanged(const QString &path
-#if !defined(qdoc)
+#if !defined(Q_QDOC)
         , QPrivateSignal
 #endif
     );
     void directoryChanged(const QString &path
-#if !defined(qdoc)
+#if !defined(Q_QDOC)
         , QPrivateSignal
 #endif
     );
@@ -90,7 +88,5 @@ private:
 
 QT_END_NAMESPACE
 
-QT_END_HEADER
-
 #endif // QT_NO_FILESYSTEMWATCHER
 #endif // QFILESYSTEMWATCHER_H
diff --git a/src/corelib/io/qiodevice.h b/src/corelib/io/qiodevice.h
index 3294fc3..cdc90f2 100644
--- a/src/corelib/io/qiodevice.h
+++ b/src/corelib/io/qiodevice.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtCore module of the Qt Toolkit.
@@ -42,6 +42,7 @@
 #ifndef QIODEVICE_H
 #define QIODEVICE_H
 
+#include <QtCore/qglobal.h>
 #ifndef QT_NO_QOBJECT
 #include <QtCore/qobject.h>
 #else
@@ -54,8 +55,6 @@
 #error qiodevice.h must be included before any header file that defines open
 #endif
 
-QT_BEGIN_HEADER
-
 QT_BEGIN_NAMESPACE
 
 
@@ -177,6 +176,4 @@ Q_CORE_EXPORT QDebug operator<<(QDebug debug, QIODevice::OpenMode modes);
 
 QT_END_NAMESPACE
 
-QT_END_HEADER
-
 #endif // QIODEVICE_H
diff --git a/src/corelib/io/qprocess.h b/src/corelib/io/qprocess.h
index bf4f2fb..9da3e63 100644
--- a/src/corelib/io/qprocess.h
+++ b/src/corelib/io/qprocess.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtCore module of the Qt Toolkit.
@@ -46,14 +46,12 @@
 #include <QtCore/qstringlist.h>
 #include <QtCore/qshareddata.h>
 
-QT_BEGIN_HEADER
-
 QT_BEGIN_NAMESPACE
 
 
 #ifndef QT_NO_PROCESS
 
-#if !defined(Q_OS_WIN) || defined(qdoc)
+#if !defined(Q_OS_WIN) || defined(Q_QDOC)
 typedef qint64 Q_PID;
 #else
 QT_END_NAMESPACE
@@ -138,8 +136,14 @@ public:
 
     void start(const QString &program, const QStringList &arguments, OpenMode mode = ReadWrite);
     void start(const QString &command, OpenMode mode = ReadWrite);
+    void start(OpenMode mode = ReadWrite);
+    bool open(OpenMode mode = ReadWrite) Q_DECL_OVERRIDE;
+
     QString program() const;
+    void setProgram(const QString &program);
+
     QStringList arguments() const;
+    void setArguments(const QStringList & arguments);
 
     ProcessChannelMode readChannelMode() const;
     void setReadChannelMode(ProcessChannelMode mode);
@@ -211,26 +215,26 @@ public Q_SLOTS:
 
 Q_SIGNALS:
     void started(
-#if !defined(qdoc)
+#if !defined(Q_QDOC)
         QPrivateSignal
 #endif
     );
-    void finished(int exitCode);
+    void finished(int exitCode); // ### Qt 6: merge the two signals with a default value
     void finished(int exitCode, QProcess::ExitStatus exitStatus);
     void error(QProcess::ProcessError error);
     void stateChanged(QProcess::ProcessState state
-#if !defined(qdoc)
+#if !defined(Q_QDOC)
         , QPrivateSignal
 #endif
     );
 
     void readyReadStandardOutput(
-#if !defined(qdoc)
+#if !defined(Q_QDOC)
         QPrivateSignal
 #endif
     );
     void readyReadStandardError(
-#if !defined(qdoc)
+#if !defined(Q_QDOC)
         QPrivateSignal
 #endif
     );
@@ -261,6 +265,4 @@ private:
 
 QT_END_NAMESPACE
 
-QT_END_HEADER
-
 #endif // QPROCESS_H
diff --git a/src/corelib/io/qresource.h b/src/corelib/io/qresource.h
index a8c7faf..88467bd 100644
--- a/src/corelib/io/qresource.h
+++ b/src/corelib/io/qresource.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtCore module of the Qt Toolkit.
@@ -47,8 +47,6 @@
 #include <QtCore/qstringlist.h>
 #include <QtCore/qlist.h>
 
-QT_BEGIN_HEADER
-
 QT_BEGIN_NAMESPACE
 
 
@@ -98,6 +96,4 @@ private:
 
 QT_END_NAMESPACE
 
-QT_END_HEADER
-
 #endif // QRESOURCE_H
diff --git a/src/corelib/io/qsettings.h b/src/corelib/io/qsettings.h
index 456147b..a720b3d 100644
--- a/src/corelib/io/qsettings.h
+++ b/src/corelib/io/qsettings.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtCore module of the Qt Toolkit.
@@ -47,8 +47,6 @@
 #include <QtCore/qstring.h>
 #include <QtCore/qscopedpointer.h>
 
-QT_BEGIN_HEADER
-
 QT_BEGIN_NAMESPACE
 QT_END_NAMESPACE
 
@@ -198,6 +196,4 @@ QT_END_NAMESPACE
 
 #endif // QT_NO_SETTINGS
 
-QT_END_HEADER
-
 #endif // QSETTINGS_H
diff --git a/src/corelib/io/qstandardpaths.h b/src/corelib/io/qstandardpaths.h
index d9d572d..d8b6d24 100644
--- a/src/corelib/io/qstandardpaths.h
+++ b/src/corelib/io/qstandardpaths.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtCore module of the Qt Toolkit.
@@ -44,15 +44,11 @@
 
 #include <QtCore/qstringlist.h>
 
-QT_BEGIN_HEADER
-
 QT_BEGIN_NAMESPACE
 
 
 #ifndef QT_NO_STANDARDPATHS
 
-class QStringList;
-
 class Q_CORE_EXPORT QStandardPaths
 {
 public:
@@ -87,7 +83,9 @@ public:
 
     static QString locate(StandardLocation type, const QString &fileName, LocateOptions options = LocateFile);
     static QStringList locateAll(StandardLocation type, const QString &fileName, LocateOptions options = LocateFile);
+#ifndef QT_BOOTSTRAPPED
     static QString displayName(StandardLocation type);
+#endif
 
     static QString findExecutable(const QString &executableName, const QStringList &paths = QStringList());
 
@@ -104,6 +102,4 @@ private:
 
 QT_END_NAMESPACE
 
-QT_END_HEADER
-
 #endif // QSTANDARDPATHS_H
diff --git a/src/corelib/io/qtemporarydir.h b/src/corelib/io/qtemporarydir.h
index b75a6e3..47252cb 100644
--- a/src/corelib/io/qtemporarydir.h
+++ b/src/corelib/io/qtemporarydir.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtCore module of the Qt Toolkit.
@@ -45,8 +45,6 @@
 #include <QtCore/qdir.h>
 #include <QtCore/QScopedPointer>
 
-QT_BEGIN_HEADER
-
 QT_BEGIN_NAMESPACE
 
 
@@ -79,6 +77,4 @@ private:
 
 QT_END_NAMESPACE
 
-QT_END_HEADER
-
 #endif // QTEMPORARYDIR_H
diff --git a/src/corelib/io/qtemporaryfile.h b/src/corelib/io/qtemporaryfile.h
index b7c375e..09aa53c 100644
--- a/src/corelib/io/qtemporaryfile.h
+++ b/src/corelib/io/qtemporaryfile.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtCore module of the Qt Toolkit.
@@ -49,14 +49,13 @@
 #error qtemporaryfile.h must be included before any header file that defines open
 #endif
 
-QT_BEGIN_HEADER
-
 QT_BEGIN_NAMESPACE
 
 
 #ifndef QT_NO_TEMPORARYFILE
 
 class QTemporaryFilePrivate;
+class QLockFilePrivate;
 
 class Q_CORE_EXPORT QTemporaryFile : public QFile
 {
@@ -98,6 +97,7 @@ protected:
 
 private:
     friend class QFile;
+    friend class QLockFilePrivate;
     Q_DISABLE_COPY(QTemporaryFile)
 };
 
@@ -105,6 +105,4 @@ private:
 
 QT_END_NAMESPACE
 
-QT_END_HEADER
-
 #endif // QTEMPORARYFILE_H
diff --git a/src/corelib/io/qtextstream.h b/src/corelib/io/qtextstream.h
index cf19721..6d143bd 100644
--- a/src/corelib/io/qtextstream.h
+++ b/src/corelib/io/qtextstream.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtCore module of the Qt Toolkit.
@@ -54,8 +54,6 @@
 #error qtextstream.h must be included before any header file that defines Status
 #endif
 
-QT_BEGIN_HEADER
-
 QT_BEGIN_NAMESPACE
 
 
@@ -194,6 +192,7 @@ public:
 
 private:
     Q_DISABLE_COPY(QTextStream)
+    friend class QDebugStateSaverPrivate;
 
     QScopedPointer<QTextStreamPrivate> d_ptr;
 };
@@ -284,6 +283,4 @@ inline QTextStreamManipulator qSetRealNumberPrecision(int precision)
 
 QT_END_NAMESPACE
 
-QT_END_HEADER
-
 #endif // QTEXTSTREAM_H
diff --git a/src/corelib/io/qurl.h b/src/corelib/io/qurl.h
index fcea4fd..de4ce75 100644
--- a/src/corelib/io/qurl.h
+++ b/src/corelib/io/qurl.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Copyright (C) 2012 Intel Corporation.
 ** Contact: http://www.qt-project.org/legal
 **
@@ -50,8 +50,6 @@
 #include <QtCore/qpair.h>
 #include <QtCore/qglobal.h>
 
-QT_BEGIN_HEADER
-
 QT_BEGIN_NAMESPACE
 
 
@@ -154,7 +152,7 @@ public:
         FullyDecoded = FullyEncoded | DecodeReserved | 0x4000000
     };
     Q_DECLARE_FLAGS(ComponentFormattingOptions, ComponentFormattingOption)
-#ifdef qdoc
+#ifdef Q_QDOC
     Q_DECLARE_FLAGS(FormattingOptions, UrlFormattingOption)
 #else
     typedef QUrlTwoFlags<UrlFormattingOption, ComponentFormattingOption> FormattingOptions;
@@ -322,6 +320,9 @@ public:
     static QString fromAce(const QByteArray &);
     static QByteArray toAce(const QString &);
     static QStringList idnWhitelist();
+    static QStringList toStringList(const QList<QUrl> &uris, FormattingOptions options = FormattingOptions(PrettyDecoded));
+    static QList<QUrl> fromStringList(const QStringList &uris, ParsingMode mode = TolerantMode);
+
     static void setIdnWhitelist(const QStringList &);
     friend Q_CORE_EXPORT uint qHash(const QUrl &url, uint seed = 0) Q_DECL_NOTHROW;
 
@@ -381,6 +382,4 @@ QT_END_NAMESPACE
 # include <QtCore/qurlquery.h>
 #endif
 
-QT_END_HEADER
-
 #endif // QURL_H
diff --git a/src/corelib/io/qurlquery.h b/src/corelib/io/qurlquery.h
index 319fe3c..c515bf7 100644
--- a/src/corelib/io/qurlquery.h
+++ b/src/corelib/io/qurlquery.h
@@ -50,8 +50,6 @@
 #include <QtCore/qstringlist.h>
 #endif
 
-QT_BEGIN_HEADER
-
 QT_BEGIN_NAMESPACE
 
 class QUrlQueryPrivate;
@@ -173,6 +171,4 @@ inline QList<QByteArray> QUrl::allEncodedQueryItemValues(const QByteArray &key)
 
 QT_END_NAMESPACE
 
-QT_END_HEADER
-
 #endif // QURLQUERY_H
diff --git a/src/corelib/itemmodels/qabstractitemmodel.h b/src/corelib/itemmodels/qabstractitemmodel.h
index 9513a24..215ccce 100644
--- a/src/corelib/itemmodels/qabstractitemmodel.h
+++ b/src/corelib/itemmodels/qabstractitemmodel.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtCore module of the Qt Toolkit.
@@ -47,8 +47,6 @@
 #include <QtCore/qhash.h>
 #include <QtCore/qvector.h>
 
-QT_BEGIN_HEADER
-
 QT_BEGIN_NAMESPACE
 
 
@@ -156,7 +154,7 @@ template <class Key, class T> class QMap;
 class Q_CORE_EXPORT QAbstractItemModel : public QObject
 {
     Q_OBJECT
-    Q_ENUMS(LayoutChangeHints)
+    Q_ENUMS(LayoutChangeHint)
 
     friend class QPersistentModelIndexData;
     friend class QAbstractItemViewPrivate;
@@ -252,78 +250,78 @@ Q_SIGNALS:
     void layoutAboutToBeChanged(const QList<QPersistentModelIndex> &parents = QList<QPersistentModelIndex>(), QAbstractItemModel::LayoutChangeHint hint = QAbstractItemModel::NoLayoutChangeHint);
 
     void rowsAboutToBeInserted(const QModelIndex &parent, int first, int last
-#if !defined(qdoc)
+#if !defined(Q_QDOC)
       , QPrivateSignal
 #endif
     );
     void rowsInserted(const QModelIndex &parent, int first, int last
-#if !defined(qdoc)
+#if !defined(Q_QDOC)
       , QPrivateSignal
 #endif
     );
 
     void rowsAboutToBeRemoved(const QModelIndex &parent, int first, int last
-#if !defined(qdoc)
+#if !defined(Q_QDOC)
       , QPrivateSignal
 #endif
     );
     void rowsRemoved(const QModelIndex &parent, int first, int last
-#if !defined(qdoc)
+#if !defined(Q_QDOC)
       , QPrivateSignal
 #endif
     );
 
     void columnsAboutToBeInserted(const QModelIndex &parent, int first, int last
-#if !defined(qdoc)
+#if !defined(Q_QDOC)
       , QPrivateSignal
 #endif
     );
     void columnsInserted(const QModelIndex &parent, int first, int last
-#if !defined(qdoc)
+#if !defined(Q_QDOC)
       , QPrivateSignal
 #endif
     );
 
     void columnsAboutToBeRemoved(const QModelIndex &parent, int first, int last
-#if !defined(qdoc)
+#if !defined(Q_QDOC)
       , QPrivateSignal
 #endif
     );
     void columnsRemoved(const QModelIndex &parent, int first, int last
-#if !defined(qdoc)
+#if !defined(Q_QDOC)
       , QPrivateSignal
 #endif
     );
 
     void modelAboutToBeReset(
-#if !defined(qdoc)
+#if !defined(Q_QDOC)
       QPrivateSignal
 #endif
     );
     void modelReset(
-#if !defined(qdoc)
+#if !defined(Q_QDOC)
       QPrivateSignal
 #endif
     );
 
     void rowsAboutToBeMoved( const QModelIndex &sourceParent, int sourceStart, int sourceEnd, const QModelIndex &destinationParent, int destinationRow
-#if !defined(qdoc)
+#if !defined(Q_QDOC)
       , QPrivateSignal
 #endif
     );
     void rowsMoved( const QModelIndex &parent, int start, int end, const QModelIndex &destination, int row
-#if !defined(qdoc)
+#if !defined(Q_QDOC)
       , QPrivateSignal
 #endif
     );
 
     void columnsAboutToBeMoved( const QModelIndex &sourceParent, int sourceStart, int sourceEnd, const QModelIndex &destinationParent, int destinationColumn
-#if !defined(qdoc)
+#if !defined(Q_QDOC)
       , QPrivateSignal
 #endif
     );
     void columnsMoved( const QModelIndex &parent, int start, int end, const QModelIndex &destination, int column
-#if !defined(qdoc)
+#if !defined(Q_QDOC)
       , QPrivateSignal
 #endif
     );
@@ -332,6 +330,10 @@ public Q_SLOTS:
     virtual bool submit();
     virtual void revert();
 
+protected Q_SLOTS:
+    // Qt 6: Make virtual
+    void resetInternalData();
+
 protected:
     QAbstractItemModel(QAbstractItemModelPrivate &dd, QObject *parent = 0);
 
@@ -403,7 +405,7 @@ inline bool QAbstractItemModel::moveRow(const QModelIndex &sourceParent, int sou
 { return moveRows(sourceParent, sourceRow, 1, destinationParent, destinationChild); }
 inline bool QAbstractItemModel::moveColumn(const QModelIndex &sourceParent, int sourceColumn,
                                            const QModelIndex &destinationParent, int destinationChild)
-{ return moveRows(sourceParent, sourceColumn, 1, destinationParent, destinationChild); }
+{ return moveColumns(sourceParent, sourceColumn, 1, destinationParent, destinationChild); }
 inline QModelIndex QAbstractItemModel::createIndex(int arow, int acolumn, void *adata) const
 { return QModelIndex(arow, acolumn, adata, this); }
 inline QModelIndex QAbstractItemModel::createIndex(int arow, int acolumn, quintptr aid) const
@@ -421,6 +423,7 @@ public:
     bool dropMimeData(const QMimeData *data, Qt::DropAction action,
                       int row, int column, const QModelIndex &parent);
 
+    Qt::ItemFlags flags(const QModelIndex &index) const Q_DECL_OVERRIDE;
 protected:
     QAbstractTableModel(QAbstractItemModelPrivate &dd, QObject *parent);
 
@@ -441,6 +444,8 @@ public:
     QModelIndex index(int row, int column = 0, const QModelIndex &parent = QModelIndex()) const;
     bool dropMimeData(const QMimeData *data, Qt::DropAction action,
                       int row, int column, const QModelIndex &parent);
+
+    Qt::ItemFlags flags(const QModelIndex &index) const Q_DECL_OVERRIDE;
 protected:
     QAbstractListModel(QAbstractItemModelPrivate &dd, QObject *parent);
 
@@ -473,6 +478,4 @@ inline uint qHash(const QModelIndex &index)
 
 QT_END_NAMESPACE
 
-QT_END_HEADER
-
 #endif // QABSTRACTITEMMODEL_H
diff --git a/src/corelib/itemmodels/qabstractproxymodel.h b/src/corelib/itemmodels/qabstractproxymodel.h
index 1f32126..9b26d6c 100644
--- a/src/corelib/itemmodels/qabstractproxymodel.h
+++ b/src/corelib/itemmodels/qabstractproxymodel.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtGui module of the Qt Toolkit.
@@ -44,8 +44,6 @@
 
 #include <QtCore/qabstractitemmodel.h>
 
-QT_BEGIN_HEADER
-
 QT_BEGIN_NAMESPACE
 
 
@@ -103,6 +101,9 @@ Q_SIGNALS:
 #endif
     );
 
+protected Q_SLOTS:
+    void resetInternalData();
+
 protected:
     QAbstractProxyModel(QAbstractProxyModelPrivate &, QObject *parent);
 
@@ -116,6 +117,4 @@ private:
 
 QT_END_NAMESPACE
 
-QT_END_HEADER
-
 #endif // QABSTRACTPROXYMODEL_H
diff --git a/src/corelib/itemmodels/qidentityproxymodel.h b/src/corelib/itemmodels/qidentityproxymodel.h
index da40836..8a416c9 100644
--- a/src/corelib/itemmodels/qidentityproxymodel.h
+++ b/src/corelib/itemmodels/qidentityproxymodel.h
@@ -47,8 +47,6 @@
 
 #ifndef QT_NO_IDENTITYPROXYMODEL
 
-QT_BEGIN_HEADER
-
 QT_BEGIN_NAMESPACE
 
 
@@ -102,7 +100,7 @@ private:
     Q_PRIVATE_SLOT(d_func(), void _q_sourceColumnsAboutToBeMoved(QModelIndex,int,int,QModelIndex,int))
     Q_PRIVATE_SLOT(d_func(), void _q_sourceColumnsMoved(QModelIndex,int,int,QModelIndex,int))
 
-    Q_PRIVATE_SLOT(d_func(), void _q_sourceDataChanged(QModelIndex,QModelIndex))
+    Q_PRIVATE_SLOT(d_func(), void _q_sourceDataChanged(QModelIndex,QModelIndex,QVector<int>))
     Q_PRIVATE_SLOT(d_func(), void _q_sourceHeaderDataChanged(Qt::Orientation orientation, int first, int last))
 
     Q_PRIVATE_SLOT(d_func(), void _q_sourceLayoutAboutToBeChanged(const QList<QPersistentModelIndex> &sourceParents, QAbstractItemModel::LayoutChangeHint hint))
@@ -113,8 +111,6 @@ private:
 
 QT_END_NAMESPACE
 
-QT_END_HEADER
-
 #endif // QT_NO_IDENTITYPROXYMODEL
 
 #endif // QIDENTITYPROXYMODEL_H
diff --git a/src/corelib/itemmodels/qitemselectionmodel.h b/src/corelib/itemmodels/qitemselectionmodel.h
index 79a8a25..2a1a4b0 100644
--- a/src/corelib/itemmodels/qitemselectionmodel.h
+++ b/src/corelib/itemmodels/qitemselectionmodel.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtGui module of the Qt Toolkit.
@@ -47,8 +47,6 @@
 #include <QtCore/qlist.h>
 #include <QtCore/qabstractitemmodel.h>
 
-QT_BEGIN_HEADER
-
 QT_BEGIN_NAMESPACE
 
 
@@ -253,6 +251,4 @@ Q_CORE_EXPORT QDebug operator<<(QDebug, const QItemSelectionRange &);
 
 QT_END_NAMESPACE
 
-QT_END_HEADER
-
 #endif // QITEMSELECTIONMODEL_H
diff --git a/src/corelib/itemmodels/qsortfilterproxymodel.h b/src/corelib/itemmodels/qsortfilterproxymodel.h
index 18b7078..a37c892 100644
--- a/src/corelib/itemmodels/qsortfilterproxymodel.h
+++ b/src/corelib/itemmodels/qsortfilterproxymodel.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtGui module of the Qt Toolkit.
@@ -48,8 +48,6 @@
 
 #include <QtCore/qregexp.h>
 
-QT_BEGIN_HEADER
-
 QT_BEGIN_NAMESPACE
 
 
@@ -198,8 +196,6 @@ private:
 
 QT_END_NAMESPACE
 
-QT_END_HEADER
-
 #endif // QT_NO_SORTFILTERPROXYMODEL
 
 #endif // QSORTFILTERPROXYMODEL_H
diff --git a/src/corelib/itemmodels/qstringlistmodel.h b/src/corelib/itemmodels/qstringlistmodel.h
index 4da435c..3514b27 100644
--- a/src/corelib/itemmodels/qstringlistmodel.h
+++ b/src/corelib/itemmodels/qstringlistmodel.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtGui module of the Qt Toolkit.
@@ -45,8 +45,6 @@
 #include <QtCore/qabstractitemmodel.h>
 #include <QtCore/qstringlist.h>
 
-QT_BEGIN_HEADER
-
 QT_BEGIN_NAMESPACE
 
 
@@ -86,6 +84,4 @@ private:
 
 QT_END_NAMESPACE
 
-QT_END_HEADER
-
 #endif // QSTRINGLISTMODEL_H
diff --git a/src/corelib/json/qjsonarray.h b/src/corelib/json/qjsonarray.h
index 0a6c769..1474cca 100644
--- a/src/corelib/json/qjsonarray.h
+++ b/src/corelib/json/qjsonarray.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtCore module of the Qt Toolkit.
@@ -45,8 +45,6 @@
 #include <QtCore/qjsonvalue.h>
 #include <QtCore/qiterator.h>
 
-QT_BEGIN_HEADER
-
 QT_BEGIN_NAMESPACE
 
 class QDebug;
@@ -219,6 +217,4 @@ Q_CORE_EXPORT QDebug operator<<(QDebug, const QJsonArray &);
 
 QT_END_NAMESPACE
 
-QT_END_HEADER
-
 #endif // QJSONARRAY_H
diff --git a/src/corelib/json/qjsondocument.h b/src/corelib/json/qjsondocument.h
index a5e87a8..0354262 100644
--- a/src/corelib/json/qjsondocument.h
+++ b/src/corelib/json/qjsondocument.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtCore module of the Qt Toolkit.
@@ -44,8 +44,6 @@
 
 #include <QtCore/qjsonvalue.h>
 
-QT_BEGIN_HEADER
-
 QT_BEGIN_NAMESPACE
 
 class QDebug;
@@ -69,7 +67,8 @@ struct Q_CORE_EXPORT QJsonParseError
         IllegalUTF8String,
         UnterminatedString,
         MissingObject,
-        DeepNesting
+        DeepNesting,
+        DocumentTooLarge
     };
 
     QString    errorString() const;
@@ -109,8 +108,19 @@ public:
     static QJsonDocument fromVariant(const QVariant &variant);
     QVariant toVariant() const;
 
+    enum JsonFormat {
+        Indented,
+        Compact
+    };
+
     static QJsonDocument fromJson(const QByteArray &json, QJsonParseError *error = 0);
-    QByteArray toJson() const;
+
+#ifdef Q_QDOC
+    QByteArray toJson(JsonFormat format = Indented) const;
+#else
+    QByteArray toJson() const; //### Merge in Qt6
+    QByteArray toJson(JsonFormat format) const;
+#endif
 
     bool isEmpty() const;
     bool isArray() const;
@@ -144,6 +154,4 @@ Q_CORE_EXPORT QDebug operator<<(QDebug, const QJsonDocument &);
 
 QT_END_NAMESPACE
 
-QT_END_HEADER
-
 #endif // QJSONDOCUMENT_H
diff --git a/src/corelib/json/qjsonobject.h b/src/corelib/json/qjsonobject.h
index a7cd3c9..8226b61 100644
--- a/src/corelib/json/qjsonobject.h
+++ b/src/corelib/json/qjsonobject.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtCore module of the Qt Toolkit.
@@ -45,8 +45,6 @@
 #include <QtCore/qjsonvalue.h>
 #include <QtCore/qiterator.h>
 
-QT_BEGIN_HEADER
-
 QT_BEGIN_NAMESPACE
 
 class QDebug;
@@ -214,6 +212,4 @@ Q_CORE_EXPORT QDebug operator<<(QDebug, const QJsonObject &);
 
 QT_END_NAMESPACE
 
-QT_END_HEADER
-
 #endif // QJSONOBJECT_H
diff --git a/src/corelib/json/qjsonvalue.h b/src/corelib/json/qjsonvalue.h
index 990c262..b8bdf55 100644
--- a/src/corelib/json/qjsonvalue.h
+++ b/src/corelib/json/qjsonvalue.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtCore module of the Qt Toolkit.
@@ -45,8 +45,6 @@
 #include <QtCore/qglobal.h>
 #include <QtCore/qstring.h>
 
-QT_BEGIN_HEADER
-
 QT_BEGIN_NAMESPACE
 
 class QDebug;
@@ -184,6 +182,4 @@ Q_CORE_EXPORT QDebug operator<<(QDebug, const QJsonValue &);
 
 QT_END_NAMESPACE
 
-QT_END_HEADER
-
 #endif // QJSONVALUE_H
diff --git a/src/corelib/kernel/qabstracteventdispatcher.h b/src/corelib/kernel/qabstracteventdispatcher.h
index 99e3163..6f21cef 100644
--- a/src/corelib/kernel/qabstracteventdispatcher.h
+++ b/src/corelib/kernel/qabstracteventdispatcher.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtCore module of the Qt Toolkit.
@@ -45,8 +45,6 @@
 #include <QtCore/qobject.h>
 #include <QtCore/qeventloop.h>
 
-QT_BEGIN_HEADER
-
 QT_BEGIN_NAMESPACE
 
 class QAbstractNativeEventFilter;
@@ -129,6 +127,4 @@ protected:
 
 QT_END_NAMESPACE
 
-QT_END_HEADER
-
 #endif // QABSTRACTEVENTDISPATCHER_H
diff --git a/src/corelib/kernel/qabstractnativeeventfilter.h b/src/corelib/kernel/qabstractnativeeventfilter.h
index 2d57b14..9d1db2c 100644
--- a/src/corelib/kernel/qabstractnativeeventfilter.h
+++ b/src/corelib/kernel/qabstractnativeeventfilter.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtCore module of the Qt Toolkit.
@@ -44,8 +44,6 @@
 
 #include <QtCore/qnamespace.h>
 
-QT_BEGIN_HEADER
-
 QT_BEGIN_NAMESPACE
 
 class QAbstractNativeEventFilterPrivate;
@@ -65,6 +63,4 @@ private:
 
 QT_END_NAMESPACE
 
-QT_END_HEADER
-
 #endif /* QABSTRACTNATIVEEVENTFILTER_H */
diff --git a/src/corelib/kernel/qbasictimer.h b/src/corelib/kernel/qbasictimer.h
index 6915623..432e4d5 100644
--- a/src/corelib/kernel/qbasictimer.h
+++ b/src/corelib/kernel/qbasictimer.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtCore module of the Qt Toolkit.
@@ -45,8 +45,6 @@
 #include <QtCore/qglobal.h>
 #include <QtCore/qnamespace.h>
 
-QT_BEGIN_HEADER
-
 QT_BEGIN_NAMESPACE
 
 
@@ -70,6 +68,4 @@ Q_DECLARE_TYPEINFO(QBasicTimer, Q_MOVABLE_TYPE);
 
 QT_END_NAMESPACE
 
-QT_END_HEADER
-
 #endif // QBASICTIMER_H
diff --git a/src/corelib/kernel/qcoreapplication.h b/src/corelib/kernel/qcoreapplication.h
index 83f444c..ae17aee 100644
--- a/src/corelib/kernel/qcoreapplication.h
+++ b/src/corelib/kernel/qcoreapplication.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtCore module of the Qt Toolkit.
@@ -42,15 +42,21 @@
 #ifndef QCOREAPPLICATION_H
 #define QCOREAPPLICATION_H
 
+#include <QtCore/qglobal.h>
+#include <QtCore/qstring.h>
+#ifndef QT_NO_QOBJECT
 #include <QtCore/qobject.h>
 #include <QtCore/qcoreevent.h>
 #include <QtCore/qeventloop.h>
+#else
+#include <QtCore/qscopedpointer.h>
+#endif
 
+#ifndef QT_NO_QOBJECT
 #if defined(Q_OS_WIN) && !defined(tagMSG)
 typedef struct tagMSG MSG;
 #endif
-
-QT_BEGIN_HEADER
+#endif
 
 QT_BEGIN_NAMESPACE
 
@@ -65,14 +71,19 @@ class QAbstractNativeEventFilter;
 
 #define qApp QCoreApplication::instance()
 
-class Q_CORE_EXPORT QCoreApplication : public QObject
+class Q_CORE_EXPORT QCoreApplication
+#ifndef QT_NO_QOBJECT
+    : public QObject
+#endif
 {
+#ifndef QT_NO_QOBJECT
     Q_OBJECT
-    Q_PROPERTY(QString applicationName READ applicationName WRITE setApplicationName)
-    Q_PROPERTY(QString applicationVersion READ applicationVersion WRITE setApplicationVersion)
-    Q_PROPERTY(QString organizationName READ organizationName WRITE setOrganizationName)
-    Q_PROPERTY(QString organizationDomain READ organizationDomain WRITE setOrganizationDomain)
+    Q_PROPERTY(QString applicationName READ applicationName WRITE setApplicationName NOTIFY applicationNameChanged)
+    Q_PROPERTY(QString applicationVersion READ applicationVersion WRITE setApplicationVersion NOTIFY applicationVersionChanged)
+    Q_PROPERTY(QString organizationName READ organizationName WRITE setOrganizationName NOTIFY organizationNameChanged)
+    Q_PROPERTY(QString organizationDomain READ organizationDomain WRITE setOrganizationDomain NOTIFY organizationDomainChanged)
     Q_PROPERTY(bool quitLockEnabled READ isQuitLockEnabled WRITE setQuitLockEnabled)
+#endif
 
     Q_DECLARE_PRIVATE(QCoreApplication)
 public:
@@ -103,6 +114,7 @@ public:
 
     static QCoreApplication *instance() { return self; }
 
+#ifndef QT_NO_QOBJECT
     static int exec();
     static void processEvents(QEventLoop::ProcessEventsFlags flags = QEventLoop::AllEvents);
     static void processEvents(QEventLoop::ProcessEventsFlags flags, int maxtime);
@@ -120,6 +132,7 @@ public:
 
     static bool startingUp();
     static bool closingDown();
+#endif
 
     static QString applicationDirPath();
     static QString applicationFilePath();
@@ -148,6 +161,7 @@ public:
         { return translate(context, key, disambiguation, n); }
 #endif
 
+#ifndef QT_NO_QOBJECT
     static void flush();
 
     void installNativeEventFilter(QAbstractNativeEventFilter *filterObj);
@@ -161,22 +175,34 @@ public Q_SLOTS:
 
 Q_SIGNALS:
     void aboutToQuit(
-#if !defined(qdoc)
+#if !defined(Q_QDOC)
     QPrivateSignal
 #endif
     );
 
+    void organizationNameChanged();
+    void organizationDomainChanged();
+    void applicationNameChanged();
+    void applicationVersionChanged();
+
 protected:
     bool event(QEvent *);
 
     virtual bool compressEvent(QEvent *, QObject *receiver, QPostEventList *);
+#endif // QT_NO_QOBJECT
 
 protected:
     QCoreApplication(QCoreApplicationPrivate &p);
 
+#ifdef QT_NO_QOBJECT
+    QScopedPointer<QCoreApplicationPrivate> d_ptr;
+#endif
+
 private:
+#ifndef QT_NO_QOBJECT
     static bool sendSpontaneousEvent(QObject *receiver, QEvent *event);
     bool notifyInternal(QObject *receiver, QEvent *event);
+#endif
 
     void init();
 
@@ -184,7 +210,6 @@ private:
 
     Q_DISABLE_COPY(QCoreApplication)
 
-    friend class QEventDispatcherUNIXPrivate;
     friend class QApplication;
     friend class QApplicationPrivate;
     friend class QGuiApplication;
@@ -193,46 +218,59 @@ private:
     friend class QWidget;
     friend class QWidgetWindow;
     friend class QWidgetPrivate;
+#ifndef QT_NO_QOBJECT
+    friend class QEventDispatcherUNIXPrivate;
     friend class QCocoaEventDispatcherPrivate;
     friend bool qt_sendSpontaneousEvent(QObject*, QEvent*);
+#endif
     friend Q_CORE_EXPORT QString qAppName();
     friend class QClassFactory;
 };
 
+#ifndef QT_NO_QOBJECT
 inline bool QCoreApplication::sendEvent(QObject *receiver, QEvent *event)
 {  if (event) event->spont = false; return self ? self->notifyInternal(receiver, event) : false; }
 
 inline bool QCoreApplication::sendSpontaneousEvent(QObject *receiver, QEvent *event)
 { if (event) event->spont = true; return self ? self->notifyInternal(receiver, event) : false; }
+#endif
 
-#ifdef QT_NO_TRANSLATION
-inline QString QCoreApplication::translate(const char *, const char *sourceText, const char *, int)
-{
-    return QString::fromUtf8(sourceText);
-}
+#ifdef QT_NO_DEPRECATED
+#  define QT_DECLARE_DEPRECATED_TR_FUNCTIONS(context)
+#else
+#  define QT_DECLARE_DEPRECATED_TR_FUNCTIONS(context) \
+    QT_DEPRECATED static inline QString trUtf8(const char *sourceText, const char *disambiguation = 0, int n = -1) \
+        { return QCoreApplication::translate(#context, sourceText, disambiguation, n); }
 #endif
 
 #define Q_DECLARE_TR_FUNCTIONS(context) \
 public: \
     static inline QString tr(const char *sourceText, const char *disambiguation = 0, int n = -1) \
         { return QCoreApplication::translate(#context, sourceText, disambiguation, n); } \
-    QT_DEPRECATED static inline QString trUtf8(const char *sourceText, const char *disambiguation = 0, int n = -1) \
-        { return QCoreApplication::translate(#context, sourceText, disambiguation, n); } \
+    QT_DECLARE_DEPRECATED_TR_FUNCTIONS(context) \
 private:
 
+typedef void (*QtStartUpFunction)();
 typedef void (*QtCleanUpFunction)();
 
+Q_CORE_EXPORT void qAddPreRoutine(QtStartUpFunction);
 Q_CORE_EXPORT void qAddPostRoutine(QtCleanUpFunction);
 Q_CORE_EXPORT void qRemovePostRoutine(QtCleanUpFunction);
 Q_CORE_EXPORT QString qAppName();                // get application name
 
+#define Q_COREAPP_STARTUP_FUNCTION(AFUNC) \
+    static void AFUNC ## _ctor_function() {  \
+        qAddPreRoutine(AFUNC);        \
+    }                                 \
+    Q_CONSTRUCTOR_FUNCTION(AFUNC ## _ctor_function)
+
+#ifndef QT_NO_QOBJECT
 #if defined(Q_OS_WIN) && !defined(QT_NO_DEBUG_STREAM)
 Q_CORE_EXPORT QString decodeMSG(const MSG &);
 Q_CORE_EXPORT QDebug operator<<(QDebug, const MSG &);
 #endif
+#endif
 
 QT_END_NAMESPACE
 
-QT_END_HEADER
-
 #endif // QCOREAPPLICATION_H
diff --git a/src/corelib/kernel/qcoreevent.h b/src/corelib/kernel/qcoreevent.h
index 6cce838..2ca0a7d 100644
--- a/src/corelib/kernel/qcoreevent.h
+++ b/src/corelib/kernel/qcoreevent.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtCore module of the Qt Toolkit.
@@ -46,8 +46,6 @@
 #include <QtCore/qbytearray.h>
 #include <QtCore/qobjectdefs.h>
 
-QT_BEGIN_HEADER
-
 QT_BEGIN_NAMESPACE
 
 
@@ -169,9 +167,9 @@ public:
 
         ToolBarChange = 120,                    // toolbar visibility toggled
 
-        ApplicationActivate = 121,              // application has been changed to active
+        ApplicationActivate = 121,              // deprecated. Use ApplicationStateChange instead.
         ApplicationActivated = ApplicationActivate, // deprecated
-        ApplicationDeactivate = 122,            // application has been changed to inactive
+        ApplicationDeactivate = 122,            // deprecated. Use ApplicationStateChange instead.
         ApplicationDeactivated = ApplicationDeactivate, // deprecated
 
         QueryWhatsThis = 123,                   // query what's this widget help
@@ -278,6 +276,7 @@ public:
         PlatformPanel = 212,
 
         StyleAnimationUpdate = 213,             // style animation target should be updated
+        ApplicationStateChange = 214,
 
         // 512 reserved for Qt Jambi's MetaCall event
         // 513 reserved for Qt Jambi's DeleteOnMainThread event
@@ -377,6 +376,4 @@ private:
 
 QT_END_NAMESPACE
 
-QT_END_HEADER
-
 #endif // QCOREEVENT_H
diff --git a/src/corelib/kernel/qeventloop.h b/src/corelib/kernel/qeventloop.h
index c11e3ed..926be08 100644
--- a/src/corelib/kernel/qeventloop.h
+++ b/src/corelib/kernel/qeventloop.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtCore module of the Qt Toolkit.
@@ -44,8 +44,6 @@
 
 #include <QtCore/qobject.h>
 
-QT_BEGIN_HEADER
-
 QT_BEGIN_NAMESPACE
 
 
@@ -106,6 +104,4 @@ private:
 
 QT_END_NAMESPACE
 
-QT_END_HEADER
-
 #endif // QEVENTLOOP_H
diff --git a/src/corelib/kernel/qfunctions_nacl.h b/src/corelib/kernel/qfunctions_nacl.h
index 1e90283..c15b975 100644
--- a/src/corelib/kernel/qfunctions_nacl.h
+++ b/src/corelib/kernel/qfunctions_nacl.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtCore module of the Qt Toolkit.
@@ -42,6 +42,8 @@
 #ifndef QFUNCTIONS_NACL_H
 #define QFUNCTIONS_NACL_H
 
+#include <QtCore/qglobal.h>
+
 #ifdef Q_OS_NACL
 
 #include <sys/types.h>
@@ -52,8 +54,6 @@
 #define PTHREAD_CANCEL_ENABLE 2
 #define PTHREAD_INHERIT_SCHED 3
 
-QT_BEGIN_HEADER
-
 QT_BEGIN_NAMESPACE
 
 
@@ -69,7 +69,7 @@ int pthread_cancel(pthread_t thread);
 
 int pthread_attr_setinheritsched(pthread_attr_t *attr,
     int inheritsched);
-int pthread_attr_getinheritsched(const pthread_attr_t *attr, 
+int pthread_attr_getinheritsched(const pthread_attr_t *attr,
     int *inheritsched);
 
 // event dispatcher, select
@@ -89,8 +89,6 @@ int select(int nfds, fd_set * readfds, fd_set * writefds, fd_set * errorfds, str
 
 QT_END_NAMESPACE
 
-QT_END_HEADER
-
 #endif //Q_OS_NACL
 
 #endif //QFUNCTIONS_NACL_H
diff --git a/src/corelib/kernel/qfunctions_vxworks.h b/src/corelib/kernel/qfunctions_vxworks.h
index d0f6e60..e33401a 100644
--- a/src/corelib/kernel/qfunctions_vxworks.h
+++ b/src/corelib/kernel/qfunctions_vxworks.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtCore module of the Qt Toolkit.
@@ -41,6 +41,9 @@
 
 #ifndef QFUNCTIONS_VXWORKS_H
 #define QFUNCTIONS_VXWORKS_H
+
+#include <QtCore/qglobal.h>
+
 #ifdef Q_OS_VXWORKS
 
 #include <unistd.h>
@@ -52,7 +55,11 @@
 #include <errno.h>
 #include <sys/types.h>
 #include <sys/ioctl.h>
+#if defined(_WRS_KERNEL)
 #include <sys/times.h>
+#else
+#include <sys/time.h>
+#endif
 #include <sys/socket.h>
 #include <sys/stat.h>
 #include <sys/wait.h>
@@ -61,15 +68,50 @@
 #include <net/if.h>
 #endif
 
-QT_BEGIN_HEADER
+// VxWorks has public header mbuf.h which defines following variables for DKM.
+// Let's undef those to because they overlap with Qt variable names-
+// File mbuf.h is included in headers <netinet/in.h> <net/if.h>, so make sure
+// that those are included before undef's.
+#if defined(mbuf)
+#  undef mbuf
+#endif
+#if defined(m_data)
+#  undef m_data
+#endif
+#if defined(m_type)
+#  undef m_type
+#endif
+#if defined(m_next)
+#  undef m_next
+#endif
+#if defined(m_len)
+#  undef m_len
+#endif
+#if defined(m_flags)
+#  undef m_flags
+#endif
+#if defined(m_hdr)
+#  undef m_hdr
+#endif
+#if defined(m_ext)
+#  undef m_ext
+#endif
+#if defined(m_act)
+#  undef m_act
+#endif
+#if defined(m_nextpkt)
+#  undef m_nextpkt
+#endif
+#if defined(m_pkthdr)
+#  undef m_pkthdr
+#endif
+
 QT_BEGIN_NAMESPACE
 
 #ifdef QT_BUILD_CORE_LIB
 #endif
 
 QT_END_NAMESPACE
-QT_END_HEADER
-
 
 #ifndef RTLD_LOCAL
 #define RTLD_LOCAL  0
@@ -95,17 +137,23 @@ void *lfind(const void* key, const void* base, size_t* elements, size_t size,
 // no rand_r(), but rand()
 // NOTE: this implementation is wrong for multi threaded applications,
 // but there is no way to get it right on VxWorks (in kernel mode)
+#if defined(_WRS_KERNEL)
 int rand_r(unsigned int * /*seedp*/);
+#endif
 
 // no usleep() support
 int usleep(unsigned int);
 
+#if defined(VXWORKS_DKM) || defined(VXWORKS_RTP)
+int gettimeofday(struct timeval *, void *);
+#else
 // gettimeofday() is declared, but is missing from the library.
 // It IS however defined in the Curtis-Wright X11 libraries, so
 // we have to make the symbol 'weak'
 int gettimeofday(struct timeval *tv, void /*struct timezone*/ *) __attribute__((weak));
+#endif
 
-// neither getpagesize() or sysconf(_SC_PAGESIZE) are available
+// getpagesize() not available
 int getpagesize();
 
 // symlinks are not supported (lstat is now just a call to stat - see qplatformdefs.h)
diff --git a/src/corelib/kernel/qfunctions_wince.h b/src/corelib/kernel/qfunctions_wince.h
index a4dc783..ab7bbe3 100644
--- a/src/corelib/kernel/qfunctions_wince.h
+++ b/src/corelib/kernel/qfunctions_wince.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtCore module of the Qt Toolkit.
@@ -41,6 +41,9 @@
 
 #ifndef QFUNCTIONS_WINCE_H
 #define QFUNCTIONS_WINCE_H
+
+#include <QtCore/qglobal.h>
+
 #ifdef Q_OS_WINCE
 #include <stdio.h>
 #include <stdlib.h>
@@ -56,15 +59,12 @@
 #include <winsock.h>
 #include <ceconfig.h>
 
-QT_BEGIN_HEADER
 QT_BEGIN_NAMESPACE
 
 #ifdef QT_BUILD_CORE_LIB
 #endif
 
 QT_END_NAMESPACE
-QT_END_HEADER
-
 
 // The standard SDK misses this define...
 #define _control87 _controlfp
diff --git a/src/corelib/kernel/qmath.h b/src/corelib/kernel/qmath.h
index c5aa90e..21e23b9 100644
--- a/src/corelib/kernel/qmath.h
+++ b/src/corelib/kernel/qmath.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtCore module of the Qt Toolkit.
@@ -42,12 +42,14 @@
 #ifndef QMATH_H
 #define QMATH_H
 
+#if 0
+#pragma qt_class(QtMath)
+#endif
+
 #include <math.h>
 
 #include <QtCore/qglobal.h>
 
-QT_BEGIN_HEADER
-
 QT_BEGIN_NAMESPACE
 
 
@@ -264,8 +266,26 @@ inline qreal qFastCos(qreal x)
     return qt_sine_table[si] - (qt_sine_table[ci] + 0.5 * qt_sine_table[si] * d) * d;
 }
 
-QT_END_NAMESPACE
+Q_DECL_CONSTEXPR inline float qDegreesToRadians(float degrees)
+{
+    return degrees * float(M_PI/180);
+}
+
+Q_DECL_CONSTEXPR inline double qDegreesToRadians(double degrees)
+{
+    return degrees * (M_PI / 180);
+}
+
+Q_DECL_CONSTEXPR inline float qRadiansToDegrees(float radians)
+{
+    return radians * float(180/M_PI);
+}
 
-QT_END_HEADER
+Q_DECL_CONSTEXPR inline double qRadiansToDegrees(double radians)
+{
+    return radians * (180 / M_PI);
+}
+
+QT_END_NAMESPACE
 
 #endif // QMATH_H
diff --git a/src/corelib/kernel/qmetaobject.h b/src/corelib/kernel/qmetaobject.h
index 9e0cba7..23fc89f 100644
--- a/src/corelib/kernel/qmetaobject.h
+++ b/src/corelib/kernel/qmetaobject.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtCore module of the Qt Toolkit.
@@ -45,8 +45,6 @@
 #include <QtCore/qobjectdefs.h>
 #include <QtCore/qvariant.h>
 
-QT_BEGIN_HEADER
-
 QT_BEGIN_NAMESPACE
 
 
@@ -274,6 +272,4 @@ Q_DECLARE_TYPEINFO(QMetaClassInfo, Q_MOVABLE_TYPE);
 
 QT_END_NAMESPACE
 
-QT_END_HEADER
-
 #endif // QMETAOBJECT_H
diff --git a/src/corelib/kernel/qmetatype.h b/src/corelib/kernel/qmetatype.h
index 09c641e..aed998f 100644
--- a/src/corelib/kernel/qmetatype.h
+++ b/src/corelib/kernel/qmetatype.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtCore module of the Qt Toolkit.
@@ -56,8 +56,6 @@
 #error qmetatype.h must be included before any header file that defines Bool
 #endif
 
-QT_BEGIN_HEADER
-
 QT_BEGIN_NAMESPACE
 
 
@@ -534,6 +532,9 @@ struct QMetaTypeId2
     static inline Q_DECL_CONSTEXPR int qt_metatype_id() { return QMetaTypeId<T>::qt_metatype_id(); }
 };
 
+template <typename T>
+struct QMetaTypeId2<const T&> : QMetaTypeId2<T> {};
+
 namespace QtPrivate {
     template <typename T, bool Defined = QMetaTypeId2<T>::Defined>
     struct QMetaTypeIdHelper {
@@ -574,7 +575,7 @@ namespace QtPrivate {
 
 template <typename T>
 int qRegisterNormalizedMetaType(const QT_PREPEND_NAMESPACE(QByteArray) &normalizedTypeName
-#ifndef qdoc
+#ifndef Q_QDOC
     , T * dummy = 0
     , typename QtPrivate::MetaTypeDefinedHelper<T, QMetaTypeId2<T>::Defined && !QMetaTypeId2<T>::IsBuiltIn>::DefinedType defined = QtPrivate::MetaTypeDefinedHelper<T, QMetaTypeId2<T>::Defined && !QMetaTypeId2<T>::IsBuiltIn>::Defined
 #endif
@@ -604,7 +605,7 @@ int qRegisterNormalizedMetaType(const QT_PREPEND_NAMESPACE(QByteArray) &normaliz
 
 template <typename T>
 int qRegisterMetaType(const char *typeName
-#ifndef qdoc
+#ifndef Q_QDOC
     , T * dummy = 0
     , typename QtPrivate::MetaTypeDefinedHelper<T, QMetaTypeId2<T>::Defined && !QMetaTypeId2<T>::IsBuiltIn>::DefinedType defined = QtPrivate::MetaTypeDefinedHelper<T, QMetaTypeId2<T>::Defined && !QMetaTypeId2<T>::IsBuiltIn>::Defined
 #endif
@@ -621,7 +622,7 @@ int qRegisterMetaType(const char *typeName
 #ifndef QT_NO_DATASTREAM
 template <typename T>
 void qRegisterMetaTypeStreamOperators(const char *typeName
-#ifndef qdoc
+#ifndef Q_QDOC
     , T * /* dummy */ = 0
 #endif
 )
@@ -633,30 +634,30 @@ void qRegisterMetaTypeStreamOperators(const char *typeName
 #endif // QT_NO_DATASTREAM
 
 template <typename T>
-inline Q_DECL_CONSTEXPR int qMetaTypeId(
-#ifndef qdoc
-    T * /* dummy */ = 0
-#endif
-)
+inline Q_DECL_CONSTEXPR int qMetaTypeId()
 {
     Q_STATIC_ASSERT_X(QMetaTypeId2<T>::Defined, "Type is not registered, please use the Q_DECLARE_METATYPE macro to make it known to Qt's meta-object system");
     return QMetaTypeId2<T>::qt_metatype_id();
 }
 
 template <typename T>
-inline Q_DECL_CONSTEXPR int qRegisterMetaType(
-#if !defined(qdoc) && !defined(Q_CC_SUN)
-    T * dummy = 0
-#endif
-)
+inline Q_DECL_CONSTEXPR int qRegisterMetaType()
 {
-#ifdef Q_CC_SUN
-    return qMetaTypeId(static_cast<T *>(0));
-#else
-    return qMetaTypeId(dummy);
-#endif
+    return qMetaTypeId<T>();
 }
 
+#if QT_DEPRECATED_SINCE(5, 1) && !defined(Q_QDOC)
+// There used to be a T *dummy = 0 argument in Qt 4.0 to support MSVC6
+template <typename T>
+QT_DEPRECATED inline Q_DECL_CONSTEXPR int qMetaTypeId(T *)
+{ return qMetaTypeId<T>(); }
+#ifndef Q_CC_SUN
+template <typename T>
+QT_DEPRECATED inline Q_DECL_CONSTEXPR int qRegisterMetaType(T *)
+{ return qRegisterMetaType<T>(); }
+#endif
+#endif
+
 template <typename T>
 struct QMetaTypeIdQObject<T*, /* isPointerToTypeDerivedFromQObject */ true>
 {
@@ -669,12 +670,12 @@ struct QMetaTypeIdQObject<T*, /* isPointerToTypeDerivedFromQObject */ true>
         static QBasicAtomicInt metatype_id = Q_BASIC_ATOMIC_INITIALIZER(0);
         if (const int id = metatype_id.loadAcquire())
             return id;
-        const int len = int(strlen(T::staticMetaObject.className()));
-        QVarLengthArray<char, 16> classNameStar;
-        classNameStar.append(T::staticMetaObject.className(), len);
-        classNameStar.append('*');
-        const int newId = qRegisterNormalizedMetaType<T*>(       \
-                        QByteArray(classNameStar.constData(), classNameStar.size()),
+        const char * const cName = T::staticMetaObject.className();
+        QByteArray typeName;
+        typeName.reserve(int(strlen(cName)) + 1);
+        typeName.append(cName).append('*');
+        const int newId = qRegisterNormalizedMetaType<T*>(
+                        typeName,
                         reinterpret_cast<T**>(quintptr(-1)));
         metatype_id.storeRelease(newId);
         return newId;
@@ -756,17 +757,18 @@ struct QMetaTypeId< SINGLE_ARG_TEMPLATE<T> > \
         static QBasicAtomicInt metatype_id = Q_BASIC_ATOMIC_INITIALIZER(0); \
         if (const int id = metatype_id.load()) \
             return id; \
-        QVarLengthArray<char, 24> name; \
-        name.append(#SINGLE_ARG_TEMPLATE, int(sizeof(#SINGLE_ARG_TEMPLATE)) - 1); \
-        name.append('<'); \
         const char *tName = QMetaType::typeName(qMetaTypeId<T>()); \
         Q_ASSERT(tName); \
-        name.append(tName, int(strlen(tName))); \
-        if (name.last() == '>') \
-            name.append(' '); \
-        name.append('>'); \
-        const int newId = qRegisterNormalizedMetaType< SINGLE_ARG_TEMPLATE<T> >(     \
-                        QByteArray(name.constData(), name.size()), \
+        const int tNameLen = qstrlen(tName); \
+        QByteArray typeName; \
+        typeName.reserve(sizeof(#SINGLE_ARG_TEMPLATE) + 1 + tNameLen + 1 + 1); \
+        typeName.append(#SINGLE_ARG_TEMPLATE, sizeof(#SINGLE_ARG_TEMPLATE) - 1) \
+            .append('<').append(tName, tNameLen); \
+        if (typeName.endsWith('>')) \
+            typeName.append(' '); \
+        typeName.append('>'); \
+        const int newId = qRegisterNormalizedMetaType< SINGLE_ARG_TEMPLATE<T> >( \
+                        typeName, \
                         reinterpret_cast< SINGLE_ARG_TEMPLATE<T> *>(quintptr(-1))); \
         metatype_id.storeRelease(newId); \
         return newId; \
@@ -785,21 +787,21 @@ struct QMetaTypeId< DOUBLE_ARG_TEMPLATE<T, U> > \
         static QBasicAtomicInt metatype_id = Q_BASIC_ATOMIC_INITIALIZER(0); \
         if (const int id = metatype_id.loadAcquire()) \
             return id; \
-        QVarLengthArray<char, 24> name; \
-        name.append(#DOUBLE_ARG_TEMPLATE, sizeof(#DOUBLE_ARG_TEMPLATE) - 1); \
-        name.append('<'); \
         const char *tName = QMetaType::typeName(qMetaTypeId<T>()); \
-        Q_ASSERT(tName); \
-        name.append(tName, int(strlen(tName))); \
-        name.append(','); \
         const char *uName = QMetaType::typeName(qMetaTypeId<U>()); \
+        Q_ASSERT(tName); \
         Q_ASSERT(uName); \
-        name.append(uName, int(strlen(uName))); \
-        if (name.last() == '>') \
-            name.append(' '); \
-        name.append('>'); \
+        const int tNameLen = qstrlen(tName); \
+        const int uNameLen = qstrlen(uName); \
+        QByteArray typeName; \
+        typeName.reserve(sizeof(#DOUBLE_ARG_TEMPLATE) + 1 + tNameLen + 1 + uNameLen + 1 + 1); \
+        typeName.append(#DOUBLE_ARG_TEMPLATE, sizeof(#DOUBLE_ARG_TEMPLATE) - 1) \
+            .append('<').append(tName, tNameLen).append(',').append(uName, uNameLen); \
+        if (typeName.endsWith('>')) \
+            typeName.append(' '); \
+        typeName.append('>'); \
         const int newId = qRegisterNormalizedMetaType< DOUBLE_ARG_TEMPLATE<T, U> >(\
-                        QByteArray(name.constData(), name.size()), \
+                        typeName, \
                         reinterpret_cast< DOUBLE_ARG_TEMPLATE<T, U> *>(quintptr(-1))); \
         metatype_id.storeRelease(newId); \
         return newId; \
@@ -826,7 +828,13 @@ struct QMetaTypeId_ ## SMART_POINTER ## _QObjectStar<T, true> \
         static QBasicAtomicInt metatype_id = Q_BASIC_ATOMIC_INITIALIZER(0); \
         if (const int id = metatype_id.loadAcquire()) \
             return id; \
-        const int newId = qRegisterNormalizedMetaType< SMART_POINTER<T> >( #SMART_POINTER "<" + QByteArray(T::staticMetaObject.className()) + ">", \
+        const char * const cName = T::staticMetaObject.className(); \
+        QByteArray typeName; \
+        typeName.reserve(sizeof(#SMART_POINTER) + 1 + strlen(cName) + 1); \
+        typeName.append(#SMART_POINTER, sizeof(#SMART_POINTER) - 1) \
+            .append('<').append(cName).append('>'); \
+        const int newId = qRegisterNormalizedMetaType< SMART_POINTER<T> >( \
+                        typeName, \
                         reinterpret_cast< SMART_POINTER<T> *>(quintptr(-1))); \
         metatype_id.storeRelease(newId); \
         return newId; \
@@ -980,6 +988,4 @@ QT_END_NAMESPACE
 QT_FOR_EACH_STATIC_TYPE(Q_DECLARE_BUILTIN_METATYPE)
 
 
-QT_END_HEADER
-
 #endif // QMETATYPE_H
diff --git a/src/corelib/kernel/qmimedata.h b/src/corelib/kernel/qmimedata.h
index 662a726..84c7326 100644
--- a/src/corelib/kernel/qmimedata.h
+++ b/src/corelib/kernel/qmimedata.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtCore module of the Qt Toolkit.
@@ -45,8 +45,6 @@
 #include <QtCore/qvariant.h>
 #include <QtCore/qobject.h>
 
-QT_BEGIN_HEADER
-
 QT_BEGIN_NAMESPACE
 
 
@@ -98,6 +96,4 @@ private:
 
 QT_END_NAMESPACE
 
-QT_END_HEADER
-
 #endif // QMIMEDATA_H
diff --git a/src/corelib/kernel/qobject.h b/src/corelib/kernel/qobject.h
index e9316c9..aaa09fa 100644
--- a/src/corelib/kernel/qobject.h
+++ b/src/corelib/kernel/qobject.h
@@ -1,6 +1,7 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Olivier Goffart <ogoffart at woboq.com>
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtCore module of the Qt Toolkit.
@@ -56,8 +57,6 @@
 
 #include <QtCore/qobject_impl.h>
 
-QT_BEGIN_HEADER
-
 QT_BEGIN_NAMESPACE
 
 
@@ -73,7 +72,7 @@ class QWidget;
 #ifndef QT_NO_REGEXP
 class QRegExp;
 #endif
-#ifndef QT_NO_REGEXP
+#ifndef QT_NO_REGULAREXPRESSION
 class QRegularExpression;
 #endif
 #ifndef QT_NO_USERDATA
@@ -125,7 +124,7 @@ public:
     virtual bool event(QEvent *);
     virtual bool eventFilter(QObject *, QEvent *);
 
-#ifdef qdoc
+#ifdef Q_QDOC
     static QString tr(const char *sourceText, const char *comment = 0, int n = -1);
     static QString trUtf8(const char *sourceText, const char *comment = 0, int n = -1);
     virtual const QMetaObject *metaObject() const;
@@ -163,12 +162,8 @@ public:
     inline QList<T> findChildren(const QString &aName = QString(), Qt::FindChildOptions options = Qt::FindChildrenRecursively) const
     {
         QList<T> list;
-        union {
-            QList<T> *typedList;
-            QList<void *> *voidList;
-        } u;
-        u.typedList = &list;
-        qt_qFindChildren_helper(this, aName, reinterpret_cast<T>(0)->staticMetaObject, u.voidList, options);
+        qt_qFindChildren_helper(this, aName, reinterpret_cast<T>(0)->staticMetaObject,
+                                reinterpret_cast<QList<void *> *>(&list), options);
         return list;
     }
 
@@ -177,27 +172,19 @@ public:
     inline QList<T> findChildren(const QRegExp &re, Qt::FindChildOptions options = Qt::FindChildrenRecursively) const
     {
         QList<T> list;
-        union {
-            QList<T> *typedList;
-            QList<void *> *voidList;
-        } u;
-        u.typedList = &list;
-        qt_qFindChildren_helper(this, re, reinterpret_cast<T>(0)->staticMetaObject, u.voidList, options);
+        qt_qFindChildren_helper(this, re, reinterpret_cast<T>(0)->staticMetaObject,
+                                reinterpret_cast<QList<void *> *>(&list), options);
         return list;
     }
 #endif
 
-#ifndef QT_NO_REGEXP
+#ifndef QT_NO_REGULAREXPRESSION
     template<typename T>
     inline QList<T> findChildren(const QRegularExpression &re, Qt::FindChildOptions options = Qt::FindChildrenRecursively) const
     {
         QList<T> list;
-        union {
-            QList<T> *typedList;
-            QList<void *> *voidList;
-        } u;
-        u.typedList = &list;
-        qt_qFindChildren_helper(this, re, reinterpret_cast<T>(0)->staticMetaObject, u.voidList, options);
+        qt_qFindChildren_helper(this, re, reinterpret_cast<T>(0)->staticMetaObject,
+                                reinterpret_cast<QList<void *> *>(&list), options);
         return list;
     }
 #endif
@@ -279,27 +266,50 @@ public:
     static inline typename QtPrivate::QEnableIf<QtPrivate::FunctionPointer<Func2>::ArgumentCount == -1, QMetaObject::Connection>::Type
             connect(const typename QtPrivate::FunctionPointer<Func1>::Object *sender, Func1 signal, Func2 slot)
     {
+#if defined (Q_COMPILER_DECLTYPE) && defined (Q_COMPILER_VARIADIC_TEMPLATES)
+        typedef QtPrivate::FunctionPointer<Func1> SignalType;
+        const int FunctorArgumentCount = QtPrivate::ComputeFunctorArgumentCount<Func2 , typename SignalType::Arguments>::Value;
+
+        Q_STATIC_ASSERT_X((FunctorArgumentCount >= 0),
+                          "Signal and slot arguments are not compatible.");
+        const int SlotArgumentCount = (FunctorArgumentCount >= 0) ? FunctorArgumentCount : 0;
+        typedef typename QtPrivate::FunctorReturnType<Func2, typename QtPrivate::List_Left<typename SignalType::Arguments, SlotArgumentCount>::Value>::Value SlotReturnType;
+#else
+      // Without variadic template, we don't detect the best overload of operator(). We just
+      // assume there is only one simple operator() and connect to &Func2::operator()
+
+      /* If you get an error such as:
+             couldn't deduce template parameter 'Func2Operator'
+        or
+             cannot resolve address of overloaded function
+        It means the functor does not have a single operator().
+        Functors with overloaded or templated operator() are only supported if the compiler supports
+        C++11 variadic templates
+      */
 #ifndef Q_COMPILER_DECLTYPE  //Workaround the lack of decltype using another function as indirection
         return connect_functor(sender, signal, slot, &Func2::operator()); }
     template <typename Func1, typename Func2, typename Func2Operator>
     static inline QMetaObject::Connection connect_functor(const QObject *sender, Func1 signal, Func2 slot, Func2Operator) {
         typedef QtPrivate::FunctionPointer<Func2Operator> SlotType ;
 #else
-
         typedef QtPrivate::FunctionPointer<decltype(&Func2::operator())> SlotType ;
 #endif
         typedef QtPrivate::FunctionPointer<Func1> SignalType;
+        typedef typename SlotType::ReturnType SlotReturnType;
+        const int SlotArgumentCount = SlotType::ArgumentCount;
 
-        Q_STATIC_ASSERT_X(int(SignalType::ArgumentCount) >= int(SlotType::ArgumentCount),
+        Q_STATIC_ASSERT_X(int(SignalType::ArgumentCount) >= SlotArgumentCount,
                           "The slot requires more arguments than the signal provides.");
         Q_STATIC_ASSERT_X((QtPrivate::CheckCompatibleArguments<typename SignalType::Arguments, typename SlotType::Arguments>::value),
                           "Signal and slot arguments are not compatible.");
-        Q_STATIC_ASSERT_X((QtPrivate::AreArgumentsCompatible<typename SlotType::ReturnType, typename SignalType::ReturnType>::value),
+#endif
+
+        Q_STATIC_ASSERT_X((QtPrivate::AreArgumentsCompatible<SlotReturnType, typename SignalType::ReturnType>::value),
                           "Return type of the slot is not compatible with the return type of the signal.");
 
         return connectImpl(sender, reinterpret_cast<void **>(&signal), sender, 0,
-                           new QtPrivate::QFunctorSlotObject<Func2, SlotType::ArgumentCount,
-                                typename QtPrivate::List_Left<typename SignalType::Arguments, SlotType::ArgumentCount>::Value,
+                           new QtPrivate::QFunctorSlotObject<Func2, SlotArgumentCount,
+                                typename QtPrivate::List_Left<typename SignalType::Arguments, SlotArgumentCount>::Value,
                                 typename SignalType::ReturnType>(slot),
                            Qt::DirectConnection, 0, &SignalType::Object::staticMetaObject);
     }
@@ -367,7 +377,7 @@ public:
 Q_SIGNALS:
     void destroyed(QObject * = 0);
     void objectNameChanged(const QString &objectName
-#if !defined(qdoc)
+#if !defined(Q_QDOC)
     , QPrivateSignal
 #endif
     );
@@ -438,7 +448,7 @@ public:
 };
 #endif
 
-#ifdef qdoc
+#ifdef Q_QDOC
 T qFindChild(const QObject *o, const QString &name = QString());
 QList<T> qFindChildren(const QObject *oobj, const QString &name = QString());
 QList<T> qFindChildren(const QObject *o, const QRegExp &re);
@@ -508,8 +518,6 @@ namespace QtPrivate {
 
 QT_END_NAMESPACE
 
-QT_END_HEADER
-
 #endif
 
 #endif // QOBJECT_H
diff --git a/src/corelib/kernel/qobject_impl.h b/src/corelib/kernel/qobject_impl.h
index 7083ded..0b5631f 100644
--- a/src/corelib/kernel/qobject_impl.h
+++ b/src/corelib/kernel/qobject_impl.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtCore module of the Qt Toolkit.
@@ -45,7 +45,10 @@
 #error Do not include qobject_impl.h directly
 #endif
 
-QT_BEGIN_HEADER
+#if 0
+#pragma qt_sync_skip_header_check
+#pragma qt_sync_stop_processing
+#endif
 
 QT_BEGIN_NAMESPACE
 
@@ -78,14 +81,14 @@ namespace QtPrivate {
     { static const int *types() { static const int t[4] = { QtPrivate::QMetaTypeIdHelper<Arg1>::qt_metatype_id(), QtPrivate::QMetaTypeIdHelper<Arg2>::qt_metatype_id(),
                                                             QtPrivate::QMetaTypeIdHelper<Arg3>::qt_metatype_id(), 0 }; return t; } };
     template <typename Arg1, typename Arg2, typename Arg3, typename Arg4> struct ConnectionTypes<List<Arg1, List<Arg2,  List<Arg3, List<Arg4, void> > > >, true>
-    { static const int *types() { static const int t[4] = { QtPrivate::QMetaTypeIdHelper<Arg1>::qt_metatype_id(), QtPrivate::QMetaTypeIdHelper<Arg2>::qt_metatype_id(),
+    { static const int *types() { static const int t[5] = { QtPrivate::QMetaTypeIdHelper<Arg1>::qt_metatype_id(), QtPrivate::QMetaTypeIdHelper<Arg2>::qt_metatype_id(),
                 QtPrivate::QMetaTypeIdHelper<Arg3>::qt_metatype_id(), QtPrivate::QMetaTypeIdHelper<Arg4>::qt_metatype_id(), 0 }; return t; } };
     template <typename Arg1, typename Arg2, typename Arg3, typename Arg4, typename Arg5> struct ConnectionTypes<List<Arg1, List<Arg2,  List<Arg3, List<Arg4, List<Arg5, void> > > > >, true>
-    { static const int *types() { static const int t[4] = { QtPrivate::QMetaTypeIdHelper<Arg1>::qt_metatype_id(), QtPrivate::QMetaTypeIdHelper<Arg2>::qt_metatype_id(),
+    { static const int *types() { static const int t[6] = { QtPrivate::QMetaTypeIdHelper<Arg1>::qt_metatype_id(), QtPrivate::QMetaTypeIdHelper<Arg2>::qt_metatype_id(),
                 QtPrivate::QMetaTypeIdHelper<Arg3>::qt_metatype_id(), QtPrivate::QMetaTypeIdHelper<Arg4>::qt_metatype_id(), QtPrivate::QMetaTypeIdHelper<Arg5>::qt_metatype_id(), 0 }; return t; } };
     template <typename Arg1, typename Arg2, typename Arg3, typename Arg4, typename Arg5, typename Arg6>
     struct ConnectionTypes<List<Arg1, List<Arg2,  List<Arg3, List<Arg4, List<Arg5, List<Arg6, void> > > > > >, true>
-    { static const int *types() { static const int t[4] = { QtPrivate::QMetaTypeIdHelper<Arg1>::qt_metatype_id(), QtPrivate::QMetaTypeIdHelper<Arg2>::qt_metatype_id(),
+    { static const int *types() { static const int t[7] = { QtPrivate::QMetaTypeIdHelper<Arg1>::qt_metatype_id(), QtPrivate::QMetaTypeIdHelper<Arg2>::qt_metatype_id(),
             QtPrivate::QMetaTypeIdHelper<Arg3>::qt_metatype_id(), QtPrivate::QMetaTypeIdHelper<Arg4>::qt_metatype_id(), QtPrivate::QMetaTypeIdHelper<Arg5>::qt_metatype_id(),
             QtPrivate::QMetaTypeIdHelper<Arg6>::qt_metatype_id(), 0 }; return t; } };
 #else
@@ -207,6 +210,4 @@ namespace QtPrivate {
 
 QT_END_NAMESPACE
 
-QT_END_HEADER
-
 #endif
diff --git a/src/corelib/kernel/qobjectcleanuphandler.h b/src/corelib/kernel/qobjectcleanuphandler.h
index 68f4f43..1f053cc 100644
--- a/src/corelib/kernel/qobjectcleanuphandler.h
+++ b/src/corelib/kernel/qobjectcleanuphandler.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtCore module of the Qt Toolkit.
@@ -44,8 +44,6 @@
 
 #include <QtCore/qobject.h>
 
-QT_BEGIN_HEADER
-
 QT_BEGIN_NAMESPACE
 
 
@@ -72,6 +70,4 @@ private Q_SLOTS:
 
 QT_END_NAMESPACE
 
-QT_END_HEADER
-
 #endif // QOBJECTCLEANUPHANDLER_H
diff --git a/src/corelib/kernel/qobjectdefs.h b/src/corelib/kernel/qobjectdefs.h
index 78a6827..afbe1a5 100644
--- a/src/corelib/kernel/qobjectdefs.h
+++ b/src/corelib/kernel/qobjectdefs.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtCore module of the Qt Toolkit.
@@ -46,8 +46,6 @@
 
 #include <QtCore/qobjectdefs_impl.h>
 
-QT_BEGIN_HEADER
-
 QT_BEGIN_NAMESPACE
 
 
@@ -483,6 +481,4 @@ inline const QMetaObject *QMetaObject::superClass() const
 
 QT_END_NAMESPACE
 
-QT_END_HEADER
-
 #endif // QOBJECTDEFS_H
diff --git a/src/corelib/kernel/qobjectdefs_impl.h b/src/corelib/kernel/qobjectdefs_impl.h
index 7fd9800..4f44d92 100644
--- a/src/corelib/kernel/qobjectdefs_impl.h
+++ b/src/corelib/kernel/qobjectdefs_impl.h
@@ -1,6 +1,7 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Olivier Goffart <ogoffart at woboq.com>
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtCore module of the Qt Toolkit.
@@ -45,7 +46,10 @@
 #error Do not include qobjectdefs_impl.h directly
 #endif
 
-QT_BEGIN_HEADER
+#if 0
+#pragma qt_sync_skip_header_check
+#pragma qt_sync_stop_processing
+#endif
 
 QT_BEGIN_NAMESPACE
 
@@ -59,7 +63,7 @@ namespace QtPrivate {
     /*
        The following List classes are used to help to handle the list of arguments.
        It follow the same principles as the lisp lists.
-       List_Left<L,N> take a list and a number as a parametter and returns (via the Value typedef,
+       List_Left<L,N> take a list and a number as a parameter and returns (via the Value typedef,
        the list composed of the first N element of the list
      */
 #ifndef Q_COMPILER_VARIADIC_TEMPLATES
@@ -90,7 +94,7 @@ namespace QtPrivate {
     template <typename T>
     struct ApplyReturnValue {
         void *data;
-        ApplyReturnValue(void *data_) : data(data_) {}
+        explicit ApplyReturnValue(void *data_) : data(data_) {}
     };
     template<typename T, typename U>
     void operator,(const T &value, const ApplyReturnValue<U> &container) {
@@ -113,7 +117,7 @@ namespace QtPrivate {
         - ArgumentCount  is the number of argument, or -1 if it is unknown
         - the Object typedef is the Object of a pointer to member function
         - the Arguments typedef is the list of argument (in a QtPrivate::List)
-        - the Function typedef is an alias to the template parametter Func
+        - the Function typedef is an alias to the template parameter Func
         - the call<Args, R>(f,o,args) method is used to call that slot
             Args is the list of argument of the signal
             R is the return type of the signal
@@ -594,13 +598,44 @@ namespace QtPrivate {
         enum { value = AreArgumentsCompatible<typename RemoveConstRef<Arg1>::Type, typename RemoveConstRef<Arg2>::Type>::value
                     && CheckCompatibleArguments<List<Tail1...>, List<Tail2...>>::value };
     };
+#endif
+
+#if defined(Q_COMPILER_DECLTYPE) && defined(Q_COMPILER_VARIADIC_TEMPLATES)
+    /*
+       Find the maximum number of arguments a functor object can take and be still compatible with
+       the arguments from the signal.
+       Value is the number of arguments, or -1 if nothing matches.
+     */
+    template <typename Functor, typename ArgList> struct ComputeFunctorArgumentCount;
+
+    template <typename Functor, typename ArgList, bool Done> struct ComputeFunctorArgumentCountHelper
+    { enum { Value = -1 }; };
+    template <typename Functor, typename First, typename... ArgList>
+    struct ComputeFunctorArgumentCountHelper<Functor, List<First, ArgList...>, false>
+        : ComputeFunctorArgumentCount<Functor,
+            typename List_Left<List<First, ArgList...>, sizeof...(ArgList)>::Value> {};
+
+    template <typename Functor, typename... ArgList> struct ComputeFunctorArgumentCount<Functor, List<ArgList...>>
+    {
+        template <typename D> static D dummy();
+        template <typename F> static auto test(F f) -> decltype(((f.operator()((dummy<ArgList>())...)), int()));
+        static char test(...);
+        enum {
+            Ok = sizeof(test(dummy<Functor>())) == sizeof(int),
+            Value = Ok ? sizeof...(ArgList) : int(ComputeFunctorArgumentCountHelper<Functor, List<ArgList...>, Ok>::Value)
+        };
+    };
 
+    /* get the return type of a functor, given the signal argument list  */
+    template <typename Functor, typename ArgList> struct FunctorReturnType;
+    template <typename Functor, typename ... ArgList> struct FunctorReturnType<Functor, List<ArgList...>> {
+        template <typename D> static D dummy();
+        typedef decltype(dummy<Functor>().operator()((dummy<ArgList>())...)) Value;
+    };
 #endif
-}
 
+}
 
 QT_END_NAMESPACE
 
-QT_END_HEADER
-
 #endif
diff --git a/src/corelib/kernel/qpointer.h b/src/corelib/kernel/qpointer.h
index dee1543..230b6b6 100644
--- a/src/corelib/kernel/qpointer.h
+++ b/src/corelib/kernel/qpointer.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtCore module of the Qt Toolkit.
@@ -46,67 +46,51 @@
 
 #ifndef QT_NO_QOBJECT
 
-QT_BEGIN_HEADER
-
 QT_BEGIN_NAMESPACE
 
 class QVariant;
 
-class QPointerBase
-{
-    QWeakPointer<QObject> wp;
-
-protected:
-    inline QPointerBase() : wp() { }
-    inline QPointerBase(QObject *p) : wp(p, true) { }
-    // compiler-generated copy/move ctor/assignment operators are fine! (even though public)
-    inline ~QPointerBase() { }
-
-    inline QObject* data() const
-    { return wp.data(); }
-
-    inline void assign(QObject *p)
-    { wp.assign(p); }
-
-    inline bool isNull() const
-    { return wp.isNull(); }
-
-    inline void clear()
-    { wp.clear(); }
-};
-
 template <class T>
-class QPointer : private QPointerBase
+class QPointer
 {
+    template<typename U>
+    struct TypeSelector
+    {
+        typedef QObject Type;
+    };
+    template<typename U>
+    struct TypeSelector<const U>
+    {
+        typedef const QObject Type;
+    };
+    typedef typename TypeSelector<T>::Type QObjectType;
+    QWeakPointer<QObjectType> wp;
 public:
     inline QPointer() { }
-    inline QPointer(T *p) : QPointerBase(p) { }
+    inline QPointer(T *p) : wp(p, true) { }
     // compiler-generated copy/move ctor/assignment operators are fine!
     inline ~QPointer() { }
 
     inline QPointer<T> &operator=(T* p)
-    { QPointerBase::assign(p); return *this; }
+    { wp.assign(static_cast<QObjectType*>(p)); return *this; }
 
     inline T* data() const
-    { return static_cast<T*>(QPointerBase::data()); }
+    { return static_cast<T*>( wp.data()); }
     inline T* operator->() const
     { return data(); }
     inline T& operator*() const
     { return *data(); }
     inline operator T*() const
     { return data(); }
-#ifdef qdoc
-    inline bool isNull() const;
-    inline void clear();
-#else
-    using QPointerBase::isNull;
-    using QPointerBase::clear;
-#endif
+
+    inline bool isNull() const
+    { return wp.isNull(); }
+
+    inline void clear()
+    { wp.clear(); }
 };
 template <class T> Q_DECLARE_TYPEINFO_BODY(QPointer<T>, Q_MOVABLE_TYPE);
 
-#if (!defined(Q_CC_SUN) || (__SUNPRO_CC >= 0x580)) // ambiguity between const T * and T *
-
 template <class T>
 inline bool operator==(const T *o, const QPointer<T> &p)
 { return o == p.operator->(); }
@@ -115,18 +99,6 @@ template<class T>
 inline bool operator==(const QPointer<T> &p, const T *o)
 { return p.operator->() == o; }
 
-#else
-
-template<class T>
-inline bool operator==(const void *o, const QPointer<T> &p)
-{ return o == p.operator->(); }
-
-template<class T>
-inline bool operator==(const QPointer<T> &p, const void *o)
-{ return p.operator->() == o; }
-
-#endif
-
 template <class T>
 inline bool operator==(T *o, const QPointer<T> &p)
 { return o == p.operator->(); }
@@ -139,9 +111,6 @@ template<class T>
 inline bool operator==(const QPointer<T> &p1, const QPointer<T> &p2)
 { return p1.operator->() == p2.operator->(); }
 
-
-#if (!defined(Q_CC_SUN) || (__SUNPRO_CC >= 0x580)) // ambiguity between const T * and T *
-
 template <class T>
 inline bool operator!=(const T *o, const QPointer<T> &p)
 { return o != p.operator->(); }
@@ -150,18 +119,6 @@ template<class T>
 inline bool operator!= (const QPointer<T> &p, const T *o)
 { return p.operator->() != o; }
 
-#else
-
-template<class T>
-inline bool operator!= (const void *o, const QPointer<T> &p)
-{ return o != p.operator->(); }
-
-template<class T>
-inline bool operator!= (const QPointer<T> &p, const void *o)
-{ return p.operator->() != o; }
-
-#endif
-
 template <class T>
 inline bool operator!=(T *o, const QPointer<T> &p)
 { return o != p.operator->(); }
@@ -174,17 +131,6 @@ template<class T>
 inline bool operator!= (const QPointer<T> &p1, const QPointer<T> &p2)
 { return p1.operator->() != p2.operator->() ; }
 
-// Make MSVC < 1400 (2005) handle "if (NULL == p)" syntax
-#if defined(Q_CC_MSVC) && (_MSC_VER < 1400)
-template<class T>
-inline bool operator== (int i, const QPointer<T> &p)
-{ Q_ASSERT(i == 0); return !i && p.isNull(); }
-
-template<class T>
-inline bool operator!= (int i, const QPointer<T> &p)
-{ Q_ASSERT(i == 0); return !i && !p.isNull(); }
-#endif
-
 template<typename T>
 QPointer<T>
 qPointerFromVariant(const QVariant &variant)
@@ -194,8 +140,6 @@ qPointerFromVariant(const QVariant &variant)
 
 QT_END_NAMESPACE
 
-QT_END_HEADER
-
 #endif // QT_NO_QOBJECT
 
 #endif // QPOINTER_H
diff --git a/src/corelib/kernel/qsharedmemory.h b/src/corelib/kernel/qsharedmemory.h
index b9b94a0..6b44548 100644
--- a/src/corelib/kernel/qsharedmemory.h
+++ b/src/corelib/kernel/qsharedmemory.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtCore module of the Qt Toolkit.
@@ -44,8 +44,6 @@
 
 #include <QtCore/qobject.h>
 
-QT_BEGIN_HEADER
-
 QT_BEGIN_NAMESPACE
 
 
@@ -114,7 +112,5 @@ private:
 
 QT_END_NAMESPACE
 
-QT_END_HEADER
-
 #endif // QSHAREDMEMORY_H
 
diff --git a/src/corelib/kernel/qsignalmapper.h b/src/corelib/kernel/qsignalmapper.h
index bdffdfb..997e8e4 100644
--- a/src/corelib/kernel/qsignalmapper.h
+++ b/src/corelib/kernel/qsignalmapper.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtCore module of the Qt Toolkit.
@@ -44,8 +44,6 @@
 
 #include <QtCore/qobject.h>
 
-QT_BEGIN_HEADER
-
 QT_BEGIN_NAMESPACE
 
 class QSignalMapperPrivate;
@@ -86,6 +84,4 @@ private:
 
 QT_END_NAMESPACE
 
-QT_END_HEADER
-
 #endif // QSIGNALMAPPER_H
diff --git a/src/corelib/kernel/qsocketnotifier.h b/src/corelib/kernel/qsocketnotifier.h
index 35e73b7..8cc6b9c 100644
--- a/src/corelib/kernel/qsocketnotifier.h
+++ b/src/corelib/kernel/qsocketnotifier.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtCore module of the Qt Toolkit.
@@ -44,8 +44,6 @@
 
 #include <QtCore/qobject.h>
 
-QT_BEGIN_HEADER
-
 QT_BEGIN_NAMESPACE
 
 class QSocketNotifierPrivate;
@@ -70,7 +68,7 @@ public Q_SLOTS:
 
 Q_SIGNALS:
     void activated(int socket
-#if !defined(qdoc)
+#if !defined(Q_QDOC)
     , QPrivateSignal
 #endif
     );
@@ -84,6 +82,4 @@ private:
 
 QT_END_NAMESPACE
 
-QT_END_HEADER
-
 #endif // QSOCKETNOTIFIER_H
diff --git a/src/corelib/kernel/qsystemsemaphore.h b/src/corelib/kernel/qsystemsemaphore.h
index 931db7b..b7dd220 100644
--- a/src/corelib/kernel/qsystemsemaphore.h
+++ b/src/corelib/kernel/qsystemsemaphore.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtCore module of the Qt Toolkit.
@@ -45,8 +45,6 @@
 #include <QtCore/qstring.h>
 #include <QtCore/qscopedpointer.h>
 
-QT_BEGIN_HEADER
-
 QT_BEGIN_NAMESPACE
 
 
@@ -96,7 +94,5 @@ private:
 
 QT_END_NAMESPACE
 
-QT_END_HEADER
-
 #endif // QSYSTEMSEMAPHORE_H
 
diff --git a/src/corelib/kernel/qtimer.h b/src/corelib/kernel/qtimer.h
index a3cc1c7..3484f4d 100644
--- a/src/corelib/kernel/qtimer.h
+++ b/src/corelib/kernel/qtimer.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtCore module of the Qt Toolkit.
@@ -42,13 +42,13 @@
 #ifndef QTIMER_H
 #define QTIMER_H
 
+#include <QtCore/qglobal.h>
+
 #ifndef QT_NO_QOBJECT
 
 #include <QtCore/qbasictimer.h> // conceptual inheritance
 #include <QtCore/qobject.h>
 
-QT_BEGIN_HEADER
-
 QT_BEGIN_NAMESPACE
 
 
@@ -89,7 +89,7 @@ public Q_SLOTS:
 
 Q_SIGNALS:
     void timeout(
-#if !defined(qdoc)
+#if !defined(Q_QDOC)
       QPrivateSignal
 #endif
     );
@@ -114,8 +114,6 @@ inline void QTimer::setSingleShot(bool asingleShot) { single = asingleShot; }
 
 QT_END_NAMESPACE
 
-QT_END_HEADER
-
 #endif // QT_NO_QOBJECT
 
 #endif // QTIMER_H
diff --git a/src/corelib/kernel/qtranslator.h b/src/corelib/kernel/qtranslator.h
index c87b9d8..c3957af 100644
--- a/src/corelib/kernel/qtranslator.h
+++ b/src/corelib/kernel/qtranslator.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtCore module of the Qt Toolkit.
@@ -45,8 +45,6 @@
 #include <QtCore/qobject.h>
 #include <QtCore/qbytearray.h>
 
-QT_BEGIN_HEADER
-
 QT_BEGIN_NAMESPACE
 
 
@@ -87,6 +85,4 @@ private:
 
 QT_END_NAMESPACE
 
-QT_END_HEADER
-
 #endif // QTRANSLATOR_H
diff --git a/src/corelib/kernel/qvariant.h b/src/corelib/kernel/qvariant.h
index 86b43cf..6f212f5 100644
--- a/src/corelib/kernel/qvariant.h
+++ b/src/corelib/kernel/qvariant.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtCore module of the Qt Toolkit.
@@ -51,8 +51,6 @@
 #include <QtCore/qstring.h>
 #include <QtCore/qobject.h>
 
-QT_BEGIN_HEADER
-
 QT_BEGIN_NAMESPACE
 
 
@@ -76,8 +74,10 @@ class QRect;
 class QRectF;
 #ifndef QT_NO_REGEXP
 class QRegExp;
-class QRegularExpression;
 #endif // QT_NO_REGEXP
+#ifndef QT_NO_REGULAREXPRESSION
+class QRegularExpression;
+#endif // QT_NO_REGULAREXPRESSION
 class QTextFormat;
 class QTextLength;
 class QUrl;
@@ -240,11 +240,11 @@ class Q_CORE_EXPORT QVariant
     QVariant(const QLocale &locale);
 #ifndef QT_NO_REGEXP
     QVariant(const QRegExp &regExp);
-#ifndef QT_BOOTSRAPPED
-    QVariant(const QRegularExpression &re);
-#endif // QT_BOOTSTRAPPED
 #endif // QT_NO_REGEXP
 #ifndef QT_BOOTSTRAPPED
+#ifndef QT_NO_REGULAREXPRESSION
+    QVariant(const QRegularExpression &re);
+#endif // QT_NO_REGULAREXPRESSION
     QVariant(const QUrl &url);
     QVariant(const QEasingCurve &easing);
     QVariant(const QUuid &uuid);
@@ -253,7 +253,7 @@ class Q_CORE_EXPORT QVariant
     QVariant(const QJsonObject &jsonObject);
     QVariant(const QJsonArray &jsonArray);
     QVariant(const QJsonDocument &jsonDocument);
-#endif
+#endif // QT_BOOTSTRAPPED
 
     QVariant& operator=(const QVariant &other);
 #ifdef Q_COMPILER_RVALUE_REFS
@@ -313,11 +313,11 @@ class Q_CORE_EXPORT QVariant
     QLocale toLocale() const;
 #ifndef QT_NO_REGEXP
     QRegExp toRegExp() const;
-#ifndef QT_BOOTSTRAPPED
-    QRegularExpression toRegularExpression() const;
-#endif // QT_BOOTSTRAPPED
 #endif // QT_NO_REGEXP
 #ifndef QT_BOOTSTRAPPED
+#ifndef QT_NO_REGULAREXPRESSION
+    QRegularExpression toRegularExpression() const;
+#endif // QT_NO_REGULAREXPRESSION
     QUrl toUrl() const;
     QEasingCurve toEasingCurve() const;
     QUuid toUuid() const;
@@ -326,7 +326,7 @@ class Q_CORE_EXPORT QVariant
     QJsonObject toJsonObject() const;
     QJsonArray toJsonArray() const;
     QJsonDocument toJsonDocument() const;
-#endif
+#endif // QT_BOOTSTRAPPED
 
 #ifndef QT_NO_DATASTREAM
     void load(QDataStream &ds);
@@ -355,7 +355,7 @@ class Q_CORE_EXPORT QVariant
     { return canConvert(qMetaTypeId<T>()); }
 
  public:
-#ifndef qdoc
+#ifndef Q_QDOC
     struct PrivateShared
     {
         inline PrivateShared(void *v) : ptr(v), ref(1) { }
@@ -484,7 +484,7 @@ public:
 template <typename T>
 inline QVariant qVariantFromValue(const T &t)
 {
-    return QVariant(qMetaTypeId<T>(reinterpret_cast<T *>(0)), &t, QTypeInfo<T>::isPointer);
+    return QVariant(qMetaTypeId<T>(), &t, QTypeInfo<T>::isPointer);
 }
 
 template <>
@@ -494,7 +494,7 @@ template <typename T>
 inline void qVariantSetValue(QVariant &v, const T &t)
 {
     //if possible we reuse the current QVariant private
-    const uint type = qMetaTypeId<T>(reinterpret_cast<T *>(0));
+    const uint type = qMetaTypeId<T>();
     QVariant::Private &d = v.data_ptr();
     if (v.isDetached() && (type == d.type || (type <= uint(QVariant::Char) && d.type <= uint(QVariant::Char)))) {
         d.type = type;
@@ -533,7 +533,7 @@ inline bool QVariant::isDetached() const
 { return !d.is_shared || d.data.shared->ref.load() == 1; }
 
 
-#ifdef qdoc
+#ifdef Q_QDOC
     inline bool operator==(const QVariant &v1, const QVariant &v2);
     inline bool operator!=(const QVariant &v1, const QVariant &v2);
 #else
@@ -568,7 +568,7 @@ namespace QtPrivate {
     {
         static T metaType(const QVariant &v)
         {
-            const int vid = qMetaTypeId<T>(static_cast<T *>(0));
+            const int vid = qMetaTypeId<T>();
             if (vid == v.userType())
                 return *reinterpret_cast<const T *>(v.constData());
             if (vid < int(QMetaType::User)) {
@@ -620,6 +620,4 @@ Q_CORE_EXPORT QDebug operator<<(QDebug, const QVariant::Type);
 
 QT_END_NAMESPACE
 
-QT_END_HEADER
-
 #endif // QVARIANT_H
diff --git a/src/corelib/kernel/qwineventnotifier.h b/src/corelib/kernel/qwineventnotifier.h
index d5e4d0f..56605d9 100644
--- a/src/corelib/kernel/qwineventnotifier.h
+++ b/src/corelib/kernel/qwineventnotifier.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtCore module of the Qt Toolkit.
@@ -42,15 +42,10 @@
 #ifndef QWINEVENTNOTIFIER_H
 #define QWINEVENTNOTIFIER_H
 
-#if 0
-// inform syncqt
-#pragma qt_no_master_include
-#endif
-
 #include "QtCore/qobject.h"
-#include "QtCore/qt_windows.h"
 
-QT_BEGIN_HEADER
+#ifdef Q_OS_WIN
+#include "QtCore/qt_windows.h"
 
 QT_BEGIN_NAMESPACE
 
@@ -75,7 +70,7 @@ public Q_SLOTS:
 
 Q_SIGNALS:
     void activated(HANDLE hEvent
-#if !defined(qdoc)
+#if !defined(Q_QDOC)
     , QPrivateSignal
 #endif
     );
@@ -86,6 +81,6 @@ protected:
 
 QT_END_NAMESPACE
 
-QT_END_HEADER
+#endif // Q_OS_WIN
 
 #endif // QWINEVENTNOTIFIER_H
diff --git a/src/corelib/mimetypes/qmimedatabase.h b/src/corelib/mimetypes/qmimedatabase.h
index a1c1736..17684e4 100644
--- a/src/corelib/mimetypes/qmimedatabase.h
+++ b/src/corelib/mimetypes/qmimedatabase.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtCore module of the Qt Toolkit.
@@ -45,7 +45,6 @@
 #include <QtCore/qmimetype.h>
 #include <QtCore/qstringlist.h>
 
-QT_BEGIN_HEADER
 QT_BEGIN_NAMESPACE
 
 class QByteArray;
@@ -90,6 +89,4 @@ private:
 };
 
 QT_END_NAMESPACE
-QT_END_HEADER
-
 #endif   // QMIMEDATABASE_H
diff --git a/src/corelib/mimetypes/qmimetype.h b/src/corelib/mimetypes/qmimetype.h
index 150a799..24d043e 100644
--- a/src/corelib/mimetypes/qmimetype.h
+++ b/src/corelib/mimetypes/qmimetype.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtCore module of the Qt Toolkit.
@@ -45,7 +45,6 @@
 #include <QtCore/qshareddata.h>
 #include <QtCore/qstring.h>
 
-QT_BEGIN_HEADER
 QT_BEGIN_NAMESPACE
 
 class QMimeTypePrivate;
@@ -112,6 +111,4 @@ protected:
 Q_DECLARE_SHARED(QMimeType)
 
 QT_END_NAMESPACE
-QT_END_HEADER
-
 #endif   // QMIMETYPE_H
diff --git a/src/corelib/plugin/qfactoryinterface.h b/src/corelib/plugin/qfactoryinterface.h
index c0115d8..88fb1bf 100644
--- a/src/corelib/plugin/qfactoryinterface.h
+++ b/src/corelib/plugin/qfactoryinterface.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtCore module of the Qt Toolkit.
@@ -45,8 +45,6 @@
 #include <QtCore/qobject.h>
 #include <QtCore/qstringlist.h>
 
-QT_BEGIN_HEADER
-
 QT_BEGIN_NAMESPACE
 
 
@@ -61,6 +59,4 @@ Q_DECLARE_INTERFACE(QFactoryInterface, "org.qt-project.Qt.QFactoryInterface")
 
 QT_END_NAMESPACE
 
-QT_END_HEADER
-
 #endif // QFACTORYINTERFACE_H
diff --git a/src/corelib/plugin/qlibrary.h b/src/corelib/plugin/qlibrary.h
index 96ba661..865bb8c 100644
--- a/src/corelib/plugin/qlibrary.h
+++ b/src/corelib/plugin/qlibrary.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtCore module of the Qt Toolkit.
@@ -44,16 +44,8 @@
 
 #include <QtCore/qobject.h>
 
-QT_BEGIN_HEADER
-
 QT_BEGIN_NAMESPACE
 
-
-#if defined(QT_NO_LIBRARY) && defined(Q_OS_WIN)
-#undef QT_NO_LIBRARY
-#pragma message("QT_NO_LIBRARY is not supported on Windows")
-#endif
-
 #ifndef QT_NO_LIBRARY
 
 class QLibraryPrivate;
@@ -111,6 +103,4 @@ Q_DECLARE_OPERATORS_FOR_FLAGS(QLibrary::LoadHints)
 
 QT_END_NAMESPACE
 
-QT_END_HEADER
-
 #endif //QLIBRARY_H
diff --git a/src/corelib/plugin/qplugin.h b/src/corelib/plugin/qplugin.h
index f212eaa..b91a0e9 100644
--- a/src/corelib/plugin/qplugin.h
+++ b/src/corelib/plugin/qplugin.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtCore module of the Qt Toolkit.
@@ -45,8 +45,6 @@
 #include <QtCore/qobject.h>
 #include <QtCore/qpointer.h>
 
-QT_BEGIN_HEADER
-
 QT_BEGIN_NAMESPACE
 
 
@@ -139,6 +137,4 @@ void Q_CORE_EXPORT qRegisterStaticPluginFunction(QStaticPlugin staticPlugin);
 
 QT_END_NAMESPACE
 
-QT_END_HEADER
-
 #endif // Q_PLUGIN_H
diff --git a/src/corelib/plugin/qpluginloader.h b/src/corelib/plugin/qpluginloader.h
index 46fc35a..8f8833e 100644
--- a/src/corelib/plugin/qpluginloader.h
+++ b/src/corelib/plugin/qpluginloader.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtCore module of the Qt Toolkit.
@@ -44,15 +44,8 @@
 
 #include <QtCore/qlibrary.h>
 
-#if defined(QT_NO_LIBRARY) && defined(Q_OS_WIN)
-#undef QT_NO_LIBRARY
-#pragma message("QT_NO_LIBRARY is not supported on Windows")
-#endif
-
 #ifndef QT_NO_LIBRARY
 
-QT_BEGIN_HEADER
-
 QT_BEGIN_NAMESPACE
 
 class QLibraryPrivate;
@@ -93,8 +86,6 @@ private:
 
 QT_END_NAMESPACE
 
-QT_END_HEADER
-
 #endif // QT_NO_LIBRARY
 
 #endif //QPLUGINLOADER_H
diff --git a/src/corelib/plugin/quuid.h b/src/corelib/plugin/quuid.h
index d1b5600..31b9890 100644
--- a/src/corelib/plugin/quuid.h
+++ b/src/corelib/plugin/quuid.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtCore module of the Qt Toolkit.
@@ -44,8 +44,6 @@
 
 #include <QtCore/qstring.h>
 
-QT_BEGIN_HEADER
-
 #if defined(Q_OS_WIN)
 #ifndef GUID_DEFINED
 #define GUID_DEFINED
@@ -84,11 +82,11 @@ public:
         Sha1                 = 5 // 0 1 0 1
     };
 
-#ifdef Q_COMPILER_INITIALIZER_LISTS // UNIFORM_INITIALIZATION
-    Q_DECL_CONSTEXPR QUuid()
-        : data1(0), data2(0), data3(0), data4{0,0,0,0,0,0,0,0} {}
+#if defined(Q_COMPILER_INITIALIZER_LISTS) && !defined(Q_QDOC)
+    Q_DECL_CONSTEXPR QUuid() : data1(0), data2(0), data3(0), data4{0,0,0,0,0,0,0,0} {}
 
-    Q_DECL_CONSTEXPR QUuid(uint l, ushort w1, ushort w2, uchar b1, uchar b2, uchar b3, uchar b4, uchar b5, uchar b6, uchar b7, uchar b8)
+    Q_DECL_CONSTEXPR QUuid(uint l, ushort w1, ushort w2, uchar b1, uchar b2, uchar b3,
+                           uchar b4, uchar b5, uchar b6, uchar b7, uchar b8)
         : data1(l), data2(w1), data3(w2), data4{b1, b2, b3, b4, b5, b6, b7, b8} {}
 #else
     QUuid()
@@ -149,7 +147,7 @@ public:
 #if defined(Q_OS_WIN)
     // On Windows we have a type GUID that is used by the platform API, so we
     // provide convenience operators to cast from and to this type.
-#ifdef Q_COMPILER_INITIALIZER_LISTS // UNIFORM_INITIALIZATION
+#if defined(Q_COMPILER_INITIALIZER_LISTS) && !defined(Q_QDOC)
     Q_DECL_CONSTEXPR QUuid(const GUID &guid)
         : data1(guid.Data1), data2(guid.Data2), data3(guid.Data3),
           data4{guid.Data4[0], guid.Data4[1], guid.Data4[2], guid.Data4[3],
@@ -227,6 +225,4 @@ Q_CORE_EXPORT uint qHash(const QUuid &uuid, uint seed = 0) Q_DECL_NOTHROW;
 
 QT_END_NAMESPACE
 
-QT_END_HEADER
-
 #endif // QUUID_H
diff --git a/src/corelib/statemachine/qabstractstate.h b/src/corelib/statemachine/qabstractstate.h
index 370414e..a6ac248 100644
--- a/src/corelib/statemachine/qabstractstate.h
+++ b/src/corelib/statemachine/qabstractstate.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtCore module of the Qt Toolkit.
@@ -44,8 +44,6 @@
 
 #include <QtCore/qobject.h>
 
-QT_BEGIN_HEADER
-
 QT_BEGIN_NAMESPACE
 
 
@@ -66,12 +64,12 @@ public:
 
 Q_SIGNALS:
     void entered(
-#if !defined(qdoc)
+#if !defined(Q_QDOC)
       QPrivateSignal
 #endif
     );
     void exited(
-#if !defined(qdoc)
+#if !defined(Q_QDOC)
       QPrivateSignal
 #endif
     );
@@ -96,6 +94,4 @@ private:
 
 QT_END_NAMESPACE
 
-QT_END_HEADER
-
 #endif
diff --git a/src/corelib/statemachine/qabstracttransition.h b/src/corelib/statemachine/qabstracttransition.h
index f9790bc..a35ad4c 100644
--- a/src/corelib/statemachine/qabstracttransition.h
+++ b/src/corelib/statemachine/qabstracttransition.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtCore module of the Qt Toolkit.
@@ -46,8 +46,6 @@
 
 #include <QtCore/qlist.h>
 
-QT_BEGIN_HEADER
-
 QT_BEGIN_NAMESPACE
 
 
@@ -89,7 +87,7 @@ public:
 
 Q_SIGNALS:
     void triggered(
-#if !defined(qdoc)
+#if !defined(Q_QDOC)
       QPrivateSignal
 #endif
     );
@@ -113,6 +111,4 @@ private:
 
 QT_END_NAMESPACE
 
-QT_END_HEADER
-
 #endif
diff --git a/src/corelib/statemachine/qeventtransition.h b/src/corelib/statemachine/qeventtransition.h
index 84a72eb..f53a5e4 100644
--- a/src/corelib/statemachine/qeventtransition.h
+++ b/src/corelib/statemachine/qeventtransition.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtCore module of the Qt Toolkit.
@@ -45,8 +45,6 @@
 #include <QtCore/qabstracttransition.h>
 #include <QtCore/qcoreevent.h>
 
-QT_BEGIN_HEADER
-
 QT_BEGIN_NAMESPACE
 
 
@@ -89,6 +87,4 @@ private:
 
 QT_END_NAMESPACE
 
-QT_END_HEADER
-
 #endif
diff --git a/src/corelib/statemachine/qfinalstate.h b/src/corelib/statemachine/qfinalstate.h
index 4540c0b..0343b99 100644
--- a/src/corelib/statemachine/qfinalstate.h
+++ b/src/corelib/statemachine/qfinalstate.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtCore module of the Qt Toolkit.
@@ -44,8 +44,6 @@
 
 #include <QtCore/qabstractstate.h>
 
-QT_BEGIN_HEADER
-
 QT_BEGIN_NAMESPACE
 
 
@@ -74,6 +72,4 @@ private:
 
 QT_END_NAMESPACE
 
-QT_END_HEADER
-
 #endif
diff --git a/src/corelib/statemachine/qhistorystate.h b/src/corelib/statemachine/qhistorystate.h
index dfa6155..62278ac 100644
--- a/src/corelib/statemachine/qhistorystate.h
+++ b/src/corelib/statemachine/qhistorystate.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtCore module of the Qt Toolkit.
@@ -44,8 +44,6 @@
 
 #include <QtCore/qabstractstate.h>
 
-QT_BEGIN_HEADER
-
 QT_BEGIN_NAMESPACE
 
 
@@ -89,6 +87,4 @@ private:
 
 QT_END_NAMESPACE
 
-QT_END_HEADER
-
 #endif
diff --git a/src/corelib/statemachine/qsignaltransition.h b/src/corelib/statemachine/qsignaltransition.h
index 81bf6e2..12f021d 100644
--- a/src/corelib/statemachine/qsignaltransition.h
+++ b/src/corelib/statemachine/qsignaltransition.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtCore module of the Qt Toolkit.
@@ -44,8 +44,6 @@
 
 #include <QtCore/qabstracttransition.h>
 
-QT_BEGIN_HEADER
-
 QT_BEGIN_NAMESPACE
 
 
@@ -84,6 +82,4 @@ private:
 
 QT_END_NAMESPACE
 
-QT_END_HEADER
-
 #endif
diff --git a/src/corelib/statemachine/qstate.h b/src/corelib/statemachine/qstate.h
index cad2691..a5f2509 100644
--- a/src/corelib/statemachine/qstate.h
+++ b/src/corelib/statemachine/qstate.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtCore module of the Qt Toolkit.
@@ -46,8 +46,6 @@
 
 #include <QtCore/qlist.h>
 
-QT_BEGIN_HEADER
-
 QT_BEGIN_NAMESPACE
 
 
@@ -101,12 +99,12 @@ public:
 
 Q_SIGNALS:
     void finished(
-#if !defined(qdoc)
+#if !defined(Q_QDOC)
       QPrivateSignal
 #endif
     );
     void propertiesAssigned(
-#if !defined(qdoc)
+#if !defined(Q_QDOC)
       QPrivateSignal
 #endif
     );
@@ -129,6 +127,4 @@ private:
 
 QT_END_NAMESPACE
 
-QT_END_HEADER
-
 #endif
diff --git a/src/corelib/statemachine/qstatemachine.h b/src/corelib/statemachine/qstatemachine.h
index 256471e..9305676 100644
--- a/src/corelib/statemachine/qstatemachine.h
+++ b/src/corelib/statemachine/qstatemachine.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtCore module of the Qt Toolkit.
@@ -50,8 +50,6 @@
 #include <QtCore/qset.h>
 #include <QtCore/qvariant.h>
 
-QT_BEGIN_HEADER
-
 QT_BEGIN_NAMESPACE
 
 
@@ -154,12 +152,12 @@ public Q_SLOTS:
 
 Q_SIGNALS:
     void started(
-#if !defined(qdoc)
+#if !defined(Q_QDOC)
       QPrivateSignal
 #endif
     );
     void stopped(
-#if !defined(qdoc)
+#if !defined(Q_QDOC)
       QPrivateSignal
 #endif
     );
@@ -195,6 +193,4 @@ private:
 
 QT_END_NAMESPACE
 
-QT_END_HEADER
-
 #endif
diff --git a/src/corelib/thread/qatomic.h b/src/corelib/thread/qatomic.h
index 1000180..1ccaecc 100644
--- a/src/corelib/thread/qatomic.h
+++ b/src/corelib/thread/qatomic.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtCore module of the Qt Toolkit.
@@ -46,8 +46,6 @@
 
 #include <QtCore/qbasicatomic.h>
 
-QT_BEGIN_HEADER
-
 QT_BEGIN_NAMESPACE
 
 
@@ -81,7 +79,7 @@ public:
         return *this;
     }
 
-#ifdef qdoc
+#ifdef Q_QDOC
     int load() const;
     int loadAcquire() const;
     void store(int newValue);
@@ -143,7 +141,7 @@ public:
         return *this;
     }
 
-#ifdef qdoc
+#ifdef Q_QDOC
     T *load() const;
     T *loadAcquire() const;
     void store(T *newValue);
@@ -220,6 +218,4 @@ inline void qAtomicDetach(T *&d)
 }
 
 QT_END_NAMESPACE
-QT_END_HEADER
-
 #endif // QATOMIC_H
diff --git a/src/corelib/thread/qbasicatomic.h b/src/corelib/thread/qbasicatomic.h
index 4177ddb..cf0a6a5 100644
--- a/src/corelib/thread/qbasicatomic.h
+++ b/src/corelib/thread/qbasicatomic.h
@@ -39,12 +39,12 @@
 **
 ****************************************************************************/
 
+#include <QtCore/qatomic.h>
+
 #ifndef QBASICATOMIC_H
 #define QBASICATOMIC_H
 
-#include <QtCore/qglobal.h>
-
-#if defined(QT_MOC) || defined(QT_BUILD_QMAKE) || defined(QT_RCC) || defined(QT_UIC) || defined(QT_BOOTSTRAPPED)
+#if defined(QT_BOOTSTRAPPED)
 #  include <QtCore/qatomic_bootstrap.h>
 
 // Compiler dependent implementation
@@ -101,15 +101,11 @@
 // Only include if the implementation has been ported to QAtomicOps
 #ifndef QOLDBASICATOMIC_H
 
-QT_BEGIN_HEADER
-
 QT_BEGIN_NAMESPACE
 
 #if 0
 // silence syncqt warnings
 QT_END_NAMESPACE
-QT_END_HEADER
-
 #pragma qt_no_master_include
 #pragma qt_sync_stop_processing
 #endif
@@ -117,10 +113,10 @@ QT_END_HEADER
 // New atomics
 
 #if defined(Q_COMPILER_CONSTEXPR) && defined(Q_COMPILER_DEFAULT_MEMBERS) && defined(Q_COMPILER_DELETE_MEMBERS)
-# if defined(Q_CC_CLANG) && ((((__clang_major__ * 100) + __clang_minor__) < 302) \
+# if defined(Q_CC_CLANG) && ((((__clang_major__ * 100) + __clang_minor__) < 303) \
                              || defined(__apple_build_version__) \
                             )
-   /* Do not define QT_BASIC_ATOMIC_HAS_CONSTRUCTORS for "stock" clang before version 3.2.
+   /* Do not define QT_BASIC_ATOMIC_HAS_CONSTRUCTORS for "stock" clang before version 3.3.
       Apple's version has different (higher!) version numbers, so disable it for all of them for now.
       (The only way to distinguish between them seems to be a check for __apple_build_version__ .)
 
@@ -271,8 +267,6 @@ public:
 
 QT_END_NAMESPACE
 
-QT_END_HEADER
-
 #endif // QOLDBASICATOMIC_H
 
 #endif // QBASICATOMIC_H
diff --git a/src/corelib/thread/qexception.h b/src/corelib/thread/qexception.h
index d24b291..accf0fc 100644
--- a/src/corelib/thread/qexception.h
+++ b/src/corelib/thread/qexception.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtCore module of the Qt Toolkit.
@@ -53,7 +53,6 @@
 #  include <exception>
 #endif
 
-QT_BEGIN_HEADER
 QT_BEGIN_NAMESPACE
 
 
@@ -116,7 +115,6 @@ public:
 #endif // QT_NO_EXCEPTIONS
 
 QT_END_NAMESPACE
-QT_END_HEADER
 
 #endif // QT_NO_QFUTURE
 
diff --git a/src/corelib/thread/qfuture.h b/src/corelib/thread/qfuture.h
index 8b16f30..8071e80 100644
--- a/src/corelib/thread/qfuture.h
+++ b/src/corelib/thread/qfuture.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtCore module of the Qt Toolkit.
@@ -49,7 +49,6 @@
 #include <QtCore/qfutureinterface.h>
 #include <QtCore/qstring.h>
 
-QT_BEGIN_HEADER
 QT_BEGIN_NAMESPACE
 
 
@@ -269,7 +268,6 @@ QFuture<void> qToVoidFuture(const QFuture<T> &future)
 }
 
 QT_END_NAMESPACE
-QT_END_HEADER
 
 #endif // QT_NO_QFUTURE
 
diff --git a/src/corelib/thread/qfutureinterface.h b/src/corelib/thread/qfutureinterface.h
index ea39c86..e0a5969 100644
--- a/src/corelib/thread/qfutureinterface.h
+++ b/src/corelib/thread/qfutureinterface.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtCore module of the Qt Toolkit.
@@ -50,7 +50,6 @@
 #include <QtCore/qexception.h>
 #include <QtCore/qresultstore.h>
 
-QT_BEGIN_HEADER
 QT_BEGIN_NAMESPACE
 
 
@@ -235,7 +234,7 @@ inline void QFutureInterface<T>::reportResults(const QVector<T> &_results, int b
         this->reportResultsReady(resultCountBefore, store.count());
     } else {
         const int insertIndex = store.addResults(beginIndex, &_results, count);
-        this->reportResultsReady(insertIndex, insertIndex + _results.count());    
+        this->reportResultsReady(insertIndex, insertIndex + _results.count());
     }
 }
 
@@ -310,8 +309,6 @@ public:
 };
 
 QT_END_NAMESPACE
-QT_END_HEADER
-
 #endif // QT_NO_QFUTURE
 
 #endif // QFUTUREINTERFACE_H
diff --git a/src/corelib/thread/qfuturesynchronizer.h b/src/corelib/thread/qfuturesynchronizer.h
index 12edcfb..39dbfc5 100644
--- a/src/corelib/thread/qfuturesynchronizer.h
+++ b/src/corelib/thread/qfuturesynchronizer.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtCore module of the Qt Toolkit.
@@ -46,7 +46,6 @@
 
 #ifndef QT_NO_QFUTURE
 
-QT_BEGIN_HEADER
 QT_BEGIN_NAMESPACE
 
 
@@ -81,7 +80,7 @@ public:
                  m_futures[i].cancel();
             }
         }
-        
+
         for (int i = 0; i < m_futures.count(); ++i) {
              m_futures[i].waitForFinished();
          }
@@ -113,8 +112,6 @@ protected:
 };
 
 QT_END_NAMESPACE
-QT_END_HEADER
-
 #endif // QT_NO_QFUTURE
 
 #endif // QFUTURESYNCHRONIZER_H
diff --git a/src/corelib/thread/qfuturewatcher.h b/src/corelib/thread/qfuturewatcher.h
index 005a0b1..c78ed7a 100644
--- a/src/corelib/thread/qfuturewatcher.h
+++ b/src/corelib/thread/qfuturewatcher.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtCore module of the Qt Toolkit.
@@ -48,7 +48,6 @@
 
 #include <QtCore/qobject.h>
 
-QT_BEGIN_HEADER
 QT_BEGIN_NAMESPACE
 
 
@@ -131,7 +130,7 @@ public:
     T result() const { return m_future.result(); }
     T resultAt(int index) const { return m_future.resultAt(index); }
 
-#ifdef qdoc
+#ifdef Q_QDOC
     int progressValue() const;
     int progressMinimum() const;
     int progressMaximum() const;
@@ -215,8 +214,6 @@ Q_INLINE_TEMPLATE void QFutureWatcher<void>::setFuture(const QFuture<void> &_fut
 }
 
 QT_END_NAMESPACE
-QT_END_HEADER
-
 #endif // QT_NO_QFUTURE
 
 #endif // QFUTUREWATCHER_H
diff --git a/src/corelib/thread/qgenericatomic.h b/src/corelib/thread/qgenericatomic.h
index 90f0223..a0a851e 100644
--- a/src/corelib/thread/qgenericatomic.h
+++ b/src/corelib/thread/qgenericatomic.h
@@ -44,14 +44,12 @@
 
 #include <QtCore/qglobal.h>
 
-QT_BEGIN_HEADER
 QT_BEGIN_NAMESPACE
 
 #if 0
 // silence syncqt warnings
 QT_END_NAMESPACE
-QT_END_HEADER
-
+#pragma qt_sync_skip_header_check
 #pragma qt_sync_stop_processing
 #endif
 
@@ -241,6 +239,4 @@ template <typename BaseClass> struct QGenericAtomicOps
 #undef always_inline
 
 QT_END_NAMESPACE
-QT_END_HEADER
-
 #endif // QGENERICATOMIC_H
diff --git a/src/corelib/thread/qmutex.h b/src/corelib/thread/qmutex.h
index 86b3db2..0bca0de 100644
--- a/src/corelib/thread/qmutex.h
+++ b/src/corelib/thread/qmutex.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtCore module of the Qt Toolkit.
@@ -46,12 +46,10 @@
 #include <QtCore/qatomic.h>
 #include <new>
 
-QT_BEGIN_HEADER
-
 QT_BEGIN_NAMESPACE
 
 
-#if !defined(QT_NO_THREAD) && !defined(qdoc)
+#if !defined(QT_NO_THREAD) && !defined(Q_QDOC)
 
 #ifdef Q_OS_LINUX
 # define QT_MUTEX_LOCK_NOEXCEPT Q_DECL_NOTHROW
@@ -173,7 +171,7 @@ private:
     quintptr val;
 };
 
-#else // QT_NO_THREAD or qdoc
+#else // QT_NO_THREAD or Q_QDOC
 
 class Q_CORE_EXPORT QMutex
 {
@@ -207,10 +205,8 @@ private:
 
 typedef QMutex QBasicMutex;
 
-#endif // QT_NO_THREAD or qdoc
+#endif // QT_NO_THREAD or Q_QDOC
 
 QT_END_NAMESPACE
 
-QT_END_HEADER
-
 #endif // QMUTEX_H
diff --git a/src/corelib/thread/qoldbasicatomic.h b/src/corelib/thread/qoldbasicatomic.h
index eac77ab..b755256 100644
--- a/src/corelib/thread/qoldbasicatomic.h
+++ b/src/corelib/thread/qoldbasicatomic.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtCore module of the Qt Toolkit.
@@ -44,16 +44,13 @@
 
 #include <QtCore/qglobal.h>
 
-QT_BEGIN_HEADER
-
 QT_BEGIN_NAMESPACE
 
 
 #if 0
 // silence syncqt warnings
 QT_END_NAMESPACE
-QT_END_HEADER
-
+#pragma qt_sync_skip_header_check
 #pragma qt_no_master_include
 #pragma qt_sync_stop_processing
 #endif
@@ -142,6 +139,5 @@ public:
 #define Q_BASIC_ATOMIC_INITIALIZER(a) { (a) }
 
 QT_END_NAMESPACE
-QT_END_HEADER
 
 #endif // QOLDBASICATOMIC_H
diff --git a/src/corelib/thread/qreadwritelock.h b/src/corelib/thread/qreadwritelock.h
index 39c34a4..6815878 100644
--- a/src/corelib/thread/qreadwritelock.h
+++ b/src/corelib/thread/qreadwritelock.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtCore module of the Qt Toolkit.
@@ -44,8 +44,6 @@
 
 #include <QtCore/qglobal.h>
 
-QT_BEGIN_HEADER
-
 QT_BEGIN_NAMESPACE
 
 
@@ -231,6 +229,4 @@ private:
 
 QT_END_NAMESPACE
 
-QT_END_HEADER
-
 #endif // QREADWRITELOCK_H
diff --git a/src/corelib/thread/qresultstore.h b/src/corelib/thread/qresultstore.h
index d084e24..11ce239 100644
--- a/src/corelib/thread/qresultstore.h
+++ b/src/corelib/thread/qresultstore.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtCore module of the Qt Toolkit.
@@ -49,7 +49,6 @@
 #include <QtCore/qmap.h>
 #include <QtCore/qdebug.h>
 
-QT_BEGIN_HEADER
 QT_BEGIN_NAMESPACE
 
 
@@ -61,7 +60,7 @@ QT_BEGIN_NAMESPACE
     either individually or in batches.
 */
 
-#ifndef qdoc
+#ifndef Q_QDOC
 
 namespace QtPrivate {
 
@@ -149,7 +148,7 @@ protected:
     bool m_filterMode;
     QMap<int, ResultItem> pendingResults;
     int filteredResults;
-    
+
 };
 
 template <typename T>
@@ -231,10 +230,9 @@ public:
 
 } // namespace QtPrivate
 
-#endif //qdoc
+#endif //Q_QDOC
 
 QT_END_NAMESPACE
-QT_END_HEADER
 
 #endif // QT_NO_QFUTURE
 
diff --git a/src/corelib/thread/qrunnable.h b/src/corelib/thread/qrunnable.h
index fbd241c..a6cc095 100644
--- a/src/corelib/thread/qrunnable.h
+++ b/src/corelib/thread/qrunnable.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtCore module of the Qt Toolkit.
@@ -44,7 +44,6 @@
 
 #include <QtCore/qglobal.h>
 
-QT_BEGIN_HEADER
 QT_BEGIN_NAMESPACE
 
 
@@ -67,6 +66,5 @@ public:
 };
 
 QT_END_NAMESPACE
-QT_END_HEADER
 
 #endif
diff --git a/src/corelib/thread/qsemaphore.h b/src/corelib/thread/qsemaphore.h
index 067f900..4020015 100644
--- a/src/corelib/thread/qsemaphore.h
+++ b/src/corelib/thread/qsemaphore.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtCore module of the Qt Toolkit.
@@ -44,8 +44,6 @@
 
 #include <QtCore/qglobal.h>
 
-QT_BEGIN_HEADER
-
 QT_BEGIN_NAMESPACE
 
 
@@ -77,6 +75,4 @@ private:
 
 QT_END_NAMESPACE
 
-QT_END_HEADER
-
 #endif // QSEMAPHORE_H
diff --git a/src/corelib/thread/qthread.h b/src/corelib/thread/qthread.h
index f7ae95f..19c0f82 100644
--- a/src/corelib/thread/qthread.h
+++ b/src/corelib/thread/qthread.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtCore module of the Qt Toolkit.
@@ -46,8 +46,6 @@
 
 #include <limits.h>
 
-QT_BEGIN_HEADER
-
 QT_BEGIN_NAMESPACE
 
 
@@ -113,12 +111,12 @@ public:
 
 Q_SIGNALS:
     void started(
-#if !defined(qdoc)
+#if !defined(Q_QDOC)
       QPrivateSignal
 #endif
     );
     void finished(
-#if !defined(qdoc)
+#if !defined(Q_QDOC)
       QPrivateSignal
 #endif
     );
@@ -164,6 +162,4 @@ private:
 
 QT_END_NAMESPACE
 
-QT_END_HEADER
-
 #endif // QTHREAD_H
diff --git a/src/corelib/thread/qthreadpool.h b/src/corelib/thread/qthreadpool.h
index da7cf43..ffc16de 100644
--- a/src/corelib/thread/qthreadpool.h
+++ b/src/corelib/thread/qthreadpool.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtCore module of the Qt Toolkit.
@@ -49,7 +49,6 @@
 
 #ifndef QT_NO_THREAD
 
-QT_BEGIN_HEADER
 QT_BEGIN_NAMESPACE
 
 
@@ -87,7 +86,6 @@ public:
 };
 
 QT_END_NAMESPACE
-QT_END_HEADER
 
 #endif // QT_NO_THREAD
 
diff --git a/src/corelib/thread/qthreadstorage.h b/src/corelib/thread/qthreadstorage.h
index 5c3d7f5..86285de 100644
--- a/src/corelib/thread/qthreadstorage.h
+++ b/src/corelib/thread/qthreadstorage.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtCore module of the Qt Toolkit.
@@ -46,8 +46,6 @@
 
 #ifndef QT_NO_THREAD
 
-QT_BEGIN_HEADER
-
 QT_BEGIN_NAMESPACE
 
 
@@ -156,8 +154,6 @@ public:
 
 QT_END_NAMESPACE
 
-QT_END_HEADER
-
 #endif // QT_NO_THREAD
 
 #endif // QTHREADSTORAGE_H
diff --git a/src/corelib/thread/qwaitcondition.h b/src/corelib/thread/qwaitcondition.h
index db36213..1468951 100644
--- a/src/corelib/thread/qwaitcondition.h
+++ b/src/corelib/thread/qwaitcondition.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtCore module of the Qt Toolkit.
@@ -46,8 +46,6 @@
 
 #include <limits.h>
 
-QT_BEGIN_HEADER
-
 QT_BEGIN_NAMESPACE
 
 
@@ -99,6 +97,4 @@ public:
 
 QT_END_NAMESPACE
 
-QT_END_HEADER
-
 #endif // QWAITCONDITION_H
diff --git a/src/corelib/tools/qalgorithms.h b/src/corelib/tools/qalgorithms.h
index 356f524..e3b7688 100644
--- a/src/corelib/tools/qalgorithms.h
+++ b/src/corelib/tools/qalgorithms.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtCore module of the Qt Toolkit.
@@ -44,8 +44,6 @@
 
 #include <QtCore/qglobal.h>
 
-QT_BEGIN_HEADER
-
 QT_BEGIN_NAMESPACE
 
 
@@ -140,7 +138,7 @@ inline void qCount(const Container &container, const T &value, Size &n)
     qCount(container.constBegin(), container.constEnd(), value, n);
 }
 
-#ifdef qdoc
+#ifdef Q_QDOC
 template <typename T>
 LessThan qLess()
 {
@@ -520,6 +518,4 @@ Q_OUTOFLINE_TEMPLATE RandomAccessIterator qBinaryFindHelper(RandomAccessIterator
 
 QT_END_NAMESPACE
 
-QT_END_HEADER
-
 #endif // QALGORITHMS_H
diff --git a/src/corelib/tools/qarraydata.h b/src/corelib/tools/qarraydata.h
index 7fecbbb..27f2606 100644
--- a/src/corelib/tools/qarraydata.h
+++ b/src/corelib/tools/qarraydata.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtCore module of the Qt Toolkit.
@@ -45,8 +45,6 @@
 #include <QtCore/qrefcount.h>
 #include <string.h>
 
-QT_BEGIN_HEADER
-
 QT_BEGIN_NAMESPACE
 
 struct Q_CORE_EXPORT QArrayData
@@ -361,6 +359,4 @@ namespace QtPrivate {
 
 QT_END_NAMESPACE
 
-QT_END_HEADER
-
 #endif // include guard
diff --git a/src/corelib/tools/qarraydataops.h b/src/corelib/tools/qarraydataops.h
index ceb65db..3cd8c51 100644
--- a/src/corelib/tools/qarraydataops.h
+++ b/src/corelib/tools/qarraydataops.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtCore module of the Qt Toolkit.
@@ -47,8 +47,6 @@
 #include <new>
 #include <string.h>
 
-QT_BEGIN_HEADER
-
 QT_BEGIN_NAMESPACE
 
 namespace QtPrivate {
@@ -423,6 +421,4 @@ struct QArrayDataOps
 
 QT_END_NAMESPACE
 
-QT_END_HEADER
-
 #endif // include guard
diff --git a/src/corelib/tools/qarraydatapointer.h b/src/corelib/tools/qarraydatapointer.h
index 766d4a4..533f7a3 100644
--- a/src/corelib/tools/qarraydatapointer.h
+++ b/src/corelib/tools/qarraydatapointer.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtCore module of the Qt Toolkit.
@@ -44,8 +44,6 @@
 
 #include <QtCore/qarraydataops.h>
 
-QT_BEGIN_HEADER
-
 QT_BEGIN_NAMESPACE
 
 template <class T>
@@ -219,6 +217,4 @@ namespace std
     }
 }
 
-QT_END_HEADER
-
 #endif // include guard
diff --git a/src/corelib/tools/qbitarray.h b/src/corelib/tools/qbitarray.h
index 133f829..1103712 100644
--- a/src/corelib/tools/qbitarray.h
+++ b/src/corelib/tools/qbitarray.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtCore module of the Qt Toolkit.
@@ -44,8 +44,6 @@
 
 #include <QtCore/qbytearray.h>
 
-QT_BEGIN_HEADER
-
 QT_BEGIN_NAMESPACE
 
 
@@ -176,6 +174,4 @@ Q_DECLARE_SHARED(QBitArray)
 
 QT_END_NAMESPACE
 
-QT_END_HEADER
-
 #endif // QBITARRAY_H
diff --git a/src/corelib/tools/qbytearray.h b/src/corelib/tools/qbytearray.h
index 50e52a1..f3cc301 100644
--- a/src/corelib/tools/qbytearray.h
+++ b/src/corelib/tools/qbytearray.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtCore module of the Qt Toolkit.
@@ -66,8 +66,6 @@
 #endif
 
 
-QT_BEGIN_HEADER
-
 QT_BEGIN_NAMESPACE
 
 
@@ -581,11 +579,11 @@ inline QByteArray &QByteArray::replace(const char *before, const char *after)
 { return replace(before, qstrlen(before), after, qstrlen(after)); }
 
 inline QByteArray &QByteArray::setNum(short n, int base)
-{ return setNum(qlonglong(n), base); }
+{ return base == 10 ? setNum(qlonglong(n), base) : setNum(qulonglong(ushort(n)), base); }
 inline QByteArray &QByteArray::setNum(ushort n, int base)
 { return setNum(qulonglong(n), base); }
 inline QByteArray &QByteArray::setNum(int n, int base)
-{ return setNum(qlonglong(n), base); }
+{ return base == 10 ? setNum(qlonglong(n), base) : setNum(qulonglong(uint(n)), base); }
 inline QByteArray &QByteArray::setNum(uint n, int base)
 { return setNum(qulonglong(n), base); }
 inline QByteArray &QByteArray::setNum(float n, char f, int prec)
@@ -610,8 +608,6 @@ Q_DECLARE_SHARED(QByteArray)
 
 QT_END_NAMESPACE
 
-QT_END_HEADER
-
 #ifdef QT_USE_QSTRINGBUILDER
 #include <QtCore/qstring.h>
 #endif
diff --git a/src/corelib/tools/qbytearraymatcher.h b/src/corelib/tools/qbytearraymatcher.h
index ae03af1..da6a337 100644
--- a/src/corelib/tools/qbytearraymatcher.h
+++ b/src/corelib/tools/qbytearraymatcher.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtCore module of the Qt Toolkit.
@@ -44,8 +44,6 @@
 
 #include <QtCore/qbytearray.h>
 
-QT_BEGIN_HEADER
-
 QT_BEGIN_NAMESPACE
 
 
@@ -97,6 +95,4 @@ private:
 
 QT_END_NAMESPACE
 
-QT_END_HEADER
-
 #endif // QBYTEARRAYMATCHER_H
diff --git a/src/corelib/tools/qcache.h b/src/corelib/tools/qcache.h
index 386deab..5890a94 100644
--- a/src/corelib/tools/qcache.h
+++ b/src/corelib/tools/qcache.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtCore module of the Qt Toolkit.
@@ -44,8 +44,6 @@
 
 #include <QtCore/qhash.h>
 
-QT_BEGIN_HEADER
-
 QT_BEGIN_NAMESPACE
 
 
@@ -200,6 +198,4 @@ void QCache<Key,T>::trim(int m)
 
 QT_END_NAMESPACE
 
-QT_END_HEADER
-
 #endif // QCACHE_H
diff --git a/src/corelib/tools/qchar.h b/src/corelib/tools/qchar.h
index aeb9848..8afa05b 100644
--- a/src/corelib/tools/qchar.h
+++ b/src/corelib/tools/qchar.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtCore module of the Qt Toolkit.
@@ -44,8 +44,6 @@
 
 #include <QtCore/qglobal.h>
 
-QT_BEGIN_HEADER
-
 QT_BEGIN_NAMESPACE
 
 
@@ -137,6 +135,130 @@ public:
         Symbol_Other              //   So
     };
 
+    enum Script
+    {
+        Script_Unknown,
+        Script_Inherited,
+        Script_Common,
+
+        Script_Latin,
+        Script_Greek,
+        Script_Cyrillic,
+        Script_Armenian,
+        Script_Hebrew,
+        Script_Arabic,
+        Script_Syriac,
+        Script_Thaana,
+        Script_Devanagari,
+        Script_Bengali,
+        Script_Gurmukhi,
+        Script_Gujarati,
+        Script_Oriya,
+        Script_Tamil,
+        Script_Telugu,
+        Script_Kannada,
+        Script_Malayalam,
+        Script_Sinhala,
+        Script_Thai,
+        Script_Lao,
+        Script_Tibetan,
+        Script_Myanmar,
+        Script_Georgian,
+        Script_Hangul,
+        Script_Ethiopic,
+        Script_Cherokee,
+        Script_CanadianAboriginal,
+        Script_Ogham,
+        Script_Runic,
+        Script_Khmer,
+        Script_Mongolian,
+        Script_Hiragana,
+        Script_Katakana,
+        Script_Bopomofo,
+        Script_Han,
+        Script_Yi,
+        Script_OldItalic,
+        Script_Gothic,
+        Script_Deseret,
+        Script_Tagalog,
+        Script_Hanunoo,
+        Script_Buhid,
+        Script_Tagbanwa,
+        Script_Coptic,
+
+        // Unicode 4.0 additions
+        Script_Limbu,
+        Script_TaiLe,
+        Script_LinearB,
+        Script_Ugaritic,
+        Script_Shavian,
+        Script_Osmanya,
+        Script_Cypriot,
+        Script_Braille,
+
+        // Unicode 4.1 additions
+        Script_Buginese,
+        Script_NewTaiLue,
+        Script_Glagolitic,
+        Script_Tifinagh,
+        Script_SylotiNagri,
+        Script_OldPersian,
+        Script_Kharoshthi,
+
+        // Unicode 5.0 additions
+        Script_Balinese,
+        Script_Cuneiform,
+        Script_Phoenician,
+        Script_PhagsPa,
+        Script_Nko,
+
+        // Unicode 5.1 additions
+        Script_Sundanese,
+        Script_Lepcha,
+        Script_OlChiki,
+        Script_Vai,
+        Script_Saurashtra,
+        Script_KayahLi,
+        Script_Rejang,
+        Script_Lycian,
+        Script_Carian,
+        Script_Lydian,
+        Script_Cham,
+
+        // Unicode 5.2 additions
+        Script_TaiTham,
+        Script_TaiViet,
+        Script_Avestan,
+        Script_EgyptianHieroglyphs,
+        Script_Samaritan,
+        Script_Lisu,
+        Script_Bamum,
+        Script_Javanese,
+        Script_MeeteiMayek,
+        Script_ImperialAramaic,
+        Script_OldSouthArabian,
+        Script_InscriptionalParthian,
+        Script_InscriptionalPahlavi,
+        Script_OldTurkic,
+        Script_Kaithi,
+
+        // Unicode 6.0 additions
+        Script_Batak,
+        Script_Brahmi,
+        Script_Mandaic,
+
+        // Unicode 6.1 additions
+        Script_Chakma,
+        Script_MeroiticCursive,
+        Script_MeroiticHieroglyphs,
+        Script_Miao,
+        Script_Sharada,
+        Script_SoraSompeng,
+        Script_Takri,
+
+        ScriptCount
+    };
+
     enum Direction
     {
         DirL, DirR, DirEN, DirES, DirET, DirAN, DirCS, DirB, DirS, DirWS, DirON,
@@ -231,6 +353,8 @@ public:
     inline QChar toTitleCase() const { return QChar::toTitleCase(ucs); }
     inline QChar toCaseFolded() const { return QChar::toCaseFolded(ucs); }
 
+    inline Script script() const { return QChar::script(ucs); }
+
     inline UnicodeVersion unicodeVersion() const { return QChar::unicodeVersion(ucs); }
 
 #if QT_DEPRECATED_SINCE(5, 0)
@@ -316,6 +440,8 @@ public:
     static uint QT_FASTCALL toTitleCase(uint ucs4);
     static uint QT_FASTCALL toCaseFolded(uint ucs4);
 
+    static Script QT_FASTCALL script(uint ucs4);
+
     static UnicodeVersion QT_FASTCALL unicodeVersion(uint ucs4);
 
     static UnicodeVersion QT_FASTCALL currentUnicodeVersion();
@@ -398,6 +524,4 @@ Q_CORE_EXPORT QDataStream &operator>>(QDataStream &, QChar &);
 
 QT_END_NAMESPACE
 
-QT_END_HEADER
-
 #endif // QCHAR_H
diff --git a/src/corelib/tools/qcontainerfwd.h b/src/corelib/tools/qcontainerfwd.h
index 9cf063f..6b79e40 100644
--- a/src/corelib/tools/qcontainerfwd.h
+++ b/src/corelib/tools/qcontainerfwd.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtCore module of the Qt Toolkit.
@@ -44,8 +44,6 @@
 
 #include <QtCore/qglobal.h>
 
-QT_BEGIN_HEADER
-
 QT_BEGIN_NAMESPACE
 
 
@@ -65,6 +63,4 @@ template <class T> class QVector;
 
 QT_END_NAMESPACE
 
-QT_END_HEADER
-
 #endif // QCONTAINERFWD_H
diff --git a/src/corelib/tools/qcontiguouscache.h b/src/corelib/tools/qcontiguouscache.h
index e1cc65f..d601ddb 100644
--- a/src/corelib/tools/qcontiguouscache.h
+++ b/src/corelib/tools/qcontiguouscache.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtCore module of the Qt Toolkit.
@@ -46,8 +46,6 @@
 #include <limits.h>
 #include <new>
 
-QT_BEGIN_HEADER
-
 QT_BEGIN_NAMESPACE
 
 #undef QT_QCONTIGUOUSCACHE_DEBUG
@@ -464,6 +462,4 @@ inline T QContiguousCache<T>::takeLast()
 
 QT_END_NAMESPACE
 
-QT_END_HEADER
-
 #endif
diff --git a/src/corelib/tools/qcryptographichash.h b/src/corelib/tools/qcryptographichash.h
index 177c5c9..d4e75c4 100644
--- a/src/corelib/tools/qcryptographichash.h
+++ b/src/corelib/tools/qcryptographichash.h
@@ -1,6 +1,7 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Richard J. Moore <rich at kde.org>.
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtCore module of the Qt Toolkit.
@@ -44,8 +45,6 @@
 
 #include <QtCore/qbytearray.h>
 
-QT_BEGIN_HEADER
-
 QT_BEGIN_NAMESPACE
 
 
@@ -62,7 +61,11 @@ public:
         Sha224,
         Sha256,
         Sha384,
-        Sha512
+        Sha512,
+        Sha3_224,
+        Sha3_256,
+        Sha3_384,
+        Sha3_512
     };
 
     explicit QCryptographicHash(Algorithm method);
@@ -84,6 +87,4 @@ private:
 
 QT_END_NAMESPACE
 
-QT_END_HEADER
-
 #endif
diff --git a/src/corelib/tools/qdatetime.h b/src/corelib/tools/qdatetime.h
index 22db5a4..5c16680 100644
--- a/src/corelib/tools/qdatetime.h
+++ b/src/corelib/tools/qdatetime.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtCore module of the Qt Toolkit.
@@ -48,8 +48,6 @@
 
 #include <limits>
 
-QT_BEGIN_HEADER
-
 QT_BEGIN_NAMESPACE
 
 
@@ -264,6 +262,10 @@ public:
 private:
     friend class QDateTimePrivate;
     void detach();
+
+    // ### Qt6: Using a private here has high impact on runtime
+    // on users such as QFileInfo. In Qt 6, the data members
+    // should be inlined.
     QExplicitlySharedDataPointer<QDateTimePrivate> d;
 
 #ifndef QT_NO_DATASTREAM
@@ -296,6 +298,4 @@ Q_CORE_EXPORT uint qHash(const QTime &key, uint seed = 0) Q_DECL_NOTHROW;
 
 QT_END_NAMESPACE
 
-QT_END_HEADER
-
 #endif // QDATETIME_H
diff --git a/src/corelib/tools/qeasingcurve.h b/src/corelib/tools/qeasingcurve.h
index b00cdb0..2e65754 100644
--- a/src/corelib/tools/qeasingcurve.h
+++ b/src/corelib/tools/qeasingcurve.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtCore module of the Qt Toolkit.
@@ -50,8 +50,6 @@
 # include <QtCore/qpoint.h>
 #endif
 
-QT_BEGIN_HEADER
-
 QT_BEGIN_NAMESPACE
 
 
@@ -142,6 +140,4 @@ Q_CORE_EXPORT QDataStream &operator>>(QDataStream &, QEasingCurve &);
 
 QT_END_NAMESPACE
 
-QT_END_HEADER
-
 #endif
diff --git a/src/corelib/tools/qelapsedtimer.h b/src/corelib/tools/qelapsedtimer.h
index 9729b72..b06afe4 100644
--- a/src/corelib/tools/qelapsedtimer.h
+++ b/src/corelib/tools/qelapsedtimer.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtCore module of the Qt Toolkit.
@@ -44,8 +44,6 @@
 
 #include <QtCore/qglobal.h>
 
-QT_BEGIN_HEADER
-
 QT_BEGIN_NAMESPACE
 
 
@@ -89,6 +87,4 @@ private:
 
 QT_END_NAMESPACE
 
-QT_END_HEADER
-
 #endif // QELAPSEDTIMER_H
diff --git a/src/corelib/tools/qhash.h b/src/corelib/tools/qhash.h
index 169b32a..e99a67d 100644
--- a/src/corelib/tools/qhash.h
+++ b/src/corelib/tools/qhash.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtCore module of the Qt Toolkit.
@@ -48,7 +48,9 @@
 #include <QtCore/qpair.h>
 #include <QtCore/qrefcount.h>
 
-QT_BEGIN_HEADER
+#ifdef Q_COMPILER_INITIALIZER_LISTS
+#include <initializer_list>
+#endif
 
 QT_BEGIN_NAMESPACE
 
@@ -90,6 +92,7 @@ Q_CORE_EXPORT uint qHash(const QStringRef &key, uint seed = 0) Q_DECL_NOTHROW;
 Q_CORE_EXPORT uint qHash(const QBitArray &key, uint seed = 0) Q_DECL_NOTHROW;
 Q_CORE_EXPORT uint qHash(QLatin1String key, uint seed = 0) Q_DECL_NOTHROW;
 Q_CORE_EXPORT uint qt_hash(const QString &key) Q_DECL_NOTHROW;
+Q_CORE_EXPORT uint qt_hash(const QStringRef &key) Q_DECL_NOTHROW;
 
 #if defined(Q_CC_MSVC)
 #pragma warning( push )
@@ -285,6 +288,15 @@ class QHash
 
 public:
     inline QHash() : d(const_cast<QHashData *>(&QHashData::shared_null)) { }
+#ifdef Q_COMPILER_INITIALIZER_LISTS
+    inline QHash(std::initializer_list<std::pair<Key,T> > list)
+        : d(const_cast<QHashData *>(&QHashData::shared_null))
+    {
+        reserve(list.size());
+        for (typename std::initializer_list<std::pair<Key,T> >::const_iterator it = list.begin(); it != list.end(); ++it)
+            insert(it->first, it->second);
+    }
+#endif
     inline QHash(const QHash<Key, T> &other) : d(other.d) { d->ref.ref(); if (!d->sharable) detach(); }
     inline ~QHash() { if (!d->ref.deref()) freeData(d); }
 
@@ -921,6 +933,14 @@ class QMultiHash : public QHash<Key, T>
 {
 public:
     QMultiHash() {}
+#ifdef Q_COMPILER_INITIALIZER_LISTS
+    inline QMultiHash(std::initializer_list<std::pair<Key,T> > list)
+    {
+        this->reserve(list.size());
+        for (typename std::initializer_list<std::pair<Key,T> >::const_iterator it = list.begin(); it != list.end(); ++it)
+            insert(it->first, it->second);
+    }
+#endif
     QMultiHash(const QHash<Key, T> &other) : QHash<Key, T>(other) {}
     inline void swap(QMultiHash<Key, T> &other) { QHash<Key, T>::swap(other); } // prevent QMultiHash<->QHash swaps
 
@@ -1034,6 +1054,4 @@ Q_DECLARE_MUTABLE_ASSOCIATIVE_ITERATOR(Hash)
 
 QT_END_NAMESPACE
 
-QT_END_HEADER
-
 #endif // QHASH_H
diff --git a/src/corelib/tools/qiterator.h b/src/corelib/tools/qiterator.h
index 7775bb2..3b86edd 100644
--- a/src/corelib/tools/qiterator.h
+++ b/src/corelib/tools/qiterator.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtCore module of the Qt Toolkit.
@@ -44,8 +44,6 @@
 
 #include <QtCore/qglobal.h>
 
-QT_BEGIN_HEADER
-
 QT_BEGIN_NAMESPACE
 
 #define Q_DECLARE_SEQUENTIAL_ITERATOR(C) \
@@ -190,6 +188,4 @@ public: \
 
 QT_END_NAMESPACE
 
-QT_END_HEADER
-
 #endif // QITERATOR_H
diff --git a/src/corelib/tools/qline.h b/src/corelib/tools/qline.h
index 989f430..69e8a82 100644
--- a/src/corelib/tools/qline.h
+++ b/src/corelib/tools/qline.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtCore module of the Qt Toolkit.
@@ -44,8 +44,6 @@
 
 #include <QtCore/qpoint.h>
 
-QT_BEGIN_HEADER
-
 QT_BEGIN_NAMESPACE
 
 
@@ -421,6 +419,4 @@ Q_CORE_EXPORT QDataStream &operator>>(QDataStream &, QLineF &);
 
 QT_END_NAMESPACE
 
-QT_END_HEADER
-
 #endif // QLINE_H
diff --git a/src/corelib/tools/qlinkedlist.h b/src/corelib/tools/qlinkedlist.h
index 06ee5ce..b9ca1b9 100644
--- a/src/corelib/tools/qlinkedlist.h
+++ b/src/corelib/tools/qlinkedlist.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtCore module of the Qt Toolkit.
@@ -48,8 +48,6 @@
 #include <iterator>
 #include <list>
 
-QT_BEGIN_HEADER
-
 QT_BEGIN_NAMESPACE
 
 
@@ -501,6 +499,4 @@ Q_DECLARE_MUTABLE_SEQUENTIAL_ITERATOR(LinkedList)
 
 QT_END_NAMESPACE
 
-QT_END_HEADER
-
 #endif // QLINKEDLIST_H
diff --git a/src/corelib/tools/qlist.h b/src/corelib/tools/qlist.h
index f5858bf..0592c24 100644
--- a/src/corelib/tools/qlist.h
+++ b/src/corelib/tools/qlist.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtCore module of the Qt Toolkit.
@@ -57,8 +57,6 @@
 #include <limits.h>
 #include <string.h>
 
-QT_BEGIN_HEADER
-
 QT_BEGIN_NAMESPACE
 
 
@@ -368,7 +366,7 @@ Q_INLINE_TEMPLATE void QList<T>::node_construct(Node *n, const T &t)
     else *reinterpret_cast<T*>(n) = t;
 #else
     // This is always safe, but penaltizes unoptimized builds a lot.
-    else ::memcpy(n, &t, sizeof(T));
+    else ::memcpy(n, static_cast<const void *>(&t), sizeof(T));
 #endif
 }
 
@@ -910,6 +908,4 @@ Q_DECLARE_MUTABLE_SEQUENTIAL_ITERATOR(List)
 
 QT_END_NAMESPACE
 
-QT_END_HEADER
-
 #endif // QLIST_H
diff --git a/src/corelib/tools/qlocale.h b/src/corelib/tools/qlocale.h
index 6b6beef..78fa336 100644
--- a/src/corelib/tools/qlocale.h
+++ b/src/corelib/tools/qlocale.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtCore module of the Qt Toolkit.
@@ -47,8 +47,6 @@
 #include <QtCore/qobjectdefs.h>
 #include <QtCore/qshareddata.h>
 
-QT_BEGIN_HEADER
-
 QT_BEGIN_NAMESPACE
 
 
@@ -67,7 +65,9 @@ class Q_CORE_EXPORT QLocale
     Q_GADGET
     Q_ENUMS(Language)
     Q_ENUMS(Country)
+    Q_ENUMS(MeasurementSystem)
     friend class QString;
+    friend class QStringRef;
     friend class QByteArray;
     friend class QIntValidator;
     friend class QDoubleValidatorPrivate;
@@ -206,7 +206,7 @@ public:
         Turkish = 125,
         Turkmen = 126,
         Tahitian = 127,
-        Uigur = 128,
+        Uighur = 128,
         Ukrainian = 129,
         Urdu = 130,
         Uzbek = 131,
@@ -339,6 +339,57 @@ public:
         Kako = 258,
         Meta = 259,
         Ngiemboon = 260,
+        Aragonese = 261,
+        Akkadian = 262,
+        AncientEgyptian = 263,
+        AncientGreek = 264,
+        Aramaic = 265,
+        Balinese = 266,
+        Bamun = 267,
+        BatakToba = 268,
+        Buginese = 269,
+        Buhid = 270,
+        Carian = 271,
+        Chakma = 272,
+        ClassicalMandaic = 273,
+        Coptic = 274,
+        Dogri = 275,
+        EasternCham = 276,
+        EasternKayah = 277,
+        Etruscan = 278,
+        Gothic = 279,
+        Hanunoo = 280,
+        Ingush = 281,
+        LargeFloweryMiao = 282,
+        Lepcha = 283,
+        Limbu = 284,
+        Lisu = 285,
+        Lu = 286,
+        Lycian = 287,
+        Lydian = 288,
+        Mandingo = 289,
+        Manipuri = 290,
+        Meroitic = 291,
+        NorthernThai = 292,
+        OldIrish = 293,
+        OldNorse = 294,
+        OldPersian = 295,
+        OldTurkish = 296,
+        Pahlavi = 297,
+        Parthian = 298,
+        Phoenician = 299,
+        PrakritLanguage = 300,
+        Rejang = 301,
+        Sabaean = 302,
+        Samaritan = 303,
+        Santali = 304,
+        Saurashtra = 305,
+        Sora = 306,
+        Sylheti = 307,
+        Tagbanwa = 308,
+        TaiDam = 309,
+        TaiNua = 310,
+        Ugaritic = 311,
         Norwegian = NorwegianBokmal,
         Moldavian = Romanian,
         SerboCroatian = Serbian,
@@ -352,7 +403,8 @@ public:
         RhaetoRomance = Romansh,
         Chewa = Nyanja,
         Frisian = WesternFrisian,
-        LastLanguage = Ngiemboon
+        Uigur = Uighur,
+        LastLanguage = Ugaritic
     };
 
     enum Script {
@@ -392,9 +444,78 @@ public:
         SyriacScript = 33,
         YiScript = 34,
         VaiScript = 35,
+        AvestanScript = 36,
+        BalineseScript = 37,
+        BamumScript = 38,
+        BatakScript = 39,
+        BopomofoScript = 40,
+        BrahmiScript = 41,
+        BugineseScript = 42,
+        BuhidScript = 43,
+        CanadianAboriginalScript = 44,
+        CarianScript = 45,
+        ChakmaScript = 46,
+        ChamScript = 47,
+        CopticScript = 48,
+        CypriotScript = 49,
+        EgyptianHieroglyphsScript = 50,
+        FraserScript = 51,
+        GlagoliticScript = 52,
+        GothicScript = 53,
+        HanScript = 54,
+        HangulScript = 55,
+        HanunooScript = 56,
+        ImperialAramaicScript = 57,
+        InscriptionalPahlaviScript = 58,
+        InscriptionalParthianScript = 59,
+        JavaneseScript = 60,
+        KaithiScript = 61,
+        KatakanaScript = 62,
+        KayahLiScript = 63,
+        KharoshthiScript = 64,
+        LannaScript = 65,
+        LepchaScript = 66,
+        LimbuScript = 67,
+        LinearBScript = 68,
+        LycianScript = 69,
+        LydianScript = 70,
+        MandaeanScript = 71,
+        MeiteiMayekScript = 72,
+        MeroiticScript = 73,
+        MeroiticCursiveScript = 74,
+        NkoScript = 75,
+        NewTaiLueScript = 76,
+        OghamScript = 77,
+        OlChikiScript = 78,
+        OldItalicScript = 79,
+        OldPersianScript = 80,
+        OldSouthArabianScript = 81,
+        OrkhonScript = 82,
+        OsmanyaScript = 83,
+        PhagsPaScript = 84,
+        PhoenicianScript = 85,
+        PollardPhoneticScript = 86,
+        RejangScript = 87,
+        RunicScript = 88,
+        SamaritanScript = 89,
+        SaurashtraScript = 90,
+        SharadaScript = 91,
+        ShavianScript = 92,
+        SoraSompengScript = 93,
+        CuneiformScript = 94,
+        SundaneseScript = 95,
+        SylotiNagriScript = 96,
+        TagalogScript = 97,
+        TagbanwaScript = 98,
+        TaiLeScript = 99,
+        TaiVietScript = 100,
+        TakriScript = 101,
+        UgariticScript = 102,
+        BrailleScript = 103,
+        HiraganaScript = 104,
         SimplifiedChineseScript = SimplifiedHanScript,
         TraditionalChineseScript = TraditionalHanScript,
-        LastScript = VaiScript
+        LastScript = HiraganaScript
     };
     enum Country {
         AnyCountry = 0,
@@ -711,6 +832,15 @@ public:
     float toFloat(const QString &s, bool *ok = 0) const;
     double toDouble(const QString &s, bool *ok = 0) const;
 
+    short toShort(const QStringRef &s, bool *ok = 0) const;
+    ushort toUShort(const QStringRef &s, bool *ok = 0) const;
+    int toInt(const QStringRef &s, bool *ok = 0) const;
+    uint toUInt(const QStringRef &s, bool *ok = 0) const;
+    qlonglong toLongLong(const QStringRef &s, bool *ok = 0) const;
+    qulonglong toULongLong(const QStringRef &s, bool *ok = 0) const;
+    float toFloat(const QStringRef &s, bool *ok = 0) const;
+    double toDouble(const QStringRef &s, bool *ok = 0) const;
+
     QString toString(qlonglong i) const;
     QString toString(qulonglong i) const;
     inline QString toString(short i) const;
@@ -842,6 +972,4 @@ Q_CORE_EXPORT QDebug operator<<(QDebug, const QLocale &);
 
 QT_END_NAMESPACE
 
-QT_END_HEADER
-
 #endif // QLOCALE_H
diff --git a/src/corelib/tools/qmap.h b/src/corelib/tools/qmap.h
index d44a794..449fcbc 100644
--- a/src/corelib/tools/qmap.h
+++ b/src/corelib/tools/qmap.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtCore module of the Qt Toolkit.
@@ -54,7 +54,9 @@
 #include <map>
 #include <new>
 
-QT_BEGIN_HEADER
+#ifdef Q_COMPILER_INITIALIZER_LISTS
+#include <initializer_list>
+#endif
 
 QT_BEGIN_NAMESPACE
 
@@ -327,6 +329,14 @@ class QMap
 
 public:
     inline QMap() : d(static_cast<QMapData<Key, T> *>(const_cast<QMapDataBase *>(&QMapDataBase::shared_null))) { }
+#ifdef Q_COMPILER_INITIALIZER_LISTS
+    inline QMap(std::initializer_list<std::pair<Key,T> > list)
+        : d(static_cast<QMapData<Key, T> *>(const_cast<QMapDataBase *>(&QMapDataBase::shared_null)))
+    {
+        for (typename std::initializer_list<std::pair<Key,T> >::const_iterator it = list.begin(); it != list.end(); ++it)
+            insert(it->first, it->second);
+    }
+#endif
     QMap(const QMap<Key, T> &other);
 
     inline ~QMap() { if (!d->ref.deref()) d->destroy(); }
@@ -528,7 +538,9 @@ public:
     iterator upperBound(const Key &key);
     const_iterator upperBound(const Key &key) const;
     iterator insert(const Key &key, const T &value);
+    iterator insert(const_iterator pos, const Key &key, const T &value);
     iterator insertMulti(const Key &key, const T &value);
+    iterator insertMulti(const_iterator pos, const Key &akey, const T &avalue);
     QMap<Key, T> &unite(const QMap<Key, T> &other);
 
     // STL compatibility
@@ -653,6 +665,72 @@ Q_INLINE_TEMPLATE typename QMap<Key, T>::iterator QMap<Key, T>::insert(const Key
 }
 
 template <class Key, class T>
+typename QMap<Key, T>::iterator QMap<Key, T>::insert(const_iterator pos, const Key &akey, const T &avalue)
+{
+    if (d->ref.isShared())
+        return this->insert(akey, avalue);
+
+    if (pos == constEnd()) {
+        // Hint is that the Node is larger than (or equal to) the largest value.
+        Node *n = static_cast<Node *>(pos.i->left);
+        if (n) {
+            while (n->right)
+                n = static_cast<Node *>(n->right);
+
+            if (!qMapLessThanKey(n->key, akey))
+                return this->insert(akey, avalue); // ignore hint
+            // This can be optimized by checking equal too.
+            // we can overwrite if previous node key is strictly smaller
+            // (or there is no previous node)
+
+            Node *z = d->createNode(akey, avalue, n, false); // insert right most
+            return iterator(z);
+        }
+        return this->insert(akey, avalue);
+    } else {
+        // Hint indicates that the node should be less (or equal to) the hint given
+        // but larger than the previous value.
+        Node *next = const_cast<Node*>(pos.i);
+        if (qMapLessThanKey(next->key, akey))
+            return this->insert(akey, avalue); // ignore hint
+
+        if (pos == constBegin()) {
+            // There is no previous value
+            // Maybe overwrite left most value
+            if (!qMapLessThanKey(akey, next->key)) {
+                next->value = avalue; // overwrite current iterator
+                return iterator(next);
+            }
+            // insert left most.
+            Node *z = d->createNode(akey, avalue, begin().i, true);
+            return iterator(z);
+        } else {
+            Node *prev = const_cast<Node*>(pos.i->previousNode());
+            if (!qMapLessThanKey(prev->key, akey)) {
+                return this->insert(akey, avalue); // ignore hint
+            }
+            // Hint is ok
+            if (!qMapLessThanKey(akey, next->key)) {
+                next->value = avalue; // overwrite current iterator
+                return iterator(next);
+            }
+
+            // we need to insert (not overwrite)
+            if (prev->right == 0) {
+                Node *z = d->createNode(akey, avalue, prev, false);
+                return iterator(z);
+            }
+            if (next->left == 0) {
+                Node *z = d->createNode(akey, avalue, next, true);
+                return iterator(z);
+            }
+            Q_ASSERT(false); // We should have prev->right == 0 or next->left == 0.
+            return this->insert(akey, avalue);
+        }
+    }
+}
+
+template <class Key, class T>
 Q_INLINE_TEMPLATE typename QMap<Key, T>::iterator QMap<Key, T>::insertMulti(const Key &akey,
                                                                             const T &avalue)
 {
@@ -670,6 +748,57 @@ Q_INLINE_TEMPLATE typename QMap<Key, T>::iterator QMap<Key, T>::insertMulti(cons
 }
 
 template <class Key, class T>
+typename QMap<Key, T>::iterator QMap<Key, T>::insertMulti(const_iterator pos, const Key &akey, const T &avalue)
+{
+    if (d->ref.isShared())
+        return this->insertMulti(akey, avalue);
+
+    if (pos == constEnd()) {
+        // Hint is that the Node is larger than (or equal to) the largest value.
+        Node *n = static_cast<Node *>(pos.i->left);
+        if (n) {
+            while (n->right)
+                n = static_cast<Node *>(n->right);
+
+            if (!qMapLessThanKey(n->key, akey))
+                return this->insertMulti(akey, avalue); // ignore hint
+            Node *z = d->createNode(akey, avalue, n, false); // insert right most
+            return iterator(z);
+        }
+        return this->insertMulti(akey, avalue);
+    } else {
+        // Hint indicates that the node should be less (or equal to) the hint given
+        // but larger than the previous value.
+        Node *next = const_cast<Node*>(pos.i);
+        if (qMapLessThanKey(next->key, akey))
+            return this->insertMulti(akey, avalue); // ignore hint
+
+        if (pos == constBegin()) {
+            // There is no previous value (insert left most)
+            Node *z = d->createNode(akey, avalue, begin().i, true);
+            return iterator(z);
+        } else {
+            Node *prev = const_cast<Node*>(pos.i->previousNode());
+            if (!qMapLessThanKey(prev->key, akey))
+                return this->insertMulti(akey, avalue); // ignore hint
+
+            // Hint is ok - do insert
+            if (prev->right == 0) {
+                Node *z = d->createNode(akey, avalue, prev, false);
+                return iterator(z);
+            }
+            if (next->left == 0) {
+                Node *z = d->createNode(akey, avalue, next, true);
+                return iterator(z);
+            }
+            Q_ASSERT(false); // We should have prev->right == 0 or next->left == 0.
+            return this->insertMulti(akey, avalue);
+        }
+    }
+}
+
+
+template <class Key, class T>
 Q_INLINE_TEMPLATE typename QMap<Key, T>::const_iterator QMap<Key, T>::constFind(const Key &akey) const
 {
     Node *n = d->findNode(akey);
@@ -960,6 +1089,13 @@ class QMultiMap : public QMap<Key, T>
 {
 public:
     QMultiMap() {}
+#ifdef Q_COMPILER_INITIALIZER_LISTS
+    inline QMultiMap(std::initializer_list<std::pair<Key,T> > list)
+    {
+        for (typename std::initializer_list<std::pair<Key,T> >::const_iterator it = list.begin(); it != list.end(); ++it)
+            insert(it->first, it->second);
+    }
+#endif
     QMultiMap(const QMap<Key, T> &other) : QMap<Key, T>(other) {}
     inline void swap(QMultiMap<Key, T> &other) { QMap<Key, T>::swap(other); }
 
@@ -967,6 +1103,8 @@ public:
     { return QMap<Key, T>::insert(key, value); }
     inline typename QMap<Key, T>::iterator insert(const Key &key, const T &value)
     { return QMap<Key, T>::insertMulti(key, value); }
+    inline typename QMap<Key, T>::iterator insert(typename QMap<Key, T>::const_iterator pos, const Key &key, const T &value)
+    { return QMap<Key, T>::insertMulti(pos, key, value); }
 
     inline QMultiMap &operator+=(const QMultiMap &other)
     { this->unite(other); return *this; }
@@ -1072,6 +1210,4 @@ Q_DECLARE_MUTABLE_ASSOCIATIVE_ITERATOR(Map)
 
 QT_END_NAMESPACE
 
-QT_END_HEADER
-
 #endif // QMAP_H
diff --git a/src/corelib/tools/qmargins.h b/src/corelib/tools/qmargins.h
index 8ceccd4..0d68be9 100644
--- a/src/corelib/tools/qmargins.h
+++ b/src/corelib/tools/qmargins.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtCore module of the Qt Toolkit.
@@ -42,9 +42,7 @@
 #ifndef QMARGINS_H
 #define QMARGINS_H
 
-#include <QtCore/qnamespace.h>
-
-QT_BEGIN_HEADER
+#include <QtCore/qrect.h>
 
 QT_BEGIN_NAMESPACE
 
@@ -67,6 +65,15 @@ public:
     void setRight(int right);
     void setBottom(int bottom);
 
+    QMargins &operator+=(const QMargins &margins);
+    QMargins &operator-=(const QMargins &margins);
+    QMargins &operator+=(int);
+    QMargins &operator-=(int);
+    QMargins &operator*=(int);
+    QMargins &operator/=(int);
+    QMargins &operator*=(qreal);
+    QMargins &operator/=(qreal);
+
 private:
     int m_left;
     int m_top;
@@ -142,12 +149,128 @@ Q_DECL_CONSTEXPR inline bool operator!=(const QMargins &m1, const QMargins &m2)
             m1.m_bottom != m2.m_bottom;
 }
 
+Q_DECL_CONSTEXPR inline QRect operator+(const QRect &rectangle, const QMargins &margins)
+{
+    return QRect(QPoint(rectangle.left() - margins.left(), rectangle.top() - margins.top()),
+                 QPoint(rectangle.right() + margins.right(), rectangle.bottom() + margins.bottom()));
+}
+
+Q_DECL_CONSTEXPR inline QRect operator+(const QMargins &margins, const QRect &rectangle)
+{
+    return QRect(QPoint(rectangle.left() - margins.left(), rectangle.top() - margins.top()),
+                 QPoint(rectangle.right() + margins.right(), rectangle.bottom() + margins.bottom()));
+}
+
+inline QRect QRect::marginsAdded(const QMargins &margins) const
+{
+    return *this + margins;
+}
+
+inline QRect QRect::marginsRemoved(const QMargins &margins) const
+{
+    return QRect(QPoint(x1 + margins.left(), y1 + margins.top()),
+                 QPoint(x2 - margins.right(), y2 - margins.bottom()));
+}
+
+inline QRect &QRect::operator+=(const QMargins &margins)
+{
+    *this = marginsAdded(margins);
+    return *this;
+}
+
+inline QRect &QRect::operator-=(const QMargins &margins)
+{
+    *this = marginsRemoved(margins);
+    return *this;
+}
+
+Q_DECL_CONSTEXPR inline QMargins operator+(const QMargins &m1, const QMargins &m2)
+{
+    return QMargins(m1.left() + m2.left(), m1.top() + m2.top(),
+                    m1.right() + m2.right(), m1.bottom() + m2.bottom());
+}
+
+Q_DECL_CONSTEXPR inline QMargins operator-(const QMargins &m1, const QMargins &m2)
+{
+    return QMargins(m1.left() - m2.left(), m1.top() - m2.top(),
+                    m1.right() - m2.right(), m1.bottom() - m2.bottom());
+}
+
+Q_DECL_CONSTEXPR inline QMargins operator*(const QMargins &margins, int factor)
+{
+    return QMargins(margins.left() * factor, margins.top() * factor,
+                    margins.right() * factor, margins.bottom() * factor);
+}
+
+Q_DECL_CONSTEXPR inline QMargins operator*(int factor, const QMargins &margins)
+{
+    return QMargins(margins.left() * factor, margins.top() * factor,
+                    margins.right() * factor, margins.bottom() * factor);
+}
+
+Q_DECL_CONSTEXPR inline QMargins operator*(const QMargins &margins, qreal factor)
+{
+    return QMargins(qRound(margins.left() * factor), qRound(margins.top() * factor),
+                    qRound(margins.right() * factor), qRound(margins.bottom() * factor));
+}
+
+Q_DECL_CONSTEXPR inline QMargins operator*(qreal factor, const QMargins &margins)
+{
+    return QMargins(qRound(margins.left() * factor), qRound(margins.top() * factor),
+                    qRound(margins.right() * factor), qRound(margins.bottom() * factor));
+}
+
+Q_DECL_CONSTEXPR inline QMargins operator/(const QMargins &margins, int divisor)
+{
+    return QMargins(margins.left() / divisor, margins.top() / divisor,
+                    margins.right() / divisor, margins.bottom() / divisor);
+}
+
+Q_DECL_CONSTEXPR inline QMargins operator/(const QMargins &margins, qreal divisor)
+{
+    return QMargins(qRound(margins.left() / divisor), qRound(margins.top() / divisor),
+                    qRound(margins.right() / divisor), qRound(margins.bottom() / divisor));
+}
+
+inline QMargins &QMargins::operator+=(const QMargins &margins)
+{
+    return *this = *this + margins;
+}
+
+inline QMargins &QMargins::operator-=(const QMargins &margins)
+{
+    return *this = *this - margins;
+}
+
+inline QMargins &QMargins::operator*=(int factor)
+{
+    return *this = *this * factor;
+}
+
+inline QMargins &QMargins::operator/=(int divisor)
+{
+    return *this = *this / divisor;
+}
+
+inline QMargins &QMargins::operator*=(qreal factor)
+{
+    return *this = *this * factor;
+}
+
+inline QMargins &QMargins::operator/=(qreal divisor)
+{
+    return *this = *this / divisor;
+}
+
+Q_DECL_CONSTEXPR inline QMargins operator-(const QMargins &margins)
+{
+    return QMargins(-margins.left(), -margins.top(), -margins.right(), -margins.bottom());
+}
+
 #ifndef QT_NO_DEBUG_STREAM
 Q_CORE_EXPORT QDebug operator<<(QDebug, const QMargins &);
 #endif
 
 QT_END_NAMESPACE
 
-QT_END_HEADER
-
 #endif // QMARGINS_H
diff --git a/src/corelib/tools/qpair.h b/src/corelib/tools/qpair.h
index 224a2dc..96b1b65 100644
--- a/src/corelib/tools/qpair.h
+++ b/src/corelib/tools/qpair.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtCore module of the Qt Toolkit.
@@ -44,8 +44,6 @@
 
 #include <QtCore/qglobal.h>
 
-QT_BEGIN_HEADER
-
 QT_BEGIN_NAMESPACE
 
 
@@ -108,6 +106,4 @@ Q_OUTOFLINE_TEMPLATE QPair<T1, T2> qMakePair(const T1 &x, const T2 &y)
 
 QT_END_NAMESPACE
 
-QT_END_HEADER
-
 #endif // QPAIR_H
diff --git a/src/corelib/tools/qpoint.h b/src/corelib/tools/qpoint.h
index 16689fe..69403eb 100644
--- a/src/corelib/tools/qpoint.h
+++ b/src/corelib/tools/qpoint.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtCore module of the Qt Toolkit.
@@ -44,8 +44,6 @@
 
 #include <QtCore/qnamespace.h>
 
-QT_BEGIN_HEADER
-
 QT_BEGIN_NAMESPACE
 
 
@@ -76,6 +74,9 @@ public:
 
     inline QPoint &operator/=(qreal divisor);
 
+    Q_DECL_CONSTEXPR static inline int dotProduct(const QPoint &p1, const QPoint &p2)
+    { return p1.xp * p2.xp + p1.yp * p2.yp; }
+
     friend Q_DECL_CONSTEXPR inline bool operator==(const QPoint &, const QPoint &);
     friend Q_DECL_CONSTEXPR inline bool operator!=(const QPoint &, const QPoint &);
     friend Q_DECL_CONSTEXPR inline const QPoint operator+(const QPoint &, const QPoint &);
@@ -233,6 +234,9 @@ public:
     inline QPointF &operator*=(qreal c);
     inline QPointF &operator/=(qreal c);
 
+    Q_DECL_CONSTEXPR static inline qreal dotProduct(const QPointF &p1, const QPointF &p2)
+    { return p1.xp * p2.xp + p1.yp * p2.yp; }
+
     friend Q_DECL_CONSTEXPR inline bool operator==(const QPointF &, const QPointF &);
     friend Q_DECL_CONSTEXPR inline bool operator!=(const QPointF &, const QPointF &);
     friend Q_DECL_CONSTEXPR inline const QPointF operator+(const QPointF &, const QPointF &);
@@ -393,6 +397,4 @@ Q_CORE_EXPORT QDebug operator<<(QDebug d, const QPointF &p);
 
 QT_END_NAMESPACE
 
-QT_END_HEADER
-
 #endif // QPOINT_H
diff --git a/src/corelib/tools/qqueue.h b/src/corelib/tools/qqueue.h
index 5139525..b830214 100644
--- a/src/corelib/tools/qqueue.h
+++ b/src/corelib/tools/qqueue.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtCore module of the Qt Toolkit.
@@ -44,8 +44,6 @@
 
 #include <QtCore/qlist.h>
 
-QT_BEGIN_HEADER
-
 QT_BEGIN_NAMESPACE
 
 
@@ -64,6 +62,4 @@ public:
 
 QT_END_NAMESPACE
 
-QT_END_HEADER
-
 #endif // QQUEUE_H
diff --git a/src/corelib/tools/qrect.h b/src/corelib/tools/qrect.h
index 6e1a819..62ebdd1 100644
--- a/src/corelib/tools/qrect.h
+++ b/src/corelib/tools/qrect.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtCore module of the Qt Toolkit.
@@ -49,10 +49,9 @@
 #error qrect.h must be included before any header file that defines topLeft
 #endif
 
-QT_BEGIN_HEADER
-
 QT_BEGIN_NAMESPACE
 
+class QMargins;
 
 class Q_CORE_EXPORT QRect
 {
@@ -139,6 +138,11 @@ public:
     inline QRect intersected(const QRect &other) const;
     bool intersects(const QRect &r) const;
 
+    inline QRect marginsAdded(const QMargins &margins) const;
+    inline QRect marginsRemoved(const QMargins &margins) const;
+    inline QRect &operator+=(const QMargins &margins);
+    inline QRect &operator-=(const QMargins &margins);
+
 #if QT_DEPRECATED_SINCE(5, 0)
     QT_DEPRECATED QRect unite(const QRect &r) const { return united(r); }
     QT_DEPRECATED QRect intersect(const QRect &r) const { return intersected(r); }
@@ -786,6 +790,4 @@ Q_CORE_EXPORT QDebug operator<<(QDebug, const QRectF &);
 
 QT_END_NAMESPACE
 
-QT_END_HEADER
-
 #endif // QRECT_H
diff --git a/src/corelib/tools/qrefcount.h b/src/corelib/tools/qrefcount.h
index d45bcba..84314b1 100644
--- a/src/corelib/tools/qrefcount.h
+++ b/src/corelib/tools/qrefcount.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtCore module of the Qt Toolkit.
@@ -44,8 +44,6 @@
 
 #include <QtCore/qatomic.h>
 
-QT_BEGIN_HEADER
-
 QT_BEGIN_NAMESPACE
 
 
@@ -112,6 +110,4 @@ public:
 
 QT_END_NAMESPACE
 
-QT_END_HEADER
-
 #endif
diff --git a/src/corelib/tools/qregexp.h b/src/corelib/tools/qregexp.h
index 870e377..26b0b78 100644
--- a/src/corelib/tools/qregexp.h
+++ b/src/corelib/tools/qregexp.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtCore module of the Qt Toolkit.
@@ -42,12 +42,12 @@
 #ifndef QREGEXP_H
 #define QREGEXP_H
 
+#include <QtCore/qglobal.h>
+
 #ifndef QT_NO_REGEXP
 
 #include <QtCore/qstring.h>
 
-QT_BEGIN_HEADER
-
 QT_BEGIN_NAMESPACE
 
 
@@ -129,8 +129,6 @@ Q_CORE_EXPORT QDebug operator<<(QDebug, const QRegExp &);
 
 QT_END_NAMESPACE
 
-QT_END_HEADER
-
 #endif // QT_NO_REGEXP
 
 #endif // QREGEXP_H
diff --git a/src/corelib/tools/qregularexpression.h b/src/corelib/tools/qregularexpression.h
index 4c95a5b..5059ea6 100644
--- a/src/corelib/tools/qregularexpression.h
+++ b/src/corelib/tools/qregularexpression.h
@@ -1,6 +1,7 @@
 /****************************************************************************
 **
 ** Copyright (C) 2012 Giuseppe D'Angelo <dangelog at gmail.com>.
+** Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info at kdab.com, author Giuseppe D'Angelo <giuseppe.dangelo at kdab.com>
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtCore module of the Qt Toolkit.
@@ -42,14 +43,15 @@
 #ifndef QREGULAREXPRESSION_H
 #define QREGULAREXPRESSION_H
 
-#ifndef QT_NO_REGEXP
+#include <QtCore/qglobal.h>
+
+#ifndef QT_NO_REGULAREXPRESSION
 
 #include <QtCore/qstring.h>
+#include <QtCore/qstringlist.h>
 #include <QtCore/qshareddata.h>
 #include <QtCore/qvariant.h>
 
-QT_BEGIN_HEADER
-
 QT_BEGIN_NAMESPACE
 
 class QRegularExpressionMatch;
@@ -95,11 +97,13 @@ public:
     QString errorString() const;
 
     int captureCount() const;
+    QStringList namedCaptureGroups() const;
 
     enum MatchType {
         NormalMatch = 0,
         PartialPreferCompleteMatch,
-        PartialPreferFirstMatch
+        PartialPreferFirstMatch,
+        NoMatch
     };
 
     enum MatchOption {
@@ -152,6 +156,7 @@ struct QRegularExpressionMatchPrivate;
 class Q_CORE_EXPORT QRegularExpressionMatch
 {
 public:
+    QRegularExpressionMatch();
     ~QRegularExpressionMatch();
     QRegularExpressionMatch(const QRegularExpressionMatch &match);
     QRegularExpressionMatch &operator=(const QRegularExpressionMatch &match);
@@ -209,6 +214,7 @@ struct QRegularExpressionMatchIteratorPrivate;
 class Q_CORE_EXPORT QRegularExpressionMatchIterator
 {
 public:
+    QRegularExpressionMatchIterator();
     ~QRegularExpressionMatchIterator();
     QRegularExpressionMatchIterator(const QRegularExpressionMatchIterator &iterator);
     QRegularExpressionMatchIterator &operator=(const QRegularExpressionMatchIterator &iterator);
@@ -239,8 +245,6 @@ Q_DECLARE_SHARED(QRegularExpressionMatchIterator)
 
 QT_END_NAMESPACE
 
-QT_END_HEADER
-
-#endif // QT_NO_REGEXP
+#endif // QT_NO_REGULAREXPRESSION
 
 #endif // QREGULAREXPRESSION_H
diff --git a/src/corelib/tools/qscopedpointer.h b/src/corelib/tools/qscopedpointer.h
index fbe2aa8..2155c56 100644
--- a/src/corelib/tools/qscopedpointer.h
+++ b/src/corelib/tools/qscopedpointer.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtCore module of the Qt Toolkit.
@@ -46,7 +46,6 @@
 
 #include <stdlib.h>
 
-QT_BEGIN_HEADER
 QT_BEGIN_NAMESPACE
 
 template <typename T>
@@ -97,7 +96,6 @@ public:
     {
         T *oldD = this->d;
         Cleanup::cleanup(oldD);
-        this->d = 0;
     }
 
     inline T &operator*() const
@@ -239,6 +237,5 @@ private:
 };
 
 QT_END_NAMESPACE
-QT_END_HEADER
 
 #endif // QSCOPEDPOINTER_H
diff --git a/src/corelib/tools/qscopedvaluerollback.h b/src/corelib/tools/qscopedvaluerollback.h
index 755100d..dfaf198 100644
--- a/src/corelib/tools/qscopedvaluerollback.h
+++ b/src/corelib/tools/qscopedvaluerollback.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtCore module of the Qt Toolkit.
@@ -44,7 +44,6 @@
 
 #include <QtCore/qglobal.h>
 
-QT_BEGIN_HEADER
 QT_BEGIN_NAMESPACE
 
 template <typename T>
@@ -75,6 +74,5 @@ private:
 };
 
 QT_END_NAMESPACE
-QT_END_HEADER
 
 #endif // QSCOPEDVALUEROLLBACK_H
diff --git a/src/corelib/tools/qset.h b/src/corelib/tools/qset.h
index 7541d80..d5c3637 100644
--- a/src/corelib/tools/qset.h
+++ b/src/corelib/tools/qset.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtCore module of the Qt Toolkit.
@@ -43,8 +43,9 @@
 #define QSET_H
 
 #include <QtCore/qhash.h>
-
-QT_BEGIN_HEADER
+#ifdef Q_COMPILER_INITIALIZER_LISTS
+#include <initializer_list>
+#endif
 
 QT_BEGIN_NAMESPACE
 
@@ -56,6 +57,14 @@ class QSet
 
 public:
     inline QSet() {}
+#ifdef Q_COMPILER_INITIALIZER_LISTS
+    inline QSet(std::initializer_list<T> list)
+    {
+        reserve(list.size());
+        for (typename std::initializer_list<T>::const_iterator it = list.begin(); it != list.end(); ++it)
+            insert(*it);
+    }
+#endif
     inline QSet(const QSet<T> &other) : q_hash(other.q_hash) {}
 
     inline QSet<T> &operator=(const QSet<T> &other)
@@ -355,6 +364,4 @@ public:
 
 QT_END_NAMESPACE
 
-QT_END_HEADER
-
 #endif // QSET_H
diff --git a/src/corelib/tools/qshareddata.h b/src/corelib/tools/qshareddata.h
index bec5132..00bf4cb 100644
--- a/src/corelib/tools/qshareddata.h
+++ b/src/corelib/tools/qshareddata.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtCore module of the Qt Toolkit.
@@ -45,8 +45,6 @@
 #include <QtCore/qglobal.h>
 #include <QtCore/qatomic.h>
 
-QT_BEGIN_HEADER
-
 QT_BEGIN_NAMESPACE
 
 
@@ -281,6 +279,4 @@ template<typename T> Q_DECLARE_TYPEINFO_BODY(QExplicitlySharedDataPointer<T>, Q_
 
 QT_END_NAMESPACE
 
-QT_END_HEADER
-
 #endif // QSHAREDDATA_H
diff --git a/src/corelib/tools/qsharedpointer.h b/src/corelib/tools/qsharedpointer.h
index cfc5cad..7d1f008 100644
--- a/src/corelib/tools/qsharedpointer.h
+++ b/src/corelib/tools/qsharedpointer.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtCore module of the Qt Toolkit.
@@ -50,8 +50,6 @@
 # include <QtCore/qsharedpointer_impl.h>
 #else
 
-QT_BEGIN_HEADER
-
 QT_BEGIN_NAMESPACE
 
 
@@ -95,6 +93,9 @@ public:
     template <class X> QSharedPointer<X> dynamicCast() const;
     template <class X> QSharedPointer<X> constCast() const;
     template <class X> QSharedPointer<X> objectCast() const;
+
+    static inline QSharedPointer<T> create();
+    static inline QSharedPointer<T> create(...);
 };
 
 template <class T>
@@ -149,8 +150,6 @@ template <class X, class T> QWeakPointer<X> qWeakPointerCast(const QWeakPointer<
 
 QT_END_NAMESPACE
 
-QT_END_HEADER
-
 #endif // Q_QDOC
 
 #endif // QSHAREDPOINTER_H
diff --git a/src/corelib/tools/qsharedpointer_impl.h b/src/corelib/tools/qsharedpointer_impl.h
index 6f3e577..5e30cf3 100644
--- a/src/corelib/tools/qsharedpointer_impl.h
+++ b/src/corelib/tools/qsharedpointer_impl.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtCore module of the Qt Toolkit.
@@ -46,14 +46,17 @@
 #endif
 
 #if 0
+#pragma qt_sync_skip_header_check
+#pragma qt_sync_stop_processing
+#endif
+
+#if 0
 // These macros are duplicated here to make syncqt not complain a about
 // this header, as we have a "qt_sync_stop_processing" below, which in turn
 // is here because this file contains a template mess and duplicates the
 // classes found in qsharedpointer.h
-QT_BEGIN_HEADER
 QT_BEGIN_NAMESPACE
 QT_END_NAMESPACE
-QT_END_HEADER
 #pragma qt_sync_stop_processing
 #endif
 
@@ -62,7 +65,9 @@ QT_END_HEADER
 #include <QtCore/qobject.h>    // for qobject_cast
 #include <QtCore/qhash.h>    // for qHash
 
-QT_BEGIN_HEADER
+#if defined(Q_COMPILER_RVALUE_REFS) && defined(Q_COMPILER_VARIADIC_TEMPLATES)
+#  include <utility>           // for std::forward
+#endif
 
 QT_BEGIN_NAMESPACE
 
@@ -389,6 +394,28 @@ public:
 
     QWeakPointer<T> toWeakRef() const;
 
+#if defined(Q_COMPILER_RVALUE_REFS) && defined(Q_COMPILER_VARIADIC_TEMPLATES)
+    template <typename... Args>
+    static QSharedPointer<T> create(Args && ...arguments)
+    {
+        typedef QtSharedPointer::ExternalRefCountWithContiguousData<T> Private;
+# ifdef QT_SHAREDPOINTER_TRACK_POINTERS
+        typename Private::DestroyerFn destroy = &Private::safetyCheckDeleter;
+# else
+        typename Private::DestroyerFn destroy = &Private::deleter;
+# endif
+        QSharedPointer<T> result(Qt::Uninitialized);
+        result.d = Private::create(&result.value, destroy);
+
+        // now initialize the data
+        new (result.data()) T(std::forward<Args>(arguments)...);
+        result.d->setQObjectShared(result.value, true);
+# ifdef QT_SHAREDPOINTER_TRACK_POINTERS
+        internalSafetyCheckAdd(result.d, result.value);
+# endif
+        return result;
+    }
+#else
     static inline QSharedPointer<T> create()
     {
         typedef QtSharedPointer::ExternalRefCountWithContiguousData<T> Private;
@@ -408,6 +435,7 @@ public:
         result.d->setQObjectShared(result.value, true);
         return result;
     }
+#endif
 
 private:
     explicit QSharedPointer(Qt::Initialization) {}
@@ -616,7 +644,7 @@ private:
 public:
 #else
     template <class X> friend class QSharedPointer;
-    friend class QPointerBase;
+    template <class X> friend class QPointer;
 #endif
 
     template <class X>
@@ -786,6 +814,8 @@ template <class X, class T>
 Q_INLINE_TEMPLATE QSharedPointer<X> qSharedPointerDynamicCast(const QSharedPointer<T> &src)
 {
     register X *ptr = dynamic_cast<X *>(src.data()); // if you get an error in this line, the cast is invalid
+    if (!ptr)
+        return QSharedPointer<X>();
     return QtSharedPointer::copyAndSetPointer(ptr, src);
 }
 template <class X, class T>
@@ -860,6 +890,4 @@ template<typename T> Q_DECLARE_TYPEINFO_BODY(QSharedPointer<T>, Q_MOVABLE_TYPE);
 
 QT_END_NAMESPACE
 
-QT_END_HEADER
-
 #endif
diff --git a/src/corelib/tools/qsize.h b/src/corelib/tools/qsize.h
index cde49a6..76f2ae0 100644
--- a/src/corelib/tools/qsize.h
+++ b/src/corelib/tools/qsize.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtCore module of the Qt Toolkit.
@@ -44,8 +44,6 @@
 
 #include <QtCore/qnamespace.h>
 
-QT_BEGIN_HEADER
-
 QT_BEGIN_NAMESPACE
 
 
@@ -379,6 +377,4 @@ Q_CORE_EXPORT QDebug operator<<(QDebug, const QSizeF &);
 
 QT_END_NAMESPACE
 
-QT_END_HEADER
-
 #endif // QSIZE_H
diff --git a/src/corelib/tools/qstack.h b/src/corelib/tools/qstack.h
index ea3d9e4..135c4dd 100644
--- a/src/corelib/tools/qstack.h
+++ b/src/corelib/tools/qstack.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtCore module of the Qt Toolkit.
@@ -44,8 +44,6 @@
 
 #include <QtCore/qvector.h>
 
-QT_BEGIN_HEADER
-
 QT_BEGIN_NAMESPACE
 
 
@@ -77,6 +75,4 @@ inline const T &QStack<T>::top() const
 
 QT_END_NAMESPACE
 
-QT_END_HEADER
-
 #endif // QSTACK_H
diff --git a/src/corelib/tools/qstring.h b/src/corelib/tools/qstring.h
index 47cca0d..d8aaa92 100644
--- a/src/corelib/tools/qstring.h
+++ b/src/corelib/tools/qstring.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtCore module of the Qt Toolkit.
@@ -49,7 +49,7 @@
 
 #include <string>
 
-#if defined(Q_OS_LINUX_ANDROID)
+#if defined(Q_OS_ANDROID)
 // std::wstring is disabled on android's glibc, as bionic lacks certain features
 // that libstdc++ checks for (like mbcslen).
 namespace std
@@ -64,14 +64,13 @@ namespace std
 #error qstring.h must be included before any header file that defines truncate
 #endif
 
-QT_BEGIN_HEADER
-
 QT_BEGIN_NAMESPACE
 
 
 class QCharRef;
 class QRegExp;
 class QRegularExpression;
+class QRegularExpressionMatch;
 class QString;
 class QStringList;
 class QTextCodec;
@@ -299,12 +298,20 @@ public:
 
     QString    &vsprintf(const char *format, va_list ap)
 #if defined(Q_CC_GNU) && !defined(__INSURE__)
+#  if defined(Q_CC_MINGW) && !defined(Q_CC_CLANG)
+        __attribute__ ((format (gnu_printf, 2, 0)))
+#  else
         __attribute__ ((format (printf, 2, 0)))
+#  endif
 #endif
         ;
     QString    &sprintf(const char *format, ...)
 #if defined(Q_CC_GNU) && !defined(__INSURE__)
+#  if defined(Q_CC_MINGW) && !defined(Q_CC_CLANG)
+        __attribute__ ((format (gnu_printf, 2, 3)))
+#  else
         __attribute__ ((format (printf, 2, 3)))
+#  endif
 #endif
         ;
 
@@ -335,10 +342,11 @@ public:
     inline bool contains(QRegExp &rx) const { return indexOf(rx) != -1; }
 #endif
 
-#ifndef QT_NO_REGEXP
+#ifndef QT_NO_REGULAREXPRESSION
     int indexOf(const QRegularExpression &re, int from = 0) const;
     int lastIndexOf(const QRegularExpression &re, int from = -1) const;
     bool contains(const QRegularExpression &re) const;
+    bool contains(const QRegularExpression &re, QRegularExpressionMatch *match) const; // ### Qt 6: merge overloads
     int count(const QRegularExpression &re) const;
 #endif
 
@@ -356,7 +364,7 @@ public:
 #ifndef QT_NO_REGEXP
     QString section(const QRegExp &reg, int start, int end = -1, SectionFlags flags = SectionDefault) const;
 #endif
-#ifndef QT_NO_REGEXP
+#ifndef QT_NO_REGULAREXPRESSION
     QString section(const QRegularExpression &re, int start, int end = -1, SectionFlags flags = SectionDefault) const;
 #endif
     QString left(int n) const Q_REQUIRED_RESULT;
@@ -432,7 +440,7 @@ public:
     inline QString &remove(const QRegExp &rx)
     { return replace(rx, QString()); }
 #endif
-#ifndef QT_NO_REGEXP
+#ifndef QT_NO_REGULAREXPRESSION
     QString &replace(const QRegularExpression &re, const QString  &after);
     inline QString &remove(const QRegularExpression &re)
     { return replace(re, QString()); }
@@ -447,7 +455,7 @@ public:
 #ifndef QT_NO_REGEXP
     QStringList split(const QRegExp &sep, SplitBehavior behavior = KeepEmptyParts) const Q_REQUIRED_RESULT;
 #endif
-#ifndef QT_NO_REGEXP
+#ifndef QT_NO_REGULAREXPRESSION
     QStringList split(const QRegularExpression &sep, SplitBehavior behavior = KeepEmptyParts) const Q_REQUIRED_RESULT;
 #endif
     enum NormalizationForm {
@@ -884,6 +892,8 @@ public:
     QChar::Decomposition decompositionTag() const { return QChar(*this).decompositionTag(); }
     uchar combiningClass() const { return QChar(*this).combiningClass(); }
 
+    inline QChar::Script script() const { return QChar(*this).script(); }
+
     QChar::UnicodeVersion unicodeVersion() const { return QChar(*this).unicodeVersion(); }
 
     inline uchar cell() const { return QChar(*this).cell(); }
@@ -1171,13 +1181,17 @@ class Q_CORE_EXPORT QStringRef {
     int m_position;
     int m_size;
 public:
+    // ### Qt 6: make this constructor constexpr, after the destructor is made trivial
     inline QStringRef():m_string(0), m_position(0), m_size(0){}
     inline QStringRef(const QString *string, int position, int size);
     inline QStringRef(const QString *string);
+
+    // ### Qt 6: remove this copy constructor, the implicit one is fine
     inline QStringRef(const QStringRef &other)
         :m_string(other.m_string), m_position(other.m_position), m_size(other.m_size)
         {}
 
+    // ### Qt 6: remove this destructor, the implicit one is fine
     inline ~QStringRef(){}
     inline const QString *string() const { return m_string; }
     inline int position() const { return m_position; }
@@ -1271,6 +1285,18 @@ public:
     int localeAwareCompare(const QStringRef &s) const;
     static int localeAwareCompare(const QStringRef &s1, const QString &s2);
     static int localeAwareCompare(const QStringRef &s1, const QStringRef &s2);
+
+    QStringRef trimmed() const Q_REQUIRED_RESULT;
+    short  toShort(bool *ok = 0, int base = 10) const;
+    ushort toUShort(bool *ok = 0, int base = 10) const;
+    int toInt(bool *ok = 0, int base = 10) const;
+    uint toUInt(bool *ok = 0, int base = 10) const;
+    long toLong(bool *ok = 0, int base = 10) const;
+    ulong toULong(bool *ok = 0, int base = 10) const;
+    qlonglong toLongLong(bool *ok = 0, int base = 10) const;
+    qulonglong toULongLong(bool *ok = 0, int base = 10) const;
+    float toFloat(bool *ok = 0) const;
+    double toDouble(bool *ok = 0) const;
 };
 Q_DECLARE_TYPEINFO(QStringRef, Q_PRIMITIVE_TYPE);
 
@@ -1386,8 +1412,6 @@ QT_DEPRECATED inline QString escape(const QString &plain) {
 
 QT_END_NAMESPACE
 
-QT_END_HEADER
-
 #if defined(QT_USE_FAST_OPERATOR_PLUS) || defined(QT_USE_QSTRINGBUILDER)
 #include <QtCore/qstringbuilder.h>
 #endif
diff --git a/src/corelib/tools/qstringbuilder.h b/src/corelib/tools/qstringbuilder.h
index a04910c..e09b02b 100644
--- a/src/corelib/tools/qstringbuilder.h
+++ b/src/corelib/tools/qstringbuilder.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtCore module of the Qt Toolkit.
@@ -54,8 +54,6 @@
 
 #include <string.h>
 
-QT_BEGIN_HEADER
-
 QT_BEGIN_NAMESPACE
 
 
@@ -429,6 +427,4 @@ QString &operator+=(QString &a, const QStringBuilder<A, B> &b)
 
 QT_END_NAMESPACE
 
-QT_END_HEADER
-
 #endif // QSTRINGBUILDER_H
diff --git a/src/corelib/tools/qstringlist.h b/src/corelib/tools/qstringlist.h
index 2448081..a962b7c 100644
--- a/src/corelib/tools/qstringlist.h
+++ b/src/corelib/tools/qstringlist.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtCore module of the Qt Toolkit.
@@ -49,8 +49,6 @@
 #include <QtCore/qstring.h>
 #include <QtCore/qstringmatcher.h>
 
-QT_BEGIN_HEADER
-
 QT_BEGIN_NAMESPACE
 
 
@@ -99,12 +97,12 @@ public:
 #endif
 
 #ifndef QT_BOOTSTRAPPED
-#ifndef QT_NO_REGEXP
+#ifndef QT_NO_REGULAREXPRESSION
     inline QStringList filter(const QRegularExpression &re) const;
     inline QStringList &replaceInStrings(const QRegularExpression &re, const QString &after);
     inline int indexOf(const QRegularExpression &re, int from = 0) const;
     inline int lastIndexOf(const QRegularExpression &re, int from = -1) const;
-#endif // QT_NO_REGEXP
+#endif // QT_NO_REGULAREXPRESSION
 #endif // QT_BOOTSTRAPPED
 
 #if !defined(Q_NO_USING_KEYWORD)
@@ -141,12 +139,12 @@ namespace QtPrivate {
 #endif
 
 #ifndef QT_BOOTSTRAPPED
-#ifndef QT_NO_REGEXP
+#ifndef QT_NO_REGULAREXPRESSION
     void Q_CORE_EXPORT QStringList_replaceInStrings(QStringList *that, const QRegularExpression &rx, const QString &after);
     QStringList Q_CORE_EXPORT QStringList_filter(const QStringList *that, const QRegularExpression &re);
     int Q_CORE_EXPORT QStringList_indexOf(const QStringList *that, const QRegularExpression &re, int from);
     int Q_CORE_EXPORT QStringList_lastIndexOf(const QStringList *that, const QRegularExpression &re, int from);
-#endif // QT_NO_REGEXP
+#endif // QT_NO_REGULAREXPRESSION
 #endif // QT_BOOTSTRAPPED
 }
 
@@ -220,7 +218,7 @@ inline int QStringList::lastIndexOf(QRegExp &rx, int from) const
 #endif
 
 #ifndef QT_BOOTSTRAPPED
-#ifndef QT_NO_REGEXP
+#ifndef QT_NO_REGULAREXPRESSION
 inline QStringList &QStringList::replaceInStrings(const QRegularExpression &rx, const QString &after)
 {
     QtPrivate::QStringList_replaceInStrings(this, rx, after);
@@ -241,7 +239,7 @@ inline int QStringList::lastIndexOf(const QRegularExpression &rx, int from) cons
 {
     return QtPrivate::QStringList_lastIndexOf(this, rx, from);
 }
-#endif // QT_NO_REGEXP
+#endif // QT_NO_REGULAREXPRESSION
 #endif // QT_BOOTSTRAPPED
 
 #ifndef QT_NO_DATASTREAM
@@ -257,6 +255,4 @@ inline QDataStream &operator<<(QDataStream &out, const QStringList &list)
 
 QT_END_NAMESPACE
 
-QT_END_HEADER
-
 #endif // QSTRINGLIST_H
diff --git a/src/corelib/tools/qstringmatcher.h b/src/corelib/tools/qstringmatcher.h
index 64c2894..792b975 100644
--- a/src/corelib/tools/qstringmatcher.h
+++ b/src/corelib/tools/qstringmatcher.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtCore module of the Qt Toolkit.
@@ -44,8 +44,6 @@
 
 #include <QtCore/qstring.h>
 
-QT_BEGIN_HEADER
-
 QT_BEGIN_NAMESPACE
 
 
@@ -97,6 +95,4 @@ private:
 
 QT_END_NAMESPACE
 
-QT_END_HEADER
-
 #endif // QSTRINGMATCHER_H
diff --git a/src/corelib/tools/qtextboundaryfinder.h b/src/corelib/tools/qtextboundaryfinder.h
index 745dc4e..81cd0dd 100644
--- a/src/corelib/tools/qtextboundaryfinder.h
+++ b/src/corelib/tools/qtextboundaryfinder.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtCore module of the Qt Toolkit.
@@ -45,8 +45,6 @@
 #include <QtCore/qchar.h>
 #include <QtCore/qstring.h>
 
-QT_BEGIN_HEADER
-
 QT_BEGIN_NAMESPACE
 
 
@@ -111,7 +109,5 @@ Q_DECLARE_OPERATORS_FOR_FLAGS(QTextBoundaryFinder::BoundaryReasons)
 
 QT_END_NAMESPACE
 
-QT_END_HEADER
-
 #endif
 
diff --git a/src/corelib/tools/qtimeline.h b/src/corelib/tools/qtimeline.h
index 04ad549..be2a4ae 100644
--- a/src/corelib/tools/qtimeline.h
+++ b/src/corelib/tools/qtimeline.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtCore module of the Qt Toolkit.
@@ -45,8 +45,6 @@
 #include <QtCore/qeasingcurve.h>
 #include <QtCore/qobject.h>
 
-QT_BEGIN_HEADER
-
 QT_BEGIN_NAMESPACE
 
 
@@ -126,22 +124,22 @@ public Q_SLOTS:
 
 Q_SIGNALS:
     void valueChanged(qreal x
-#if !defined(qdoc)
+#if !defined(Q_QDOC)
       , QPrivateSignal
 #endif
     );
     void frameChanged(int
-#if !defined(qdoc)
+#if !defined(Q_QDOC)
       , QPrivateSignal
 #endif
     );
     void stateChanged(QTimeLine::State newState
-#if !defined(qdoc)
+#if !defined(Q_QDOC)
       , QPrivateSignal
 #endif
     );
     void finished(
-#if !defined(qdoc)
+#if !defined(Q_QDOC)
       QPrivateSignal
 #endif
     );
@@ -156,7 +154,5 @@ private:
 
 QT_END_NAMESPACE
 
-QT_END_HEADER
-
 #endif
 
diff --git a/src/corelib/tools/qvarlengtharray.h b/src/corelib/tools/qvarlengtharray.h
index 0c5b61d..3a20280 100644
--- a/src/corelib/tools/qvarlengtharray.h
+++ b/src/corelib/tools/qvarlengtharray.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtCore module of the Qt Toolkit.
@@ -50,8 +50,6 @@
 #include <string.h>
 #include <stdlib.h>
 
-QT_BEGIN_HEADER
-
 QT_BEGIN_NAMESPACE
 
 
@@ -103,6 +101,7 @@ public:
     inline bool isEmpty() const { return (s == 0); }
     inline void resize(int size);
     inline void clear() { resize(0); }
+    inline void squeeze();
 
     inline int capacity() const { return a; }
     inline void reserve(int size);
@@ -244,6 +243,10 @@ Q_OUTOFLINE_TEMPLATE void QVarLengthArray<T, Prealloc>::append(const T *abuf, in
 }
 
 template <class T, int Prealloc>
+Q_INLINE_TEMPLATE void QVarLengthArray<T, Prealloc>::squeeze()
+{ realloc(s, s); }
+
+template <class T, int Prealloc>
 Q_OUTOFLINE_TEMPLATE void QVarLengthArray<T, Prealloc>::realloc(int asize, int aalloc)
 {
     Q_ASSERT(aalloc >= asize);
@@ -415,6 +418,4 @@ bool operator!=(const QVarLengthArray<T, Prealloc1> &l, const QVarLengthArray<T,
 
 QT_END_NAMESPACE
 
-QT_END_HEADER
-
 #endif // QVARLENGTHARRAY_H
diff --git a/src/corelib/tools/qvector.h b/src/corelib/tools/qvector.h
index 2c688db..816e1f1 100644
--- a/src/corelib/tools/qvector.h
+++ b/src/corelib/tools/qvector.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtCore module of the Qt Toolkit.
@@ -56,8 +56,6 @@
 #include <initializer_list>
 #endif
 
-QT_BEGIN_HEADER
-
 QT_BEGIN_NAMESPACE
 
 class QRegion;
@@ -140,6 +138,10 @@ public:
     void replace(int i, const T &t);
     void remove(int i);
     void remove(int i, int n);
+    inline void removeFirst() { Q_ASSERT(!isEmpty()); erase(d->begin()); }
+    inline void removeLast();
+    inline T takeFirst() { Q_ASSERT(!isEmpty()); T r = first(); removeFirst(); return r; }
+    inline T takeLast()  { Q_ASSERT(!isEmpty()); T r = last(); removeLast(); return r; }
 
     QVector<T> &fill(const T &t, int size = -1);
 
@@ -200,8 +202,8 @@ public:
     typedef int size_type;
     inline void push_back(const T &t) { append(t); }
     inline void push_front(const T &t) { prepend(t); }
-    void pop_back() { Q_ASSERT(!isEmpty()); erase(d->end() - 1); }
-    void pop_front() { Q_ASSERT(!isEmpty()); erase(d->begin()); }
+    void pop_back() { removeLast(); }
+    void pop_front() { removeFirst(); }
     inline bool empty() const
     { return d->size == 0; }
     inline T& front() { return first(); }
@@ -491,7 +493,7 @@ void QVector<T>::reallocData(const int asize, const int aalloc, QArrayData::Allo
             }
             x->capacityReserved = d->capacityReserved;
         } else {
-            Q_ASSERT(d->alloc == aalloc); // resize, without changing allocation size
+            Q_ASSERT(int(d->alloc) == aalloc); // resize, without changing allocation size
             Q_ASSERT(isDetached());       // can be done only on detached d
             Q_ASSERT(x == d);             // in this case we do not need to allocate anything
             if (asize <= d->size) {
@@ -506,8 +508,7 @@ void QVector<T>::reallocData(const int asize, const int aalloc, QArrayData::Allo
     }
     if (d != x) {
         if (!d->ref.deref()) {
-            Q_ASSERT(!isShared);
-            if (QTypeInfo<T>::isStatic || !aalloc) {
+            if (QTypeInfo<T>::isStatic || !aalloc || (isShared && QTypeInfo<T>::isComplex)) {
                 // data was copy constructed, we need to call destructors
                 // or if !alloc we did nothing to the old 'd'.
                 freeData(d);
@@ -557,6 +558,22 @@ void QVector<T>::append(const T &t)
 }
 
 template <typename T>
+inline void QVector<T>::removeLast()
+{
+    Q_ASSERT(!isEmpty());
+
+    if (d->alloc) {
+        if (d->ref.isShared()) {
+            reallocData(d->size - 1, int(d->alloc));
+            return;
+        }
+        if (QTypeInfo<T>::isComplex)
+            (d->data() + d->size - 1)->~T();
+        --d->size;
+    }
+}
+
+template <typename T>
 typename QVector<T>::iterator QVector<T>::insert(iterator before, size_type n, const T &t)
 {
     int offset = std::distance(d->begin(), before);
@@ -605,6 +622,7 @@ typename QVector<T>::iterator QVector<T>::erase(iterator abegin, iterator aend)
 
     // FIXME we could do a proper realloc, which copy constructs only needed data.
     // FIXME we ara about to delete data maybe it is good time to shrink?
+    // FIXME the shrink is also an issue in removeLast, that is just a copy + reduce of this.
     if (d->alloc) {
         detach();
         abegin = d->begin() + itemsUntouched;
@@ -814,6 +832,4 @@ Q_TEMPLATE_EXTERN template class Q_CORE_EXPORT QVector<QPoint>;
 
 QT_END_NAMESPACE
 
-QT_END_HEADER
-
 #endif // QVECTOR_H
diff --git a/src/corelib/xml/qxmlstream.h b/src/corelib/xml/qxmlstream.h
index 02f76ee..8a9c2fc 100644
--- a/src/corelib/xml/qxmlstream.h
+++ b/src/corelib/xml/qxmlstream.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtCore module of the Qt Toolkit.
@@ -50,8 +50,6 @@
 #include <QtCore/qvector.h>
 #include <QtCore/qscopedpointer.h>
 
-QT_BEGIN_HEADER
-
 QT_BEGIN_NAMESPACE
 
 
@@ -426,7 +424,5 @@ private:
 
 QT_END_NAMESPACE
 
-QT_END_HEADER
-
 #endif // QT_NO_XMLSTREAM
 #endif // QXMLSTREAM_H



More information about the Development mailing list