diff options
author | Simon Glass <sjg@chromium.org> | 2020-12-21 16:27:32 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-12-24 00:01:32 +0000 |
commit | bab787e065cac46be3a3070b4060741108601475 (patch) | |
tree | 3c7d60c804eb203b0bf3c7bebb068c4ae6fbf4e6 | |
parent | da9bdddf31d1280e8dccf801c4fabf1d33478db3 (diff) | |
download | chrome-ec-bab787e065cac46be3a3070b4060741108601475.tar.gz |
zephyr: Avoid duplicate definition of GENMASK, etc.
These two macros are defined by Zephyr after this header is included.
Avoid this with an #ifdef.
BUG=b:175434113
BRANCH=none
TEST=build zephyr for volteer
Signed-off-by: Simon Glass <sjg@chromium.org>
Change-Id: Iaa802de3e49bbdbb68bf9044be28a93bd095c7de
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2600227
Reviewed-by: Keith Short <keithshort@chromium.org>
-rw-r--r-- | include/compile_time_macros.h | 2 | ||||
-rw-r--r-- | include/ec_commands.h | 7 | ||||
-rw-r--r-- | include/util.h | 6 |
3 files changed, 14 insertions, 1 deletions
diff --git a/include/compile_time_macros.h b/include/compile_time_macros.h index 15432549d3..3844898084 100644 --- a/include/compile_time_macros.h +++ b/include/compile_time_macros.h @@ -83,7 +83,7 @@ */ #ifndef CONFIG_ZEPHYR #define GENMASK(h, l) (((BIT(h)<<1) - 1) ^ (BIT(l) - 1)) -#endif #define GENMASK_ULL(h, l) (((BIT_ULL(h)<<1) - 1) ^ (BIT_ULL(l) - 1)) +#endif #endif /* __CROS_EC_COMPILE_TIME_MACROS_H */ diff --git a/include/ec_commands.h b/include/ec_commands.h index 6089fc1eb0..a59e75c800 100644 --- a/include/ec_commands.h +++ b/include/ec_commands.h @@ -56,6 +56,12 @@ extern "C" { #define BIT_ULL(nr) (1ULL << (nr)) #endif +/* + * When building Zephyr, this file ends up being included before Zephyr's + * include/sys/util.h so causes a warning there. We don't want to add an #ifdef + * in that file since it won't be accepted upstream. So work around it here. + */ +#ifndef CONFIG_ZEPHYR #ifndef GENMASK #define GENMASK(h, l) (((BIT(h) << 1) - 1) ^ (BIT(l) - 1)) #endif @@ -63,6 +69,7 @@ extern "C" { #ifndef GENMASK_ULL #define GENMASK_ULL(h, l) (((BIT_ULL(h) << 1) - 1) ^ (BIT_ULL(l) - 1)) #endif +#endif #endif /* __KERNEL__ */ diff --git a/include/util.h b/include/util.h index 3d788d01cb..2be43bddfb 100644 --- a/include/util.h +++ b/include/util.h @@ -95,11 +95,17 @@ extern "C" { /* Standard library functions */ int atoi(const char *nptr); + +#ifdef CONFIG_ZEPHYR +#include <ctype.h> +#else int isdigit(int c); int isspace(int c); int isalpha(int c); int isupper(int c); int isprint(int c); +#endif + int memcmp(const void *s1, const void *s2, size_t len); void *memcpy(void *dest, const void *src, size_t len); void *memset(void *dest, int c, size_t len); |