Warn for unused results
This commit is contained in:
parent
1aed6c0715
commit
ee2ddd7e8c
2 changed files with 2 additions and 1 deletions
1
Makefile
1
Makefile
|
@ -12,6 +12,7 @@ LDFLAGS = -Tkernel.ld
|
|||
LDFLAGS += -m elf64lriscv
|
||||
|
||||
CFLAGS = -Wall -Werror -O
|
||||
CFLAGS += -Wno-unused-result
|
||||
CFLAGS += -mcmodel=medany
|
||||
CFLAGS += -march=rv64gc -mabi=lp64
|
||||
CFLAGS += -ffreestanding -fno-common -nostdlib -mno-relax
|
||||
|
|
|
@ -4,7 +4,7 @@ void spinlock_init(spinlock_t *l) {
|
|||
l->v = 0;
|
||||
}
|
||||
|
||||
bool spin_trylock(spinlock_t *l) {
|
||||
__attribute__((warn_unused_result)) bool spin_trylock(spinlock_t *l) {
|
||||
uint32_t old;
|
||||
// old = xchg_acquire(&l->v, 1) using AMO
|
||||
__asm__ volatile("amoswap.w.aq %0, %2, (%1)\n" : "=&r"(old) : "r"(&l->v), "r"(1u) : "memory");
|
||||
|
|
Loading…
Add table
Reference in a new issue