mirror of
https://github.com/ThrowTheSwitch/Unity.git
synced 2026-01-25 09:21:36 +01:00
Fix link errors with MinGW.
MinGW supports a limited form of weak symbols, with the restriction that weak/default implementations need to be defined in the same translation unit they are called from. Strong/overriding symbols may of course be specified in a different translation unit.
This commit is contained in:
18
src/unity.c
18
src/unity.c
@@ -5,6 +5,7 @@
|
||||
============================================================================ */
|
||||
|
||||
#include "unity.h"
|
||||
#include "unity_setup.h"
|
||||
#include <stddef.h>
|
||||
|
||||
/* If omitted from header, declare overrideable prototypes here so they're ready for use */
|
||||
@@ -1310,23 +1311,6 @@ void UnityIgnore(const char* msg, const UNITY_LINE_TYPE line)
|
||||
UNITY_IGNORE_AND_BAIL;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------*/
|
||||
#if defined(UNITY_WEAK_ATTRIBUTE)
|
||||
UNITY_WEAK_ATTRIBUTE void setUp(void) { }
|
||||
UNITY_WEAK_ATTRIBUTE void tearDown(void) { }
|
||||
UNITY_WEAK_ATTRIBUTE void suiteSetUp(void) { }
|
||||
UNITY_WEAK_ATTRIBUTE int suiteTearDown(int num_failures) { return num_failures; }
|
||||
#elif defined(UNITY_WEAK_PRAGMA)
|
||||
#pragma weak setUp
|
||||
void setUp(void) { }
|
||||
#pragma weak tearDown
|
||||
void tearDown(void) { }
|
||||
#pragma weak suiteSetUp
|
||||
void suiteSetUp(void) { }
|
||||
#pragma weak suiteTearDown
|
||||
int suiteTearDown(int num_failures) { return num_failures; }
|
||||
#endif
|
||||
|
||||
/*-----------------------------------------------*/
|
||||
void UnityDefaultTestRun(UnityTestFunction Func, const char* FuncName, const int FuncLineNum)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user