New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[PATCH] Internal cleanup in numeric.c, no functional changes #15636
Comments
From @petdanceCreated by @petdanceMinor internal cleanups in numeric.c * Simplified some variable instantiation in Perl_my_atof, including Perl Info
|
From @petdanceconst.patchdiff --git a/numeric.c b/numeric.c
index 0c73749..7e05966 100644
--- a/numeric.c
+++ b/numeric.c
@@ -1022,7 +1022,7 @@ Perl_grok_number_flags(pTHX_ const char *pv, STRLEN len, UV *valuep, U32 flags)
if ((s + 2 < send) && strchr("inqs#", toFOLD(*s))) {
/* Really detect inf/nan. Start at d, not s, since the above
* code might have already consumed the "1." or "1". */
- int infnan = Perl_grok_infnan(aTHX_ &d, send);
+ const int infnan = Perl_grok_infnan(aTHX_ &d, send);
if ((infnan & IS_NUMBER_INFINITY)) {
return (numtype | infnan); /* Keep sign for infinity. */
}
@@ -1089,7 +1089,7 @@ Perl_grok_atoUV(const char *pv, UV *valptr, const char** endptr)
/* This could be unrolled like in grok_number(), but
* the expected uses of this are not speed-needy, and
* unlikely to need full 64-bitness. */
- U8 digit = *s++ - '0';
+ const U8 digit = *s++ - '0';
if (val < uv_max_div_10 ||
(val == uv_max_div_10 && digit <= uv_max_mod_10)) {
val = val * 10 + digit;
@@ -1221,9 +1221,6 @@ Perl_my_atof(pTHX_ const char* s)
DECLARATION_FOR_LC_NUMERIC_MANIPULATION;
STORE_LC_NUMERIC_SET_TO_NEEDED();
if (PL_numeric_radix_sv && IN_LC(LC_NUMERIC)) {
- const char *standard = NULL, *local = NULL;
- bool use_standard_radix;
-
/* Look through the string for the first thing that looks like a
* decimal point: either the value in the current locale or the
* standard fallback of '.'. The one which appears earliest in the
@@ -1231,10 +1228,9 @@ Perl_my_atof(pTHX_ const char* s)
* that we have to determine this beforehand because on some
* systems, Perl_atof2 is just a wrapper around the system's atof.
* */
- standard = strchr(s, '.');
- local = strstr(s, SvPV_nolen(PL_numeric_radix_sv));
-
- use_standard_radix = standard && (!local || standard < local);
+ const char * const standard = strchr(s, '.');
+ const char * const local = strstr(s, SvPV_nolen(PL_numeric_radix_sv));
+ const bool use_standard_radix = standard && (!local || standard < local);
if (use_standard_radix)
SET_NUMERIC_STANDARD();
@@ -1266,7 +1262,7 @@ S_my_atof_infnan(pTHX_ const char* s, bool negative, const char* send, NV* value
{
const char *p0 = negative ? s - 1 : s;
const char *p = p0;
- int infnan = grok_infnan(&p, send);
+ const int infnan = grok_infnan(&p, send);
if (infnan && p != p0) {
/* If we can generate inf/nan directly, let's do so. */
#ifdef NV_INF
@@ -1428,9 +1424,9 @@ Perl_my_atof2(pTHX_ const char* orig, NV* value)
#if defined(NV_INF) || defined(NV_NAN)
{
- const char* endp;
+ char* endp;
if ((endp = S_my_atof_infnan(aTHX_ s, negative, send, value)))
- return (char*)endp;
+ return endp;
}
#endif
|
From @jkeenanOn Fri Sep 30 10:20:48 2016, petdance wrote:
Now available for smoke-testing in branch: smoke-me/jkeenan/petdance/129766-numeric-c -- |
The RT System itself - Status changed from 'new' to 'open' |
From @jkeenanOn Fri Sep 30 12:50:17 2016, jkeenan wrote:
The patch is failing to compile when you configure with '-Dcc=g++'. See smoke reports at http://perl.develop-help.com/?b=smoke-me%2Fjkeenan%2Fpetdance%2F129766-numeric-c I have locally reproduced the same type of failures as reported by George's g++ smoke runs at the above link. When I call 'make', I very quickly start to get warnings like these: ##### Eventually, 'make' collapses with output like this: ##### Transcripts available upon request, but these are easily reproducible. OTOH, on FreeBSD-10.3, where clang is the default cc, 'make' and 'make test_harness' completed successfully. -- |
From @jkeenanOn Sat Oct 01 06:20:14 2016, jkeenan wrote:
Possible false alarm! To create a branch for smoke testing, I forked from blead at: ##### vax-netbsd: do not export inf/nan which we do not have blead is failing to compile where -Dcc=g++'. See, e.g.: http://perl.develop-help.com/raw/?id=195564 So the real problem is probably in blead, not in this branch. Thank you very much. -- |
From @jkeenanOn Sat Oct 01 06:30:40 2016, jkeenan wrote:
Blead was broken in commit afabfeb, ##### PL_inf/PL_nan need different export with C++ So smoke-me/jkeenan/petdance/129766-numeric-c should now PASS when using '-Dcc=g++'. (I've confirmed that locally and hopefully smokers will confirm that as well.) Thank you very much. We now return this RT to normal discussion. -- |
From @petdanceHow long do patches typically need to simmer before getting applied? |
From @khwilliamsonOn 10/17/2016 08:17 AM, Andy Lester via RT wrote:
There's no typical number. It depends on if someone has the tuits, In your case, I think it got sidetracked by the other issue, and your |
From @khwilliamsonThanks, applied as 7eff3d3 |
@khwilliamson - Status changed from 'open' to 'pending release' |
From @khwilliamsonThank you for filing this report. You have helped make Perl better. With the release today of Perl 5.26.0, this and 210 other issues have been Perl 5.26.0 may be downloaded via: If you find that the problem persists, feel free to reopen this ticket. |
@khwilliamson - Status changed from 'pending release' to 'resolved' |
Migrated from rt.perl.org#129766 (status was 'resolved')
Searchable as RT129766$
The text was updated successfully, but these errors were encountered: