Fix Clang 6 compiler warnings

This commit is contained in:
Simon Arlott 2019-09-15 11:28:48 +01:00
parent a4fe4b8191
commit 8679c0fe3c
No known key found for this signature in database
GPG key ID: 49BFFEEFD4C3ED53
15 changed files with 66 additions and 69 deletions

View file

@ -743,7 +743,7 @@ check_schema(void)
NULL NULL
}; };
for(i = 0; i < LAST_BANDB_TYPE; i++) for(i = 0; i < LAST_BANDB_TYPE; i += 2 /* skip over _PERM */)
{ {
if(!table_exists(bandb_table[i])) if(!table_exists(bandb_table[i]))
{ {
@ -770,8 +770,6 @@ check_schema(void)
columns[j], type); columns[j], type);
} }
} }
i++; /* skip over .perm */
} }
} }
@ -816,10 +814,9 @@ wipe_schema(void)
{ {
int i; int i;
rsdb_transaction(RSDB_TRANS_START); rsdb_transaction(RSDB_TRANS_START);
for(i = 0; i < LAST_BANDB_TYPE; i++) for(i = 0; i < LAST_BANDB_TYPE; i += 2 /* double increment to skip over _PERM */)
{ {
rsdb_exec(NULL, "DROP TABLE %s", bandb_table[i]); rsdb_exec(NULL, "DROP TABLE %s", bandb_table[i]);
i++; /* double increment to skip over .perm */
} }
rsdb_transaction(RSDB_TRANS_END); rsdb_transaction(RSDB_TRANS_END);

View file

@ -248,7 +248,7 @@ rb_bh_destroy(rb_bh *bh)
} }
void void
rb_bh_usage(rb_bh *bh, size_t *bused, size_t *bfree, size_t *bmemusage, const char **desc) rb_bh_usage(rb_bh *bh __attribute__((unused)), size_t *bused, size_t *bfree, size_t *bmemusage, const char **desc)
{ {
if(bused != NULL) if(bused != NULL)
*bused = 0; *bused = 0;

View file

@ -312,7 +312,7 @@ rb_settimeout(rb_fde_t *F, time_t timeout, PF * callback, void *cbdata)
* this will happen. * this will happen.
*/ */
void void
rb_checktimeouts(void *notused) rb_checktimeouts(void *notused __attribute__((unused)))
{ {
rb_dlink_node *ptr, *next; rb_dlink_node *ptr, *next;
struct timeout_data *td; struct timeout_data *td;
@ -514,7 +514,7 @@ rb_inet_get_proto(rb_fde_t *F)
return IPPROTO_TCP; return IPPROTO_TCP;
} }
static void rb_accept_tryaccept(rb_fde_t *F, void *data) { static void rb_accept_tryaccept(rb_fde_t *F, void *data __attribute__((unused))) {
struct rb_sockaddr_storage st; struct rb_sockaddr_storage st;
rb_fde_t *new_F; rb_fde_t *new_F;
rb_socklen_t addrlen; rb_socklen_t addrlen;
@ -772,14 +772,14 @@ rb_connect_callback(rb_fde_t *F, int status)
* called .. * called ..
*/ */
static void static void
rb_connect_timeout(rb_fde_t *F, void *notused) rb_connect_timeout(rb_fde_t *F, void *notused __attribute__((unused)))
{ {
/* error! */ /* error! */
rb_connect_callback(F, RB_ERR_TIMEOUT); rb_connect_callback(F, RB_ERR_TIMEOUT);
} }
static void static void
rb_connect_outcome(rb_fde_t *F, void *notused) rb_connect_outcome(rb_fde_t *F, void *notused __attribute__((unused)))
{ {
int retval; int retval;
int err = 0; int err = 0;
@ -2448,7 +2448,7 @@ rb_recv_fd_buf(rb_fde_t *F, void *data, size_t datasize, rb_fde_t **xF, int nfds
int int
rb_send_fd_buf(rb_fde_t *xF, rb_fde_t **F, int count, void *data, size_t datasize, pid_t pid) rb_send_fd_buf(rb_fde_t *xF, rb_fde_t **F, int count, void *data, size_t datasize, pid_t pid __attribute__((unused)))
{ {
struct msghdr msg; struct msghdr msg;
struct cmsghdr *cmsg; struct cmsghdr *cmsg;

View file

@ -277,21 +277,21 @@ rb_init_netio_devpoll(void)
} }
void void
rb_setselect_devpoll(rb_fde_t *F, unsigned int type, PF * handler, void *client_data) rb_setselect_devpoll(rb_fde_t *F __attribute__((unused)), unsigned int type __attribute__((unused)), PF * handler __attribute__((unused)), void *client_data __attribute__((unused)))
{ {
errno = ENOSYS; errno = ENOSYS;
return; return;
} }
int int
rb_select_devpoll(long delay) rb_select_devpoll(long delay __attribute__((unused)))
{ {
errno = ENOSYS; errno = ENOSYS;
return -1; return -1;
} }
int int
rb_setup_fd_devpoll(rb_fde_t *F) rb_setup_fd_devpoll(rb_fde_t *F __attribute__((unused)))
{ {
errno = ENOSYS; errno = ENOSYS;
return -1; return -1;

View file

@ -586,7 +586,7 @@ void rb_dictionary_foreach_start(rb_dictionary *dtree,
* Side Effects: * Side Effects:
* - none * - none
*/ */
void *rb_dictionary_foreach_cur(rb_dictionary *dtree, void *rb_dictionary_foreach_cur(rb_dictionary *dtree __attribute__((unused)),
rb_dictionary_iter *state) rb_dictionary_iter *state)
{ {
lrb_assert(dtree != NULL); lrb_assert(dtree != NULL);

View file

@ -84,7 +84,7 @@ rb_init_netio_epoll(void)
} }
int int
rb_setup_fd_epoll(rb_fde_t *F) rb_setup_fd_epoll(rb_fde_t *F __attribute__((unused)))
{ {
return 0; return 0;
} }
@ -326,7 +326,7 @@ struct our_signalfd_siginfo
#define SIGFDIOV_COUNT 16 #define SIGFDIOV_COUNT 16
static void static void
signalfd_handler(rb_fde_t *F, void *data) signalfd_handler(rb_fde_t *F, void *data __attribute__((unused)))
{ {
static struct our_signalfd_siginfo fdsig[SIGFDIOV_COUNT]; static struct our_signalfd_siginfo fdsig[SIGFDIOV_COUNT];
static struct iovec iov[SIGFDIOV_COUNT]; static struct iovec iov[SIGFDIOV_COUNT];
@ -533,21 +533,21 @@ rb_init_netio_epoll(void)
} }
void void
rb_setselect_epoll(rb_fde_t *F, unsigned int type, PF * handler, void *client_data) rb_setselect_epoll(rb_fde_t *F __attribute__((unused)), unsigned int type __attribute__((unused)), PF * handler __attribute__((unused)), void *client_data __attribute__((unused)))
{ {
errno = ENOSYS; errno = ENOSYS;
return; return;
} }
int int
rb_select_epoll(long delay) rb_select_epoll(long delay __attribute__((unused)))
{ {
errno = ENOSYS; errno = ENOSYS;
return -1; return -1;
} }
int int
rb_setup_fd_epoll(rb_fde_t *F) rb_setup_fd_epoll(rb_fde_t *F __attribute__((unused)))
{ {
errno = ENOSYS; errno = ENOSYS;
return -1; return -1;
@ -564,14 +564,14 @@ rb_epoll_init_event(void)
} }
int int
rb_epoll_sched_event(struct ev_entry *event, int when) rb_epoll_sched_event(struct ev_entry *event __attribute__((unused)), int when __attribute__((unused)))
{ {
errno = ENOSYS; errno = ENOSYS;
return -1; return -1;
} }
void void
rb_epoll_unsched_event(struct ev_entry *event) rb_epoll_unsched_event(struct ev_entry *event __attribute__((unused)))
{ {
return; return;
} }

View file

@ -242,7 +242,7 @@ rb_helper_write(rb_helper *helper, const char *format, ...)
} }
static void static void
rb_helper_read_cb(rb_fde_t *F, void *data) rb_helper_read_cb(rb_fde_t *F __attribute__((unused)), void *data)
{ {
rb_helper *helper = (rb_helper *)data; rb_helper *helper = (rb_helper *)data;
static char buf[32768]; static char buf[32768];

View file

@ -358,21 +358,21 @@ rb_init_netio_kqueue(void)
} }
void void
rb_setselect_kqueue(rb_fde_t *F, unsigned int type, PF * handler, void *client_data) rb_setselect_kqueue(rb_fde_t *F __attribute__((unused)), unsigned int type __attribute__((unused)), PF * handler __attribute__((unused)), void *client_data __attribute__((unused)))
{ {
errno = ENOSYS; errno = ENOSYS;
return; return;
} }
int int
rb_select_kqueue(long delay) rb_select_kqueue(long delay __attribute__((unused)))
{ {
errno = ENOSYS; errno = ENOSYS;
return -1; return -1;
} }
int int
rb_setup_fd_kqueue(rb_fde_t *F) rb_setup_fd_kqueue(rb_fde_t *F __attribute__((unused)))
{ {
errno = ENOSYS; errno = ENOSYS;
return -1; return -1;
@ -388,14 +388,14 @@ rb_kqueue_init_event(void)
} }
int int
rb_kqueue_sched_event(struct ev_entry *event, int when) rb_kqueue_sched_event(struct ev_entry *event __attribute__((unused)), int when __attribute__((unused)))
{ {
errno = ENOSYS; errno = ENOSYS;
return -1; return -1;
} }
void void
rb_kqueue_unsched_event(struct ev_entry *event) rb_kqueue_unsched_event(struct ev_entry *event __attribute__((unused)))
{ {
return; return;
} }

View file

@ -33,7 +33,7 @@
#include <commio-ssl.h> #include <commio-ssl.h>
int int
rb_setup_ssl_server(const char *cert, const char *keyfile, const char *dhfile, const char *cipher_list) rb_setup_ssl_server(const char *cert __attribute__((unused)), const char *keyfile __attribute__((unused)), const char *dhfile __attribute__((unused)), const char *cipher_list __attribute__((unused)))
{ {
errno = ENOSYS; errno = ENOSYS;
return 0; return 0;
@ -48,21 +48,21 @@ rb_init_ssl(void)
} }
int int
rb_ssl_listen(rb_fde_t *F, int backlog, int defer_accept) rb_ssl_listen(rb_fde_t *F __attribute__((unused)), int backlog __attribute__((unused)), int defer_accept __attribute__((unused)))
{ {
errno = ENOSYS; errno = ENOSYS;
return -1; return -1;
} }
static void static void
rb_stir_arc4random(void *unused) rb_stir_arc4random(void *unused __attribute__((unused)))
{ {
arc4random_stir(); arc4random_stir();
} }
int int
rb_init_prng(const char *path, prng_seed_t seed_type) rb_init_prng(const char *path __attribute__((unused)), prng_seed_t seed_type __attribute__((unused)))
{ {
/* xxx this ignores the parameters above */ /* xxx this ignores the parameters above */
arc4random_stir(); arc4random_stir();
@ -86,39 +86,39 @@ rb_get_random(void *buf, size_t length)
} }
const char * const char *
rb_get_ssl_strerror(rb_fde_t *F) rb_get_ssl_strerror(rb_fde_t *F __attribute__((unused)))
{ {
static const char *nosupport = "SSL/TLS not supported"; static const char *nosupport = "SSL/TLS not supported";
return nosupport; return nosupport;
} }
int int
rb_get_ssl_certfp(rb_fde_t *F, uint8_t certfp[RB_SSL_CERTFP_LEN], int method) rb_get_ssl_certfp(rb_fde_t *F __attribute__((unused)), uint8_t certfp[RB_SSL_CERTFP_LEN] __attribute__((unused)), int method __attribute__((unused)))
{ {
return 0; return 0;
} }
int int
rb_get_ssl_certfp_file(const char *filename, uint8_t certfp[RB_SSL_CERTFP_LEN], int method) rb_get_ssl_certfp_file(const char *filename __attribute__((unused)), uint8_t certfp[RB_SSL_CERTFP_LEN] __attribute__((unused)), int method __attribute__((unused)))
{ {
return 0; return 0;
} }
void void
rb_ssl_start_accepted(rb_fde_t *new_F, ACCB * cb, void *data, int timeout) rb_ssl_start_accepted(rb_fde_t *new_F __attribute__((unused)), ACCB * cb __attribute__((unused)), void *data __attribute__((unused)), int timeout __attribute__((unused)))
{ {
return; return;
} }
void void
rb_ssl_start_connected(rb_fde_t *F, CNCB * callback, void *data, int timeout) rb_ssl_start_connected(rb_fde_t *F __attribute__((unused)), CNCB * callback __attribute__((unused)), void *data __attribute__((unused)), int timeout __attribute__((unused)))
{ {
return; return;
} }
void void
rb_connect_tcp_ssl(rb_fde_t *F, struct sockaddr *dest, rb_connect_tcp_ssl(rb_fde_t *F __attribute__((unused)), struct sockaddr *dest __attribute__((unused)),
struct sockaddr *clocal, CNCB * callback, void *data, int timeout) struct sockaddr *clocal __attribute__((unused)), CNCB * callback __attribute__((unused)), void *data __attribute__((unused)), int timeout __attribute__((unused)))
{ {
return; return;
} }
@ -130,58 +130,58 @@ rb_supports_ssl(void)
} }
void void
rb_ssl_shutdown(rb_fde_t *F) rb_ssl_shutdown(rb_fde_t *F __attribute__((unused)))
{ {
return; return;
} }
void void
rb_ssl_accept_setup(rb_fde_t *F, rb_fde_t *new_F, struct sockaddr *st, int addrlen) rb_ssl_accept_setup(rb_fde_t *F __attribute__((unused)), rb_fde_t *new_F __attribute__((unused)), struct sockaddr *st __attribute__((unused)), int addrlen __attribute__((unused)))
{ {
return; return;
} }
ssize_t ssize_t
rb_ssl_read(rb_fde_t *F, void *buf, size_t count) rb_ssl_read(rb_fde_t *F __attribute__((unused)), void *buf __attribute__((unused)), size_t count __attribute__((unused)))
{ {
errno = ENOSYS; errno = ENOSYS;
return -1; return -1;
} }
ssize_t ssize_t
rb_ssl_write(rb_fde_t *F, const void *buf, size_t count) rb_ssl_write(rb_fde_t *F __attribute__((unused)), const void *buf __attribute__((unused)), size_t count __attribute__((unused)))
{ {
errno = ENOSYS; errno = ENOSYS;
return -1; return -1;
} }
unsigned int unsigned int
rb_ssl_handshake_count(rb_fde_t *F) rb_ssl_handshake_count(rb_fde_t *F __attribute__((unused)))
{ {
return 0; return 0;
} }
void void
rb_ssl_clear_handshake_count(rb_fde_t *F) rb_ssl_clear_handshake_count(rb_fde_t *F __attribute__((unused)))
{ {
return; return;
} }
void void
rb_get_ssl_info(char *buf, size_t len) rb_get_ssl_info(char *buf __attribute__((unused)), size_t len __attribute__((unused)))
{ {
snprintf(buf, len, "Not compiled with SSL support"); snprintf(buf, len, "Not compiled with SSL support");
} }
int int
rb_ssl_get_certfp(rb_fde_t *F, uint8_t certfp[RB_SSL_CERTFP_LEN]) rb_ssl_get_certfp(rb_fde_t *F __attribute__((unused)), uint8_t certfp[RB_SSL_CERTFP_LEN] __attribute__((unused)))
{ {
errno = ENOSYS; errno = ENOSYS;
return -1; return -1;
} }
const char * const char *
rb_ssl_get_cipher(rb_fde_t *F) rb_ssl_get_cipher(rb_fde_t *F __attribute__((unused)))
{ {
errno = ENOSYS; errno = ENOSYS;
return NULL; return NULL;

View file

@ -100,7 +100,7 @@ rb_ssl_init_fd(rb_fde_t *const F, const rb_fd_tls_direction dir)
} }
static void static void
rb_ssl_accept_common(rb_fde_t *const F, void *const data) rb_ssl_accept_common(rb_fde_t *const F, void *const data __attribute__((unused)))
{ {
lrb_assert(F != NULL); lrb_assert(F != NULL);
lrb_assert(F->accept != NULL); lrb_assert(F->accept != NULL);
@ -191,7 +191,7 @@ rb_ssl_strerror(const unsigned long err)
} }
static int static int
verify_accept_all_cb(const int preverify_ok, X509_STORE_CTX *const x509_ctx) verify_accept_all_cb(const int preverify_ok __attribute__((unused)), X509_STORE_CTX *const x509_ctx __attribute__((unused)))
{ {
return 1; return 1;
} }
@ -635,7 +635,7 @@ rb_ssl_connect_realcb(rb_fde_t *const F, const int status, struct ssl_connect *c
} }
static void static void
rb_ssl_timeout_cb(rb_fde_t *const F, void *const data) rb_ssl_timeout_cb(rb_fde_t *const F, void *const data __attribute__((unused)))
{ {
lrb_assert(F->accept != NULL); lrb_assert(F->accept != NULL);
lrb_assert(F->accept->callback != NULL); lrb_assert(F->accept->callback != NULL);

View file

@ -51,7 +51,7 @@ typedef struct _pollfd_list pollfd_list_t;
static pollfd_list_t pollfd_list; static pollfd_list_t pollfd_list;
int int
rb_setup_fd_poll(rb_fde_t *F) rb_setup_fd_poll(rb_fde_t *F __attribute__((unused)))
{ {
return 0; return 0;
} }
@ -238,21 +238,21 @@ rb_init_netio_poll(void)
} }
void void
rb_setselect_poll(rb_fde_t *F, unsigned int type, PF * handler, void *client_data) rb_setselect_poll(rb_fde_t *F __attribute__((unused)), unsigned int type __attribute__((unused)), PF * handler __attribute__((unused)), void *client_data __attribute__((unused)))
{ {
errno = ENOSYS; errno = ENOSYS;
return; return;
} }
int int
rb_select_poll(long delay) rb_select_poll(long delay __attribute__((unused)))
{ {
errno = ENOSYS; errno = ENOSYS;
return -1; return -1;
} }
int int
rb_setup_fd_poll(rb_fde_t *F) rb_setup_fd_poll(rb_fde_t *F __attribute__((unused)))
{ {
errno = ENOSYS; errno = ENOSYS;
return -1; return -1;

View file

@ -242,14 +242,14 @@ rb_ports_init_event(void)
} }
int int
rb_ports_sched_event(struct ev_entry *event, int when) rb_ports_sched_event(struct ev_entry *event __attribute__((unused)), int when __attribute__((unused)))
{ {
errno = ENOSYS; errno = ENOSYS;
return -1; return -1;
} }
void void
rb_ports_unsched_event(struct ev_entry *event) rb_ports_unsched_event(struct ev_entry *event __attribute__((unused)))
{ {
return; return;
} }
@ -261,21 +261,21 @@ rb_init_netio_ports(void)
} }
void void
rb_setselect_ports(rb_fde_t *F, unsigned int type, PF * handler, void *client_data) rb_setselect_ports(rb_fde_t *F __attribute__((unused)), unsigned int type __attribute__((unused)), PF * handler __attribute__((unused)), void *client_data __attribute__((unused)))
{ {
errno = ENOSYS; errno = ENOSYS;
return; return;
} }
int int
rb_select_ports(long delay) rb_select_ports(long delay __attribute__((unused)))
{ {
errno = ENOSYS; errno = ENOSYS;
return -1; return -1;
} }
int int
rb_setup_fd_ports(rb_fde_t *F) rb_setup_fd_ports(rb_fde_t *F __attribute__((unused)))
{ {
errno = ENOSYS; errno = ENOSYS;
return -1; return -1;

View file

@ -120,7 +120,7 @@ select_update_selectfds(rb_fde_t *F, short event, PF * handler)
/* Public functions */ /* Public functions */
int int
rb_setup_fd_select(rb_fde_t *F) rb_setup_fd_select(rb_fde_t *F __attribute__((unused)))
{ {
return 0; return 0;
} }
@ -253,21 +253,21 @@ rb_init_netio_select(void)
} }
void void
rb_setselect_select(rb_fde_t *F, unsigned int type, PF * handler, void *client_data) rb_setselect_select(rb_fde_t *F __attribute__((unused)), unsigned int type __attribute__((unused)), PF * handler __attribute__((unused)), void *client_data __attribute__((unused)))
{ {
errno = ENOSYS; errno = ENOSYS;
return; return;
} }
int int
rb_select_select(long delay) rb_select_select(long delay __attribute__((unused)))
{ {
errno = ENOSYS; errno = ENOSYS;
return -1; return -1;
} }
int int
rb_setup_fd_select(rb_fde_t *F) rb_setup_fd_select(rb_fde_t *F __attribute__((unused)))
{ {
errno = ENOSYS; errno = ENOSYS;
return -1; return -1;

View file

@ -487,14 +487,14 @@ rb_sigio_init_event(void)
} }
int int
rb_sigio_sched_event(struct ev_entry *event, int when) rb_sigio_sched_event(struct ev_entry *event __attribute__((unused)), int when __attribute__((unused)))
{ {
errno = ENOSYS; errno = ENOSYS;
return -1; return -1;
} }
void void
rb_sigio_unsched_event(struct ev_entry *event) rb_sigio_unsched_event(struct ev_entry *event __attribute__((unused)))
{ {
return; return;
} }

View file

@ -623,21 +623,21 @@ rb_init_netio_win32(void)
} }
void void
rb_setselect_win32(rb_fde_t *F, unsigned int type, PF * handler, void *client_data) rb_setselect_win32(rb_fde_t *F __attribute__((unused)), unsigned int type __attribute__((unused)), PF * handler __attribute__((unused)), void *client_data __attribute__((unused)))
{ {
errno = ENOSYS; errno = ENOSYS;
return; return;
} }
int int
rb_select_win32(long delay) rb_select_win32(long delay __attribute__((unused)))
{ {
errno = ENOSYS; errno = ENOSYS;
return -1; return -1;
} }
int int
rb_setup_fd_win32(rb_fde_t *F) rb_setup_fd_win32(rb_fde_t *F __attribute__((unused)))
{ {
errno = ENOSYS; errno = ENOSYS;
return -1; return -1;