mirror of
https://github.com/ThrowTheSwitch/Unity.git
synced 2026-01-27 02:11:36 +01:00
Fixture C99 compliance on tricky macros for Spy & match core Unity version
Add CFLAGS in Fixture Makefile to catch C99 rules with '-pedantic'
This commit is contained in:
@@ -309,14 +309,17 @@ TEST_TEAR_DOWN(LeakDetection)
|
||||
}
|
||||
|
||||
// This tricky set of defines lets us see if we are using the Spy, returns 1 if true, else 0
|
||||
#define USING_OUTPUT_SPY(a) EXPAND_AND_USE_2ND(ASSIGN_VALUE(a), 0)
|
||||
#define USING_SPY_AS(a) EXPAND_AND_USE_2ND(ASSIGN_VALUE(a), 0)
|
||||
#define ASSIGN_VALUE(a) VAL_FUNC_##a
|
||||
#define VAL_FUNC_UnityOutputCharSpy_OutputChar() 0, 1
|
||||
#define EXPAND_AND_USE_2ND(a, b) SECOND_PARAM(a, b)
|
||||
#define EXPAND_AND_USE_2ND(a, b) SECOND_PARAM(a, b, throwaway)
|
||||
#define SECOND_PARAM(a, b, ...) b
|
||||
#if USING_SPY_AS(UNITY_OUTPUT_CHAR())
|
||||
#define USING_OUTPUT_SPY
|
||||
#endif
|
||||
TEST(LeakDetection, DetectsLeak)
|
||||
{
|
||||
#if USING_OUTPUT_SPY(UNITY_OUTPUT_CHAR()) == 0
|
||||
#ifndef USING_OUTPUT_SPY
|
||||
TEST_IGNORE_MESSAGE("Build with '-D UNITY_OUTPUT_CHAR=UnityOutputCharSpy_OutputChar' to enable tests");
|
||||
#else
|
||||
void* m = malloc(10);
|
||||
@@ -333,7 +336,7 @@ TEST(LeakDetection, DetectsLeak)
|
||||
|
||||
TEST(LeakDetection, BufferOverrunFoundDuringFree)
|
||||
{
|
||||
#if USING_OUTPUT_SPY(UNITY_OUTPUT_CHAR()) == 0
|
||||
#ifndef USING_OUTPUT_SPY
|
||||
UNITY_PRINT_EOL();
|
||||
TEST_IGNORE();
|
||||
#else
|
||||
@@ -352,7 +355,7 @@ TEST(LeakDetection, BufferOverrunFoundDuringFree)
|
||||
|
||||
TEST(LeakDetection, BufferOverrunFoundDuringRealloc)
|
||||
{
|
||||
#if USING_OUTPUT_SPY(UNITY_OUTPUT_CHAR()) == 0
|
||||
#ifndef USING_OUTPUT_SPY
|
||||
UNITY_PRINT_EOL();
|
||||
TEST_IGNORE();
|
||||
#else
|
||||
|
||||
Reference in New Issue
Block a user