From b451548bec9bb4f510d960c4fd94b9522548d6bc Mon Sep 17 00:00:00 2001 From: sfja Date: Tue, 1 Apr 2025 17:19:26 +0200 Subject: [PATCH] use unused --- Makefile | 6 +++--- common/unused.h | 3 +++ compile_flags.txt | 2 -- vm/main.c | 2 +- vm/vm.c | 4 +++- 5 files changed, 10 insertions(+), 7 deletions(-) create mode 100644 common/unused.h diff --git a/Makefile b/Makefile index 28102ac..c59b442 100644 --- a/Makefile +++ b/Makefile @@ -4,11 +4,11 @@ MAKEFLAGS += -j $(shell nproc) CC = gcc C_FLAGS = \ + -I. \ -std=c17 \ -Wall -Wextra -Wpedantic -Wconversion \ -pedantic -pedantic-errors \ - -Wno-unused-variable \ - -I. \ + -Wno-unused-function \ L_FLAGS = -pthread @@ -26,7 +26,7 @@ ifeq ($(RELEASE),1) F_FLAGS += -flto=auto OPTIMIZATION += -O3 else - C_FLAGS += -g + C_FLAGS += -g -Wno-unused-variable F_FLAGS += -fsanitize=address,undefined,leak OPTIMIZATION += -Og endif diff --git a/common/unused.h b/common/unused.h new file mode 100644 index 0000000..f2b3fd7 --- /dev/null +++ b/common/unused.h @@ -0,0 +1,3 @@ +#pragma once + +#define UNUSED __attribute__((unused)) diff --git a/compile_flags.txt b/compile_flags.txt index e7d8f39..61d526a 100644 --- a/compile_flags.txt +++ b/compile_flags.txt @@ -7,7 +7,5 @@ -pedantic -pedantic-errors -Wno-unused-variable -# -Wno-unused-parameter -# -Wno-unused-function -I. diff --git a/vm/main.c b/vm/main.c index db0c9f7..f192a77 100644 --- a/vm/main.c +++ b/vm/main.c @@ -376,7 +376,7 @@ void filedrive_construct( .drive = (Drive) { .self = drive, .block_size = block_size, - .block_amount = block_size, + .block_amount = block_amount, .read = filedrive_drive_read, .write = filedrive_drive_write, }, diff --git a/vm/vm.c b/vm/vm.c index aca8c0c..a5270b2 100644 --- a/vm/vm.c +++ b/vm/vm.c @@ -1,6 +1,7 @@ #include "vm.h" #include "common/arch.h" #include "common/op_str.h" +#include "common/unused.h" #include #include #include @@ -413,7 +414,8 @@ static inline void handle_device_read(VM* vm, Reg dst_reg, uint16_t device_id) } } -static inline void handle_device_write(VM* vm, uint16_t op1, uint16_t device_id) +static inline void handle_device_write( + UNUSED VM* vm, UNUSED uint16_t op1, uint16_t device_id) { switch (device_id) { default: