tests: avoid some compiler warnings
authorEric Blake <ebb9@byu.net>
Thu, 29 Oct 2009 15:15:06 +0000 (09:15 -0600)
committerEric Blake <ebb9@byu.net>
Fri, 30 Oct 2009 00:39:29 +0000 (18:39 -0600)
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>
18 files changed:
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

index 899616f..bda6fbb 100644 (file)
--- 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.
 
index fc2d8ba..1e2479f 100644 (file)
@@ -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;
 }
index f707a9e..7440e8c 100644 (file)
@@ -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==";
index eeea3f7..384b98b 100644 (file)
@@ -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;
index 0c112f6..da4fe6b 100644 (file)
@@ -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;
index 3ab0b86..32723da 100644 (file)
@@ -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;
index 51fc816..50722cd 100644 (file)
@@ -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;
index a8cfc9b..d5e53e0 100644 (file)
@@ -109,7 +109,7 @@ main (void)
            ASSERT (MEMCHR (mem, 'U', n) == NULL);
 
            {
-             int i;
+             size_t i;
 
              for (i = 0; i < n; i++)
                {
index b195719..5a61557 100644 (file)
@@ -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;
 }
index e855f92..079dec5 100644 (file)
@@ -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 (;;)
index ec82250..d6d6b06 100644 (file)
@@ -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;
 
index 3c85a43..2d25964 100644 (file)
@@ -22,7 +22,7 @@
 #include "sockets.h"
 
 int
-main (int argc, char *argv[])
+main (void)
 {
   int err;
 
index 8868346..a4be4b7 100644 (file)
@@ -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 *.
index 6607952..aef8941 100644 (file)
@@ -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'".  */
index 3d946a8..ddb491b 100644 (file)
@@ -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;
index 85e7247..aa0b5d1 100644 (file)
@@ -21,7 +21,7 @@
 #include <u64.h>
 
 int
-main ()
+main (void)
 {
   u64 i = u64init (42, 4711);
   u64 j, k, l;
index adfa1fd..b001f04 100644 (file)
@@ -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]);
 
index 234ec83..3760314 100644 (file)
@@ -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]);