[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
tests cleanup
From: |
Eric Blake |
Subject: |
tests cleanup |
Date: |
Mon, 15 Sep 2008 20:36:17 +0000 (UTC) |
User-agent: |
Loom/3.14 (http://gmane.org/) |
I noticed some compiler warnings in the m4 testsuite, which were easy to avoid
even though they didn't affect correctness.
>From a0dc688369a937a657cdf8d35f362c3068b0af9a Mon Sep 17 00:00:00 2001
From: Eric Blake <address@hidden>
Date: Mon, 15 Sep 2008 14:31:03 -0600
Subject: [PATCH] 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 <address@hidden>
---
ChangeLog | 12 +++++++++---
tests/test-closein.c | 7 +++----
tests/test-memchr.c | 4 +++-
3 files changed, 15 insertions(+), 8 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 65b21fd..eae0145 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2008-09-15 Eric Blake <address@hidden>
+
+ 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 <address@hidden>
* m4/errno_h.m4 (gl_HEADER_ERRNO_H_BODY): Test for all the macros that
diff --git a/tests/test-closein.c b/tests/test-closein.c
index cf7b30a..57d968b 100644
--- a/tests/test-closein.c
+++ b/tests/test-closein.c
@@ -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 @@ int
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 @@ main (int argc, char **argv)
close (0);
if (argc > 1)
- i = fread (buf, 1, 6, stdin);
+ fread (buf, 1, 6, stdin);
return 0;
}
diff --git a/tests/test-memchr.c b/tests/test-memchr.c
index d108f1a..ebf3cfc 100644
--- a/tests/test-memchr.c
+++ b/tests/test-memchr.c
@@ -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 @@ main ()
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);
--
1.6.0
- tests cleanup,
Eric Blake <=