summaryrefslogtreecommitdiff
path: root/toke.c
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>1999-08-01 22:22:51 +0000
committerJarkko Hietaniemi <jhi@iki.fi>1999-08-01 22:22:51 +0000
commitcf2093f6405d08be483e037b6052608c46952a75 (patch)
treea2572a825ae30eabcd1fee0cac65751bef6a4d05 /toke.c
parentad7e816fc202b9506cd8e0633196331ccf37f264 (diff)
downloadperl-cf2093f6405d08be483e037b6052608c46952a75.tar.gz
64-bit work. Now 32-bit platforms get a 100% make test
with -Duse64bits (using long long). Tested in Solaris 2.6 sparc RH Linux 6.0 x86 (and Digital IX 4.0D, to get a true 64-bit opinion). Now e.g. 'print unpack "q", pack "q", 12345678901' should work on such 32-bit platforms. Still a lot of printf()s behind -D which wrongly assume that %ld/%lx and (long) are a good combination. Introducing a slew of new macros intended to be used in printf() format strings: e. g. PERL_PRId64 is the string to be used when printing an IV, printf("%" PERL_PRId64 "\n", iv). The PRI... naming follows the C9X naming of <inttypes.h> macros. p4raw-id: //depot/cfgperl@3861
Diffstat (limited to 'toke.c')
-rw-r--r--toke.c29
1 files changed, 23 insertions, 6 deletions
diff --git a/toke.c b/toke.c
index c4521c5bb6..64485ac75c 100644
--- a/toke.c
+++ b/toke.c
@@ -3562,8 +3562,13 @@ Perl_yylex(pTHX)
TERM(THING);
case KEY___LINE__:
- yylval.opval = (OP*)newSVOP(OP_CONST, 0,
- Perl_newSVpvf(aTHX_ "%ld", (long)PL_curcop->cop_line));
+#ifdef IV_IS_QUAD
+ yylval.opval = (OP*)newSVOP(OP_CONST, 0,
+ Perl_newSVpvf(aTHX_ "%" PERL_PRId64, (IV)PL_curcop->cop_line));
+#else
+ yylval.opval = (OP*)newSVOP(OP_CONST, 0,
+ Perl_newSVpvf(aTHX_ "%ld", (long)PL_curcop->cop_line));
+#endif
TERM(THING);
case KEY___PACKAGE__:
@@ -6745,16 +6750,28 @@ Perl_yyerror(pTHX_ char *s)
where = SvPVX(where_sv);
}
msg = sv_2mortal(newSVpv(s, 0));
+#ifdef IV_IS_QUAD
+ Perl_sv_catpvf(aTHX_ msg, " at %_ line %" PERL_PRId64 ", ",
+ GvSV(PL_curcop->cop_filegv), (IV)PL_curcop->cop_line);
+#else
Perl_sv_catpvf(aTHX_ msg, " at %_ line %ld, ",
- GvSV(PL_curcop->cop_filegv), (long)PL_curcop->cop_line);
+ GvSV(PL_curcop->cop_filegv), (long)PL_curcop->cop_line);
+#endif
if (context)
Perl_sv_catpvf(aTHX_ msg, "near \"%.*s\"\n", contlen, context);
else
Perl_sv_catpvf(aTHX_ msg, "%s\n", where);
if (PL_multi_start < PL_multi_end && (U32)(PL_curcop->cop_line - PL_multi_end) <= 1) {
- Perl_sv_catpvf(aTHX_ msg,
- " (Might be a runaway multi-line %c%c string starting on line %ld)\n",
- (int)PL_multi_open,(int)PL_multi_close,(long)PL_multi_start);
+#ifdef IV_IS_QUAD
+ Perl_sv_catpvf(aTHX_ msg,
+ " (Might be a runaway multi-line %c%c string starting on line %" PERL_\
+PRId64 ")\n",
+ (int)PL_multi_open,(int)PL_multi_close,(IV)PL_multi_start);
+#else
+ Perl_sv_catpvf(aTHX_ msg,
+ " (Might be a runaway multi-line %c%c string starting on line %ld)\n",
+ (int)PL_multi_open,(int)PL_multi_close,(long)PL_multi_start);
+#endif
PL_multi_end = 0;
}
if (PL_in_eval & EVAL_WARNONLY)