1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-07-29 11:41:21 +03:00

Fix some warnings in the absence of FP round/exception support

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.
This commit is contained in:
Chris Metcalf
2014-12-30 14:11:13 -05:00
parent 0f9dfe0432
commit 1ff950ad20
7 changed files with 32 additions and 11 deletions

View File

@ -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]

View 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,
@ -636,7 +637,7 @@ test_single_exception (const char *test_name,
# endif
}
#endif
/* Test whether exceptions given by EXCEPTION are raised. Ignore thereby
allowed but not required exceptions.

View 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,6 +231,7 @@ 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)
@ -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

View 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

View 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++)

View 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++)
{

View 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;