Skip to content

Commit 8b3a7c2

Browse files
committed
Fix func decls with no arguments: () -> (void).
1 parent 94186c8 commit 8b3a7c2

10 files changed

Lines changed: 30 additions & 30 deletions

File tree

py/gc.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ void gc_init(void *start, void *end) {
115115
} \
116116
} while (0)
117117

118-
static void gc_drain_stack() {
118+
static void gc_drain_stack(void) {
119119
while (gc_sp > gc_stack) {
120120
// pop the next block off the stack
121121
machine_uint_t block = *--gc_sp;
@@ -135,7 +135,7 @@ static void gc_drain_stack() {
135135
}
136136
}
137137

138-
static void gc_deal_with_stack_overflow() {
138+
static void gc_deal_with_stack_overflow(void) {
139139
while (gc_stack_overflow) {
140140
gc_stack_overflow = 0;
141141
gc_sp = gc_stack;
@@ -151,7 +151,7 @@ static void gc_deal_with_stack_overflow() {
151151
}
152152
}
153153

154-
static void gc_sweep() {
154+
static void gc_sweep(void) {
155155
// free unmarked heads and their tails
156156
int free_tail = 0;
157157
for (machine_uint_t block = 0; block < gc_alloc_table_byte_len * BLOCKS_PER_ATB; block++) {
@@ -174,7 +174,7 @@ static void gc_sweep() {
174174
}
175175
}
176176

177-
void gc_collect_start() {
177+
void gc_collect_start(void) {
178178
gc_stack_overflow = 0;
179179
gc_sp = gc_stack;
180180
}
@@ -187,7 +187,7 @@ void gc_collect_root(void **ptrs, machine_uint_t len) {
187187
}
188188
}
189189

190-
void gc_collect_end() {
190+
void gc_collect_end(void) {
191191
gc_deal_with_stack_overflow();
192192
gc_sweep();
193193
}
@@ -336,7 +336,7 @@ void *gc_realloc(void *ptr, machine_uint_t n_bytes) {
336336
}
337337

338338
/*
339-
static void gc_dump_at() {
339+
static void gc_dump_at(void) {
340340
for (machine_uint_t bl = 0; bl < gc_alloc_table_byte_len * BLOCKS_PER_ATB; bl++) {
341341
printf("block % 6u ", bl);
342342
switch (ATB_GET_KIND(bl)) {
@@ -349,7 +349,7 @@ static void gc_dump_at() {
349349
}
350350
}
351351
352-
int main() {
352+
int main(void) {
353353
machine_uint_t len = 1000;
354354
machine_uint_t *heap = malloc(len);
355355
gc_init(heap, heap + len / sizeof(machine_uint_t));

py/gc.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
void gc_init(void *start, void *end);
2-
void gc_collect_start();
2+
void gc_collect_start(void);
33
void gc_collect_root(void **ptrs, machine_uint_t len);
4-
void gc_collect_end();
5-
void gc_collect();
4+
void gc_collect_end(void);
5+
void gc_collect(void);
66
void *gc_alloc(machine_uint_t n_bytes);
77
void gc_free(void *ptr);
88
machine_uint_t gc_nbytes(void *ptr);

py/malloc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,6 @@ void *m_realloc(void *ptr, int num_bytes) {
5151
return ptr;
5252
}
5353

54-
int m_get_total_bytes_allocated() {
54+
int m_get_total_bytes_allocated(void) {
5555
return total_bytes_allocated;
5656
}

py/misc.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ void *m_malloc(int num_bytes);
2525
void *m_malloc0(int num_bytes);
2626
void *m_realloc(void *ptr, int num_bytes);
2727

28-
int m_get_total_bytes_allocated();
28+
int m_get_total_bytes_allocated(void);
2929

3030
/** unichar / UTF-8 *********************************************/
3131

@@ -67,7 +67,7 @@ typedef struct _vstr_t {
6767

6868
void vstr_init(vstr_t *vstr);
6969
void vstr_clear(vstr_t *vstr);
70-
vstr_t *vstr_new();
70+
vstr_t *vstr_new(void);
7171
void vstr_free(vstr_t *vstr);
7272
void vstr_reset(vstr_t *vstr);
7373
bool vstr_had_error(vstr_t *vstr);
@@ -88,7 +88,7 @@ void vstr_cut_tail(vstr_t *vstr, int len);
8888

8989
typedef unsigned int qstr;
9090

91-
void qstr_init();
91+
void qstr_init(void);
9292
qstr qstr_from_str_static(const char *str);
9393
qstr qstr_from_str_take(char *str);
9494
qstr qstr_from_strn_copy(const char *str, int len);

py/nlr.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,5 @@ struct _nlr_buf_t {
2424
};
2525

2626
unsigned int nlr_push(nlr_buf_t *);
27-
void nlr_pop();
27+
void nlr_pop(void);
2828
void nlr_jump(void *val) __attribute__((noreturn));

py/qstr.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ static int qstrs_alloc;
77
static int qstrs_len;
88
static const char **qstrs;
99

10-
void qstr_init() {
10+
void qstr_init(void) {
1111
qstrs_alloc = 400;
1212
qstrs_len = 1;
1313
qstrs = m_new(const char*, qstrs_alloc);

py/runtime.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -521,7 +521,7 @@ py_obj_t py_builtin_range(py_obj_t o_arg) {
521521
FILE *fp_native = NULL;
522522
#endif
523523

524-
void rt_init() {
524+
void rt_init(void) {
525525
q_append = qstr_from_str_static("append");
526526
q_print = qstr_from_str_static("print");
527527
q_len = qstr_from_str_static("len");
@@ -560,7 +560,7 @@ void rt_init() {
560560
#endif
561561
}
562562

563-
void rt_deinit() {
563+
void rt_deinit(void) {
564564
#ifdef WRITE_NATIVE
565565
if (fp_native != NULL) {
566566
fclose(fp_native);
@@ -576,7 +576,7 @@ int rt_get_unique_code_id(bool is_main_module) {
576576
}
577577
}
578578

579-
static void alloc_unique_codes() {
579+
static void alloc_unique_codes(void) {
580580
if (unique_codes == NULL) {
581581
unique_codes = m_new(py_code_t, next_unique_code_id);
582582
for (int i = 0; i < next_unique_code_id; i++) {
@@ -901,7 +901,7 @@ py_obj_t rt_load_global(qstr qstr) {
901901
return elem->value;
902902
}
903903

904-
py_obj_t rt_load_build_class() {
904+
py_obj_t rt_load_build_class(void) {
905905
DEBUG_OP_printf("load_build_class\n");
906906
py_map_elem_t *elem = py_qstr_map_lookup(&map_builtins, q___build_class__, false);
907907
if (elem == NULL) {
@@ -1635,7 +1635,7 @@ void rt_f_vector(rt_fun_kind_t fun_kind) {
16351635
// temporary way of making C modules
16361636
// hack: use class to mimic a module
16371637

1638-
py_obj_t py_module_new() {
1638+
py_obj_t py_module_new(void) {
16391639
py_obj_base_t *o = m_new(py_obj_base_t, 1);
16401640
o->kind = O_CLASS;
16411641
o->u_class.locals = py_map_new(MAP_QSTR, 0);

py/runtime.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -79,18 +79,18 @@ typedef enum {
7979
extern void *const rt_fun_table[RT_F_NUMBER_OF];
8080

8181
typedef machine_ptr_t py_obj_t; // must be of pointer size
82-
typedef py_obj_t (*py_fun_0_t)();
82+
typedef py_obj_t (*py_fun_0_t)(void);
8383
typedef py_obj_t (*py_fun_1_t)(py_obj_t);
8484
typedef py_obj_t (*py_fun_2_t)(py_obj_t, py_obj_t);
85-
typedef py_obj_t (*py_fun_t)();
85+
typedef py_obj_t (*py_fun_t)(void);
8686

8787
extern py_obj_t py_const_none;
8888
extern py_obj_t py_const_false;
8989
extern py_obj_t py_const_true;
9090
extern py_obj_t py_const_stop_iteration; // special object indicating end of iteration (not StopIteration exception!)
9191

92-
void rt_init();
93-
void rt_deinit();
92+
void rt_init(void);
93+
void rt_deinit(void);
9494
int rt_get_unique_code_id(bool is_main_module);
9595
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);
9696
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);
102102
py_obj_t rt_load_const_str(qstr qstr);
103103
py_obj_t rt_load_name(qstr qstr);
104104
py_obj_t rt_load_global(qstr qstr);
105-
py_obj_t rt_load_build_class();
105+
py_obj_t rt_load_build_class(void);
106106
void rt_store_name(qstr qstr, py_obj_t obj);
107107
void rt_store_global(qstr qstr, py_obj_t obj);
108108
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);
133133
py_obj_t rt_iternext(py_obj_t o);
134134

135135
// temporary way of making C modules
136-
py_obj_t py_module_new();
136+
py_obj_t py_module_new(void);

py/vstr.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ void vstr_clear(vstr_t *vstr) {
2424
vstr->buf = NULL;
2525
}
2626

27-
vstr_t *vstr_new() {
27+
vstr_t *vstr_new(void) {
2828
vstr_t *vstr = m_new(vstr_t, 1);
2929
if (vstr == NULL) {
3030
return NULL;
@@ -193,7 +193,7 @@ void vstr_printf(vstr_t *vstr, const char *fmt, ...) {
193193
/** testing *****************************************************/
194194

195195
/*
196-
int main() {
196+
int main(void) {
197197
vstr_t *vstr = vstr_new();
198198
int i;
199199
for (i = 0; i < 10; i++) {

unix/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ char *str_join(const char *s1, int sep_char, const char *s2) {
2828
return s;
2929
}
3030

31-
void do_repl() {
31+
void do_repl(void) {
3232
for (;;) {
3333
char *line = readline(">>> ");
3434
if (line == NULL) {

0 commit comments

Comments
 (0)