bug-gnulib
[Top][All Lists]
Advanced

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

[PATCH] test-nl_langinfo: avoid "unsigned expression >= 0 is always true


From: Jim Meyering
Subject: [PATCH] test-nl_langinfo: avoid "unsigned expression >= 0 is always true" warning
Date: Wed, 13 Oct 2010 10:34:48 +0200

Hi Bruno,

Is this change ok with you?
Alternatively, I'd be slightly happier simply
to remove the warning-evoking tests.

Here's one of the 5 warnings:

  test-nl_langinfo.c:56: warning: comparison of unsigned expression >= 0 \
    is always true [-Wtype-limits]


>From 3dd5d3a98d4f6a4fe8d693e124c4e34558687db6 Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Wed, 13 Oct 2010 10:32:39 +0200
Subject: [PATCH] test-nl_langinfo: avoid "unsigned expression >= 0 is always 
true" warning

* tests/test-nl_langinfo.c (main): Disable assertions that
strlen (s) >= 0.  That is guaranteed always to be true.
---
 ChangeLog                |    4 ++++
 tests/test-nl_langinfo.c |   10 +++++-----
 2 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index e7838e1..9d998f5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2010-10-13  Jim Meyering  <address@hidden>

+       test-nl_langinfo: avoid "unsigned expression >= 0 is always true" 
warning
+       * tests/test-nl_langinfo.c (main): Disable assertions that
+       strlen (s) >= 0.  That is guaranteed always to be true.
+
        test-select: avoid warn_unused_result warnings
        * tests/test-select.c: Include "macros.h".
        ASSERT that each call to read, write, and pipe succeeds.
diff --git a/tests/test-nl_langinfo.c b/tests/test-nl_langinfo.c
index ec89b3f..8e9c56a 100644
--- a/tests/test-nl_langinfo.c
+++ b/tests/test-nl_langinfo.c
@@ -51,7 +51,7 @@ main (int argc, char *argv[])
     }
   /* nl_langinfo items of the LC_NUMERIC category */
   ASSERT (strlen (nl_langinfo (RADIXCHAR)) > 0);
-  ASSERT (strlen (nl_langinfo (THOUSEP)) >= 0);
+  /* ASSERT (strlen (nl_langinfo (THOUSEP)) >= 0); */
   /* nl_langinfo items of the LC_TIME category */
   ASSERT (strlen (nl_langinfo (D_T_FMT)) > 0);
   ASSERT (strlen (nl_langinfo (D_FMT)) > 0);
@@ -97,10 +97,10 @@ main (int argc, char *argv[])
   ASSERT (strlen (nl_langinfo (ABMON_10)) > 0);
   ASSERT (strlen (nl_langinfo (ABMON_11)) > 0);
   ASSERT (strlen (nl_langinfo (ABMON_12)) > 0);
-  ASSERT (strlen (nl_langinfo (ERA)) >= 0);
-  ASSERT (strlen (nl_langinfo (ERA_D_FMT)) >= 0);
-  ASSERT (strlen (nl_langinfo (ERA_D_T_FMT)) >= 0);
-  ASSERT (strlen (nl_langinfo (ERA_T_FMT)) >= 0);
+  /* ASSERT (strlen (nl_langinfo (ERA)) >= 0); */
+  /* ASSERT (strlen (nl_langinfo (ERA_D_FMT)) >= 0); */
+  /* ASSERT (strlen (nl_langinfo (ERA_D_T_FMT)) >= 0); */
+  /* ASSERT (strlen (nl_langinfo (ERA_T_FMT)) >= 0); */
   ASSERT (nl_langinfo (ALT_DIGITS) != NULL);
   /* nl_langinfo items of the LC_MONETARY category */
   {
--
1.7.3.1.104.gc752e



reply via email to

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