diff options
author | Paul E. Murphy <murphyp@linux.vnet.ibm.com> | 2016-07-15 10:57:07 -0500 |
---|---|---|
committer | Paul E. Murphy <murphyp@linux.vnet.ibm.com> | 2016-08-05 14:38:57 -0500 |
commit | d4cf1331007743c21e4f03603add48a107a6857d (patch) | |
tree | 079add94e814723052a046bdf3836a8fec58b9a0 /math/gen-libm-test.pl | |
parent | 89a12e6f8e0a9776ea52389c58bf77aba87fd243 (diff) | |
download | glibc-d4cf1331007743c21e4f03603add48a107a6857d.tar.gz glibc-d4cf1331007743c21e4f03603add48a107a6857d.tar.xz glibc-d4cf1331007743c21e4f03603add48a107a6857d.zip |
Improve gen-libm-test.pl LIT() application
When bootstrapping float128, this exposed a number of areas where the L suffix is incorrectly applied to simple expressions when it should be applied to each constant in the expression. In order to stave off more macros in libm-test.inc, apply_lit is made slightly more intelligent. It will now split expressions based on space characters, and attempt to apply LIT() to each token. Having done this, there are numerous spacing issues within libm-test.inc which have been fixed. The above is problematic when the L real suffix is not the most expressive modifier, and the compiler complains (i.e ppc64) or silently truncates a value (i.e ppc64).
Diffstat (limited to 'math/gen-libm-test.pl')
-rwxr-xr-x | math/gen-libm-test.pl | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/math/gen-libm-test.pl b/math/gen-libm-test.pl index aa66e7676f..577964c3c6 100755 --- a/math/gen-libm-test.pl +++ b/math/gen-libm-test.pl @@ -163,7 +163,7 @@ sub show_exceptions { # Apply the LIT(x) macro to a literal floating point constant # and strip any existing suffix. -sub apply_lit { +sub _apply_lit { my ($lit) = @_; my $exp_re = "([+-])?[[:digit:]]+"; # Don't wrap something that does not look like a: @@ -180,6 +180,21 @@ sub apply_lit { return "LIT (${lit})"; } +# Apply LIT macro to individual tokens within an expression. +# +# This function assumes the C expression follows GNU coding +# standards. Specifically, a space separates each lexical +# token. Otherwise, this post-processing may apply LIT +# incorrectly, or around an entire expression. +sub apply_lit { + my ($lit) = @_; + my @toks = split (/ /, $lit); + foreach (@toks) { + $_ = _apply_lit ($_); + } + return join (' ', @toks); +} + # Parse the arguments to TEST_x_y sub parse_args { my ($file, $descr, $args) = @_; |