summaryrefslogtreecommitdiff
path: root/pp_ctl.c
diff options
context:
space:
mode:
authorDavid Mitchell <davem@iabyn.com>2013-11-30 12:16:17 +0000
committerDavid Mitchell <davem@iabyn.com>2013-11-30 12:16:17 +0000
commitbd7084a616a85eea78f3601244f5f6d1ca4f3906 (patch)
tree48d5f1b60c27de73215c69b9981afa303048b889 /pp_ctl.c
parent1818d3caff904c667c8db00213e74c3c5c6e3dd1 (diff)
downloadperl-bd7084a616a85eea78f3601244f5f6d1ca4f3906.tar.gz
revert pp_formline -Wformat-nonliteral fix
Revert the part of 5d37acd6b65eb421e938a3fde62cc1edde467dae that was intended to silence non-literal format warnings. It's giving compiler errors on AIX due (I suspect) to overlong macro expansions. The next commit will fix the warning in a more prosaic fashion
Diffstat (limited to 'pp_ctl.c')
-rw-r--r--pp_ctl.c51
1 files changed, 22 insertions, 29 deletions
diff --git a/pp_ctl.c b/pp_ctl.c
index 01b3b9cd1e..95727f201a 100644
--- a/pp_ctl.c
+++ b/pp_ctl.c
@@ -479,6 +479,7 @@ PP(pp_formline)
STRLEN linemax; /* estimate of output size in bytes */
bool item_is_utf8 = FALSE;
bool targ_is_utf8 = FALSE;
+ const char *fmt;
MAGIC *mg = NULL;
U8 *source; /* source of bytes to append */
STRLEN to_copy; /* how may bytes to append */
@@ -794,13 +795,28 @@ PP(pp_formline)
}
case FF_0DECIMAL: /* like FF_DECIMAL but for 0### */
- case FF_DECIMAL: /* do @##, ^##, where <arg>=(precision|flags) */
- {
- I32 form_num_point;
-
arg = *fpc++;
- form_num_point = (arg & FORM_NUM_POINT);
+#if defined(USE_LONG_DOUBLE)
+ fmt = (const char *)
+ ((arg & FORM_NUM_POINT) ?
+ "%#0*.*" PERL_PRIfldbl : "%0*.*" PERL_PRIfldbl);
+#else
+ fmt = (const char *)
+ ((arg & FORM_NUM_POINT) ?
+ "%#0*.*f" : "%0*.*f");
+#endif
+ goto ff_dec;
+ case FF_DECIMAL: /* do @##, ^##, where <arg>=(precision|flags) */
+ arg = *fpc++;
+#if defined(USE_LONG_DOUBLE)
+ fmt = (const char *)
+ ((arg & FORM_NUM_POINT) ? "%#*.*" PERL_PRIfldbl : "%*.*" PERL_PRIfldbl);
+#else
+ fmt = (const char *)
+ ((arg & FORM_NUM_POINT) ? "%#*.*f" : "%*.*f");
+#endif
+ ff_dec:
/* If the field is marked with ^ and the value is undefined,
blank it out. */
if ((arg & FORM_NUM_BLANK) && !SvOK(sv)) {
@@ -822,34 +838,11 @@ PP(pp_formline)
{
STORE_NUMERIC_STANDARD_SET_LOCAL();
arg &= ~(FORM_NUM_POINT|FORM_NUM_BLANK);
- my_snprintf(t,
- SvLEN(PL_formtarget) - (t - SvPVX(PL_formtarget)),
- (fpc[-2] == FF_0DECIMAL)
- ?
- form_num_point
-#if defined(USE_LONG_DOUBLE)
- ? "%#0*.*" PERL_PRIfldbl
- : "%0*.*" PERL_PRIfldbl
-#else
- ? "%#0*.*f"
- : "%0*.*f"
-#endif
- :
- form_num_point
-#if defined(USE_LONG_DOUBLE)
- ? "%#*.*" PERL_PRIfldbl
- : "%*.*" PERL_PRIfldbl
-#else
- ? "%#*.*f"
- : "%*.*f"
-#endif
- , (int) fieldsize, (int) arg, value);
-
+ my_snprintf(t, SvLEN(PL_formtarget) - (t - SvPVX(PL_formtarget)), fmt, (int) fieldsize, (int) arg, value);
RESTORE_NUMERIC_STANDARD();
}
t += fieldsize;
break;
- }
case FF_NEWLINE: /* delete trailing spaces, then append \n */
f++;