summaryrefslogtreecommitdiff
path: root/libcr/coroutine.c
diff options
context:
space:
mode:
Diffstat (limited to 'libcr/coroutine.c')
-rw-r--r--libcr/coroutine.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/libcr/coroutine.c b/libcr/coroutine.c
index cb872b0..c935c22 100644
--- a/libcr/coroutine.c
+++ b/libcr/coroutine.c
@@ -48,8 +48,8 @@
/*
* Portability notes:
*
- * - It uses GCC `__attribute__`s, and the GNUC ({ ... }) statement
- * exprs extension.
+ * - It uses GCC `gnu::` attributes, and the GNUC `({ ... })`
+ * statement exprs extension.
*
* - It has a small bit of platform-specific code in the "platform
* support" section. Other than this, it should be portable to
@@ -122,7 +122,7 @@
* no longer exists.
*/
-#define ALWAYS_INLINE inline __attribute__((always_inline))
+#define ALWAYS_INLINE [[gnu::always_inline]] inline
/* platform support ***********************************************************/
@@ -130,7 +130,7 @@
* able to run it on my x86-64 GNU/Linux laptop is useful for debugging. */
#define CR_PLAT_STACK_ALIGNMENT \
- ({ __attribute__((aligned)) void fn(void) {}; __alignof__(fn); })
+ ({ [[gnu::aligned]] void fn(void) {}; __alignof__(fn); })
#if 0
{ /* bracket to get Emacs indentation to work how I want */
@@ -197,7 +197,7 @@
);
return isr_number != 0;
}
- static ALWAYS_INLINE bool _cr_plat_are_interrupts_enabled(void) {
+ ALWAYS_INLINE static bool _cr_plat_are_interrupts_enabled(void) {
assert(!cr_is_in_intrhandler());
uint32_t primask;
asm volatile ("mrs %0, PRIMASK"
@@ -206,7 +206,7 @@
return primask == 0;
}
- static ALWAYS_INLINE void cr_plat_wait_for_interrupt(void) {
+ ALWAYS_INLINE static void cr_plat_wait_for_interrupt(void) {
assert(!cr_is_in_intrhandler());
assert(!_cr_plat_are_interrupts_enabled());
asm volatile ("wfi\n"
@@ -236,7 +236,7 @@
#define CR_PLAT_STACK_GROWS_DOWNWARD 1
#if CONFIG_COROUTINE_MEASURE_STACK
- static ALWAYS_INLINE uintptr_t cr_plat_get_sp(void) {
+ ALWAYS_INLINE static uintptr_t cr_plat_get_sp(void) {
uintptr_t sp;
asm volatile ("mov %0, sp":"=r"(sp));
return sp;
@@ -268,7 +268,7 @@
#define CR_PLAT_STACK_GROWS_DOWNWARD 1
#if CONFIG_COROUTINE_MEASURE_STACK
- static ALWAYS_INLINE uintptr_t cr_plat_get_sp(void) {
+ ALWAYS_INLINE static uintptr_t cr_plat_get_sp(void) {
uintptr_t sp;
asm volatile ("movq %%rsp, %0":"=r"(sp));
return sp;
@@ -459,7 +459,7 @@ static inline void assert_cid(cid_t cid) {
/* coroutine_add() ************************************************************/
cid_t coroutine_add_with_stack_size(size_t stack_size,
- const char __attribute__((unused)) *name,
+ const char [[gnu::unused]] *name,
cr_fn_t fn, void *args) {
static cid_t last_created = 0;
cid_t parent = coroutine_running;
@@ -537,7 +537,7 @@ cid_t coroutine_add(const char *name, cr_fn_t fn, void *args) {
/* coroutine_main() ***********************************************************/
-__attribute__ ((noreturn)) void coroutine_main(void) {
+[[noreturn]] void coroutine_main(void) {
debugf("coroutine_main()");
bool saved = cr_save_and_disable_interrupts();
assert(saved);
@@ -626,7 +626,7 @@ void cr_pause_and_yield(void) {
cr_restore_interrupts(saved);
}
-__attribute__ ((noreturn)) void cr_exit(void) {
+[[noreturn]] void cr_exit(void) {
debugf("cid=%zu: cr_exit()", coroutine_running);
assert(!cr_is_in_intrhandler());
assert_cid_state(coroutine_running, state == CR_RUNNING);