]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
CLEANUP: tree-wide: fix prototypes for functions taking no arguments.
authorTim Duesterhus <tim@bastelstu.be>
Sun, 12 Sep 2021 10:49:33 +0000 (12:49 +0200)
committerWilly Tarreau <w@1wt.eu>
Wed, 15 Sep 2021 09:07:18 +0000 (11:07 +0200)
"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()

20 files changed:
include/haproxy/acl.h
include/haproxy/bug.h
include/haproxy/cfgdiag.h
include/haproxy/cfgparse.h
include/haproxy/cli.h
include/haproxy/cpuset.h
include/haproxy/debug.h
include/haproxy/dynbuf.h
include/haproxy/fd.h
include/haproxy/global.h
include/haproxy/listener.h
include/haproxy/log.h
include/haproxy/mworker.h
include/haproxy/pool.h
include/haproxy/proxy.h
include/haproxy/signal.h
include/haproxy/task.h
include/haproxy/thread.h
include/haproxy/time.h
include/haproxy/tools.h

index bd6e1db8b4b3bdc51255ccc361aeda38e02c4af6..ab96d1995e4f9eb08c37eb7915e998b6e9ec4031 100644 (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);
 
index 7a2fa81a086c727cc94bcdb25a2b8ae47aadd266..45c97ba6737394d31202256296c1070036db269f 100644 (file)
 
 #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
index 6ec84b1e122b20677559b7a520a6d89951e38ffe..698910997635721b3a825296260095bf04d67ee8 100644 (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 */
index 1c97a88b92a6176077059dff67be4cb24a69d678..72a3720ffc7109be4bae9a6404c9fd4d4113dc9b 100644 (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,
index 31020430ef35927e8281599dc55bb89e094981c7..6d66157d4f9b181e69d4fc0c86e1f2e20c8146a1 100644 (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 */
 
index d29c3560bc54722e0d541bef20a67830d5604129..390115bcdbb4f4940cd6d4a3e7b33b00a4f1e8de 100644 (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 */
index dd1668db9e7dbbb868db33421a770f5b8a0d1de5..7bfd12ed61e122cd7d5e0550d0fd7e3a868a9391 100644 (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 */
index d3377549e1cf987c50039ad31d848a4440a60958..c38b9c7e127434fd89ef256491c0612590387c2d 100644 (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);
 
 /*****************************************************************/
index 4160252134efb58049038ee0b8857d3ae9f2efc6..d07a0391864813193656a2b47776b0de7103cab8 100644 (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>.
index 460de1f11505bf59b9b2f156de43068b4a291a50..03c21d535ac584269512c87dd3f4b021da1461d4 100644 (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;
 
index 3fb078f8cb41f4aa9df899d3763b00a5091df4e4..1c37d34daaf6b9f049390617395ef69e56c2379f 100644 (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);
index 4503be42800dbf66d35bac071e3bd9ef4aa074ed..49fbe5bfd43e06656675c67603cf51f732ad4314 100644 (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);
index 279fb085dad1a478ffb6092d28fd51d4919a5751..0e166ac090dca181b97d210b06ee9898cf812e67 100644 (file)
 
 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);
 
index 0bc683b1c4018545bb9c36af39ec22cb0f877737..cb2c8b4de26e31a54d24aa62495b16f1908ccfdd 100644 (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 */
index 8a2a5c85e55a408e464d282fd5611f8b03aec9cd..c7bc2c533594f581ccc4ccc0f66a3e0dcf7689cf 100644 (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);
 
index 331b7fdc60e141c51eb553acf6c3abe10f4aeb72..25a4ef1138be86724867c2b2a8d31d8f2815556d 100644 (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()
 {
index f83aba78428f609cb4fc133cf3c981f90a7b3f15..2fe5f74af1a801d14953b8d3e3f7fed5bf6f1609 100644 (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
index 9cf66476c30ecb9f550ae17a339bbabf692bffee..5c0dc49e357e998f1a47b4185248b199d8933310 100644 (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)
 
index c8358e00c0729b7ebb6dba2e110725acf0746a64..e9baab418b952850706228eb9f6597769e891c79 100644 (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);
 
index dec82e6b7210b7164ae39452aa6cfef8bcf46b12..141b3dadbec2afb7a95064b5a8f00234412247c8 100644 (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()
 {