From 3368cc792249b59ea8cb555c5d23ee4900f3f466 Mon Sep 17 00:00:00 2001 From: Niels Provos Date: Tue, 18 Dec 2007 03:50:04 +0000 Subject: [PATCH] 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 --- ChangeLog | 3 +- configure.in | 36 +++++++++++++++ event.h | 2 - event_tagging.c | 2 + http.c | 4 +- poll.c | 3 +- sample/event-test.c | 4 +- sample/signal-test.c | 2 +- sample/time-test.c | 2 +- select.c | 3 +- signal.c | 1 - test/bench.c | 5 +-- test/regress.c | 101 ++++++++++++++++++++++--------------------- test/regress_dns.c | 14 +++--- test/regress_http.c | 38 ++++++++-------- test/regress_rpc.c | 12 ++--- test/test-eof.c | 4 +- test/test-time.c | 4 +- test/test-weof.c | 4 +- 19 files changed, 143 insertions(+), 101 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4b17fd89..a8618189 100644 --- a/ChangeLog +++ b/ChangeLog @@ -18,7 +18,8 @@ Changes in current version: 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 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: o allow \r or \n individually to separate HTTP headers instead of the standard "\r\n"; from Charles Kerr. diff --git a/configure.in b/configure.in index 80578d21..c5e721f0 100644 --- a/configure.in +++ b/configure.in @@ -21,6 +21,9 @@ if test "$GCC" = yes ; then CFLAGS="$CFLAGS -Wall" fi +AC_ARG_ENABLE(gcc-warnings, + AS_HELP_STRING(--enable-gcc-warnings, enable verbose warnings with GCC)) + AC_PROG_LIBTOOL 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__]))) +# 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) diff --git a/event.h b/event.h index 1d5f17f8..c5b16ad3 100644 --- a/event.h +++ b/event.h @@ -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, struct timeval *tv); -void evtag_test(void); - int evtag_unmarshal(struct evbuffer *src, ev_uint32_t *ptag, struct evbuffer *dst); int evtag_peek(struct evbuffer *evbuf, ev_uint32_t *ptag); diff --git a/event_tagging.c b/event_tagging.c index fc185640..a89bc544 100644 --- a/event_tagging.c +++ b/event_tagging.c @@ -65,6 +65,8 @@ #include "log.h" 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 */ diff --git a/http.c b/http.c index a52c6575..ac45925d 100644 --- a/http.c +++ b/http.c @@ -453,9 +453,7 @@ evhttp_make_header(struct evhttp_connection *evcon, struct evhttp_request *req) } evbuffer_add(evcon->output_buffer, "\r\n", 2); - /* XXX EVBUFFER_LENGTH returns an unsigned value, so this test - * is always true. What is the intent of this test? -NM */ - if (EVBUFFER_LENGTH(req->output_buffer) >= 0) { + if (EVBUFFER_LENGTH(req->output_buffer) > 0) { /* * For a request, we add the POST data, for a reply, this * is the regular data. diff --git a/poll.c b/poll.c index 15b2a7b9..7da804cd 100644 --- a/poll.c +++ b/poll.c @@ -77,7 +77,8 @@ const struct eventop pollops = { poll_add, poll_del, poll_dispatch, - poll_dealloc + poll_dealloc, + 0 }; void * diff --git a/sample/event-test.c b/sample/event-test.c index db3ba31e..2c6cb938 100644 --- a/sample/event-test.c +++ b/sample/event-test.c @@ -24,7 +24,7 @@ #include -void +static void fifo_read(int fd, short event, void *arg) { char buf[255]; @@ -86,7 +86,7 @@ main (int argc, char **argv) #else struct stat st; - char *fifo = "event.fifo"; + const char *fifo = "event.fifo"; int socket; if (lstat (fifo, &st) == 0) { diff --git a/sample/signal-test.c b/sample/signal-test.c index 98650ca1..d04c00e4 100644 --- a/sample/signal-test.c +++ b/sample/signal-test.c @@ -28,7 +28,7 @@ int called = 0; -void +static void signal_cb(int fd, short event, void *arg) { struct event *signal = arg; diff --git a/sample/time-test.c b/sample/time-test.c index aba4f623..069d4f8f 100644 --- a/sample/time-test.c +++ b/sample/time-test.c @@ -29,7 +29,7 @@ int lasttime; -void +static void timeout_cb(int fd, short event, void *arg) { struct timeval tv; diff --git a/select.c b/select.c index 1e37ac09..4b8503e6 100644 --- a/select.c +++ b/select.c @@ -82,7 +82,8 @@ const struct eventop selectops = { select_add, select_del, select_dispatch, - select_dealloc + select_dealloc, + 0 }; static int select_resize(struct selectop *sop, int fdsz); diff --git a/signal.c b/signal.c index 42c336d6..682bd1c6 100644 --- a/signal.c +++ b/signal.c @@ -72,7 +72,6 @@ static void evsignal_cb(int fd, short what, void *arg) { static char signals[100]; - struct event *ev = arg; #ifdef WIN32 SSIZE_T n; #else diff --git a/test/bench.c b/test/bench.c index 28c31beb..48fd32a9 100644 --- a/test/bench.c +++ b/test/bench.c @@ -65,7 +65,7 @@ static struct event *events; -void +static void read_cb(int fd, short which, void *arg) { 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) { int *cp, i, space; @@ -128,7 +128,6 @@ main (int argc, char **argv) int i, c; struct timeval *tv; int *cp; - extern char *optarg; num_pipes = 100; num_active = 1; diff --git a/test/regress.c b/test/regress.c index e4f8ea8c..a6e48260 100644 --- a/test/regress.c +++ b/test/regress.c @@ -86,7 +86,7 @@ static struct event_base *global_base; #define read(fd,buf,len) recv((fd),(buf),(len),0) #endif -void +static void simple_read_cb(int fd, short event, void *arg) { char buf[256]; @@ -105,7 +105,7 @@ simple_read_cb(int fd, short event, void *arg) called++; } -void +static void simple_write_cb(int fd, short event, void *arg) { int len; @@ -117,7 +117,7 @@ simple_write_cb(int fd, short event, void *arg) test_ok = 1; } -void +static void multiple_write_cb(int fd, short event, void *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) { 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) { struct timeval tv; @@ -192,12 +192,13 @@ timeout_cb(int fd, short event, void *arg) test_ok = 1; } -void signal_cb_sa(int sig) +static void +signal_cb_sa(int sig) { test_ok = 2; } -void +static void signal_cb(int fd, short event, void *arg) { struct event *ev = arg; @@ -211,7 +212,7 @@ struct both { int nread; }; -void +static void combined_read_cb(int fd, short event, void *arg) { struct both *both = arg; @@ -229,7 +230,7 @@ combined_read_cb(int fd, short event, void *arg) exit(1); } -void +static void combined_write_cb(int fd, short event, void *arg) { struct both *both = arg; @@ -255,8 +256,8 @@ combined_write_cb(int fd, short event, void *arg) /* Test infrastructure */ -int -setup_test(char *name) +static int +setup_test(const char *name) { fprintf(stdout, "%s", name); @@ -279,7 +280,7 @@ setup_test(char *name) return (0); } -int +static int cleanup_test(void) { #ifndef WIN32 @@ -299,7 +300,7 @@ cleanup_test(void) return (0); } -void +static void test_simpleread(void) { struct event ev; @@ -318,7 +319,7 @@ test_simpleread(void) cleanup_test(); } -void +static void test_simplewrite(void) { struct event ev; @@ -334,7 +335,7 @@ test_simplewrite(void) cleanup_test(); } -void +static void test_multiple(void) { struct event ev, ev2; @@ -363,7 +364,7 @@ test_multiple(void) cleanup_test(); } -void +static void test_persistent(void) { struct event ev, ev2; @@ -392,7 +393,7 @@ test_persistent(void) cleanup_test(); } -void +static void test_combined(void) { struct both r1, r2, w1, w2; @@ -427,7 +428,7 @@ test_combined(void) cleanup_test(); } -void +static void test_simpletimeout(void) { struct timeval tv; @@ -447,7 +448,8 @@ test_simpletimeout(void) } #ifndef WIN32 -void +extern struct event_base *current_base; +static void test_fork(void) { int status; @@ -464,7 +466,6 @@ test_fork(void) if ((pid = fork()) == 0) { /* in the child */ - extern struct event_base *current_base; if (event_reinit(current_base) == -1) { fprintf(stderr, "FAILED (reinit)\n"); exit(1); @@ -502,7 +503,7 @@ test_fork(void) cleanup_test(); } -void +static void test_simplesignal(void) { struct event ev; @@ -525,7 +526,7 @@ test_simplesignal(void) cleanup_test(); } -void +static void test_immediatesignal(void) { struct event ev; @@ -540,7 +541,7 @@ test_immediatesignal(void) cleanup_test(); } -void +static void test_signal_dealloc(void) { /* make sure that signal_event is event_del'ed and pipe closed */ @@ -556,7 +557,7 @@ test_signal_dealloc(void) cleanup_test(); } -void +static void test_signal_pipeloss(void) { /* 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 * signals internally, and all interested kqueues get all the signals. */ -void +static void test_signal_switchbase(void) { struct event ev1, ev2; @@ -634,8 +635,8 @@ test_signal_switchbase(void) * assert that a signal event removed from the event queue really is * removed - with no possibility of it's parent handler being fired. */ -void -test_signal_assert() +static void +test_signal_assert(void) { struct event ev; struct event_base *base = event_init(); @@ -665,8 +666,8 @@ test_signal_assert() /* * assert that we restore our previous signal handler properly. */ -void -test_signal_restore() +static void +test_signal_restore(void) { struct event ev; struct event_base *base = event_init(); @@ -701,7 +702,7 @@ out: } #endif -void +static void test_free_active_base(void) { struct event_base *base1; @@ -717,7 +718,7 @@ test_free_active_base(void) cleanup_test(); } -void +static void test_event_base_new(void) { struct event_base *base; @@ -739,7 +740,7 @@ test_event_base_new(void) cleanup_test(); } -void +static void test_loopexit(void) { struct timeval tv, tv_start, tv_end; @@ -782,7 +783,7 @@ fail_cb(int fd, short events, void *arg) test_ok = 0; } -void +static void test_loopbreak(void) { struct event ev1, ev2; @@ -805,7 +806,7 @@ test_loopbreak(void) cleanup_test(); } -void +static void test_evbuffer(void) { struct evbuffer *evb = evbuffer_new(); @@ -822,12 +823,12 @@ test_evbuffer(void) { cleanup_test(); } -void +static void test_evbuffer_find(void) { u_char* p; - char* test1 = "1234567890\r\n"; - char* test2 = "1234567890\r"; + const char* test1 = "1234567890\r\n"; + const char* test2 = "1234567890\r"; #define EVBUFFER_INITIAL_LENGTH 256 char test3[EVBUFFER_INITIAL_LENGTH]; unsigned int i; @@ -877,7 +878,7 @@ test_evbuffer_find(void) evbuffer_free(buf); } -void +static void readcb(struct bufferevent *bev, void *arg) { 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) { if (EVBUFFER_LENGTH(bev->output) == 0) test_ok++; } -void +static void errorcb(struct bufferevent *bev, short what, void *arg) { test_ok = -2; } -void +static void test_bufferevent(void) { struct bufferevent *bev1, *bev2; @@ -935,7 +936,7 @@ struct test_pri_event { int count; }; -void +static void test_priorities_cb(int fd, short what, void *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); } -void +static void test_priorities(int npriorities) { char buf[32]; @@ -1015,7 +1016,7 @@ test_multiple_cb(int fd, short event, void *arg) test_ok |= 2; } -void +static void test_multiple_events_for_same_fd(void) { 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_decode_tag(uint32_t *pnumber, struct evbuffer *evbuf); -void +static void read_once_cb(int fd, short event, void *arg) { char buf[256]; @@ -1061,7 +1062,7 @@ read_once_cb(int fd, short event, void *arg) called++; } -void +static void test_want_only_once(void) { struct event ev; @@ -1087,7 +1088,7 @@ test_want_only_once(void) #define TEST_MAX_INT 6 -void +static void evtag_int_test(void) { struct evbuffer *tmp = evbuffer_new(); @@ -1127,7 +1128,7 @@ evtag_int_test(void) fprintf(stdout, "\t%s: OK\n", __func__); } -void +static void evtag_fuzz(void) { u_char buffer[4096]; @@ -1210,7 +1211,7 @@ evtag_tag_encoding(void) fprintf(stdout, "\t%s: OK\n", __func__); } -void +static void evtag_test(void) { fprintf(stdout, "Testing Tagging:\n"); @@ -1224,7 +1225,7 @@ evtag_test(void) fprintf(stdout, "OK\n"); } -void +static void rpc_test(void) { struct msg *msg, *msg2; diff --git a/test/regress_dns.c b/test/regress_dns.c index 0161de0e..8191192c 100644 --- a/test/regress_dns.c +++ b/test/regress_dns.c @@ -66,7 +66,9 @@ static int dns_ok = 0; static int dns_err = 0; -void +void dns_suite(void); + +static void dns_gethostbyname_cb(int result, char type, int count, int ttl, void *addresses, void *arg) { @@ -131,7 +133,7 @@ out: event_loopexit(NULL); } -void +static void dns_gethostbyname(void) { fprintf(stdout, "Simple DNS resolve: "); @@ -147,7 +149,7 @@ dns_gethostbyname(void) } } -void +static void dns_gethostbyname6(void) { fprintf(stdout, "IPv6 DNS resolve: "); @@ -165,7 +167,7 @@ dns_gethostbyname6(void) } } -void +static void dns_gethostbyaddr(void) { 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, 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) { int sock; diff --git a/test/regress_http.c b/test/regress_http.c index 654b405d..05c7da0d 100644 --- a/test/regress_http.c +++ b/test/regress_http.c @@ -64,6 +64,8 @@ static struct evhttp *http; /* set if a test needs to call loopexit on a base */ static struct event_base *base; +void http_suite(void); + void http_basic_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); @@ -100,7 +102,7 @@ http_setup(short *pport, struct event_base *base) #define NI_MAXSERV 1024 #endif -int +static int http_connect(const char *address, u_short port) { /* Stupid code for connecting */ @@ -150,7 +152,7 @@ http_connect(const char *address, u_short port) return (fd); } -void +static void http_readcb(struct bufferevent *bev, void *arg) { 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) { 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) { test_ok = -2; @@ -210,12 +212,12 @@ http_basic_cb(struct evhttp_request *req, void *arg) evbuffer_free(evb); } -void +static void http_basic_test(void) { struct bufferevent *bev; int fd; - char *http_request; + const char *http_request; short port = -1; test_ok = 0; @@ -255,7 +257,7 @@ http_basic_test(void) void http_request_done(struct evhttp_request *, void *); void http_request_empty_done(struct evhttp_request *, void *); -void +static void http_connection_test(int persistent) { short port = -1; @@ -429,7 +431,7 @@ http_dispatcher_cb(struct evhttp_request *req, void *arg) evbuffer_free(evb); } -void +static void http_dispatcher_test_done(struct evhttp_request *req, void *arg) { const char *what = "DISPATCHER_TEST"; @@ -459,7 +461,7 @@ http_dispatcher_test_done(struct evhttp_request *req, void *arg) event_loopexit(NULL); } -void +static void http_dispatcher_test(void) { short port = -1; @@ -520,7 +522,7 @@ void http_postrequest_done(struct evhttp_request *, void *); #define POST_DATA "Okay. Not really printf" -void +static void http_post_test(void) { short port = -1; @@ -641,7 +643,7 @@ http_postrequest_done(struct evhttp_request *req, void *arg) event_loopexit(NULL); } -void +static void http_failure_readcb(struct bufferevent *bev, void *arg) { 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. */ -void +static void http_failure_test(void) { struct bufferevent *bev; int fd; - char *http_request; + const char *http_request; short port = -1; test_ok = 0; @@ -744,7 +746,7 @@ close_detect_cb(struct evhttp_request *req, void *arg) } -void +static void http_close_detection(void) { short port = -1; @@ -794,7 +796,7 @@ http_close_detection(void) fprintf(stdout, "OK\n"); } -void +static void http_highport_test(void) { int i = -1; @@ -816,7 +818,7 @@ http_highport_test(void) exit(1); } -void +static void http_bad_header_test(void) { struct evkeyvalq headers; @@ -849,12 +851,12 @@ fail: exit(1); } -void +static void http_base_test(void) { struct bufferevent *bev; int fd; - char *http_request; + const char *http_request; short port = -1; test_ok = 0; diff --git a/test/regress_rpc.c b/test/regress_rpc.c index 3fa11f79..9fc1d50b 100644 --- a/test/regress_rpc.c +++ b/test/regress_rpc.c @@ -60,6 +60,8 @@ #include "regress.gen.h" +void rpc_suite(void); + extern int test_ok; static struct evhttp * @@ -94,7 +96,7 @@ EVRPC_GENERATE(NeverReply, msg, kill); static int need_input_hook = 0; static int need_output_hook = 0; -void +static void MessageCb(EVRPC_STRUCT(Message)* rpc, void *arg) { struct kill* kill_reply = rpc->reply; @@ -116,7 +118,7 @@ MessageCb(EVRPC_STRUCT(Message)* rpc, void *arg) static EVRPC_STRUCT(NeverReply) *saved_rpc; -void +static void NeverReplyCb(EVRPC_STRUCT(NeverReply)* rpc, void *arg) { test_ok += 1; @@ -448,14 +450,14 @@ rpc_basic_client(void) need_input_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); - assert(evrpc_add_hook(base, OUTPUT, rpc_hook_add_header, "output") + assert(evrpc_add_hook(base, OUTPUT, rpc_hook_add_header, (void*)"output") != NULL); 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 */ msg = msg_new(); diff --git a/test/test-eof.c b/test/test-eof.c index 2dd4c894..4fc1a19f 100644 --- a/test/test-eof.c +++ b/test/test-eof.c @@ -29,7 +29,7 @@ int test_okay = 1; int called = 0; -void +static void read_cb(int fd, short event, void *arg) { char buf[256]; @@ -57,7 +57,7 @@ int main (int argc, char **argv) { struct event ev; - char *test = "test string"; + const char *test = "test string"; int pair[2]; if (evutil_socketpair(AF_UNIX, SOCK_STREAM, 0, pair) == -1) diff --git a/test/test-time.c b/test/test-time.c index 901b39a4..a847d55e 100644 --- a/test/test-time.c +++ b/test/test-time.c @@ -25,7 +25,7 @@ int called = 0; struct event *ev[NEVENT]; -int +static int rand_int(int n) { #ifdef WIN32 @@ -35,7 +35,7 @@ rand_int(int n) #endif } -void +static void time_cb(int fd, short event, void *arg) { struct timeval tv; diff --git a/test/test-weof.c b/test/test-weof.c index db2894ca..5d87ceb8 100644 --- a/test/test-weof.c +++ b/test/test-weof.c @@ -31,10 +31,10 @@ int pair[2]; int test_okay = 1; int called = 0; -void +static void write_cb(int fd, short event, void *arg) { - char *test = "test string"; + const char *test = "test string"; int len; len = write(fd, test, strlen(test) + 1);