Align with native_simulator's upstream main 7d652dbfb313260cf07d595ccf26638f2b3c2959 Which includes: * 7d652db Provide macros for noreturn and unreachable & annotate Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
33 lines
853 B
C
33 lines
853 B
C
/*
|
|
* Copyright (c) 2010-2014 Wind River Systems, Inc.
|
|
* Copyright (c) 2023 Nordic Semiconductor ASA
|
|
*
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
|
|
#ifndef NSI_COMMON_SRC_INCL_NSI_UTILS_H
|
|
#define NSI_COMMON_SRC_INCL_NSI_UTILS_H
|
|
|
|
/* Remove brackets from around a single argument: */
|
|
#define NSI_DEBRACKET(...) __VA_ARGS__
|
|
|
|
#define _NSI_STRINGIFY(x) #x
|
|
#define NSI_STRINGIFY(s) _NSI_STRINGIFY(s)
|
|
|
|
/* concatenate the values of the arguments into one */
|
|
#define NSI_DO_CONCAT(x, y) x ## y
|
|
#define NSI_CONCAT(x, y) NSI_DO_CONCAT(x, y)
|
|
|
|
#define NSI_MAX(a, b) (((a) > (b)) ? (a) : (b))
|
|
#define NSI_MIN(a, b) (((a) < (b)) ? (a) : (b))
|
|
|
|
#ifndef NSI_ARG_UNUSED
|
|
#define NSI_ARG_UNUSED(x) (void)(x)
|
|
#endif
|
|
|
|
#define NSI_CODE_UNREACHABLE __builtin_unreachable()
|
|
|
|
#define NSI_FUNC_NORETURN __attribute__((__noreturn__))
|
|
|
|
#endif /* NSI_COMMON_SRC_INCL_NSI_UTILS_H */
|