Zephyr API Documentation 4.4.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
Toolchain abstraction

Macros allowing to abstract compiler capabilities that utilize toolchain specific attributes and/or pragmas. More...

Files

file  toolchain.h
 Macros to abstract toolchain specific capabilities.

Compiler builtins, versions, and feature probes

#define HAS_BUILTIN(x)
 Check if the compiler supports the built-in function x.
#define TOOLCHAIN_GCC_VERSION   0
 GCC version in xxyyzz for xx.yy.zz.
#define TOOLCHAIN_CLANG_VERSION   0
 Clang version in xxyyzz for xx.yy.zz.
#define TOOLCHAIN_HAS_PRAGMA_DIAG   0
 Indicate if toolchain supports #pragma diagnostics.
#define TOOLCHAIN_HAS_C_GENERIC   0
 Indicate if toolchain supports C Generic.
#define TOOLCHAIN_HAS_C_AUTO_TYPE   0
 Indicate if toolchain supports C __auto_type.
#define TOOLCHAIN_HAS_ZLA   0
 Indicate if toolchain supports Zero Length Arrays.
#define TOOLCHAIN_PRAGMA(x)
 Helper for using pragma in macros.

Compiler warning identifiers

#define TOOLCHAIN_WARNING_ADDRESS_OF_PACKED_MEMBER
 Toolchain-specific warning for taking the address of a packed member.
#define TOOLCHAIN_WARNING_ARRAY_BOUNDS
 Toolchain-specific warning for array bounds violations.
#define TOOLCHAIN_WARNING_ATTRIBUTES
 Toolchain-specific warning for unknown attributes.
#define TOOLCHAIN_WARNING_DELETE_NON_VIRTUAL_DTOR
 Toolchain-specific warning for deleting a pointer to an object with a non-virtual destructor.
#define TOOLCHAIN_WARNING_EXTRA
 Toolchain-specific warning for extra warnings.
#define TOOLCHAIN_WARNING_ARM_INTERRUPT_VFP_CLOBBER
 Toolchain-specific warning for ARM interrupt service routines with VFP enabled that may clobber the VFP state.
#define TOOLCHAIN_WARNING_NONNULL
 Toolchain-specific warning for null pointer arguments to functions marked with "nonnull".
#define TOOLCHAIN_WARNING_POINTER_ARITH
 Toolchain-specific warning for pointer arithmetic.
#define TOOLCHAIN_WARNING_SHADOW
 Toolchain-specific warning for shadow variables.
#define TOOLCHAIN_WARNING_UNUSED_LABEL
 Toolchain-specific warning for unused labels.
#define TOOLCHAIN_WARNING_UNUSED_VARIABLE
 Toolchain-specific warning for unused variables.
#define TOOLCHAIN_WARNING_ALWAYS_INLINE
 Toolchain-specific warning for inline functions.
#define TOOLCHAIN_WARNING_CAST_QUAL
 Toolchain-specific warning for pointer casts removing a type qualifier.

Compiler warning control

#define TOOLCHAIN_DISABLE_WARNING(warning)
 Disable the specified compiler warning for all compilers.
#define TOOLCHAIN_ENABLE_WARNING(warning)
 Re-enable the specified compiler warning for all compilers.
#define TOOLCHAIN_DISABLE_CLANG_WARNING(warning)
 Disable the specified compiler warning for clang.
#define TOOLCHAIN_ENABLE_CLANG_WARNING(warning)
 Re-enable the specified compiler warning for clang.
#define TOOLCHAIN_DISABLE_GCC_WARNING(warning)
 Disable the specified compiler warning for gcc.
#define TOOLCHAIN_ENABLE_GCC_WARNING(warning)
 Re-enable the specified compiler warning for gcc.
#define TOOLCHAIN_DISABLE_IAR_WARNING(warning)
 Disable the specified compiler warning for IAR compilers.
#define TOOLCHAIN_ENABLE_IAR_WARNING(warning)
 Re-enable the specified compiler warning for IAR compilers.

Detailed Description

Macros allowing to abstract compiler capabilities that utilize toolchain specific attributes and/or pragmas.

Macro Definition Documentation

◆ HAS_BUILTIN

#define HAS_BUILTIN ( x)

#include <zephyr/toolchain.h>

Value:
HAS_BUILTIN_##x

Check if the compiler supports the built-in function x.

This macro is for use with conditional compilation to enable code using a builtin function that may not be available in every compiler.

Parameters
xBuilt-in function identifier, including the leading underscores.
Returns
Nonzero if the built-in function is supported, or zero otherwise.

◆ TOOLCHAIN_CLANG_VERSION

#define TOOLCHAIN_CLANG_VERSION   0

#include <zephyr/toolchain.h>

Clang version in xxyyzz for xx.yy.zz.

Zero if not Clang compatible.

◆ TOOLCHAIN_DISABLE_CLANG_WARNING

#define TOOLCHAIN_DISABLE_CLANG_WARNING ( warning)

#include <zephyr/toolchain.h>

Disable the specified compiler warning for clang.

Parameters
warningClang warning identifier.

◆ TOOLCHAIN_DISABLE_GCC_WARNING

#define TOOLCHAIN_DISABLE_GCC_WARNING ( warning)

#include <zephyr/toolchain.h>

Disable the specified compiler warning for gcc.

Parameters
warningGCC warning identifier.

◆ TOOLCHAIN_DISABLE_IAR_WARNING

#define TOOLCHAIN_DISABLE_IAR_WARNING ( warning)

#include <zephyr/toolchain.h>

Disable the specified compiler warning for IAR compilers.

Parameters
warningIAR warning identifier.

◆ TOOLCHAIN_DISABLE_WARNING

#define TOOLCHAIN_DISABLE_WARNING ( warning)

#include <zephyr/toolchain.h>

Disable the specified compiler warning for all compilers.

Parameters
warningToolchain-specific warning identifier.

◆ TOOLCHAIN_ENABLE_CLANG_WARNING

#define TOOLCHAIN_ENABLE_CLANG_WARNING ( warning)

#include <zephyr/toolchain.h>

Re-enable the specified compiler warning for clang.

Can only be used after a call to TOOLCHAIN_DISABLE_CLANG_WARNING.

Parameters
warningClang warning identifier.

◆ TOOLCHAIN_ENABLE_GCC_WARNING

#define TOOLCHAIN_ENABLE_GCC_WARNING ( warning)

#include <zephyr/toolchain.h>

Re-enable the specified compiler warning for gcc.

Can only be used after a call to TOOLCHAIN_DISABLE_GCC_WARNING.

Parameters
warningGCC warning identifier.

◆ TOOLCHAIN_ENABLE_IAR_WARNING

#define TOOLCHAIN_ENABLE_IAR_WARNING ( warning)

#include <zephyr/toolchain.h>

Re-enable the specified compiler warning for IAR compilers.

Can only be used after a call to TOOLCHAIN_DISABLE_IAR_WARNING.

Parameters
warningIAR warning identifier.

◆ TOOLCHAIN_ENABLE_WARNING

#define TOOLCHAIN_ENABLE_WARNING ( warning)

#include <zephyr/toolchain.h>

Re-enable the specified compiler warning for all compilers.

Can only be used after a call to TOOLCHAIN_DISABLE_WARNING.

Parameters
warningToolchain-specific warning identifier.

◆ TOOLCHAIN_GCC_VERSION

#define TOOLCHAIN_GCC_VERSION   0

#include <zephyr/toolchain.h>

GCC version in xxyyzz for xx.yy.zz.

Zero if not GCC compatible.

◆ TOOLCHAIN_HAS_C_AUTO_TYPE

#define TOOLCHAIN_HAS_C_AUTO_TYPE   0

#include <zephyr/toolchain.h>

Indicate if toolchain supports C __auto_type.

◆ TOOLCHAIN_HAS_C_GENERIC

#define TOOLCHAIN_HAS_C_GENERIC   0

#include <zephyr/toolchain.h>

Indicate if toolchain supports C Generic.

◆ TOOLCHAIN_HAS_PRAGMA_DIAG

#define TOOLCHAIN_HAS_PRAGMA_DIAG   0

#include <zephyr/toolchain.h>

Indicate if toolchain supports #pragma diagnostics.

◆ TOOLCHAIN_HAS_ZLA

#define TOOLCHAIN_HAS_ZLA   0

#include <zephyr/toolchain.h>

Indicate if toolchain supports Zero Length Arrays.

◆ TOOLCHAIN_PRAGMA

#define TOOLCHAIN_PRAGMA ( x)

#include <zephyr/toolchain.h>

Value:
_Pragma(#x)

Helper for using pragma in macros.

Parameters
xPragma directive body.

◆ TOOLCHAIN_WARNING_ADDRESS_OF_PACKED_MEMBER

#define TOOLCHAIN_WARNING_ADDRESS_OF_PACKED_MEMBER

#include <zephyr/toolchain.h>

Toolchain-specific warning for taking the address of a packed member.

Use this as an argument to the TOOLCHAIN_DISABLE_WARNING and TOOLCHAIN_ENABLE_WARNING family of macros.

◆ TOOLCHAIN_WARNING_ALWAYS_INLINE

#define TOOLCHAIN_WARNING_ALWAYS_INLINE

#include <zephyr/toolchain.h>

Toolchain-specific warning for inline functions.

Use this as an argument to the TOOLCHAIN_DISABLE_WARNING and TOOLCHAIN_ENABLE_WARNING family of macros.

◆ TOOLCHAIN_WARNING_ARM_INTERRUPT_VFP_CLOBBER

#define TOOLCHAIN_WARNING_ARM_INTERRUPT_VFP_CLOBBER

#include <zephyr/toolchain.h>

Toolchain-specific warning for ARM interrupt service routines with VFP enabled that may clobber the VFP state.

Use this as an argument to the TOOLCHAIN_DISABLE_WARNING and TOOLCHAIN_ENABLE_WARNING family of macros.

◆ TOOLCHAIN_WARNING_ARRAY_BOUNDS

#define TOOLCHAIN_WARNING_ARRAY_BOUNDS

#include <zephyr/toolchain.h>

Toolchain-specific warning for array bounds violations.

Use this as an argument to the TOOLCHAIN_DISABLE_WARNING and TOOLCHAIN_ENABLE_WARNING family of macros.

◆ TOOLCHAIN_WARNING_ATTRIBUTES

#define TOOLCHAIN_WARNING_ATTRIBUTES

#include <zephyr/toolchain.h>

Toolchain-specific warning for unknown attributes.

Use this as an argument to the TOOLCHAIN_DISABLE_WARNING and TOOLCHAIN_ENABLE_WARNING family of macros.

◆ TOOLCHAIN_WARNING_CAST_QUAL

#define TOOLCHAIN_WARNING_CAST_QUAL

#include <zephyr/toolchain.h>

Toolchain-specific warning for pointer casts removing a type qualifier.

Use this as an argument to the TOOLCHAIN_DISABLE_WARNING and TOOLCHAIN_ENABLE_WARNING family of macros.

◆ TOOLCHAIN_WARNING_DELETE_NON_VIRTUAL_DTOR

#define TOOLCHAIN_WARNING_DELETE_NON_VIRTUAL_DTOR

#include <zephyr/toolchain.h>

Toolchain-specific warning for deleting a pointer to an object with a non-virtual destructor.

Use this as an argument to the TOOLCHAIN_DISABLE_WARNING and TOOLCHAIN_ENABLE_WARNING family of macros.

◆ TOOLCHAIN_WARNING_EXTRA

#define TOOLCHAIN_WARNING_EXTRA

#include <zephyr/toolchain.h>

Toolchain-specific warning for extra warnings.

Use this as an argument to the TOOLCHAIN_DISABLE_WARNING and TOOLCHAIN_ENABLE_WARNING family of macros.

◆ TOOLCHAIN_WARNING_NONNULL

#define TOOLCHAIN_WARNING_NONNULL

#include <zephyr/toolchain.h>

Toolchain-specific warning for null pointer arguments to functions marked with "nonnull".

Use this as an argument to the TOOLCHAIN_DISABLE_WARNING and TOOLCHAIN_ENABLE_WARNING family of macros.

◆ TOOLCHAIN_WARNING_POINTER_ARITH

#define TOOLCHAIN_WARNING_POINTER_ARITH

#include <zephyr/toolchain.h>

Toolchain-specific warning for pointer arithmetic.

Use this as an argument to the TOOLCHAIN_DISABLE_WARNING and TOOLCHAIN_ENABLE_WARNING family of macros.

◆ TOOLCHAIN_WARNING_SHADOW

#define TOOLCHAIN_WARNING_SHADOW

#include <zephyr/toolchain.h>

Toolchain-specific warning for shadow variables.

Use this as an argument to the TOOLCHAIN_DISABLE_WARNING and TOOLCHAIN_ENABLE_WARNING family of macros.

◆ TOOLCHAIN_WARNING_UNUSED_LABEL

#define TOOLCHAIN_WARNING_UNUSED_LABEL

#include <zephyr/toolchain.h>

Toolchain-specific warning for unused labels.

Use this as an argument to the TOOLCHAIN_DISABLE_WARNING and TOOLCHAIN_ENABLE_WARNING family of macros.

◆ TOOLCHAIN_WARNING_UNUSED_VARIABLE

#define TOOLCHAIN_WARNING_UNUSED_VARIABLE

#include <zephyr/toolchain.h>

Toolchain-specific warning for unused variables.

Use this as an argument to the TOOLCHAIN_DISABLE_WARNING and TOOLCHAIN_ENABLE_WARNING family of macros.