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()
This commit is contained in:
Tim Duesterhus 2021-09-12 12:49:33 +02:00 committed by Willy Tarreau
parent 062a54dd47
commit 992007ec78
20 changed files with 52 additions and 52 deletions

View File

@ -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);

View File

@ -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

View File

@ -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 */

View File

@ -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,

View File

@ -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 */

View File

@ -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 */

View File

@ -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 */

View File

@ -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);
/*****************************************************************/

View File

@ -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 <out>.

View File

@ -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;

View File

@ -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 <px>'s queue */
void dequeue_proxy_listeners(struct proxy *px);

View File

@ -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);

View File

@ -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);

View File

@ -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 */

View File

@ -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);

View File

@ -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()
{

View File

@ -124,24 +124,24 @@ unsigned int run_tasks_from_lists(unsigned int budgets[]);
* - 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

View File

@ -166,11 +166,11 @@ static inline unsigned long thread_isolated()
#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 @@ 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)

View File

@ -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);

View File

@ -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()
{