tests: avoid several compiler warnings
authorEric Blake <ebb9@byu.net>
Thu, 22 Oct 2009 13:59:46 +0000 (07:59 -0600)
committerEric Blake <ebb9@byu.net>
Fri, 23 Oct 2009 03:09:28 +0000 (21:09 -0600)
* tests/test-getcwd.c (main): Avoid buffer underflow.
* tests/test-getdate.c (main): String literals are not safe with
putenv, so use setenv.  Declare unused argument.
* modules/getdate-tests (Depends-on): Add setenv.
* tests/test-argv-iter.c (main): Declare unused argument.  Avoid
problems with string literals in char *.
* tests/test-hash.c (main): Avoid shadowing declaration.
(insert_new): Treat string literals as char const *.
* tests/test-getopt.h (test_getopt): Likewise.
(getopt_loop): Alter types to minimize casting elsewhere.
* tests/test-getopt_long.h (test_getopt_long, getopt_long_loop)
(test_getopt_long_posix): Likewise.
(do_getopt_long): Add wrapper to minimize casting.
* tests/test-atexit.c (clear_temp_file): Use void.
* tests/test-areadlink-with-size.c (main): Declare unused
arguments.
* tests/test-areadlink.c (main): Likewise.
* tests/test-areadlinkat-with-size.c (main): Likewise.
* tests/test-areadlinkat.c (main): Likewise.
* tests/test-canonicalize-lgpl.c (main): Likewise.
* tests/test-canonicalize.c (main): Likewise.
* tests/test-dirent-safer.c (main): Likewise.
* tests/test-dirname.c (main): Likewise.
* tests/test-dup2.c (main): Likewise.
* tests/test-fchdir.c (main): Likewise.
* tests/test-fcntl-h.c (main): Likewise.
* tests/test-fcntl-safer.c (main): Likewise.
* tests/test-fdopendir.c (main): Likewise.
* tests/test-fdutimensat.c (main): Likewise.
* tests/test-fflush.c (main): Likewise.
* tests/test-filenamecat.c (main): Likewise.
* tests/test-filevercmp.c (main): Likewise.
* tests/test-fopen-safer.c (main): Likewise.
* tests/test-fopen.c (main): Likewise.
* tests/test-fpending.c (main): Likewise.
* tests/test-fpurge.c (main): Likewise.
* tests/test-freading.c (main): Likewise.
* tests/test-fstatat.c (main): Likewise.
* tests/test-fsync.c (main): Likewise.
* tests/test-futimens.c (main): Likewise.
* tests/test-getndelim2.c (main): Likewise.
* tests/test-gettimeofday.c (main): Likewise.
* tests/test-getopt.c (main): Likewise.
* tests/test-i-ring.c (main): Likewise.
* tests/test-inttypes.c (main): Likewise.
* tests/test-link.c (main): Likewise.
* tests/test-lstat.c (main): Likewise.
* tests/test-math.c (main): Likewise.
* tests/test-md5.c (main): Likewise.
* tests/test-memchr2.c (main): Likewise.
* tests/test-memrchr.c (main): Likewise.
* tests/test-mkdir.c (main): Likewise.
* tests/test-mkdirat.c (main): Likewise.
* tests/test-mkfifoat.c (main): Likewise.
* tests/test-open.c (main): Likewise.
* tests/test-openat-safer.c (main): Likewise.
* tests/test-openat.c (main): Likewise.
* tests/test-quotearg.c (main): Likewise.
* tests/test-rawmemchr.c (main): Likewise.
* tests/test-readlink.c (main): Likewise.
* tests/test-remove.c (main): Likewise.
* tests/test-rename.c (main): Likewise.
* tests/test-renameat.c (main): Likewise.
* tests/test-rmdir.c (main): Likewise.
* tests/test-sha1.c (main): Likewise.
* tests/test-signal.c (main): Likewise.
* tests/test-sigaction.c (main): Likewise.
* tests/test-stat.c (main): Likewise.
* tests/test-stat-time.c (main): Likewise.
* tests/test-stddef.c (main): Likewise.
* tests/test-stdint.c (main): Likewise.
* tests/test-stdio.c (main): Likewise.
* tests/test-stdlib.c (main): Likewise.
* tests/test-strchrnul.c (main): Likewise.
* tests/test-strerror.c (main): Likewise.
* tests/test-string.c (main): Likewise.
* tests/test-strtod.c (main): Likewise.
* tests/test-strverscmp.c (main): Likewise.
* tests/test-symlink.c (main): Likewise.
* tests/test-symlinkat.c (main): Likewise.
* tests/test-sys_stat.c (main): Likewise.
* tests/test-sys_time.c (main): Likewise.
* tests/test-time.c (main): Likewise.
* tests/test-unistd.c (main): Likewise.
* tests/test-unlink.c (main): Likewise.
* tests/test-unlinkat.c (main): Likewise.
* tests/test-utimens.c (main): Likewise.
* tests/test-utimensat.c (main): Likewise.
* tests/test-version-etc.c (main): Likewise.
* tests/test-wchar.c (main): Likewise.
* tests/test-wctype.c (main): Likewise.
* tests/test-xprintf-posix.c (main): Likewise.
* tests/test-posixtm.c (main): Likewise.
(STREQ): Delete unused macro.
* tests/test-linkat.c (main): Declare unused arguments.  Avoid
shadowed variables.
* tests/test-memchr.c (main): Likewise.

Signed-off-by: Eric Blake <ebb9@byu.net>
89 files changed:
ChangeLog
modules/getdate-tests
tests/test-areadlink-with-size.c
tests/test-areadlink.c
tests/test-areadlinkat-with-size.c
tests/test-areadlinkat.c
tests/test-argv-iter.c
tests/test-atexit.c
tests/test-canonicalize-lgpl.c
tests/test-canonicalize.c
tests/test-dirent-safer.c
tests/test-dirname.c
tests/test-dup2.c
tests/test-fchdir.c
tests/test-fcntl-h.c
tests/test-fcntl-safer.c
tests/test-fdopendir.c
tests/test-fdutimensat.c
tests/test-fflush.c
tests/test-filenamecat.c
tests/test-filevercmp.c
tests/test-fopen-safer.c
tests/test-fopen.c
tests/test-fpending.c
tests/test-fpurge.c
tests/test-freading.c
tests/test-fstatat.c
tests/test-fsync.c
tests/test-futimens.c
tests/test-getcwd.c
tests/test-getdate.c
tests/test-getndelim2.c
tests/test-getopt.c
tests/test-getopt.h
tests/test-getopt_long.h
tests/test-gettimeofday.c
tests/test-hash.c
tests/test-i-ring.c
tests/test-inttypes.c
tests/test-link.c
tests/test-linkat.c
tests/test-lstat.c
tests/test-math.c
tests/test-md5.c
tests/test-memchr.c
tests/test-memchr2.c
tests/test-memrchr.c
tests/test-mkdir.c
tests/test-mkdirat.c
tests/test-mkfifoat.c
tests/test-open.c
tests/test-openat-safer.c
tests/test-openat.c
tests/test-posixtm.c
tests/test-quotearg.c
tests/test-rawmemchr.c
tests/test-readlink.c
tests/test-remove.c
tests/test-rename.c
tests/test-renameat.c
tests/test-rmdir.c
tests/test-sha1.c
tests/test-sigaction.c
tests/test-signal.c
tests/test-stat-time.c
tests/test-stat.c
tests/test-stddef.c
tests/test-stdint.c
tests/test-stdio.c
tests/test-stdlib.c
tests/test-strchrnul.c
tests/test-strerror.c
tests/test-string.c
tests/test-strtod.c
tests/test-strverscmp.c
tests/test-symlink.c
tests/test-symlinkat.c
tests/test-sys_stat.c
tests/test-sys_time.c
tests/test-time.c
tests/test-unistd.c
tests/test-unlink.c
tests/test-unlinkat.c
tests/test-utimens.c
tests/test-utimensat.c
tests/test-version-etc.c
tests/test-wchar.c
tests/test-wctype.c
tests/test-xprintf-posix.c

index c08b84415c72bc4fa90ab9abc23c152fc54205cf..03519a60da5b1a85c1e6b7fd0e2b32380c858408 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,104 @@
+2009-10-22  Eric Blake  <ebb9@byu.net>
+
+       tests: avoid several compiler warnings
+       * tests/test-getcwd.c (main): Avoid buffer underflow.
+       * tests/test-getdate.c (main): String literals are not safe with
+       putenv, so use setenv.  Declare unused argument.
+       * modules/getdate-tests (Depends-on): Add setenv.
+       * tests/test-argv-iter.c (main): Declare unused argument.  Avoid
+       problems with string literals in char *.
+       * tests/test-hash.c (main): Avoid shadowing declaration.
+       (insert_new): Treat string literals as char const *.
+       * tests/test-getopt.h (test_getopt): Likewise.
+       (getopt_loop): Alter types to minimize casting elsewhere.
+       * tests/test-getopt_long.h (test_getopt_long, getopt_long_loop)
+       (test_getopt_long_posix): Likewise.
+       (do_getopt_long): Add wrapper to minimize casting.
+       * tests/test-atexit.c (clear_temp_file): Use void.
+       * tests/test-areadlink-with-size.c (main): Declare unused
+       arguments.
+       * tests/test-areadlink.c (main): Likewise.
+       * tests/test-areadlinkat-with-size.c (main): Likewise.
+       * tests/test-areadlinkat.c (main): Likewise.
+       * tests/test-canonicalize-lgpl.c (main): Likewise.
+       * tests/test-canonicalize.c (main): Likewise.
+       * tests/test-dirent-safer.c (main): Likewise.
+       * tests/test-dirname.c (main): Likewise.
+       * tests/test-dup2.c (main): Likewise.
+       * tests/test-fchdir.c (main): Likewise.
+       * tests/test-fcntl-h.c (main): Likewise.
+       * tests/test-fcntl-safer.c (main): Likewise.
+       * tests/test-fdopendir.c (main): Likewise.
+       * tests/test-fdutimensat.c (main): Likewise.
+       * tests/test-fflush.c (main): Likewise.
+       * tests/test-filenamecat.c (main): Likewise.
+       * tests/test-filevercmp.c (main): Likewise.
+       * tests/test-fopen-safer.c (main): Likewise.
+       * tests/test-fopen.c (main): Likewise.
+       * tests/test-fpending.c (main): Likewise.
+       * tests/test-fpurge.c (main): Likewise.
+       * tests/test-freading.c (main): Likewise.
+       * tests/test-fstatat.c (main): Likewise.
+       * tests/test-fsync.c (main): Likewise.
+       * tests/test-futimens.c (main): Likewise.
+       * tests/test-getndelim2.c (main): Likewise.
+       * tests/test-gettimeofday.c (main): Likewise.
+       * tests/test-getopt.c (main): Likewise.
+       * tests/test-i-ring.c (main): Likewise.
+       * tests/test-inttypes.c (main): Likewise.
+       * tests/test-link.c (main): Likewise.
+       * tests/test-lstat.c (main): Likewise.
+       * tests/test-math.c (main): Likewise.
+       * tests/test-md5.c (main): Likewise.
+       * tests/test-memchr2.c (main): Likewise.
+       * tests/test-memrchr.c (main): Likewise.
+       * tests/test-mkdir.c (main): Likewise.
+       * tests/test-mkdirat.c (main): Likewise.
+       * tests/test-mkfifoat.c (main): Likewise.
+       * tests/test-open.c (main): Likewise.
+       * tests/test-openat-safer.c (main): Likewise.
+       * tests/test-openat.c (main): Likewise.
+       * tests/test-quotearg.c (main): Likewise.
+       * tests/test-rawmemchr.c (main): Likewise.
+       * tests/test-readlink.c (main): Likewise.
+       * tests/test-remove.c (main): Likewise.
+       * tests/test-rename.c (main): Likewise.
+       * tests/test-renameat.c (main): Likewise.
+       * tests/test-rmdir.c (main): Likewise.
+       * tests/test-sha1.c (main): Likewise.
+       * tests/test-signal.c (main): Likewise.
+       * tests/test-sigaction.c (main): Likewise.
+       * tests/test-stat.c (main): Likewise.
+       * tests/test-stat-time.c (main): Likewise.
+       * tests/test-stddef.c (main): Likewise.
+       * tests/test-stdint.c (main): Likewise.
+       * tests/test-stdio.c (main): Likewise.
+       * tests/test-stdlib.c (main): Likewise.
+       * tests/test-strchrnul.c (main): Likewise.
+       * tests/test-strerror.c (main): Likewise.
+       * tests/test-string.c (main): Likewise.
+       * tests/test-strtod.c (main): Likewise.
+       * tests/test-strverscmp.c (main): Likewise.
+       * tests/test-symlink.c (main): Likewise.
+       * tests/test-symlinkat.c (main): Likewise.
+       * tests/test-sys_stat.c (main): Likewise.
+       * tests/test-sys_time.c (main): Likewise.
+       * tests/test-time.c (main): Likewise.
+       * tests/test-unistd.c (main): Likewise.
+       * tests/test-unlink.c (main): Likewise.
+       * tests/test-unlinkat.c (main): Likewise.
+       * tests/test-utimens.c (main): Likewise.
+       * tests/test-utimensat.c (main): Likewise.
+       * tests/test-version-etc.c (main): Likewise.
+       * tests/test-wchar.c (main): Likewise.
+       * tests/test-wctype.c (main): Likewise.
+       * tests/test-xprintf-posix.c (main): Likewise.
+       * tests/test-posixtm.c (main): Likewise.
+       (STREQ): Delete unused macro.
+       * tests/test-linkat.c (main): Declare unused arguments.  Avoid
+       shadowed variables.
+       * tests/test-memchr.c (main): Likewise.
+
 2009-10-21  Eric Blake  <ebb9@byu.net>
 
        areadlinkat: avoid failure on older glibc
index afacd0964129f462ef7f3838c7bc7460df1337d3..6b7c92ba498b8192e99871e4f9b629fc114dbd5c 100644 (file)
@@ -3,6 +3,7 @@ tests/test-getdate.c
 
 Depends-on:
 progname
+setenv
 
 configure.ac:
 
index 2a175a5b1489a8aa5778e7b64493d1e982156be1..ff50f89d686d104c8dea69addc12b948d0b790ad 100644 (file)
@@ -46,7 +46,7 @@
 #include "test-areadlink.h"
 
 int
-main ()
+main (void)
 {
   /* Remove any leftovers from a previous partial run.  */
   ASSERT (system ("rm -rf " BASE "*") == 0);
index 657ea6f3c16cfcc4e9bab6c6ab5cb5fc2ca4a4c0..aa297cedc4dff5a90b4cfd563f887652ee918271 100644 (file)
@@ -53,7 +53,7 @@ do_areadlink (char const *name, size_t ignored _UNUSED_PARAMETER_)
 }
 
 int
-main ()
+main (void)
 {
   /* Remove any leftovers from a previous partial run.  */
   ASSERT (system ("rm -rf " BASE "*") == 0);
index df4afc25894e0573d65c234dbebc110fcca4c674..55ab78e6e90f26ee82711a176626e9118cf511eb 100644 (file)
@@ -55,7 +55,7 @@ do_areadlinkat_with_size (char const *name, size_t size)
 }
 
 int
-main ()
+main (void)
 {
   int result;
 
index 5f8d4b08506f08881b4e3bfa3f1b07f320f4f5dc..e567b3718757cabb7a17492e8d5784ecdace4395 100644 (file)
@@ -55,7 +55,7 @@ do_areadlinkat (char const *name, size_t ignored _UNUSED_PARAMETER_)
 }
 
 int
-main ()
+main (void)
 {
   int result;
 
index 507075409966bb39404cf99f298aed8417bc2510..eef30148e33fabac18f2825cdfd36f2db68d778a 100644 (file)
@@ -54,14 +54,17 @@ write_nul_delimited_argv (char **argv)
 }
 
 int
-main ()
+main (void)
 {
   /* set_program_name (argv[0]); placate overzealous "syntax-check" test.  */
+  static char one[] = "1";
+  static char two[] = "2";
+  static char three[] = "3";
   static char *av[][4] = {
     {NULL},
-    {"1", NULL},
-    {"1", "2", NULL},
-    {"1", "2", "3", NULL}
+    {one, NULL},
+    {one, two, NULL},
+    {one, two, three, NULL}
   };
 
   int use_stream;
index 883b05651e3bd3335204b724cbd099f349b78ea0..97afff5f8b5f80d8ba64ba9e87c19a4c4d40de23 100644 (file)
@@ -24,7 +24,7 @@
 #define TEMPFILE "t-atexit.tmp"
 
 static void
-clear_temp_file ()
+clear_temp_file (void)
 {
   unlink (TEMPFILE);
 }
index cb09790018509ba98e806f3d6c0aa8c97863dc96..ef6bd9d1bbddd3c5931ea3222ad30a67c4ad718f 100644 (file)
@@ -44,7 +44,7 @@
 #define BASE "t-can-lgpl.tmp"
 
 int
-main ()
+main (void)
 {
 #ifdef GNULIB_CANONICALIZE
   /* No need to test canonicalize-lgpl module if canonicalize is also
index 7de6059e06f44d6a357ee388ff1dca1e01753ea8..eeae9e0d99aaaf4c81792617f83af83da2dfaed5 100644 (file)
@@ -45,7 +45,7 @@
 #define BASE "t-can.tmp"
 
 int
-main ()
+main (void)
 {
   /* Setup some hierarchy to be used by this test.  Start by removing
      any leftovers from a previous partial run.  */
index aeb8342d9ecba8e547f0268e5ae09fd88b0853bf..8d5d529282734075ec8345706d640fb1609834a3 100644 (file)
@@ -48,7 +48,7 @@ static FILE *myerr;
   while (0)
 
 int
-main ()
+main (void)
 {
   int i;
   DIR *dp;
index 44898dd9850ecda98d6299e57dd60336eba53b03..bd7502015170252561a9203d13d4fa4d8b3e143b 100644 (file)
@@ -1,5 +1,5 @@
 /* Test the gnulib dirname module.
-   Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc.
+   Copyright (C) 2005, 2006, 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
@@ -131,7 +131,7 @@ static struct test tests[] = {
 };
 
 int
-main ()
+main (void)
 {
   struct test *t;
   bool ok = true;
index e1ffc21768975ec27f791a0e2e7e1bfff497889d..32c354d0b0ae1cce2e3d460e8bc6c0ca9f80c6e1 100644 (file)
@@ -61,7 +61,7 @@ is_open (int fd)
 }
 
 int
-main ()
+main (void)
 {
   const char *file = "test-dup2.tmp";
   char buffer[1];
index b361d0d61693e733b05c646820b05871f429d964..53d6631ccd4af694117a139a1e7860e59422b4ff 100644 (file)
@@ -39,7 +39,7 @@
   while (0)
 
 int
-main ()
+main (void)
 {
   char *cwd = getcwd (NULL, 0);
   int fd = open (".", O_RDONLY);
index 649c44ad4bf635f4fb1f31bcab2f99e5c09ff8ca..a1f086676e0f87b1d2388a297b1883aae549607b 100644 (file)
@@ -32,7 +32,7 @@ int sk[] = { SEEK_CUR, SEEK_END, SEEK_SET };
 int fd = FD_CLOEXEC;
 
 int
-main ()
+main (void)
 {
   return 0;
 }
index 433160bf66d8522a0d909f192aaf9de292e973b8..33c7c2cd8a7726d1bb11cc2c6ba3346c0fb1ae8f 100644 (file)
@@ -25,7 +25,7 @@
 #include "test-open.h"
 
 int
-main ()
+main (void)
 {
   return test_open ();
 }
index 330544c5d6a6ae505196e793c6be5893305a5d12..fad60cfa72ed51966df64496d8a92bd14403df92 100644 (file)
@@ -39,7 +39,7 @@
   while (0)
 
 int
-main ()
+main (void)
 {
   DIR *d;
   int fd;
index b5c60aed9adb3e79375bc71c58657fd285e8c8b7..00729d8e68dad4a1c6732ad450309542a61b5e14 100644 (file)
@@ -86,7 +86,7 @@ do_utimens (const char *name, struct timespec const times[2])
 }
 
 int
-main ()
+main (void)
 {
   int result1; /* Skip because of no symlink support.  */
   int result2; /* Skip because of no futimens support.  */
index 6f369f021ae1bb83e4289cf778a07adcd9b2d6fb..3a17f8d475abddac769f852f77bd2202c7a8cf02 100644 (file)
@@ -1,5 +1,5 @@
 /* Test of POSIX compatible fflush() function.
-   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
@@ -22,7 +22,7 @@
 #include <unistd.h>
 
 int
-main (int argc, char *argv[])
+main (void)
 {
   FILE *f;
   char buffer[10];
index d102ef627fd2402a06f9ba9e22216a1e0fe3635d..44a7bd587cd06b371ee85c7a9096905e9abc1e22 100644 (file)
@@ -29,7 +29,7 @@
 #include "progname.h"
 
 int
-main (int argc, char *argv[])
+main (int argc _UNUSED_PARAMETER_, char *argv[])
 {
   static char const *const tests[][3] =
     {
index ca88eb3caf365429a3143aaa28010b0c78c965d2..14426a6a73d9fc825046c9a0422b7ab9c1f66c87 100644 (file)
@@ -97,7 +97,7 @@ static const char *const examples[] =
 };
 
 int
-main (int argc, char **argv)
+main (void)
 {
   const char *const *i;
 
index e6133649d7a4080fda045d23b8ca7263fada2664..088489a7a97f9f1a339e7dfa84bb71a85177f0d4 100644 (file)
@@ -25,7 +25,7 @@
 #include "test-fopen.h"
 
 int
-main ()
+main (void)
 {
   return test_fopen ();
 }
index 6efd48064328bcb0284b49566c1897bc7e0d647a..29d783946323ae410a4b6b4f5e4b778f9f2845ec 100644 (file)
@@ -25,7 +25,7 @@
 #include "test-fopen.h"
 
 int
-main ()
+main (void)
 {
   return test_fopen ();
 }
index 8d9e5ae9128224b9908b693b842bbf3b3f911936..6c053dc84edfb69e811d009ff642e09eaeaea515 100644 (file)
@@ -1,6 +1,6 @@
 /* Ensure that __fpending works.
 
-   Copyright (C) 2004, 2007-2008 Free Software Foundation, Inc.
+   Copyright (C) 2004, 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
@@ -37,7 +37,7 @@
   while (0)
 
 int
-main ()
+main (void)
 {
   ASSERT (__fpending (stdout) == 0);
 
index 13388ec391dce53b995cc4abc96b426ca2702220..319a04042691fe8bb073934b51fbe59bfe132165 100644 (file)
@@ -38,7 +38,7 @@
 #define TESTFILE "t-fpurge.tmp"
 
 int
-main ()
+main (void)
 {
   int check_filepos;
 
index c4d5533b5bea917d72b1b125791ee51afaa02a75..0f8e686eaaf9a2c8f71728fd8366ce33e9cab18b 100644 (file)
@@ -1,5 +1,5 @@
 /* Test of freading() 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
@@ -38,7 +38,7 @@
 #define TESTFILE "t-freading.tmp"
 
 int
-main ()
+main (void)
 {
   FILE *fp;
 
index 2c652627389fea3013f73f9960505220e4f49323..ad5434e081dbae2f8958a594475069e9bfb2e8ab 100644 (file)
@@ -65,7 +65,7 @@ do_lstat (char const *name, struct stat *st)
 }
 
 int
-main ()
+main (void)
 {
   int result;
   ASSERT (test_stat_func (do_stat) == 0);
index b6ffe2a4c6496171b42935bab1f59724c35aeefa..c00d54fb35ace892fcdd4df4587d677ff78e0f0d 100644 (file)
@@ -1,5 +1,5 @@
 /* Test of fsync() 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
@@ -34,7 +34,7 @@
   while (0)
 
 int
-main ()
+main (void)
 {
   int fd;
   const char *file = "test-fsync.txt";
index 3eac64c4c8075ea2465e57c5f97b67e9ff23cad7..4e049bdffe77bdc3f6d7f20831010f1d31747a8b 100644 (file)
@@ -49,7 +49,7 @@
 #include "test-futimens.h"
 
 int
-main ()
+main (void)
 {
   /* Clean up any trash from prior testsuite runs.  */
   ASSERT (system ("rm -rf " BASE "*") == 0);
index 2733e4f6cf85079c7639133bdd9882fd7855e1e6..9a4ba4b63f864a69bbfd58d8563662f46cf8492e 100644 (file)
@@ -62,7 +62,7 @@ main (int argc, char **argv)
   free (pwd2);
   {
     size_t len = strlen (pwd1);
-    size_t i = len - 10;
+    ssize_t i = len - 10;
     if (i < 0)
       i = 0;
     pwd2 = malloc (len + 2);
index ea70527f9393f83d5daa42a1f392597f1d633b87..58668867eff13aba5b4df0e185990ba85f14d678 100644 (file)
@@ -61,7 +61,7 @@ static const char* const day_table[] =
 };
 
 int
-main (int argc, char **argv)
+main (int argc _UNUSED_PARAMETER_, char **argv)
 {
   struct timespec result;
   struct timespec result2;
@@ -225,7 +225,7 @@ main (int argc, char **argv)
          && result.tv_nsec == result2.tv_nsec);
 
   /* Check that some "next Monday", "last Wednesday", etc. are correct.  */
-  putenv ("TZ=UTC0");
+  setenv ("TZ", "UTC0", 1);
   for (i = 0; day_table[i]; i++)
     {
       unsigned int thur2 = 7 * 24 * 3600; /* 2nd thursday */
index d1eb12af3d2ae73b72e8a1e866f6658e158d3b68..84135eaf37b67a6eb8f3c45e2fe64ef5a526a88c 100644 (file)
@@ -1,5 +1,5 @@
 /* Test of getndelim2() 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
@@ -38,7 +38,7 @@
   while (0)
 
 int
-main (int argc, char **argv)
+main (void)
 {
   FILE *f;
   char *line = NULL;
index 12d8d92fe9a7247ef4ce4ffbf67d67134f038735..6c59d4753a0c52faf719a852d076f85030f1ce5b 100644 (file)
@@ -53,7 +53,7 @@
 #endif
 
 int
-main ()
+main (void)
 {
   unsetenv ("POSIXLY_CORRECT");
 
index 352fe3231af7d888b1fc460ff550382753b0be86..4efec4bc7a3ab94477b4b6b45e77151845b291b9 100644 (file)
@@ -17,7 +17,7 @@
 /* Written by Bruno Haible <bruno@clisp.org>, 2009.  */
 
 static void
-getopt_loop (int argc, char **argv,
+getopt_loop (int argc, const char **argv,
             const char *options,
             int *a_seen, int *b_seen,
             const char **p_value, const char **q_value,
@@ -27,7 +27,7 @@ getopt_loop (int argc, char **argv,
   int c;
 
   opterr = 0;
-  while ((c = getopt (argc, argv, options)) != -1)
+  while ((c = getopt (argc, (char **) argv, options)) != -1)
     {
       switch (c)
        {
@@ -74,7 +74,7 @@ test_getopt (void)
       const char *non_options[10];
       int unrecognized = 0;
       int argc = 0;
-      char *argv[10];
+      const char *argv[10];
 
       argv[argc++] = "program";
       argv[argc++] = "-a";
@@ -102,7 +102,7 @@ test_getopt (void)
       const char *non_options[10];
       int unrecognized = 0;
       int argc = 0;
-      char *argv[10];
+      const char *argv[10];
 
       argv[argc++] = "program";
       argv[argc++] = "-b";
@@ -131,7 +131,7 @@ test_getopt (void)
       const char *non_options[10];
       int unrecognized = 0;
       int argc = 0;
-      char *argv[10];
+      const char *argv[10];
 
       argv[argc++] = "program";
       argv[argc++] = "-ba";
@@ -159,7 +159,7 @@ test_getopt (void)
       const char *non_options[10];
       int unrecognized = 0;
       int argc = 0;
-      char *argv[10];
+      const char *argv[10];
 
       argv[argc++] = "program";
       argv[argc++] = "-ab";
@@ -190,7 +190,7 @@ test_getopt (void)
       const char *non_options[10];
       int unrecognized = 0;
       int argc = 0;
-      char *argv[10];
+      const char *argv[10];
 
       argv[argc++] = "program";
       argv[argc++] = "-pfoo";
@@ -217,7 +217,7 @@ test_getopt (void)
       const char *non_options[10];
       int unrecognized = 0;
       int argc = 0;
-      char *argv[10];
+      const char *argv[10];
 
       argv[argc++] = "program";
       argv[argc++] = "-p";
@@ -245,7 +245,7 @@ test_getopt (void)
       const char *non_options[10];
       int unrecognized = 0;
       int argc = 0;
-      char *argv[10];
+      const char *argv[10];
 
       argv[argc++] = "program";
       argv[argc++] = "-ab";
@@ -278,7 +278,7 @@ test_getopt (void)
       const char *non_options[10];
       int unrecognized = 0;
       int argc = 0;
-      char *argv[10];
+      const char *argv[10];
 
       argv[argc++] = "program";
       argv[argc++] = "-pfoo";
@@ -305,7 +305,7 @@ test_getopt (void)
       const char *non_options[10];
       int unrecognized = 0;
       int argc = 0;
-      char *argv[10];
+      const char *argv[10];
 
       argv[argc++] = "program";
       argv[argc++] = "-p";
@@ -333,7 +333,7 @@ test_getopt (void)
       const char *non_options[10];
       int unrecognized = 0;
       int argc = 0;
-      char *argv[10];
+      const char *argv[10];
 
       argv[argc++] = "program";
       argv[argc++] = "-p";
@@ -364,7 +364,7 @@ test_getopt (void)
       const char *non_options[10];
       int unrecognized = 0;
       int argc = 0;
-      char *argv[10];
+      const char *argv[10];
 
       argv[argc++] = "program";
       argv[argc++] = "-p";
@@ -396,7 +396,7 @@ test_getopt (void)
       const char *non_options[10];
       int unrecognized = 0;
       int argc = 0;
-      char *argv[10];
+      const char *argv[10];
 
       argv[argc++] = "program";
       argv[argc++] = "donald";
@@ -458,7 +458,7 @@ test_getopt (void)
       const char *non_options[10];
       int unrecognized = 0;
       int argc = 0;
-      char *argv[20];
+      const char *argv[20];
 
       argv[argc++] = "program";
       argv[argc++] = "donald";
@@ -536,7 +536,7 @@ test_getopt (void)
       const char *non_options[10];
       int unrecognized = 0;
       int argc = 0;
-      char *argv[10];
+      const char *argv[10];
 
       argv[argc++] = "program";
       argv[argc++] = "donald";
@@ -579,7 +579,7 @@ test_getopt (void)
       const char *non_options[10];
       int unrecognized = 0;
       int argc = 0;
-      char *argv[20];
+      const char *argv[20];
 
       argv[argc++] = "program";
       argv[argc++] = "donald";
@@ -650,7 +650,7 @@ test_getopt (void)
       const char *non_options[10];
       int unrecognized = 0;
       int argc = 0;
-      char *argv[10];
+      const char *argv[10];
 
       argv[argc++] = "program";
       argv[argc++] = "donald";
@@ -713,7 +713,7 @@ test_getopt (void)
       const char *non_options[10];
       int unrecognized = 0;
       int argc = 0;
-      char *argv[10];
+      const char *argv[10];
 
       argv[argc++] = "program";
       argv[argc++] = "donald";
@@ -751,7 +751,7 @@ test_getopt (void)
       const char *non_options[10];
       int unrecognized = 0;
       int argc = 0;
-      char *argv[10];
+      const char *argv[10];
 
       argv[argc++] = "program";
       argv[argc++] = "-+";
@@ -779,7 +779,7 @@ test_getopt (void)
       const char *non_options[10];
       int unrecognized = 0;
       int argc = 0;
-      char *argv[20];
+      const char *argv[20];
 
       argv[argc++] = "program";
       argv[argc++] = "donald";
@@ -829,7 +829,7 @@ test_getopt (void)
       const char *non_options[10];
       int unrecognized = 0;
       int argc = 0;
-      char *argv[10];
+      const char *argv[10];
 
       argv[argc++] = "program";
       argv[argc++] = "donald";
index fb505b2c14af92935e8d3b1a68ae44f9f9dc1052..d0d16fa67791228f9b23ec2f81d736869d3c338e 100644 (file)
@@ -41,7 +41,7 @@ static const struct option long_options_optional[] =
   };
 
 static void
-getopt_long_loop (int argc, char **argv,
+getopt_long_loop (int argc, const char **argv,
                  const char *options, const struct option *long_options,
                  const char **p_value, const char **q_value,
                  int *non_options_count, const char **non_options,
@@ -51,7 +51,8 @@ getopt_long_loop (int argc, char **argv,
   int c;
 
   opterr = 0;
-  while ((c = getopt_long (argc, argv, options, long_options, &option_index))
+  while ((c = getopt_long (argc, (char **) argv, options, long_options,
+                          &option_index))
         != -1)
     {
       switch (c)
@@ -86,6 +87,16 @@ getopt_long_loop (int argc, char **argv,
     }
 }
 
+/* Reduce casting, so we can use string literals elsewhere.
+   getopt_long takes an array of char*, but luckily does not modify
+   those elements, so we can pass const char*.  */
+static int
+do_getopt_long (int argc, const char **argv, const char *shortopts,
+                const struct option *longopts, int *longind)
+{
+  return getopt_long (argc, (char **) argv, shortopts, longopts, longind);
+}
+
 static void
 test_getopt_long (void)
 {
@@ -94,7 +105,7 @@ test_getopt_long (void)
   /* Test disambiguation of options.  */
   {
     int argc = 0;
-    char *argv[10];
+    const char *argv[10];
     int option_index;
     int c;
 
@@ -102,13 +113,13 @@ test_getopt_long (void)
     argv[argc++] = "--x";
     optind = 1;
     opterr = 0;
-    c = getopt_long (argc, argv, "ab", long_options_required, &option_index);
+    c = do_getopt_long (argc, argv, "ab", long_options_required, &option_index);
     ASSERT (c == '?');
     ASSERT (optopt == 0);
   }
   {
     int argc = 0;
-    char *argv[10];
+    const char *argv[10];
     int option_index;
     int c;
 
@@ -116,13 +127,13 @@ test_getopt_long (void)
     argv[argc++] = "--xt";
     optind = 1;
     opterr = 0;
-    c = getopt_long (argc, argv, "ab", long_options_required, &option_index);
+    c = do_getopt_long (argc, argv, "ab", long_options_required, &option_index);
     ASSERT (c == '?');
     ASSERT (optopt == 0);
   }
   {
     int argc = 0;
-    char *argv[10];
+    const char *argv[10];
     int option_index;
     int c;
 
@@ -130,13 +141,13 @@ test_getopt_long (void)
     argv[argc++] = "--xtr";
     optind = 1;
     opterr = 0;
-    c = getopt_long (argc, argv, "ab", long_options_required, &option_index);
+    c = do_getopt_long (argc, argv, "ab", long_options_required, &option_index);
     ASSERT (c == '?');
     ASSERT (optopt == 0);
   }
   {
     int argc = 0;
-    char *argv[10];
+    const char *argv[10];
     int option_index;
     int c;
 
@@ -144,12 +155,12 @@ test_getopt_long (void)
     argv[argc++] = "--xtra";
     optind = 1;
     opterr = 0;
-    c = getopt_long (argc, argv, "ab", long_options_required, &option_index);
+    c = do_getopt_long (argc, argv, "ab", long_options_required, &option_index);
     ASSERT (c == 1001);
   }
   {
     int argc = 0;
-    char *argv[10];
+    const char *argv[10];
     int option_index;
     int c;
 
@@ -157,13 +168,13 @@ test_getopt_long (void)
     argv[argc++] = "--xtre";
     optind = 1;
     opterr = 0;
-    c = getopt_long (argc, argv, "ab", long_options_required, &option_index);
+    c = do_getopt_long (argc, argv, "ab", long_options_required, &option_index);
     ASSERT (c == '?');
     ASSERT (optopt == 0);
   }
   {
     int argc = 0;
-    char *argv[10];
+    const char *argv[10];
     int option_index;
     int c;
 
@@ -171,13 +182,13 @@ test_getopt_long (void)
     argv[argc++] = "--xtrem";
     optind = 1;
     opterr = 0;
-    c = getopt_long (argc, argv, "ab", long_options_required, &option_index);
+    c = do_getopt_long (argc, argv, "ab", long_options_required, &option_index);
     ASSERT (c == '?');
     ASSERT (optopt == 0);
   }
   {
     int argc = 0;
-    char *argv[10];
+    const char *argv[10];
     int option_index;
     int c;
 
@@ -185,12 +196,12 @@ test_getopt_long (void)
     argv[argc++] = "--xtreme";
     optind = 1;
     opterr = 0;
-    c = getopt_long (argc, argv, "ab", long_options_required, &option_index);
+    c = do_getopt_long (argc, argv, "ab", long_options_required, &option_index);
     ASSERT (c == 1002);
   }
   {
     int argc = 0;
-    char *argv[10];
+    const char *argv[10];
     int option_index;
     int c;
 
@@ -198,12 +209,12 @@ test_getopt_long (void)
     argv[argc++] = "--xtremel";
     optind = 1;
     opterr = 0;
-    c = getopt_long (argc, argv, "ab", long_options_required, &option_index);
+    c = do_getopt_long (argc, argv, "ab", long_options_required, &option_index);
     ASSERT (c == 1003);
   }
   {
     int argc = 0;
-    char *argv[10];
+    const char *argv[10];
     int option_index;
     int c;
 
@@ -211,7 +222,7 @@ test_getopt_long (void)
     argv[argc++] = "--xtremely";
     optind = 1;
     opterr = 0;
-    c = getopt_long (argc, argv, "ab", long_options_required, &option_index);
+    c = do_getopt_long (argc, argv, "ab", long_options_required, &option_index);
     ASSERT (c == 1003);
   }
 
@@ -224,7 +235,7 @@ test_getopt_long (void)
       const char *non_options[10];
       int unrecognized = 0;
       int argc = 0;
-      char *argv[10];
+      const char *argv[10];
       a_seen = 0;
       b_seen = 0;
 
@@ -252,7 +263,7 @@ test_getopt_long (void)
       const char *non_options[10];
       int unrecognized = 0;
       int argc = 0;
-      char *argv[10];
+      const char *argv[10];
       a_seen = 0;
       b_seen = 0;
 
@@ -281,7 +292,7 @@ test_getopt_long (void)
       const char *non_options[10];
       int unrecognized = 0;
       int argc = 0;
-      char *argv[10];
+      const char *argv[10];
       a_seen = 0;
       b_seen = 0;
 
@@ -309,7 +320,7 @@ test_getopt_long (void)
       const char *non_options[10];
       int unrecognized = 0;
       int argc = 0;
-      char *argv[10];
+      const char *argv[10];
       a_seen = 0;
       b_seen = 0;
 
@@ -340,7 +351,7 @@ test_getopt_long (void)
       const char *non_options[10];
       int unrecognized = 0;
       int argc = 0;
-      char *argv[10];
+      const char *argv[10];
       a_seen = 0;
       b_seen = 0;
 
@@ -367,7 +378,7 @@ test_getopt_long (void)
       const char *non_options[10];
       int unrecognized = 0;
       int argc = 0;
-      char *argv[10];
+      const char *argv[10];
       a_seen = 0;
       b_seen = 0;
 
@@ -395,7 +406,7 @@ test_getopt_long (void)
       const char *non_options[10];
       int unrecognized = 0;
       int argc = 0;
-      char *argv[10];
+      const char *argv[10];
       a_seen = 0;
       b_seen = 0;
 
@@ -427,7 +438,7 @@ test_getopt_long (void)
       const char *non_options[10];
       int unrecognized = 0;
       int argc = 0;
-      char *argv[10];
+      const char *argv[10];
       a_seen = 0;
       b_seen = 0;
 
@@ -454,7 +465,7 @@ test_getopt_long (void)
       const char *non_options[10];
       int unrecognized = 0;
       int argc = 0;
-      char *argv[10];
+      const char *argv[10];
       a_seen = 0;
       b_seen = 0;
 
@@ -482,7 +493,7 @@ test_getopt_long (void)
       const char *non_options[10];
       int unrecognized = 0;
       int argc = 0;
-      char *argv[10];
+      const char *argv[10];
       a_seen = 0;
       b_seen = 0;
 
@@ -512,7 +523,7 @@ test_getopt_long (void)
       const char *non_options[10];
       int unrecognized = 0;
       int argc = 0;
-      char *argv[10];
+      const char *argv[10];
       a_seen = 0;
       b_seen = 0;
 
@@ -544,7 +555,7 @@ test_getopt_long (void)
       const char *non_options[10];
       int unrecognized = 0;
       int argc = 0;
-      char *argv[10];
+      const char *argv[10];
       a_seen = 0;
       b_seen = 0;
 
@@ -584,7 +595,7 @@ test_getopt_long (void)
       const char *non_options[10];
       int unrecognized = 0;
       int argc = 0;
-      char *argv[20];
+      const char *argv[20];
       a_seen = 0;
       b_seen = 0;
 
@@ -634,7 +645,7 @@ test_getopt_long (void)
       const char *non_options[10];
       int unrecognized = 0;
       int argc = 0;
-      char *argv[10];
+      const char *argv[10];
       a_seen = 0;
       b_seen = 0;
 
@@ -677,7 +688,7 @@ test_getopt_long (void)
       const char *non_options[10];
       int unrecognized = 0;
       int argc = 0;
-      char *argv[20];
+      const char *argv[20];
       a_seen = 0;
       b_seen = 0;
 
@@ -747,7 +758,7 @@ test_getopt_long (void)
       const char *non_options[10];
       int unrecognized = 0;
       int argc = 0;
-      char *argv[10];
+      const char *argv[10];
       a_seen = 0;
       b_seen = 0;
 
@@ -788,7 +799,7 @@ test_getopt_long (void)
       const char *non_options[10];
       int unrecognized = 0;
       int argc = 0;
-      char *argv[10];
+      const char *argv[10];
       a_seen = 0;
       b_seen = 0;
 
@@ -826,7 +837,7 @@ test_getopt_long (void)
       const char *non_options[10];
       int unrecognized = 0;
       int argc = 0;
-      char *argv[10];
+      const char *argv[10];
       a_seen = 0;
       b_seen = 0;
 
@@ -854,7 +865,7 @@ test_getopt_long (void)
       const char *non_options[10];
       int unrecognized = 0;
       int argc = 0;
-      char *argv[20];
+      const char *argv[20];
       a_seen = 0;
       b_seen = 0;
 
@@ -904,7 +915,7 @@ test_getopt_long (void)
       const char *non_options[10];
       int unrecognized = 0;
       int argc = 0;
-      char *argv[10];
+      const char *argv[10];
       a_seen = 0;
       b_seen = 0;
 
@@ -944,14 +955,14 @@ static void
 test_getopt_long_posix (void)
 {
   int c = 3;
-  char *v[4] = {"test", "-r", "foo", NULL};
-  struct option l[] = {{NULL}};
+  const char *v[4] = {"test", "-r", "foo", NULL};
+  struct option l[] = {{NULL, 0, NULL, 0}};
   int start;
   int result;
   for (start = OPTIND_MIN; start <= 1; start++)
     {
       optind = start;
-      result = getopt_long (c, v, "r::", l, NULL);
+      result = do_getopt_long (c, v, "r::", l, NULL);
     }
   ASSERT (result == 'r');
   ASSERT (optarg == NULL);
index 892b18829c96d1b6cc90ff2234d923d156f40faf..3b858791a42173d4caa8df909bce503e1dfa4589 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2005, 2007 Free Software Foundation
+ * Copyright (C) 2005, 2007, 2009 Free Software Foundation
  * Written by Jim Meyering.
  *
  * This program is free software: you can redistribute it and/or modify
@@ -24,7 +24,7 @@
 #include <string.h>
 
 int
-main (int argc, char *argv[])
+main (void)
 {
   time_t t = 0;
   struct tm *lt;
index b056d0a650f6afccc091e27c5f1f96102779625b..baaab9a0c9bf67eaa8f5fa3d458ace55bfb4ed59 100644 (file)
@@ -57,7 +57,7 @@ hash_freer (void *x)
 }
 
 static void
-insert_new (Hash_table *ht, void *ent)
+insert_new (Hash_table *ht, const void *ent)
 {
   void *e = hash_insert (ht, ent);
   ASSERT (e == ent);
@@ -243,11 +243,11 @@ main (int argc, char **argv)
                size_t n = hash_get_n_entries (ht);
                if (n)
                  {
-                   size_t k = rand () % n;
+                   size_t kk = rand () % n;
                    void const *p;
                    void *v;
-                   for (p = hash_get_first (ht); k;
-                        --k, p = hash_get_next (ht, p))
+                   for (p = hash_get_first (ht); kk;
+                        --kk, p = hash_get_next (ht, p))
                      {
                        /* empty */
                      }
index 05270d7b8ff3f4aefc0824a064b5d744ce250dee..c08a3ee9475bd02a4ee4f0040ccd2da8d1643633 100644 (file)
@@ -1,5 +1,5 @@
 /* Test the simple ring buffer.
-   Copyright (C) 2006-2008 Free Software Foundation, Inc.
+   Copyright (C) 2006-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 ()
+main (void)
 {
   int o;
   I_ring ir;
index 10857aea90ec7e7e547b66885b3df1de4df206c1..6126aa0a4238666a893d906716c3747b979a60cd 100644 (file)
@@ -1,5 +1,5 @@
 /* Test of <inttypes.h> substitute.
-   Copyright (C) 2006-2007 Free Software Foundation, Inc.
+   Copyright (C) 2006-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
@@ -115,7 +115,7 @@ const char *l = /* implicit string concatenation */
   ;
 
 int
-main ()
+main (void)
 {
   return 0;
 }
index a77ffe76d707d5face792142f8b3fff8398c9d95..dd7df2e0163258bb3cb0952dda08192316d3629c 100644 (file)
@@ -44,7 +44,7 @@
 #include "test-link.h"
 
 int
-main (int argc, char **argv)
+main (void)
 {
   /* Remove any garbage left from previous partial runs.  */
   ASSERT (system ("rm -rf " BASE "*") == 0);
index 9740d26cd6f519b5dfb8eda506142993ab1561a9..b06b3189f5799a13c15f786318afaeea3922d7e6 100644 (file)
@@ -81,7 +81,7 @@ check_same_link (char const *name1, char const *name2)
 }
 
 int
-main ()
+main (void)
 {
   int i;
   int dfd;
@@ -134,11 +134,11 @@ main ()
      do the other variant after the loop.  */
   for (i = 0; i < 32; i++)
     {
-      int flag = (i & 0x10 ? AT_SYMLINK_FOLLOW : 0);
       int fd1 = (i & 8) ? dfd : AT_FDCWD;
       char *file1 = file_name_concat ((i & 4) ? ".." : cwd, BASE "xx", NULL);
       int fd2 = (i & 2) ? dfd : AT_FDCWD;
       char *file2 = file_name_concat ((i & 1) ? ".." : cwd, BASE "xx", NULL);
+      flag = (i & 0x10 ? AT_SYMLINK_FOLLOW : 0);
 
       ASSERT (sprintf (strchr (file1, '\0') - 2, "%02d", i) == 2);
       ASSERT (sprintf (strchr (file2, '\0') - 2, "%02d", i + 1) == 2);
index 89edb1fa02b7f96d0f8eb7ea95fe0c6fad1ce881..b8c3d94e84fdaaedbef3b6de41b1f97d8ac74a36 100644 (file)
@@ -54,7 +54,7 @@ do_lstat (char const *name, struct stat *st)
 }
 
 int
-main ()
+main (void)
 {
   return test_lstat_func (do_lstat, true);
 }
index aa51f8581a3890389bfeea4c9d2461c6d611908f..28f2f12550a86239f3058cb0cc0ae406ded069af 100644 (file)
@@ -1,5 +1,5 @@
 /* Test of <math.h> substitute.
-   Copyright (C) 2007, 2008 Free Software Foundation, Inc.
+   Copyright (C) 2007, 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
@@ -40,7 +40,7 @@ numeric_equal (double x, double y)
 }
 
 int
-main ()
+main (void)
 {
   double d = NAN;
   double zero = 0.0;
index aeae980d014e8a5cc437384807bc645684af3dc6..c3f4521cede6f7ffac961a00a0a0957b309f71bc 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2005 Free Software Foundation
+ * Copyright (C) 2005, 2009 Free Software Foundation
  * Written by Simon Josefsson
  *
  * This program is free software: you can redistribute it and/or modify
@@ -25,7 +25,7 @@
 #include "md5.h"
 
 int
-main (int argc, char *argv[])
+main (void)
 {
   /* Test vectors from RFC 1321. */
 
index 1124f8b5871362e1bec3f5d8b6bbd0fa6446b581..a8cfc9b222b9ff96b65366a0c740b5299dc8c5f0 100644 (file)
@@ -41,7 +41,7 @@
 #define MEMCHR (char *) memchr
 
 int
-main ()
+main (void)
 {
   size_t n = 0x100000;
   char *input = malloc (n);
@@ -102,8 +102,6 @@ main ()
 
     if (page_boundary != NULL)
       {
-       int n;
-
        for (n = 1; n <= 500; n++)
          {
            char *mem = page_boundary - n;
index c7ba6b97353026286cf93eea5ce2cfd3b2b3c32a..6769aba21b3f870d5ff3b85fc83eddaa1d4a5fc3 100644 (file)
@@ -42,7 +42,7 @@
 #define MEMCHR2 (char *) memchr2
 
 int
-main ()
+main (void)
 {
   size_t n = 0x100000;
   char *input = malloc (n);
index 63568c156619c8512c262f9d54ccfaa2a4e3bd0b..962fc90cf20719c121dba996c07afe5273591aac 100644 (file)
@@ -41,7 +41,7 @@
 #define MEMRCHR (char *) memrchr
 
 int
-main ()
+main (void)
 {
   size_t n = 0x100000;
   char *input = malloc (n);
index cc51fcef180be39038d052bbaef0edddcee73918..14c33233406cf7e1e878c10c6f654fce0ee5ea76 100644 (file)
@@ -44,7 +44,7 @@
 #include "test-mkdir.h"
 
 int
-main ()
+main (void)
 {
   /* Clean up any trash from prior testsuite runs.  */
   ASSERT (system ("rm -rf " BASE "*") == 0);
index 69d90b81e8eab01c2076812661c96dc717045556..9b59f17a48fb35935f065f900399253262736c9a 100644 (file)
@@ -53,7 +53,7 @@ do_mkdir (char const *name, mode_t mode)
 }
 
 int
-main ()
+main (void)
 {
   int result;
 
index 3853dfecb7206f4aa18d57cc73edea44e99bdbd3..2992ba2efa57411bf0b4b37c32401c90c720157b 100644 (file)
@@ -50,7 +50,7 @@ test_mknodat (int fd, char const *name, mode_t mode)
 }
 
 int
-main ()
+main (void)
 {
   int i;
   test_func funcs[2] = { mkfifoat, test_mknodat };
index 6b97e184d39fc3328ff65bd28cbf2db265223416..738934e12406f0eb0aa2a72bb4669713a023eec6 100644 (file)
@@ -25,7 +25,7 @@
 #include "test-open.h"
 
 int
-main ()
+main (void)
 {
   return test_open ();
 }
index 221a8801fbee726d8406dca73f903056b49ed76a..fe9d456cc14eeee283848e8d6ca05253b763482f 100644 (file)
@@ -48,7 +48,7 @@ static FILE *myerr;
 #define witness "test-openat-safer.txt"
 
 int
-main ()
+main (void)
 {
   int i;
   int j;
index 8fa8f83c426da514f9f155befbae73bab837841b..6e5c5199cb32387ebc80a55ba9fba0a66e7e8782 100644 (file)
@@ -37,7 +37,7 @@
   while (0)
 
 int
-main ()
+main (void)
 {
   /* FIXME - add more tests.  For example, share /dev/null and
      trailing slash tests with test-open, and do more checks for
index 2e17b4155ddf0e1b289bcd69b713b96489306178..66ca1f7c0e441e70bff1e3a6fa8eee697b07cf58 100644 (file)
@@ -28,8 +28,6 @@
 
 #include "intprops.h"
 
-#define STREQ(a, b) (strcmp (a, b) == 0)
-
 #define ASSERT(expr) \
   do                                                                        \
     {                                                                       \
@@ -101,7 +99,7 @@ static struct posixtm_test const T[] =
   };
 
 int
-main (int argc, char **argv)
+main (void)
 {
   unsigned int i;
   int fail = 0;
index 04891bc7580baffc757c2947d959eaf104d64f81..7346cba6050863baef391417e747dd19b75ef758 100644 (file)
@@ -378,7 +378,7 @@ use_quotearg_colon (const char *str, size_t *len)
 }
 
 int
-main (int argc, char *argv[])
+main (int argc _UNUSED_PARAMETER_, char *argv[])
 {
   int i;
   bool ascii_only = MB_CUR_MAX == 1 && !isprint ((unsigned char) LQ[0]);
index 34e70ef472e8f57eedbd8df080b7f6927d39328f..963af3964b4addb763a77a0204c20561d933cd26 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2008 Free Software Foundation
+ * Copyright (C) 2008, 2009 Free Software Foundation
  * Written by Eric Blake and Bruno Haible
  *
  * This program is free software: you can redistribute it and/or modify
@@ -39,7 +39,7 @@
 #define RAWMEMCHR (char *) rawmemchr
 
 int
-main ()
+main (void)
 {
   size_t n = 0x100000;
   char *input = malloc (n + 1);
index 1fdc2da5a163422c61460a211f96858cc974208f..78bf342cb4b8d2af37a609058bd5fe961ed63424 100644 (file)
@@ -45,7 +45,7 @@
 #include "test-readlink.h"
 
 int
-main ()
+main (void)
 {
   /* Remove any leftovers from a previous partial run.  */
   ASSERT (system ("rm -rf " BASE "*") == 0);
index 2d5d6337c46f884b1f77d640040c9567e0adc28b..af5d01bc235a8a111097de2f8c1eda5f3872200e 100644 (file)
@@ -42,7 +42,7 @@
 #define BASE "test-remove.t"
 
 int
-main ()
+main (void)
 {
   /* Remove any leftovers from a previous partial run.  */
   ASSERT (system ("rm -rf " BASE "*") == 0);
index 7bfdd848a768704988afd0c32fcff559838054e1..0d51140d80ccdf13301ded489b7b474e528f186a 100644 (file)
@@ -44,7 +44,7 @@
 #include "test-rename.h"
 
 int
-main (int argc, char **argv)
+main (void)
 {
   /* Remove any garbage left from previous partial runs.  */
   ASSERT (system ("rm -rf " BASE "*") == 0);
index c69a75fc9b56766f832405a715df2abf9932e86d..88c0cb08e6970a2a1c2e97d98834e1a12c488c18 100644 (file)
@@ -57,7 +57,7 @@ do_rename (char const *name1, char const *name2)
 }
 
 int
-main ()
+main (void)
 {
   int i;
   int dfd;
index 9d8eb5ab0b5be5872d7bb5ad6ab2544ef8d8a93e..642d92c7a54b77e7f670de9e02663515afad4dec 100644 (file)
@@ -44,7 +44,7 @@
 #include "test-rmdir.h"
 
 int
-main ()
+main (void)
 {
   return test_rmdir_func (rmdir, true);
 }
index ac5b495174abc0da314e5e572bbc78cb064bf33f..892f2c8fa9c7977be0b805e9d43d1065a0330ba5 100644 (file)
@@ -23,7 +23,7 @@
 #include "sha1.h"
 
 int
-main (int argc, char *argv[])
+main (void)
 {
   const char *in1 = "abcdefgh";
   const char *out1 = "\x42\x5a\xf1\x2a\x07\x43\x50\x2b"
index c06e6f72772e1a14196d999a2e191c1e36666ad9..2269b69653329ac5b5eba714b2228bfcafe95e49 100644 (file)
@@ -1,5 +1,5 @@
 /* Test of sigaction() 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
@@ -89,7 +89,7 @@ handler (int sig)
 }
 
 int
-main (int argc, char *argv[])
+main (void)
 {
   struct sigaction sa;
   struct sigaction old_sa;
index 4bc13ab5dc9e5047909e0901ffd1e5c32f103e46..5154f4e9530ddf843266974449f22f7f8380942e 100644 (file)
@@ -22,7 +22,8 @@
 
 volatile sig_atomic_t s;
 
-int main ()
+int
+main (void)
 {
   return s;
 }
index 7fb2e93b9b540ff5d6fa693824170195b7e03261..b88af3dc51af6ca5258c6f7f237b2f80fb2886b0 100644 (file)
@@ -254,7 +254,7 @@ test_birthtime (const struct stat *statinfo,
 }
 
 int
-main ()
+main (void)
 {
   struct stat statinfo[NFILES];
   struct timespec modtimes[NFILES];
index f6777e8415b5afef35e0648fee780e38ed3dc59a..61a9d901821c2b1aa78d660d74b243b3fad9c50d 100644 (file)
@@ -54,7 +54,7 @@ do_stat (char const *name, struct stat *st)
 }
 
 int
-main ()
+main (void)
 {
   return test_stat_func (do_stat);
 }
index f8484987cb3f432009010114e2c3968dd63008cb..c0a7515ecca1dfe0732bc7932ac2bed89724d0af 100644 (file)
@@ -32,7 +32,7 @@ size_t c = 2;
 verify (sizeof NULL == sizeof (void *));
 
 int
-main ()
+main (void)
 {
   return 0;
 }
index a2bf42ac899451eabcbe4dcf041c726951841a7d..4e9b3621eeb3829d372c7cf8bbdacbb77a2f2249 100644 (file)
@@ -1,5 +1,5 @@
 /* Test of <stdint.h> substitute.
-   Copyright (C) 2006-2008 Free Software Foundation, Inc.
+   Copyright (C) 2006-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
@@ -354,7 +354,7 @@ verify_same_types (UINTMAX_C (17), (uintmax_t)0 + 0);
 
 
 int
-main ()
+main (void)
 {
   return 0;
 }
index dcfe38dd515cf365fc8c55fbf19ed17177fa23d5..3f2f0677f0c7db62b28579e246d80d552ca36bad 100644 (file)
@@ -30,7 +30,7 @@ int sk[] = { SEEK_CUR, SEEK_END, SEEK_SET };
 verify (sizeof NULL == sizeof (void *));
 
 int
-main ()
+main (void)
 {
   return 0;
 }
index ae46ba16625479aeb9022489162bee441a57433b..fad5cf450e58bf42c1651dda278c752944e56a09 100644 (file)
@@ -29,7 +29,7 @@ int exitcode;
 verify (sizeof NULL == sizeof (void *));
 
 int
-main ()
+main (void)
 {
   /* Check that some macros are defined and different integer constants.  */
   switch (exitcode)
index dc550661b47441f07c3b0592392b0e47850e5ed1..ea882e5543d5c0c5506fdf6c7650b36cd7c61b6c 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2008 Free Software Foundation
+ * Copyright (C) 2008, 2009 Free Software Foundation
  * Written by Eric Blake and Bruno Haible
  *
  * This program is free software: you can redistribute it and/or modify
@@ -35,7 +35,7 @@
   while (0)
 
 int
-main ()
+main (void)
 {
   size_t n = 0x100000;
   char *input = malloc (n + 1);
index 3d9814d5d4c8c4ea08af1b757341106ab8f14dde..27eb969a7023ff54fd6f1d75d028729e91a80edb 100644 (file)
@@ -1,5 +1,5 @@
 /* Test of strerror() 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
@@ -37,7 +37,7 @@
   while (0)
 
 int
-main (int argc, char **argv)
+main (void)
 {
   char *str;
 
index fe53cd9b152a584e9559ff43b55a38106416dcad..69df747eb675b6d820019029b2394cc6a42a3c6c 100644 (file)
@@ -27,7 +27,7 @@
 verify (sizeof NULL == sizeof (void *));
 
 int
-main ()
+main (void)
 {
   return 0;
 }
index d99e5fe5ec9abe690a7397e586d23f69132dbd7e..69dd4749e771a4e0071b87833a3eefb46f2d6b85 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2008 Free Software Foundation
+ * Copyright (C) 2008, 2009 Free Software Foundation
  * Written by Eric Blake
  *
  * This program is free software: you can redistribute it and/or modify
@@ -47,7 +47,7 @@
 double zero = 0.0;
 
 int
-main ()
+main (void)
 {
   int status = 0;
   /* Subject sequence empty or invalid.  */
index 04da20c105d7e7cf42ebf0f3c5fd27e95ca5d93e..a98695baa0cc4c4191d8882d68d301583c5aeeba 100644 (file)
@@ -1,5 +1,5 @@
 /* Test of strverscmp() 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
@@ -37,7 +37,7 @@
   while (0)
 
 int
-main (int argc, char **argv)
+main (void)
 {
   ASSERT (strverscmp ("", "") == 0);
   ASSERT (strverscmp ("a", "a") == 0);
index 9f39090e84a7d12a66e807c27944a5b74d39e8e0..26e97d01719d52ddcaa255281fb196f8924465b5 100644 (file)
@@ -44,7 +44,7 @@
 #include "test-symlink.h"
 
 int
-main ()
+main (void)
 {
   /* Remove any leftovers from a previous partial run.  */
   ASSERT (system ("rm -rf " BASE "*") == 0);
index 3b542e3309d5df882db366253d3a57a041838d69..993087204d4be19a10f6e54b3ae21a7628c7662a 100644 (file)
@@ -64,7 +64,7 @@ do_readlink (char const *name, char *buf, size_t len)
 }
 
 int
-main ()
+main (void)
 {
   char buf[80];
   int result;
index a73f9b81c61f608148275059b644ec0477439de7..4a85c9f08b48f08899cf4848981551369b21d641 100644 (file)
@@ -282,7 +282,7 @@ nlink_t t1;
 struct timespec t2;
 
 int
-main ()
+main (void)
 {
   return 0;
 }
index bae4108e0771f49b490c62755b2dae4f8d5817ac..74f35acfe41c2d6be77a768730fce0ec150b572a 100644 (file)
@@ -1,5 +1,5 @@
 /* Test of <sys/time.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
@@ -23,7 +23,7 @@
 struct timeval a;
 
 int
-main ()
+main (void)
 {
   return 0;
 }
index ea8143737f16cd0099831f868966accabcc4cee4..4afa3b39881abaef3203ce5950a9583aeeb8a013 100644 (file)
@@ -29,7 +29,7 @@ struct timespec a;
 verify (sizeof NULL == sizeof (void *));
 
 int
-main ()
+main (void)
 {
   return 0;
 }
index 129367b4d7df989e1f31d1035e9ddc444d8a3169..dd907f4ebe9d4c227de732efcf2aae611df87930 100644 (file)
@@ -50,7 +50,7 @@ intptr_t t8;
 #endif
 
 int
-main ()
+main (void)
 {
   return 0;
 }
index 0c8dc6f721d506df9777e7bbda4c830e0ea8a96e..3d7a8753a67dbf2c9745db2cb9c449f36d3ececf 100644 (file)
@@ -47,7 +47,7 @@
 #include "test-unlink.h"
 
 int
-main ()
+main (void)
 {
   return test_unlink_func (unlink, true);
 }
index 851ffe7ca4ccaff19bc5e3091809d87c5de7718b..8fa96430c67c0947ed6934478a9c8ae280a103c8 100644 (file)
@@ -63,7 +63,7 @@ unlinker (char const *name)
 }
 
 int
-main ()
+main (void)
 {
   /* FIXME: Add tests of fd other than ".".  */
   int result1;
index 651ea9b516659cc6e078987a6382488da3e82b67..a36f0428f51bf842d9880d0e57a5e6df0be83992 100644 (file)
@@ -69,7 +69,7 @@ do_fdutimens (char const *name, struct timespec const times[2])
 }
 
 int
-main ()
+main (void)
 {
   int result1; /* Skip because of no symlink support.  */
   int result2; /* Skip because of no futimens support.  */
index 8dc0cc95cd5aefd13a8356c6ed9765e6d9f60c31..35fd1bfac616a82810d77fde30b6f22b348b3d16 100644 (file)
@@ -66,7 +66,7 @@ do_lutimensat (char const *name, struct timespec const times[2])
 }
 
 int
-main ()
+main (void)
 {
   int result1; /* Skip because of no symlink support.  */
   int result2; /* Skip because of no lutimens support.  */
index 71cbc8bac4583aa9714c511549f62fa8f1fd4335..9ff97c45a8b12c22fdc61f277a18a4164faf1e52 100644 (file)
@@ -24,7 +24,7 @@
 #define AUTHORS "Sergey Poznyakoff", "Eric Blake"
 
 int
-main (int argc, char **argv)
+main (int argc _UNUSED_PARAMETER_, char **argv)
 {
   set_program_name (argv[0]);
   version_etc (stdout, "test-version-etc", "dummy", "0", AUTHORS,
index 28660688d2cf6fb2449a66509ddff9968da31bdd..2e60bb86db298b13e4dd656028ea8460a009fe1a 100644 (file)
@@ -31,7 +31,7 @@ wint_t b = 'x';
 verify (sizeof NULL == sizeof (void *));
 
 int
-main ()
+main (void)
 {
   return 0;
 }
index 5deae45de958b12b8399ac1f5f7eb93e69d67e1d..a39514a74fce445a99a9a94060827b34d4094c0a 100644 (file)
@@ -41,7 +41,7 @@ wint_t a = 'x';
 wint_t e = WEOF;
 
 int
-main ()
+main (void)
 {
   /* Check that the isw* functions exist as functions or as macros.  */
   (void) iswalnum (0);
index 62c9b957f86a489e42cb0b7f2be8f44695fba464..a5ab7266e52bb247a35b990e55eeb20bb839d0a5 100644 (file)
@@ -1,5 +1,5 @@
 /* Test of error-checking xprintf() 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
@@ -43,7 +43,7 @@
 #include "test-printf-posix.h"
 
 int
-main (int argc, char *argv[])
+main (int argc _UNUSED_PARAMETER_, char *argv[])
 {
   set_program_name (argv[0]);