changeset 12210:441d8820b5a5

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 <ebb9@byu.net>
author Eric Blake <ebb9@byu.net>
date Thu, 29 Oct 2009 09:15:06 -0600
parents 31e5813d01e1
children 76cbe8b29dce
files ChangeLog tests/test-arpa_inet.c tests/test-base64.c tests/test-getaddrinfo.c tests/test-getdelim.c tests/test-gethostname.c tests/test-getline.c tests/test-memchr.c tests/test-netinet_in.c tests/test-select-stdin.c tests/test-select.c tests/test-sockets.c tests/test-strsignal.c tests/test-sys_select.c tests/test-sys_socket.c tests/test-u64.c tests/test-xfprintf-posix.c tests/test-xvasprintf.c
diffstat 18 files changed, 49 insertions(+), 28 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,25 @@
 2009-10-29  Eric Blake  <ebb9@byu.net>
 
+	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.
 
--- a/tests/test-arpa_inet.c
+++ b/tests/test-arpa_inet.c
@@ -1,5 +1,5 @@
 /* Test of <arpa/inet.h> 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 <arpa/inet.h>
 
 int
-main ()
+main (void)
 {
   return 0;
 }
--- 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==";
--- 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;
--- 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;
--- 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;
--- 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;
--- a/tests/test-memchr.c
+++ b/tests/test-memchr.c
@@ -109,7 +109,7 @@
 	    ASSERT (MEMCHR (mem, 'U', n) == NULL);
 
 	    {
-	      int i;
+	      size_t i;
 
 	      for (i = 0; i < n; i++)
 		{
--- a/tests/test-netinet_in.c
+++ b/tests/test-netinet_in.c
@@ -1,5 +1,5 @@
 /* Test of <netinet/in.h> 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 <netinet/in.h>
 
 int
-main ()
+main (void)
 {
   return 0;
 }
--- 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 <unistd.h>
 
 int
-main ()
+main (void)
 {
   printf ("Applying select() from standard input. Press Ctrl-C to abort.\n");
   for (;;)
--- a/tests/test-select.c
+++ b/tests/test-select.c
@@ -84,7 +84,7 @@
 /* Funny socket code.  */
 
 static int
-open_server_socket ()
+open_server_socket (void)
 {
   int s, x;
   struct sockaddr_in ia;
@@ -355,7 +355,7 @@
 /* Do them all.  */
 
 int
-main ()
+main (void)
 {
   int result;
 
--- 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;
 
--- 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 <string.h> by declaring str as
      const char *, even though strsignal is supposed to return char *.
--- 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'".  */
--- a/tests/test-sys_socket.c
+++ b/tests/test-sys_socket.c
@@ -28,7 +28,7 @@
 #endif
 
 int
-main ()
+main (void)
 {
   struct sockaddr_storage x;
   sa_family_t i;
--- a/tests/test-u64.c
+++ b/tests/test-u64.c
@@ -21,7 +21,7 @@
 #include <u64.h>
 
 int
-main ()
+main (void)
 {
   u64 i = u64init (42, 4711);
   u64 j, k, l;
--- 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]);
 
--- 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 @@
 }
 
 static void
-test_xvasprintf ()
+test_xvasprintf (void)
 {
   int repeat;
 
@@ -80,7 +80,7 @@
 }
 
 int
-main (int argc, char *argv[])
+main (int argc _UNUSED_PARAMETER_, char *argv[])
 {
   set_program_name (argv[0]);