Skip to content

Commit cd34207

Browse files
committed
py: Can compile with -Wmissing-declarations and -Wmissing-prototypes.
1 parent 3dd1c0a commit cd34207

File tree

11 files changed

+22
-18
lines changed

11 files changed

+22
-18
lines changed

py/builtin.h

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030

3131
mp_obj_t mp_builtin___import__(mp_uint_t n_args, const mp_obj_t *args);
3232
mp_obj_t mp_builtin_open(mp_uint_t n_args, const mp_obj_t *args, mp_map_t *kwargs);
33+
mp_obj_t mp_micropython_mem_info(mp_uint_t n_args, const mp_obj_t *args);
3334

3435
MP_DECLARE_CONST_FUN_OBJ(mp_builtin___build_class___obj);
3536
MP_DECLARE_CONST_FUN_OBJ(mp_builtin___import___obj);
@@ -91,11 +92,6 @@ extern const mp_obj_module_t mp_module_gc;
9192

9293
extern const mp_obj_dict_t mp_module_builtins_globals;
9394

94-
struct _dummy_t;
95-
extern struct _dummy_t mp_sys_stdin_obj;
96-
extern struct _dummy_t mp_sys_stdout_obj;
97-
extern struct _dummy_t mp_sys_stderr_obj;
98-
9995
// extmod modules
10096
extern const mp_obj_module_t mp_module_uctypes;
10197
extern const mp_obj_module_t mp_module_uzlib;

py/modbuiltins.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -406,6 +406,7 @@ STATIC mp_obj_t mp_builtin_print(mp_uint_t n_args, const mp_obj_t *args, mp_map_
406406
end_data = mp_obj_str_get_data(end_elem->value, &end_len);
407407
}
408408
#if MICROPY_PY_IO
409+
extern mp_uint_t mp_sys_stdout_obj; // type is irrelevant, just need pointer
409410
mp_obj_t stream_obj = &mp_sys_stdout_obj;
410411
mp_map_elem_t *file_elem = mp_map_lookup(kwargs, MP_OBJ_NEW_QSTR(MP_QSTR_file), MP_MAP_LOOKUP);
411412
if (file_elem != NULL && file_elem->value != mp_const_none) {

py/modsys.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,11 @@
3737

3838
/// \module sys - system specific functions
3939

40+
// defined per port; type of these is irrelevant, just need pointer
41+
extern mp_uint_t mp_sys_stdin_obj;
42+
extern mp_uint_t mp_sys_stdout_obj;
43+
extern mp_uint_t mp_sys_stderr_obj;
44+
4045
// These two lists must be initialised per port (after the call to mp_init).
4146
// TODO document these properly, they aren't constants or functions...
4247
/// \constant path - a mutable list of directories to search for imported modules

py/obj.c

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
#include "py/runtime0.h"
3737
#include "py/runtime.h"
3838
#include "py/stackctrl.h"
39+
#include "py/pfenv.h"
3940

4041
mp_obj_type_t *mp_obj_get_type(mp_const_obj_t o_in) {
4142
if (MP_OBJ_IS_SMALL_INT(o_in)) {
@@ -52,13 +53,6 @@ const char *mp_obj_get_type_str(mp_const_obj_t o_in) {
5253
return qstr_str(mp_obj_get_type(o_in)->name);
5354
}
5455

55-
void printf_wrapper(void *env, const char *fmt, ...) {
56-
va_list args;
57-
va_start(args, fmt);
58-
vprintf(fmt, args);
59-
va_end(args);
60-
}
61-
6256
void mp_obj_print_helper(void (*print)(void *env, const char *fmt, ...), void *env, mp_obj_t o_in, mp_print_kind_t kind) {
6357
// There can be data structures nested too deep, or just recursive
6458
MP_STACK_CHECK();

py/pfenv.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626
#ifndef __MICROPY_INCLUDED_PY_PFENV_H__
2727
#define __MICROPY_INCLUDED_PY_PFENV_H__
2828

29+
#include <stdarg.h>
30+
2931
#include "py/obj.h"
3032

3133
#define PF_FLAG_LEFT_ADJUST (0x001)
@@ -54,7 +56,7 @@ int pfenv_print_mp_int(const pfenv_t *pfenv, mp_obj_t x, int sgn, int base, int
5456
int pfenv_print_float(const pfenv_t *pfenv, mp_float_t f, char fmt, int flags, char fill, int width, int prec);
5557
#endif
5658

57-
//int pfenv_vprintf(const pfenv_t *pfenv, const char *fmt, va_list args);
59+
int pfenv_vprintf(const pfenv_t *pfenv, const char *fmt, va_list args);
5860
int pfenv_printf(const pfenv_t *pfenv, const char *fmt, ...);
5961

6062
// Wrapper for system printf

py/pfenv_printf.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
#include <assert.h>
2828
#include <string.h>
2929
#include <stdarg.h>
30+
#include <stdio.h>
3031

3132
#include "py/pfenv.h"
3233

@@ -193,3 +194,10 @@ int pfenv_printf(const pfenv_t *pfenv, const char *fmt, ...) {
193194
va_end(ap);
194195
return ret;
195196
}
197+
198+
void printf_wrapper(void *env, const char *fmt, ...) {
199+
va_list args;
200+
va_start(args, fmt);
201+
vprintf(fmt, args);
202+
va_end(args);
203+
}

py/warning.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@
2727
#include <stdarg.h>
2828
#include <stdio.h>
2929

30-
#include "py/obj.h"
3130
#include "py/emit.h"
31+
#include "py/runtime.h"
3232

3333
#if MICROPY_WARNINGS
3434

stmhal/printf.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,6 @@
3636
#include "py/formatfloat.h"
3737
#endif
3838

39-
int pfenv_vprintf(const pfenv_t *pfenv, const char *fmt, va_list args);
40-
4139
STATIC void stdout_print_strn(void *dummy_env, const char *str, mp_uint_t len) {
4240
stdout_tx_strn_cooked(str, len);
4341
}

unix/file.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
#include "py/nlr.h"
3535
#include "py/runtime.h"
3636
#include "py/stream.h"
37+
#include "py/builtin.h"
3738

3839
#ifdef _WIN32
3940
#define fsync _commit

unix/gccollect.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ STATIC void gc_helper_get_regs(regs_t arr) {
5151
#ifdef __x86_64__
5252
typedef mp_uint_t regs_t[6];
5353

54-
void gc_helper_get_regs(regs_t arr) {
54+
STATIC void gc_helper_get_regs(regs_t arr) {
5555
register long rbx asm ("rbx");
5656
register long rbp asm ("rbp");
5757
register long r12 asm ("r12");

0 commit comments

Comments
 (0)