Fix func decls with no arguments: () -> (void).
diff --git a/py/gc.c b/py/gc.c
index 4a3d1da..7d4f476 100644
--- a/py/gc.c
+++ b/py/gc.c
@@ -115,7 +115,7 @@
} \
} 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_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_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 @@
}
}
-void gc_collect_start() {
+void gc_collect_start(void) {
gc_stack_overflow = 0;
gc_sp = gc_stack;
}
@@ -187,7 +187,7 @@
}
}
-void gc_collect_end() {
+void gc_collect_end(void) {
gc_deal_with_stack_overflow();
gc_sweep();
}
@@ -336,7 +336,7 @@
}
/*
-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 @@
}
}
-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 d5b5fcc..711212a 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 8775f68..2f8b5f7 100644
--- a/py/malloc.c
+++ b/py/malloc.c
@@ -51,6 +51,6 @@
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 c67d9df..87cbbd9 100644
--- a/py/misc.h
+++ b/py/misc.h
@@ -25,7 +25,7 @@
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 @@
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 @@
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 fa4e2f4..8ca8a9d 100644
--- a/py/nlr.h
+++ b/py/nlr.h
@@ -24,5 +24,5 @@
};
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 33d15c7..6fa69dd 100644
--- a/py/qstr.c
+++ b/py/qstr.c
@@ -7,7 +7,7 @@
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 41d696a..9da5688 100644
--- a/py/runtime.c
+++ b/py/runtime.c
@@ -521,7 +521,7 @@
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 @@
#endif
}
-void rt_deinit() {
+void rt_deinit(void) {
#ifdef WRITE_NATIVE
if (fp_native != NULL) {
fclose(fp_native);
@@ -576,7 +576,7 @@
}
}
-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 @@
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 @@
// 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 dedbf1b..326ca08 100644
--- a/py/runtime.h
+++ b/py/runtime.h
@@ -79,18 +79,18 @@
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 @@
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_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 fc7a772..076c3a3 100644
--- a/py/vstr.c
+++ b/py/vstr.c
@@ -24,7 +24,7 @@
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 @@
/** testing *****************************************************/
/*
-int main() {
+int main(void) {
vstr_t *vstr = vstr_new();
int i;
for (i = 0; i < 10; i++) {