1
0
mirror of https://github.com/ThrowTheSwitch/Unity.git synced 2026-01-23 08:25:58 +01:00

Merge pull request #564 from BAUR-GmbH/master

Use stdnoreturn.h for c11 and [[ noreturn ]] for c++11. Fixes #563
This commit is contained in:
Mark VanderVoord
2021-06-02 11:42:32 -04:00
committed by GitHub

View File

@@ -46,6 +46,20 @@
#define UNITY_FUNCTION_ATTR(a) /* ignore */ #define UNITY_FUNCTION_ATTR(a) /* ignore */
#endif #endif
#ifndef UNITY_NORETURN
#if defined(__cplusplus)
#if __cplusplus >= 201103L
#define UNITY_NORETURN [[ noreturn ]]
#endif
#elif defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L
#include <stdnoreturn.h>
#define UNITY_NORETURN noreturn
#endif
#endif
#ifndef UNITY_NORETURN
#define UNITY_NORETURN UNITY_FUNCTION_ATTR(noreturn)
#endif
/*------------------------------------------------------- /*-------------------------------------------------------
* Guess Widths If Not Specified * Guess Widths If Not Specified
*-------------------------------------------------------*/ *-------------------------------------------------------*/
@@ -618,8 +632,8 @@ void UnityAssertNumbersArrayWithin(const UNITY_UINT delta,
const UNITY_FLAGS_T flags); const UNITY_FLAGS_T flags);
#ifndef UNITY_EXCLUDE_SETJMP_H #ifndef UNITY_EXCLUDE_SETJMP_H
void UnityFail(const char* message, const UNITY_LINE_TYPE line) UNITY_FUNCTION_ATTR(noreturn); UNITY_NORETURN void UnityFail(const char* message, const UNITY_LINE_TYPE line);
void UnityIgnore(const char* message, const UNITY_LINE_TYPE line) UNITY_FUNCTION_ATTR(noreturn); UNITY_NORETURN void UnityIgnore(const char* message, const UNITY_LINE_TYPE line);
#else #else
void UnityFail(const char* message, const UNITY_LINE_TYPE line); void UnityFail(const char* message, const UNITY_LINE_TYPE line);
void UnityIgnore(const char* message, const UNITY_LINE_TYPE line); void UnityIgnore(const char* message, const UNITY_LINE_TYPE line);