1
0
mirror of https://github.com/ThrowTheSwitch/Unity.git synced 2026-01-28 18:54:27 +01:00

Merge pull request #94 from zanedp/win32-clang-weak-workaround

New macros for controlling use of weak linkage (Thanks Zane!)
This commit is contained in:
Mark VanderVoord
2014-12-16 10:41:40 -05:00
2 changed files with 19 additions and 17 deletions

View File

@@ -1101,12 +1101,17 @@ void UnityIgnore(const char* msg, const UNITY_LINE_TYPE line)
} }
//----------------------------------------------- //-----------------------------------------------
#ifdef UNITY_SUPPORT_WEAK #if defined(UNITY_WEAK_ATTRIBUTE)
UNITY_WEAK void setUp(void) { } UNITY_WEAK_ATTRIBUTE void setUp(void) { }
UNITY_WEAK void tearDown(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 #else
void setUp(void); void setUp(void);
void tearDown(void); void tearDown(void);
#endif #endif
//----------------------------------------------- //-----------------------------------------------
void UnityDefaultTestRun(UnityTestFunction Func, const char* FuncName, const int FuncLineNum) void UnityDefaultTestRun(UnityTestFunction Func, const char* FuncName, const int FuncLineNum)

View File

@@ -292,22 +292,19 @@ extern int UNITY_OUTPUT_CHAR(int);
//------------------------------------------------------- //-------------------------------------------------------
// Language Features Available // Language Features Available
//------------------------------------------------------- //-------------------------------------------------------
#if !defined(UNITY_WEAK_ATTRIBUTE) && !defined(UNITY_WEAK_PRAGMA)
#ifdef __GNUC__ # ifdef __GNUC__ // includes clang
#define UNITY_SUPPORT_WEAK __attribute__((weak)) # if !(defined(__WIN32__) && defined(__clang__))
# define UNITY_WEAK_ATTRIBUTE __attribute__((weak))
# endif
# endif
#endif #endif
#ifdef __clang__ #ifdef UNITY_NO_WEAK
#define UNITY_SUPPORT_WEAK __attribute__((weak)) # undef UNITY_WEAK_ATTRIBUTE
# undef UNITY_WEAK_PRAGMA
#endif #endif
#ifndef UNITY_WEAK
#ifdef UNITY_SUPPORT_WEAK
#define UNITY_WEAK UNITY_SUPPORT_WEAK
#else
#define UNITY_WEAK
#endif
#endif
//------------------------------------------------------- //-------------------------------------------------------
// Internal Structs Needed // Internal Structs Needed