CLEANUP: tree-wide: fix prototypes for functions taking no arguments.
"f(void)" is the correct and preferred form for a function taking no
argument, while some places use the older "f()". These were reported
by clang's -Wmissing-prototypes, for example:
src/cpuset.c:111:5: warning: no previous prototype for function 'ha_cpuset_size' [-Wmissing-prototypes]
int ha_cpuset_size()
include/haproxy/cpuset.h:42:5: note: this declaration is not a prototype; add 'void' to make it a prototype for a zero-parameter function
int ha_cpuset_size();
^
void
This aggregate patch fixes this for the following functions:
ha_backtrace_to_stderr(), ha_cpuset_size(), ha_panic(), ha_random64(),
ha_thread_dump_all_to_trash(), get_exec_path(), check_config_validity(),
mworker_child_nb(), mworker_cli_proxy_(create|stop)(),
mworker_cleantasks(), mworker_cleanlisteners(), mworker_ext_launch_all(),
mworker_reload(), mworker_(env|proc_list)_to_(proc_list|env)(),
mworker_(un|)block_signals(), proxy_adjust_all_maxconn(),
proxy_destroy_all_defaults(), get_tainted(),
pool_total_(allocated|used)(), thread_isolate(_full|)(),
thread(_sync|)_release(), thread_harmless_till_end(),
thread_cpu_mask_forced(), dequeue_all_listeners(), next_timer_expiry(),
wake_expired_tasks(), process_runnable_tasks(), init_acl(),
init_buffer(), (de|)init_log_buffers(), (de|)init_pollers(),
fork_poller(), pool_destroy_all(), pool_evict_from_local_caches(),
pool_total_failures(), dump_pools_to_trash(), cfg_run_diagnostics(),
tv_init_(process|thread)_date(), __signal_process_queue(),
deinit_signals(), haproxy_unblock_signals()
diff --git a/include/haproxy/acl.h b/include/haproxy/acl.h
index bd6e1db..ab96d19 100644
--- a/include/haproxy/acl.h
+++ b/include/haproxy/acl.h
@@ -144,7 +144,7 @@
/* initializes ACLs by resolving the sample fetch names they rely upon.
* Returns 0 on success, otherwise an error.
*/
-int init_acl();
+int init_acl(void);
void free_acl_cond(struct acl_cond *cond);
diff --git a/include/haproxy/bug.h b/include/haproxy/bug.h
index 7a2fa81..45c97ba 100644
--- a/include/haproxy/bug.h
+++ b/include/haproxy/bug.h
@@ -39,12 +39,12 @@
#ifdef DEBUG_USE_ABORT
/* abort() is better recognized by code analysis tools */
-#define ABORT_NOW() do { extern void ha_backtrace_to_stderr(); ha_backtrace_to_stderr(); abort(); } while (0)
+#define ABORT_NOW() do { extern void ha_backtrace_to_stderr(void); ha_backtrace_to_stderr(); abort(); } while (0)
#else
/* More efficient than abort() because it does not mangle the
* stack and stops at the exact location we need.
*/
-#define ABORT_NOW() do { extern void ha_backtrace_to_stderr(); ha_backtrace_to_stderr(); (*(volatile int*)1=0); } while (0)
+#define ABORT_NOW() do { extern void ha_backtrace_to_stderr(void); ha_backtrace_to_stderr(); (*(volatile int*)1=0); } while (0)
#endif
/* BUG_ON: complains if <cond> is true when DEBUG_STRICT or DEBUG_STRICT_NOCRASH
diff --git a/include/haproxy/cfgdiag.h b/include/haproxy/cfgdiag.h
index 6ec84b1..6989109 100644
--- a/include/haproxy/cfgdiag.h
+++ b/include/haproxy/cfgdiag.h
@@ -6,6 +6,6 @@
*
* Returns 0 if no diagnostic message has been found else 1.
*/
-int cfg_run_diagnostics();
+int cfg_run_diagnostics(void);
#endif /* _HAPROXY_CFGDIAG_H */
diff --git a/include/haproxy/cfgparse.h b/include/haproxy/cfgparse.h
index 1c97a88..72a3720 100644
--- a/include/haproxy/cfgparse.h
+++ b/include/haproxy/cfgparse.h
@@ -101,7 +101,7 @@
int readcfgfile(const char *file);
void cfg_register_keywords(struct cfg_kw_list *kwl);
void cfg_unregister_keywords(struct cfg_kw_list *kwl);
-int check_config_validity();
+int check_config_validity(void);
int str2listener(char *str, struct proxy *curproxy, struct bind_conf *bind_conf, const char *file, int line, char **err);
int str2receiver(char *str, struct proxy *curproxy, struct bind_conf *bind_conf, const char *file, int line, char **err);
int cfg_register_section(char *section_name,
diff --git a/include/haproxy/cli.h b/include/haproxy/cli.h
index 3102043..6d66157 100644
--- a/include/haproxy/cli.h
+++ b/include/haproxy/cli.h
@@ -40,10 +40,10 @@
/* mworker proxy functions */
-int mworker_cli_proxy_create();
+int mworker_cli_proxy_create(void);
int mworker_cli_proxy_new_listener(char *line);
int mworker_cli_sockpair_new(struct mworker_proc *mworker_proc, int proc);
-void mworker_cli_proxy_stop();
+void mworker_cli_proxy_stop(void);
/* proxy mode cli functions */
diff --git a/include/haproxy/cpuset.h b/include/haproxy/cpuset.h
index d29c356..390115b 100644
--- a/include/haproxy/cpuset.h
+++ b/include/haproxy/cpuset.h
@@ -39,6 +39,6 @@
/* Returns the biggest index plus one usable on the platform.
*/
-int ha_cpuset_size();
+int ha_cpuset_size(void);
#endif /* _HAPROXY_CPUSET_H */
diff --git a/include/haproxy/debug.h b/include/haproxy/debug.h
index dd1668d..7bfd12e 100644
--- a/include/haproxy/debug.h
+++ b/include/haproxy/debug.h
@@ -29,8 +29,8 @@
void ha_task_dump(struct buffer *buf, const struct task *task, const char *pfx);
void ha_thread_dump(struct buffer *buf, int thr, int calling_tid);
void ha_dump_backtrace(struct buffer *buf, const char *prefix, int dump);
-void ha_backtrace_to_stderr();
-void ha_thread_dump_all_to_trash();
-void ha_panic();
+void ha_backtrace_to_stderr(void);
+void ha_thread_dump_all_to_trash(void);
+void ha_panic(void);
#endif /* _HAPROXY_DEBUG_H */
diff --git a/include/haproxy/dynbuf.h b/include/haproxy/dynbuf.h
index d337754..c38b9c7 100644
--- a/include/haproxy/dynbuf.h
+++ b/include/haproxy/dynbuf.h
@@ -36,7 +36,7 @@
extern struct pool_head *pool_head_buffer;
-int init_buffer();
+int init_buffer(void);
void buffer_dump(FILE *o, struct buffer *b, int from, int to);
/*****************************************************************/
diff --git a/include/haproxy/fd.h b/include/haproxy/fd.h
index 4160252..d07a039 100644
--- a/include/haproxy/fd.h
+++ b/include/haproxy/fd.h
@@ -82,12 +82,12 @@
* If none works, returns 0, otherwise 1.
* The pollers register themselves just before main() is called.
*/
-int init_pollers();
+int init_pollers(void);
/*
* Deinitialize the pollers.
*/
-void deinit_pollers();
+void deinit_pollers(void);
/*
* Some pollers may lose their connection after a fork(). It may be necessary
@@ -96,7 +96,7 @@
* the the current poller is destroyed and the caller is responsible for trying
* another one by calling init_pollers() again.
*/
-int fork_poller();
+int fork_poller(void);
/*
* Lists the known pollers on <out>.
diff --git a/include/haproxy/global.h b/include/haproxy/global.h
index 460de1f..03c21d5 100644
--- a/include/haproxy/global.h
+++ b/include/haproxy/global.h
@@ -65,7 +65,7 @@
int compare_current_version(const char *version);
void mworker_accept_wrapper(int fd);
-void mworker_reload();
+void mworker_reload(void);
/* to be used with warned and WARN_* */
static inline int already_warned(unsigned int warning)
@@ -90,7 +90,7 @@
TAINTED_CLI_EXPERIMENTAL_MODE = 0x8,
};
void mark_tainted(const enum tainted_flags flag);
-unsigned int get_tainted();
+unsigned int get_tainted(void);
extern unsigned int experimental_directives_allowed;
diff --git a/include/haproxy/listener.h b/include/haproxy/listener.h
index 3fb078f..1c37d34 100644
--- a/include/haproxy/listener.h
+++ b/include/haproxy/listener.h
@@ -66,7 +66,7 @@
void enable_listener(struct listener *listener);
/* Dequeues all listeners waiting for a resource the global wait queue */
-void dequeue_all_listeners();
+void dequeue_all_listeners(void);
/* Dequeues all listeners waiting for a resource in proxy <px>'s queue */
void dequeue_proxy_listeners(struct proxy *px);
diff --git a/include/haproxy/log.h b/include/haproxy/log.h
index 4503be4..49fbe5b 100644
--- a/include/haproxy/log.h
+++ b/include/haproxy/log.h
@@ -57,8 +57,8 @@
void syslog_fd_handler(int fd);
/* Initialize/Deinitialize log buffers used for syslog messages */
-int init_log_buffers();
-void deinit_log_buffers();
+int init_log_buffers(void);
+void deinit_log_buffers(void);
/* build a log line for the session and an optional stream */
int sess_build_logline(struct session *sess, struct stream *s, char *dst, size_t maxsize, struct list *list_format);
diff --git a/include/haproxy/mworker.h b/include/haproxy/mworker.h
index 279fb08..0e166ac 100644
--- a/include/haproxy/mworker.h
+++ b/include/haproxy/mworker.h
@@ -19,12 +19,12 @@
extern struct mworker_proc *proc_self;
-void mworker_proc_list_to_env();
-int mworker_env_to_proc_list();
+void mworker_proc_list_to_env(void);
+int mworker_env_to_proc_list(void);
-void mworker_block_signals();
-void mworker_unblock_signals();
+void mworker_block_signals(void);
+void mworker_unblock_signals(void);
void mworker_broadcast_signal(struct sig_handler *sh);
void mworker_catch_sighup(struct sig_handler *sh);
@@ -33,11 +33,11 @@
void mworker_accept_wrapper(int fd);
-void mworker_cleanlisteners();
+void mworker_cleanlisteners(void);
-int mworker_child_nb();
+int mworker_child_nb(void);
-int mworker_ext_launch_all();
+int mworker_ext_launch_all(void);
void mworker_kill_max_reloads(int sig);
diff --git a/include/haproxy/pool.h b/include/haproxy/pool.h
index 0bc683b..cb2c8b4 100644
--- a/include/haproxy/pool.h
+++ b/include/haproxy/pool.h
@@ -52,17 +52,17 @@
void pool_put_to_os(struct pool_head *pool, void *ptr);
void *pool_alloc_nocache(struct pool_head *pool);
void pool_free_nocache(struct pool_head *pool, void *ptr);
-void dump_pools_to_trash();
+void dump_pools_to_trash(void);
void dump_pools(void);
-int pool_total_failures();
-unsigned long pool_total_allocated();
-unsigned long pool_total_used();
+int pool_total_failures(void);
+unsigned long pool_total_allocated(void);
+unsigned long pool_total_used(void);
void pool_flush(struct pool_head *pool);
void pool_gc(struct pool_head *pool_ctx);
struct pool_head *create_pool(char *name, unsigned int size, unsigned int flags);
void create_pool_callback(struct pool_head **ptr, char *name, unsigned int size);
void *pool_destroy(struct pool_head *pool);
-void pool_destroy_all();
+void pool_destroy_all(void);
int mem_should_fail(const struct pool_head *pool);
@@ -74,7 +74,7 @@
extern THREAD_LOCAL size_t pool_cache_count; /* #cache objects */
void pool_evict_from_local_cache(struct pool_head *pool);
-void pool_evict_from_local_caches();
+void pool_evict_from_local_caches(void);
void pool_put_to_cache(struct pool_head *pool, void *ptr);
/* returns true if the pool is considered to have too many free objects */
diff --git a/include/haproxy/proxy.h b/include/haproxy/proxy.h
index 8a2a5c8..c7bc2c5 100644
--- a/include/haproxy/proxy.h
+++ b/include/haproxy/proxy.h
@@ -62,7 +62,7 @@
void proxy_preset_defaults(struct proxy *defproxy);
void proxy_free_defaults(struct proxy *defproxy);
void proxy_destroy_defaults(struct proxy *px);
-void proxy_destroy_all_defaults();
+void proxy_destroy_all_defaults(void);
struct proxy *alloc_new_proxy(const char *name, unsigned int cap,
char **errmsg);
struct proxy *parse_new_proxy(const char *name, unsigned int cap,
@@ -77,7 +77,7 @@
unsigned int buf_out, unsigned int err_pos,
const union error_snapshot_ctx *ctx,
void (*show)(struct buffer *, const struct error_snapshot *));
-void proxy_adjust_all_maxconn();
+void proxy_adjust_all_maxconn(void);
struct proxy *cli_find_frontend(struct appctx *appctx, const char *arg);
struct proxy *cli_find_frontend(struct appctx *appctx, const char *arg);
diff --git a/include/haproxy/signal.h b/include/haproxy/signal.h
index 331b7fd..25a4ef1 100644
--- a/include/haproxy/signal.h
+++ b/include/haproxy/signal.h
@@ -27,14 +27,14 @@
__decl_thread(extern HA_SPINLOCK_T signals_lock);
void signal_handler(int sig);
-void __signal_process_queue();
-void deinit_signals();
+void __signal_process_queue(void);
+void deinit_signals(void);
struct sig_handler *signal_register_fct(int sig, void (*fct)(struct sig_handler *), int arg);
struct sig_handler *signal_register_task(int sig, struct task *task, int reason);
void signal_unregister_handler(struct sig_handler *handler);
void signal_unregister_target(int sig, void *target);
void signal_unregister(int sig);
-void haproxy_unblock_signals();
+void haproxy_unblock_signals(void);
static inline void signal_process_queue()
{
diff --git a/include/haproxy/task.h b/include/haproxy/task.h
index f83aba7..2fe5f74 100644
--- a/include/haproxy/task.h
+++ b/include/haproxy/task.h
@@ -124,24 +124,24 @@
* - return the date of next event in <next> or eternity.
*/
-void process_runnable_tasks();
+void process_runnable_tasks(void);
/*
* Extract all expired timers from the timer queue, and wakes up all
* associated tasks.
*/
-void wake_expired_tasks();
+void wake_expired_tasks(void);
/* Checks the next timer for the current thread by looking into its own timer
* list and the global one. It may return TICK_ETERNITY if no timer is present.
* Note that the next timer might very well be slightly in the past.
*/
-int next_timer_expiry();
+int next_timer_expiry(void);
/*
* Delete every tasks before running the master polling loop
*/
-void mworker_cleantasks();
+void mworker_cleantasks(void);
/* returns the number of running tasks+tasklets on the whole process. Note
* that this *is* racy since a task may move from the global to a local
diff --git a/include/haproxy/thread.h b/include/haproxy/thread.h
index 9cf6647..5c0dc49 100644
--- a/include/haproxy/thread.h
+++ b/include/haproxy/thread.h
@@ -166,11 +166,11 @@
#include <string.h>
#include <import/plock.h>
-void thread_harmless_till_end();
-void thread_isolate();
-void thread_isolate_full();
-void thread_release();
-void thread_sync_release();
+void thread_harmless_till_end(void);
+void thread_isolate(void);
+void thread_isolate_full(void);
+void thread_release(void);
+void thread_sync_release(void);
void ha_tkill(unsigned int thr, int sig);
void ha_tkillall(int sig);
void ha_spin_init(HA_SPINLOCK_T *l);
@@ -325,7 +325,7 @@
/* Returns 1 if the cpu set is currently restricted for the process else 0.
* Currently only implemented for the Linux platform.
*/
-int thread_cpu_mask_forced();
+int thread_cpu_mask_forced(void);
#if !defined(DEBUG_THREAD) && !defined(DEBUG_FULL)
diff --git a/include/haproxy/time.h b/include/haproxy/time.h
index c8358e0..e9baab4 100644
--- a/include/haproxy/time.h
+++ b/include/haproxy/time.h
@@ -88,8 +88,8 @@
* timeout).
*/
void tv_update_date(int max_wait, int interrupted);
-void tv_init_process_date();
-void tv_init_thread_date();
+void tv_init_process_date(void);
+void tv_init_thread_date(void);
char *timeofday_as_iso_us(int pad);
diff --git a/include/haproxy/tools.h b/include/haproxy/tools.h
index dec82e6..141b3da 100644
--- a/include/haproxy/tools.h
+++ b/include/haproxy/tools.h
@@ -981,7 +981,7 @@
void dump_hex(struct buffer *out, const char *pfx, const void *buf, int len, int unsafe);
int may_access(const void *ptr);
const void *resolve_sym_name(struct buffer *buf, const char *pfx, const void *addr);
-const char *get_exec_path();
+const char *get_exec_path(void);
void *get_sym_curr_addr(const char *name);
void *get_sym_next_addr(const char *name);
@@ -1027,7 +1027,7 @@
void ha_generate_uuid(struct buffer *output);
void ha_random_seed(const unsigned char *seed, size_t len);
void ha_random_jump96(uint32_t dist);
-uint64_t ha_random64();
+uint64_t ha_random64(void);
static inline uint32_t ha_random32()
{