From 04a7cc322f0cf16ecea5a906e74a1893127d696e Mon Sep 17 00:00:00 2001 From: Huang Qi <757509347@qq.com> Date: Wed, 16 Sep 2020 17:53:03 +0800 Subject: [PATCH] core/shared: Add guard to avoid redefine macro (#386) Signed-off-by: Huang Qi Co-authored-by: Huang Qi --- core/shared/platform/include/platform_common.h | 10 ++++++++++ core/shared/utils/bh_log.h | 10 ++++++++++ 2 files changed, 20 insertions(+) diff --git a/core/shared/platform/include/platform_common.h b/core/shared/platform/include/platform_common.h index 33c93e43..02d71fc6 100644 --- a/core/shared/platform/include/platform_common.h +++ b/core/shared/platform/include/platform_common.h @@ -47,11 +47,21 @@ void BH_FREE(void *ptr); #endif #ifndef __cplusplus + +#ifndef true #define true 1 +#endif + +#ifndef false #define false 0 +#endif + +#ifndef inline #define inline __inline #endif +#endif + /* Return the offset of the given field in the given type */ #ifndef offsetof #define offsetof(Type, field) ((size_t)(&((Type *)0)->field)) diff --git a/core/shared/utils/bh_log.h b/core/shared/utils/bh_log.h index 6a5ead46..e0720964 100644 --- a/core/shared/utils/bh_log.h +++ b/core/shared/utils/bh_log.h @@ -41,6 +41,16 @@ bh_log_set_verbose_level(uint32 level); void bh_log(LogLevel log_level, const char *file, int line, const char *fmt, ...); +#ifdef BH_PLATFORM_NUTTX + +#undef LOG_FATAL +#undef LOG_ERROR +#undef LOG_WARNING +#undef LOG_VERBOSE +#undef LOG_DEBUG + +#endif + #if BH_DEBUG == 1 #define LOG_FATAL(...) bh_log(BH_LOG_LEVEL_FATAL, __FILE__, __LINE__, __VA_ARGS__) #else