From 230ed5e400ea4276d927570a7781cfcb5c7a534a Mon Sep 17 00:00:00 2001 From: Michele Calgaro Date: Tue, 25 Sep 2018 20:57:27 +0900 Subject: [PATCH] Always build with a clean namespace QT_CLEAN_NAMESPACE constant is no more needed MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This may theoretically affect applications created for Qt1 and Qt2, but such applications require further modifications as well. --------------------------- Cherry picked and adapted from commit ff63338d in tqt3 from Slávek Banko Signed-off-by: Michele Calgaro --- doc/html/porting.html | 4 +--- doc/html/qcstring-h.html | 14 ----------- doc/html/qcursor-h.html | 13 ----------- doc/html/qglobal-h.html | 32 -------------------------- doc/html/qwindowdefs-h.html | 6 ----- doc/porting3.doc | 4 +--- examples/demo/opengl/glinfo_x11.cpp | 2 -- plugins/src/imageformats/jpeg/main.cpp | 3 --- plugins/src/imageformats/mng/main.cpp | 4 ---- plugins/src/imageformats/png/main.cpp | 3 --- src/kernel/qapplication_x11.cpp | 3 --- src/kernel/qcursor.h | 13 ----------- src/kernel/qjpegio.cpp | 4 ---- src/kernel/qmngio.cpp | 4 ---- src/kernel/qobjectdefs.h | 6 ----- src/kernel/qsound_x11.cpp | 2 -- src/kernel/qtkdeintegration_x11.cpp | 1 - src/kernel/qwindowdefs.h | 6 ----- src/tools/qcstring.h | 14 ----------- src/tools/qglobal.h | 32 -------------------------- tools/msg2qm/msg2qm.cpp | 4 ++-- tools/qvfb/qanimationwriter.cpp | 1 - 22 files changed, 4 insertions(+), 171 deletions(-) diff --git a/doc/html/porting.html b/doc/html/porting.html index 5d9d3c7..4b5a5d0 100644 --- a/doc/html/porting.html +++ b/doc/html/porting.html @@ -217,9 +217,7 @@ previously disabled, please check these macro variables:
  • CHECK_NULL becomes QT_CHECK_NULL
  • CHECK_MATH becomes QT_CHECK_MATH -

    The name of some debugging macro functions has been changed as well -but source compatibility should not be affected if the macro variable -QT_CLEAN_NAMESPACE is not defined: +

    The name of some debugging macro functions has been changed:

    • ASSERT becomes Q_ASSERT
    • CHECK_PTR becomes Q_CHECK_PTR diff --git a/doc/html/qcstring-h.html b/doc/html/qcstring-h.html index 5219aa9..3378143 100644 --- a/doc/html/qcstring-h.html +++ b/doc/html/qcstring-h.html @@ -117,20 +117,6 @@ Q_EXPORT int qstricmp( const char *, const char * ); Q_EXPORT int qstrnicmp( const char *, const char *, uint len ); -#ifndef QT_CLEAN_NAMESPACE -Q_EXPORT inline uint cstrlen( const char *str ) -{ return (uint)strlen(str); } - -Q_EXPORT inline char *cstrcpy( char *dst, const char *src ) -{ return strcpy(dst,src); } - -Q_EXPORT inline int cstrcmp( const char *str1, const char *str2 ) -{ return strcmp(str1,str2); } - -Q_EXPORT inline int cstrncmp( const char *str1, const char *str2, uint len ) -{ return strncmp(str1,str2,len); } -#endif - // qChecksum: Internet checksum diff --git a/doc/html/qcursor-h.html b/doc/html/qcursor-h.html index 0823646..84f6e84 100644 --- a/doc/html/qcursor-h.html +++ b/doc/html/qcursor-h.html @@ -158,19 +158,6 @@ private: }; -#if !defined(QT_CLEAN_NAMESPACE) -// CursorShape is defined in X11/X.h -#ifdef CursorShape -#define X_CursorShape CursorShape -#undef CursorShape -#endif -typedef Qt::CursorShape QCursorShape; -#ifdef X_CursorShape -#define CursorShape X_CursorShape -#endif -#endif - - /***************************************************************************** QCursor stream functions *****************************************************************************/ diff --git a/doc/html/qglobal-h.html b/doc/html/qglobal-h.html index 17b08bd..dd8d61a 100644 --- a/doc/html/qglobal-h.html +++ b/doc/html/qglobal-h.html @@ -734,16 +734,6 @@ inline int qRound( double d ) // Size-dependent types (architechture-dependent byte order) // -#if !defined(QT_CLEAN_NAMESPACE) -// source compatibility with Qt 1.x -typedef signed char INT8; // 8 bit signed -typedef unsigned char UINT8; // 8 bit unsigned -typedef short INT16; // 16 bit signed -typedef unsigned short UINT16; // 16 bit unsigned -typedef int INT32; // 32 bit signed -typedef unsigned int UINT32; // 32 bit unsigned -#endif - typedef signed char Q_INT8; // 8 bit signed typedef unsigned char Q_UINT8; // 8 bit unsigned typedef short Q_INT16; // 16 bit signed @@ -1020,28 +1010,6 @@ Q_EXPORT void qFatal( const char *, ... ) // print fatal message and exit Q_EXPORT void qSystemWarning( const char *, int code = -1 ); -#if !defined(QT_CLEAN_NAMESPACE) // compatibility with Qt 1 - -Q_EXPORT void debug( const char *, ... ) // print debug message -#if defined(Q_CC_GNU) && !defined(__INSURE__) - __attribute__ ((format (printf, 1, 2))) -#endif -; - -Q_EXPORT void warning( const char *, ... ) // print warning message -#if defined(Q_CC_GNU) && !defined(__INSURE__) - __attribute__ ((format (printf, 1, 2))) -#endif -; - -Q_EXPORT void fatal( const char *, ... ) // print fatal message and exit -#if defined(Q_CC_GNU) && !defined(__INSURE__) - __attribute__ ((format (printf, 1, 2))) -#endif -; - -#endif // QT_CLEAN_NAMESPACE - #if !defined(Q_ASSERT) # if defined(QT_CHECK_STATE) diff --git a/doc/html/qwindowdefs-h.html b/doc/html/qwindowdefs-h.html index 8a837c8..90b6c27 100644 --- a/doc/html/qwindowdefs-h.html +++ b/doc/html/qwindowdefs-h.html @@ -224,12 +224,6 @@ typedef void (*QtCleanUpFunction)(); Q_EXPORT void qAddPostRoutine( QtCleanUpFunction ); Q_EXPORT void qRemovePostRoutine( QtCleanUpFunction ); -#if !defined(QT_CLEAN_NAMESPACE) -// source compatibility with Qt 2.x -typedef QtCleanUpFunction Q_CleanUpFunction; -#endif - - #endif // QWINDOWDEFS_H diff --git a/doc/porting3.doc b/doc/porting3.doc index 9b7c012..29f1e2e 100644 --- a/doc/porting3.doc +++ b/doc/porting3.doc @@ -165,9 +165,7 @@ previously disabled, please check these macro variables: \i \c CHECK_MATH becomes \c QT_CHECK_MATH \endlist -The name of some debugging macro functions has been changed as well -but source compatibility should not be affected if the macro variable -\c QT_CLEAN_NAMESPACE is not defined: +The name of some debugging macro functions has been changed: \list \i \c ASSERT becomes \c Q_ASSERT diff --git a/examples/demo/opengl/glinfo_x11.cpp b/examples/demo/opengl/glinfo_x11.cpp index 1137ef9..c7b92f3 100644 --- a/examples/demo/opengl/glinfo_x11.cpp +++ b/examples/demo/opengl/glinfo_x11.cpp @@ -7,8 +7,6 @@ ** *****************************************************************************/ -#define QT_CLEAN_NAMESPACE // avoid clashes with Xmd.h - #include #include #include "glinfo.h" diff --git a/plugins/src/imageformats/jpeg/main.cpp b/plugins/src/imageformats/jpeg/main.cpp index d2fa377..9f3311e 100644 --- a/plugins/src/imageformats/jpeg/main.cpp +++ b/plugins/src/imageformats/jpeg/main.cpp @@ -1,6 +1,3 @@ -#ifndef QT_CLEAN_NAMESPACE -#define QT_CLEAN_NAMESPACE -#endif #include #ifndef QT_NO_IMAGEFORMATPLUGIN diff --git a/plugins/src/imageformats/mng/main.cpp b/plugins/src/imageformats/mng/main.cpp index 4f1e283..dec02cb 100644 --- a/plugins/src/imageformats/mng/main.cpp +++ b/plugins/src/imageformats/mng/main.cpp @@ -1,7 +1,3 @@ -#ifndef QT_CLEAN_NAMESPACE -#define QT_CLEAN_NAMESPACE -#endif - #include #ifndef QT_NO_IMAGEFORMATPLUGIN diff --git a/plugins/src/imageformats/png/main.cpp b/plugins/src/imageformats/png/main.cpp index dcd5792..2bab0e4 100644 --- a/plugins/src/imageformats/png/main.cpp +++ b/plugins/src/imageformats/png/main.cpp @@ -1,6 +1,3 @@ -#ifndef QT_CLEAN_NAMESPACE -#define QT_CLEAN_NAMESPACE -#endif #include #ifndef QT_NO_IMAGEFORMATPLUGIN diff --git a/src/kernel/qapplication_x11.cpp b/src/kernel/qapplication_x11.cpp index c93c60f..a40ca02 100644 --- a/src/kernel/qapplication_x11.cpp +++ b/src/kernel/qapplication_x11.cpp @@ -44,9 +44,6 @@ // provide a proper alternative for others. See also the exports in // qapplication_win.cpp which suggest a unification. -// ### needed for solaris-g++ in beta5 -#define QT_CLEAN_NAMESPACE - #include "qplatformdefs.h" // POSIX Large File Support redefines open -> open64 diff --git a/src/kernel/qcursor.h b/src/kernel/qcursor.h index 9b99edb..7518cd3 100644 --- a/src/kernel/qcursor.h +++ b/src/kernel/qcursor.h @@ -122,19 +122,6 @@ private: }; -#if !defined(QT_CLEAN_NAMESPACE) -// CursorShape is defined in X11/X.h -#ifdef CursorShape -#define X_CursorShape CursorShape -#undef CursorShape -#endif -typedef Qt::CursorShape QCursorShape; -#ifdef X_CursorShape -#define CursorShape X_CursorShape -#endif -#endif - - /***************************************************************************** QCursor stream functions *****************************************************************************/ diff --git a/src/kernel/qjpegio.cpp b/src/kernel/qjpegio.cpp index bdb4c27..e448cad 100644 --- a/src/kernel/qjpegio.cpp +++ b/src/kernel/qjpegio.cpp @@ -38,10 +38,6 @@ ** **********************************************************************/ -#ifndef QT_CLEAN_NAMESPACE -#define QT_CLEAN_NAMESPACE -#endif - #include "qimage.h" #ifndef QT_NO_IMAGEIO_JPEG diff --git a/src/kernel/qmngio.cpp b/src/kernel/qmngio.cpp index d9d085b..76bf00c 100644 --- a/src/kernel/qmngio.cpp +++ b/src/kernel/qmngio.cpp @@ -38,10 +38,6 @@ ** **********************************************************************/ -#ifndef QT_CLEAN_NAMESPACE -#define QT_CLEAN_NAMESPACE -#endif - #include "qdatetime.h" #ifndef QT_NO_IMAGEIO_MNG diff --git a/src/kernel/qobjectdefs.h b/src/kernel/qobjectdefs.h index cab0ec0..e0f31f6 100644 --- a/src/kernel/qobjectdefs.h +++ b/src/kernel/qobjectdefs.h @@ -142,12 +142,6 @@ private: \ #define SIGNAL(a) "2"#a #endif -#ifndef QT_CLEAN_NAMESPACE -#define METHOD_CODE 0 // member type codes -#define SLOT_CODE 1 -#define SIGNAL_CODE 2 -#endif - #define QMETHOD_CODE 0 // member type codes #define QSLOT_CODE 1 #define QSIGNAL_CODE 2 diff --git a/src/kernel/qsound_x11.cpp b/src/kernel/qsound_x11.cpp index 82639a4..edc5e34 100644 --- a/src/kernel/qsound_x11.cpp +++ b/src/kernel/qsound_x11.cpp @@ -38,8 +38,6 @@ ** **********************************************************************/ -#define QT_CLEAN_NAMESPACE - #include "qsound.h" #ifndef QT_NO_SOUND diff --git a/src/kernel/qtkdeintegration_x11.cpp b/src/kernel/qtkdeintegration_x11.cpp index a562a76..5fcd00f 100644 --- a/src/kernel/qtkdeintegration_x11.cpp +++ b/src/kernel/qtkdeintegration_x11.cpp @@ -1,7 +1,6 @@ /* This file is licensed under the terms of the GPL v2 or v3, as it has been publicly released by OpenSUSE as part of their GPLed Qt library disribution */ -#define QT_CLEAN_NAMESPACE #include "qtkdeintegration_x11_p.h" #include diff --git a/src/kernel/qwindowdefs.h b/src/kernel/qwindowdefs.h index 05a3a33..1021696 100644 --- a/src/kernel/qwindowdefs.h +++ b/src/kernel/qwindowdefs.h @@ -188,10 +188,4 @@ typedef void (*QtCleanUpFunction)(); Q_EXPORT void qAddPostRoutine( QtCleanUpFunction ); Q_EXPORT void qRemovePostRoutine( QtCleanUpFunction ); -#if !defined(QT_CLEAN_NAMESPACE) -// source compatibility with Qt 2.x -typedef QtCleanUpFunction Q_CleanUpFunction; -#endif - - #endif // QWINDOWDEFS_H diff --git a/src/tools/qcstring.h b/src/tools/qcstring.h index 372ae80..a48cce8 100644 --- a/src/tools/qcstring.h +++ b/src/tools/qcstring.h @@ -81,20 +81,6 @@ Q_EXPORT int qstricmp( const char *, const char * ); Q_EXPORT int qstrnicmp( const char *, const char *, uint len ); -#ifndef QT_CLEAN_NAMESPACE -Q_EXPORT inline uint cstrlen( const char *str ) -{ return (uint)strlen(str); } - -Q_EXPORT inline char *cstrcpy( char *dst, const char *src ) -{ return strcpy(dst,src); } - -Q_EXPORT inline int cstrcmp( const char *str1, const char *str2 ) -{ return strcmp(str1,str2); } - -Q_EXPORT inline int cstrncmp( const char *str1, const char *str2, uint len ) -{ return strncmp(str1,str2,len); } -#endif - // qChecksum: Internet checksum diff --git a/src/tools/qglobal.h b/src/tools/qglobal.h index 62de654..27f784e 100644 --- a/src/tools/qglobal.h +++ b/src/tools/qglobal.h @@ -700,16 +700,6 @@ inline int qRound( double d ) // Size-dependent types (architechture-dependent byte order) // -#if !defined(QT_CLEAN_NAMESPACE) -// source compatibility with Qt 1.x -typedef signed char INT8; // 8 bit signed -typedef unsigned char UINT8; // 8 bit unsigned -typedef short INT16; // 16 bit signed -typedef unsigned short UINT16; // 16 bit unsigned -typedef int INT32; // 32 bit signed -typedef unsigned int UINT32; // 32 bit unsigned -#endif - typedef signed char Q_INT8; // 8 bit signed typedef unsigned char Q_UINT8; // 8 bit unsigned typedef short Q_INT16; // 16 bit signed @@ -987,28 +977,6 @@ Q_EXPORT void qFatal( const char *, ... ) // print fatal message and exit Q_EXPORT void qSystemWarning( const char *, int code = -1 ); -#if !defined(QT_CLEAN_NAMESPACE) // compatibility with Qt 1 - -Q_EXPORT void debug( const char *, ... ) // print debug message -#if defined(Q_CC_GNU) && !defined(__INSURE__) - __attribute__ ((format (printf, 1, 2))) -#endif -; - -Q_EXPORT void warning( const char *, ... ) // print warning message -#if defined(Q_CC_GNU) && !defined(__INSURE__) - __attribute__ ((format (printf, 1, 2))) -#endif -; - -Q_EXPORT void fatal( const char *, ... ) // print fatal message and exit -#if defined(Q_CC_GNU) && !defined(__INSURE__) - __attribute__ ((format (printf, 1, 2))) -#endif -; - -#endif // QT_CLEAN_NAMESPACE - #if !defined(Q_ASSERT) # if defined(QT_CHECK_STATE) diff --git a/tools/msg2qm/msg2qm.cpp b/tools/msg2qm/msg2qm.cpp index 6ac8c36..d90d7b6 100644 --- a/tools/msg2qm/msg2qm.cpp +++ b/tools/msg2qm/msg2qm.cpp @@ -192,10 +192,10 @@ void translate( const QString& filename, const QString& qmfile ) QString charset = msgstr.mid( cpos, i-cpos ); codec = QTextCodec::codecForName( charset.ascii() ); if ( codec ) { - debug( "PO file character set: %s. Codec: %s", + qDebug( "PO file character set: %s. Codec: %s", charset.ascii(), codec->name() ); } else { - debug( "No codec for %s", charset.ascii() ); + qDebug( "No codec for %s", charset.ascii() ); } } break; diff --git a/tools/qvfb/qanimationwriter.cpp b/tools/qvfb/qanimationwriter.cpp index ad6a047..161c985 100644 --- a/tools/qvfb/qanimationwriter.cpp +++ b/tools/qvfb/qanimationwriter.cpp @@ -33,7 +33,6 @@ #include "qanimationwriter.h" -#define QT_CLEAN_NAMESPACE #include #include