From a52ac4e207e8088f317dd2ec6ea940e5268e4569 Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Wed, 1 Jan 2025 16:36:23 +0100 Subject: [PATCH] build: Compile with -Wunused -Wall also on BSD. The new #define in oggdec_filter.c gets rid of the warnings such as 'OV_CALLBACKS_STREAMONLY_NOCLOSE' defined but not used [-Wunused-variable] on NetBSD. With the patch applied, the code still compiles without warnings. Tested on Linux, FreeBSD and Linux. --- Makefile.real | 7 +------ oggdec_filter.c | 8 ++++++++ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/Makefile.real b/Makefile.real index 3a6aea4c..a6aee13c 100644 --- a/Makefile.real +++ b/Makefile.real @@ -33,8 +33,6 @@ vardir := /var/paraslash mandir := $(datarootdir)/man/man1 MKDIR_P := mkdir -p -uname_s := $(shell uname -s 2>/dev/null || echo "UNKNOWN_OS") - ifeq ("$(origin O)", "command line") build_dir := $(O) else @@ -395,6 +393,7 @@ STRICT_CFLAGS += -Wformat -Wformat-security -Wmissing-format-attribute STRICT_CFLAGS += -fdata-sections -ffunction-sections STRICT_CFLAGS += -Wstrict-prototypes STRICT_CFLAGS += -Wshadow +STRICT_CFLAGS += -Wunused -Wall LDFLAGS += -Wl,--gc-sections @@ -403,10 +402,6 @@ ifeq ($(ENABLE_UBSAN), yes) LDFLAGS += -lubsan endif -ifeq ($(uname_s),Linux) - # these cause warnings on *BSD - STRICT_CFLAGS += -Wunused -Wall -endif cc-option = $(shell \ $(CC) $(1) -Werror -c -x c /dev/null -o /dev/null > /dev/null 2>&1 \ diff --git a/oggdec_filter.c b/oggdec_filter.c index 91c18c48..1d53f312 100644 --- a/oggdec_filter.c +++ b/oggdec_filter.c @@ -3,6 +3,14 @@ /** \file oggdec_filter.c Paraslash's ogg vorbis decoder. */ #include + +/* + * The static ogg-vorbis callback structures are only needed on Windows. At + * least with vorbistools-1.3.7, they cause warnings on NetBSD-10.0. The + * #define below instructs the preprocessor to not define these structures, + * avoiding the warnings. See the comment in vorbisfile.h for details. + */ +#define OV_EXCLUDE_STATIC_CALLBACKS #include #include "para.h" -- 2.39.5