diff options
author | Damien George <damien.p.george@gmail.com> | 2014-06-08 13:26:02 +0100 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2014-06-08 13:26:02 +0100 |
commit | 70c289a7a671dd783dc9beb93288a3d0b5c61513 (patch) | |
tree | 856afe4dbfbeea23134dd40275cbd1aa96a1d0ed | |
parent | 9e951498b28706bac7347d3c599977c13d9515c4 (diff) | |
parent | 4480cb37118b662cf301953595b37704dc197d40 (diff) | |
download | micropython-70c289a7a671dd783dc9beb93288a3d0b5c61513.tar.gz micropython-70c289a7a671dd783dc9beb93288a3d0b5c61513.zip |
Merge branch 'marcusva-alloca'
-rw-r--r-- | bare-arm/mpconfigport.h | 2 | ||||
-rw-r--r-- | py/builtinimport.c | 1 | ||||
-rw-r--r-- | py/objfun.c | 1 | ||||
-rw-r--r-- | py/runtime.c | 1 | ||||
-rw-r--r-- | py/vm.c | 1 | ||||
-rw-r--r-- | qemu-arm/mpconfigport.h | 2 | ||||
-rw-r--r-- | stmhal/mpconfigport.h | 3 | ||||
-rw-r--r-- | unix-cpy/mpconfigport.h | 7 | ||||
-rw-r--r-- | unix/modsocket.c | 1 | ||||
-rw-r--r-- | unix/mpconfigport.h | 7 | ||||
-rw-r--r-- | windows/alloca.h | 29 | ||||
-rw-r--r-- | windows/mpconfigport.h | 4 |
12 files changed, 23 insertions, 36 deletions
diff --git a/bare-arm/mpconfigport.h b/bare-arm/mpconfigport.h index 73b66802fe..1587dca57a 100644 --- a/bare-arm/mpconfigport.h +++ b/bare-arm/mpconfigport.h @@ -43,3 +43,5 @@ extern const struct _mp_obj_fun_native_t mp_builtin_open_obj; #define MICROPY_PORT_BUILTINS \ { MP_OBJ_NEW_QSTR(MP_QSTR_open), (mp_obj_t)&mp_builtin_open_obj }, +// We need to provide a declaration/definition of alloca() +#include <alloca.h> diff --git a/py/builtinimport.c b/py/builtinimport.c index 795d9fd5e1..44ba4d5541 100644 --- a/py/builtinimport.c +++ b/py/builtinimport.c @@ -29,7 +29,6 @@ #include <stdio.h> #include <string.h> #include <assert.h> -#include <alloca.h> #include "mpconfig.h" #include "nlr.h" diff --git a/py/objfun.c b/py/objfun.c index 5743fa550f..d63acc687b 100644 --- a/py/objfun.c +++ b/py/objfun.c @@ -28,7 +28,6 @@ #include <stdbool.h> #include <string.h> #include <assert.h> -#include <alloca.h> #include "mpconfig.h" #include "nlr.h" diff --git a/py/runtime.c b/py/runtime.c index 179b48d327..d57bb686d1 100644 --- a/py/runtime.c +++ b/py/runtime.c @@ -27,7 +27,6 @@ #include <stdio.h> #include <string.h> #include <assert.h> -#include <alloca.h> #include "mpconfig.h" #include "nlr.h" @@ -28,7 +28,6 @@ #include <stdio.h> #include <string.h> #include <assert.h> -#include <alloca.h> #include "mpconfig.h" #include "nlr.h" diff --git a/qemu-arm/mpconfigport.h b/qemu-arm/mpconfigport.h index f464712f50..e2c625ce29 100644 --- a/qemu-arm/mpconfigport.h +++ b/qemu-arm/mpconfigport.h @@ -33,3 +33,5 @@ extern const struct _mp_obj_fun_native_t mp_builtin_open_obj; #define MICROPY_PORT_BUILTINS \ { MP_OBJ_NEW_QSTR(MP_QSTR_open), (mp_obj_t)&mp_builtin_open_obj }, +// We need to provide a declaration/definition of alloca() +#include <alloca.h> diff --git a/stmhal/mpconfigport.h b/stmhal/mpconfigport.h index 36a60dfa7c..5b99ffca55 100644 --- a/stmhal/mpconfigport.h +++ b/stmhal/mpconfigport.h @@ -99,3 +99,6 @@ typedef const void *machine_const_ptr_t; // must be of pointer size // board specific definitions #include "mpconfigboard.h" + +// We need to provide a declaration/definition of alloca() +#include <alloca.h> diff --git a/unix-cpy/mpconfigport.h b/unix-cpy/mpconfigport.h index 78d197033a..a4b5cc0879 100644 --- a/unix-cpy/mpconfigport.h +++ b/unix-cpy/mpconfigport.h @@ -48,3 +48,10 @@ typedef unsigned int machine_uint_t; // must be pointer size typedef void *machine_ptr_t; // must be of pointer size typedef const void *machine_const_ptr_t; // must be of pointer size typedef double machine_float_t; + +// We need to provide a declaration/definition of alloca() +#ifdef __FreeBSD__ +#include <stdlib.h> +#else +#include <alloca.h> +#endif diff --git a/unix/modsocket.c b/unix/modsocket.c index d6f732377d..b1a34a39b8 100644 --- a/unix/modsocket.c +++ b/unix/modsocket.c @@ -37,7 +37,6 @@ #include <arpa/inet.h> #include <netdb.h> #include <errno.h> -#include <alloca.h> #include "mpconfig.h" #include "nlr.h" diff --git a/unix/mpconfigport.h b/unix/mpconfigport.h index bf2cf73efd..3426ae44fe 100644 --- a/unix/mpconfigport.h +++ b/unix/mpconfigport.h @@ -99,3 +99,10 @@ extern const struct _mp_obj_fun_native_t mp_builtin_open_obj; #define MICROPY_PORT_BUILTINS \ { MP_OBJ_NEW_QSTR(MP_QSTR_input), (mp_obj_t)&mp_builtin_input_obj }, \ { MP_OBJ_NEW_QSTR(MP_QSTR_open), (mp_obj_t)&mp_builtin_open_obj }, + +// We need to provide a declaration/definition of alloca() +#ifdef __FreeBSD__ +#include <stdlib.h> +#else +#include <alloca.h> +#endif diff --git a/windows/alloca.h b/windows/alloca.h deleted file mode 100644 index 4d47e4aabf..0000000000 --- a/windows/alloca.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - * This file is part of the Micro Python project, http://micropython.org/ - * - * The MIT License (MIT) - * - * Copyright (c) 2013, 2014 Damien P. George - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -// Compatibility header to workaround lack of native alloca.h in some -// Windows toolchains. -#include <malloc.h> diff --git a/windows/mpconfigport.h b/windows/mpconfigport.h index 94304e20d2..63eeb4d962 100644 --- a/windows/mpconfigport.h +++ b/windows/mpconfigport.h @@ -92,7 +92,7 @@ void msec_sleep(double msec); #endif -// CL specific overrides from mpconfig +// CL specific overrides from mpconfig #define NORETURN __declspec(noreturn) #define MICROPY_PORT_CONSTANTS { "dummy", 0 } //can't have zero-sized array @@ -114,7 +114,7 @@ void msec_sleep(double msec); #include <stddef.h> //for NULL #include <assert.h> //for assert - +#include <malloc.h> //for alloca() // Functions implemented in platform code |