bug-gnulib
[Top][All Lists]
Advanced

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

[PATCH] tests: fix compiler warnings


From: Eric Blake
Subject: [PATCH] tests: fix compiler warnings
Date: Wed, 3 Nov 2010 16:54:57 -0600

Detected by icc.  The first three files are real test bugs, the
last merely silences a warning about mixing an int with an enum type.

* tests/test-getopt.h (test_getopt): Fix condition.
* tests/test-getopt_long.h (test_getopt_long): Likewise.
* tests/test-pipe2.c (main): Likewise.
* tests/test-quotearg-simple.c (main): Avoid icc warning.

Signed-off-by: Eric Blake <address@hidden>
---
 ChangeLog                    |    6 ++++++
 tests/test-getopt.h          |    2 +-
 tests/test-getopt_long.h     |    2 +-
 tests/test-pipe2.c           |    4 ++--
 tests/test-quotearg-simple.c |    2 +-
 5 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 73e19da..68c0a75 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2010-11-03  Eric Blake  <address@hidden>

+       tests: fix compiler warnings
+       * tests/test-getopt.h (test_getopt): Fix condition.
+       * tests/test-getopt_long.h (test_getopt_long): Likewise.
+       * tests/test-pipe2.c (main): Likewise.
+       * tests/test-quotearg-simple.c (main): Avoid icc warning.
+
        utimens: fix broken m4 test
        * m4/utimens.m4 (gl_UTIMENS): Include correct headers.

diff --git a/tests/test-getopt.h b/tests/test-getopt.h
index 8baa39d..12859ac 100644
--- a/tests/test-getopt.h
+++ b/tests/test-getopt.h
@@ -1187,7 +1187,7 @@ test_getopt (void)
       ASSERT (q_value == NULL);
       ASSERT (non_options_count == 0);
       ASSERT (unrecognized == 0);
-      ASSERT (optind = 1);
+      ASSERT (optind == 1);
       ASSERT (!output);
     }
 #endif /* GNULIB_TEST_GETOPT_GNU */
diff --git a/tests/test-getopt_long.h b/tests/test-getopt_long.h
index 0e58fec..e1bf732 100644
--- a/tests/test-getopt_long.h
+++ b/tests/test-getopt_long.h
@@ -1747,7 +1747,7 @@ test_getopt_long (void)
       ASSERT (q_value == NULL);
       ASSERT (non_options_count == 0);
       ASSERT (unrecognized == 0);
-      ASSERT (optind = 1);
+      ASSERT (optind == 1);
     }

   /* Check that the '+' flag has to come first.  */
diff --git a/tests/test-pipe2.c b/tests/test-pipe2.c
index e8e5798..a39de58 100644
--- a/tests/test-pipe2.c
+++ b/tests/test-pipe2.c
@@ -117,8 +117,8 @@ main ()
         ASSERT (fd[0] >= 0);
         ASSERT (fd[1] >= 0);
         ASSERT (fd[0] != fd[1]);
-        ASSERT (is_open (fd[0]) >= 0);
-        ASSERT (is_open (fd[1]) >= 0);
+        ASSERT (is_open (fd[0]));
+        ASSERT (is_open (fd[1]));
         if (use_cloexec)
           {
             ASSERT (is_cloexec (fd[0]));
diff --git a/tests/test-quotearg-simple.c b/tests/test-quotearg-simple.c
index 095b199..bd637ee 100644
--- a/tests/test-quotearg-simple.c
+++ b/tests/test-quotearg-simple.c
@@ -244,7 +244,7 @@ main (int argc _GL_UNUSED, char *argv[])
   ASSERT (!isprint ('\033'));
   for (i = literal_quoting_style; i <= clocale_quoting_style; i++)
     {
-      set_quoting_style (NULL, i);
+      set_quoting_style (NULL, (enum quoting_style) i);
       compare_strings (use_quotearg_buffer, &results_g[i].group1, ascii_only);
       compare_strings (use_quotearg, &results_g[i].group2, ascii_only);
       if (i == c_quoting_style)
-- 
1.7.3.2




reply via email to

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