1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-12-24 22:13:52 +01:00

Merge pull request #18884 from kfessel/p-macro-maybe-unused

core/lib: define MAYBE_UNUSED
This commit is contained in:
benpicco 2022-11-22 12:54:36 +01:00 committed by GitHub
commit 0621150bf0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

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