From d868c9945a188d6ad22e0b7d6d24ac7fca00ab4e Mon Sep 17 00:00:00 2001 From: Harald Fernengel Date: Wed, 21 Dec 2011 10:40:36 +0100 Subject: [PATCH] Remove QT_NO_STL_WCHAR hack We don't support gcc 2.95 any more. Change-Id: I842f1f8ac64b9006516c104add0991830ac9a46a Reviewed-by: Thiago Macieira --- src/corelib/global/qglobal.h | 1 - src/corelib/tools/qstring.h | 21 +++------------------ tests/auto/corelib/tools/qstring/tst_qstring.cpp | 8 +------- 3 files changed, 4 insertions(+), 26 deletions(-) diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index 581bac9..c60796c 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -450,7 +450,6 @@ namespace QT_NAMESPACE {} /* GCC 2.95 knows "using" but does not support it correctly */ # if __GNUC__ == 2 && __GNUC_MINOR__ <= 95 # define Q_NO_USING_KEYWORD -# define QT_NO_STL_WCHAR # endif # if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95) # define Q_ALIGNOF(type) __alignof__(type) diff --git a/src/corelib/tools/qstring.h b/src/corelib/tools/qstring.h index 427de85..8f063dd 100644 --- a/src/corelib/tools/qstring.h +++ b/src/corelib/tools/qstring.h @@ -49,12 +49,6 @@ #ifndef QT_NO_STL # include - -# ifndef QT_NO_STL_WCHAR -// workaround for some headers not typedef'ing std::wstring -typedef std::basic_string QStdWString; -# endif // QT_NO_STL_WCHAR - #endif // QT_NO_STL #include @@ -576,15 +570,8 @@ public: #ifndef QT_NO_STL static inline QString fromStdString(const std::string &s); inline std::string toStdString() const; -# ifdef qdoc static inline QString fromStdWString(const std::wstring &s); inline std::wstring toStdWString() const; -# else -# ifndef QT_NO_STL_WCHAR - static inline QString fromStdWString(const QStdWString &s); - inline QStdWString toStdWString() const; -# endif // QT_NO_STL_WCHAR -# endif // qdoc #endif // compatibility @@ -1066,10 +1053,9 @@ inline std::string QString::toStdString() const inline QString QString::fromStdString(const std::string &s) { return fromAscii(s.data(), int(s.size())); } -# ifndef QT_NO_STL_WCHAR -inline QStdWString QString::toStdWString() const +inline std::wstring QString::toStdWString() const { - QStdWString str; + std::wstring str; str.resize(length()); #if defined(_MSC_VER) && _MSC_VER >= 1400 @@ -1081,9 +1067,8 @@ inline QStdWString QString::toStdWString() const str.resize(toWCharArray(&(*str.begin()))); return str; } -inline QString QString::fromStdWString(const QStdWString &s) +inline QString QString::fromStdWString(const std::wstring &s) { return fromWCharArray(s.data(), int(s.size())); } -# endif #endif #if !defined(QT_NO_DATASTREAM) || (defined(QT_BOOTSTRAPPED) && !defined(QT_BUILD_QMAKE)) diff --git a/tests/auto/corelib/tools/qstring/tst_qstring.cpp b/tests/auto/corelib/tools/qstring/tst_qstring.cpp index 80cbabe..80e9984 100644 --- a/tests/auto/corelib/tools/qstring/tst_qstring.cpp +++ b/tests/auto/corelib/tools/qstring/tst_qstring.cpp @@ -811,9 +811,6 @@ void tst_QString::constructorQByteArray() void tst_QString::STL() { -#ifdef Q_CC_HPACC - QSKIP("This test crashes on HP-UX with aCC"); -#endif #ifndef QT_NO_STL #ifndef QT_NO_CAST_TO_ASCII QString qt( "QString" ); @@ -851,16 +848,13 @@ void tst_QString::STL() QVERIFY( !stdstr3.length() ); #endif -// Skip the rest of the test if glibc is not compiled with wide character support -#if !(defined Q_CC_GNU && !defined _GLIBCPP_USE_WCHAR_T) && !defined QT_NO_STL_WCHAR const wchar_t arr[] = {'h', 'e', 'l', 'l', 'o', 0}; - QStdWString stlStr = arr; + std::wstring stlStr = arr; QString s = QString::fromStdWString(stlStr); QCOMPARE(s, QString::fromLatin1("hello")); QCOMPARE(stlStr, s.toStdWString()); -#endif #else QSKIP( "Not tested without STL support"); #endif -- 2.7.4