Toolchain

This module defines a toolchain abstraction layer through macros.

Summary

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

OT_APPLE_IGNORE_GNU_FOLDING_CONSTANT __VA_ARGS__
OT_FALL_THROUGH do \ { \ } while (false) /* fallthrough */
Suppress fall through warning in specific compiler.
OT_MUST_USE_RESULT
Compiler-specific indication that a class or enum must be used when it is the return value of a function.
OT_TOOL_PACKED_BEGIN
Compiler-specific indication that a class or struct must be byte packed.
OT_TOOL_PACKED_FIELD
Indicate to the compiler a nested struct or union to be packed within byte packed class or struct.
OT_TOOL_PRINTF_STYLE_FORMAT_ARG_CHECK
Specifies that a function or method takes printf style arguments and should be type-checked against a format string.
OT_TOOL_WEAK
Compiler-specific weak symbol modifier.
OT_UNREACHABLE_CODE CODE
Suppress Unreachable code warning in specific toolchains.
OT_UNUSED_VARIABLE do \ { \ (void)(VARIABLE); \ } while (false)
Suppress unused variable warning in specific toolchains.

Macros

OT_APPLE_IGNORE_GNU_FOLDING_CONSTANT

 OT_APPLE_IGNORE_GNU_FOLDING_CONSTANT __VA_ARGS__

OT_FALL_THROUGH

 OT_FALL_THROUGH do                  \
    {                   \
    } while (false) /* fallthrough */

Suppress fall through warning in specific compiler.

OT_MUST_USE_RESULT

 OT_MUST_USE_RESULT

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

OT_TOOL_PACKED_BEGIN

 OT_TOOL_PACKED_BEGIN

Compiler-specific indication that a class or struct must be byte packed.

OT_TOOL_PACKED_FIELD

 OT_TOOL_PACKED_FIELD

Indicate to the compiler a nested struct or union to be packed within byte packed class or struct.

OT_TOOL_PRINTF_STYLE_FORMAT_ARG_CHECK

 OT_TOOL_PRINTF_STYLE_FORMAT_ARG_CHECK

Specifies that a function or method takes printf style arguments and should be type-checked against a format string.

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.

Details
Parameters
[in] aFmtIndex
The argument index of the format string.
[in] aStartIndex
The argument index of the first argument to check against the format string.

OT_TOOL_WEAK

 OT_TOOL_WEAK

Compiler-specific weak symbol modifier.

OT_UNREACHABLE_CODE

 OT_UNREACHABLE_CODE CODE

Suppress Unreachable code warning in specific toolchains.

OT_UNUSED_VARIABLE

 OT_UNUSED_VARIABLE do                               \
    {                                \
        (void)(VARIABLE);            \
    } while (false)

Suppress unused variable warning in specific toolchains.

Resources

OpenThread API Reference topics originate from the source code, available on GitHub. For more information, or to contribute to our documentation, refer to Resources.