summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@qt.io>2022-09-30 13:02:05 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2022-10-11 10:56:06 +0000
commitf6f49a7025d5c17f44df3479e916bb4ce2568530 (patch)
tree7ad85edaa29e37f569301307e029687aa1fe6f0c
parent99aa595274f7a1a307ce5c8ebcbfadf5f0a7f5e3 (diff)
forkfd: fix Clang 15 ATOMIC_VAR_INIT deprecation warning
Replace the macro use with the expansion of the macro as it appears in both libc++ as well as libstdc++. Fixes Clang 15 C++20 warning-turned-error: forkfd.c:157:39: error: macro 'ATOMIC_VAR_INIT' has been marked as deprecated [-Werror,-Wdeprecated-pragma] static ffd_atomic_int forkfd_status = FFD_ATOMIC_INIT(0); ^ forkfd_c11.h:51:37: note: expanded from macro 'FFD_ATOMIC_INIT' #define FFD_ATOMIC_INIT(val) ATOMIC_VAR_INIT(val) ^ /d/llvm/15/bin/../include/c++/v1/atomic:2671:43: note: macro marked 'deprecated' here # pragma clang deprecated(ATOMIC_VAR_INIT) ^ Matching OpenDCDiag pull request: https://github.com/opendcdiag/opendcdiag/pull/159 Change-Id: I0204f7fcd6039624ed75d414daf9b6a771bfd9d0 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit 35649760e5ec22b4dcea0729ad679f51f438573d) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--src/3rdparty/forkfd/forkfd_c11.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/3rdparty/forkfd/forkfd_c11.h b/src/3rdparty/forkfd/forkfd_c11.h
index 2b1d3f181e..934ce55a11 100644
--- a/src/3rdparty/forkfd/forkfd_c11.h
+++ b/src/3rdparty/forkfd/forkfd_c11.h
@@ -48,7 +48,11 @@ typedef std::atomic<int> ffd_atomic_int;
typedef atomic_int ffd_atomic_int;
#endif
+#ifdef __cpp_lib_atomic_value_initialization
+#define FFD_ATOMIC_INIT(val) { val }
+#else
#define FFD_ATOMIC_INIT(val) ATOMIC_VAR_INIT(val)
+#endif
#define ffd_atomic_load(ptr, order) \
atomic_load_explicit(ptr, order)