diff --git a/src/corelib/CMakeLists.txt b/src/corelib/CMakeLists.txt index d1ed6c7453..ba155c4e9b 100644 --- a/src/corelib/CMakeLists.txt +++ b/src/corelib/CMakeLists.txt @@ -81,6 +81,7 @@ qt_internal_add_module(Core global/qtconfigmacros.h global/qtdeprecationmarkers.h global/qtenvironmentvariables.cpp global/qtenvironmentvariables.h + global/qtpreprocessorsupport.h global/qtrace_p.h global/qtresource.h global/qttranslation.h 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 - - 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> 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 #include -/* 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 inline void qt_noop(void) {} @@ -40,22 +37,10 @@ inline void qt_noop(void) {} #include #include -/* - 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 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 + + 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 + + The macro can be used to turn the builtin line expander \a arg into a string + literal. +*/