From 4a59f29362bedf0bc1ca7636a1cd086c205074be Mon Sep 17 00:00:00 2001 From: Ross Smyth <18294397+RossSmyth@users.noreply.github.com> Date: Wed, 2 Jul 2025 21:43:20 -0400 Subject: [PATCH] Fix -Wmissing-prototypes errors This one was a bit tough, but I think this works fine. --- test/Makefile | 2 +- test/tests/self_assessment_utils.h | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/test/Makefile b/test/Makefile index c5a26ab..b0b9699 100644 --- a/test/Makefile +++ b/test/Makefile @@ -10,7 +10,7 @@ CC = clang endif ifeq ($(findstring clang, $(CC)), clang) E = -Weverything -CFLAGS += $E -Wno-unknown-warning-option -Wno-missing-prototypes +CFLAGS += $E -Wno-unknown-warning-option CFLAGS += -Wno-unsafe-buffer-usage endif CFLAGS += -std=c99 -pedantic -Wall -Wextra -Werror diff --git a/test/tests/self_assessment_utils.h b/test/tests/self_assessment_utils.h index f764ca9..24b755f 100644 --- a/test/tests/self_assessment_utils.h +++ b/test/tests/self_assessment_utils.h @@ -72,6 +72,11 @@ static char putcharSpyBuffer[SPY_BUFFER_MAX]; static UNITY_COUNTER_TYPE indexSpyBuffer; static UNITY_COUNTER_TYPE putcharSpyEnabled; +#ifdef __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#endif + void startPutcharSpy(void) { indexSpyBuffer = 0; @@ -133,6 +138,10 @@ void flushSpy(void) if (flushSpyEnabled){ flushSpyCalls++; } } +#ifdef __clang__ +#pragma clang diagnostic pop +#endif + #define TEST_ASSERT_EQUAL_PRINT_NUMBERS(expected, actual) do { \ startPutcharSpy(); UnityPrintNumber((actual)); endPutcharSpy(); \ TEST_ASSERT_EQUAL_STRING((expected), getBufferPutcharSpy()); \ @@ -149,3 +158,10 @@ void flushSpy(void) } while (0) #endif + +// The reason this isn't folded into the above diagnostic is to semi-isolate +// the header contents from the user content it is included into. +#ifdef __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#endif