From: Eric Blake Date: Thu, 29 Oct 2009 15:15:06 +0000 (-0600) Subject: tests: avoid some compiler warnings X-Git-Tag: v0.1~5277 X-Git-Url: http://erislabs.net/gitweb/?a=commitdiff_plain;h=b886ebac9e37729d68e765b141b099ec5b24ab2c;p=gnulib.git tests: avoid some compiler warnings Mostly Simon's modules; warnings reported by gcc 4.3.4 on coreutils. * tests/test-getaddrinfo.c (simple): Mark static, and allow string literals. * tests/test-memchr.c (main): Avoid type mismatch. * tests/test-arpa_inet.c (main): Avoid unused parameters. * tests/test-base64.c (main): Likewise. * tests/test-getdelim.c (main): Likewise. * tests/test-gethostname.c (main): Likewise. * tests/test-getline.c (main): Likewise. * tests/test-netinet_in.c (main): Likewise. * tests/test-select.c (open_server_socket, main): Likewise. * tests/test-select-stdin.c (main): Likewise. * tests/test-sockets.c (main): Likewise. * tests/test-strsignal.c (main): Likewise. * tests/test-sys_select.c (main): Likewise. * tests/test-sys_socket.c (main): Likewise. * tests/test-u64.c (main): Likewise. * tests/test-xfprintf-posix.c (main): Likewise. * tests/test-xvasprintf.c (test_xvasprintf, main): Likewise. Signed-off-by: Eric Blake --- diff --git a/ChangeLog b/ChangeLog index 899616fa7..bda6fbbf3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,25 @@ 2009-10-29 Eric Blake + tests: avoid some compiler warnings + * tests/test-getaddrinfo.c (simple): Mark static, and allow string + literals. + * tests/test-memchr.c (main): Avoid type mismatch. + * tests/test-arpa_inet.c (main): Avoid unused parameters. + * tests/test-base64.c (main): Likewise. + * tests/test-getdelim.c (main): Likewise. + * tests/test-gethostname.c (main): Likewise. + * tests/test-getline.c (main): Likewise. + * tests/test-netinet_in.c (main): Likewise. + * tests/test-select.c (open_server_socket, main): Likewise. + * tests/test-select-stdin.c (main): Likewise. + * tests/test-sockets.c (main): Likewise. + * tests/test-strsignal.c (main): Likewise. + * tests/test-sys_select.c (main): Likewise. + * tests/test-sys_socket.c (main): Likewise. + * tests/test-u64.c (main): Likewise. + * tests/test-xfprintf-posix.c (main): Likewise. + * tests/test-xvasprintf.c (test_xvasprintf, main): Likewise. + sockets: avoid compiler warning * lib/sockets.c (gl_sockets_startup): Mark unused parameter. diff --git a/tests/test-arpa_inet.c b/tests/test-arpa_inet.c index fc2d8ba44..1e2479f4f 100644 --- a/tests/test-arpa_inet.c +++ b/tests/test-arpa_inet.c @@ -1,5 +1,5 @@ /* Test of substitute. - Copyright (C) 2007 Free Software Foundation, Inc. + Copyright (C) 2007, 2009 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -21,7 +21,7 @@ #include int -main () +main (void) { return 0; } diff --git a/tests/test-base64.c b/tests/test-base64.c index f707a9e6b..7440e8cd1 100644 --- a/tests/test-base64.c +++ b/tests/test-base64.c @@ -1,5 +1,5 @@ /* Self tests for base64. - Copyright (C) 2004, 2008 Free Software Foundation, Inc. + Copyright (C) 2004, 2008, 2009 Free Software Foundation, Inc. Written by Simon Josefsson. This program is free software: you can redistribute it and/or modify @@ -25,7 +25,7 @@ #include "base64.h" int -main (int argc, char *argv[]) +main (void) { const char *in = "abcdefghijklmnop"; const char *b64in = "YWJjZGVmZw=="; diff --git a/tests/test-getaddrinfo.c b/tests/test-getaddrinfo.c index eeea3f7c4..384b98b6e 100644 --- a/tests/test-getaddrinfo.c +++ b/tests/test-getaddrinfo.c @@ -44,7 +44,8 @@ # define EAI_SERVICE 0 #endif -int simple (char *host, char *service) +static int +simple (char const *host, char const *service) { char buf[BUFSIZ]; static int skip = 0; diff --git a/tests/test-getdelim.c b/tests/test-getdelim.c index 0c112f6bd..da4fe6b31 100644 --- a/tests/test-getdelim.c +++ b/tests/test-getdelim.c @@ -1,5 +1,5 @@ /* Test of getdelim() function. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2009 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -36,7 +36,7 @@ while (0) int -main (int argc, char **argv) +main (void) { FILE *f; char *line = NULL; diff --git a/tests/test-gethostname.c b/tests/test-gethostname.c index 3ab0b86af..32723da19 100644 --- a/tests/test-gethostname.c +++ b/tests/test-gethostname.c @@ -29,7 +29,7 @@ #define NOHOSTNAME "magic-gnulib-test-string" int -main (int argc, char *argv[]) +main (int argc, char *argv[] _UNUSED_PARAMETER_) { char buf[HOST_NAME_MAX]; int rc; diff --git a/tests/test-getline.c b/tests/test-getline.c index 51fc81686..50722cd48 100644 --- a/tests/test-getline.c +++ b/tests/test-getline.c @@ -1,5 +1,5 @@ /* Test of getline() function. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2009 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -36,7 +36,7 @@ while (0) int -main (int argc, char **argv) +main (void) { FILE *f; char *line = NULL; diff --git a/tests/test-memchr.c b/tests/test-memchr.c index a8cfc9b22..d5e53e008 100644 --- a/tests/test-memchr.c +++ b/tests/test-memchr.c @@ -109,7 +109,7 @@ main (void) ASSERT (MEMCHR (mem, 'U', n) == NULL); { - int i; + size_t i; for (i = 0; i < n; i++) { diff --git a/tests/test-netinet_in.c b/tests/test-netinet_in.c index b1957197b..5a61557c9 100644 --- a/tests/test-netinet_in.c +++ b/tests/test-netinet_in.c @@ -1,5 +1,5 @@ /* Test of substitute. - Copyright (C) 2007 Free Software Foundation, Inc. + Copyright (C) 2007, 2009 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -21,7 +21,7 @@ #include int -main () +main (void) { return 0; } diff --git a/tests/test-select-stdin.c b/tests/test-select-stdin.c index e855f92d2..079dec50e 100644 --- a/tests/test-select-stdin.c +++ b/tests/test-select-stdin.c @@ -1,5 +1,5 @@ /* Test of select() substitute, reading from stdin. - Copyright (C) 2008 Free Software Foundation, Inc. + Copyright (C) 2008, 2009 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -25,7 +25,7 @@ #include int -main () +main (void) { printf ("Applying select() from standard input. Press Ctrl-C to abort.\n"); for (;;) diff --git a/tests/test-select.c b/tests/test-select.c index ec8225014..d6d6b063a 100644 --- a/tests/test-select.c +++ b/tests/test-select.c @@ -84,7 +84,7 @@ test (void (*fn) (void), const char *msg) /* Funny socket code. */ static int -open_server_socket () +open_server_socket (void) { int s, x; struct sockaddr_in ia; @@ -355,7 +355,7 @@ test_pipe (void) /* Do them all. */ int -main () +main (void) { int result; diff --git a/tests/test-sockets.c b/tests/test-sockets.c index 3c85a431c..2d259649c 100644 --- a/tests/test-sockets.c +++ b/tests/test-sockets.c @@ -22,7 +22,7 @@ #include "sockets.h" int -main (int argc, char *argv[]) +main (void) { int err; diff --git a/tests/test-strsignal.c b/tests/test-strsignal.c index 8868346e6..a4be4b7a7 100644 --- a/tests/test-strsignal.c +++ b/tests/test-strsignal.c @@ -1,5 +1,5 @@ /* Test of strsignal() function. - Copyright (C) 2008 Free Software Foundation, Inc. + Copyright (C) 2008, 2009 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -44,7 +44,7 @@ #endif int -main (int argc, char **argv) +main (void) { /* Work around bug in cygwin 1.5.25 by declaring str as const char *, even though strsignal is supposed to return char *. diff --git a/tests/test-sys_select.c b/tests/test-sys_select.c index 66079529e..aef894107 100644 --- a/tests/test-sys_select.c +++ b/tests/test-sys_select.c @@ -24,7 +24,7 @@ struct timeval t1; int -main () +main (void) { /* Check that FD_ZERO can be used. This should not yield a warning such as "warning: implicit declaration of function 'memset'". */ diff --git a/tests/test-sys_socket.c b/tests/test-sys_socket.c index 3d946a83b..ddb491b31 100644 --- a/tests/test-sys_socket.c +++ b/tests/test-sys_socket.c @@ -28,7 +28,7 @@ int a[] = { SHUT_RD, SHUT_WR, SHUT_RDWR }; #endif int -main () +main (void) { struct sockaddr_storage x; sa_family_t i; diff --git a/tests/test-u64.c b/tests/test-u64.c index 85e72478a..aa0b5d1a3 100644 --- a/tests/test-u64.c +++ b/tests/test-u64.c @@ -21,7 +21,7 @@ #include int -main () +main (void) { u64 i = u64init (42, 4711); u64 j, k, l; diff --git a/tests/test-xfprintf-posix.c b/tests/test-xfprintf-posix.c index adfa1fd05..b001f0426 100644 --- a/tests/test-xfprintf-posix.c +++ b/tests/test-xfprintf-posix.c @@ -1,5 +1,5 @@ /* Test of error-checking xfprintf() function with POSIX compatible formatting. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2009 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -44,7 +44,7 @@ #include "test-fprintf-posix.h" int -main (int argc, char *argv[]) +main (int argc _UNUSED_PARAMETER_, char *argv[]) { set_program_name (argv[0]); diff --git a/tests/test-xvasprintf.c b/tests/test-xvasprintf.c index 234ec8373..37603142f 100644 --- a/tests/test-xvasprintf.c +++ b/tests/test-xvasprintf.c @@ -1,5 +1,5 @@ /* Test of xvasprintf() and xasprintf() functions. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2009 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -52,7 +52,7 @@ my_xasprintf (const char *format, ...) } static void -test_xvasprintf () +test_xvasprintf (void) { int repeat; @@ -80,7 +80,7 @@ test_xasprintf () } int -main (int argc, char *argv[]) +main (int argc _UNUSED_PARAMETER_, char *argv[]) { set_program_name (argv[0]);