]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Fix some warnings in the absence of FP round/exception support
authorChris Metcalf <cmetcalf@ezchip.com>
Tue, 30 Dec 2014 19:11:13 +0000 (14:11 -0500)
committerChris Metcalf <cmetcalf@ezchip.com>
Tue, 30 Dec 2014 19:11:13 +0000 (14:11 -0500)
Due to tile missing a bunch of FP exception and rounding
support, the tests generate warnings.  These changes fix the
warnings by just not compiling some unused functions, and
adding some attribute ((unused)) tags.

ChangeLog
math/libm-test.inc
math/test-fenv.c
setjmp/tst-setjmp-fp.c
stdio-common/tst-printf-round.c
stdlib/tst-strtod-round.c
stdlib/tst-strtod-underflow.c

index 5780c3a7f0ad89854966389e0eadaffc839c7742..d6c2d287f66667dec6cb0b4c81e3bd2ab84b2f1c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2014-12-30  Chris Metcalf  <cmetcalf@ezchip.com>
+
+       * math/test-fenv.c (test_single_exception, set_single_exc,
+       feenv_nomask_test, feenv_mask_test, feexcp_nomask_test,
+       feexcp_mask_test, feenable_test, fe_single_test): Add
+       [!FE_ALL_EXCEPT] test so these routines are not compiled in the
+       case where they are not used.
+       * math/libm-test.inc: Likewise.
+       * setjmp/test-setjmp-fp.c: Mark attribute ((unused)) on variable
+       unused in the absence of FP rounding/exception support.
+       * stdio-common/tst-printf-round.c: Likewise.
+       * stdlib/tst-strtod-round.c: Likewise.
+       * stdlib/tst-strtod-underflow.c: Likewise.
+
 2014-12-30  Joseph Myers  <joseph@codesourcery.com>
 
        [BZ #17723]
index f86a4fa0542a0330929ab973c2f7658c89a39887..b44b2db7c9583759f626965ef70d7657b6c3248e 100644 (file)
@@ -590,6 +590,7 @@ print_complex_max_error (const char *func_name)
 }
 
 
+#if FE_ALL_EXCEPT
 /* Test whether a given exception was raised.  */
 static void
 test_single_exception (const char *test_name,
@@ -598,7 +599,7 @@ test_single_exception (const char *test_name,
                       int fe_flag,
                       const char *flag_name)
 {
-#ifndef TEST_INLINE
+# ifndef TEST_INLINE
   int ok = 1;
   if (exception & exc_flag)
     {
@@ -634,9 +635,9 @@ test_single_exception (const char *test_name,
   if (!ok)
     ++noErrors;
 
-#endif
+# endif
 }
-
+#endif
 
 /* Test whether exceptions given by EXCEPTION are raised.  Ignore thereby
    allowed but not required exceptions.
index 23e47d4f363487f65b9b5a6715f4b4344ed21d66..0783fb1c5ca3617feb0cfef2fdc3a376f697a0f0 100644 (file)
@@ -54,6 +54,7 @@
 
 static int count_errors;
 
+#if FE_ALL_EXCEPT
 /* Test whether a given exception was raised.  */
 static void
 test_single_exception (short int exception,
@@ -84,6 +85,7 @@ test_single_exception (short int exception,
         }
     }
 }
+#endif
 
 static void
 test_exceptions (const char *test_name, short int exception,
@@ -164,6 +166,7 @@ test_rounding (const char *test_name, int rounding_mode)
 }
 
 
+#if FE_ALL_EXCEPT
 static void
 set_single_exc (const char *test_name, int fe_exc, fexcept_t exception)
 {
@@ -195,6 +198,7 @@ set_single_exc (const char *test_name, int fe_exc, fexcept_t exception)
   feclearexcept (exception);
   test_exceptions (str, ALL_EXC ^ fe_exc, 0);
 }
+#endif
 
 static void
 fe_tests (void)
@@ -227,11 +231,12 @@ fe_tests (void)
 #endif
 }
 
+#if FE_ALL_EXCEPT
 /* Test that program aborts with no masked interrupts */
 static void
 feenv_nomask_test (const char *flag_name, int fe_exc)
 {
-#if defined FE_NOMASK_ENV
+# if defined FE_NOMASK_ENV
   int status;
   pid_t pid;
 
@@ -247,13 +252,13 @@ feenv_nomask_test (const char *flag_name, int fe_exc)
   pid = fork ();
   if (pid == 0)
     {
-#ifdef RLIMIT_CORE
+#  ifdef RLIMIT_CORE
       /* Try to avoid dumping core.  */
       struct rlimit core_limit;
       core_limit.rlim_cur = 0;
       core_limit.rlim_max = 0;
       setrlimit (RLIMIT_CORE, &core_limit);
-#endif
+#  endif
 
       fesetenv (FE_NOMASK_ENV);
       feraiseexcept (fe_exc);
@@ -284,7 +289,7 @@ feenv_nomask_test (const char *flag_name, int fe_exc)
        ++count_errors;
       }
   }
-#endif
+# endif
 }
 
 /* Test that program doesn't abort with default environment */
@@ -613,6 +618,7 @@ fe_single_test (const char *flag_name, int fe_exc)
   feenv_mask_test (flag_name, fe_exc);
   feenable_test (flag_name, fe_exc);
 }
+#endif
 
 
 static void
index d84c47ed5c4a4ce02053e119a784944dc3c1db06..8cdb5356a15004e1cbc7c9ca87d4b00db54a2fb8 100644 (file)
@@ -22,7 +22,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 
-static jmp_buf env;
+static jmp_buf __attribute__ ((unused)) env;
 static int result = 0;
 
 #if defined FE_TONEAREST && defined FE_TOWARDZERO
index 5035ddae4ce44b50df6751fa313a22b4bda30731..6022edf26debe9d8e4e2483b4bbb2871ec2df4c5 100644 (file)
@@ -164,7 +164,7 @@ test_hex_in_one_mode (double d, const char *fmt, const char *const expected[4],
 static int
 do_test (void)
 {
-  int save_round_mode = fegetround ();
+  int save_round_mode __attribute__ ((unused)) = fegetround ();
   int result = 0;
 
   for (size_t i = 0; i < sizeof (dec_tests) / sizeof (dec_tests[0]); i++)
index cbde4574515899a9591f0d58bc4dbd0c58c3e3ba..2a278d0871f63b8a4ccfb05c56c65709fcce4057 100644 (file)
@@ -7874,7 +7874,7 @@ test_in_one_mode (const char *s, const struct test_results *expected,
 static int
 do_test (void)
 {
-  int save_round_mode = fegetround ();
+  int save_round_mode __attribute__ ((unused)) = fegetround ();
   int result = 0;
   for (size_t i = 0; i < sizeof (tests) / sizeof (tests[0]); i++)
     {
index bc2374188bdf67f072abfa6002481868dda7a82b..82bb483fcf88dddb00da41b8a253e574d1227f57 100644 (file)
@@ -171,7 +171,7 @@ test_in_one_mode (const char *s, enum underflow_case c, int rm,
 static int
 do_test (void)
 {
-  int save_round_mode = fegetround ();
+  int save_round_mode __attribute__ ((unused)) = fegetround ();
   int result = 0;
 #ifdef FE_TONEAREST
   const int fe_tonearest = FE_TONEAREST;