Make qt_noop() constexpr and noexcept (for C++)

Since qt_noop() is supposed to be a no-op, it should not affect
constexpr'ness and noexcept'ness of functions and expressions it's
(indirectly) used in.

That requires that it be constexpr and noexcept itself. Add the
keywords, but guard against use from C. We can't use our Q_ macros
(which would enable noexcept for C, too, on some compilers, because
qcompilerdetection.h depends on qtnoop.h, and we don't want the
circular dependency.

Change-Id: Ie5441c423b7942a6c956345126fc7aec99907d25
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 7bad2902f84a44da00a8cbc8e3acbec3b26c6866)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Marc Mutz 2023-06-28 10:39:15 +02:00 committed by Qt Cherry-pick Bot
parent 13197d7506
commit 212ff817ca

View File

@ -8,6 +8,13 @@
#pragma qt_sync_stop_processing
#endif
inline void qt_noop(void) {}
#ifdef __cplusplus
constexpr
#endif
inline void qt_noop(void)
#ifdef __cplusplus
noexcept
#endif
{}
#endif // QTNOOP_H