diff options
author | João Abecasis <joao.abecasis@nokia.com> | 2012-01-04 14:30:42 +0100 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-01-05 13:59:24 +0100 |
commit | fed603fde515339ec520accefded211ac6f69982 (patch) | |
tree | 914b02ab274db14cc73d2a1ea03d7278e3e8e8f8 /tests/auto/corelib/tools | |
parent | 9a890a519e9e314b99ca765a7127aa8bdc5b8870 (diff) |
Ensure shared_null(s) are statically initialized on VS 2010
This removes const qualification on data members of QConst*Data, which
was subjecting QString's and QByteArray's shared_null to the "order of
static initialization fiasco", with up-to-date VS 2010.
Furthermore, the const qualification in the places where it was removed
had little meaning and no value. It was unnecessary. As such, "Const"
was removed from the struct's names and "Static" used in its place, to
imply their usefulness in supporting statically-initialized fixed-size
(string and byte) containers.
A test case was added to QArrayData as that is meant to replace both
QStringData and QByteArrayData in the near future.
VS issue reported at:
https://connect.microsoft.com/VisualStudio/feedback/details/716461
Change-Id: I3d86f2a387a68f359bb3d8f4d10cf3da51c6ecf7
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
Diffstat (limited to 'tests/auto/corelib/tools')
-rw-r--r-- | tests/auto/corelib/tools/qarraydata/tst_qarraydata.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/auto/corelib/tools/qarraydata/tst_qarraydata.cpp b/tests/auto/corelib/tools/qarraydata/tst_qarraydata.cpp index 89a1f8bc75..63a26ed926 100644 --- a/tests/auto/corelib/tools/qarraydata/tst_qarraydata.cpp +++ b/tests/auto/corelib/tools/qarraydata/tst_qarraydata.cpp @@ -46,6 +46,23 @@ #include "simplevector.h" +struct SharedNullVerifier +{ + SharedNullVerifier() + { + Q_ASSERT(QArrayData::shared_null.ref.isStatic()); + Q_ASSERT(QArrayData::shared_null.ref.isShared()); + Q_ASSERT(QArrayData::shared_null.ref.isSharable()); + } +}; + +// This is meant to verify/ensure that shared_null is not being dynamically +// initialized and stays away from the order-of-static-initialization fiasco. +// +// Of course, if this was to fail, qmake and the build should have crashed and +// burned before we ever got to this point :-) +SharedNullVerifier globalInit; + class tst_QArrayData : public QObject { Q_OBJECT |