diff options
author | Kaspar Schleiser <kaspar@schleiser.de> | 2015-05-09 21:46:29 +0200 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2015-05-17 17:42:04 +0100 |
commit | cf5112b26f3e6e96480234d50b2c781663d971c2 (patch) | |
tree | 7389bea5a534e43bd46ad19c81b8977063052e78 /py/obj.h | |
parent | 44e7cbf019344bf3836e106d1ac5333f437479d1 (diff) | |
download | micropython-cf5112b26f3e6e96480234d50b2c781663d971c2.tar.gz micropython-cf5112b26f3e6e96480234d50b2c781663d971c2.zip |
py: Change _mp_obj_fun_builtin_t.fun to function pointer.
ISO C forbids conversion between function pointers and void*, gcc
-pedantic triggers a warning.
Diffstat (limited to 'py/obj.h')
-rw-r--r-- | py/obj.h | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -143,7 +143,7 @@ static inline bool mp_obj_is_integer(mp_const_obj_t o) { return MP_OBJ_IS_INT(o) #define MP_DECLARE_CONST_FUN_OBJ(obj_name) extern const mp_obj_fun_builtin_t obj_name -#define MP_DEFINE_CONST_FUN_OBJ_VOID_PTR(obj_name, is_kw, n_args_min, n_args_max, fun_name) const mp_obj_fun_builtin_t obj_name = {{&mp_type_fun_builtin}, is_kw, n_args_min, n_args_max, (void *)fun_name} +#define MP_DEFINE_CONST_FUN_OBJ_VOID_PTR(obj_name, is_kw, n_args_min, n_args_max, fun_name) const mp_obj_fun_builtin_t obj_name = {{&mp_type_fun_builtin}, is_kw, n_args_min, n_args_max, (void(*)(void))fun_name} #define MP_DEFINE_CONST_FUN_OBJ_0(obj_name, fun_name) MP_DEFINE_CONST_FUN_OBJ_VOID_PTR(obj_name, false, 0, 0, (mp_fun_0_t)fun_name) #define MP_DEFINE_CONST_FUN_OBJ_1(obj_name, fun_name) MP_DEFINE_CONST_FUN_OBJ_VOID_PTR(obj_name, false, 1, 1, (mp_fun_1_t)fun_name) #define MP_DEFINE_CONST_FUN_OBJ_2(obj_name, fun_name) MP_DEFINE_CONST_FUN_OBJ_VOID_PTR(obj_name, false, 2, 2, (mp_fun_2_t)fun_name) @@ -622,7 +622,7 @@ typedef struct _mp_obj_fun_builtin_t { // use this to make const objects that go bool is_kw : 1; mp_uint_t n_args_min : 15; // inclusive mp_uint_t n_args_max : 16; // inclusive - void *fun; // must be a pointer to a callable function in ROM + void (*fun)(void); // must be a pointer to a callable function in ROM } mp_obj_fun_builtin_t; qstr mp_obj_fun_get_name(mp_const_obj_t fun); |