summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2020-12-17 15:04:17 -0700
committerCommit Bot <commit-bot@chromium.org>2020-12-22 17:11:48 +0000
commit1eb7b2791fb3c67c183f88e8308242bb1cadc93d (patch)
tree676396222763db1d8a33819a2178d0cc556d00cb
parentd3dde4c56d3b00564087025032485495ddd18b75 (diff)
downloadchrome-ec-1eb7b2791fb3c67c183f88e8308242bb1cadc93d.tar.gz
zephyr: Add support for typeof()
This is not available with gcc when -std is used, as it is in Zephyr builds. Define typeof() so that the EC codebase case build, e.g. with the GEN_NOT_SUPPORTED() macro. BUG=b:175434113 BRANCH=none TEST=build zephyr for volteer emerge-volteer -q chromeos-ec Signed-off-by: Simon Glass <sjg@chromium.org> Change-Id: Ic923abeec6409857895c6b20f3c47d2d662ca1ba Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2597984 Reviewed-by: Keith Short <keithshort@chromium.org>
-rw-r--r--include/compiler.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/include/compiler.h b/include/compiler.h
index 21e5ae4a47..a78571ff11 100644
--- a/include/compiler.h
+++ b/include/compiler.h
@@ -12,4 +12,13 @@
#define GCC_VERSION \
(__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
+/*
+ * The EC codebase assumes that typeof() is available but it is not in Zephyr.
+ * We use an #ifdef since arch/arm/include/aarch32/cortex_m/cmse.h defines this
+ * macro.
+ */
+#ifndef typeof
+#define typeof(x) __typeof__(x)
+#endif
+
#endif /* __CROS_EC_COMPILER_H */