UNITY_OUTPUT_CHAR can emit a redundant declaration, we scope the extern declartion to the unity.c

This commit is contained in:
Jerry Jacobs
2016-04-13 12:19:04 +02:00
parent 8c37d7b98a
commit a27b03c79a
2 changed files with 11 additions and 3 deletions

View File

@ -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