aboutsummaryrefslogtreecommitdiffstats
path: root/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/debian/stdatomic.patch
blob: e11f3cc783e4692c03b0ba307f88d4da3f1fb479 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
Upstream-Status: Pending

Description: Fix incompatibility between <stdatomic.h> and <atomic>
 This 2 headers combined will cause errors for both GCC and Clang. This patch
 makes sure only one of them is present at any time.
Bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60932
Bug: https://reviews.llvm.org/D45470
--- a/system/core/libcutils/include/cutils/trace.h
+++ b/system/core/libcutils/include/cutils/trace.h
@@ -18,7 +18,14 @@
 #define _LIBS_CUTILS_TRACE_H
 
 #include <inttypes.h>
+#ifdef __cplusplus
+#include <atomic>
+using std::atomic_bool;
+using std::atomic_load_explicit;
+using std::memory_order_acquire;
+#else
 #include <stdatomic.h>
+#endif
 #include <stdbool.h>
 #include <stdint.h>
 #include <stdio.h>
--- a/system/core/libcutils/include/cutils/atomic.h
+++ b/system/core/libcutils/include/cutils/atomic.h
@@ -19,7 +19,23 @@
 
 #include <stdint.h>
 #include <sys/types.h>
+#ifdef __cplusplus
+#include <atomic>
+using std::atomic_compare_exchange_strong_explicit;
+using std::atomic_fetch_add_explicit;
+using std::atomic_fetch_or_explicit;
+using std::atomic_fetch_sub_explicit;
+using std::atomic_int_least32_t;
+using std::atomic_load_explicit;
+using std::atomic_store_explicit;
+using std::atomic_thread_fence;
+using std::memory_order::memory_order_acquire;
+using std::memory_order::memory_order_relaxed;
+using std::memory_order::memory_order_release;
+using std::memory_order::memory_order_seq_cst;
+#else
 #include <stdatomic.h>
+#endif
 
 #ifndef ANDROID_ATOMIC_INLINE
 #define ANDROID_ATOMIC_INLINE static inline
--- a/system/core/liblog/logger.h
+++ b/system/core/liblog/logger.h
@@ -16,7 +16,13 @@
 
 #pragma once
 
+#ifdef __cplusplus
+#include <atomic>
+using std::atomic_int;
+using std::atomic_uintptr_t;
+#else
 #include <stdatomic.h>
+#endif
 #include <sys/cdefs.h>
 
 #include <log/log.h>