From: Bruno Haible <bruno@clisp.org>
Date: Sun, 27 Jan 2019 11:24:47 +0000 (+0100)
Subject: tests: Fix some "unused variable" warnings.
X-Git-Tag: v1.0~5108
X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=4ca4f8f0cf1bb2a451813d3df9a734076f5fc398;p=gnulib.git

tests: Fix some "unused variable" warnings.

* tests/test-fts.c (fts_dealloc): Remove unused variable.
* tests/unigbrk/test-uc-grapheme-breaks.c (main): Likewise.
* tests/test-striconveh.c (main): Move some variable into the
'#if HAVE_ICONV'.
* tests/test-striconveha.c (main): Likewise.
* tests/uniconv/test-u8-conv-from-enc.c (main): Likewise.
* tests/uniconv/test-u16-conv-from-enc.c (main): Likewise.
* tests/uniconv/test-u32-conv-from-enc.c (main): Likewise.
* tests/uniconv/test-u8-conv-to-enc.c (main): Likewise.
* tests/uniconv/test-u16-conv-to-enc.c (main): Likewise.
* tests/uniconv/test-u32-conv-to-enc.c (main): Likewise.
* tests/uniconv/test-u8-strconv-from-enc.c (main): Likewise.
* tests/uniconv/test-u16-strconv-from-enc.c (main): Likewise.
* tests/uniconv/test-u32-strconv-from-enc.c (main): Likewise.
* tests/uniconv/test-u8-strconv-to-enc.c (main): Likewise.
* tests/uniconv/test-u16-strconv-to-enc.c (main): Likewise.
* tests/uniconv/test-u32-strconv-to-enc.c (main): Likewise.
* tests/test-tsearch.c (main): Move some variable into the
'#if HAVE_INITSTATE'.
---

diff --git a/ChangeLog b/ChangeLog
index 2f23c644cb..d7d1f81d55 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,26 @@
+2019-01-27  Bruno Haible  <bruno@clisp.org>
+
+	tests: Fix some "unused variable" warnings.
+	* tests/test-fts.c (fts_dealloc): Remove unused variable.
+	* tests/unigbrk/test-uc-grapheme-breaks.c (main): Likewise.
+	* tests/test-striconveh.c (main): Move some variable into the
+	'#if HAVE_ICONV'.
+	* tests/test-striconveha.c (main): Likewise.
+	* tests/uniconv/test-u8-conv-from-enc.c (main): Likewise.
+	* tests/uniconv/test-u16-conv-from-enc.c (main): Likewise.
+	* tests/uniconv/test-u32-conv-from-enc.c (main): Likewise.
+	* tests/uniconv/test-u8-conv-to-enc.c (main): Likewise.
+	* tests/uniconv/test-u16-conv-to-enc.c (main): Likewise.
+	* tests/uniconv/test-u32-conv-to-enc.c (main): Likewise.
+	* tests/uniconv/test-u8-strconv-from-enc.c (main): Likewise.
+	* tests/uniconv/test-u16-strconv-from-enc.c (main): Likewise.
+	* tests/uniconv/test-u32-strconv-from-enc.c (main): Likewise.
+	* tests/uniconv/test-u8-strconv-to-enc.c (main): Likewise.
+	* tests/uniconv/test-u16-strconv-to-enc.c (main): Likewise.
+	* tests/uniconv/test-u32-strconv-to-enc.c (main): Likewise.
+	* tests/test-tsearch.c (main): Move some variable into the
+	'#if HAVE_INITSTATE'.
+
 2019-01-27  Bruno Haible  <bruno@clisp.org>
 
 	unigbrk/uc-grapheme-breaks: Fix build failure.
diff --git a/tests/test-fts.c b/tests/test-fts.c
index 4c6bdb6e94..2938550db3 100644
--- a/tests/test-fts.c
+++ b/tests/test-fts.c
@@ -44,7 +44,6 @@ fts_dealloc (void)
 {
   static char dir[] = "./";
   static char *const curr_dir[2] = { dir, 0 };
-  FTSENT *e;
   FTS *ftsp = fts_open (curr_dir, FTS_NOSTAT | FTS_PHYSICAL | FTS_CWDFD, 0);
   if (ftsp)
     {
diff --git a/tests/test-striconveh.c b/tests/test-striconveh.c
index f6fb60b788..6cb7f1f8cf 100644
--- a/tests/test-striconveh.c
+++ b/tests/test-striconveh.c
@@ -44,6 +44,7 @@ new_offsets (size_t n)
 int
 main ()
 {
+#if HAVE_ICONV
   static enum iconv_ilseq_handler handlers[] =
     { iconveh_error, iconveh_question_mark, iconveh_escape_sequence };
   size_t indirect;
@@ -51,7 +52,6 @@ main ()
   size_t o;
   size_t i;
 
-#if HAVE_ICONV
   /* Assume that iconv() supports at least the encodings ASCII, ISO-8859-1,
      ISO-8859-2, and UTF-8.  */
   iconv_t cd_ascii_to_88591 = iconv_open ("ISO-8859-1", "ASCII");
diff --git a/tests/test-striconveha.c b/tests/test-striconveha.c
index ba32e05358..930c97a3cf 100644
--- a/tests/test-striconveha.c
+++ b/tests/test-striconveha.c
@@ -45,13 +45,13 @@ new_offsets (size_t n)
 int
 main ()
 {
+#if HAVE_ICONV
   static enum iconv_ilseq_handler handlers[] =
     { iconveh_error, iconveh_question_mark, iconveh_escape_sequence };
   size_t h;
   size_t o;
   size_t i;
 
-#if HAVE_ICONV
   /* Assume that iconv() supports at least the encodings ASCII, ISO-8859-1,
      ISO-8859-2, and UTF-8.  */
 
diff --git a/tests/test-tsearch.c b/tests/test-tsearch.c
index a546cf7df3..808a827003 100644
--- a/tests/test-tsearch.c
+++ b/tests/test-tsearch.c
@@ -264,11 +264,12 @@ int
 main (int argc, char **argv)
 {
   int total_error = 0;
-  static char state[8] = { 1, 2, 3, 4, 5, 6, 7, 8 };
   void *root = NULL;
   int i, j;
 
 #if HAVE_INITSTATE
+  static char state[8] = { 1, 2, 3, 4, 5, 6, 7, 8 };
+
   initstate (SEED, state, 8);
 #endif
 
diff --git a/tests/uniconv/test-u16-conv-from-enc.c b/tests/uniconv/test-u16-conv-from-enc.c
index 76ab740cbe..50983fa63e 100644
--- a/tests/uniconv/test-u16-conv-from-enc.c
+++ b/tests/uniconv/test-u16-conv-from-enc.c
@@ -41,13 +41,13 @@ new_offsets (size_t n)
 int
 main ()
 {
+#if HAVE_ICONV
   static enum iconv_ilseq_handler handlers[] =
     { iconveh_error, iconveh_question_mark, iconveh_escape_sequence };
   size_t h;
   size_t o;
   size_t i;
 
-#if HAVE_ICONV
   /* Assume that iconv() supports at least the encodings ASCII, ISO-8859-1,
      ISO-8859-2, and UTF-8.  */
 
diff --git a/tests/uniconv/test-u16-conv-to-enc.c b/tests/uniconv/test-u16-conv-to-enc.c
index a6cf189cfc..0d34816ed3 100644
--- a/tests/uniconv/test-u16-conv-to-enc.c
+++ b/tests/uniconv/test-u16-conv-to-enc.c
@@ -40,13 +40,13 @@ new_offsets (size_t n)
 int
 main ()
 {
+#if HAVE_ICONV
   static enum iconv_ilseq_handler handlers[] =
     { iconveh_error, iconveh_question_mark, iconveh_escape_sequence };
   size_t h;
   size_t o;
   size_t i;
 
-#if HAVE_ICONV
   /* Assume that iconv() supports at least the encodings ASCII, ISO-8859-1,
      ISO-8859-2, and UTF-8.  */
 
diff --git a/tests/uniconv/test-u16-strconv-from-enc.c b/tests/uniconv/test-u16-strconv-from-enc.c
index c890dfd338..f7972c2570 100644
--- a/tests/uniconv/test-u16-strconv-from-enc.c
+++ b/tests/uniconv/test-u16-strconv-from-enc.c
@@ -29,11 +29,11 @@ extern int iconv_supports_encoding (const char *encoding);
 int
 main ()
 {
+#if HAVE_ICONV
   static enum iconv_ilseq_handler handlers[] =
     { iconveh_error, iconveh_question_mark, iconveh_escape_sequence };
   size_t h;
 
-#if HAVE_ICONV
   /* Assume that iconv() supports at least the encodings ASCII, ISO-8859-1,
      ISO-8859-2, and UTF-8.  */
 
diff --git a/tests/uniconv/test-u16-strconv-to-enc.c b/tests/uniconv/test-u16-strconv-to-enc.c
index 55bc71ec69..c29f19a7c2 100644
--- a/tests/uniconv/test-u16-strconv-to-enc.c
+++ b/tests/uniconv/test-u16-strconv-to-enc.c
@@ -29,11 +29,11 @@
 int
 main ()
 {
+#if HAVE_ICONV
   static enum iconv_ilseq_handler handlers[] =
     { iconveh_error, iconveh_question_mark, iconveh_escape_sequence };
   size_t h;
 
-#if HAVE_ICONV
   /* Assume that iconv() supports at least the encodings ASCII, ISO-8859-1,
      ISO-8859-2, and UTF-8.  */
 
diff --git a/tests/uniconv/test-u32-conv-from-enc.c b/tests/uniconv/test-u32-conv-from-enc.c
index 0a4552f7f1..d41201a202 100644
--- a/tests/uniconv/test-u32-conv-from-enc.c
+++ b/tests/uniconv/test-u32-conv-from-enc.c
@@ -41,13 +41,13 @@ new_offsets (size_t n)
 int
 main ()
 {
+#if HAVE_ICONV
   static enum iconv_ilseq_handler handlers[] =
     { iconveh_error, iconveh_question_mark, iconveh_escape_sequence };
   size_t h;
   size_t o;
   size_t i;
 
-#if HAVE_ICONV
   /* Assume that iconv() supports at least the encodings ASCII, ISO-8859-1,
      ISO-8859-2, and UTF-8.  */
 
diff --git a/tests/uniconv/test-u32-conv-to-enc.c b/tests/uniconv/test-u32-conv-to-enc.c
index 7cf06ee485..b2d48cef90 100644
--- a/tests/uniconv/test-u32-conv-to-enc.c
+++ b/tests/uniconv/test-u32-conv-to-enc.c
@@ -40,13 +40,13 @@ new_offsets (size_t n)
 int
 main ()
 {
+#if HAVE_ICONV
   static enum iconv_ilseq_handler handlers[] =
     { iconveh_error, iconveh_question_mark, iconveh_escape_sequence };
   size_t h;
   size_t o;
   size_t i;
 
-#if HAVE_ICONV
   /* Assume that iconv() supports at least the encodings ASCII, ISO-8859-1,
      ISO-8859-2, and UTF-8.  */
 
diff --git a/tests/uniconv/test-u32-strconv-from-enc.c b/tests/uniconv/test-u32-strconv-from-enc.c
index 30e5a72706..94bab31fec 100644
--- a/tests/uniconv/test-u32-strconv-from-enc.c
+++ b/tests/uniconv/test-u32-strconv-from-enc.c
@@ -29,11 +29,11 @@ extern int iconv_supports_encoding (const char *encoding);
 int
 main ()
 {
+#if HAVE_ICONV
   static enum iconv_ilseq_handler handlers[] =
     { iconveh_error, iconveh_question_mark, iconveh_escape_sequence };
   size_t h;
 
-#if HAVE_ICONV
   /* Assume that iconv() supports at least the encodings ASCII, ISO-8859-1,
      ISO-8859-2, and UTF-8.  */
 
diff --git a/tests/uniconv/test-u32-strconv-to-enc.c b/tests/uniconv/test-u32-strconv-to-enc.c
index 68ec0dde8e..615c61e83d 100644
--- a/tests/uniconv/test-u32-strconv-to-enc.c
+++ b/tests/uniconv/test-u32-strconv-to-enc.c
@@ -28,11 +28,11 @@
 int
 main ()
 {
+#if HAVE_ICONV
   static enum iconv_ilseq_handler handlers[] =
     { iconveh_error, iconveh_question_mark, iconveh_escape_sequence };
   size_t h;
 
-#if HAVE_ICONV
   /* Assume that iconv() supports at least the encodings ASCII, ISO-8859-1,
      ISO-8859-2, and UTF-8.  */
 
diff --git a/tests/uniconv/test-u8-conv-from-enc.c b/tests/uniconv/test-u8-conv-from-enc.c
index 68b927a403..de9fef3486 100644
--- a/tests/uniconv/test-u8-conv-from-enc.c
+++ b/tests/uniconv/test-u8-conv-from-enc.c
@@ -41,13 +41,13 @@ new_offsets (size_t n)
 int
 main ()
 {
+#if HAVE_ICONV
   static enum iconv_ilseq_handler handlers[] =
     { iconveh_error, iconveh_question_mark, iconveh_escape_sequence };
   size_t h;
   size_t o;
   size_t i;
 
-#if HAVE_ICONV
   /* Assume that iconv() supports at least the encodings ASCII, ISO-8859-1,
      ISO-8859-2, and UTF-8.  */
 
diff --git a/tests/uniconv/test-u8-conv-to-enc.c b/tests/uniconv/test-u8-conv-to-enc.c
index 5440820de8..9e2b098915 100644
--- a/tests/uniconv/test-u8-conv-to-enc.c
+++ b/tests/uniconv/test-u8-conv-to-enc.c
@@ -41,13 +41,13 @@ new_offsets (size_t n)
 int
 main ()
 {
+#if HAVE_ICONV
   static enum iconv_ilseq_handler handlers[] =
     { iconveh_error, iconveh_question_mark, iconveh_escape_sequence };
   size_t h;
   size_t o;
   size_t i;
 
-#if HAVE_ICONV
   /* Assume that iconv() supports at least the encodings ASCII, ISO-8859-1,
      ISO-8859-2, and UTF-8.  */
 
diff --git a/tests/uniconv/test-u8-strconv-from-enc.c b/tests/uniconv/test-u8-strconv-from-enc.c
index 5a5924b9e3..14a6e87057 100644
--- a/tests/uniconv/test-u8-strconv-from-enc.c
+++ b/tests/uniconv/test-u8-strconv-from-enc.c
@@ -29,11 +29,11 @@ extern int iconv_supports_encoding (const char *encoding);
 int
 main ()
 {
+#if HAVE_ICONV
   static enum iconv_ilseq_handler handlers[] =
     { iconveh_error, iconveh_question_mark, iconveh_escape_sequence };
   size_t h;
 
-#if HAVE_ICONV
   /* Assume that iconv() supports at least the encodings ASCII, ISO-8859-1,
      ISO-8859-2, and UTF-8.  */
 
diff --git a/tests/uniconv/test-u8-strconv-to-enc.c b/tests/uniconv/test-u8-strconv-to-enc.c
index 7eeff5e438..8d9d86785a 100644
--- a/tests/uniconv/test-u8-strconv-to-enc.c
+++ b/tests/uniconv/test-u8-strconv-to-enc.c
@@ -29,11 +29,11 @@
 int
 main ()
 {
+#if HAVE_ICONV
   static enum iconv_ilseq_handler handlers[] =
     { iconveh_error, iconveh_question_mark, iconveh_escape_sequence };
   size_t h;
 
-#if HAVE_ICONV
   /* Assume that iconv() supports at least the encodings ASCII, ISO-8859-1,
      ISO-8859-2, and UTF-8.  */
 
diff --git a/tests/unigbrk/test-uc-grapheme-breaks.c b/tests/unigbrk/test-uc-grapheme-breaks.c
index 7716f8b760..af21902bfe 100644
--- a/tests/unigbrk/test-uc-grapheme-breaks.c
+++ b/tests/unigbrk/test-uc-grapheme-breaks.c
@@ -139,8 +139,6 @@ main (int argc, char *argv[])
       p = line;
       do
         {
-          ucs4_t next;
-
           p += strspn (p, " \t\r\n");
           if (!strncmp (p, "\303\267" /* ÷ */, 2))
             {