Mesa (master): glthread: Fix use of alloca() without #include "c99_alloca.h"

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue May 12 15:07:14 UTC 2020


Module: Mesa
Branch: master
Commit: 38cc649fcb54baf87a974ca2dc29d92b50c86cfa
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=38cc649fcb54baf87a974ca2dc29d92b50c86cfa

Author: Jon Turney <jon.turney at dronecode.org.uk>
Date:   Wed May  6 16:09:56 2020 +0100

glthread: Fix use of alloca() without #include "c99_alloca.h"

../src/mesa/main/glthread_draw.c: In function ‘_mesa_marshal_MultiDrawElementsBaseVertex’:
../src/mesa/main/glthread_draw.c:812:36: error: implicit declaration of function ‘alloca’; did you mean ‘malloc’? [-Werror=implicit-function-declaration]
  812 |       const GLvoid **out_indices = alloca(sizeof(indices[0]) * draw_count);
      |                                    ^~~~~~
      |                                    malloc
../src/mesa/main/glthread_draw.c:812:36: error: initialization of ‘const GLvoid **’ {aka ‘const void **’} from ‘int’ makes pointer from integer without a cast [-Werror=int-conversion]
cc1: some warnings being treated as errors

Include c99_alloca.h to portably make the alloca() prototype available.

Fixes: 2840bc30
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4920>

---

 src/mesa/main/glthread_draw.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/mesa/main/glthread_draw.c b/src/mesa/main/glthread_draw.c
index 3ed75e470bd..8e6aeca002a 100644
--- a/src/mesa/main/glthread_draw.c
+++ b/src/mesa/main/glthread_draw.c
@@ -27,6 +27,8 @@
  * index data, so that glthread doesn't have to execute synchronously.
  */
 
+#include "c99_alloca.h"
+
 #include "main/glthread_marshal.h"
 #include "main/dispatch.h"
 #include "main/varray.h"



More information about the mesa-commit mailing list