1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00
Commit Graph

7 Commits

Author SHA1 Message Date
Marian Buschsieweke
cf6fa4edf0
tree wide: add IWYU pragma: export where needed
We occasionally have some public `foo.h` header that includes a private
`foo_arch.h` header. Users are expected to include the `foo.h` header
and not the `foo_arch.h`. However, clangd will claim that the `#include`
of `foo.h` is unused if only functions / macros/ types / ... from
`foor_arch.h` is used and nothing from `foo.h`.

This adds the `IWYU pragma: export` comment to the include of
`foo_arch.h` in `foo.h`, so that clangd treats functions / macros /
types provided by `foo_arch.h` as if they were instead provided by
`foo.h`, which fixes the false positives.
2024-04-14 14:26:05 +02:00
Marian Buschsieweke
86fdbd7054
core/lib: Add macros/utils.h header
The macros CONCAT(), MIN(), and MAX() are defined over and over again in
RIOT's code base. This de-duplicates the code by moving the macros to a
common place.
2023-01-07 09:47:44 +01:00
Marian Buschsieweke
20793fd6c6
sys/atomic_utils: Add load/store for kernel PIDs
This will make it easier to change the width of kernel_pid_t if needed
without breaking code.
2022-01-05 15:45:53 +01:00
Marian Buschsieweke
78ded2dd08
sys/atomic_utils: add atomic_{load,store}_ptr() 2021-11-23 14:23:50 +01:00
Marian Buschsieweke
8b0007f33a
sys/atomic_utils: return previous value
Update the `atomic_fetch_<OPERATION>_u<WIDTH>()` functions to return the old
value the target contained prior to applying the operation. This makes this
API much more versatile and closer to C11 atomics.
2020-12-16 18:09:35 +01:00
Marian Buschsieweke
a594b8adc1
sys/atomic_utils: Use volatile pointers
Mark all pointers in the atomic utils API as `volatile` for the following
reasons:

1. The guarantees provided by `volatile` is a subset of the guarantees
   provided by the atomic utils. This makes this fact more obvious.
2. Casting `volatile` off is undefined behavior. In order to be able to use
   the atomic utils on memory mapped IO (which needs the `volatile` qualifier)
   without resorting to undefined behavior, this API change is needed.
2020-11-24 14:00:51 +01:00
Marian Buschsieweke
0e8b8ffa64
sys/atomic_utils: Functions for atomic access
A set of functions competing with C11 atomics feature-wise, but are implemented
more efficient.
2020-11-05 10:23:32 +01:00