瀏覽代碼

Add a conditional check for the macro __STDC_VERSION__ (#4080)

yangkun27 11 月之前
父節點
當前提交
71bc3c2d15
共有 2 個文件被更改,包括 2 次插入2 次删除
  1. 1 1
      core/iwasm/include/wasm_c_api.h
  2. 1 1
      core/shared/utils/bh_assert.h

+ 1 - 1
core/iwasm/include/wasm_c_api.h

@@ -46,7 +46,7 @@ extern "C" {
 // Auxiliaries
 
 // Machine types
-#if (__STDC_VERSION__) > 199901L
+#if defined(__STDC_VERSION__) && (__STDC_VERSION__) > 199901L
 inline void assertions(void) {
   static_assert(sizeof(float) == sizeof(uint32_t), "incompatible float type");
   static_assert(sizeof(double) == sizeof(uint64_t), "incompatible double type");

+ 1 - 1
core/shared/utils/bh_assert.h

@@ -26,7 +26,7 @@ bh_assert_internal(int64 v, const char *file_name, int line_number,
 #define __has_extension(a) 0
 #endif
 
-#if __STDC_VERSION__ >= 201112L                                          \
+#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L)           \
     || (defined(__GNUC__) && __GNUC__ * 0x100 + __GNUC_MINOR__ >= 0x406) \
     || __has_extension(c_static_assert)