mirror of
https://github.com/ThrowTheSwitch/Unity.git
synced 2025-07-23 02:22:32 +08:00
UNITY_OUTPUT_CHAR can emit a redundant declaration, we scope the extern declartion to the unity.c
This commit is contained in:
@ -7,6 +7,11 @@
|
||||
#include "unity.h"
|
||||
#include <stddef.h>
|
||||
|
||||
#ifndef UNITY_OUTPUT_CHAR_USE_PUTC
|
||||
//If defined as something else, make sure we declare it here so it's ready for use
|
||||
extern int UNITY_OUTPUT_CHAR(int);
|
||||
#endif
|
||||
|
||||
#define UNITY_FAIL_AND_BAIL { Unity.CurrentTestFailed = 1; longjmp(Unity.AbortFrame, 1); }
|
||||
#define UNITY_IGNORE_AND_BAIL { Unity.CurrentTestIgnored = 1; longjmp(Unity.AbortFrame, 1); }
|
||||
/// return prematurely if we are already in failure or ignore state
|
||||
|
@ -291,9 +291,12 @@ typedef UNITY_DOUBLE_TYPE _UD;
|
||||
//Default to using putchar, which is defined in stdio.h
|
||||
#include <stdio.h>
|
||||
#define UNITY_OUTPUT_CHAR(a) putchar(a)
|
||||
#else
|
||||
//If defined as something else, make sure we declare it here so it's ready for use
|
||||
extern int UNITY_OUTPUT_CHAR(int);
|
||||
// We need to flag the output char function uses putc in
|
||||
// unity.c the extern function is not declared then.
|
||||
// Previously the extern was declared in this header but
|
||||
// when redundant function declaration compiler flag is enabled
|
||||
// it wont compile.
|
||||
#define UNITY_OUTPUT_CHAR_USE_PUTC
|
||||
#endif
|
||||
|
||||
#ifndef UNITY_PRINT_EOL
|
||||
|
Reference in New Issue
Block a user