Remove QT_NO_STL_WCHAR hack
authorHarald Fernengel <harald.fernengel@nokia.com>
Wed, 21 Dec 2011 09:40:36 +0000 (10:40 +0100)
committerQt by Nokia <qt-info@nokia.com>
Thu, 22 Dec 2011 12:20:40 +0000 (13:20 +0100)
We don't support gcc 2.95 any more.

Change-Id: I842f1f8ac64b9006516c104add0991830ac9a46a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
src/corelib/global/qglobal.h
src/corelib/tools/qstring.h
tests/auto/corelib/tools/qstring/tst_qstring.cpp

index 581bac9..c60796c 100644 (file)
@@ -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)
index 427de85..8f063dd 100644 (file)
 
 #ifndef QT_NO_STL
 #  include <string>
-
-#  ifndef QT_NO_STL_WCHAR
-// workaround for some headers not typedef'ing std::wstring
-typedef std::basic_string<wchar_t> QStdWString;
-#  endif // QT_NO_STL_WCHAR
-
 #endif // QT_NO_STL
 
 #include <stdarg.h>
@@ -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))
index 80cbabe..80e9984 100644 (file)
@@ -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