[Mesa-dev] [PATCH] st/wgl: fix MinGW _alinged_malloc() compiler warning

Brian Paul brianp at vmware.com
Tue Sep 11 19:08:13 UTC 2018


With some versions of MinGW, in a 64-bit optimized build the
prototype for _aligned_malloc() isn't found so we get some compiler
warnings about using the undeclared function.  The root cause is
unknown but including malloc.h before windows.h solves the problem.
---
 src/gallium/state_trackers/wgl/stw_device.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/gallium/state_trackers/wgl/stw_device.c b/src/gallium/state_trackers/wgl/stw_device.c
index e43f12f..8bdfada 100644
--- a/src/gallium/state_trackers/wgl/stw_device.c
+++ b/src/gallium/state_trackers/wgl/stw_device.c
@@ -25,6 +25,11 @@
  *
  **************************************************************************/
 
+
+/* Include malloc.h before windows.h to ensure we get a prototype for
+ * _aligned_malloc() with MinGW.
+ */
+#include <malloc.h>
 #include <windows.h>
 
 #include "glapi/glapi.h"
-- 
2.7.4



More information about the mesa-dev mailing list