Skip to content

Commit 4a59f29

Browse files
committed
Fix -Wmissing-prototypes errors
This one was a bit tough, but I think this works fine.
1 parent 6decd7a commit 4a59f29

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

test/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ CC = clang
1010
endif
1111
ifeq ($(findstring clang, $(CC)), clang)
1212
E = -Weverything
13-
CFLAGS += $E -Wno-unknown-warning-option -Wno-missing-prototypes
13+
CFLAGS += $E -Wno-unknown-warning-option
1414
CFLAGS += -Wno-unsafe-buffer-usage
1515
endif
1616
CFLAGS += -std=c99 -pedantic -Wall -Wextra -Werror

test/tests/self_assessment_utils.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,11 @@ static char putcharSpyBuffer[SPY_BUFFER_MAX];
7272
static UNITY_COUNTER_TYPE indexSpyBuffer;
7373
static UNITY_COUNTER_TYPE putcharSpyEnabled;
7474

75+
#ifdef __clang__
76+
#pragma clang diagnostic push
77+
#pragma clang diagnostic ignored "-Wmissing-prototypes"
78+
#endif
79+
7580
void startPutcharSpy(void)
7681
{
7782
indexSpyBuffer = 0;
@@ -133,6 +138,10 @@ void flushSpy(void)
133138
if (flushSpyEnabled){ flushSpyCalls++; }
134139
}
135140

141+
#ifdef __clang__
142+
#pragma clang diagnostic pop
143+
#endif
144+
136145
#define TEST_ASSERT_EQUAL_PRINT_NUMBERS(expected, actual) do { \
137146
startPutcharSpy(); UnityPrintNumber((actual)); endPutcharSpy(); \
138147
TEST_ASSERT_EQUAL_STRING((expected), getBufferPutcharSpy()); \
@@ -149,3 +158,10 @@ void flushSpy(void)
149158
} while (0)
150159

151160
#endif
161+
162+
// The reason this isn't folded into the above diagnostic is to semi-isolate
163+
// the header contents from the user content it is included into.
164+
#ifdef __clang__
165+
#pragma clang diagnostic push
166+
#pragma clang diagnostic ignored "-Wmissing-prototypes"
167+
#endif

0 commit comments

Comments
 (0)