summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@qt.io>2023-06-28 10:39:15 +0200
committerMarc Mutz <marc.mutz@qt.io>2023-06-29 01:54:10 +0200
commit7bad2902f84a44da00a8cbc8e3acbec3b26c6866 (patch)
tree9c8d86b0fde3f1e4068b18d9e39930c571dc97b0 /src
parent01e1dc273d0fd95e4e4f57ae0af1862196f72bd6 (diff)
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>
Diffstat (limited to 'src')
-rw-r--r--src/corelib/global/qtnoop.h9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/corelib/global/qtnoop.h b/src/corelib/global/qtnoop.h
index ea0cedd9bc..c84e6c8a99 100644
--- a/src/corelib/global/qtnoop.h
+++ b/src/corelib/global/qtnoop.h
@@ -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