This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCHv2 04/14] Refactor type specific macros using regexes
- From: Joseph Myers <joseph at codesourcery dot com>
- To: "Paul E. Murphy" <murphyp at linux dot vnet dot ibm dot com>
- Cc: <libc-alpha at sourceware dot org>
- Date: Mon, 23 May 2016 16:50:50 +0000
- Subject: Re: [PATCHv2 04/14] Refactor type specific macros using regexes
- Authentication-results: sourceware.org; auth=none
- References: <cover dot 1463779745 dot git dot murphyp at linux dot vnet dot ibm dot com> <125d41217079ffa464a93f944ab391a575f99ad3 dot 1463779745 dot git dot murphyp at linux dot vnet dot ibm dot com>
On Fri, 20 May 2016, Paul E. Murphy wrote:
> Replace most of the type specific macros with the equivalent
> type-generic macro using the following sed replacement command below:
>
> sed -ri -e 's/defined TEST_FLOAT/TEST_COND_binary32/' \
> -e 's/ndef TEST_FLOAT/ !TEST_COND_binary32/' \
> -e 's/def TEST_FLOAT/ TEST_COND_binary32/' \
> -e 's/defined TEST_DOUBLE/TEST_COND_binary64/'\
> -e 's/ndef TEST_DOUBLE/ !TEST_COND_binary64/' \
> -e 's/def TEST_DOUBLE/ TEST_COND_binary64/' \
> -e 's/defined TEST_LDOUBLE && //' \
> -e 's/ifdef TEST_LDOUBLE/if MANT_DIG >= 64/' \
> -e 's/defined TEST_LDOUBLE/MANT_DIG >= 64/' \
> -e '9941,10047!s/LDBL_(MIN_EXP|MAX_EXP|MANT_DIG)/\1/g' \
> libm-test.inc
>
> Note, TEST_LDOUBLE checks are replaced by MANT_DIG >= 64 excepting
> where another property of the type is being tested.
>
> Beware, the magic numbers of the final regex. This explicitly
> avoids converting the LDBL_ macros of the nexttoward tests. This
> function always takes a second long double argument.
You can avoid magic numbers by using a range matching regular expressions
for suitable lines before and after the nexttoward tests, which would make
this command more robust to changes in libm-test.inc / earlier patches.
> [TEST_LDOUBLE]: Change usage to TEST_COND_gt_binary64.
> [LDBL_MAX_EXP]: Change to TYPE_MAX_EXP.
> [LDBL_MIN_EXP]: Change to TYPE_MIN_EXP.
> [LDBL_MANT_DIG]: Change to TYPE_MANT_DIG, except for
> nexttoward tests.
This part of the ChangeLog entries obviously needs rewriting.
I think in this case it *does* make sense to include the generated changes
for review in the patch submission.
--
Joseph S. Myers
joseph@codesourcery.com