From aca8db3d63a3521784d5b6ca38f285bc7680404d Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Tue, 28 Jul 2020 11:37:48 -0700 Subject: builtin: Add stdnoreturn.h _Noreturn was added in C11 and the convenience macro "noreturn" is specified by stdnoreturn.h: https://en.cppreference.com/w/c/language/_Noreturn. We need our own implementation of the header since we don't include the compiler's builtins. BRANCH=none BUG=none TEST=make buildall -j Signed-off-by: Tom Hughes Change-Id: Ie6c83e5ed0c331fc14a7f6092dae6220ba20cd54 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2324815 Reviewed-by: Ting Shen --- builtin/stdnoreturn.h | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 builtin/stdnoreturn.h (limited to 'builtin') diff --git a/builtin/stdnoreturn.h b/builtin/stdnoreturn.h new file mode 100644 index 0000000000..659d3c540f --- /dev/null +++ b/builtin/stdnoreturn.h @@ -0,0 +1,20 @@ +/* Copyright 2020 The Chromium OS Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +#ifndef __CROS_EC_STDNORETURN_H__ +#define __CROS_EC_STDNORETURN_H__ + +/* + * Only defined for C: https://en.cppreference.com/w/c/language/_Noreturn + * + * C++ uses [[noreturn]]: https://en.cppreference.com/w/cpp/language/attributes/noreturn + */ +#ifndef __cplusplus +#ifndef noreturn +#define noreturn _Noreturn +#endif +#endif + +#endif /* __CROS_EC_STDNORETURN_H__ */ -- cgit v1.2.1