test, bench: ANSI-fy function prototypes
Replace `void f()` with `void f(void)`; the former means "a function that takes any number of arguments, including none" while the latter is what is actually intended: a function taking no arguments. The first form also isn't strictly conforming ANSI/ISO C.
This commit is contained in:
parent
fa9c577e55
commit
7ff6f29b85
@ -174,7 +174,7 @@ static void pinger_connect_cb(uv_connect_t* req, int status) {
|
||||
}
|
||||
|
||||
|
||||
static void pinger_new() {
|
||||
static void pinger_new(void) {
|
||||
int r;
|
||||
struct sockaddr_in client_addr = uv_ip4_addr("0.0.0.0", 0);
|
||||
struct sockaddr_in server_addr = uv_ip4_addr("127.0.0.1", TEST_PORT);
|
||||
|
||||
@ -117,7 +117,7 @@ static void show_stats(uv_timer_t* handle, int status) {
|
||||
}
|
||||
|
||||
|
||||
static void read_show_stats() {
|
||||
static void read_show_stats(void) {
|
||||
int64_t diff;
|
||||
|
||||
uv_update_time(loop);
|
||||
@ -149,7 +149,7 @@ void read_sockets_close_cb(uv_handle_t* handle) {
|
||||
}
|
||||
|
||||
|
||||
static void start_stats_collection() {
|
||||
static void start_stats_collection(void) {
|
||||
int r;
|
||||
|
||||
/* Show-stats timer */
|
||||
@ -231,7 +231,7 @@ static void connect_cb(uv_connect_t* req, int status) {
|
||||
}
|
||||
|
||||
|
||||
static void maybe_connect_some() {
|
||||
static void maybe_connect_some(void) {
|
||||
uv_connect_t* req;
|
||||
uv_tcp_t* tcp;
|
||||
uv_pipe_t* pipe;
|
||||
@ -302,7 +302,7 @@ typedef struct req_list_s {
|
||||
static req_list_t* req_freelist = NULL;
|
||||
|
||||
|
||||
static uv_req_t* req_alloc() {
|
||||
static uv_req_t* req_alloc(void) {
|
||||
req_list_t* req;
|
||||
|
||||
req = req_freelist;
|
||||
|
||||
@ -100,7 +100,7 @@ void on_read(uv_stream_t* pipe, ssize_t nread, uv_buf_t buf) {
|
||||
}
|
||||
|
||||
|
||||
static void spawn() {
|
||||
static void spawn(void) {
|
||||
uv_stdio_container_t stdio[2];
|
||||
int r;
|
||||
|
||||
|
||||
@ -313,7 +313,7 @@ void process_cleanup(process_info_t *p) {
|
||||
|
||||
|
||||
/* Move the console cursor one line up and back to the first column. */
|
||||
void rewind_cursor() {
|
||||
void rewind_cursor(void) {
|
||||
fprintf(stderr, "\033[2K\r");
|
||||
}
|
||||
|
||||
|
||||
@ -38,7 +38,7 @@
|
||||
typedef struct {
|
||||
char *task_name;
|
||||
char *process_name;
|
||||
int (*main)();
|
||||
int (*main)(void);
|
||||
int is_helper;
|
||||
int show_output;
|
||||
} task_entry_t, bench_entry_t;
|
||||
@ -55,7 +55,7 @@ typedef struct {
|
||||
};
|
||||
|
||||
#define TEST_DECLARE(name) \
|
||||
int run_test_##name();
|
||||
int run_test_##name(void);
|
||||
|
||||
#define TEST_ENTRY(name) \
|
||||
{ #name, #name, &run_test_##name, 0, 0 },
|
||||
@ -64,13 +64,13 @@ typedef struct {
|
||||
{ #name, #name, &run_test_##name, 0, 1 },
|
||||
|
||||
#define BENCHMARK_DECLARE(name) \
|
||||
int run_benchmark_##name();
|
||||
int run_benchmark_##name(void);
|
||||
|
||||
#define BENCHMARK_ENTRY(name) \
|
||||
{ #name, #name, &run_benchmark_##name, 0, 0 },
|
||||
|
||||
#define HELPER_DECLARE(name) \
|
||||
int run_helper_##name();
|
||||
int run_helper_##name(void);
|
||||
|
||||
#define HELPER_ENTRY(task_name, name) \
|
||||
{ #task_name, #name, &run_helper_##name, 1, 0 },
|
||||
@ -123,7 +123,7 @@ void print_tests(FILE* stream);
|
||||
*/
|
||||
|
||||
/* Do platform-specific initialization. */
|
||||
void platform_init();
|
||||
void platform_init(int argc, char** argv);
|
||||
|
||||
/* Invoke "argv[0] test-name [test-part]". Store process info in *p. */
|
||||
/* Make sure that all stdio output of the processes is buffered up. */
|
||||
@ -154,6 +154,6 @@ int process_reap(process_info_t *p);
|
||||
void process_cleanup(process_info_t *p);
|
||||
|
||||
/* Move the console cursor one line up and back to the first column. */
|
||||
void rewind_cursor();
|
||||
void rewind_cursor(void);
|
||||
|
||||
#endif /* RUNNER_H_ */
|
||||
|
||||
18
test/task.h
18
test/task.h
@ -79,8 +79,6 @@ typedef enum {
|
||||
abort(); \
|
||||
} while (0)
|
||||
|
||||
|
||||
|
||||
/* Have our own assert, so we are sure it does not get optimized away in
|
||||
* a release build.
|
||||
*/
|
||||
@ -103,15 +101,17 @@ typedef enum {
|
||||
uv_loop_delete(uv_default_loop())
|
||||
|
||||
/* Just sugar for wrapping the main() for a task or helper. */
|
||||
#define TEST_IMPL(name) \
|
||||
int run_test_##name()
|
||||
#define TEST_IMPL(name) \
|
||||
int run_test_##name(void); \
|
||||
int run_test_##name(void)
|
||||
|
||||
#define BENCHMARK_IMPL(name) \
|
||||
int run_benchmark_##name()
|
||||
|
||||
#define HELPER_IMPL(name) \
|
||||
int run_helper_##name()
|
||||
#define BENCHMARK_IMPL(name) \
|
||||
int run_benchmark_##name(void); \
|
||||
int run_benchmark_##name(void)
|
||||
|
||||
#define HELPER_IMPL(name) \
|
||||
int run_helper_##name(void); \
|
||||
int run_helper_##name(void)
|
||||
|
||||
/* Pause the calling thread for a number of milliseconds. */
|
||||
void uv_sleep(int msec);
|
||||
|
||||
@ -100,7 +100,7 @@ static void connection_cb(uv_stream_t* tcp, int status) {
|
||||
}
|
||||
|
||||
|
||||
static void start_server() {
|
||||
static void start_server(void) {
|
||||
struct sockaddr_in addr = uv_ip4_addr("0.0.0.0", TEST_PORT);
|
||||
uv_tcp_t* server = (uv_tcp_t*)malloc(sizeof *server);
|
||||
int r;
|
||||
@ -153,7 +153,7 @@ static void connect_cb(uv_connect_t* req, int status) {
|
||||
}
|
||||
|
||||
|
||||
static void client_connect() {
|
||||
static void client_connect(void) {
|
||||
struct sockaddr_in addr = uv_ip4_addr("127.0.0.1", TEST_PORT);
|
||||
uv_tcp_t* client = (uv_tcp_t*)malloc(sizeof *client);
|
||||
uv_connect_t* connect_req = malloc(sizeof *connect_req);
|
||||
|
||||
@ -165,7 +165,7 @@ static void on_connect(uv_connect_t* req, int status) {
|
||||
}
|
||||
|
||||
|
||||
static int tcp_listener() {
|
||||
static int tcp_listener(void) {
|
||||
struct sockaddr_in addr = uv_ip4_addr("0.0.0.0", server_port);
|
||||
struct sockaddr sockname, peername;
|
||||
int namelen;
|
||||
@ -206,7 +206,7 @@ static int tcp_listener() {
|
||||
}
|
||||
|
||||
|
||||
static void tcp_connector() {
|
||||
static void tcp_connector(void) {
|
||||
struct sockaddr_in server_addr = uv_ip4_addr("127.0.0.1", server_port);
|
||||
struct sockaddr sockname;
|
||||
int r, namelen;
|
||||
@ -261,7 +261,7 @@ static void udp_send(uv_udp_send_t* req, int status) {
|
||||
}
|
||||
|
||||
|
||||
static int udp_listener() {
|
||||
static int udp_listener(void) {
|
||||
struct sockaddr_in addr = uv_ip4_addr("0.0.0.0", server_port);
|
||||
struct sockaddr sockname;
|
||||
int namelen;
|
||||
|
||||
@ -108,7 +108,7 @@ static void connect_cb(uv_connect_t* req, int status) {
|
||||
}
|
||||
|
||||
|
||||
static void make_many_connections() {
|
||||
static void make_many_connections(void) {
|
||||
tcp_conn* conn;
|
||||
struct sockaddr_in addr;
|
||||
int r, i;
|
||||
@ -578,7 +578,7 @@ int ipc_helper(int listen_after_write) {
|
||||
}
|
||||
|
||||
|
||||
int ipc_helper_tcp_connection() {
|
||||
int ipc_helper_tcp_connection(void) {
|
||||
/*
|
||||
* This is launched from test-ipc.c. stdin is a duplex channel that we
|
||||
* over which a handle will be transmitted.
|
||||
|
||||
@ -44,7 +44,7 @@ static void connection_cb(uv_stream_t* tcp, int status) {
|
||||
}
|
||||
|
||||
|
||||
static void start_server() {
|
||||
static void start_server(void) {
|
||||
struct sockaddr_in addr = uv_ip4_addr("0.0.0.0", TEST_PORT);
|
||||
int r;
|
||||
|
||||
@ -71,7 +71,7 @@ static void connect_cb(uv_connect_t* req, int status) {
|
||||
}
|
||||
|
||||
|
||||
static void client_connect() {
|
||||
static void client_connect(void) {
|
||||
struct sockaddr_in addr = uv_ip4_addr("127.0.0.1", TEST_PORT);
|
||||
uv_connect_t* connect_req = malloc(sizeof *connect_req);
|
||||
int r;
|
||||
|
||||
@ -145,7 +145,7 @@ static void pinger_on_connect(uv_connect_t *req, int status) {
|
||||
|
||||
|
||||
/* same ping-pong test, but using IPv6 connection */
|
||||
static void tcp_pinger_v6_new() {
|
||||
static void tcp_pinger_v6_new(void) {
|
||||
int r;
|
||||
struct sockaddr_in6 server_addr = uv_ip6_addr("::1", TEST_PORT);
|
||||
pinger_t *pinger;
|
||||
@ -170,7 +170,7 @@ static void tcp_pinger_v6_new() {
|
||||
}
|
||||
|
||||
|
||||
static void tcp_pinger_new() {
|
||||
static void tcp_pinger_new(void) {
|
||||
int r;
|
||||
struct sockaddr_in server_addr = uv_ip4_addr("127.0.0.1", TEST_PORT);
|
||||
pinger_t *pinger;
|
||||
@ -195,7 +195,7 @@ static void tcp_pinger_new() {
|
||||
}
|
||||
|
||||
|
||||
static void pipe_pinger_new() {
|
||||
static void pipe_pinger_new(void) {
|
||||
int r;
|
||||
pinger_t *pinger;
|
||||
|
||||
|
||||
@ -72,7 +72,7 @@ static int valid_writable_wakeups = 0;
|
||||
static int spurious_writable_wakeups = 0;
|
||||
|
||||
|
||||
static int got_eagain() {
|
||||
static int got_eagain(void) {
|
||||
#ifdef _WIN32
|
||||
return WSAGetLastError() == WSAEWOULDBLOCK;
|
||||
#else
|
||||
@ -495,7 +495,7 @@ static void server_poll_cb(uv_poll_t* handle, int status, int events) {
|
||||
}
|
||||
|
||||
|
||||
static void start_server() {
|
||||
static void start_server(void) {
|
||||
uv_os_sock_t sock;
|
||||
server_context_t* context;
|
||||
int r;
|
||||
@ -511,7 +511,7 @@ static void start_server() {
|
||||
}
|
||||
|
||||
|
||||
static void start_client() {
|
||||
static void start_client(void) {
|
||||
uv_os_sock_t sock;
|
||||
connection_context_t* context;
|
||||
struct sockaddr_in server_addr = uv_ip4_addr("127.0.0.1", TEST_PORT);
|
||||
@ -531,7 +531,7 @@ static void start_client() {
|
||||
}
|
||||
|
||||
|
||||
static void start_poll_test() {
|
||||
static void start_poll_test(void) {
|
||||
int i, r;
|
||||
|
||||
#ifdef _WIN32
|
||||
|
||||
@ -58,7 +58,7 @@ static void fail_cb(void) {
|
||||
}
|
||||
|
||||
|
||||
static void fail_cb2() {
|
||||
static void fail_cb2(void) {
|
||||
ASSERT(0 && "fail_cb2 should not have been called");
|
||||
}
|
||||
|
||||
@ -109,7 +109,7 @@ TEST_IMPL(ref) {
|
||||
TEST_IMPL(idle_ref) {
|
||||
uv_idle_t h;
|
||||
uv_idle_init(uv_default_loop(), &h);
|
||||
uv_idle_start(&h, fail_cb2);
|
||||
uv_idle_start(&h, (uv_idle_cb) fail_cb2);
|
||||
uv_unref((uv_handle_t*)&h);
|
||||
uv_run(uv_default_loop());
|
||||
do_close(&h);
|
||||
@ -132,7 +132,7 @@ TEST_IMPL(async_ref) {
|
||||
TEST_IMPL(prepare_ref) {
|
||||
uv_prepare_t h;
|
||||
uv_prepare_init(uv_default_loop(), &h);
|
||||
uv_prepare_start(&h, fail_cb2);
|
||||
uv_prepare_start(&h, (uv_prepare_cb) fail_cb2);
|
||||
uv_unref((uv_handle_t*)&h);
|
||||
uv_run(uv_default_loop());
|
||||
do_close(&h);
|
||||
@ -144,7 +144,7 @@ TEST_IMPL(prepare_ref) {
|
||||
TEST_IMPL(check_ref) {
|
||||
uv_check_t h;
|
||||
uv_check_init(uv_default_loop(), &h);
|
||||
uv_check_start(&h, fail_cb2);
|
||||
uv_check_start(&h, (uv_check_cb) fail_cb2);
|
||||
uv_unref((uv_handle_t*)&h);
|
||||
uv_run(uv_default_loop());
|
||||
do_close(&h);
|
||||
|
||||
@ -182,7 +182,7 @@ static uv_buf_t on_read_alloc(uv_handle_t* handle, size_t suggested_size) {
|
||||
}
|
||||
|
||||
|
||||
int stdio_over_pipes_helper() {
|
||||
int stdio_over_pipes_helper(void) {
|
||||
/* Write several buffers to test that the write order is preserved. */
|
||||
char* buffers[] = {
|
||||
"he",
|
||||
|
||||
Loading…
Reference in New Issue
Block a user