changeset 30133:4aef3b742953

tests: avoid some compiler warnings * tests/test-memchr.c (main): Pass NULL indirectly. * tests/test-closein.c (main): Avoid unused variable. Signed-off-by: Eric Blake <ebb9@byu.net>
author Eric Blake <ebb9@byu.net>
date Mon, 15 Sep 2008 14:31:03 -0600
parents d639ac7a764a
children a9d2e3c7ee34
files ChangeLog tests/test-closein.c tests/test-memchr.c
diffstat 3 files changed, 15 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Mon Sep 15 13:38:19 2008 +0200
+++ b/ChangeLog	Mon Sep 15 14:31:03 2008 -0600
@@ -1,3 +1,9 @@
+2008-09-15  Eric Blake  <ebb9@byu.net>
+
+	tests: avoid some compiler warnings
+	* tests/test-memchr.c (main): Pass NULL indirectly.
+	* tests/test-closein.c (main): Avoid unused variable.
+
 2008-09-15  Bruno Haible  <bruno@clisp.org>
 
 	* m4/errno_h.m4 (gl_HEADER_ERRNO_H_BODY): Test for all the macros that
@@ -158,7 +164,7 @@
 	__MSVCRT__.
 
 2008-09-13  Yoann Vandoorselaere  <yoann.v@prelude-ids.com>
-            Bruno Haible  <bruno@clisp.org>
+	    Bruno Haible  <bruno@clisp.org>
 
 	* lib/glob.c: Don't include <pwd.h> on native Windows.
 	(WINDOWS32): New macro.
@@ -263,7 +269,7 @@
 	Approved by Eric Blake.
 
 2008-09-04  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
-            Bruno Haible  <bruno@clisp.org>
+	    Bruno Haible  <bruno@clisp.org>
 
 	Make gnulib-tool work with native 'sed' on AIX.
 	* gnulib-tool (sed_noop): New variable.
@@ -273,7 +279,7 @@
 	Reported by Albert Chin <bug-gnulib@mlists.thewrittenword.com>.
 
 2008-09-04  Albert Chin  <bug-gnulib@mlists.thewrittenword.com>
-            Bruno Haible  <bruno@clisp.org>
+	    Bruno Haible  <bruno@clisp.org>
 
 	* m4/include_next.m4 (gl_INCLUDE_NEXT): Add check whether #include_next
 	also works after #include directives.
--- a/tests/test-closein.c	Mon Sep 15 13:38:19 2008 +0200
+++ b/tests/test-closein.c	Mon Sep 15 14:31:03 2008 -0600
@@ -1,5 +1,5 @@
 /* Test of closein module.
-   Copyright (C) 2007 Free Software Foundation, Inc.
+   Copyright (C) 2007, 2008 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,8 +36,7 @@
 main (int argc, char **argv)
 {
   char buf[7];
-  int i = -1;
-  atexit(close_stdin);
+  atexit (close_stdin);
   program_name = argv[0];
 
   /* close_stdin currently relies on ftell, but mingw ftell is
@@ -48,6 +47,6 @@
     close (0);
 
   if (argc > 1)
-    i = fread (buf, 1, 6, stdin);
+    fread (buf, 1, 6, stdin);
   return 0;
 }
--- a/tests/test-memchr.c	Mon Sep 15 13:38:19 2008 +0200
+++ b/tests/test-memchr.c	Mon Sep 15 14:31:03 2008 -0600
@@ -41,6 +41,8 @@
 int
 main ()
 {
+  void *nil = NULL; /* Use to avoid gcc attribute((nonnull)) warnings.  */
+
   size_t n = 0x100000;
   char *input = malloc (n);
   ASSERT (input);
@@ -56,7 +58,7 @@
   ASSERT (MEMCHR (input, 'a', n) == input);
 
   ASSERT (MEMCHR (input, 'a', 0) == NULL);
-  ASSERT (MEMCHR (NULL, 'a', 0) == NULL);
+  ASSERT (MEMCHR (nil, 'a', 0) == NULL);
 
   ASSERT (MEMCHR (input, 'b', n) == input + 1);
   ASSERT (MEMCHR (input, 'c', n) == input + 2);