In C language, a declaration in the form int f(); is equivalent to int f(...);, thus being able to accept an indefinit number of parameters. With the -Wstrict-prototypes GCC options, these declarations are reported as "function declaration isn’t a prototype".
On some cases, this may trick the compiler into generating unoptimized code (like preparing to handle variadic argument list).
In all cases having a declaration int f() and a definition inf f(int) is missleading, even if standard compliant.
This is still Work in Progress. (maybe adding the -Wstrict-prototypes option to default is desireable)
... | ... |
@@ -40,8 +40,8 @@ |
40 | 40 |
#define __atomic_ops_init_h |
41 | 41 |
|
42 | 42 |
/*! \brief init atomic ops */ |
43 |
-int init_atomic_ops(); |
|
43 |
+int init_atomic_ops(void); |
|
44 | 44 |
/*! \brief destroy atomic ops (e.g. frees the locks, if locks are used) */ |
45 |
-void destroy_atomic_ops(); |
|
45 |
+void destroy_atomic_ops(void); |
|
46 | 46 |
|
47 | 47 |
#endif |
... | ... |
@@ -35,10 +35,10 @@ struct cfg_read_handle { |
35 | 35 |
}; |
36 | 36 |
|
37 | 37 |
/* free the list of not yet fixed selects */ |
38 |
-void cfg_free_selects(); |
|
38 |
+void cfg_free_selects(void); |
|
39 | 39 |
|
40 | 40 |
/* fix-up the select calls */ |
41 |
-int cfg_fixup_selects(); |
|
41 |
+int cfg_fixup_selects(void); |
|
42 | 42 |
|
43 | 43 |
int select_cfg_var(str *res, select_t *s, struct sip_msg *msg); |
44 | 44 |
|
... | ... |
@@ -28,17 +28,17 @@ |
28 | 28 |
#define _daemonize_h |
29 | 29 |
|
30 | 30 |
int daemonize(char* name, int daemon_status_fd_input); |
31 |
-int do_suid(); |
|
31 |
+int do_suid(void); |
|
32 | 32 |
int increase_open_fds(int target); |
33 | 33 |
int set_core_dump(int enable, long unsigned int size); |
34 |
-int mem_lock_pages(); |
|
34 |
+int mem_lock_pages(void); |
|
35 | 35 |
int set_rt_prio(int prio, int policy); |
36 | 36 |
|
37 |
-void daemon_status_init(); |
|
38 |
-void daemon_status_on_fork_cleanup(); |
|
37 |
+void daemon_status_init(void); |
|
38 |
+void daemon_status_on_fork_cleanup(void); |
|
39 | 39 |
int daemon_status_send(char status); |
40 |
-void daemon_status_no_wait(); |
|
41 |
-void daemon_status_on_fork_cleanup(); |
|
40 |
+void daemon_status_no_wait(void); |
|
41 |
+void daemon_status_on_fork_cleanup(void); |
|
42 | 42 |
|
43 | 43 |
#endif /*_daemonize_h */ |
44 | 44 |
|
... | ... |
@@ -195,12 +195,12 @@ void fix_dns_flags(str *gname, str *name); |
195 | 195 |
int use_dns_failover_fixup(void *handle, str *gname, str *name, void **val); |
196 | 196 |
int use_dns_cache_fixup(void *handle, str *gname, str *name, void **val); |
197 | 197 |
int dns_cache_max_mem_fixup(void *handle, str *gname, str *name, void **val); |
198 |
-int init_dns_cache(); |
|
198 |
+int init_dns_cache(void); |
|
199 | 199 |
#ifdef USE_DNS_CACHE_STATS |
200 | 200 |
int init_dns_cache_stats(int iproc_num); |
201 | 201 |
#define DNS_CACHE_ALL_STATS "dc_all_stats" |
202 | 202 |
#endif |
203 |
-void destroy_dns_cache(); |
|
203 |
+void destroy_dns_cache(void); |
|
204 | 204 |
|
205 | 205 |
|
206 | 206 |
void dns_hash_put(struct dns_hash_entry* e); |
... | ... |
@@ -104,7 +104,7 @@ |
104 | 104 |
/** @brief my_pid(), process_no are from pt.h but we cannot \#include it here |
105 | 105 |
because of circular dependencies */ |
106 | 106 |
extern int process_no; |
107 |
-extern int my_pid(); |
|
107 |
+extern int my_pid(void); |
|
108 | 108 |
|
109 | 109 |
/** @brief non-zero if logging to stderr instead to the syslog */ |
110 | 110 |
extern int log_stderr; |
... | ... |
@@ -309,7 +309,7 @@ inline static int blacklist_run_hooks(struct blst_callbacks_lst *cb_lst, |
309 | 309 |
/** init per protocol blacklist event ignore masks. |
310 | 310 |
* @return 0 on success, < 0 on error. |
311 | 311 |
*/ |
312 |
-int blst_init_ign_masks() |
|
312 |
+int blst_init_ign_masks(void) |
|
313 | 313 |
{ |
314 | 314 |
if ((PROTO_UDP > PROTO_LAST) || (PROTO_TCP > PROTO_LAST) || |
315 | 315 |
(PROTO_TLS > PROTO_LAST) || (PROTO_SCTP > PROTO_LAST)){ |
... | ... |
@@ -83,12 +83,12 @@ struct blacklist_hook{ |
83 | 83 |
int register_blacklist_hook(struct blacklist_hook *h, int type); |
84 | 84 |
#endif /* DST_BLACKLIST_HOOKS */ |
85 | 85 |
|
86 |
-int init_dst_blacklist(); |
|
86 |
+int init_dst_blacklist(void); |
|
87 | 87 |
#ifdef USE_DST_BLACKLIST_STATS |
88 | 88 |
int init_dst_blacklist_stats(int iproc_num); |
89 | 89 |
#define DST_BLACKLIST_ALL_STATS "bkl_all_stats" |
90 | 90 |
#endif |
91 |
-void destroy_dst_blacklist(); |
|
91 |
+void destroy_dst_blacklist(void); |
|
92 | 92 |
|
93 | 93 |
|
94 | 94 |
/** force add to the blacklist. |
... | ... |
@@ -72,7 +72,7 @@ extern int _endian_test_int; |
72 | 72 |
#define is_little_endian() endian_test() |
73 | 73 |
|
74 | 74 |
|
75 |
-extern int endianness_sanity_check(); |
|
75 |
+extern int endianness_sanity_check(void); |
|
76 | 76 |
|
77 | 77 |
/* detect compile time endianess */ |
78 | 78 |
#if defined __BYTE_ORDER && defined __LITTLE_ENDIAN && defined __BIG_ENDIAN |
... | ... |
@@ -48,7 +48,7 @@ |
48 | 48 |
#include "lock_ops.h" |
49 | 49 |
|
50 | 50 |
/* returns 0 on success, -1 on error */ |
51 |
-int init_lock_ops() |
|
51 |
+int init_lock_ops(void) |
|
52 | 52 |
{ |
53 | 53 |
#ifdef USE_FUTEX |
54 | 54 |
int os_ver; |
... | ... |
@@ -66,6 +66,6 @@ int init_lock_ops() |
66 | 66 |
|
67 | 67 |
|
68 | 68 |
|
69 |
-void destroy_lock_ops() |
|
69 |
+void destroy_lock_ops(void) |
|
70 | 70 |
{ |
71 | 71 |
} |
... | ... |
@@ -263,7 +263,7 @@ Options:\n\ |
263 | 263 |
|
264 | 264 |
|
265 | 265 |
/* print compile-time constants */ |
266 |
-void print_ct_constants() |
|
266 |
+void print_ct_constants(void) |
|
267 | 267 |
{ |
268 | 268 |
#ifdef ADAPTIVE_WAIT |
269 | 269 |
printf("ADAPTIVE_WAIT_LOOPS=%d, ", ADAPTIVE_WAIT_LOOPS); |
... | ... |
@@ -283,7 +283,7 @@ void print_ct_constants() |
283 | 283 |
} |
284 | 284 |
|
285 | 285 |
/* print compile-time constants */ |
286 |
-void print_internals() |
|
286 |
+void print_internals(void) |
|
287 | 287 |
{ |
288 | 288 |
printf("Print out of %s internals\n", NAME); |
289 | 289 |
printf(" Version: %s\n", full_version); |
... | ... |
@@ -312,7 +312,7 @@ void print_internals() |
312 | 312 |
|
313 | 313 |
/* debugging function */ |
314 | 314 |
/* |
315 |
-void receive_stdin_loop() |
|
315 |
+void receive_stdin_loop(void) |
|
316 | 316 |
{ |
317 | 317 |
#define BSIZE 1024 |
318 | 318 |
char buf[BSIZE+1]; |
... | ... |
@@ -541,7 +541,7 @@ static int cfg_ok=0; |
541 | 541 |
|
542 | 542 |
|
543 | 543 |
extern FILE* yyin; |
544 |
-extern int yyparse(); |
|
544 |
+extern int yyparse(void); |
|
545 | 545 |
|
546 | 546 |
|
547 | 547 |
int is_main=1; /* flag = is this the "main" process? */ |
... | ... |
@@ -713,7 +713,7 @@ static void shutdown_children(int sig, int show_status) |
713 | 713 |
|
714 | 714 |
|
715 | 715 |
|
716 |
-void handle_sigs() |
|
716 |
+void handle_sigs(void) |
|
717 | 717 |
{ |
718 | 718 |
pid_t chld; |
719 | 719 |
int chld_status; |
... | ... |
@@ -893,7 +893,7 @@ void sig_usr(int signo) |
893 | 893 |
|
894 | 894 |
|
895 | 895 |
/* install the signal handlers, returns 0 on success, -1 on error */ |
896 |
-int install_sigs() |
|
896 |
+int install_sigs(void) |
|
897 | 897 |
{ |
898 | 898 |
/* added by jku: add exit handler */ |
899 | 899 |
if (set_sig_h(SIGINT, sig_usr) == SIG_ERR ) { |
... | ... |
@@ -1259,7 +1259,7 @@ int fix_cfg_file(void) |
1259 | 1259 |
|
1260 | 1260 |
|
1261 | 1261 |
/* main loop */ |
1262 |
-int main_loop() |
|
1262 |
+int main_loop(void) |
|
1263 | 1263 |
{ |
1264 | 1264 |
int i; |
1265 | 1265 |
pid_t pid; |
... | ... |
@@ -59,8 +59,8 @@ struct nonsip_hook{ |
59 | 59 |
}; |
60 | 60 |
|
61 | 61 |
|
62 |
-int init_nonsip_hooks(); |
|
63 |
-void destroy_nonsip_hooks(); |
|
62 |
+int init_nonsip_hooks(void); |
|
63 |
+void destroy_nonsip_hooks(void); |
|
64 | 64 |
int register_nonsip_msg_hook(struct nonsip_hook *h); |
65 | 65 |
int nonsip_msg_run_hooks(struct sip_msg* msg); |
66 | 66 |
|
... | ... |
@@ -50,7 +50,7 @@ extern char* poll_method_str[POLL_END]; |
50 | 50 |
extern char* poll_support; |
51 | 51 |
|
52 | 52 |
|
53 |
-enum poll_types choose_poll_method(); |
|
53 |
+enum poll_types choose_poll_method(void); |
|
54 | 54 |
|
55 | 55 |
/* returns 0 on success, and an error message on error */ |
56 | 56 |
char* check_poll_method(enum poll_types poll_method); |
... | ... |
@@ -63,9 +63,9 @@ extern int process_no; |
63 | 63 |
extern struct tcp_child* tcp_children; |
64 | 64 |
|
65 | 65 |
int init_pt(int proc_no); |
66 |
-int get_max_procs(); |
|
66 |
+int get_max_procs(void); |
|
67 | 67 |
int register_procs(int no); |
68 |
-int get_max_open_fds(); |
|
68 |
+int get_max_open_fds(void); |
|
69 | 69 |
int register_fds(int no); |
70 | 70 |
|
71 | 71 |
|
... | ... |
@@ -74,7 +74,7 @@ int close_extra_socks(int proc_id, int proc_no); |
74 | 74 |
#define get_proc_no() ((process_count)?*process_count:0) |
75 | 75 |
|
76 | 76 |
/* return processes pid */ |
77 |
-int my_pid(); |
|
77 |
+int my_pid(void); |
|
78 | 78 |
|
79 | 79 |
/** |
80 | 80 |
* Forks a new process. |
... | ... |
@@ -31,7 +31,7 @@ |
31 | 31 |
/* side effect: seeds also random w/ seed */ |
32 | 32 |
void fastrand_seed(unsigned int seed); |
33 | 33 |
/* generate a 32 bit random number */ |
34 |
-unsigned int fastrand(); |
|
34 |
+unsigned int fastrand(void); |
|
35 | 35 |
/* generate a random number between 0 and max inclusive ( 0 <= r <= max) |
36 | 36 |
* should not be used for cryptography */ |
37 | 37 |
unsigned int fastrand_max(unsigned int max); |
... | ... |
@@ -92,15 +92,15 @@ extern struct route_list event_rt; |
92 | 92 |
/* script optimization level */ |
93 | 93 |
extern int scr_opt_lev; |
94 | 94 |
|
95 |
-int init_routes(); |
|
96 |
-void destroy_routes(); |
|
95 |
+int init_routes(void); |
|
96 |
+void destroy_routes(void); |
|
97 | 97 |
int route_get(struct route_list* rt, char* name); |
98 | 98 |
int route_lookup(struct route_list* rt, char* name); |
99 | 99 |
|
100 | 100 |
void push(struct action* a, struct action** head); |
101 | 101 |
int add_actions(struct action* a, struct action** head); |
102 |
-void print_rls(); |
|
103 |
-int fix_rls(); |
|
102 |
+void print_rls(void); |
|
103 |
+int fix_rls(void); |
|
104 | 104 |
|
105 | 105 |
int eval_expr(struct run_act_ctx* h, struct expr* e, struct sip_msg* msg); |
106 | 106 |
|
... | ... |
@@ -32,8 +32,8 @@ |
32 | 32 |
extern rpc_export_t** rpc_sarray; |
33 | 33 |
extern int rpc_sarray_crt_size; |
34 | 34 |
|
35 |
-int init_rpcs(); |
|
36 |
-int destroy_rpcs(); |
|
35 |
+int init_rpcs(void); |
|
36 |
+int destroy_rpcs(void); |
|
37 | 37 |
|
38 | 38 |
rpc_export_t* rpc_lookup(const char* name, int len); |
39 | 39 |
int rpc_register(rpc_export_t* rpc); |
... | ... |
@@ -69,8 +69,8 @@ struct script_cb{ |
69 | 69 |
*/ |
70 | 70 |
int register_script_cb( cb_function f, unsigned int flags, void *param ); |
71 | 71 |
|
72 |
-int init_script_cb(); |
|
73 |
-void destroy_script_cb(); |
|
72 |
+int init_script_cb(void); |
|
73 |
+void destroy_script_cb(void); |
|
74 | 74 |
|
75 | 75 |
/* Execute pre-script callbacks of a given type. |
76 | 76 |
* Returns 0 on error, 1 on success |
... | ... |
@@ -67,9 +67,9 @@ extern struct cfg_group_sctp sctp_default_cfg; |
67 | 67 |
/* sctp config handle */ |
68 | 68 |
extern void* sctp_cfg; |
69 | 69 |
|
70 |
-void init_sctp_options(); |
|
71 |
-void sctp_options_check(); |
|
72 |
-int sctp_register_cfg(); |
|
70 |
+void init_sctp_options(void); |
|
71 |
+void sctp_options_check(void); |
|
72 |
+int sctp_register_cfg(void); |
|
73 | 73 |
void sctp_options_get(struct cfg_group_sctp *s); |
74 | 74 |
int sctp_get_os_defaults(struct cfg_group_sctp *s); |
75 | 75 |
int sctp_get_cfg_from_sock(int s, struct cfg_group_sctp* cfg); |
... | ... |
@@ -35,21 +35,21 @@ struct sctp_gen_info{ |
35 | 35 |
int sctp_total_connections; |
36 | 36 |
}; |
37 | 37 |
|
38 |
-int init_sctp(); |
|
39 |
-void destroy_sctp(); |
|
38 |
+int init_sctp(void); |
|
39 |
+void destroy_sctp(void); |
|
40 | 40 |
int sctp_check_compiled_sockopts(char* buf, int size); |
41 |
-int sctp_check_support(); |
|
41 |
+int sctp_check_support(void); |
|
42 | 42 |
int sctp_init_sock(struct socket_info* sock_info); |
43 |
-int sctp_rcv_loop(); |
|
43 |
+int sctp_rcv_loop(void); |
|
44 | 44 |
int sctp_msg_send(struct dest_info* dst, char* buf, unsigned len); |
45 | 45 |
|
46 | 46 |
/* generic sctp information (stats a.s.o) */ |
47 | 47 |
void sctp_get_info(struct sctp_gen_info* sinf); |
48 | 48 |
|
49 |
-void destroy_sctp(); |
|
49 |
+void destroy_sctp(void); |
|
50 | 50 |
|
51 | 51 |
int sctp_setsockopt(int s, int level, int optname, |
52 | 52 |
void* optval, socklen_t optlen, char* err_prefix); |
53 | 53 |
|
54 |
-void sctp_con_tracking_flush(); |
|
54 |
+void sctp_con_tracking_flush(void); |
|
55 | 55 |
#endif /* _sctp_server_h */ |
... | ... |
@@ -80,7 +80,7 @@ extern enum sip_protos nxt_proto[PROTO_LAST+1]; |
80 | 80 |
|
81 | 81 |
extern int socket_types; |
82 | 82 |
|
83 |
-void init_proto_order(); |
|
83 |
+void init_proto_order(void); |
|
84 | 84 |
|
85 | 85 |
int add_listen_iface(char* name, struct name_lst* nlst, |
86 | 86 |
unsigned short port, unsigned short proto, |
... | ... |
@@ -89,9 +89,9 @@ int add_listen_advertise_iface(char* name, struct name_lst* nlst, |
89 | 89 |
unsigned short port, unsigned short proto, |
90 | 90 |
char *useaddr, unsigned short useport, |
91 | 91 |
enum si_flags flags); |
92 |
-int fix_all_socket_lists(); |
|
93 |
-void print_all_socket_lists(); |
|
94 |
-void print_aliases(); |
|
92 |
+int fix_all_socket_lists(void); |
|
93 |
+void print_all_socket_lists(void); |
|
94 |
+void print_aliases(void); |
|
95 | 95 |
|
96 | 96 |
struct socket_info* grep_sock_info(str* host, unsigned short port, |
97 | 97 |
unsigned short proto); |
... | ... |
@@ -123,7 +123,7 @@ static inline int next_proto(unsigned short proto) |
123 | 123 |
/* gets first non-null socket_info structure |
124 | 124 |
* (useful if for. e.g we are not listening on any udp sockets ) |
125 | 125 |
*/ |
126 |
-inline static struct socket_info* get_first_socket() |
|
126 |
+inline static struct socket_info* get_first_socket(void) |
|
127 | 127 |
{ |
128 | 128 |
if (udp_listen) return udp_listen; |
129 | 129 |
#ifdef USE_TCP |
... | ... |
@@ -58,11 +58,11 @@ struct tcp_child{ |
58 | 58 |
#define TCP_ALIAS_REPLACE 2 |
59 | 59 |
|
60 | 60 |
|
61 |
-int init_tcp(); |
|
62 |
-void destroy_tcp(); |
|
61 |
+int init_tcp(void); |
|
62 |
+void destroy_tcp(void); |
|
63 | 63 |
int tcp_init(struct socket_info* sock_info); |
64 |
-int tcp_init_children(); |
|
65 |
-void tcp_main_loop(); |
|
64 |
+int tcp_init_children(void); |
|
65 |
+void tcp_main_loop(void); |
|
66 | 66 |
void tcp_receive_loop(int unix_sock); |
67 | 67 |
int tcp_fix_child_sockets(int* fd); |
68 | 68 |
|
... | ... |
@@ -152,9 +152,9 @@ extern struct cfg_group_tcp tcp_default_cfg; |
152 | 152 |
extern void* tcp_cfg; |
153 | 153 |
|
154 | 154 |
|
155 |
-void init_tcp_options(); |
|
156 |
-void tcp_options_check(); |
|
157 |
-int tcp_register_cfg(); |
|
155 |
+void init_tcp_options(void); |
|
156 |
+void tcp_options_check(void); |
|
157 |
+int tcp_register_cfg(void); |
|
158 | 158 |
void tcp_options_get(struct cfg_group_tcp* t); |
159 | 159 |
|
160 | 160 |
#ifdef USE_TCP |
... | ... |
@@ -132,20 +132,20 @@ struct timer_ln{ /* timer_link already used in tm */ |
132 | 132 |
|
133 | 133 |
|
134 | 134 |
|
135 |
-void timer_main(); /* timer main loop, never exists */ |
|
135 |
+void timer_main(void); /* timer main loop, never exists */ |
|
136 | 136 |
|
137 | 137 |
|
138 |
-int init_timer(); |
|
139 |
-int arm_timer(); |
|
140 |
-void destroy_timer(); |
|
138 |
+int init_timer(void); |
|
139 |
+int arm_timer(void); |
|
140 |
+void destroy_timer(void); |
|
141 | 141 |
|
142 | 142 |
#ifdef USE_SLOW_TIMER |
143 |
-int arm_slow_timer(); |
|
144 |
-void slow_timer_main(); |
|
143 |
+int arm_slow_timer(void); |
|
144 |
+void slow_timer_main(void); |
|
145 | 145 |
#endif |
146 | 146 |
|
147 | 147 |
|
148 |
-struct timer_ln* timer_alloc(); |
|
148 |
+struct timer_ln* timer_alloc(void); |
|
149 | 149 |
void timer_free(struct timer_ln* t); |
150 | 150 |
|
151 | 151 |
#ifdef TIMER_DEBUG |
... | ... |
@@ -203,7 +203,7 @@ struct sr_timer{ |
203 | 203 |
/*register a periodic timer; |
204 | 204 |
* ret: <0 on error*/ |
205 | 205 |
int register_timer(timer_function f, void* param, unsigned int interval); |
206 |
-ticks_t get_ticks(); |
|
207 |
-ticks_t get_ticks_raw(); |
|
206 |
+ticks_t get_ticks(void); |
|
207 |
+ticks_t get_ticks_raw(void); |
|
208 | 208 |
|
209 | 209 |
#endif |
... | ... |
@@ -79,10 +79,10 @@ struct tls_hooks{ |
79 | 79 |
int (*init_si)(struct socket_info* si); |
80 | 80 |
/* generic init function (called at ser init, after module initialization |
81 | 81 |
* and process table creation)*/ |
82 |
- int (*init)(); |
|
82 |
+ int (*init)(void); |
|
83 | 83 |
/* destroy function, called after the modules are destroyed, and |
84 | 84 |
* after destroy_tcp() */ |
85 |
- void (*destroy)(); |
|
85 |
+ void (*destroy)(void); |
|
86 | 86 |
}; |
87 | 87 |
|
88 | 88 |
|
... | ... |
@@ -48,11 +48,11 @@ |
48 | 48 |
#endif |
49 | 49 |
|
50 | 50 |
|
51 |
-int tls_loaded(); |
|
52 |
-int tls_has_init_si(); /*returns true if a handle for tls_init is registered*/ |
|
51 |
+int tls_loaded(void); |
|
52 |
+int tls_has_init_si(void); /*returns true if a handle for tls_init is registered*/ |
|
53 | 53 |
int tls_init(struct socket_info* si); |
54 |
-int init_tls(); |
|
55 |
-void destroy_tls(); |
|
54 |
+int init_tls(void); |
|
55 |
+void destroy_tls(void); |
|
56 | 56 |
|
57 | 57 |
#endif /* TLS_HOOKS */ |
58 | 58 |
#endif |