Parcourir la source

More VS warning management

Andre Weissflog il y a 7 ans
Parent
commit
1f028a7ad7
3 fichiers modifiés avec 35 ajouts et 26 suppressions
  1. 13 16
      sokol_app.h
  2. 10 1
      sokol_audio.h
  3. 12 9
      sokol_gfx.h

+ 13 - 16
sokol_app.h

@@ -569,6 +569,15 @@ extern const void* sapp_d3d11_get_depth_stencil_view(void);
 /*-- IMPLEMENTATION ----------------------------------------------------------*/
 #ifdef SOKOL_IMPL
 
+#ifdef _MSC_VER
+#pragma warning(push)
+#pragma warning(disable:4201)   /* nonstandard extension used: nameless struct/union */
+#pragma warning(disable:4115)   /* named type definition in parentheses */
+#pragma warning(disable:4054)   /* 'type cast': from function pointer */
+#pragma warning(disable:4055)   /* 'type cast': from data pointer */
+#pragma warning(disable:4505)   /* unreferenced local function has been removed */
+#endif
+
 #include <string.h> /* memset */
 
 /* check if the config defines are alright */
@@ -2146,16 +2155,8 @@ _SOKOL_PRIVATE const _sapp_gl_fbconfig* _sapp_gl_choose_fbconfig(const _sapp_gl_
 #if defined(SOKOL_D3D11)
 #define COBJMACROS
 #include <windows.h>
-#ifdef _MSC_VER
-#pragma warning(push)
-#pragma warning(disable:4201)   /* nonstandard extension used: nameless struct/union */
-#pragma warning(disable:4115)   /* named type definition in parentheses */
-#endif
 #include <d3d11.h>
 #include <dxgi.h>
-#ifdef _MSC_VER
-#pragma warning(pop)
-#endif
 #endif
 
 #ifndef DPI_ENUMS_DECLARED
@@ -2279,11 +2280,6 @@ more, you'll need to use you own gl header-generator/loader
 */
 #if !defined(SOKOL_WIN32_NO_GL_LOADER)
 #if defined(SOKOL_GLCORE33)
-#ifdef _MSC_VER
-#pragma warning(push)
-#pragma warning(disable:4054)   /* 'type cast': from function pointer */
-#pragma warning(disable:4055)   /* 'type cast': from data pointer */
-#endif
 #define __gl_h_ 1
 #define __gl32_h_ 1
 #define __gl31_h_ 1
@@ -2846,9 +2842,6 @@ _SOKOL_PRIVATE  void _sapp_win32_gl_loadfuncs(void) {
 #define glFrontFace _sapp_glFrontFace
 #define glCullFace _sapp_glCullFace
 
-#ifdef _MSC_VER
-#pragma warning(pop)
-#endif
 #endif /* SOKOL_WIN32_NO_GL_LOADER */
 
 #endif /* SOKOL_GLCORE33 */
@@ -5532,4 +5525,8 @@ const void* sapp_d3d11_get_depth_stencil_view(void) {
 } /* extern "C" */
 #endif
 
+#ifdef _MSC_VER
+#pragma warning(pop)
+#endif
+
 #endif /* SOKOL_IMPL */

+ 10 - 1
sokol_audio.h

@@ -158,6 +158,11 @@ extern int saudio_push(const float* frames, int num_frames);
 /*--- IMPLEMENTATION ---------------------------------------------------------*/
 #ifdef SOKOL_IMPL
 
+#ifdef _MSC_VER
+#pragma warning(push)
+#pragma warning(disable:4505)   /* unreferenced local function has been removed */
+#endif
+
 #ifndef SOKOL_DEBUG
     #ifdef _DEBUG
         #define SOKOL_DEBUG (1)
@@ -302,7 +307,7 @@ _SOKOL_PRIVATE void _saudio_fifo_init(_saudio_fifo* fifo, int packet_size, int n
     SOKOL_ASSERT((packet_size > 0) && (num_packets > 0));
     fifo->packet_size = packet_size;
     fifo->num_packets = num_packets;
-    fifo->base_ptr = SOKOL_MALLOC(packet_size * num_packets);
+    fifo->base_ptr = (uint8_t*) SOKOL_MALLOC(packet_size * num_packets);
     SOKOL_ASSERT(fifo->base_ptr);
     fifo->cur_packet = -1;
     fifo->cur_offset = 0;
@@ -678,4 +683,8 @@ int saudio_push(const float* frames, int num_frames) {
 } /* extern "C" */
 #endif
 
+#ifdef _MSC_VER
+#pragma warning(pop)
+#endif
+
 #endif /* SOKOL_IMPL */

+ 12 - 9
sokol_gfx.h

@@ -1547,6 +1547,13 @@ extern void sg_discard_context(sg_context ctx_id);
 /*--- IMPLEMENTATION ---------------------------------------------------------*/
 #ifdef SOKOL_IMPL
 
+#ifdef _MSC_VER
+#pragma warning(push)
+#pragma warning(disable:4201)   /* nonstandard extension used: nameless struct/union */
+#pragma warning(disable:4115)   /* named type definition in parentheses */
+#pragma warning(disable:4505)   /* unreferenced local function has been removed */
+#endif
+
 #ifndef SOKOL_DEBUG
     #ifdef _DEBUG
         #define SOKOL_DEBUG (1)
@@ -3201,7 +3208,7 @@ _SOKOL_PRIVATE void _sg_gl_load_blend(const sg_blend_state* src, sg_blend_state*
         dst->color_write_mask = 0;
     }
     else {
-        dst->color_write_mask = _sg_def((sg_color_mask)src->color_write_mask, SG_COLORMASK_RGBA);
+        dst->color_write_mask = (uint8_t) _sg_def((sg_color_mask)src->color_write_mask, SG_COLORMASK_RGBA);
     }
     for (int i = 0; i < 4; i++) {
         dst->blend_color[i] = src->blend_color[i];
@@ -4093,11 +4100,6 @@ _SOKOL_PRIVATE void _sg_update_image(_sg_image* img, const sg_image_content* dat
 #define WIN32_LEAN_AND_MEAN
 #endif
 #include <windows.h>
-#ifdef _MSC_VER
-#pragma warning(push)
-#pragma warning(disable:4201)   /* nonstandard extension used: nameless struct/union */
-#pragma warning(disable:4115)   /* named type definition in parentheses */
-#endif
 #include <d3d11.h>
 #if (defined(WINAPI_FAMILY_PARTITION) && !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP))
 #pragma comment (lib, "WindowsApp.lib")
@@ -4113,9 +4115,6 @@ _SOKOL_PRIVATE void _sg_update_image(_sg_image* img, const sg_image_content* dat
 #pragma comment (lib, "d3dcompiler.lib")
 #endif
 #endif
-#ifdef _MSC_VER
-#pragma warning(pop)
-#endif
 
 #ifdef __cplusplus
 extern "C" {
@@ -9030,4 +9029,8 @@ void sg_update_image(sg_image img_id, const sg_image_content* data) {
 } /* extern "C" */
 #endif
 
+#ifdef _MSC_VER
+#pragma warning(pop)
+#endif
+
 #endif /* SOKOL_IMPL */