from trunk:

r16733@catbus:  nickm | 2007-11-26 14:18:25 -0500
 Add an --enable-gcc-warnings option (lifted from Tor) to the configure script. When provided, and when we are using GCC, we enable a bunch of extra GCC warnings in the compiler.  Also, make the code all build happily with these warnings.



svn:r601
This commit is contained in:
Niels Provos 2007-12-18 03:50:04 +00:00
parent c7bc1f10cf
commit 3368cc7922
19 changed files with 143 additions and 101 deletions

View File

@ -18,6 +18,7 @@ Changes in current version:
o support for 32-bit tag numbers in rpc structures; this is wire compatible, but changes the API slightly. o support for 32-bit tag numbers in rpc structures; this is wire compatible, but changes the API slightly.
o prefix {encode,decode}_tag functions with evtag to avoid collisions o prefix {encode,decode}_tag functions with evtag to avoid collisions
o Correctly handle DNS replies with no answers set (Fixes bug 1846282) o Correctly handle DNS replies with no answers set (Fixes bug 1846282)
o The configure script now takes an --enable-gcc-warnigns option that turns on many optional gcc warnings. (Nick has been building with these for a while, but they might be useful to other developers.)
Changes in 1.4.0-beta: Changes in 1.4.0-beta:

View File

@ -21,6 +21,9 @@ if test "$GCC" = yes ; then
CFLAGS="$CFLAGS -Wall" CFLAGS="$CFLAGS -Wall"
fi fi
AC_ARG_ENABLE(gcc-warnings,
AS_HELP_STRING(--enable-gcc-warnings, enable verbose warnings with GCC))
AC_PROG_LIBTOOL AC_PROG_LIBTOOL
dnl Uncomment "AC_DISABLE_SHARED" to make shared librraries not get dnl Uncomment "AC_DISABLE_SHARED" to make shared librraries not get
@ -335,4 +338,37 @@ AC_TRY_COMPILE([],
[Define to appropriate substitue if compiler doesnt have __func__]))) [Define to appropriate substitue if compiler doesnt have __func__])))
# Add some more warnings which we use in development but not in the
# released versions. (Some relevant gcc versions can't handle these.)
if test x$enable_gcc_warnings = xyes; then
AC_COMPILE_IFELSE(AC_LANG_PROGRAM([], [
#if !defined(__GNUC__) || (__GNUC__ < 4)
#error
#endif]), have_gcc4=yes, have_gcc4=no)
AC_COMPILE_IFELSE(AC_LANG_PROGRAM([], [
#if !defined(__GNUC__) || (__GNUC__ < 4) || (__GNUC__ == 4 && __GNUC_MINOR__ < 2)
#error
#endif]), have_gcc42=yes, have_gcc42=no)
CFLAGS="$CFLAGS -W -Wfloat-equal -Wundef -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes -Wwrite-strings -Wredundant-decls -Wchar-subscripts -Wcomment -Wformat=2 -Wwrite-strings -Wmissing-declarations -Wredundant-decls -Wnested-externs -Wbad-function-cast -Wswitch-enum -Werror"
CFLAGS="$CFLAGS -Wno-unused-parameter -Wno-sign-compare -Wstrict-aliasing"
if test x$have_gcc4 = xyes ; then
# These warnings break gcc 3.3.5 and work on gcc 4.0.2
CFLAGS="$CFLAGS -Winit-self -Wmissing-field-initializers -Wdeclaration-after-statement"
#CFLAGS="$CFLAGS -Wold-style-definition"
fi
if test x$have_gcc42 = xyes ; then
# These warnings break gcc 4.0.2 and work on gcc 4.2
CFLAGS="$CFLAGS -Waddress -Wnormalized=id -Woverride-init"
fi
##This will break the world on some 64-bit architectures
# CFLAGS="$CFLAGS -Winline"
fi
AC_OUTPUT(Makefile test/Makefile sample/Makefile) AC_OUTPUT(Makefile test/Makefile sample/Makefile)

View File

@ -1086,8 +1086,6 @@ void evtag_marshal_string(struct evbuffer *buf, ev_uint32_t tag,
void evtag_marshal_timeval(struct evbuffer *evbuf, ev_uint32_t tag, void evtag_marshal_timeval(struct evbuffer *evbuf, ev_uint32_t tag,
struct timeval *tv); struct timeval *tv);
void evtag_test(void);
int evtag_unmarshal(struct evbuffer *src, ev_uint32_t *ptag, int evtag_unmarshal(struct evbuffer *src, ev_uint32_t *ptag,
struct evbuffer *dst); struct evbuffer *dst);
int evtag_peek(struct evbuffer *evbuf, ev_uint32_t *ptag); int evtag_peek(struct evbuffer *evbuf, ev_uint32_t *ptag);

View File

@ -65,6 +65,8 @@
#include "log.h" #include "log.h"
int evtag_decode_int(uint32_t *pnumber, struct evbuffer *evbuf); int evtag_decode_int(uint32_t *pnumber, struct evbuffer *evbuf);
int evtag_encode_tag(struct evbuffer *evbuf, uint32_t tag);
int evtag_decode_tag(uint32_t *ptag, struct evbuffer *evbuf);
static struct evbuffer *_buf; /* not thread safe */ static struct evbuffer *_buf; /* not thread safe */

4
http.c
View File

@ -453,9 +453,7 @@ evhttp_make_header(struct evhttp_connection *evcon, struct evhttp_request *req)
} }
evbuffer_add(evcon->output_buffer, "\r\n", 2); evbuffer_add(evcon->output_buffer, "\r\n", 2);
/* XXX EVBUFFER_LENGTH returns an unsigned value, so this test if (EVBUFFER_LENGTH(req->output_buffer) > 0) {
* is always true. What is the intent of this test? -NM */
if (EVBUFFER_LENGTH(req->output_buffer) >= 0) {
/* /*
* For a request, we add the POST data, for a reply, this * For a request, we add the POST data, for a reply, this
* is the regular data. * is the regular data.

3
poll.c
View File

@ -77,7 +77,8 @@ const struct eventop pollops = {
poll_add, poll_add,
poll_del, poll_del,
poll_dispatch, poll_dispatch,
poll_dealloc poll_dealloc,
0
}; };
void * void *

View File

@ -24,7 +24,7 @@
#include <event.h> #include <event.h>
void static void
fifo_read(int fd, short event, void *arg) fifo_read(int fd, short event, void *arg)
{ {
char buf[255]; char buf[255];
@ -86,7 +86,7 @@ main (int argc, char **argv)
#else #else
struct stat st; struct stat st;
char *fifo = "event.fifo"; const char *fifo = "event.fifo";
int socket; int socket;
if (lstat (fifo, &st) == 0) { if (lstat (fifo, &st) == 0) {

View File

@ -28,7 +28,7 @@
int called = 0; int called = 0;
void static void
signal_cb(int fd, short event, void *arg) signal_cb(int fd, short event, void *arg)
{ {
struct event *signal = arg; struct event *signal = arg;

View File

@ -29,7 +29,7 @@
int lasttime; int lasttime;
void static void
timeout_cb(int fd, short event, void *arg) timeout_cb(int fd, short event, void *arg)
{ {
struct timeval tv; struct timeval tv;

View File

@ -82,7 +82,8 @@ const struct eventop selectops = {
select_add, select_add,
select_del, select_del,
select_dispatch, select_dispatch,
select_dealloc select_dealloc,
0
}; };
static int select_resize(struct selectop *sop, int fdsz); static int select_resize(struct selectop *sop, int fdsz);

View File

@ -72,7 +72,6 @@ static void
evsignal_cb(int fd, short what, void *arg) evsignal_cb(int fd, short what, void *arg)
{ {
static char signals[100]; static char signals[100];
struct event *ev = arg;
#ifdef WIN32 #ifdef WIN32
SSIZE_T n; SSIZE_T n;
#else #else

View File

@ -65,7 +65,7 @@ static struct event *events;
void static void
read_cb(int fd, short which, void *arg) read_cb(int fd, short which, void *arg)
{ {
int idx = (int) arg, widx = idx + 1; int idx = (int) arg, widx = idx + 1;
@ -81,7 +81,7 @@ read_cb(int fd, short which, void *arg)
} }
} }
struct timeval * static struct timeval *
run_once(void) run_once(void)
{ {
int *cp, i, space; int *cp, i, space;
@ -128,7 +128,6 @@ main (int argc, char **argv)
int i, c; int i, c;
struct timeval *tv; struct timeval *tv;
int *cp; int *cp;
extern char *optarg;
num_pipes = 100; num_pipes = 100;
num_active = 1; num_active = 1;

View File

@ -86,7 +86,7 @@ static struct event_base *global_base;
#define read(fd,buf,len) recv((fd),(buf),(len),0) #define read(fd,buf,len) recv((fd),(buf),(len),0)
#endif #endif
void static void
simple_read_cb(int fd, short event, void *arg) simple_read_cb(int fd, short event, void *arg)
{ {
char buf[256]; char buf[256];
@ -105,7 +105,7 @@ simple_read_cb(int fd, short event, void *arg)
called++; called++;
} }
void static void
simple_write_cb(int fd, short event, void *arg) simple_write_cb(int fd, short event, void *arg)
{ {
int len; int len;
@ -117,7 +117,7 @@ simple_write_cb(int fd, short event, void *arg)
test_ok = 1; test_ok = 1;
} }
void static void
multiple_write_cb(int fd, short event, void *arg) multiple_write_cb(int fd, short event, void *arg)
{ {
struct event *ev = arg; struct event *ev = arg;
@ -150,7 +150,7 @@ multiple_write_cb(int fd, short event, void *arg)
} }
} }
void static void
multiple_read_cb(int fd, short event, void *arg) multiple_read_cb(int fd, short event, void *arg)
{ {
struct event *ev = arg; struct event *ev = arg;
@ -172,7 +172,7 @@ multiple_read_cb(int fd, short event, void *arg)
} }
} }
void static void
timeout_cb(int fd, short event, void *arg) timeout_cb(int fd, short event, void *arg)
{ {
struct timeval tv; struct timeval tv;
@ -192,12 +192,13 @@ timeout_cb(int fd, short event, void *arg)
test_ok = 1; test_ok = 1;
} }
void signal_cb_sa(int sig) static void
signal_cb_sa(int sig)
{ {
test_ok = 2; test_ok = 2;
} }
void static void
signal_cb(int fd, short event, void *arg) signal_cb(int fd, short event, void *arg)
{ {
struct event *ev = arg; struct event *ev = arg;
@ -211,7 +212,7 @@ struct both {
int nread; int nread;
}; };
void static void
combined_read_cb(int fd, short event, void *arg) combined_read_cb(int fd, short event, void *arg)
{ {
struct both *both = arg; struct both *both = arg;
@ -229,7 +230,7 @@ combined_read_cb(int fd, short event, void *arg)
exit(1); exit(1);
} }
void static void
combined_write_cb(int fd, short event, void *arg) combined_write_cb(int fd, short event, void *arg)
{ {
struct both *both = arg; struct both *both = arg;
@ -255,8 +256,8 @@ combined_write_cb(int fd, short event, void *arg)
/* Test infrastructure */ /* Test infrastructure */
int static int
setup_test(char *name) setup_test(const char *name)
{ {
fprintf(stdout, "%s", name); fprintf(stdout, "%s", name);
@ -279,7 +280,7 @@ setup_test(char *name)
return (0); return (0);
} }
int static int
cleanup_test(void) cleanup_test(void)
{ {
#ifndef WIN32 #ifndef WIN32
@ -299,7 +300,7 @@ cleanup_test(void)
return (0); return (0);
} }
void static void
test_simpleread(void) test_simpleread(void)
{ {
struct event ev; struct event ev;
@ -318,7 +319,7 @@ test_simpleread(void)
cleanup_test(); cleanup_test();
} }
void static void
test_simplewrite(void) test_simplewrite(void)
{ {
struct event ev; struct event ev;
@ -334,7 +335,7 @@ test_simplewrite(void)
cleanup_test(); cleanup_test();
} }
void static void
test_multiple(void) test_multiple(void)
{ {
struct event ev, ev2; struct event ev, ev2;
@ -363,7 +364,7 @@ test_multiple(void)
cleanup_test(); cleanup_test();
} }
void static void
test_persistent(void) test_persistent(void)
{ {
struct event ev, ev2; struct event ev, ev2;
@ -392,7 +393,7 @@ test_persistent(void)
cleanup_test(); cleanup_test();
} }
void static void
test_combined(void) test_combined(void)
{ {
struct both r1, r2, w1, w2; struct both r1, r2, w1, w2;
@ -427,7 +428,7 @@ test_combined(void)
cleanup_test(); cleanup_test();
} }
void static void
test_simpletimeout(void) test_simpletimeout(void)
{ {
struct timeval tv; struct timeval tv;
@ -447,7 +448,8 @@ test_simpletimeout(void)
} }
#ifndef WIN32 #ifndef WIN32
void extern struct event_base *current_base;
static void
test_fork(void) test_fork(void)
{ {
int status; int status;
@ -464,7 +466,6 @@ test_fork(void)
if ((pid = fork()) == 0) { if ((pid = fork()) == 0) {
/* in the child */ /* in the child */
extern struct event_base *current_base;
if (event_reinit(current_base) == -1) { if (event_reinit(current_base) == -1) {
fprintf(stderr, "FAILED (reinit)\n"); fprintf(stderr, "FAILED (reinit)\n");
exit(1); exit(1);
@ -502,7 +503,7 @@ test_fork(void)
cleanup_test(); cleanup_test();
} }
void static void
test_simplesignal(void) test_simplesignal(void)
{ {
struct event ev; struct event ev;
@ -525,7 +526,7 @@ test_simplesignal(void)
cleanup_test(); cleanup_test();
} }
void static void
test_immediatesignal(void) test_immediatesignal(void)
{ {
struct event ev; struct event ev;
@ -540,7 +541,7 @@ test_immediatesignal(void)
cleanup_test(); cleanup_test();
} }
void static void
test_signal_dealloc(void) test_signal_dealloc(void)
{ {
/* make sure that signal_event is event_del'ed and pipe closed */ /* make sure that signal_event is event_del'ed and pipe closed */
@ -556,7 +557,7 @@ test_signal_dealloc(void)
cleanup_test(); cleanup_test();
} }
void static void
test_signal_pipeloss(void) test_signal_pipeloss(void)
{ {
/* make sure that the base1 pipe is closed correctly. */ /* make sure that the base1 pipe is closed correctly. */
@ -584,7 +585,7 @@ test_signal_pipeloss(void)
* for event mechanisms that use our signal pipe trick. kqueue handles * for event mechanisms that use our signal pipe trick. kqueue handles
* signals internally, and all interested kqueues get all the signals. * signals internally, and all interested kqueues get all the signals.
*/ */
void static void
test_signal_switchbase(void) test_signal_switchbase(void)
{ {
struct event ev1, ev2; struct event ev1, ev2;
@ -634,8 +635,8 @@ test_signal_switchbase(void)
* assert that a signal event removed from the event queue really is * assert that a signal event removed from the event queue really is
* removed - with no possibility of it's parent handler being fired. * removed - with no possibility of it's parent handler being fired.
*/ */
void static void
test_signal_assert() test_signal_assert(void)
{ {
struct event ev; struct event ev;
struct event_base *base = event_init(); struct event_base *base = event_init();
@ -665,8 +666,8 @@ test_signal_assert()
/* /*
* assert that we restore our previous signal handler properly. * assert that we restore our previous signal handler properly.
*/ */
void static void
test_signal_restore() test_signal_restore(void)
{ {
struct event ev; struct event ev;
struct event_base *base = event_init(); struct event_base *base = event_init();
@ -701,7 +702,7 @@ out:
} }
#endif #endif
void static void
test_free_active_base(void) test_free_active_base(void)
{ {
struct event_base *base1; struct event_base *base1;
@ -717,7 +718,7 @@ test_free_active_base(void)
cleanup_test(); cleanup_test();
} }
void static void
test_event_base_new(void) test_event_base_new(void)
{ {
struct event_base *base; struct event_base *base;
@ -739,7 +740,7 @@ test_event_base_new(void)
cleanup_test(); cleanup_test();
} }
void static void
test_loopexit(void) test_loopexit(void)
{ {
struct timeval tv, tv_start, tv_end; struct timeval tv, tv_start, tv_end;
@ -782,7 +783,7 @@ fail_cb(int fd, short events, void *arg)
test_ok = 0; test_ok = 0;
} }
void static void
test_loopbreak(void) test_loopbreak(void)
{ {
struct event ev1, ev2; struct event ev1, ev2;
@ -805,7 +806,7 @@ test_loopbreak(void)
cleanup_test(); cleanup_test();
} }
void static void
test_evbuffer(void) { test_evbuffer(void) {
struct evbuffer *evb = evbuffer_new(); struct evbuffer *evb = evbuffer_new();
@ -822,12 +823,12 @@ test_evbuffer(void) {
cleanup_test(); cleanup_test();
} }
void static void
test_evbuffer_find(void) test_evbuffer_find(void)
{ {
u_char* p; u_char* p;
char* test1 = "1234567890\r\n"; const char* test1 = "1234567890\r\n";
char* test2 = "1234567890\r"; const char* test2 = "1234567890\r";
#define EVBUFFER_INITIAL_LENGTH 256 #define EVBUFFER_INITIAL_LENGTH 256
char test3[EVBUFFER_INITIAL_LENGTH]; char test3[EVBUFFER_INITIAL_LENGTH];
unsigned int i; unsigned int i;
@ -877,7 +878,7 @@ test_evbuffer_find(void)
evbuffer_free(buf); evbuffer_free(buf);
} }
void static void
readcb(struct bufferevent *bev, void *arg) readcb(struct bufferevent *bev, void *arg)
{ {
if (EVBUFFER_LENGTH(bev->input) == 8333) { if (EVBUFFER_LENGTH(bev->input) == 8333) {
@ -886,20 +887,20 @@ readcb(struct bufferevent *bev, void *arg)
} }
} }
void static void
writecb(struct bufferevent *bev, void *arg) writecb(struct bufferevent *bev, void *arg)
{ {
if (EVBUFFER_LENGTH(bev->output) == 0) if (EVBUFFER_LENGTH(bev->output) == 0)
test_ok++; test_ok++;
} }
void static void
errorcb(struct bufferevent *bev, short what, void *arg) errorcb(struct bufferevent *bev, short what, void *arg)
{ {
test_ok = -2; test_ok = -2;
} }
void static void
test_bufferevent(void) test_bufferevent(void)
{ {
struct bufferevent *bev1, *bev2; struct bufferevent *bev1, *bev2;
@ -935,7 +936,7 @@ struct test_pri_event {
int count; int count;
}; };
void static void
test_priorities_cb(int fd, short what, void *arg) test_priorities_cb(int fd, short what, void *arg)
{ {
struct test_pri_event *pri = arg; struct test_pri_event *pri = arg;
@ -952,7 +953,7 @@ test_priorities_cb(int fd, short what, void *arg)
event_add(&pri->ev, &tv); event_add(&pri->ev, &tv);
} }
void static void
test_priorities(int npriorities) test_priorities(int npriorities)
{ {
char buf[32]; char buf[32];
@ -1015,7 +1016,7 @@ test_multiple_cb(int fd, short event, void *arg)
test_ok |= 2; test_ok |= 2;
} }
void static void
test_multiple_events_for_same_fd(void) test_multiple_events_for_same_fd(void)
{ {
struct event e1, e2; struct event e1, e2;
@ -1042,7 +1043,7 @@ int evtag_decode_int(uint32_t *pnumber, struct evbuffer *evbuf);
int evtag_encode_tag(struct evbuffer *evbuf, uint32_t number); int evtag_encode_tag(struct evbuffer *evbuf, uint32_t number);
int evtag_decode_tag(uint32_t *pnumber, struct evbuffer *evbuf); int evtag_decode_tag(uint32_t *pnumber, struct evbuffer *evbuf);
void static void
read_once_cb(int fd, short event, void *arg) read_once_cb(int fd, short event, void *arg)
{ {
char buf[256]; char buf[256];
@ -1061,7 +1062,7 @@ read_once_cb(int fd, short event, void *arg)
called++; called++;
} }
void static void
test_want_only_once(void) test_want_only_once(void)
{ {
struct event ev; struct event ev;
@ -1087,7 +1088,7 @@ test_want_only_once(void)
#define TEST_MAX_INT 6 #define TEST_MAX_INT 6
void static void
evtag_int_test(void) evtag_int_test(void)
{ {
struct evbuffer *tmp = evbuffer_new(); struct evbuffer *tmp = evbuffer_new();
@ -1127,7 +1128,7 @@ evtag_int_test(void)
fprintf(stdout, "\t%s: OK\n", __func__); fprintf(stdout, "\t%s: OK\n", __func__);
} }
void static void
evtag_fuzz(void) evtag_fuzz(void)
{ {
u_char buffer[4096]; u_char buffer[4096];
@ -1210,7 +1211,7 @@ evtag_tag_encoding(void)
fprintf(stdout, "\t%s: OK\n", __func__); fprintf(stdout, "\t%s: OK\n", __func__);
} }
void static void
evtag_test(void) evtag_test(void)
{ {
fprintf(stdout, "Testing Tagging:\n"); fprintf(stdout, "Testing Tagging:\n");
@ -1224,7 +1225,7 @@ evtag_test(void)
fprintf(stdout, "OK\n"); fprintf(stdout, "OK\n");
} }
void static void
rpc_test(void) rpc_test(void)
{ {
struct msg *msg, *msg2; struct msg *msg, *msg2;

View File

@ -66,7 +66,9 @@
static int dns_ok = 0; static int dns_ok = 0;
static int dns_err = 0; static int dns_err = 0;
void void dns_suite(void);
static void
dns_gethostbyname_cb(int result, char type, int count, int ttl, dns_gethostbyname_cb(int result, char type, int count, int ttl,
void *addresses, void *arg) void *addresses, void *arg)
{ {
@ -131,7 +133,7 @@ out:
event_loopexit(NULL); event_loopexit(NULL);
} }
void static void
dns_gethostbyname(void) dns_gethostbyname(void)
{ {
fprintf(stdout, "Simple DNS resolve: "); fprintf(stdout, "Simple DNS resolve: ");
@ -147,7 +149,7 @@ dns_gethostbyname(void)
} }
} }
void static void
dns_gethostbyname6(void) dns_gethostbyname6(void)
{ {
fprintf(stdout, "IPv6 DNS resolve: "); fprintf(stdout, "IPv6 DNS resolve: ");
@ -165,7 +167,7 @@ dns_gethostbyname6(void)
} }
} }
void static void
dns_gethostbyaddr(void) dns_gethostbyaddr(void)
{ {
struct in_addr in; struct in_addr in;
@ -230,7 +232,7 @@ dns_server_request_cb(struct evdns_server_request *req, void *data)
} }
} }
void static void
dns_server_gethostbyname_cb(int result, char type, int count, int ttl, dns_server_gethostbyname_cb(int result, char type, int count, int ttl,
void *addresses, void *arg) void *addresses, void *arg)
{ {
@ -290,7 +292,7 @@ dns_server_gethostbyname_cb(int result, char type, int count, int ttl,
} }
} }
void static void
dns_server(void) dns_server(void)
{ {
int sock; int sock;

View File

@ -64,6 +64,8 @@ static struct evhttp *http;
/* set if a test needs to call loopexit on a base */ /* set if a test needs to call loopexit on a base */
static struct event_base *base; static struct event_base *base;
void http_suite(void);
void http_basic_cb(struct evhttp_request *req, void *arg); void http_basic_cb(struct evhttp_request *req, void *arg);
void http_post_cb(struct evhttp_request *req, void *arg); void http_post_cb(struct evhttp_request *req, void *arg);
void http_dispatcher_cb(struct evhttp_request *req, void *arg); void http_dispatcher_cb(struct evhttp_request *req, void *arg);
@ -100,7 +102,7 @@ http_setup(short *pport, struct event_base *base)
#define NI_MAXSERV 1024 #define NI_MAXSERV 1024
#endif #endif
int static int
http_connect(const char *address, u_short port) http_connect(const char *address, u_short port)
{ {
/* Stupid code for connecting */ /* Stupid code for connecting */
@ -150,7 +152,7 @@ http_connect(const char *address, u_short port)
return (fd); return (fd);
} }
void static void
http_readcb(struct bufferevent *bev, void *arg) http_readcb(struct bufferevent *bev, void *arg)
{ {
const char *what = "This is funny"; const char *what = "This is funny";
@ -178,7 +180,7 @@ http_readcb(struct bufferevent *bev, void *arg)
} }
} }
void static void
http_writecb(struct bufferevent *bev, void *arg) http_writecb(struct bufferevent *bev, void *arg)
{ {
if (EVBUFFER_LENGTH(bev->output) == 0) { if (EVBUFFER_LENGTH(bev->output) == 0) {
@ -188,7 +190,7 @@ http_writecb(struct bufferevent *bev, void *arg)
} }
} }
void static void
http_errorcb(struct bufferevent *bev, short what, void *arg) http_errorcb(struct bufferevent *bev, short what, void *arg)
{ {
test_ok = -2; test_ok = -2;
@ -210,12 +212,12 @@ http_basic_cb(struct evhttp_request *req, void *arg)
evbuffer_free(evb); evbuffer_free(evb);
} }
void static void
http_basic_test(void) http_basic_test(void)
{ {
struct bufferevent *bev; struct bufferevent *bev;
int fd; int fd;
char *http_request; const char *http_request;
short port = -1; short port = -1;
test_ok = 0; test_ok = 0;
@ -255,7 +257,7 @@ http_basic_test(void)
void http_request_done(struct evhttp_request *, void *); void http_request_done(struct evhttp_request *, void *);
void http_request_empty_done(struct evhttp_request *, void *); void http_request_empty_done(struct evhttp_request *, void *);
void static void
http_connection_test(int persistent) http_connection_test(int persistent)
{ {
short port = -1; short port = -1;
@ -429,7 +431,7 @@ http_dispatcher_cb(struct evhttp_request *req, void *arg)
evbuffer_free(evb); evbuffer_free(evb);
} }
void static void
http_dispatcher_test_done(struct evhttp_request *req, void *arg) http_dispatcher_test_done(struct evhttp_request *req, void *arg)
{ {
const char *what = "DISPATCHER_TEST"; const char *what = "DISPATCHER_TEST";
@ -459,7 +461,7 @@ http_dispatcher_test_done(struct evhttp_request *req, void *arg)
event_loopexit(NULL); event_loopexit(NULL);
} }
void static void
http_dispatcher_test(void) http_dispatcher_test(void)
{ {
short port = -1; short port = -1;
@ -520,7 +522,7 @@ void http_postrequest_done(struct evhttp_request *, void *);
#define POST_DATA "Okay. Not really printf" #define POST_DATA "Okay. Not really printf"
void static void
http_post_test(void) http_post_test(void)
{ {
short port = -1; short port = -1;
@ -641,7 +643,7 @@ http_postrequest_done(struct evhttp_request *req, void *arg)
event_loopexit(NULL); event_loopexit(NULL);
} }
void static void
http_failure_readcb(struct bufferevent *bev, void *arg) http_failure_readcb(struct bufferevent *bev, void *arg)
{ {
const char *what = "400 Bad Request"; const char *what = "400 Bad Request";
@ -655,12 +657,12 @@ http_failure_readcb(struct bufferevent *bev, void *arg)
/* /*
* Testing that the HTTP server can deal with a malformed request. * Testing that the HTTP server can deal with a malformed request.
*/ */
void static void
http_failure_test(void) http_failure_test(void)
{ {
struct bufferevent *bev; struct bufferevent *bev;
int fd; int fd;
char *http_request; const char *http_request;
short port = -1; short port = -1;
test_ok = 0; test_ok = 0;
@ -744,7 +746,7 @@ close_detect_cb(struct evhttp_request *req, void *arg)
} }
void static void
http_close_detection(void) http_close_detection(void)
{ {
short port = -1; short port = -1;
@ -794,7 +796,7 @@ http_close_detection(void)
fprintf(stdout, "OK\n"); fprintf(stdout, "OK\n");
} }
void static void
http_highport_test(void) http_highport_test(void)
{ {
int i = -1; int i = -1;
@ -816,7 +818,7 @@ http_highport_test(void)
exit(1); exit(1);
} }
void static void
http_bad_header_test(void) http_bad_header_test(void)
{ {
struct evkeyvalq headers; struct evkeyvalq headers;
@ -849,12 +851,12 @@ fail:
exit(1); exit(1);
} }
void static void
http_base_test(void) http_base_test(void)
{ {
struct bufferevent *bev; struct bufferevent *bev;
int fd; int fd;
char *http_request; const char *http_request;
short port = -1; short port = -1;
test_ok = 0; test_ok = 0;

View File

@ -60,6 +60,8 @@
#include "regress.gen.h" #include "regress.gen.h"
void rpc_suite(void);
extern int test_ok; extern int test_ok;
static struct evhttp * static struct evhttp *
@ -94,7 +96,7 @@ EVRPC_GENERATE(NeverReply, msg, kill);
static int need_input_hook = 0; static int need_input_hook = 0;
static int need_output_hook = 0; static int need_output_hook = 0;
void static void
MessageCb(EVRPC_STRUCT(Message)* rpc, void *arg) MessageCb(EVRPC_STRUCT(Message)* rpc, void *arg)
{ {
struct kill* kill_reply = rpc->reply; struct kill* kill_reply = rpc->reply;
@ -116,7 +118,7 @@ MessageCb(EVRPC_STRUCT(Message)* rpc, void *arg)
static EVRPC_STRUCT(NeverReply) *saved_rpc; static EVRPC_STRUCT(NeverReply) *saved_rpc;
void static void
NeverReplyCb(EVRPC_STRUCT(NeverReply)* rpc, void *arg) NeverReplyCb(EVRPC_STRUCT(NeverReply)* rpc, void *arg)
{ {
test_ok += 1; test_ok += 1;
@ -448,14 +450,14 @@ rpc_basic_client(void)
need_input_hook = 1; need_input_hook = 1;
need_output_hook = 1; need_output_hook = 1;
assert(evrpc_add_hook(base, INPUT, rpc_hook_add_header, "input") assert(evrpc_add_hook(base, INPUT, rpc_hook_add_header, (void*)"input")
!= NULL); != NULL);
assert(evrpc_add_hook(base, OUTPUT, rpc_hook_add_header, "output") assert(evrpc_add_hook(base, OUTPUT, rpc_hook_add_header, (void*)"output")
!= NULL); != NULL);
pool = rpc_pool_with_connection(port); pool = rpc_pool_with_connection(port);
assert(evrpc_add_hook(pool, INPUT, rpc_hook_remove_header, "output")); assert(evrpc_add_hook(pool, INPUT, rpc_hook_remove_header, (void*)"output"));
/* set up the basic message */ /* set up the basic message */
msg = msg_new(); msg = msg_new();

View File

@ -29,7 +29,7 @@
int test_okay = 1; int test_okay = 1;
int called = 0; int called = 0;
void static void
read_cb(int fd, short event, void *arg) read_cb(int fd, short event, void *arg)
{ {
char buf[256]; char buf[256];
@ -57,7 +57,7 @@ int
main (int argc, char **argv) main (int argc, char **argv)
{ {
struct event ev; struct event ev;
char *test = "test string"; const char *test = "test string";
int pair[2]; int pair[2];
if (evutil_socketpair(AF_UNIX, SOCK_STREAM, 0, pair) == -1) if (evutil_socketpair(AF_UNIX, SOCK_STREAM, 0, pair) == -1)

View File

@ -25,7 +25,7 @@ int called = 0;
struct event *ev[NEVENT]; struct event *ev[NEVENT];
int static int
rand_int(int n) rand_int(int n)
{ {
#ifdef WIN32 #ifdef WIN32
@ -35,7 +35,7 @@ rand_int(int n)
#endif #endif
} }
void static void
time_cb(int fd, short event, void *arg) time_cb(int fd, short event, void *arg)
{ {
struct timeval tv; struct timeval tv;

View File

@ -31,10 +31,10 @@ int pair[2];
int test_okay = 1; int test_okay = 1;
int called = 0; int called = 0;
void static void
write_cb(int fd, short event, void *arg) write_cb(int fd, short event, void *arg)
{ {
char *test = "test string"; const char *test = "test string";
int len; int len;
len = write(fd, test, strlen(test) + 1); len = write(fd, test, strlen(test) + 1);