summaryrefslogtreecommitdiff
path: root/include/rttypes.h
diff options
context:
space:
mode:
authorShell <[email protected]>2024-08-06 11:20:38 +0800
committerMeco Man <[email protected]>2024-08-13 04:13:51 -0400
commite9b683d0b338b4c92190702d151e5180d0b10ca0 (patch)
tree48f54401e8986d83973222659664073eaf2c64a7 /include/rttypes.h
parente418b959d76ff54746b31eb6991ebe9b6fe096e5 (diff)
feat: set RT_USING_STDC_ATOMIC to first priority
RT_USING_STDC_ATOMIC is a user selected option on current config system. While the RT_USING_HW_ATOMIC is a forced option selected by Kconfig under libcpu. And the RT_USING_STDC_ATOMIC will be meaningless if we set RT_USING_HW_ATOMIC to first priority if the arch has hw-atomic. Changes: - set RT_USING_STDC_ATOMIC to first priority on rttypes.h Signed-off-by: Shell <[email protected]>
Diffstat (limited to 'include/rttypes.h')
-rw-r--r--include/rttypes.h13
1 files changed, 9 insertions, 4 deletions
diff --git a/include/rttypes.h b/include/rttypes.h
index 78d6c63011..0cd12d7614 100644
--- a/include/rttypes.h
+++ b/include/rttypes.h
@@ -78,14 +78,19 @@ typedef rt_base_t rt_flag_t; /**< Type for flags */
typedef rt_ubase_t rt_dev_t; /**< Type for device */
typedef rt_base_t rt_off_t; /**< Type for offset */
+#if defined(RT_USING_STDC_ATOMIC) && __STDC_VERSION__ < 201112L
+#undef RT_USING_STDC_ATOMIC
+#warning Not using C11 or beyond! Maybe you should change the -std option on your compiler
+#endif
+
#ifdef __cplusplus
typedef rt_base_t rt_atomic_t;
#else
- #if defined(RT_USING_HW_ATOMIC)
- typedef rt_base_t rt_atomic_t;
- #elif defined(RT_USING_STDC_ATOMIC)
+ #if defined(RT_USING_STDC_ATOMIC)
#include <stdatomic.h>
- typedef atomic_intptr_t rt_atomic_t;
+ typedef _Atomic(rt_base_t) rt_atomic_t;
+ #elif defined(RT_USING_HW_ATOMIC)
+ typedef rt_base_t rt_atomic_t;
#else
typedef rt_base_t rt_atomic_t;
#endif /* RT_USING_STDC_ATOMIC */