summaryrefslogtreecommitdiffstats
path: root/src/corelib/global
diff options
context:
space:
mode:
authorIvan Solovev <ivan.solovev@qt.io>2022-09-30 13:45:17 +0200
committerIvan Solovev <ivan.solovev@qt.io>2022-10-06 14:26:25 +0200
commite54ff7754d83a3b7aa90be534bbaa9bc60367a97 (patch)
treec300c1c499704e4ea679e305ef62316168f9adf0 /src/corelib/global
parentdff985140a9f31632ba6630ec3391be55051a7ac (diff)
Move the rest of macros from qglobal to QtPreprocessorSupport
We had only three macros left in QtGlobal: * QT_STRINGIFY * Q_UNUSED() * Q_UNIMPLEMENTED() There is no obvious existing header for them, so a new header is created. As a drive-by: add documentation for QT_STRINGIFY. Task-number: QTBUG-106154 Task-number: QTBUG-99313 Change-Id: I2d051dd3e69f13602893a0f0d6968419479b6c23 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/global')
-rw-r--r--src/corelib/global/qglobal.cpp10
-rw-r--r--src/corelib/global/qglobal.h17
-rw-r--r--src/corelib/global/qtpreprocessorsupport.h26
-rw-r--r--src/corelib/global/qtpreprocessorsupport.qdoc20
4 files changed, 47 insertions, 26 deletions
diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp
index e444755f1b..bc280243e4 100644
--- a/src/corelib/global/qglobal.cpp
+++ b/src/corelib/global/qglobal.cpp
@@ -227,16 +227,6 @@ void qAbort()
// localtime() -- but not localtime_r(), which we use when threaded
// strftime() -- not used (except in tests)
-/*!
- \macro Q_UNUSED(name)
- \relates <QtGlobal>
-
- Indicates to the compiler that the parameter with the specified
- \a name is not used in the body of a function. This can be used to
- suppress compiler warnings while allowing functions to be defined
- with meaningful parameter names in their signatures.
-*/
-
struct QInternal_CallBackTable
{
QList<QList<qInternalCallback>> callbacks;
diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h
index ef42bc9d35..e36d64d161 100644
--- a/src/corelib/global/qglobal.h
+++ b/src/corelib/global/qglobal.h
@@ -25,10 +25,7 @@
#include <QtCore/qtconfigmacros.h>
#include <QtCore/qtcoreexports.h>
-/* These two macros makes it possible to turn the builtin line expander into a
- * string literal. */
-#define QT_STRINGIFY2(x) #x
-#define QT_STRINGIFY(x) QT_STRINGIFY2(x)
+#include <QtCore/qtpreprocessorsupport.h>
inline void qt_noop(void) {}
@@ -40,22 +37,10 @@ inline void qt_noop(void) {}
#include <QtCore/qtypes.h>
#include <QtCore/qtclasshelpermacros.h>
-/*
- Avoid "unused parameter" warnings
-*/
-#define Q_UNUSED(x) (void)x;
#ifndef __ASSEMBLER__
-QT_BEGIN_NAMESPACE
-
#if defined(__cplusplus)
-#if !defined(Q_UNIMPLEMENTED)
-# define Q_UNIMPLEMENTED() qWarning("Unimplemented code.")
-#endif
-
-QT_END_NAMESPACE
-
// We need to keep QTypeInfo, QSysInfo, QFlags, qDebug & family in qglobal.h for compatibility with Qt 4.
// Be careful when changing the order of these files.
#include <QtCore/qtypeinfo.h>
diff --git a/src/corelib/global/qtpreprocessorsupport.h b/src/corelib/global/qtpreprocessorsupport.h
new file mode 100644
index 0000000000..73bbeb68b6
--- /dev/null
+++ b/src/corelib/global/qtpreprocessorsupport.h
@@ -0,0 +1,26 @@
+// Copyright (C) 2022 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef QTPREPROCESSORSUPPORT_H
+#define QTPREPROCESSORSUPPORT_H
+
+#if 0
+#pragma qt_class(QtPreprocessorSupport)
+#pragma qt_sync_stop_processing
+#endif
+
+/* These two macros makes it possible to turn the builtin line expander into a
+ * string literal. */
+#define QT_STRINGIFY2(x) #x
+#define QT_STRINGIFY(x) QT_STRINGIFY2(x)
+
+/*
+ Avoid "unused parameter" warnings
+*/
+#define Q_UNUSED(x) (void)x;
+
+#if !defined(Q_UNIMPLEMENTED)
+# define Q_UNIMPLEMENTED() qWarning("Unimplemented code.")
+#endif
+
+#endif // QTPREPROCESSORSUPPORT_H
diff --git a/src/corelib/global/qtpreprocessorsupport.qdoc b/src/corelib/global/qtpreprocessorsupport.qdoc
new file mode 100644
index 0000000000..c9fedf4ec1
--- /dev/null
+++ b/src/corelib/global/qtpreprocessorsupport.qdoc
@@ -0,0 +1,20 @@
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
+
+/*!
+ \macro Q_UNUSED(name)
+ \relates <QtPreprocessorSupport>
+
+ Indicates to the compiler that the parameter with the specified
+ \a name is not used in the body of a function. This can be used to
+ suppress compiler warnings while allowing functions to be defined
+ with meaningful parameter names in their signatures.
+*/
+
+/*!
+ \macro QT_STRINGIFY(arg)
+ \relates <QtPreprocessorSupport>
+
+ The macro can be used to turn the builtin line expander \a arg into a string
+ literal.
+*/