From c05d83132b566a1cbdcd7aea6e418bc6028117fa Mon Sep 17 00:00:00 2001 From: bloqaudio Date: Mon, 14 Sep 2026 14:05:33 -0500 Subject: [PATCH] test: drop the unused typedef keyword and make the gcc-only warning switch conditional Building the firmware headers on the host showed two warnings from machine.h: `typedef struct machine { ... };` and the same for machine_runtime declare no alias, so the keyword only draws "useless storage class specifier in empty declaration". Every user says `struct machine`, so drop the keyword. -Wno-builtin-declaration-mismatch is a gcc switch and clang reports it as an unknown option on every build; add it only when the compiler is not clang. --- machine.h | 4 ++-- test/Makefile | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/machine.h b/machine.h index fd882229..b6d4a825 100644 --- a/machine.h +++ b/machine.h @@ -74,7 +74,7 @@ struct sfp_port i2c_bus_t i2c; }; -typedef struct machine { +struct machine { char machine_name[30]; uint8_t isRTL8373; // Lowest logical port number @@ -102,7 +102,7 @@ typedef struct machine { uint32_t mac_flash_offset; }; -typedef struct machine_runtime +struct machine_runtime { uint8_t isRTL8373 : 1; uint8_t isN : 1; diff --git a/test/Makefile b/test/Makefile index 66702b70..550cea3b 100644 --- a/test/Makefile +++ b/test/Makefile @@ -12,9 +12,12 @@ CC = gcc SRCROOT = .. # -include shim first so __xdata/__code/__banked vanish before any firmware header. CFLAGS = -std=gnu11 -g -O1 -Wall -Wextra -Wno-unused-parameter -Wno-unknown-pragmas \ - -Wno-builtin-declaration-mismatch -DRTLP_HOST_TEST \ + -DRTLP_HOST_TEST \ -fsanitize=address,undefined -fno-omit-frame-pointer \ -include sdcc_shim.h -I. -I$(SRCROOT) -I$(SRCROOT)/httpd -I$(SRCROOT)/uip +ifeq ($(findstring clang,$(shell $(CC) --version 2>/dev/null)),) +CFLAGS += -Wno-builtin-declaration-mismatch +endif LDFLAGS = -fsanitize=address,undefined BUILDDIR = build