Sfoglia il codice sorgente

fix compat warning

blueloveTH 5 mesi fa
parent
commit
9955a70c74
2 ha cambiato i file con 4 aggiunte e 3 eliminazioni
  1. 2 1
      CMakeLists.txt
  2. 2 2
      src/public/GlobalSetup.c

+ 2 - 1
CMakeLists.txt

@@ -34,9 +34,10 @@ else()
         add_definitions(-DNDEBUG)
     endif()
 
-    # disable -Wshorten-64-to-32 for apple
     if(APPLE)
         set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-shorten-64-to-32")
+    else()
+        set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-pointer-to-int-cast")
     endif()
 
     if(PK_ENABLE_DETERMINISM)

+ 2 - 2
src/public/GlobalSetup.c

@@ -29,8 +29,8 @@ void py_initialize() {
     bool is_little_endian = *(char*)&x == 1;
     if(!is_little_endian) c11__abort("is_little_endian != true");
 
-    static_assert(sizeof(py_TValue) == 24, "sizeof(py_TValue) != 24");
-    static_assert(offsetof(py_TValue, extra) == 4, "offsetof(py_TValue, extra) != 4");
+    _Static_assert(sizeof(py_TValue) == 24, "sizeof(py_TValue) != 24");
+    _Static_assert(offsetof(py_TValue, extra) == 4, "offsetof(py_TValue, extra) != 4");
 
     pk_current_vm = pk_all_vm[0] = &pk_default_vm;