Provide definition of alloca() in mpconfigport.h.

pull/675/head
Damien George 2014-06-08 13:25:33 +01:00
rodzic df896eceef
commit 4480cb3711
7 zmienionych plików z 17 dodań i 33 usunięć

Wyświetl plik

@ -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>

Wyświetl plik

@ -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>

Wyświetl plik

@ -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>

Wyświetl plik

@ -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

Wyświetl plik

@ -100,8 +100,7 @@ extern const struct _mp_obj_fun_native_t mp_builtin_open_obj;
{ 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 the correct header for alloca() */
// We need to provide a declaration/definition of alloca()
#ifdef __FreeBSD__
#include <stdlib.h>
#else

Wyświetl plik

@ -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>

Wyświetl plik

@ -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 <alloca.h> //for alloca()
#include <malloc.h> //for alloca()
// Functions implemented in platform code