This module defines a toolchain abstraction layer through macros.

Macros

#define OT_MUST_USE_RESULT
Compiler-specific indication that a class or enum must be used when it is the return value of a function.
#define OT_TOOL_PACKED_BEGIN
Compiler-specific indication that a class or struct must be byte packed.
#define OT_TOOL_PACKED_FIELD
Indicate to the compiler a nested struct or union to be packed within byte packed class or struct.
#define OT_TOOL_WEAK
Compiler-specific weak symbol modifier.
#define OT_UNUSED_VARIABLE (VARIABLE)
Suppress unused variable warning in specific toolchains.
#define OT_UNREACHABLE_CODE (CODE) CODE
Suppress Unreachable code warning in specific toolchains.
#define OT_APPLE_IGNORE_GNU_FOLDING_CONSTANT (...) __VA_ARGS__
#define OT_FALL_THROUGH
Suppress fall through warning in specific compiler.

Detailed Description

This module defines a toolchain abstraction layer through macros.

Usage:

typedef
struct
{
char mField1;
union
{
char mField2;
long mField3;
} OT_TOOL_PACKED_END packed_struct_t;

Macro Definition Documentation

OT_FALL_THROUGH

#define OT_FALL_THROUGH
Value:
do \
{ \
} while ( false ) /* fallthrough */

Suppress fall through warning in specific compiler.

OT_MUST_USE_RESULT

#define OT_MUST_USE_RESULT

Compiler-specific indication that a class or enum must be used when it is the return value of a function.

Note
This is currently only available with clang (C++17 implements it as attribute [[nodiscard]]).
To suppress the 'unused-result' warning/error, please use the '-Wno-unused-result' compiler option.

OT_UNUSED_VARIABLE

#define OT_UNUSED_VARIABLE ( VARIABLE )
Value:
do \
{ \
(void)(VARIABLE); \
} while ( false )

Suppress unused variable warning in specific toolchains.