Skip to content

Commit e50cff6

Browse files
committed
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
1 parent 36cc84a commit e50cff6

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

py/modbuiltins.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
#endif
4343

4444
#if MICROPY_PY_IO
45-
extern mp_uint_t mp_sys_stdout_obj; // type is irrelevant, just need pointer
45+
extern struct _mp_dummy_t mp_sys_stdout_obj; // type is irrelevant, just need pointer
4646
#endif
4747

4848
// args[0] is function from class body

py/modsys.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,9 @@
3939
/// \module sys - system specific functions
4040

4141
// defined per port; type of these is irrelevant, just need pointer
42-
extern mp_uint_t mp_sys_stdin_obj;
43-
extern mp_uint_t mp_sys_stdout_obj;
44-
extern mp_uint_t mp_sys_stderr_obj;
42+
extern struct _mp_dummy_t mp_sys_stdin_obj;
43+
extern struct _mp_dummy_t mp_sys_stdout_obj;
44+
extern struct _mp_dummy_t mp_sys_stderr_obj;
4545

4646
/// \constant version - Python language version that this implementation conforms to, as a string
4747
STATIC const MP_DEFINE_STR_OBJ(version_obj, "3.4.0");

py/obj.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ void mp_obj_print_helper(void (*print)(void *env, const char *fmt, ...), void *e
7474
void mp_obj_print(mp_obj_t o_in, mp_print_kind_t kind) {
7575
#if MICROPY_PY_IO
7676
// defined per port; type of these is irrelevant, just need pointer
77-
extern mp_uint_t mp_sys_stdout_obj;
77+
extern struct _mp_dummy_t mp_sys_stdout_obj;
7878
pfenv_t pfenv;
7979
pfenv.data = &mp_sys_stdout_obj;
8080
pfenv.print_strn = (void (*)(void *, const char *, mp_uint_t))mp_stream_write;

0 commit comments

Comments
 (0)