bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: tests cleanup


From: Simon Josefsson
Subject: Re: tests cleanup
Date: Tue, 30 Sep 2008 08:40:51 +0200
User-agent: Gnus/5.110011 (No Gnus v0.11) Emacs/22.2 (gnu/linux)

I ported Eric Blake's test-memchr.c fix to test-memrchr.c, and fixed
another minor bug in test-getdate.c.  This fixed the two warnings that
are easy to fix on:

http://autobuild.josefsson.org/gnulib/log-200809290932420171000.txt

The rest are warnings about possibly uninitialized variables, but all
the code has '#ifdef lint' checks to work around it.  I'm not sure it is
worth any effort to try to do more.

/Simon

>From 47bf1430c04eb59f70e74f8b402a5ea23e5b891c Mon Sep 17 00:00:00 2001
From: Simon Josefsson <address@hidden>
Date: Tue, 30 Sep 2008 08:34:56 +0200
Subject: [PATCH] tests: avoid some compiler warnings
 * tests/test-memchr.c (main): Pass NULL indirectly.
 * tests/test-getdate.c (main): Remove unused variable 'ret'.

Signed-off-by: Simon Josefsson <address@hidden>
---
 ChangeLog            |    6 ++++++
 tests/test-getdate.c |    1 -
 tests/test-memrchr.c |    4 +++-
 3 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 295178d..df51cfd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2008-09-15  Simon Josefsson  <address@hidden>
+
+       tests: avoid some compiler warnings
+       * tests/test-memchr.c (main): Pass NULL indirectly.
+       * tests/test-getdate.c (main): Remove unused variable 'ret'.
+
 2008-09-29  Ondřej Vašík  <address@hidden>
 
        getdate.y: disallow countable dayshifts like "4 yesterday ago"
diff --git a/tests/test-getdate.c b/tests/test-getdate.c
index 874d918..3433c09 100644
--- a/tests/test-getdate.c
+++ b/tests/test-getdate.c
@@ -49,7 +49,6 @@
 int
 main (int argc, char **argv)
 {
-  bool ret;
   struct timespec result;
   struct timespec result2;
   struct timespec now;
diff --git a/tests/test-memrchr.c b/tests/test-memrchr.c
index 84f6c5b..f829a22 100644
--- a/tests/test-memrchr.c
+++ b/tests/test-memrchr.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 (MEMRCHR (input, 'a', n) == input + n - 1);
 
   ASSERT (MEMRCHR (input, 'a', 0) == NULL);
-  ASSERT (MEMRCHR (NULL, 'a', 0) == NULL);
+  ASSERT (MEMRCHR (nil, 'a', 0) == NULL);
 
   ASSERT (MEMRCHR (input, 'b', n) == input + n - 2);
   ASSERT (MEMRCHR (input, 'c', n) == input + n - 3);
-- 
1.5.6.5





reply via email to

[Prev in Thread] Current Thread [Next in Thread]