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.

Pick-to: 6.6 6.5
Change-Id: Ie5441c423b7942a6c956345126fc7aec99907d25
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
bb10
Marc Mutz 2023-06-28 10:39:15 +02:00
parent 01e1dc273d
commit 7bad2902f8
1 changed files with 8 additions and 1 deletions

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