From a7548d41a7459ff85a751ae84b4bd77631833473 Mon Sep 17 00:00:00 2001 From: Joseph Myers Date: Sat, 4 May 2013 13:08:34 +0000 Subject: [PATCH] Use static initializers for constant variables in libm-test.inc. --- ChangeLog | 12 ++++++++++++ math/libm-test.inc | 49 ++++++++++++++++++---------------------------- 2 files changed, 31 insertions(+), 30 deletions(-) diff --git a/ChangeLog b/ChangeLog index fac3208a18..91cfb621c0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2013-05-04 Joseph Myers + + * math/libm-test.inc (plus_zero): Make const. Add initializer. + (minus_zero): Likewise. + (plus_infty): Likewise. + (minus_infty): Likewise. + (qnan_value): Likewise. + (max_value): Likewise. + (min_value): Likewise. + (min_subnorm_value): Likewise. + (initialize): Do not initialize those variables dynamically. + 2013-05-03 Roland McGrath * io/open.c (__open_2): Moved to ... diff --git a/math/libm-test.inc b/math/libm-test.inc index 759754734d..c58bd45678 100644 --- a/math/libm-test.inc +++ b/math/libm-test.inc @@ -231,9 +231,25 @@ static int output_max_error; /* Should the maximal errors printed? */ static int output_points; /* Should the single function results printed? */ static int ignore_max_ulp; /* Should we ignore max_ulp? */ -static FLOAT minus_zero, plus_zero; -static FLOAT plus_infty, minus_infty, qnan_value, max_value, min_value; -static FLOAT min_subnorm_value; +static const FLOAT plus_zero = CHOOSE (0.0L, 0.0, 0.0f, + 0.0L, 0.0, 0.0f); +static const FLOAT minus_zero = CHOOSE (-0.0L, -0.0, -0.0f, + -0.0L, -0.0, -0.0f); +static const FLOAT plus_infty = CHOOSE (HUGE_VALL, HUGE_VAL, HUGE_VALF, + HUGE_VALL, HUGE_VAL, HUGE_VALF); +static const FLOAT minus_infty = CHOOSE (-HUGE_VALL, -HUGE_VAL, -HUGE_VALF, + -HUGE_VALL, -HUGE_VAL, -HUGE_VALF); +static const FLOAT qnan_value = FUNC (__builtin_nan) (""); +static const FLOAT max_value = CHOOSE (LDBL_MAX, DBL_MAX, FLT_MAX, + LDBL_MAX, DBL_MAX, FLT_MAX); +static const FLOAT min_value = CHOOSE (LDBL_MIN, DBL_MIN, FLT_MIN, + LDBL_MIN, DBL_MIN, FLT_MIN); +static const FLOAT min_subnorm_value = CHOOSE (__LDBL_DENORM_MIN__, + __DBL_DENORM_MIN__, + __FLT_DENORM_MIN__, + __LDBL_DENORM_MIN__, + __DBL_DENORM_MIN__, + __FLT_DENORM_MIN__); static FLOAT max_error, real_max_error, imag_max_error; @@ -13814,33 +13830,6 @@ initialize (void) { fpstack_test ("start *init*"); - plus_zero = 0.0; - qnan_value = FUNC (__builtin_nan) (""); - minus_zero = FUNC (copysign) (0.0, -1.0); - plus_infty = CHOOSE (HUGE_VALL, HUGE_VAL, HUGE_VALF, - HUGE_VALL, HUGE_VAL, HUGE_VALF); - minus_infty = CHOOSE (-HUGE_VALL, -HUGE_VAL, -HUGE_VALF, - -HUGE_VALL, -HUGE_VAL, -HUGE_VALF); - max_value = CHOOSE (LDBL_MAX, DBL_MAX, FLT_MAX, - LDBL_MAX, DBL_MAX, FLT_MAX); - min_value = CHOOSE (LDBL_MIN, DBL_MIN, FLT_MIN, - LDBL_MIN, DBL_MIN, FLT_MIN); - min_subnorm_value = CHOOSE (__LDBL_DENORM_MIN__, - __DBL_DENORM_MIN__, - __FLT_DENORM_MIN__, - __LDBL_DENORM_MIN__, - __DBL_DENORM_MIN__, - __FLT_DENORM_MIN__); - - (void) &plus_zero; - (void) &qnan_value; - (void) &minus_zero; - (void) &plus_infty; - (void) &minus_infty; - (void) &max_value; - (void) &min_value; - (void) &min_subnorm_value; - /* Clear all exceptions. From now on we must not get random exceptions. */ feclearexcept (FE_ALL_EXCEPT); errno = 0;