From e50cff69bb0dbca8ed363b5c7c459e01cb7f00ac Mon Sep 17 00:00:00 2001 From: stijn Date: Thu, 9 Apr 2015 12:27:15 +0200 Subject: [PATCH] py: Use a dummy type for referring to extern structs Fixes msvc linker warnings about mismatching sizes between the mp_obj_fdfile_t struct defined in file.c and the mp_uint_t declarations found in modsys.c and modbuiltins.c --- py/modbuiltins.c | 2 +- py/modsys.c | 6 +++--- py/obj.c | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/py/modbuiltins.c b/py/modbuiltins.c index 0985e25bf4..04141edec9 100644 --- a/py/modbuiltins.c +++ b/py/modbuiltins.c @@ -42,7 +42,7 @@ #endif #if MICROPY_PY_IO -extern mp_uint_t mp_sys_stdout_obj; // type is irrelevant, just need pointer +extern struct _mp_dummy_t mp_sys_stdout_obj; // type is irrelevant, just need pointer #endif // args[0] is function from class body diff --git a/py/modsys.c b/py/modsys.c index 4ea60a697d..5051e72951 100644 --- a/py/modsys.c +++ b/py/modsys.c @@ -39,9 +39,9 @@ /// \module sys - system specific functions // defined per port; type of these is irrelevant, just need pointer -extern mp_uint_t mp_sys_stdin_obj; -extern mp_uint_t mp_sys_stdout_obj; -extern mp_uint_t mp_sys_stderr_obj; +extern struct _mp_dummy_t mp_sys_stdin_obj; +extern struct _mp_dummy_t mp_sys_stdout_obj; +extern struct _mp_dummy_t mp_sys_stderr_obj; /// \constant version - Python language version that this implementation conforms to, as a string STATIC const MP_DEFINE_STR_OBJ(version_obj, "3.4.0"); diff --git a/py/obj.c b/py/obj.c index c376adc03c..6c851dfb08 100644 --- a/py/obj.c +++ b/py/obj.c @@ -74,7 +74,7 @@ void mp_obj_print_helper(void (*print)(void *env, const char *fmt, ...), void *e void mp_obj_print(mp_obj_t o_in, mp_print_kind_t kind) { #if MICROPY_PY_IO // defined per port; type of these is irrelevant, just need pointer - extern mp_uint_t mp_sys_stdout_obj; + extern struct _mp_dummy_t mp_sys_stdout_obj; pfenv_t pfenv; pfenv.data = &mp_sys_stdout_obj; pfenv.print_strn = (void (*)(void *, const char *, mp_uint_t))mp_stream_write;