From: Tim Duesterhus Date: Sun, 12 Sep 2021 10:49:33 +0000 (+0200) Subject: CLEANUP: tree-wide: fix prototypes for functions taking no arguments. X-Git-Tag: v2.5-dev8~191 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=992007ec785f573aca08bc57630d859691365c3a;p=thirdparty%2Fhaproxy.git 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 bd6e1db8b4..ab96d1995e 100644 --- a/include/haproxy/acl.h +++ b/include/haproxy/acl.h @@ -144,7 +144,7 @@ void acl_unregister_keywords(struct acl_kw_list *kwl); /* 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 7a2fa81a08..45c97ba673 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 is true when DEBUG_STRICT or DEBUG_STRICT_NOCRASH diff --git a/include/haproxy/cfgdiag.h b/include/haproxy/cfgdiag.h index 6ec84b1e12..6989109976 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 1c97a88b92..72a3720ffc 100644 --- a/include/haproxy/cfgparse.h +++ b/include/haproxy/cfgparse.h @@ -101,7 +101,7 @@ int cfg_parse_track_sc_num(unsigned int *track_sc_num, 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 31020430ef..6d66157d4f 100644 --- a/include/haproxy/cli.h +++ b/include/haproxy/cli.h @@ -40,10 +40,10 @@ int cli_parse_default(char **args, char *payload, struct appctx *appctx, void *p /* 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 d29c3560bc..390115bcdb 100644 --- a/include/haproxy/cpuset.h +++ b/include/haproxy/cpuset.h @@ -39,6 +39,6 @@ void ha_cpuset_assign(struct hap_cpuset *dst, const struct hap_cpuset *src); /* 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 dd1668db9e..7bfd12ed61 100644 --- a/include/haproxy/debug.h +++ b/include/haproxy/debug.h @@ -29,8 +29,8 @@ extern unsigned int debug_commands_issued; 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 d3377549e1..c38b9c7e12 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 4160252134..d07a039186 100644 --- a/include/haproxy/fd.h +++ b/include/haproxy/fd.h @@ -82,12 +82,12 @@ void poller_pipe_io_handler(int fd); * 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 @@ void deinit_pollers(); * 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 . diff --git a/include/haproxy/global.h b/include/haproxy/global.h index 460de1f115..03c21d535a 100644 --- a/include/haproxy/global.h +++ b/include/haproxy/global.h @@ -65,7 +65,7 @@ int split_version(const char *version, unsigned int *value); 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 @@ enum tainted_flags { 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 3fb078f8cb..1c37d34daa 100644 --- a/include/haproxy/listener.h +++ b/include/haproxy/listener.h @@ -66,7 +66,7 @@ void stop_listener(struct listener *l, int lpx, int lpr, int lli); 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 's queue */ void dequeue_proxy_listeners(struct proxy *px); diff --git a/include/haproxy/log.h b/include/haproxy/log.h index 4503be4280..49fbe5bfd4 100644 --- a/include/haproxy/log.h +++ b/include/haproxy/log.h @@ -57,8 +57,8 @@ extern int cum_log_messages; 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 279fb085da..0e166ac090 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_catch_sigchld(struct sig_handler *sh); 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 0bc683b1c4..cb2c8b4de2 100644 --- a/include/haproxy/pool.h +++ b/include/haproxy/pool.h @@ -52,17 +52,17 @@ void *pool_get_from_os(struct pool_head *pool); 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_bytes; /* total cache size */ 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 8a2a5c85e5..c7bc2c5335 100644 --- a/include/haproxy/proxy.h +++ b/include/haproxy/proxy.h @@ -62,7 +62,7 @@ void init_new_proxy(struct proxy *p); 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 @@ void proxy_capture_error(struct proxy *proxy, int is_back, 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 331b7fdc60..25a4ef1138 100644 --- a/include/haproxy/signal.h +++ b/include/haproxy/signal.h @@ -27,14 +27,14 @@ extern struct signal_descriptor signal_state[]; __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 f83aba7842..2fe5f74af1 100644 --- a/include/haproxy/task.h +++ b/include/haproxy/task.h @@ -124,24 +124,24 @@ unsigned int run_tasks_from_lists(unsigned int budgets[]); * - return the date of next event in 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 9cf66476c3..5c0dc49e35 100644 --- a/include/haproxy/thread.h +++ b/include/haproxy/thread.h @@ -166,11 +166,11 @@ static inline unsigned long thread_isolated() #include #include -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 @@ static inline unsigned long thread_isolated() /* 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 c8358e00c0..e9baab418b 100644 --- a/include/haproxy/time.h +++ b/include/haproxy/time.h @@ -88,8 +88,8 @@ int tv_ms_cmp2(const struct timeval *tv1, const struct timeval *tv2); * 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 dec82e6b72..141b3dadbe 100644 --- a/include/haproxy/tools.h +++ b/include/haproxy/tools.h @@ -981,7 +981,7 @@ void dump_addr_and_bytes(struct buffer *buf, const char *pfx, const void *addr, 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 @@ int parse_dotted_uints(const char *s, unsigned int **nums, size_t *sz); 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() {