1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-12-25 22:43:50 +01:00

core/lib/include/compiler_hints.h: fix style

This adds indent to make reading preprocessor conditionals easier, as
is recommended by our coding convention.
This commit is contained in:
Marian Buschsieweke 2025-04-26 18:40:32 +02:00
parent 85233b355b
commit 914429c5f5
No known key found for this signature in database
GPG Key ID: 77AA882EC78084E6

View File

@ -33,11 +33,11 @@ extern "C" {
* cannot return.
*/
#ifndef NORETURN
#ifdef __GNUC__
#define NORETURN __attribute__((noreturn))
#else
#define NORETURN
#endif
# ifdef __GNUC__
# define NORETURN __attribute__((noreturn))
# else
# define NORETURN
# endif
#endif
/**
@ -48,11 +48,11 @@ extern "C" {
* optimization just as an arithmetic operator would be.
*/
#ifndef PURE
#ifdef __GNUC__
#define PURE __attribute__((pure))
#else
#define PURE
#endif
# ifdef __GNUC__
# define PURE __attribute__((pure))
# else
# define PURE
# endif
#endif
/**
@ -61,11 +61,11 @@ extern "C" {
* static functions, function arguments, local variables
*/
#ifndef MAYBE_UNUSED
#ifdef __GNUC__
#define MAYBE_UNUSED __attribute__((unused))
#else
#define MAYBE_UNUSED
#endif
# ifdef __GNUC__
# define MAYBE_UNUSED __attribute__((unused))
# else
# define MAYBE_UNUSED
# endif
#endif
/**
@ -77,9 +77,9 @@ extern "C" {
* by llvm.
*/
#if defined(__llvm__) || defined(__clang__)
#define NO_SANITIZE_ARRAY __attribute__((no_sanitize("address")))
# define NO_SANITIZE_ARRAY __attribute__((no_sanitize("address")))
#else
#define NO_SANITIZE_ARRAY
# define NO_SANITIZE_ARRAY
#endif
/**
@ -90,9 +90,9 @@ extern "C" {
* an assembler instruction causes a longjmp, or a write causes a reboot.
*/
#if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 5)) || (__GNUC__ >= 5) || defined(__clang__)
#define UNREACHABLE() __builtin_unreachable()
# define UNREACHABLE() __builtin_unreachable()
#else
#define UNREACHABLE() do { /* nothing */ } while (1)
# define UNREACHABLE() do { /* nothing */ } while (1)
#endif
/**
@ -138,12 +138,12 @@ extern "C" {
* This allows providing two different implementations in C, with one being
* more efficient if constant folding is used.
*/
#define IS_CT_CONSTANT(expr) <IMPLEMENTATION>
# define IS_CT_CONSTANT(expr) <IMPLEMENTATION>
#elif defined(__GNUC__)
/* both clang and gcc (which both define __GNUC__) support this */
#define IS_CT_CONSTANT(expr) __builtin_constant_p(expr)
# define IS_CT_CONSTANT(expr) __builtin_constant_p(expr)
#else
#define IS_CT_CONSTANT(expr) 0
# define IS_CT_CONSTANT(expr) 0
#endif
/**
@ -175,9 +175,9 @@ extern "C" {
* @param[in] cond Condition that is guaranteed to be true
*/
#ifdef NDEBUG
#define assume(cond) ((cond) ? (void)0 : UNREACHABLE())
# define assume(cond) ((cond) ? (void)0 : UNREACHABLE())
#else
#define assume(cond) assert(cond)
# define assume(cond) assert(cond)
#endif
/**