1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

core/lib: compiler_hints guard NORETURN and PURE

This commit is contained in:
Karl Fessel 2022-11-11 16:36:56 +01:00
parent ba3ccfe32e
commit fe325ecdd2

View File

@ -30,11 +30,13 @@ extern "C" {
* @brief The *NORETURN* keyword tells the compiler to assume that the function * @brief The *NORETURN* keyword tells the compiler to assume that the function
* cannot return. * cannot return.
*/ */
#ifndef NORETURN
#ifdef __GNUC__ #ifdef __GNUC__
#define NORETURN __attribute__((noreturn)) #define NORETURN __attribute__((noreturn))
#else #else
#define NORETURN #define NORETURN
#endif #endif
#endif
/** /**
* @def PURE * @def PURE
@ -43,11 +45,13 @@ extern "C" {
* function can be subject to common subexpression elimination and loop * function can be subject to common subexpression elimination and loop
* optimization just as an arithmetic operator would be. * optimization just as an arithmetic operator would be.
*/ */
#ifndef PURE
#ifdef __GNUC__ #ifdef __GNUC__
#define PURE __attribute__((pure)) #define PURE __attribute__((pure))
#else #else
#define PURE #define PURE
#endif #endif
#endif
/** /**
* @def UNREACHABLE() * @def UNREACHABLE()