mirror of
https://github.com/ThrowTheSwitch/Unity.git
synced 2025-07-15 00:52:46 +08:00
New macros for controlling use of weak linkage
- `UNITY_WEAK_ATTRIBUTE`, if defined, is placed before declarations of weakly linked symbols. If not manually defined, it will be automatically set to `__attribute__((weak))` on GCC and Clang, except for Clang for Win32. - `UNITY_WEAK_PRAGMA`, if defined, will cause preprocessor to emit `#pragma weak setUp`, etc. Ignored if `UNITY_WEAK_ATTRIBUTE` is defined. - `UNITY_NO_WEAK` undefines both of the above resulting in no weakly linked symbols. Work around for ThrowTheSwitch/Unity#93
This commit is contained in:
15
src/unity.c
15
src/unity.c
@ -1101,12 +1101,17 @@ void UnityIgnore(const char* msg, const UNITY_LINE_TYPE line)
|
||||
}
|
||||
|
||||
//-----------------------------------------------
|
||||
#ifdef UNITY_SUPPORT_WEAK
|
||||
UNITY_WEAK void setUp(void) { }
|
||||
UNITY_WEAK void tearDown(void) { }
|
||||
#if defined(UNITY_WEAK_ATTRIBUTE)
|
||||
UNITY_WEAK_ATTRIBUTE void setUp(void) { }
|
||||
UNITY_WEAK_ATTRIBUTE void tearDown(void) { }
|
||||
#elif defined(UNITY_WEAK_PRAGMA)
|
||||
# pragma weak setUp
|
||||
void setUp(void);
|
||||
# pragma weak tearDown
|
||||
void tearDown(void);
|
||||
#else
|
||||
void setUp(void);
|
||||
void tearDown(void);
|
||||
void setUp(void);
|
||||
void tearDown(void);
|
||||
#endif
|
||||
//-----------------------------------------------
|
||||
void UnityDefaultTestRun(UnityTestFunction Func, const char* FuncName, const int FuncLineNum)
|
||||
|
Reference in New Issue
Block a user