2
0
Эх сурвалжийг харах

sokol_spine.h: fix unused warning on gcc

Andre Weissflog 2 жил өмнө
parent
commit
2c551d3205

+ 3 - 1
tests/functional/sokol_spine_test.c

@@ -47,7 +47,9 @@ static sspine_range load_data(const char* path) {
     const size_t alloc_size = size + 1;
     uint8_t* ptr = (uint8_t*)malloc(alloc_size);
     memset(ptr, 0, alloc_size);
-    fread(ptr, size, 1, fp);
+    // NOTE: GCC warns if result of fread() is ignored
+    size_t num_bytes = fread(ptr, size, 1, fp);
+    (void)num_bytes;
     fclose(fp);
     return (sspine_range) { .ptr = ptr, .size = size };
 }

+ 2 - 0
util/sokol_spine.h

@@ -2537,11 +2537,13 @@ static const char* _sspine_fs_source_dummy = "";
 #define _SSPINE_MAX_POOL_SIZE (1<<_SSPINE_SLOT_SHIFT)
 #define _SSPINE_SLOT_MASK (_SSPINE_MAX_POOL_SIZE-1)
 
+#if defined(SOKOL_DEBUG)
 #define _SSPINE_XMACRO(code) #code,
 static const char* _sspine_error_ids[] = {
     _SSPINE_ERRORS
 };
 #undef _SSPINE_XMACRO
+#endif // SOKOL_DEBUG
 
 typedef struct {
     float mvp[16];