diff --git a/py/gc.c b/py/gc.c index 4a3d1dabee..7d4f4762ef 100644 --- a/py/gc.c +++ b/py/gc.c @@ -115,7 +115,7 @@ void gc_init(void *start, void *end) { } \ } while (0) -static void gc_drain_stack() { +static void gc_drain_stack(void) { while (gc_sp > gc_stack) { // pop the next block off the stack machine_uint_t block = *--gc_sp; @@ -135,7 +135,7 @@ static void gc_drain_stack() { } } -static void gc_deal_with_stack_overflow() { +static void gc_deal_with_stack_overflow(void) { while (gc_stack_overflow) { gc_stack_overflow = 0; gc_sp = gc_stack; @@ -151,7 +151,7 @@ static void gc_deal_with_stack_overflow() { } } -static void gc_sweep() { +static void gc_sweep(void) { // free unmarked heads and their tails int free_tail = 0; for (machine_uint_t block = 0; block < gc_alloc_table_byte_len * BLOCKS_PER_ATB; block++) { @@ -174,7 +174,7 @@ static void gc_sweep() { } } -void gc_collect_start() { +void gc_collect_start(void) { gc_stack_overflow = 0; gc_sp = gc_stack; } @@ -187,7 +187,7 @@ void gc_collect_root(void **ptrs, machine_uint_t len) { } } -void gc_collect_end() { +void gc_collect_end(void) { gc_deal_with_stack_overflow(); gc_sweep(); } @@ -336,7 +336,7 @@ void *gc_realloc(void *ptr, machine_uint_t n_bytes) { } /* -static void gc_dump_at() { +static void gc_dump_at(void) { for (machine_uint_t bl = 0; bl < gc_alloc_table_byte_len * BLOCKS_PER_ATB; bl++) { printf("block % 6u ", bl); switch (ATB_GET_KIND(bl)) { @@ -349,7 +349,7 @@ static void gc_dump_at() { } } -int main() { +int main(void) { machine_uint_t len = 1000; machine_uint_t *heap = malloc(len); gc_init(heap, heap + len / sizeof(machine_uint_t)); diff --git a/py/gc.h b/py/gc.h index d5b5fcc91c..711212ac40 100644 --- a/py/gc.h +++ b/py/gc.h @@ -1,8 +1,8 @@ void gc_init(void *start, void *end); -void gc_collect_start(); +void gc_collect_start(void); void gc_collect_root(void **ptrs, machine_uint_t len); -void gc_collect_end(); -void gc_collect(); +void gc_collect_end(void); +void gc_collect(void); void *gc_alloc(machine_uint_t n_bytes); void gc_free(void *ptr); machine_uint_t gc_nbytes(void *ptr); diff --git a/py/malloc.c b/py/malloc.c index 8775f68aa3..2f8b5f78b5 100644 --- a/py/malloc.c +++ b/py/malloc.c @@ -51,6 +51,6 @@ void *m_realloc(void *ptr, int num_bytes) { return ptr; } -int m_get_total_bytes_allocated() { +int m_get_total_bytes_allocated(void) { return total_bytes_allocated; } diff --git a/py/misc.h b/py/misc.h index c67d9df8f9..87cbbd98b6 100644 --- a/py/misc.h +++ b/py/misc.h @@ -25,7 +25,7 @@ void *m_malloc(int num_bytes); void *m_malloc0(int num_bytes); void *m_realloc(void *ptr, int num_bytes); -int m_get_total_bytes_allocated(); +int m_get_total_bytes_allocated(void); /** unichar / UTF-8 *********************************************/ @@ -67,7 +67,7 @@ typedef struct _vstr_t { void vstr_init(vstr_t *vstr); void vstr_clear(vstr_t *vstr); -vstr_t *vstr_new(); +vstr_t *vstr_new(void); void vstr_free(vstr_t *vstr); void vstr_reset(vstr_t *vstr); bool vstr_had_error(vstr_t *vstr); @@ -88,7 +88,7 @@ void vstr_cut_tail(vstr_t *vstr, int len); typedef unsigned int qstr; -void qstr_init(); +void qstr_init(void); qstr qstr_from_str_static(const char *str); qstr qstr_from_str_take(char *str); qstr qstr_from_strn_copy(const char *str, int len); diff --git a/py/nlr.h b/py/nlr.h index fa4e2f45f0..8ca8a9dc62 100644 --- a/py/nlr.h +++ b/py/nlr.h @@ -24,5 +24,5 @@ struct _nlr_buf_t { }; unsigned int nlr_push(nlr_buf_t *); -void nlr_pop(); +void nlr_pop(void); void nlr_jump(void *val) __attribute__((noreturn)); diff --git a/py/qstr.c b/py/qstr.c index 33d15c7e73..6fa69ddb95 100644 --- a/py/qstr.c +++ b/py/qstr.c @@ -7,7 +7,7 @@ static int qstrs_alloc; static int qstrs_len; static const char **qstrs; -void qstr_init() { +void qstr_init(void) { qstrs_alloc = 400; qstrs_len = 1; qstrs = m_new(const char*, qstrs_alloc); diff --git a/py/runtime.c b/py/runtime.c index 41d696a2e3..9da5688763 100644 --- a/py/runtime.c +++ b/py/runtime.c @@ -521,7 +521,7 @@ py_obj_t py_builtin_range(py_obj_t o_arg) { FILE *fp_native = NULL; #endif -void rt_init() { +void rt_init(void) { q_append = qstr_from_str_static("append"); q_print = qstr_from_str_static("print"); q_len = qstr_from_str_static("len"); @@ -560,7 +560,7 @@ void rt_init() { #endif } -void rt_deinit() { +void rt_deinit(void) { #ifdef WRITE_NATIVE if (fp_native != NULL) { fclose(fp_native); @@ -576,7 +576,7 @@ int rt_get_unique_code_id(bool is_main_module) { } } -static void alloc_unique_codes() { +static void alloc_unique_codes(void) { if (unique_codes == NULL) { unique_codes = m_new(py_code_t, next_unique_code_id); for (int i = 0; i < next_unique_code_id; i++) { @@ -901,7 +901,7 @@ py_obj_t rt_load_global(qstr qstr) { return elem->value; } -py_obj_t rt_load_build_class() { +py_obj_t rt_load_build_class(void) { DEBUG_OP_printf("load_build_class\n"); py_map_elem_t *elem = py_qstr_map_lookup(&map_builtins, q___build_class__, false); if (elem == NULL) { @@ -1635,7 +1635,7 @@ void rt_f_vector(rt_fun_kind_t fun_kind) { // temporary way of making C modules // hack: use class to mimic a module -py_obj_t py_module_new() { +py_obj_t py_module_new(void) { py_obj_base_t *o = m_new(py_obj_base_t, 1); o->kind = O_CLASS; o->u_class.locals = py_map_new(MAP_QSTR, 0); diff --git a/py/runtime.h b/py/runtime.h index dedbf1bad4..326ca0833b 100644 --- a/py/runtime.h +++ b/py/runtime.h @@ -79,18 +79,18 @@ typedef enum { extern void *const rt_fun_table[RT_F_NUMBER_OF]; typedef machine_ptr_t py_obj_t; // must be of pointer size -typedef py_obj_t (*py_fun_0_t)(); +typedef py_obj_t (*py_fun_0_t)(void); typedef py_obj_t (*py_fun_1_t)(py_obj_t); typedef py_obj_t (*py_fun_2_t)(py_obj_t, py_obj_t); -typedef py_obj_t (*py_fun_t)(); +typedef py_obj_t (*py_fun_t)(void); extern py_obj_t py_const_none; extern py_obj_t py_const_false; extern py_obj_t py_const_true; extern py_obj_t py_const_stop_iteration; // special object indicating end of iteration (not StopIteration exception!) -void rt_init(); -void rt_deinit(); +void rt_init(void); +void rt_deinit(void); int rt_get_unique_code_id(bool is_main_module); void rt_assign_byte_code(int unique_code_id, byte *code, uint len, int n_args, int n_locals, int n_stack, bool is_generator); void rt_assign_native_code(int unique_code_id, py_fun_t f, uint len, int n_args); @@ -102,7 +102,7 @@ qstr py_get_qstr(py_obj_t arg); py_obj_t rt_load_const_str(qstr qstr); py_obj_t rt_load_name(qstr qstr); py_obj_t rt_load_global(qstr qstr); -py_obj_t rt_load_build_class(); +py_obj_t rt_load_build_class(void); void rt_store_name(qstr qstr, py_obj_t obj); void rt_store_global(qstr qstr, py_obj_t obj); py_obj_t rt_unary_op(int op, py_obj_t arg); @@ -133,4 +133,4 @@ py_obj_t rt_getiter(py_obj_t o); py_obj_t rt_iternext(py_obj_t o); // temporary way of making C modules -py_obj_t py_module_new(); +py_obj_t py_module_new(void); diff --git a/py/vstr.c b/py/vstr.c index fc7a772452..076c3a30de 100644 --- a/py/vstr.c +++ b/py/vstr.c @@ -24,7 +24,7 @@ void vstr_clear(vstr_t *vstr) { vstr->buf = NULL; } -vstr_t *vstr_new() { +vstr_t *vstr_new(void) { vstr_t *vstr = m_new(vstr_t, 1); if (vstr == NULL) { return NULL; @@ -193,7 +193,7 @@ void vstr_printf(vstr_t *vstr, const char *fmt, ...) { /** testing *****************************************************/ /* -int main() { +int main(void) { vstr_t *vstr = vstr_new(); int i; for (i = 0; i < 10; i++) { diff --git a/unix/main.c b/unix/main.c index 12aca6ddf2..ebab646275 100644 --- a/unix/main.c +++ b/unix/main.c @@ -28,7 +28,7 @@ char *str_join(const char *s1, int sep_char, const char *s2) { return s; } -void do_repl() { +void do_repl(void) { for (;;) { char *line = readline(">>> "); if (line == NULL) {