Merge pull request #12548 from maribu/c11_atomcis_cpp_compat
sys: Basic C++ compatibility with C11 atomcis
This commit is contained in:
commit
e38d3e24ec
@ -24,7 +24,11 @@
|
||||
#define RMUTEX_H
|
||||
|
||||
#include <stdint.h>
|
||||
#ifdef __cplusplus
|
||||
#include "c11_atomics_compat.hpp"
|
||||
#else
|
||||
#include <stdatomic.h>
|
||||
#endif
|
||||
|
||||
#include "mutex.h"
|
||||
#include "kernel_types.h"
|
||||
|
||||
71
cpu/arm7_common/include/c11_atomics_compat_cpu.hpp
Normal file
71
cpu/arm7_common/include/c11_atomics_compat_cpu.hpp
Normal file
@ -0,0 +1,71 @@
|
||||
/* This file was automatically generated using ./dist/tools/generate_c11_atomics_cpp_compat_header/generate_c11_atomics_cpp_compat_header.sh */
|
||||
#pragma once
|
||||
|
||||
#define ATOMIC_BOOL_SIZE (1U)
|
||||
#define ATOMIC_BOOL_SAME_SIZED_TYPE uint8_t
|
||||
#define ATOMIC_CHAR_SIZE (1U)
|
||||
#define ATOMIC_CHAR_SAME_SIZED_TYPE uint8_t
|
||||
#define ATOMIC_SCHAR_SIZE (1U)
|
||||
#define ATOMIC_SCHAR_SAME_SIZED_TYPE uint8_t
|
||||
#define ATOMIC_UCHAR_SIZE (1U)
|
||||
#define ATOMIC_UCHAR_SAME_SIZED_TYPE uint8_t
|
||||
#define ATOMIC_SHORT_SIZE (2U)
|
||||
#define ATOMIC_SHORT_SAME_SIZED_TYPE uint16_t
|
||||
#define ATOMIC_USHORT_SIZE (2U)
|
||||
#define ATOMIC_USHORT_SAME_SIZED_TYPE uint16_t
|
||||
#define ATOMIC_INT_SIZE (4U)
|
||||
#define ATOMIC_INT_SAME_SIZED_TYPE uint32_t
|
||||
#define ATOMIC_UINT_SIZE (4U)
|
||||
#define ATOMIC_UINT_SAME_SIZED_TYPE uint32_t
|
||||
#define ATOMIC_LONG_SIZE (4U)
|
||||
#define ATOMIC_LONG_SAME_SIZED_TYPE uint32_t
|
||||
#define ATOMIC_ULONG_SIZE (4U)
|
||||
#define ATOMIC_ULONG_SAME_SIZED_TYPE uint32_t
|
||||
#define ATOMIC_LLONG_SIZE (8U)
|
||||
#define ATOMIC_LLONG_SAME_SIZED_TYPE uint64_t
|
||||
#define ATOMIC_ULLONG_SIZE (8U)
|
||||
#define ATOMIC_ULLONG_SAME_SIZED_TYPE uint64_t
|
||||
#define ATOMIC_INT_LEAST8_T_SIZE (1U)
|
||||
#define ATOMIC_INT_LEAST8_T_SAME_SIZED_TYPE uint8_t
|
||||
#define ATOMIC_UINT_LEAST8_T_SIZE (1U)
|
||||
#define ATOMIC_UINT_LEAST8_T_SAME_SIZED_TYPE uint8_t
|
||||
#define ATOMIC_INT_LEAST16_T_SIZE (2U)
|
||||
#define ATOMIC_INT_LEAST16_T_SAME_SIZED_TYPE uint16_t
|
||||
#define ATOMIC_UINT_LEAST16_T_SIZE (2U)
|
||||
#define ATOMIC_UINT_LEAST16_T_SAME_SIZED_TYPE uint16_t
|
||||
#define ATOMIC_INT_LEAST32_T_SIZE (4U)
|
||||
#define ATOMIC_INT_LEAST32_T_SAME_SIZED_TYPE uint32_t
|
||||
#define ATOMIC_UINT_LEAST32_T_SIZE (4U)
|
||||
#define ATOMIC_UINT_LEAST32_T_SAME_SIZED_TYPE uint32_t
|
||||
#define ATOMIC_INT_LEAST64_T_SIZE (8U)
|
||||
#define ATOMIC_INT_LEAST64_T_SAME_SIZED_TYPE uint64_t
|
||||
#define ATOMIC_UINT_LEAST64_T_SIZE (8U)
|
||||
#define ATOMIC_UINT_LEAST64_T_SAME_SIZED_TYPE uint64_t
|
||||
#define ATOMIC_INT_FAST8_T_SIZE (4U)
|
||||
#define ATOMIC_INT_FAST8_T_SAME_SIZED_TYPE uint32_t
|
||||
#define ATOMIC_UINT_FAST8_T_SIZE (4U)
|
||||
#define ATOMIC_UINT_FAST8_T_SAME_SIZED_TYPE uint32_t
|
||||
#define ATOMIC_INT_FAST16_T_SIZE (4U)
|
||||
#define ATOMIC_INT_FAST16_T_SAME_SIZED_TYPE uint32_t
|
||||
#define ATOMIC_UINT_FAST16_T_SIZE (4U)
|
||||
#define ATOMIC_UINT_FAST16_T_SAME_SIZED_TYPE uint32_t
|
||||
#define ATOMIC_INT_FAST32_T_SIZE (4U)
|
||||
#define ATOMIC_INT_FAST32_T_SAME_SIZED_TYPE uint32_t
|
||||
#define ATOMIC_UINT_FAST32_T_SIZE (4U)
|
||||
#define ATOMIC_UINT_FAST32_T_SAME_SIZED_TYPE uint32_t
|
||||
#define ATOMIC_INT_FAST64_T_SIZE (8U)
|
||||
#define ATOMIC_INT_FAST64_T_SAME_SIZED_TYPE uint64_t
|
||||
#define ATOMIC_UINT_FAST64_T_SIZE (8U)
|
||||
#define ATOMIC_UINT_FAST64_T_SAME_SIZED_TYPE uint64_t
|
||||
#define ATOMIC_INTPTR_T_SIZE (4U)
|
||||
#define ATOMIC_INTPTR_T_SAME_SIZED_TYPE uint32_t
|
||||
#define ATOMIC_UINTPTR_T_SIZE (4U)
|
||||
#define ATOMIC_UINTPTR_T_SAME_SIZED_TYPE uint32_t
|
||||
#define ATOMIC_SIZE_T_SIZE (4U)
|
||||
#define ATOMIC_SIZE_T_SAME_SIZED_TYPE uint32_t
|
||||
#define ATOMIC_PTRDIFF_T_SIZE (4U)
|
||||
#define ATOMIC_PTRDIFF_T_SAME_SIZED_TYPE uint32_t
|
||||
#define ATOMIC_INTMAX_T_SIZE (8U)
|
||||
#define ATOMIC_INTMAX_T_SAME_SIZED_TYPE uint64_t
|
||||
#define ATOMIC_UINTMAX_T_SIZE (8U)
|
||||
#define ATOMIC_UINTMAX_T_SAME_SIZED_TYPE uint64_t
|
||||
71
cpu/atmega_common/include/c11_atomics_compat_cpu.hpp
Normal file
71
cpu/atmega_common/include/c11_atomics_compat_cpu.hpp
Normal file
@ -0,0 +1,71 @@
|
||||
/* This file was automatically generated using ./dist/tools/generate_c11_atomics_cpp_compat_header/generate_c11_atomics_cpp_compat_header.sh */
|
||||
#pragma once
|
||||
|
||||
#define ATOMIC_BOOL_SIZE (1U)
|
||||
#define ATOMIC_BOOL_SAME_SIZED_TYPE uint8_t
|
||||
#define ATOMIC_CHAR_SIZE (1U)
|
||||
#define ATOMIC_CHAR_SAME_SIZED_TYPE uint8_t
|
||||
#define ATOMIC_SCHAR_SIZE (1U)
|
||||
#define ATOMIC_SCHAR_SAME_SIZED_TYPE uint8_t
|
||||
#define ATOMIC_UCHAR_SIZE (1U)
|
||||
#define ATOMIC_UCHAR_SAME_SIZED_TYPE uint8_t
|
||||
#define ATOMIC_SHORT_SIZE (2U)
|
||||
#define ATOMIC_SHORT_SAME_SIZED_TYPE uint16_t
|
||||
#define ATOMIC_USHORT_SIZE (2U)
|
||||
#define ATOMIC_USHORT_SAME_SIZED_TYPE uint16_t
|
||||
#define ATOMIC_INT_SIZE (2U)
|
||||
#define ATOMIC_INT_SAME_SIZED_TYPE uint16_t
|
||||
#define ATOMIC_UINT_SIZE (2U)
|
||||
#define ATOMIC_UINT_SAME_SIZED_TYPE uint16_t
|
||||
#define ATOMIC_LONG_SIZE (4U)
|
||||
#define ATOMIC_LONG_SAME_SIZED_TYPE uint32_t
|
||||
#define ATOMIC_ULONG_SIZE (4U)
|
||||
#define ATOMIC_ULONG_SAME_SIZED_TYPE uint32_t
|
||||
#define ATOMIC_LLONG_SIZE (8U)
|
||||
#define ATOMIC_LLONG_SAME_SIZED_TYPE uint64_t
|
||||
#define ATOMIC_ULLONG_SIZE (8U)
|
||||
#define ATOMIC_ULLONG_SAME_SIZED_TYPE uint64_t
|
||||
#define ATOMIC_INT_LEAST8_T_SIZE (1U)
|
||||
#define ATOMIC_INT_LEAST8_T_SAME_SIZED_TYPE uint8_t
|
||||
#define ATOMIC_UINT_LEAST8_T_SIZE (1U)
|
||||
#define ATOMIC_UINT_LEAST8_T_SAME_SIZED_TYPE uint8_t
|
||||
#define ATOMIC_INT_LEAST16_T_SIZE (2U)
|
||||
#define ATOMIC_INT_LEAST16_T_SAME_SIZED_TYPE uint16_t
|
||||
#define ATOMIC_UINT_LEAST16_T_SIZE (2U)
|
||||
#define ATOMIC_UINT_LEAST16_T_SAME_SIZED_TYPE uint16_t
|
||||
#define ATOMIC_INT_LEAST32_T_SIZE (4U)
|
||||
#define ATOMIC_INT_LEAST32_T_SAME_SIZED_TYPE uint32_t
|
||||
#define ATOMIC_UINT_LEAST32_T_SIZE (4U)
|
||||
#define ATOMIC_UINT_LEAST32_T_SAME_SIZED_TYPE uint32_t
|
||||
#define ATOMIC_INT_LEAST64_T_SIZE (8U)
|
||||
#define ATOMIC_INT_LEAST64_T_SAME_SIZED_TYPE uint64_t
|
||||
#define ATOMIC_UINT_LEAST64_T_SIZE (8U)
|
||||
#define ATOMIC_UINT_LEAST64_T_SAME_SIZED_TYPE uint64_t
|
||||
#define ATOMIC_INT_FAST8_T_SIZE (1U)
|
||||
#define ATOMIC_INT_FAST8_T_SAME_SIZED_TYPE uint8_t
|
||||
#define ATOMIC_UINT_FAST8_T_SIZE (1U)
|
||||
#define ATOMIC_UINT_FAST8_T_SAME_SIZED_TYPE uint8_t
|
||||
#define ATOMIC_INT_FAST16_T_SIZE (2U)
|
||||
#define ATOMIC_INT_FAST16_T_SAME_SIZED_TYPE uint16_t
|
||||
#define ATOMIC_UINT_FAST16_T_SIZE (2U)
|
||||
#define ATOMIC_UINT_FAST16_T_SAME_SIZED_TYPE uint16_t
|
||||
#define ATOMIC_INT_FAST32_T_SIZE (4U)
|
||||
#define ATOMIC_INT_FAST32_T_SAME_SIZED_TYPE uint32_t
|
||||
#define ATOMIC_UINT_FAST32_T_SIZE (4U)
|
||||
#define ATOMIC_UINT_FAST32_T_SAME_SIZED_TYPE uint32_t
|
||||
#define ATOMIC_INT_FAST64_T_SIZE (8U)
|
||||
#define ATOMIC_INT_FAST64_T_SAME_SIZED_TYPE uint64_t
|
||||
#define ATOMIC_UINT_FAST64_T_SIZE (8U)
|
||||
#define ATOMIC_UINT_FAST64_T_SAME_SIZED_TYPE uint64_t
|
||||
#define ATOMIC_INTPTR_T_SIZE (2U)
|
||||
#define ATOMIC_INTPTR_T_SAME_SIZED_TYPE uint16_t
|
||||
#define ATOMIC_UINTPTR_T_SIZE (2U)
|
||||
#define ATOMIC_UINTPTR_T_SAME_SIZED_TYPE uint16_t
|
||||
#define ATOMIC_SIZE_T_SIZE (2U)
|
||||
#define ATOMIC_SIZE_T_SAME_SIZED_TYPE uint16_t
|
||||
#define ATOMIC_PTRDIFF_T_SIZE (2U)
|
||||
#define ATOMIC_PTRDIFF_T_SAME_SIZED_TYPE uint16_t
|
||||
#define ATOMIC_INTMAX_T_SIZE (8U)
|
||||
#define ATOMIC_INTMAX_T_SAME_SIZED_TYPE uint64_t
|
||||
#define ATOMIC_UINTMAX_T_SIZE (8U)
|
||||
#define ATOMIC_UINTMAX_T_SAME_SIZED_TYPE uint64_t
|
||||
9
cpu/cortexm_common/include/c11_atomics_compat_cpu.hpp
Normal file
9
cpu/cortexm_common/include/c11_atomics_compat_cpu.hpp
Normal file
@ -0,0 +1,9 @@
|
||||
#pragma once
|
||||
|
||||
#if defined(__clang__)
|
||||
#include "c11_atomics_compat_cpu/llvm.hpp"
|
||||
#elif defined(__GNUC__)
|
||||
#include "c11_atomics_compat_cpu/gcc.hpp"
|
||||
#else
|
||||
#error "No support for C11 atomics compatibility with C++ for your compiler"
|
||||
#endif
|
||||
71
cpu/cortexm_common/include/c11_atomics_compat_cpu/gcc.hpp
Normal file
71
cpu/cortexm_common/include/c11_atomics_compat_cpu/gcc.hpp
Normal file
@ -0,0 +1,71 @@
|
||||
/* This file was automatically generated using ./dist/tools/generate_c11_atomics_cpp_compat_header/generate_c11_atomics_cpp_compat_header.sh */
|
||||
#pragma once
|
||||
|
||||
#define ATOMIC_BOOL_SIZE (1U)
|
||||
#define ATOMIC_BOOL_SAME_SIZED_TYPE uint8_t
|
||||
#define ATOMIC_CHAR_SIZE (1U)
|
||||
#define ATOMIC_CHAR_SAME_SIZED_TYPE uint8_t
|
||||
#define ATOMIC_SCHAR_SIZE (1U)
|
||||
#define ATOMIC_SCHAR_SAME_SIZED_TYPE uint8_t
|
||||
#define ATOMIC_UCHAR_SIZE (1U)
|
||||
#define ATOMIC_UCHAR_SAME_SIZED_TYPE uint8_t
|
||||
#define ATOMIC_SHORT_SIZE (2U)
|
||||
#define ATOMIC_SHORT_SAME_SIZED_TYPE uint16_t
|
||||
#define ATOMIC_USHORT_SIZE (2U)
|
||||
#define ATOMIC_USHORT_SAME_SIZED_TYPE uint16_t
|
||||
#define ATOMIC_INT_SIZE (4U)
|
||||
#define ATOMIC_INT_SAME_SIZED_TYPE uint32_t
|
||||
#define ATOMIC_UINT_SIZE (4U)
|
||||
#define ATOMIC_UINT_SAME_SIZED_TYPE uint32_t
|
||||
#define ATOMIC_LONG_SIZE (4U)
|
||||
#define ATOMIC_LONG_SAME_SIZED_TYPE uint32_t
|
||||
#define ATOMIC_ULONG_SIZE (4U)
|
||||
#define ATOMIC_ULONG_SAME_SIZED_TYPE uint32_t
|
||||
#define ATOMIC_LLONG_SIZE (8U)
|
||||
#define ATOMIC_LLONG_SAME_SIZED_TYPE uint64_t
|
||||
#define ATOMIC_ULLONG_SIZE (8U)
|
||||
#define ATOMIC_ULLONG_SAME_SIZED_TYPE uint64_t
|
||||
#define ATOMIC_INT_LEAST8_T_SIZE (1U)
|
||||
#define ATOMIC_INT_LEAST8_T_SAME_SIZED_TYPE uint8_t
|
||||
#define ATOMIC_UINT_LEAST8_T_SIZE (1U)
|
||||
#define ATOMIC_UINT_LEAST8_T_SAME_SIZED_TYPE uint8_t
|
||||
#define ATOMIC_INT_LEAST16_T_SIZE (2U)
|
||||
#define ATOMIC_INT_LEAST16_T_SAME_SIZED_TYPE uint16_t
|
||||
#define ATOMIC_UINT_LEAST16_T_SIZE (2U)
|
||||
#define ATOMIC_UINT_LEAST16_T_SAME_SIZED_TYPE uint16_t
|
||||
#define ATOMIC_INT_LEAST32_T_SIZE (4U)
|
||||
#define ATOMIC_INT_LEAST32_T_SAME_SIZED_TYPE uint32_t
|
||||
#define ATOMIC_UINT_LEAST32_T_SIZE (4U)
|
||||
#define ATOMIC_UINT_LEAST32_T_SAME_SIZED_TYPE uint32_t
|
||||
#define ATOMIC_INT_LEAST64_T_SIZE (8U)
|
||||
#define ATOMIC_INT_LEAST64_T_SAME_SIZED_TYPE uint64_t
|
||||
#define ATOMIC_UINT_LEAST64_T_SIZE (8U)
|
||||
#define ATOMIC_UINT_LEAST64_T_SAME_SIZED_TYPE uint64_t
|
||||
#define ATOMIC_INT_FAST8_T_SIZE (4U)
|
||||
#define ATOMIC_INT_FAST8_T_SAME_SIZED_TYPE uint32_t
|
||||
#define ATOMIC_UINT_FAST8_T_SIZE (4U)
|
||||
#define ATOMIC_UINT_FAST8_T_SAME_SIZED_TYPE uint32_t
|
||||
#define ATOMIC_INT_FAST16_T_SIZE (4U)
|
||||
#define ATOMIC_INT_FAST16_T_SAME_SIZED_TYPE uint32_t
|
||||
#define ATOMIC_UINT_FAST16_T_SIZE (4U)
|
||||
#define ATOMIC_UINT_FAST16_T_SAME_SIZED_TYPE uint32_t
|
||||
#define ATOMIC_INT_FAST32_T_SIZE (4U)
|
||||
#define ATOMIC_INT_FAST32_T_SAME_SIZED_TYPE uint32_t
|
||||
#define ATOMIC_UINT_FAST32_T_SIZE (4U)
|
||||
#define ATOMIC_UINT_FAST32_T_SAME_SIZED_TYPE uint32_t
|
||||
#define ATOMIC_INT_FAST64_T_SIZE (8U)
|
||||
#define ATOMIC_INT_FAST64_T_SAME_SIZED_TYPE uint64_t
|
||||
#define ATOMIC_UINT_FAST64_T_SIZE (8U)
|
||||
#define ATOMIC_UINT_FAST64_T_SAME_SIZED_TYPE uint64_t
|
||||
#define ATOMIC_INTPTR_T_SIZE (4U)
|
||||
#define ATOMIC_INTPTR_T_SAME_SIZED_TYPE uint32_t
|
||||
#define ATOMIC_UINTPTR_T_SIZE (4U)
|
||||
#define ATOMIC_UINTPTR_T_SAME_SIZED_TYPE uint32_t
|
||||
#define ATOMIC_SIZE_T_SIZE (4U)
|
||||
#define ATOMIC_SIZE_T_SAME_SIZED_TYPE uint32_t
|
||||
#define ATOMIC_PTRDIFF_T_SIZE (4U)
|
||||
#define ATOMIC_PTRDIFF_T_SAME_SIZED_TYPE uint32_t
|
||||
#define ATOMIC_INTMAX_T_SIZE (8U)
|
||||
#define ATOMIC_INTMAX_T_SAME_SIZED_TYPE uint64_t
|
||||
#define ATOMIC_UINTMAX_T_SIZE (8U)
|
||||
#define ATOMIC_UINTMAX_T_SAME_SIZED_TYPE uint64_t
|
||||
71
cpu/cortexm_common/include/c11_atomics_compat_cpu/llvm.hpp
Normal file
71
cpu/cortexm_common/include/c11_atomics_compat_cpu/llvm.hpp
Normal file
@ -0,0 +1,71 @@
|
||||
/* This file was automatically generated using ./dist/tools/generate_c11_atomics_cpp_compat_header/generate_c11_atomics_cpp_compat_header.sh */
|
||||
#pragma once
|
||||
|
||||
#define ATOMIC_BOOL_SIZE (1U)
|
||||
#define ATOMIC_BOOL_SAME_SIZED_TYPE uint8_t
|
||||
#define ATOMIC_CHAR_SIZE (1U)
|
||||
#define ATOMIC_CHAR_SAME_SIZED_TYPE uint8_t
|
||||
#define ATOMIC_SCHAR_SIZE (1U)
|
||||
#define ATOMIC_SCHAR_SAME_SIZED_TYPE uint8_t
|
||||
#define ATOMIC_UCHAR_SIZE (1U)
|
||||
#define ATOMIC_UCHAR_SAME_SIZED_TYPE uint8_t
|
||||
#define ATOMIC_SHORT_SIZE (2U)
|
||||
#define ATOMIC_SHORT_SAME_SIZED_TYPE uint16_t
|
||||
#define ATOMIC_USHORT_SIZE (2U)
|
||||
#define ATOMIC_USHORT_SAME_SIZED_TYPE uint16_t
|
||||
#define ATOMIC_INT_SIZE (4U)
|
||||
#define ATOMIC_INT_SAME_SIZED_TYPE uint32_t
|
||||
#define ATOMIC_UINT_SIZE (4U)
|
||||
#define ATOMIC_UINT_SAME_SIZED_TYPE uint32_t
|
||||
#define ATOMIC_LONG_SIZE (4U)
|
||||
#define ATOMIC_LONG_SAME_SIZED_TYPE uint32_t
|
||||
#define ATOMIC_ULONG_SIZE (4U)
|
||||
#define ATOMIC_ULONG_SAME_SIZED_TYPE uint32_t
|
||||
#define ATOMIC_LLONG_SIZE (8U)
|
||||
#define ATOMIC_LLONG_SAME_SIZED_TYPE uint64_t
|
||||
#define ATOMIC_ULLONG_SIZE (8U)
|
||||
#define ATOMIC_ULLONG_SAME_SIZED_TYPE uint64_t
|
||||
#define ATOMIC_INT_LEAST8_T_SIZE (1U)
|
||||
#define ATOMIC_INT_LEAST8_T_SAME_SIZED_TYPE uint8_t
|
||||
#define ATOMIC_UINT_LEAST8_T_SIZE (1U)
|
||||
#define ATOMIC_UINT_LEAST8_T_SAME_SIZED_TYPE uint8_t
|
||||
#define ATOMIC_INT_LEAST16_T_SIZE (2U)
|
||||
#define ATOMIC_INT_LEAST16_T_SAME_SIZED_TYPE uint16_t
|
||||
#define ATOMIC_UINT_LEAST16_T_SIZE (2U)
|
||||
#define ATOMIC_UINT_LEAST16_T_SAME_SIZED_TYPE uint16_t
|
||||
#define ATOMIC_INT_LEAST32_T_SIZE (4U)
|
||||
#define ATOMIC_INT_LEAST32_T_SAME_SIZED_TYPE uint32_t
|
||||
#define ATOMIC_UINT_LEAST32_T_SIZE (4U)
|
||||
#define ATOMIC_UINT_LEAST32_T_SAME_SIZED_TYPE uint32_t
|
||||
#define ATOMIC_INT_LEAST64_T_SIZE (8U)
|
||||
#define ATOMIC_INT_LEAST64_T_SAME_SIZED_TYPE uint64_t
|
||||
#define ATOMIC_UINT_LEAST64_T_SIZE (8U)
|
||||
#define ATOMIC_UINT_LEAST64_T_SAME_SIZED_TYPE uint64_t
|
||||
#define ATOMIC_INT_FAST8_T_SIZE (1U)
|
||||
#define ATOMIC_INT_FAST8_T_SAME_SIZED_TYPE uint8_t
|
||||
#define ATOMIC_UINT_FAST8_T_SIZE (1U)
|
||||
#define ATOMIC_UINT_FAST8_T_SAME_SIZED_TYPE uint8_t
|
||||
#define ATOMIC_INT_FAST16_T_SIZE (2U)
|
||||
#define ATOMIC_INT_FAST16_T_SAME_SIZED_TYPE uint16_t
|
||||
#define ATOMIC_UINT_FAST16_T_SIZE (2U)
|
||||
#define ATOMIC_UINT_FAST16_T_SAME_SIZED_TYPE uint16_t
|
||||
#define ATOMIC_INT_FAST32_T_SIZE (4U)
|
||||
#define ATOMIC_INT_FAST32_T_SAME_SIZED_TYPE uint32_t
|
||||
#define ATOMIC_UINT_FAST32_T_SIZE (4U)
|
||||
#define ATOMIC_UINT_FAST32_T_SAME_SIZED_TYPE uint32_t
|
||||
#define ATOMIC_INT_FAST64_T_SIZE (8U)
|
||||
#define ATOMIC_INT_FAST64_T_SAME_SIZED_TYPE uint64_t
|
||||
#define ATOMIC_UINT_FAST64_T_SIZE (8U)
|
||||
#define ATOMIC_UINT_FAST64_T_SAME_SIZED_TYPE uint64_t
|
||||
#define ATOMIC_INTPTR_T_SIZE (4U)
|
||||
#define ATOMIC_INTPTR_T_SAME_SIZED_TYPE uint32_t
|
||||
#define ATOMIC_UINTPTR_T_SIZE (4U)
|
||||
#define ATOMIC_UINTPTR_T_SAME_SIZED_TYPE uint32_t
|
||||
#define ATOMIC_SIZE_T_SIZE (4U)
|
||||
#define ATOMIC_SIZE_T_SAME_SIZED_TYPE uint32_t
|
||||
#define ATOMIC_PTRDIFF_T_SIZE (4U)
|
||||
#define ATOMIC_PTRDIFF_T_SAME_SIZED_TYPE uint32_t
|
||||
#define ATOMIC_INTMAX_T_SIZE (8U)
|
||||
#define ATOMIC_INTMAX_T_SAME_SIZED_TYPE uint64_t
|
||||
#define ATOMIC_UINTMAX_T_SIZE (8U)
|
||||
#define ATOMIC_UINTMAX_T_SAME_SIZED_TYPE uint64_t
|
||||
71
cpu/esp32/include/c11_atomics_compat_cpu.hpp
Normal file
71
cpu/esp32/include/c11_atomics_compat_cpu.hpp
Normal file
@ -0,0 +1,71 @@
|
||||
/* This file was automatically generated using ./dist/tools/generate_c11_atomics_cpp_compat_header/generate_c11_atomics_cpp_compat_header.sh */
|
||||
#pragma once
|
||||
|
||||
#define ATOMIC_BOOL_SIZE (1U)
|
||||
#define ATOMIC_BOOL_SAME_SIZED_TYPE uint8_t
|
||||
#define ATOMIC_CHAR_SIZE (1U)
|
||||
#define ATOMIC_CHAR_SAME_SIZED_TYPE uint8_t
|
||||
#define ATOMIC_SCHAR_SIZE (1U)
|
||||
#define ATOMIC_SCHAR_SAME_SIZED_TYPE uint8_t
|
||||
#define ATOMIC_UCHAR_SIZE (1U)
|
||||
#define ATOMIC_UCHAR_SAME_SIZED_TYPE uint8_t
|
||||
#define ATOMIC_SHORT_SIZE (2U)
|
||||
#define ATOMIC_SHORT_SAME_SIZED_TYPE uint16_t
|
||||
#define ATOMIC_USHORT_SIZE (2U)
|
||||
#define ATOMIC_USHORT_SAME_SIZED_TYPE uint16_t
|
||||
#define ATOMIC_INT_SIZE (4U)
|
||||
#define ATOMIC_INT_SAME_SIZED_TYPE uint32_t
|
||||
#define ATOMIC_UINT_SIZE (4U)
|
||||
#define ATOMIC_UINT_SAME_SIZED_TYPE uint32_t
|
||||
#define ATOMIC_LONG_SIZE (4U)
|
||||
#define ATOMIC_LONG_SAME_SIZED_TYPE uint32_t
|
||||
#define ATOMIC_ULONG_SIZE (4U)
|
||||
#define ATOMIC_ULONG_SAME_SIZED_TYPE uint32_t
|
||||
#define ATOMIC_LLONG_SIZE (8U)
|
||||
#define ATOMIC_LLONG_SAME_SIZED_TYPE uint64_t
|
||||
#define ATOMIC_ULLONG_SIZE (8U)
|
||||
#define ATOMIC_ULLONG_SAME_SIZED_TYPE uint64_t
|
||||
#define ATOMIC_INT_LEAST8_T_SIZE (1U)
|
||||
#define ATOMIC_INT_LEAST8_T_SAME_SIZED_TYPE uint8_t
|
||||
#define ATOMIC_UINT_LEAST8_T_SIZE (1U)
|
||||
#define ATOMIC_UINT_LEAST8_T_SAME_SIZED_TYPE uint8_t
|
||||
#define ATOMIC_INT_LEAST16_T_SIZE (2U)
|
||||
#define ATOMIC_INT_LEAST16_T_SAME_SIZED_TYPE uint16_t
|
||||
#define ATOMIC_UINT_LEAST16_T_SIZE (2U)
|
||||
#define ATOMIC_UINT_LEAST16_T_SAME_SIZED_TYPE uint16_t
|
||||
#define ATOMIC_INT_LEAST32_T_SIZE (4U)
|
||||
#define ATOMIC_INT_LEAST32_T_SAME_SIZED_TYPE uint32_t
|
||||
#define ATOMIC_UINT_LEAST32_T_SIZE (4U)
|
||||
#define ATOMIC_UINT_LEAST32_T_SAME_SIZED_TYPE uint32_t
|
||||
#define ATOMIC_INT_LEAST64_T_SIZE (8U)
|
||||
#define ATOMIC_INT_LEAST64_T_SAME_SIZED_TYPE uint64_t
|
||||
#define ATOMIC_UINT_LEAST64_T_SIZE (8U)
|
||||
#define ATOMIC_UINT_LEAST64_T_SAME_SIZED_TYPE uint64_t
|
||||
#define ATOMIC_INT_FAST8_T_SIZE (4U)
|
||||
#define ATOMIC_INT_FAST8_T_SAME_SIZED_TYPE uint32_t
|
||||
#define ATOMIC_UINT_FAST8_T_SIZE (4U)
|
||||
#define ATOMIC_UINT_FAST8_T_SAME_SIZED_TYPE uint32_t
|
||||
#define ATOMIC_INT_FAST16_T_SIZE (4U)
|
||||
#define ATOMIC_INT_FAST16_T_SAME_SIZED_TYPE uint32_t
|
||||
#define ATOMIC_UINT_FAST16_T_SIZE (4U)
|
||||
#define ATOMIC_UINT_FAST16_T_SAME_SIZED_TYPE uint32_t
|
||||
#define ATOMIC_INT_FAST32_T_SIZE (4U)
|
||||
#define ATOMIC_INT_FAST32_T_SAME_SIZED_TYPE uint32_t
|
||||
#define ATOMIC_UINT_FAST32_T_SIZE (4U)
|
||||
#define ATOMIC_UINT_FAST32_T_SAME_SIZED_TYPE uint32_t
|
||||
#define ATOMIC_INT_FAST64_T_SIZE (8U)
|
||||
#define ATOMIC_INT_FAST64_T_SAME_SIZED_TYPE uint64_t
|
||||
#define ATOMIC_UINT_FAST64_T_SIZE (8U)
|
||||
#define ATOMIC_UINT_FAST64_T_SAME_SIZED_TYPE uint64_t
|
||||
#define ATOMIC_INTPTR_T_SIZE (4U)
|
||||
#define ATOMIC_INTPTR_T_SAME_SIZED_TYPE uint32_t
|
||||
#define ATOMIC_UINTPTR_T_SIZE (4U)
|
||||
#define ATOMIC_UINTPTR_T_SAME_SIZED_TYPE uint32_t
|
||||
#define ATOMIC_SIZE_T_SIZE (4U)
|
||||
#define ATOMIC_SIZE_T_SAME_SIZED_TYPE uint32_t
|
||||
#define ATOMIC_PTRDIFF_T_SIZE (4U)
|
||||
#define ATOMIC_PTRDIFF_T_SAME_SIZED_TYPE uint32_t
|
||||
#define ATOMIC_INTMAX_T_SIZE (8U)
|
||||
#define ATOMIC_INTMAX_T_SAME_SIZED_TYPE uint64_t
|
||||
#define ATOMIC_UINTMAX_T_SIZE (8U)
|
||||
#define ATOMIC_UINTMAX_T_SAME_SIZED_TYPE uint64_t
|
||||
71
cpu/esp8266/include/c11_atomics_compat_cpu.hpp
Normal file
71
cpu/esp8266/include/c11_atomics_compat_cpu.hpp
Normal file
@ -0,0 +1,71 @@
|
||||
/* This file was automatically generated using ./dist/tools/generate_c11_atomics_cpp_compat_header/generate_c11_atomics_cpp_compat_header.sh */
|
||||
#pragma once
|
||||
|
||||
#define ATOMIC_BOOL_SIZE (1U)
|
||||
#define ATOMIC_BOOL_SAME_SIZED_TYPE uint8_t
|
||||
#define ATOMIC_CHAR_SIZE (1U)
|
||||
#define ATOMIC_CHAR_SAME_SIZED_TYPE uint8_t
|
||||
#define ATOMIC_SCHAR_SIZE (1U)
|
||||
#define ATOMIC_SCHAR_SAME_SIZED_TYPE uint8_t
|
||||
#define ATOMIC_UCHAR_SIZE (1U)
|
||||
#define ATOMIC_UCHAR_SAME_SIZED_TYPE uint8_t
|
||||
#define ATOMIC_SHORT_SIZE (2U)
|
||||
#define ATOMIC_SHORT_SAME_SIZED_TYPE uint16_t
|
||||
#define ATOMIC_USHORT_SIZE (2U)
|
||||
#define ATOMIC_USHORT_SAME_SIZED_TYPE uint16_t
|
||||
#define ATOMIC_INT_SIZE (4U)
|
||||
#define ATOMIC_INT_SAME_SIZED_TYPE uint32_t
|
||||
#define ATOMIC_UINT_SIZE (4U)
|
||||
#define ATOMIC_UINT_SAME_SIZED_TYPE uint32_t
|
||||
#define ATOMIC_LONG_SIZE (4U)
|
||||
#define ATOMIC_LONG_SAME_SIZED_TYPE uint32_t
|
||||
#define ATOMIC_ULONG_SIZE (4U)
|
||||
#define ATOMIC_ULONG_SAME_SIZED_TYPE uint32_t
|
||||
#define ATOMIC_LLONG_SIZE (8U)
|
||||
#define ATOMIC_LLONG_SAME_SIZED_TYPE uint64_t
|
||||
#define ATOMIC_ULLONG_SIZE (8U)
|
||||
#define ATOMIC_ULLONG_SAME_SIZED_TYPE uint64_t
|
||||
#define ATOMIC_INT_LEAST8_T_SIZE (1U)
|
||||
#define ATOMIC_INT_LEAST8_T_SAME_SIZED_TYPE uint8_t
|
||||
#define ATOMIC_UINT_LEAST8_T_SIZE (1U)
|
||||
#define ATOMIC_UINT_LEAST8_T_SAME_SIZED_TYPE uint8_t
|
||||
#define ATOMIC_INT_LEAST16_T_SIZE (2U)
|
||||
#define ATOMIC_INT_LEAST16_T_SAME_SIZED_TYPE uint16_t
|
||||
#define ATOMIC_UINT_LEAST16_T_SIZE (2U)
|
||||
#define ATOMIC_UINT_LEAST16_T_SAME_SIZED_TYPE uint16_t
|
||||
#define ATOMIC_INT_LEAST32_T_SIZE (4U)
|
||||
#define ATOMIC_INT_LEAST32_T_SAME_SIZED_TYPE uint32_t
|
||||
#define ATOMIC_UINT_LEAST32_T_SIZE (4U)
|
||||
#define ATOMIC_UINT_LEAST32_T_SAME_SIZED_TYPE uint32_t
|
||||
#define ATOMIC_INT_LEAST64_T_SIZE (8U)
|
||||
#define ATOMIC_INT_LEAST64_T_SAME_SIZED_TYPE uint64_t
|
||||
#define ATOMIC_UINT_LEAST64_T_SIZE (8U)
|
||||
#define ATOMIC_UINT_LEAST64_T_SAME_SIZED_TYPE uint64_t
|
||||
#define ATOMIC_INT_FAST8_T_SIZE (4U)
|
||||
#define ATOMIC_INT_FAST8_T_SAME_SIZED_TYPE uint32_t
|
||||
#define ATOMIC_UINT_FAST8_T_SIZE (4U)
|
||||
#define ATOMIC_UINT_FAST8_T_SAME_SIZED_TYPE uint32_t
|
||||
#define ATOMIC_INT_FAST16_T_SIZE (4U)
|
||||
#define ATOMIC_INT_FAST16_T_SAME_SIZED_TYPE uint32_t
|
||||
#define ATOMIC_UINT_FAST16_T_SIZE (4U)
|
||||
#define ATOMIC_UINT_FAST16_T_SAME_SIZED_TYPE uint32_t
|
||||
#define ATOMIC_INT_FAST32_T_SIZE (4U)
|
||||
#define ATOMIC_INT_FAST32_T_SAME_SIZED_TYPE uint32_t
|
||||
#define ATOMIC_UINT_FAST32_T_SIZE (4U)
|
||||
#define ATOMIC_UINT_FAST32_T_SAME_SIZED_TYPE uint32_t
|
||||
#define ATOMIC_INT_FAST64_T_SIZE (8U)
|
||||
#define ATOMIC_INT_FAST64_T_SAME_SIZED_TYPE uint64_t
|
||||
#define ATOMIC_UINT_FAST64_T_SIZE (8U)
|
||||
#define ATOMIC_UINT_FAST64_T_SAME_SIZED_TYPE uint64_t
|
||||
#define ATOMIC_INTPTR_T_SIZE (4U)
|
||||
#define ATOMIC_INTPTR_T_SAME_SIZED_TYPE uint32_t
|
||||
#define ATOMIC_UINTPTR_T_SIZE (4U)
|
||||
#define ATOMIC_UINTPTR_T_SAME_SIZED_TYPE uint32_t
|
||||
#define ATOMIC_SIZE_T_SIZE (4U)
|
||||
#define ATOMIC_SIZE_T_SAME_SIZED_TYPE uint32_t
|
||||
#define ATOMIC_PTRDIFF_T_SIZE (4U)
|
||||
#define ATOMIC_PTRDIFF_T_SAME_SIZED_TYPE uint32_t
|
||||
#define ATOMIC_INTMAX_T_SIZE (8U)
|
||||
#define ATOMIC_INTMAX_T_SAME_SIZED_TYPE uint64_t
|
||||
#define ATOMIC_UINTMAX_T_SIZE (8U)
|
||||
#define ATOMIC_UINTMAX_T_SAME_SIZED_TYPE uint64_t
|
||||
71
cpu/fe310/include/c11_atomics_compat_cpu.hpp
Normal file
71
cpu/fe310/include/c11_atomics_compat_cpu.hpp
Normal file
@ -0,0 +1,71 @@
|
||||
/* This file was automatically generated using ./dist/tools/generate_c11_atomics_cpp_compat_header/generate_c11_atomics_cpp_compat_header.sh */
|
||||
#pragma once
|
||||
|
||||
#define ATOMIC_BOOL_SIZE (1U)
|
||||
#define ATOMIC_BOOL_SAME_SIZED_TYPE uint8_t
|
||||
#define ATOMIC_CHAR_SIZE (1U)
|
||||
#define ATOMIC_CHAR_SAME_SIZED_TYPE uint8_t
|
||||
#define ATOMIC_SCHAR_SIZE (1U)
|
||||
#define ATOMIC_SCHAR_SAME_SIZED_TYPE uint8_t
|
||||
#define ATOMIC_UCHAR_SIZE (1U)
|
||||
#define ATOMIC_UCHAR_SAME_SIZED_TYPE uint8_t
|
||||
#define ATOMIC_SHORT_SIZE (2U)
|
||||
#define ATOMIC_SHORT_SAME_SIZED_TYPE uint16_t
|
||||
#define ATOMIC_USHORT_SIZE (2U)
|
||||
#define ATOMIC_USHORT_SAME_SIZED_TYPE uint16_t
|
||||
#define ATOMIC_INT_SIZE (4U)
|
||||
#define ATOMIC_INT_SAME_SIZED_TYPE uint32_t
|
||||
#define ATOMIC_UINT_SIZE (4U)
|
||||
#define ATOMIC_UINT_SAME_SIZED_TYPE uint32_t
|
||||
#define ATOMIC_LONG_SIZE (4U)
|
||||
#define ATOMIC_LONG_SAME_SIZED_TYPE uint32_t
|
||||
#define ATOMIC_ULONG_SIZE (4U)
|
||||
#define ATOMIC_ULONG_SAME_SIZED_TYPE uint32_t
|
||||
#define ATOMIC_LLONG_SIZE (8U)
|
||||
#define ATOMIC_LLONG_SAME_SIZED_TYPE uint64_t
|
||||
#define ATOMIC_ULLONG_SIZE (8U)
|
||||
#define ATOMIC_ULLONG_SAME_SIZED_TYPE uint64_t
|
||||
#define ATOMIC_INT_LEAST8_T_SIZE (1U)
|
||||
#define ATOMIC_INT_LEAST8_T_SAME_SIZED_TYPE uint8_t
|
||||
#define ATOMIC_UINT_LEAST8_T_SIZE (1U)
|
||||
#define ATOMIC_UINT_LEAST8_T_SAME_SIZED_TYPE uint8_t
|
||||
#define ATOMIC_INT_LEAST16_T_SIZE (2U)
|
||||
#define ATOMIC_INT_LEAST16_T_SAME_SIZED_TYPE uint16_t
|
||||
#define ATOMIC_UINT_LEAST16_T_SIZE (2U)
|
||||
#define ATOMIC_UINT_LEAST16_T_SAME_SIZED_TYPE uint16_t
|
||||
#define ATOMIC_INT_LEAST32_T_SIZE (4U)
|
||||
#define ATOMIC_INT_LEAST32_T_SAME_SIZED_TYPE uint32_t
|
||||
#define ATOMIC_UINT_LEAST32_T_SIZE (4U)
|
||||
#define ATOMIC_UINT_LEAST32_T_SAME_SIZED_TYPE uint32_t
|
||||
#define ATOMIC_INT_LEAST64_T_SIZE (8U)
|
||||
#define ATOMIC_INT_LEAST64_T_SAME_SIZED_TYPE uint64_t
|
||||
#define ATOMIC_UINT_LEAST64_T_SIZE (8U)
|
||||
#define ATOMIC_UINT_LEAST64_T_SAME_SIZED_TYPE uint64_t
|
||||
#define ATOMIC_INT_FAST8_T_SIZE (4U)
|
||||
#define ATOMIC_INT_FAST8_T_SAME_SIZED_TYPE uint32_t
|
||||
#define ATOMIC_UINT_FAST8_T_SIZE (4U)
|
||||
#define ATOMIC_UINT_FAST8_T_SAME_SIZED_TYPE uint32_t
|
||||
#define ATOMIC_INT_FAST16_T_SIZE (4U)
|
||||
#define ATOMIC_INT_FAST16_T_SAME_SIZED_TYPE uint32_t
|
||||
#define ATOMIC_UINT_FAST16_T_SIZE (4U)
|
||||
#define ATOMIC_UINT_FAST16_T_SAME_SIZED_TYPE uint32_t
|
||||
#define ATOMIC_INT_FAST32_T_SIZE (4U)
|
||||
#define ATOMIC_INT_FAST32_T_SAME_SIZED_TYPE uint32_t
|
||||
#define ATOMIC_UINT_FAST32_T_SIZE (4U)
|
||||
#define ATOMIC_UINT_FAST32_T_SAME_SIZED_TYPE uint32_t
|
||||
#define ATOMIC_INT_FAST64_T_SIZE (8U)
|
||||
#define ATOMIC_INT_FAST64_T_SAME_SIZED_TYPE uint64_t
|
||||
#define ATOMIC_UINT_FAST64_T_SIZE (8U)
|
||||
#define ATOMIC_UINT_FAST64_T_SAME_SIZED_TYPE uint64_t
|
||||
#define ATOMIC_INTPTR_T_SIZE (4U)
|
||||
#define ATOMIC_INTPTR_T_SAME_SIZED_TYPE uint32_t
|
||||
#define ATOMIC_UINTPTR_T_SIZE (4U)
|
||||
#define ATOMIC_UINTPTR_T_SAME_SIZED_TYPE uint32_t
|
||||
#define ATOMIC_SIZE_T_SIZE (4U)
|
||||
#define ATOMIC_SIZE_T_SAME_SIZED_TYPE uint32_t
|
||||
#define ATOMIC_PTRDIFF_T_SIZE (4U)
|
||||
#define ATOMIC_PTRDIFF_T_SAME_SIZED_TYPE uint32_t
|
||||
#define ATOMIC_INTMAX_T_SIZE (8U)
|
||||
#define ATOMIC_INTMAX_T_SAME_SIZED_TYPE uint64_t
|
||||
#define ATOMIC_UINTMAX_T_SIZE (8U)
|
||||
#define ATOMIC_UINTMAX_T_SAME_SIZED_TYPE uint64_t
|
||||
71
cpu/mips32r2_common/include/c11_atomics_compat_cpu.hpp
Normal file
71
cpu/mips32r2_common/include/c11_atomics_compat_cpu.hpp
Normal file
@ -0,0 +1,71 @@
|
||||
/* This file was automatically generated using ./dist/tools/generate_c11_atomics_cpp_compat_header/generate_c11_atomics_cpp_compat_header.sh */
|
||||
#pragma once
|
||||
|
||||
#define ATOMIC_BOOL_SIZE (1U)
|
||||
#define ATOMIC_BOOL_SAME_SIZED_TYPE uint8_t
|
||||
#define ATOMIC_CHAR_SIZE (1U)
|
||||
#define ATOMIC_CHAR_SAME_SIZED_TYPE uint8_t
|
||||
#define ATOMIC_SCHAR_SIZE (1U)
|
||||
#define ATOMIC_SCHAR_SAME_SIZED_TYPE uint8_t
|
||||
#define ATOMIC_UCHAR_SIZE (1U)
|
||||
#define ATOMIC_UCHAR_SAME_SIZED_TYPE uint8_t
|
||||
#define ATOMIC_SHORT_SIZE (2U)
|
||||
#define ATOMIC_SHORT_SAME_SIZED_TYPE uint16_t
|
||||
#define ATOMIC_USHORT_SIZE (2U)
|
||||
#define ATOMIC_USHORT_SAME_SIZED_TYPE uint16_t
|
||||
#define ATOMIC_INT_SIZE (4U)
|
||||
#define ATOMIC_INT_SAME_SIZED_TYPE uint32_t
|
||||
#define ATOMIC_UINT_SIZE (4U)
|
||||
#define ATOMIC_UINT_SAME_SIZED_TYPE uint32_t
|
||||
#define ATOMIC_LONG_SIZE (4U)
|
||||
#define ATOMIC_LONG_SAME_SIZED_TYPE uint32_t
|
||||
#define ATOMIC_ULONG_SIZE (4U)
|
||||
#define ATOMIC_ULONG_SAME_SIZED_TYPE uint32_t
|
||||
#define ATOMIC_LLONG_SIZE (8U)
|
||||
#define ATOMIC_LLONG_SAME_SIZED_TYPE uint64_t
|
||||
#define ATOMIC_ULLONG_SIZE (8U)
|
||||
#define ATOMIC_ULLONG_SAME_SIZED_TYPE uint64_t
|
||||
#define ATOMIC_INT_LEAST8_T_SIZE (1U)
|
||||
#define ATOMIC_INT_LEAST8_T_SAME_SIZED_TYPE uint8_t
|
||||
#define ATOMIC_UINT_LEAST8_T_SIZE (1U)
|
||||
#define ATOMIC_UINT_LEAST8_T_SAME_SIZED_TYPE uint8_t
|
||||
#define ATOMIC_INT_LEAST16_T_SIZE (2U)
|
||||
#define ATOMIC_INT_LEAST16_T_SAME_SIZED_TYPE uint16_t
|
||||
#define ATOMIC_UINT_LEAST16_T_SIZE (2U)
|
||||
#define ATOMIC_UINT_LEAST16_T_SAME_SIZED_TYPE uint16_t
|
||||
#define ATOMIC_INT_LEAST32_T_SIZE (4U)
|
||||
#define ATOMIC_INT_LEAST32_T_SAME_SIZED_TYPE uint32_t
|
||||
#define ATOMIC_UINT_LEAST32_T_SIZE (4U)
|
||||
#define ATOMIC_UINT_LEAST32_T_SAME_SIZED_TYPE uint32_t
|
||||
#define ATOMIC_INT_LEAST64_T_SIZE (8U)
|
||||
#define ATOMIC_INT_LEAST64_T_SAME_SIZED_TYPE uint64_t
|
||||
#define ATOMIC_UINT_LEAST64_T_SIZE (8U)
|
||||
#define ATOMIC_UINT_LEAST64_T_SAME_SIZED_TYPE uint64_t
|
||||
#define ATOMIC_INT_FAST8_T_SIZE (4U)
|
||||
#define ATOMIC_INT_FAST8_T_SAME_SIZED_TYPE uint32_t
|
||||
#define ATOMIC_UINT_FAST8_T_SIZE (4U)
|
||||
#define ATOMIC_UINT_FAST8_T_SAME_SIZED_TYPE uint32_t
|
||||
#define ATOMIC_INT_FAST16_T_SIZE (4U)
|
||||
#define ATOMIC_INT_FAST16_T_SAME_SIZED_TYPE uint32_t
|
||||
#define ATOMIC_UINT_FAST16_T_SIZE (4U)
|
||||
#define ATOMIC_UINT_FAST16_T_SAME_SIZED_TYPE uint32_t
|
||||
#define ATOMIC_INT_FAST32_T_SIZE (4U)
|
||||
#define ATOMIC_INT_FAST32_T_SAME_SIZED_TYPE uint32_t
|
||||
#define ATOMIC_UINT_FAST32_T_SIZE (4U)
|
||||
#define ATOMIC_UINT_FAST32_T_SAME_SIZED_TYPE uint32_t
|
||||
#define ATOMIC_INT_FAST64_T_SIZE (8U)
|
||||
#define ATOMIC_INT_FAST64_T_SAME_SIZED_TYPE uint64_t
|
||||
#define ATOMIC_UINT_FAST64_T_SIZE (8U)
|
||||
#define ATOMIC_UINT_FAST64_T_SAME_SIZED_TYPE uint64_t
|
||||
#define ATOMIC_INTPTR_T_SIZE (4U)
|
||||
#define ATOMIC_INTPTR_T_SAME_SIZED_TYPE uint32_t
|
||||
#define ATOMIC_UINTPTR_T_SIZE (4U)
|
||||
#define ATOMIC_UINTPTR_T_SAME_SIZED_TYPE uint32_t
|
||||
#define ATOMIC_SIZE_T_SIZE (4U)
|
||||
#define ATOMIC_SIZE_T_SAME_SIZED_TYPE uint32_t
|
||||
#define ATOMIC_PTRDIFF_T_SIZE (4U)
|
||||
#define ATOMIC_PTRDIFF_T_SAME_SIZED_TYPE uint32_t
|
||||
#define ATOMIC_INTMAX_T_SIZE (8U)
|
||||
#define ATOMIC_INTMAX_T_SAME_SIZED_TYPE uint64_t
|
||||
#define ATOMIC_UINTMAX_T_SIZE (8U)
|
||||
#define ATOMIC_UINTMAX_T_SAME_SIZED_TYPE uint64_t
|
||||
71
cpu/msp430_common/include/c11_atomics_compat_cpu.hpp
Normal file
71
cpu/msp430_common/include/c11_atomics_compat_cpu.hpp
Normal file
@ -0,0 +1,71 @@
|
||||
/* This file was automatically generated using ./dist/tools/generate_c11_atomics_cpp_compat_header/generate_c11_atomics_cpp_compat_header.sh */
|
||||
#pragma once
|
||||
|
||||
#define ATOMIC_BOOL_SIZE (2U)
|
||||
#define ATOMIC_BOOL_SAME_SIZED_TYPE uint16_t
|
||||
#define ATOMIC_CHAR_SIZE (2U)
|
||||
#define ATOMIC_CHAR_SAME_SIZED_TYPE uint16_t
|
||||
#define ATOMIC_SCHAR_SIZE (2U)
|
||||
#define ATOMIC_SCHAR_SAME_SIZED_TYPE uint16_t
|
||||
#define ATOMIC_UCHAR_SIZE (2U)
|
||||
#define ATOMIC_UCHAR_SAME_SIZED_TYPE uint16_t
|
||||
#define ATOMIC_SHORT_SIZE (2U)
|
||||
#define ATOMIC_SHORT_SAME_SIZED_TYPE uint16_t
|
||||
#define ATOMIC_USHORT_SIZE (2U)
|
||||
#define ATOMIC_USHORT_SAME_SIZED_TYPE uint16_t
|
||||
#define ATOMIC_INT_SIZE (2U)
|
||||
#define ATOMIC_INT_SAME_SIZED_TYPE uint16_t
|
||||
#define ATOMIC_UINT_SIZE (2U)
|
||||
#define ATOMIC_UINT_SAME_SIZED_TYPE uint16_t
|
||||
#define ATOMIC_LONG_SIZE (4U)
|
||||
#define ATOMIC_LONG_SAME_SIZED_TYPE uint32_t
|
||||
#define ATOMIC_ULONG_SIZE (4U)
|
||||
#define ATOMIC_ULONG_SAME_SIZED_TYPE uint32_t
|
||||
#define ATOMIC_LLONG_SIZE (8U)
|
||||
#define ATOMIC_LLONG_SAME_SIZED_TYPE uint64_t
|
||||
#define ATOMIC_ULLONG_SIZE (8U)
|
||||
#define ATOMIC_ULLONG_SAME_SIZED_TYPE uint64_t
|
||||
#define ATOMIC_INT_LEAST8_T_SIZE (2U)
|
||||
#define ATOMIC_INT_LEAST8_T_SAME_SIZED_TYPE uint16_t
|
||||
#define ATOMIC_UINT_LEAST8_T_SIZE (2U)
|
||||
#define ATOMIC_UINT_LEAST8_T_SAME_SIZED_TYPE uint16_t
|
||||
#define ATOMIC_INT_LEAST16_T_SIZE (2U)
|
||||
#define ATOMIC_INT_LEAST16_T_SAME_SIZED_TYPE uint16_t
|
||||
#define ATOMIC_UINT_LEAST16_T_SIZE (2U)
|
||||
#define ATOMIC_UINT_LEAST16_T_SAME_SIZED_TYPE uint16_t
|
||||
#define ATOMIC_INT_LEAST32_T_SIZE (4U)
|
||||
#define ATOMIC_INT_LEAST32_T_SAME_SIZED_TYPE uint32_t
|
||||
#define ATOMIC_UINT_LEAST32_T_SIZE (4U)
|
||||
#define ATOMIC_UINT_LEAST32_T_SAME_SIZED_TYPE uint32_t
|
||||
#define ATOMIC_INT_LEAST64_T_SIZE (8U)
|
||||
#define ATOMIC_INT_LEAST64_T_SAME_SIZED_TYPE uint64_t
|
||||
#define ATOMIC_UINT_LEAST64_T_SIZE (8U)
|
||||
#define ATOMIC_UINT_LEAST64_T_SAME_SIZED_TYPE uint64_t
|
||||
#define ATOMIC_INT_FAST8_T_SIZE (2U)
|
||||
#define ATOMIC_INT_FAST8_T_SAME_SIZED_TYPE uint16_t
|
||||
#define ATOMIC_UINT_FAST8_T_SIZE (2U)
|
||||
#define ATOMIC_UINT_FAST8_T_SAME_SIZED_TYPE uint16_t
|
||||
#define ATOMIC_INT_FAST16_T_SIZE (2U)
|
||||
#define ATOMIC_INT_FAST16_T_SAME_SIZED_TYPE uint16_t
|
||||
#define ATOMIC_UINT_FAST16_T_SIZE (2U)
|
||||
#define ATOMIC_UINT_FAST16_T_SAME_SIZED_TYPE uint16_t
|
||||
#define ATOMIC_INT_FAST32_T_SIZE (4U)
|
||||
#define ATOMIC_INT_FAST32_T_SAME_SIZED_TYPE uint32_t
|
||||
#define ATOMIC_UINT_FAST32_T_SIZE (4U)
|
||||
#define ATOMIC_UINT_FAST32_T_SAME_SIZED_TYPE uint32_t
|
||||
#define ATOMIC_INT_FAST64_T_SIZE (8U)
|
||||
#define ATOMIC_INT_FAST64_T_SAME_SIZED_TYPE uint64_t
|
||||
#define ATOMIC_UINT_FAST64_T_SIZE (8U)
|
||||
#define ATOMIC_UINT_FAST64_T_SAME_SIZED_TYPE uint64_t
|
||||
#define ATOMIC_INTPTR_T_SIZE (2U)
|
||||
#define ATOMIC_INTPTR_T_SAME_SIZED_TYPE uint16_t
|
||||
#define ATOMIC_UINTPTR_T_SIZE (2U)
|
||||
#define ATOMIC_UINTPTR_T_SAME_SIZED_TYPE uint16_t
|
||||
#define ATOMIC_SIZE_T_SIZE (2U)
|
||||
#define ATOMIC_SIZE_T_SAME_SIZED_TYPE uint16_t
|
||||
#define ATOMIC_PTRDIFF_T_SIZE (4U)
|
||||
#define ATOMIC_PTRDIFF_T_SAME_SIZED_TYPE uint32_t
|
||||
#define ATOMIC_INTMAX_T_SIZE (8U)
|
||||
#define ATOMIC_INTMAX_T_SAME_SIZED_TYPE uint64_t
|
||||
#define ATOMIC_UINTMAX_T_SIZE (8U)
|
||||
#define ATOMIC_UINTMAX_T_SAME_SIZED_TYPE uint64_t
|
||||
71
cpu/native/include/c11_atomics_compat_cpu.hpp
Normal file
71
cpu/native/include/c11_atomics_compat_cpu.hpp
Normal file
@ -0,0 +1,71 @@
|
||||
/* This file was automatically generated using ./dist/tools/generate_c11_atomics_cpp_compat_header/generate_c11_atomics_cpp_compat_header.sh */
|
||||
#pragma once
|
||||
|
||||
#define ATOMIC_BOOL_SIZE (1U)
|
||||
#define ATOMIC_BOOL_SAME_SIZED_TYPE uint8_t
|
||||
#define ATOMIC_CHAR_SIZE (1U)
|
||||
#define ATOMIC_CHAR_SAME_SIZED_TYPE uint8_t
|
||||
#define ATOMIC_SCHAR_SIZE (1U)
|
||||
#define ATOMIC_SCHAR_SAME_SIZED_TYPE uint8_t
|
||||
#define ATOMIC_UCHAR_SIZE (1U)
|
||||
#define ATOMIC_UCHAR_SAME_SIZED_TYPE uint8_t
|
||||
#define ATOMIC_SHORT_SIZE (2U)
|
||||
#define ATOMIC_SHORT_SAME_SIZED_TYPE uint16_t
|
||||
#define ATOMIC_USHORT_SIZE (2U)
|
||||
#define ATOMIC_USHORT_SAME_SIZED_TYPE uint16_t
|
||||
#define ATOMIC_INT_SIZE (4U)
|
||||
#define ATOMIC_INT_SAME_SIZED_TYPE uint32_t
|
||||
#define ATOMIC_UINT_SIZE (4U)
|
||||
#define ATOMIC_UINT_SAME_SIZED_TYPE uint32_t
|
||||
#define ATOMIC_LONG_SIZE (4U)
|
||||
#define ATOMIC_LONG_SAME_SIZED_TYPE uint32_t
|
||||
#define ATOMIC_ULONG_SIZE (4U)
|
||||
#define ATOMIC_ULONG_SAME_SIZED_TYPE uint32_t
|
||||
#define ATOMIC_LLONG_SIZE (8U)
|
||||
#define ATOMIC_LLONG_SAME_SIZED_TYPE uint64_t
|
||||
#define ATOMIC_ULLONG_SIZE (8U)
|
||||
#define ATOMIC_ULLONG_SAME_SIZED_TYPE uint64_t
|
||||
#define ATOMIC_INT_LEAST8_T_SIZE (1U)
|
||||
#define ATOMIC_INT_LEAST8_T_SAME_SIZED_TYPE uint8_t
|
||||
#define ATOMIC_UINT_LEAST8_T_SIZE (1U)
|
||||
#define ATOMIC_UINT_LEAST8_T_SAME_SIZED_TYPE uint8_t
|
||||
#define ATOMIC_INT_LEAST16_T_SIZE (2U)
|
||||
#define ATOMIC_INT_LEAST16_T_SAME_SIZED_TYPE uint16_t
|
||||
#define ATOMIC_UINT_LEAST16_T_SIZE (2U)
|
||||
#define ATOMIC_UINT_LEAST16_T_SAME_SIZED_TYPE uint16_t
|
||||
#define ATOMIC_INT_LEAST32_T_SIZE (4U)
|
||||
#define ATOMIC_INT_LEAST32_T_SAME_SIZED_TYPE uint32_t
|
||||
#define ATOMIC_UINT_LEAST32_T_SIZE (4U)
|
||||
#define ATOMIC_UINT_LEAST32_T_SAME_SIZED_TYPE uint32_t
|
||||
#define ATOMIC_INT_LEAST64_T_SIZE (8U)
|
||||
#define ATOMIC_INT_LEAST64_T_SAME_SIZED_TYPE uint64_t
|
||||
#define ATOMIC_UINT_LEAST64_T_SIZE (8U)
|
||||
#define ATOMIC_UINT_LEAST64_T_SAME_SIZED_TYPE uint64_t
|
||||
#define ATOMIC_INT_FAST8_T_SIZE (1U)
|
||||
#define ATOMIC_INT_FAST8_T_SAME_SIZED_TYPE uint8_t
|
||||
#define ATOMIC_UINT_FAST8_T_SIZE (1U)
|
||||
#define ATOMIC_UINT_FAST8_T_SAME_SIZED_TYPE uint8_t
|
||||
#define ATOMIC_INT_FAST16_T_SIZE (4U)
|
||||
#define ATOMIC_INT_FAST16_T_SAME_SIZED_TYPE uint32_t
|
||||
#define ATOMIC_UINT_FAST16_T_SIZE (4U)
|
||||
#define ATOMIC_UINT_FAST16_T_SAME_SIZED_TYPE uint32_t
|
||||
#define ATOMIC_INT_FAST32_T_SIZE (4U)
|
||||
#define ATOMIC_INT_FAST32_T_SAME_SIZED_TYPE uint32_t
|
||||
#define ATOMIC_UINT_FAST32_T_SIZE (4U)
|
||||
#define ATOMIC_UINT_FAST32_T_SAME_SIZED_TYPE uint32_t
|
||||
#define ATOMIC_INT_FAST64_T_SIZE (8U)
|
||||
#define ATOMIC_INT_FAST64_T_SAME_SIZED_TYPE uint64_t
|
||||
#define ATOMIC_UINT_FAST64_T_SIZE (8U)
|
||||
#define ATOMIC_UINT_FAST64_T_SAME_SIZED_TYPE uint64_t
|
||||
#define ATOMIC_INTPTR_T_SIZE (4U)
|
||||
#define ATOMIC_INTPTR_T_SAME_SIZED_TYPE uint32_t
|
||||
#define ATOMIC_UINTPTR_T_SIZE (4U)
|
||||
#define ATOMIC_UINTPTR_T_SAME_SIZED_TYPE uint32_t
|
||||
#define ATOMIC_SIZE_T_SIZE (4U)
|
||||
#define ATOMIC_SIZE_T_SAME_SIZED_TYPE uint32_t
|
||||
#define ATOMIC_PTRDIFF_T_SIZE (8U)
|
||||
#define ATOMIC_PTRDIFF_T_SAME_SIZED_TYPE uint64_t
|
||||
#define ATOMIC_INTMAX_T_SIZE (8U)
|
||||
#define ATOMIC_INTMAX_T_SAME_SIZED_TYPE uint64_t
|
||||
#define ATOMIC_UINTMAX_T_SIZE (8U)
|
||||
#define ATOMIC_UINTMAX_T_SAME_SIZED_TYPE uint64_t
|
||||
44
dist/tools/generate_c11_atomics_cpp_compat_header/README.md
vendored
Normal file
44
dist/tools/generate_c11_atomics_cpp_compat_header/README.md
vendored
Normal file
@ -0,0 +1,44 @@
|
||||
# Usage
|
||||
|
||||
./generate_c11_atomics_cpp_compat_header.sh [CC [CFLAGS]]
|
||||
|
||||
## Parameter CC
|
||||
|
||||
The C compiler to use to determine the size of the C11 atomics types. If not
|
||||
given, the environment variable CC is used instead.
|
||||
|
||||
## Parameter CFLAGS
|
||||
|
||||
The CFLAGS to pass to the C compiler during determination of the size of the
|
||||
C11 atomic types. If not given, the environment variable CFLAGS is used instead.
|
||||
|
||||
# Output
|
||||
|
||||
The script will write the sizes of each type defined in C11 atomics and which
|
||||
`uint<NUM>_t` type has the same size as the atomic type. Note that C11 allows
|
||||
to prefix any type with the `_Atomic` specifier to get an atomic version of it.
|
||||
This script will only generate entries for the default `typedef`ed types like
|
||||
`atomic_bool`, `atomic_int`, or `atomic_int_least16_t`.
|
||||
|
||||
The output will look like this:
|
||||
|
||||
``` C++
|
||||
/* This file was automatically generated using ./dist/tools/generate_c11_atomics_cpp_compat_header/generate_c11_atomics_cpp_compat_header.sh /*
|
||||
#pragma once
|
||||
|
||||
#define ATOMIC_BOOL_SIZE (1U)
|
||||
#define ATOMIC_BOOL_SAME_SIZED_TYPE uint8_t
|
||||
#define ATOMIC_CHAR_SIZE (1U)
|
||||
#define ATOMIC_CHAR_SAME_SIZED_TYPE uint8_t
|
||||
#define ATOMIC_SCHAR_SIZE (1U)
|
||||
#define ATOMIC_SCHAR_SAME_SIZED_TYPE uint8_t
|
||||
#define ATOMIC_UCHAR_SIZE (1U)
|
||||
#define ATOMIC_UCHAR_SAME_SIZED_TYPE uint8_t
|
||||
#define ATOMIC_SHORT_SIZE (2U)
|
||||
#define ATOMIC_SHORT_SAME_SIZED_TYPE uint16_t
|
||||
#define ATOMIC_USHORT_SIZE (2U)
|
||||
#define ATOMIC_USHORT_SAME_SIZED_TYPE uint16_t
|
||||
#define ATOMIC_INT_SIZE (4U)
|
||||
#define ATOMIC_INT_SAME_SIZED_TYPE uint32_t
|
||||
...
|
||||
```
|
||||
137
dist/tools/generate_c11_atomics_cpp_compat_header/generate_c11_atomics_cpp_compat_header.sh
vendored
Executable file
137
dist/tools/generate_c11_atomics_cpp_compat_header/generate_c11_atomics_cpp_compat_header.sh
vendored
Executable file
@ -0,0 +1,137 @@
|
||||
#!/bin/sh
|
||||
|
||||
TESTFILE=/tmp/riot_are_types_of_same_size_compilation_check.c
|
||||
|
||||
ATOMIC_TYPES="
|
||||
atomic_bool
|
||||
atomic_char
|
||||
atomic_schar
|
||||
atomic_uchar
|
||||
atomic_short
|
||||
atomic_ushort
|
||||
atomic_int
|
||||
atomic_uint
|
||||
atomic_long
|
||||
atomic_ulong
|
||||
atomic_llong
|
||||
atomic_ullong
|
||||
atomic_int_least8_t
|
||||
atomic_uint_least8_t
|
||||
atomic_int_least16_t
|
||||
atomic_uint_least16_t
|
||||
atomic_int_least32_t
|
||||
atomic_uint_least32_t
|
||||
atomic_int_least64_t
|
||||
atomic_uint_least64_t
|
||||
atomic_int_fast8_t
|
||||
atomic_uint_fast8_t
|
||||
atomic_int_fast16_t
|
||||
atomic_uint_fast16_t
|
||||
atomic_int_fast32_t
|
||||
atomic_uint_fast32_t
|
||||
atomic_int_fast64_t
|
||||
atomic_uint_fast64_t
|
||||
atomic_intptr_t
|
||||
atomic_uintptr_t
|
||||
atomic_size_t
|
||||
atomic_ptrdiff_t
|
||||
atomic_intmax_t
|
||||
atomic_uintmax_t
|
||||
"
|
||||
|
||||
are_types_of_same_size() {
|
||||
cat > $TESTFILE << EOF
|
||||
#include <stdint.h>
|
||||
#ifdef __msp430__
|
||||
#include <sys/cdefs.h>
|
||||
#endif
|
||||
#include <stdatomic.h>
|
||||
int main(void) {
|
||||
_Static_assert(sizeof($1) == sizeof($2), "Assert types are equally sized");
|
||||
return 0;
|
||||
}
|
||||
EOF
|
||||
$CC $CFLAGS -o /dev/null -c $TESTFILE 2> /dev/null > /dev/null
|
||||
}
|
||||
|
||||
get_size() {
|
||||
if $(are_types_of_same_size $1 uint8_t); then
|
||||
echo "1"
|
||||
return
|
||||
fi
|
||||
|
||||
if $(are_types_of_same_size $1 uint16_t); then
|
||||
echo "2"
|
||||
return
|
||||
fi
|
||||
|
||||
if $(are_types_of_same_size $1 uint32_t); then
|
||||
echo "4"
|
||||
return
|
||||
fi
|
||||
|
||||
if $(are_types_of_same_size $1 uint64_t); then
|
||||
echo "8"
|
||||
return
|
||||
fi
|
||||
|
||||
echo "Failed to determine size of $1"
|
||||
exit 1
|
||||
}
|
||||
|
||||
get_same_sized_type() {
|
||||
if $(are_types_of_same_size $1 uint8_t); then
|
||||
echo "uint8_t"
|
||||
return
|
||||
fi
|
||||
|
||||
if $(are_types_of_same_size $1 uint16_t); then
|
||||
echo "uint16_t"
|
||||
return
|
||||
fi
|
||||
|
||||
if $(are_types_of_same_size $1 uint32_t); then
|
||||
echo "uint32_t"
|
||||
return
|
||||
fi
|
||||
|
||||
if $(are_types_of_same_size $1 uint64_t); then
|
||||
echo "uint64_t"
|
||||
return
|
||||
fi
|
||||
|
||||
echo "Failed to determine same sized type for $1"
|
||||
exit 1
|
||||
}
|
||||
|
||||
print_defines() {
|
||||
printf "#define %-48s(%sU)\n" "$(echo $1 | tr [a-z] [A-Z])_SIZE" "$(get_size $1)"
|
||||
printf "#define %-48s%s\n" "$(echo $1 | tr [a-z] [A-Z])_SAME_SIZED_TYPE" "$(get_same_sized_type $1)"
|
||||
}
|
||||
|
||||
if [ $# -ge 1 ]; then
|
||||
if [ "$1" = "-h" ] || [ "$1" = "--help" ]; then
|
||||
echo "Usage: $0 [CC [CFLAGS]]"
|
||||
echo "See README.md for more details"
|
||||
exit 1
|
||||
fi
|
||||
CC="$1"
|
||||
fi
|
||||
|
||||
if [ $# -ge 2 ]; then
|
||||
CFLAGS="$2"
|
||||
fi
|
||||
|
||||
if [ -z "$CC" ]; then
|
||||
echo "C compiler needs to be specified either as environment variable, or"
|
||||
echo "as first argument. See README.md for documentation."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "/* This file was automatically generated using $0 */"
|
||||
echo "#pragma once"
|
||||
echo
|
||||
|
||||
for atomic_type in $ATOMIC_TYPES; do
|
||||
print_defines $atomic_type
|
||||
done
|
||||
437
sys/include/c11_atomics_compat.hpp
Normal file
437
sys/include/c11_atomics_compat.hpp
Normal file
@ -0,0 +1,437 @@
|
||||
/*
|
||||
* Copyright (C) 2019 Otto-von-Guericke-Universität Magdeburg
|
||||
*
|
||||
* This file is subject to the terms and conditions of the GNU Lesser
|
||||
* General Public License v2.1. See the file LICENSE in the top level
|
||||
* directory for more details.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @defgroup sys_c11_atomics_cpp_compat C++ compatibility with C11 atomics
|
||||
* @ingroup sys
|
||||
* @brief C++ compatibility of default C11 atomics types
|
||||
*
|
||||
* This module provides opaque `typedef`s for each standard C11 atomic type with
|
||||
* the same size and alignment requirements. The contents of types are not
|
||||
* accessible to C++ code, but this allows `struct`s to be defined with the
|
||||
* same memory layout as the C version, so that they can be allocated from C++.
|
||||
*
|
||||
* @{
|
||||
*
|
||||
* @file
|
||||
* @brief C++ compatibility of default C11 atomics types
|
||||
*
|
||||
* @author Marian Buschsieweke <marian.buschsieweke@ovgu.de>
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "c11_atomics_compat_cpu.hpp"
|
||||
|
||||
/**
|
||||
* @brief Initialize an atomic variable
|
||||
*
|
||||
* Usage (same syntax as the real C11 atomic initializer):
|
||||
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
* atomic_int foo = ATOMIC_VAR_INIT(42);
|
||||
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
*/
|
||||
#define ATOMIC_VAR_INIT(x) { x }
|
||||
|
||||
/**
|
||||
* @brief Type with the same alignment and size as `atomic_bool`
|
||||
*/
|
||||
typedef struct {
|
||||
/**
|
||||
* @brief Opaque content placeholder
|
||||
*
|
||||
* Access only for initializing from C++
|
||||
*/
|
||||
ATOMIC_BOOL_SAME_SIZED_TYPE do_not_access_from_cpp;
|
||||
} atomic_bool;
|
||||
|
||||
/**
|
||||
* @brief Type with the same alignment and size as `atomic_char`
|
||||
*/
|
||||
typedef struct {
|
||||
/**
|
||||
* @brief Opaque content placeholder
|
||||
*
|
||||
* Access only for initializing from C++
|
||||
*/
|
||||
ATOMIC_CHAR_SAME_SIZED_TYPE do_not_access_from_cpp;
|
||||
} atomic_char;
|
||||
|
||||
/**
|
||||
* @brief Type with the same alignment and size as `atomic_schar`
|
||||
*/
|
||||
typedef struct {
|
||||
/**
|
||||
* @brief Opaque content placeholder
|
||||
*
|
||||
* Access only for initializing from C++
|
||||
*/
|
||||
ATOMIC_SCHAR_SAME_SIZED_TYPE do_not_access_from_cpp;
|
||||
} atomic_schar;
|
||||
|
||||
/**
|
||||
* @brief Type with the same alignment and size as `atomic_uchar`
|
||||
*/
|
||||
typedef struct {
|
||||
/**
|
||||
* @brief Opaque content placeholder
|
||||
*
|
||||
* Access only for initializing from C++
|
||||
*/
|
||||
ATOMIC_UCHAR_SAME_SIZED_TYPE do_not_access_from_cpp;
|
||||
} atomic_uchar;
|
||||
|
||||
/**
|
||||
* @brief Type with the same alignment and size as `atomic_short`
|
||||
*/
|
||||
typedef struct {
|
||||
/**
|
||||
* @brief Opaque content placeholder
|
||||
*
|
||||
* Access only for initializing from C++
|
||||
*/
|
||||
ATOMIC_SHORT_SAME_SIZED_TYPE do_not_access_from_cpp;
|
||||
} atomic_short;
|
||||
|
||||
/**
|
||||
* @brief Type with the same alignment and size as `atomic_ushort`
|
||||
*/
|
||||
typedef struct {
|
||||
/**
|
||||
* @brief Opaque content placeholder
|
||||
*
|
||||
* Access only for initializing from C++
|
||||
*/
|
||||
ATOMIC_USHORT_SAME_SIZED_TYPE do_not_access_from_cpp;
|
||||
} atomic_ushort;
|
||||
|
||||
/**
|
||||
* @brief Type with the same alignment and size as `atomic_int`
|
||||
*/
|
||||
typedef struct {
|
||||
/**
|
||||
* @brief Opaque content placeholder
|
||||
*
|
||||
* Access only for initializing from C++
|
||||
*/
|
||||
ATOMIC_INT_SAME_SIZED_TYPE do_not_access_from_cpp;
|
||||
} atomic_int;
|
||||
|
||||
/**
|
||||
* @brief Type with the same alignment and size as `atomic_uint`
|
||||
*/
|
||||
typedef struct {
|
||||
/**
|
||||
* @brief Opaque content placeholder
|
||||
*
|
||||
* Access only for initializing from C++
|
||||
*/
|
||||
ATOMIC_UINT_SAME_SIZED_TYPE do_not_access_from_cpp;
|
||||
} atomic_uint;
|
||||
|
||||
/**
|
||||
* @brief Type with the same alignment and size as `atomic_long`
|
||||
*/
|
||||
typedef struct {
|
||||
/**
|
||||
* @brief Opaque content placeholder
|
||||
*
|
||||
* Access only for initializing from C++
|
||||
*/
|
||||
ATOMIC_LONG_SAME_SIZED_TYPE do_not_access_from_cpp;
|
||||
} atomic_long;
|
||||
|
||||
/**
|
||||
* @brief Type with the same alignment and size as `atomic_ulong`
|
||||
*/
|
||||
typedef struct {
|
||||
/**
|
||||
* @brief Opaque content placeholder
|
||||
*
|
||||
* Access only for initializing from C++
|
||||
*/
|
||||
ATOMIC_ULONG_SAME_SIZED_TYPE do_not_access_from_cpp;
|
||||
} atomic_ulong;
|
||||
|
||||
/**
|
||||
* @brief Type with the same alignment and size as `atomic_llong`
|
||||
*/
|
||||
typedef struct {
|
||||
/**
|
||||
* @brief Opaque content placeholder
|
||||
*
|
||||
* Access only for initializing from C++
|
||||
*/
|
||||
ATOMIC_LLONG_SAME_SIZED_TYPE do_not_access_from_cpp;
|
||||
} atomic_llong;
|
||||
|
||||
/**
|
||||
* @brief Type with the same alignment and size as `atomic_ullong`
|
||||
*/
|
||||
typedef struct {
|
||||
/**
|
||||
* @brief Opaque content placeholder
|
||||
*
|
||||
* Access only for initializing from C++
|
||||
*/
|
||||
ATOMIC_ULLONG_SAME_SIZED_TYPE do_not_access_from_cpp;
|
||||
} atomic_ullong;
|
||||
|
||||
/**
|
||||
* @brief Type with the same alignment and size as `atomic_int_least8_t`
|
||||
*/
|
||||
typedef struct {
|
||||
/**
|
||||
* @brief Opaque content placeholder
|
||||
*
|
||||
* Access only for initializing from C++
|
||||
*/
|
||||
ATOMIC_INT_LEAST8_T_SAME_SIZED_TYPE do_not_access_from_cpp;
|
||||
} atomic_int_least8_t;
|
||||
|
||||
/**
|
||||
* @brief Type with the same alignment and size as `atomic_uint_least8_t`
|
||||
*/
|
||||
typedef struct {
|
||||
/**
|
||||
* @brief Opaque content placeholder
|
||||
*
|
||||
* Access only for initializing from C++
|
||||
*/
|
||||
ATOMIC_UINT_LEAST8_T_SAME_SIZED_TYPE do_not_access_from_cpp;
|
||||
} atomic_uint_least8_t;
|
||||
|
||||
/**
|
||||
* @brief Type with the same alignment and size as `atomic_int_least16_t`
|
||||
*/
|
||||
typedef struct {
|
||||
/**
|
||||
* @brief Opaque content placeholder
|
||||
*
|
||||
* Access only for initializing from C++
|
||||
*/
|
||||
ATOMIC_INT_LEAST16_T_SAME_SIZED_TYPE do_not_access_from_cpp;
|
||||
} atomic_int_least16_t;
|
||||
|
||||
/**
|
||||
* @brief Type with the same alignment and size as `atomic_uint_least16_t`
|
||||
*/
|
||||
typedef struct {
|
||||
/**
|
||||
* @brief Opaque content placeholder
|
||||
*
|
||||
* Access only for initializing from C++
|
||||
*/
|
||||
ATOMIC_UINT_LEAST16_T_SAME_SIZED_TYPE do_not_access_from_cpp;
|
||||
} atomic_uint_least16_t;
|
||||
|
||||
/**
|
||||
* @brief Type with the same alignment and size as `atomic_int_least32_t`
|
||||
*/
|
||||
typedef struct {
|
||||
/**
|
||||
* @brief Opaque content placeholder
|
||||
*
|
||||
* Access only for initializing from C++
|
||||
*/
|
||||
ATOMIC_INT_LEAST32_T_SAME_SIZED_TYPE do_not_access_from_cpp;
|
||||
} atomic_int_least32_t;
|
||||
|
||||
/**
|
||||
* @brief Type with the same alignment and size as `atomic_uint_least32_t`
|
||||
*/
|
||||
typedef struct {
|
||||
/**
|
||||
* @brief Opaque content placeholder
|
||||
*
|
||||
* Access only for initializing from C++
|
||||
*/
|
||||
ATOMIC_UINT_LEAST32_T_SAME_SIZED_TYPE do_not_access_from_cpp;
|
||||
} atomic_uint_least32_t;
|
||||
|
||||
/**
|
||||
* @brief Type with the same alignment and size as `atomic_int_least64_t`
|
||||
*/
|
||||
typedef struct {
|
||||
/**
|
||||
* @brief Opaque content placeholder
|
||||
*
|
||||
* Access only for initializing from C++
|
||||
*/
|
||||
ATOMIC_INT_LEAST64_T_SAME_SIZED_TYPE do_not_access_from_cpp;
|
||||
} atomic_int_least64_t;
|
||||
|
||||
/**
|
||||
* @brief Type with the same alignment and size as `atomic_uint_least64_t`
|
||||
*/
|
||||
typedef struct {
|
||||
/**
|
||||
* @brief Opaque content placeholder
|
||||
*
|
||||
* Access only for initializing from C++
|
||||
*/
|
||||
ATOMIC_UINT_LEAST64_T_SAME_SIZED_TYPE do_not_access_from_cpp;
|
||||
} atomic_uint_least64_t;
|
||||
|
||||
/**
|
||||
* @brief Type with the same alignment and size as `atomic_int_fast8_t`
|
||||
*/
|
||||
typedef struct {
|
||||
/**
|
||||
* @brief Opaque content placeholder
|
||||
*
|
||||
* Access only for initializing from C++
|
||||
*/
|
||||
ATOMIC_INT_FAST8_T_SAME_SIZED_TYPE do_not_access_from_cpp;
|
||||
} atomic_int_fast8_t;
|
||||
|
||||
/**
|
||||
* @brief Type with the same alignment and size as `atomic_uint_fast8_t`
|
||||
*/
|
||||
typedef struct {
|
||||
/**
|
||||
* @brief Opaque content placeholder
|
||||
*
|
||||
* Access only for initializing from C++
|
||||
*/
|
||||
ATOMIC_UINT_FAST8_T_SAME_SIZED_TYPE do_not_access_from_cpp;
|
||||
} atomic_uint_fast8_t;
|
||||
|
||||
/**
|
||||
* @brief Type with the same alignment and size as `atomic_int_fast16_t`
|
||||
*/
|
||||
typedef struct {
|
||||
/**
|
||||
* @brief Opaque content placeholder
|
||||
*
|
||||
* Access only for initializing from C++
|
||||
*/
|
||||
ATOMIC_INT_FAST16_T_SAME_SIZED_TYPE do_not_access_from_cpp;
|
||||
} atomic_int_fast16_t;
|
||||
|
||||
/**
|
||||
* @brief Type with the same alignment and size as `atomic_uint_fast16_t`
|
||||
*/
|
||||
typedef struct {
|
||||
/**
|
||||
* @brief Opaque content placeholder
|
||||
*
|
||||
* Access only for initializing from C++
|
||||
*/
|
||||
ATOMIC_UINT_FAST16_T_SAME_SIZED_TYPE do_not_access_from_cpp;
|
||||
} atomic_uint_fast16_t;
|
||||
|
||||
/**
|
||||
* @brief Type with the same alignment and size as `atomic_int_fast32_t`
|
||||
*/
|
||||
typedef struct {
|
||||
/**
|
||||
* @brief Opaque content placeholder
|
||||
*
|
||||
* Access only for initializing from C++
|
||||
*/
|
||||
ATOMIC_INT_FAST32_T_SAME_SIZED_TYPE do_not_access_from_cpp;
|
||||
} atomic_int_fast32_t;
|
||||
|
||||
/**
|
||||
* @brief Type with the same alignment and size as `atomic_uint_fast32_t`
|
||||
*/
|
||||
typedef struct {
|
||||
/**
|
||||
* @brief Opaque content placeholder
|
||||
*
|
||||
* Access only for initializing from C++
|
||||
*/
|
||||
ATOMIC_UINT_FAST32_T_SAME_SIZED_TYPE do_not_access_from_cpp;
|
||||
} atomic_uint_fast32_t;
|
||||
|
||||
/**
|
||||
* @brief Type with the same alignment and size as `atomic_int_fast64_t`
|
||||
*/
|
||||
typedef struct {
|
||||
/**
|
||||
* @brief Opaque content placeholder
|
||||
*
|
||||
* Access only for initializing from C++
|
||||
*/
|
||||
ATOMIC_INT_FAST64_T_SAME_SIZED_TYPE do_not_access_from_cpp;
|
||||
} atomic_int_fast64_t;
|
||||
|
||||
/**
|
||||
* @brief Type with the same alignment and size as `atomic_uint_fast64_t`
|
||||
*/
|
||||
typedef struct {
|
||||
/**
|
||||
* @brief Opaque content placeholder
|
||||
*
|
||||
* Access only for initializing from C++
|
||||
*/
|
||||
ATOMIC_UINT_FAST64_T_SAME_SIZED_TYPE do_not_access_from_cpp;
|
||||
} atomic_uint_fast64_t;
|
||||
|
||||
/**
|
||||
* @brief Type with the same alignment and size as `atomic_intptr_t`
|
||||
*/
|
||||
typedef struct {
|
||||
/**
|
||||
* @brief Opaque content placeholder
|
||||
*
|
||||
* Access only for initializing from C++
|
||||
*/
|
||||
ATOMIC_INTPTR_T_SAME_SIZED_TYPE do_not_access_from_cpp;
|
||||
} atomic_intptr_t;
|
||||
|
||||
/**
|
||||
* @brief Type with the same alignment and size as `atomic_uintptr_t`
|
||||
*/
|
||||
typedef struct {
|
||||
/**
|
||||
* @brief Opaque content placeholder
|
||||
*
|
||||
* Access only for initializing from C++
|
||||
*/
|
||||
ATOMIC_UINTPTR_T_SAME_SIZED_TYPE do_not_access_from_cpp;
|
||||
} atomic_uintptr_t;
|
||||
|
||||
/**
|
||||
* @brief Type with the same alignment and size as `atomic_size_t`
|
||||
*/
|
||||
typedef struct {
|
||||
/**
|
||||
* @brief Opaque content placeholder
|
||||
*
|
||||
* Access only for initializing from C++
|
||||
*/
|
||||
ATOMIC_SIZE_T_SAME_SIZED_TYPE do_not_access_from_cpp;
|
||||
} atomic_size_t;
|
||||
|
||||
/**
|
||||
* @brief Type with the same alignment and size as `atomic_intmax_t`
|
||||
*/
|
||||
typedef struct {
|
||||
/**
|
||||
* @brief Opaque content placeholder
|
||||
*
|
||||
* Access only for initializing from C++
|
||||
*/
|
||||
ATOMIC_INTMAX_T_SAME_SIZED_TYPE do_not_access_from_cpp;
|
||||
} atomic_intmax_t;
|
||||
|
||||
/**
|
||||
* @brief Type with the same alignment and size as `atomic_uintmax_t`
|
||||
*/
|
||||
typedef struct {
|
||||
/**
|
||||
* @brief Opaque content placeholder
|
||||
*
|
||||
* Access only for initializing from C++
|
||||
*/
|
||||
ATOMIC_UINTMAX_T_SAME_SIZED_TYPE do_not_access_from_cpp;
|
||||
} atomic_uintmax_t;
|
||||
|
||||
/** @} */
|
||||
9
tests/c11_atomics_cpp_compat/Makefile
Normal file
9
tests/c11_atomics_cpp_compat/Makefile
Normal file
@ -0,0 +1,9 @@
|
||||
include ../Makefile.tests_common
|
||||
|
||||
# As it is a simple compilation test, only the basic modules are needed
|
||||
DISABLE_MODULE := \
|
||||
auto_init \
|
||||
core_msg \
|
||||
#
|
||||
|
||||
include $(RIOTBASE)/Makefile.include
|
||||
7
tests/c11_atomics_cpp_compat/README.md
Normal file
7
tests/c11_atomics_cpp_compat/README.md
Normal file
@ -0,0 +1,7 @@
|
||||
Description
|
||||
===========
|
||||
|
||||
This is a simple compile test to verify that the values provided in
|
||||
`c11_atomics_compat_cpu.hpp` for your CPU are correct. If the application
|
||||
compiles, everything is fine. There is no point in flashing or running the
|
||||
application.
|
||||
97
tests/c11_atomics_cpp_compat/main.c
Normal file
97
tests/c11_atomics_cpp_compat/main.c
Normal file
@ -0,0 +1,97 @@
|
||||
/*
|
||||
* Copyright (C) 2019 Otto-von-Guericke-Universität Magdeburg
|
||||
*
|
||||
* This file is subject to the terms and conditions of the GNU Lesser
|
||||
* General Public License v2.1. See the file LICENSE in the top level
|
||||
* directory for more details.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @ingroup tests
|
||||
* @{
|
||||
*
|
||||
* @file
|
||||
* @brief Compile test to verify values in c11_atomics_compat_cpu.hpp
|
||||
*
|
||||
* @author Marian Buschsieweke <marian.buschsieweke@ovgu.de>
|
||||
* @}
|
||||
*/
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#if defined(CPU_CC430) || defined(CPU_ESP8266) || defined(CPU_MSP430FXYZ)
|
||||
#include <sys/cdefs.h>
|
||||
#endif
|
||||
|
||||
/* This file contains only #defines, so it is fully compatible with C */
|
||||
#include "c11_atomics_compat_cpu.hpp"
|
||||
|
||||
int main(void)
|
||||
{
|
||||
_Static_assert(ATOMIC_BOOL_SIZE == sizeof(_Atomic(bool)), "Size of type must match define");
|
||||
_Static_assert(ATOMIC_CHAR_SIZE == sizeof(_Atomic(char)), "Size of type must match define");
|
||||
_Static_assert(ATOMIC_SCHAR_SIZE == sizeof(_Atomic(signed char)), "Size of type must match define");
|
||||
_Static_assert(ATOMIC_UCHAR_SIZE == sizeof(_Atomic(unsigned char)), "Size of type must match define");
|
||||
_Static_assert(ATOMIC_SHORT_SIZE == sizeof(_Atomic(short)), "Size of type must match define");
|
||||
_Static_assert(ATOMIC_USHORT_SIZE == sizeof(_Atomic(unsigned short)), "Size of type must match define");
|
||||
_Static_assert(ATOMIC_INT_SIZE == sizeof(_Atomic(int)), "Size of type must match define");
|
||||
_Static_assert(ATOMIC_UINT_SIZE == sizeof(_Atomic(unsigned int)), "Size of type must match define");
|
||||
_Static_assert(ATOMIC_LONG_SIZE == sizeof(_Atomic(long)), "Size of type must match define");
|
||||
_Static_assert(ATOMIC_ULONG_SIZE == sizeof(_Atomic(unsigned long)), "Size of type must match define");
|
||||
_Static_assert(ATOMIC_LLONG_SIZE == sizeof(_Atomic(long long)), "Size of type must match define");
|
||||
_Static_assert(ATOMIC_ULLONG_SIZE == sizeof(_Atomic(unsigned long long)), "Size of type must match define");
|
||||
_Static_assert(ATOMIC_INT_LEAST8_T_SIZE == sizeof(_Atomic(int_least8_t)), "Size of type must match define");
|
||||
_Static_assert(ATOMIC_UINT_LEAST8_T_SIZE == sizeof(_Atomic(uint_least8_t)), "Size of type must match define");
|
||||
_Static_assert(ATOMIC_INT_LEAST16_T_SIZE == sizeof(_Atomic(int_least16_t)), "Size of type must match define");
|
||||
_Static_assert(ATOMIC_UINT_LEAST16_T_SIZE == sizeof(_Atomic(uint_least16_t)), "Size of type must match define");
|
||||
_Static_assert(ATOMIC_INT_LEAST32_T_SIZE == sizeof(_Atomic(int_least32_t)), "Size of type must match define");
|
||||
_Static_assert(ATOMIC_UINT_LEAST32_T_SIZE == sizeof(_Atomic(uint_least32_t)), "Size of type must match define");
|
||||
_Static_assert(ATOMIC_INT_LEAST64_T_SIZE == sizeof(_Atomic(int_least64_t)), "Size of type must match define");
|
||||
_Static_assert(ATOMIC_UINT_LEAST64_T_SIZE == sizeof(_Atomic(uint_least64_t)), "Size of type must match define");
|
||||
_Static_assert(ATOMIC_INT_FAST8_T_SIZE == sizeof(_Atomic(int_fast8_t)), "Size of type must match define");
|
||||
_Static_assert(ATOMIC_UINT_FAST8_T_SIZE == sizeof(_Atomic(uint_fast8_t)), "Size of type must match define");
|
||||
_Static_assert(ATOMIC_INT_FAST16_T_SIZE == sizeof(_Atomic(int_fast16_t)), "Size of type must match define");
|
||||
_Static_assert(ATOMIC_UINT_FAST16_T_SIZE == sizeof(_Atomic(uint_fast16_t)), "Size of type must match define");
|
||||
_Static_assert(ATOMIC_INT_FAST32_T_SIZE == sizeof(_Atomic(int_fast32_t)), "Size of type must match define");
|
||||
_Static_assert(ATOMIC_UINT_FAST32_T_SIZE == sizeof(_Atomic(uint_fast32_t)), "Size of type must match define");
|
||||
_Static_assert(ATOMIC_INT_FAST64_T_SIZE == sizeof(_Atomic(int_fast64_t)), "Size of type must match define");
|
||||
_Static_assert(ATOMIC_UINT_FAST64_T_SIZE == sizeof(_Atomic(uint_fast64_t)), "Size of type must match define");
|
||||
_Static_assert(ATOMIC_INTPTR_T_SIZE == sizeof(_Atomic(intptr_t)), "Size of type must match define");
|
||||
_Static_assert(ATOMIC_UINTPTR_T_SIZE == sizeof(_Atomic(uintptr_t)), "Size of type must match define");
|
||||
_Static_assert(ATOMIC_SIZE_T_SIZE == sizeof(_Atomic(size_t)), "Size of type must match define");
|
||||
|
||||
_Static_assert(ATOMIC_BOOL_SIZE == sizeof(ATOMIC_BOOL_SAME_SIZED_TYPE), "Size of type must match define");
|
||||
_Static_assert(ATOMIC_CHAR_SIZE == sizeof(ATOMIC_CHAR_SAME_SIZED_TYPE), "Size of type must match define");
|
||||
_Static_assert(ATOMIC_SCHAR_SIZE == sizeof(ATOMIC_SCHAR_SAME_SIZED_TYPE), "Size of type must match define");
|
||||
_Static_assert(ATOMIC_UCHAR_SIZE == sizeof(ATOMIC_UCHAR_SAME_SIZED_TYPE), "Size of type must match define");
|
||||
_Static_assert(ATOMIC_SHORT_SIZE == sizeof(ATOMIC_SHORT_SAME_SIZED_TYPE), "Size of type must match define");
|
||||
_Static_assert(ATOMIC_USHORT_SIZE == sizeof(ATOMIC_USHORT_SAME_SIZED_TYPE), "Size of type must match define");
|
||||
_Static_assert(ATOMIC_INT_SIZE == sizeof(ATOMIC_INT_SAME_SIZED_TYPE), "Size of type must match define");
|
||||
_Static_assert(ATOMIC_UINT_SIZE == sizeof(ATOMIC_UINT_SAME_SIZED_TYPE), "Size of type must match define");
|
||||
_Static_assert(ATOMIC_LONG_SIZE == sizeof(ATOMIC_LONG_SAME_SIZED_TYPE), "Size of type must match define");
|
||||
_Static_assert(ATOMIC_ULONG_SIZE == sizeof(ATOMIC_ULONG_SAME_SIZED_TYPE), "Size of type must match define");
|
||||
_Static_assert(ATOMIC_LLONG_SIZE == sizeof(ATOMIC_LLONG_SAME_SIZED_TYPE), "Size of type must match define");
|
||||
_Static_assert(ATOMIC_ULLONG_SIZE == sizeof(ATOMIC_ULLONG_SAME_SIZED_TYPE), "Size of type must match define");
|
||||
_Static_assert(ATOMIC_INT_LEAST8_T_SIZE == sizeof(ATOMIC_INT_LEAST8_T_SAME_SIZED_TYPE), "Size of type must match define");
|
||||
_Static_assert(ATOMIC_UINT_LEAST8_T_SIZE == sizeof(ATOMIC_UINT_LEAST8_T_SAME_SIZED_TYPE), "Size of type must match define");
|
||||
_Static_assert(ATOMIC_INT_LEAST16_T_SIZE == sizeof(ATOMIC_INT_LEAST16_T_SAME_SIZED_TYPE), "Size of type must match define");
|
||||
_Static_assert(ATOMIC_UINT_LEAST16_T_SIZE == sizeof(ATOMIC_UINT_LEAST16_T_SAME_SIZED_TYPE), "Size of type must match define");
|
||||
_Static_assert(ATOMIC_INT_LEAST32_T_SIZE == sizeof(ATOMIC_INT_LEAST32_T_SAME_SIZED_TYPE), "Size of type must match define");
|
||||
_Static_assert(ATOMIC_UINT_LEAST32_T_SIZE == sizeof(ATOMIC_UINT_LEAST32_T_SAME_SIZED_TYPE), "Size of type must match define");
|
||||
_Static_assert(ATOMIC_INT_LEAST64_T_SIZE == sizeof(ATOMIC_INT_LEAST64_T_SAME_SIZED_TYPE), "Size of type must match define");
|
||||
_Static_assert(ATOMIC_UINT_LEAST64_T_SIZE == sizeof(ATOMIC_UINT_LEAST64_T_SAME_SIZED_TYPE), "Size of type must match define");
|
||||
_Static_assert(ATOMIC_INT_FAST8_T_SIZE == sizeof(ATOMIC_INT_FAST8_T_SAME_SIZED_TYPE), "Size of type must match define");
|
||||
_Static_assert(ATOMIC_UINT_FAST8_T_SIZE == sizeof(ATOMIC_UINT_FAST8_T_SAME_SIZED_TYPE), "Size of type must match define");
|
||||
_Static_assert(ATOMIC_INT_FAST16_T_SIZE == sizeof(ATOMIC_INT_FAST16_T_SAME_SIZED_TYPE), "Size of type must match define");
|
||||
_Static_assert(ATOMIC_UINT_FAST16_T_SIZE == sizeof(ATOMIC_UINT_FAST16_T_SAME_SIZED_TYPE), "Size of type must match define");
|
||||
_Static_assert(ATOMIC_INT_FAST32_T_SIZE == sizeof(ATOMIC_INT_FAST32_T_SAME_SIZED_TYPE), "Size of type must match define");
|
||||
_Static_assert(ATOMIC_UINT_FAST32_T_SIZE == sizeof(ATOMIC_UINT_FAST32_T_SAME_SIZED_TYPE), "Size of type must match define");
|
||||
_Static_assert(ATOMIC_INT_FAST64_T_SIZE == sizeof(ATOMIC_INT_FAST64_T_SAME_SIZED_TYPE), "Size of type must match define");
|
||||
_Static_assert(ATOMIC_UINT_FAST64_T_SIZE == sizeof(ATOMIC_UINT_FAST64_T_SAME_SIZED_TYPE), "Size of type must match define");
|
||||
_Static_assert(ATOMIC_INTPTR_T_SIZE == sizeof(ATOMIC_INTPTR_T_SAME_SIZED_TYPE), "Size of type must match define");
|
||||
_Static_assert(ATOMIC_UINTPTR_T_SIZE == sizeof(ATOMIC_UINTPTR_T_SAME_SIZED_TYPE), "Size of type must match define");
|
||||
_Static_assert(ATOMIC_SIZE_T_SIZE == sizeof(ATOMIC_SIZE_T_SAME_SIZED_TYPE), "Size of type must match define");
|
||||
|
||||
return 0;
|
||||
}
|
||||
5
tests/rmutex_cpp/Makefile
Normal file
5
tests/rmutex_cpp/Makefile
Normal file
@ -0,0 +1,5 @@
|
||||
include ../Makefile.tests_common
|
||||
|
||||
FEATURES_REQUIRED += cpp
|
||||
|
||||
include $(RIOTBASE)/Makefile.include
|
||||
16
tests/rmutex_cpp/Makefile.ci
Normal file
16
tests/rmutex_cpp/Makefile.ci
Normal file
@ -0,0 +1,16 @@
|
||||
BOARD_INSUFFICIENT_MEMORY := \
|
||||
arduino-duemilanove \
|
||||
arduino-leonardo \
|
||||
arduino-nano \
|
||||
arduino-uno \
|
||||
atmega328p \
|
||||
i-nucleo-lrwan1 \
|
||||
nucleo-f030r8 \
|
||||
nucleo-f031k6 \
|
||||
nucleo-f042k6 \
|
||||
nucleo-l031k6 \
|
||||
nucleo-l053r8 \
|
||||
stm32f030f4-demo \
|
||||
stm32f0discovery \
|
||||
stm32l0538-disco \
|
||||
#
|
||||
86
tests/rmutex_cpp/README.md
Normal file
86
tests/rmutex_cpp/README.md
Normal file
@ -0,0 +1,86 @@
|
||||
Expected result
|
||||
===============
|
||||
|
||||
When successful, you should see 5 different threads printing their
|
||||
PID, priority and recursion depth. The thread with the lowest priority
|
||||
should be able to lock (and unlock) the mutex first, followed by the
|
||||
other threads in the order of their priority (highest next). If two
|
||||
threads have the same priority the lower thread id should acquire the
|
||||
lock. The output should look like the following:
|
||||
|
||||
```
|
||||
main(): This is RIOT! (Version: xxx)
|
||||
Recursive Mutex test
|
||||
Please refer to the README.md for more information
|
||||
|
||||
Recursive Mutex test
|
||||
Please refer to the README.md for more information
|
||||
|
||||
T3 (prio 6, depth 0): trying to lock rmutex now
|
||||
T4 (prio 4, depth 0): trying to lock rmutex now
|
||||
T5 (prio 5, depth 0): trying to lock rmutex now
|
||||
T6 (prio 2, depth 0): trying to lock rmutex now
|
||||
T7 (prio 3, depth 0): trying to lock rmutex now
|
||||
main: unlocking recursive mutex
|
||||
T6 (prio 2, depth 0): locked rmutex now
|
||||
T6 (prio 2, depth 1): trying to lock rmutex now
|
||||
T6 (prio 2, depth 1): locked rmutex now
|
||||
T6 (prio 2, depth 2): trying to lock rmutex now
|
||||
T6 (prio 2, depth 2): locked rmutex now
|
||||
T6 (prio 2, depth 3): trying to lock rmutex now
|
||||
T6 (prio 2, depth 3): locked rmutex now
|
||||
T6 (prio 2, depth 3): unlocked rmutex
|
||||
T6 (prio 2, depth 2): unlocked rmutex
|
||||
T6 (prio 2, depth 1): unlocked rmutex
|
||||
T6 (prio 2, depth 0): unlocked rmutex
|
||||
T7 (prio 3, depth 0): locked rmutex now
|
||||
T7 (prio 3, depth 1): trying to lock rmutex now
|
||||
T7 (prio 3, depth 1): locked rmutex now
|
||||
T7 (prio 3, depth 2): trying to lock rmutex now
|
||||
T7 (prio 3, depth 2): locked rmutex now
|
||||
T7 (prio 3, depth 3): trying to lock rmutex now
|
||||
T7 (prio 3, depth 3): locked rmutex now
|
||||
T7 (prio 3, depth 4): trying to lock rmutex now
|
||||
T7 (prio 3, depth 4): locked rmutex now
|
||||
T7 (prio 3, depth 4): unlocked rmutex
|
||||
T7 (prio 3, depth 3): unlocked rmutex
|
||||
T7 (prio 3, depth 2): unlocked rmutex
|
||||
T7 (prio 3, depth 1): unlocked rmutex
|
||||
T7 (prio 3, depth 0): unlocked rmutex
|
||||
T4 (prio 4, depth 0): locked rmutex now
|
||||
T4 (prio 4, depth 1): trying to lock rmutex now
|
||||
T4 (prio 4, depth 1): locked rmutex now
|
||||
T4 (prio 4, depth 2): trying to lock rmutex now
|
||||
T4 (prio 4, depth 2): locked rmutex now
|
||||
T4 (prio 4, depth 2): unlocked rmutex
|
||||
T4 (prio 4, depth 1): unlocked rmutex
|
||||
T4 (prio 4, depth 0): unlocked rmutex
|
||||
T5 (prio 5, depth 0): locked rmutex now
|
||||
T5 (prio 5, depth 1): trying to lock rmutex now
|
||||
T5 (prio 5, depth 1): locked rmutex now
|
||||
T5 (prio 5, depth 2): trying to lock rmutex now
|
||||
T5 (prio 5, depth 2): locked rmutex now
|
||||
T5 (prio 5, depth 2): unlocked rmutex
|
||||
T5 (prio 5, depth 1): unlocked rmutex
|
||||
T5 (prio 5, depth 0): unlocked rmutex
|
||||
T3 (prio 6, depth 0): locked rmutex now
|
||||
T3 (prio 6, depth 1): trying to lock rmutex now
|
||||
T3 (prio 6, depth 1): locked rmutex now
|
||||
T3 (prio 6, depth 2): trying to lock rmutex now
|
||||
T3 (prio 6, depth 2): locked rmutex now
|
||||
T3 (prio 6, depth 3): trying to lock rmutex now
|
||||
T3 (prio 6, depth 3): locked rmutex now
|
||||
T3 (prio 6, depth 4): trying to lock rmutex now
|
||||
T3 (prio 6, depth 4): locked rmutex now
|
||||
T3 (prio 6, depth 4): unlocked rmutex
|
||||
T3 (prio 6, depth 3): unlocked rmutex
|
||||
T3 (prio 6, depth 2): unlocked rmutex
|
||||
T3 (prio 6, depth 1): unlocked rmutex
|
||||
T3 (prio 6, depth 0): unlocked rmutex
|
||||
|
||||
Test END, check the order of priorities above.
|
||||
```
|
||||
|
||||
Background
|
||||
==========
|
||||
This test application stresses a mutex with a number of threads waiting on it.
|
||||
91
tests/rmutex_cpp/main.cpp
Normal file
91
tests/rmutex_cpp/main.cpp
Normal file
@ -0,0 +1,91 @@
|
||||
/*
|
||||
* Copyright (C) 2016 Theobroma Systems Design & Consulting GmbH
|
||||
*
|
||||
* This file is subject to the terms and conditions of the GNU Lesser
|
||||
* General Public License v2.1. See the file LICENSE in the top level
|
||||
* directory for more details.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @ingroup tests
|
||||
* @{
|
||||
*
|
||||
* @file
|
||||
* @brief Test application for testing recursive mutexes
|
||||
*
|
||||
* @author Hauke Petersen <hauke.petersen@fu-berlin.de>
|
||||
* @author Martin Elshuber <martin.elshuber@theobroma-systems.com>
|
||||
* @}
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "rmutex.h"
|
||||
#include "thread.h"
|
||||
|
||||
#define THREAD_NUMOF (5U)
|
||||
|
||||
extern volatile thread_t *sched_active_thread;
|
||||
|
||||
static char stacks[THREAD_NUMOF][THREAD_STACKSIZE_MAIN];
|
||||
|
||||
static const char prios[THREAD_NUMOF] = {THREAD_PRIORITY_MAIN - 1, 4, 5, 2, 4};
|
||||
static const char depth[THREAD_NUMOF] = {5, 3, 3, 4, 5};
|
||||
|
||||
static rmutex_t testlock;
|
||||
|
||||
static void lock_recursive(char n, char depth)
|
||||
{
|
||||
volatile thread_t *t = sched_active_thread;
|
||||
|
||||
printf("T%i (prio %i, depth %i): trying to lock rmutex now\n",
|
||||
(int)t->pid, (int)t->priority, (int)n);
|
||||
rmutex_lock(&testlock);
|
||||
|
||||
printf("T%i (prio %i, depth %i): locked rmutex now\n",
|
||||
(int)t->pid, (int)t->priority, (int)n);
|
||||
|
||||
if (n + 1 < depth)
|
||||
lock_recursive(n + 1, depth);
|
||||
|
||||
thread_yield();
|
||||
|
||||
rmutex_unlock(&testlock);
|
||||
|
||||
printf("T%i (prio %i, depth %i): unlocked rmutex\n",
|
||||
(int)t->pid, (int)t->priority, (int)n);
|
||||
}
|
||||
|
||||
static void *lockme(void *arg)
|
||||
{
|
||||
intptr_t depth = (intptr_t)arg;
|
||||
|
||||
lock_recursive(0, depth);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
puts("Recursive Mutex test");
|
||||
puts("Please refer to the README.md for more information\n");
|
||||
|
||||
rmutex_init(&testlock);
|
||||
|
||||
/* lock mutex, so that spawned threads have to wait */
|
||||
rmutex_lock(&testlock);
|
||||
/* create threads */
|
||||
for (unsigned i = 0; i < THREAD_NUMOF; i++) {
|
||||
thread_create(stacks[i], sizeof(stacks[i]), prios[i], 0,
|
||||
lockme, (void*)(intptr_t)depth[i], "t");
|
||||
}
|
||||
/* allow threads to lock the mutex */
|
||||
printf("main: unlocking recursive mutex\n");
|
||||
|
||||
rmutex_unlock(&testlock);
|
||||
|
||||
rmutex_lock(&testlock);
|
||||
puts("\nTest END, check the order of priorities above.");
|
||||
|
||||
return 0;
|
||||
}
|
||||
49
tests/rmutex_cpp/tests/01-run.py
Executable file
49
tests/rmutex_cpp/tests/01-run.py
Executable file
@ -0,0 +1,49 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
# Copyright (C) 2016 Theobroma Systems Design & Consulting GmbH
|
||||
#
|
||||
# This file is subject to the terms and conditions of the GNU Lesser
|
||||
# General Public License v2.1. See the file LICENSE in the top level
|
||||
# directory for more details.
|
||||
|
||||
# Author: Martin Elshuber <martin.elshuber@theobroma-systems.com>
|
||||
|
||||
import sys
|
||||
from testrunner import run
|
||||
|
||||
|
||||
thread_prio = {
|
||||
3: 6,
|
||||
4: 4,
|
||||
5: 5,
|
||||
6: 2,
|
||||
7: 4
|
||||
}
|
||||
|
||||
lock_depth = {
|
||||
3: 5,
|
||||
4: 3,
|
||||
5: 3,
|
||||
6: 4,
|
||||
7: 5
|
||||
}
|
||||
|
||||
|
||||
def thread_prio_sort(x):
|
||||
return thread_prio.get(x)*1000 + x
|
||||
|
||||
|
||||
def testfunc(child):
|
||||
for k in thread_prio.keys():
|
||||
child.expect(u"T%i \(prio %i, depth 0\): trying to lock rmutex now" %
|
||||
(k, thread_prio[k]))
|
||||
|
||||
pri_sorted = sorted(thread_prio, key=thread_prio_sort)
|
||||
for T in pri_sorted:
|
||||
for depth in range(lock_depth[T]):
|
||||
child.expect(u"T%i \(prio %i, depth %i\): locked rmutex now" %
|
||||
(T, thread_prio[T], depth))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(run(testfunc))
|
||||
Loading…
x
Reference in New Issue
Block a user