Skip to content

Commit 4480cb3

Browse files
committed
Provide definition of alloca() in mpconfigport.h.
1 parent df896ec commit 4480cb3

7 files changed

Lines changed: 17 additions & 33 deletions

File tree

bare-arm/mpconfigport.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,5 @@ extern const struct _mp_obj_fun_native_t mp_builtin_open_obj;
4343
#define MICROPY_PORT_BUILTINS \
4444
{ MP_OBJ_NEW_QSTR(MP_QSTR_open), (mp_obj_t)&mp_builtin_open_obj },
4545

46+
// We need to provide a declaration/definition of alloca()
47+
#include <alloca.h>

qemu-arm/mpconfigport.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,5 @@ extern const struct _mp_obj_fun_native_t mp_builtin_open_obj;
3333
#define MICROPY_PORT_BUILTINS \
3434
{ MP_OBJ_NEW_QSTR(MP_QSTR_open), (mp_obj_t)&mp_builtin_open_obj },
3535

36+
// We need to provide a declaration/definition of alloca()
37+
#include <alloca.h>

stmhal/mpconfigport.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,3 +99,6 @@ typedef const void *machine_const_ptr_t; // must be of pointer size
9999

100100
// board specific definitions
101101
#include "mpconfigboard.h"
102+
103+
// We need to provide a declaration/definition of alloca()
104+
#include <alloca.h>

unix-cpy/mpconfigport.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,3 +48,10 @@ typedef unsigned int machine_uint_t; // must be pointer size
4848
typedef void *machine_ptr_t; // must be of pointer size
4949
typedef const void *machine_const_ptr_t; // must be of pointer size
5050
typedef double machine_float_t;
51+
52+
// We need to provide a declaration/definition of alloca()
53+
#ifdef __FreeBSD__
54+
#include <stdlib.h>
55+
#else
56+
#include <alloca.h>
57+
#endif

unix/mpconfigport.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,7 @@ extern const struct _mp_obj_fun_native_t mp_builtin_open_obj;
100100
{ MP_OBJ_NEW_QSTR(MP_QSTR_input), (mp_obj_t)&mp_builtin_input_obj }, \
101101
{ MP_OBJ_NEW_QSTR(MP_QSTR_open), (mp_obj_t)&mp_builtin_open_obj },
102102

103-
104-
/* We need the correct header for alloca() */
103+
// We need to provide a declaration/definition of alloca()
105104
#ifdef __FreeBSD__
106105
#include <stdlib.h>
107106
#else

windows/alloca.h

Lines changed: 0 additions & 29 deletions
This file was deleted.

windows/mpconfigport.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ void msec_sleep(double msec);
9292
#endif
9393

9494

95-
// CL specific overrides from mpconfig
95+
// CL specific overrides from mpconfig
9696

9797
#define NORETURN __declspec(noreturn)
9898
#define MICROPY_PORT_CONSTANTS { "dummy", 0 } //can't have zero-sized array
@@ -114,7 +114,7 @@ void msec_sleep(double msec);
114114

115115
#include <stddef.h> //for NULL
116116
#include <assert.h> //for assert
117-
#include <alloca.h> //for alloca()
117+
#include <malloc.h> //for alloca()
118118

119119
// Functions implemented in platform code
120120

0 commit comments

Comments
 (0)