diff options
author | Tom Hughes <tomhughes@chromium.org> | 2020-07-28 11:37:48 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-08-17 20:14:45 +0000 |
commit | aca8db3d63a3521784d5b6ca38f285bc7680404d (patch) | |
tree | b68fcdab1743ae18317e0b47505353f18480d120 | |
parent | 42473f7414e4b15d6813b5c722a1e5d251fc77c0 (diff) | |
download | chrome-ec-aca8db3d63a3521784d5b6ca38f285bc7680404d.tar.gz |
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 <tomhughes@chromium.org>
Change-Id: Ie6c83e5ed0c331fc14a7f6092dae6220ba20cd54
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2324815
Reviewed-by: Ting Shen <phoenixshen@chromium.org>
-rw-r--r-- | builtin/stdnoreturn.h | 20 |
1 files changed, 20 insertions, 0 deletions
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__ */ |