- support "weak" function definitions when available with compiler.

This commit is contained in:
Mark VanderVoord
2014-07-08 12:14:26 -04:00
parent e83439528b
commit 39cc60ce56
2 changed files with 26 additions and 0 deletions

View File

@ -1092,8 +1092,14 @@ void UnityIgnore(const char* msg, const UNITY_LINE_TYPE line)
}
//-----------------------------------------------
#ifdef UNITY_SUPPORT_WEAK
void setUp(void) { }
void tearDown(void) { }
#else
void setUp(void);
void tearDown(void);
#endif
//-----------------------------------------------
void UnityDefaultTestRun(UnityTestFunction Func, const char* FuncName, const int FuncLineNum)
{
Unity.CurrentTestName = FuncName;

View File

@ -260,6 +260,26 @@ extern int UNITY_OUTPUT_CHAR(int);
#define UNITY_COUNTER_TYPE _U_UINT
#endif
//-------------------------------------------------------
// Language Features Available
//-------------------------------------------------------
#ifdef __GNUC__
#define UNITY_SUPPORT_WEAK __attribute__((weak))
#endif
#ifdef __clang__
#define UNITY_SUPPORT_WEAK __attribute__((weak))
#endif
#ifndef UNITY_WEAK
#ifdef UNITY_SUPPORT_WEAK
#define UNITY_WEAK __attribute__((weak))
#else
#define UNITY_WEAK
#endif
#endif
//-------------------------------------------------------
// Internal Structs Needed
//-------------------------------------------------------