bug-gnulib
[Top][All Lists]
Advanced

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

vasnprintf tests: avoid warnings


From: Bruno Haible
Subject: vasnprintf tests: avoid warnings
Date: Sat, 22 Apr 2017 15:01:17 +0200
User-agent: KMail/5.1.3 (Linux/4.4.0-72-generic; KDE/5.18.0; x86_64; ; )

On Mac OS X, I'm seeing these warnings:


test-vasnprintf-posix3.c:64:1: warning: unused function 'test_vasnprintf' 
[-Wunused-function]
test_vasnprintf ()
^
test-vasnprintf-posix3.c:70:1: warning: unused function 'test_asnprintf' 
[-Wunused-function]
test_asnprintf ()
^


This fixes it:

2017-04-22  Bruno Haible  <address@hidden>

        vasnprintf tests: Avoid warnings.
        * tests/test-vasnprintf-posix3.c (test_function, my_asnprintf,
        test_vasnprintf, test_asnprintf): Don't define if there's nothing to
        test.

diff --git a/tests/test-vasnprintf-posix3.c b/tests/test-vasnprintf-posix3.c
index 0e8f934..c198526 100644
--- a/tests/test-vasnprintf-posix3.c
+++ b/tests/test-vasnprintf-posix3.c
@@ -26,13 +26,14 @@
 
 #include "macros.h"
 
+/* glibc >= 2.2 supports the 'I' flag, and in glibc >= 2.2.3 the fa_IR
+   locale defines the 'outdigits' to be U+06F0..U+06F9.
+   So we test for glibc >= 2.3.  */
+#if (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 3)) && !defined 
__UCLIBC__
+
 static void
 test_function (char * (*my_asnprintf) (char *, size_t *, const char *, ...))
 {
-  /* glibc >= 2.2 supports the 'I' flag, and in glibc >= 2.2.3 the fa_IR
-     locale defines the 'outdigits' to be U+06F0..U+06F9.
-     So we test for glibc >= 2.3.  */
-#if (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 3)) && !defined 
__UCLIBC__
   /* Test that the 'I' flag is supported.  */
   {
     size_t length;
@@ -45,7 +46,6 @@ test_function (char * (*my_asnprintf) (char *, size_t *, 
const char *, ...))
     ASSERT (length == strlen (result));
     free (result);
   }
-#endif
 }
 
 static char *
@@ -72,6 +72,8 @@ test_asnprintf ()
   test_function (asnprintf);
 }
 
+#endif
+
 int
 main (int argc, char *argv[])
 {




reply via email to

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