Toolchain#
This module defines a toolchain abstraction layer through macros.
Usage:
typedef
OT_TOOL_PACKED_BEGIN
struct
{
char mField1;
union
{
char mField2;
long mField3;
} OT_TOOL_PACKED_FIELD;
} OT_TOOL_PACKED_END packed_struct_t;
Macros#
Compiler-specific indication that a class or enum must be used when it is the return value of a function.
Compiler-specific indication that a class or struct must be byte packed.
Indicate to the compiler a nested struct or union to be packed within byte packed class or struct.
Compiler-specific weak symbol modifier.
This macro specifies that a function or method takes printf
style arguments and should be type-checked against a format string.
Suppress unused variable warning in specific toolchains.
Suppress Unreachable code warning in specific toolchains.
Suppress fall through warning in specific compiler.
Macro Definition Documentation#
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.
81
of file include/openthread/platform/toolchain.h
OT_TOOL_PACKED_BEGIN#
#define OT_TOOL_PACKED_BEGIN
Compiler-specific indication that a class or struct must be byte packed.
176
of file include/openthread/platform/toolchain.h
OT_TOOL_PACKED_FIELD#
#define OT_TOOL_PACKED_FIELD
Indicate to the compiler a nested struct or union to be packed within byte packed class or struct.
177
of file include/openthread/platform/toolchain.h
OT_TOOL_WEAK#
#define OT_TOOL_WEAK
Compiler-specific weak symbol modifier.
179
of file include/openthread/platform/toolchain.h
OT_TOOL_PRINTF_STYLE_FORMAT_ARG_CHECK#
#define OT_TOOL_PRINTF_STYLE_FORMAT_ARG_CHECK
This macro specifies that a function or method takes printf
style arguments and should be type-checked against a format string.
This macro must be added after the function/method declaration. For example:
void MyPrintf(void *aObject, const char *aFormat, ...) OT_TOOL_PRINTF_STYLE_FORMAT_ARG_CHECK(2, 3);
The two argument index values indicate format string and first argument to check against it. They start at index 1 for the first parameter in a function and at index 2 for the first parameter in a method.
181
of file include/openthread/platform/toolchain.h
OT_UNUSED_VARIABLE#
#define OT_UNUSED_VARIABLEValue:
Suppress unused variable warning in specific toolchains.
252
of file include/openthread/platform/toolchain.h
OT_UNREACHABLE_CODE#
#define OT_UNREACHABLE_CODEValue:
(CODE)
Suppress Unreachable code warning in specific toolchains.
258
of file include/openthread/platform/toolchain.h
OT_APPLE_IGNORE_GNU_FOLDING_CONSTANT#
#define OT_APPLE_IGNORE_GNU_FOLDING_CONSTANTValue:
(...)
284
of file include/openthread/platform/toolchain.h
OT_FALL_THROUGH#
#define OT_FALL_THROUGHValue:
Suppress fall through warning in specific compiler.
300
of file include/openthread/platform/toolchain.h