PatchworkOS
Loading...
Searching...
No Matches
Kernel Defines

Defines. More...

Macros

#define ALIGNED(alignment)   __attribute__((aligned(alignment)))
 GCC aligned attribute.
 
#define PACKED   __attribute__((packed))
 GCC packed attribute.
 
#define NORETURN   __attribute__((noreturn))
 GCC noreturn function attribute.
 
#define NOINLINE   __attribute__((noinline))
 GCC noinline function attribute.
 
#define CONST_FUNC   __attribute__((const))
 GCC const function attribute.
 
#define PURE_FUNC   __attribute__((pure))
 GCC.
 
#define CONCAT(a, b)   CONCAT_INNER(a, b)
 Concatenates two tokens.
 
#define CONCAT_INNER(a, b)   a##b
 Inner helper macro for token concatenation.
 

Detailed Description

Defines.

Macro Definition Documentation

◆ ALIGNED

#define ALIGNED (   alignment)    __attribute__((aligned(alignment)))

GCC aligned attribute.

Tells the compiler to align a variable or structure field to the specified byte alignment.

Usefull for caching or hardware requirements.

Definition at line 22 of file defs.h.

◆ CONCAT

#define CONCAT (   a,
 
)    CONCAT_INNER(a, b)

Concatenates two tokens.

This macro concatenates two tokens a and b into a single token.

Parameters
aThe first token.
bThe second token.
Returns
The concatenated token.

Definition at line 76 of file defs.h.

◆ CONCAT_INNER

#define CONCAT_INNER (   a,
 
)    a##b

Inner helper macro for token concatenation.

Definition at line 81 of file defs.h.

◆ CONST_FUNC

#define CONST_FUNC   __attribute__((const))

GCC const function attribute.

Tells the compiler that the fuction with said attribute only depends on the arguments passed to it, and will never access global variables.

Definition at line 56 of file defs.h.

◆ NOINLINE

#define NOINLINE   __attribute__((noinline))

GCC noinline function attribute.

Tells the compiler to never inline the function with said attribute.

Definition at line 47 of file defs.h.

◆ NORETURN

#define NORETURN   __attribute__((noreturn))

GCC noreturn function attribute.

Tells the compiler that the fuction with said attribute will never return.

Definition at line 39 of file defs.h.

◆ PACKED

#define PACKED   __attribute__((packed))

GCC packed attribute.

Tells the compiler to pack a structure, meaning there will be no padding between members.

Needed for most hardware structures.

Definition at line 32 of file defs.h.

◆ PURE_FUNC

#define PURE_FUNC   __attribute__((pure))

GCC.

The PURE_FUNC attribute tells gcc that the function with said attribute only depends on the arguments passed to it and potentially global variables.

Definition at line 65 of file defs.h.