summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2011-04-26 11:02:45 +0100
committerSteffen Mueller <smueller@cpan.org>2011-05-30 23:11:34 +0200
commitd960932e73717fecc3073e297386a0dd86d81d15 (patch)
tree04d3a9120b50027c24f34223cd84f481bd8e90ed
parentbe5d102143381d766b0ff4bb09798d2392201212 (diff)
downloadperl-d960932e73717fecc3073e297386a0dd86d81d15.tar.gz
S_doparseform() should return void, not OP*, as it should use Perl_die not DIE
a1b950687051c32e added an error condition in S_doparseform() but used DIE(...) to report it. DIE is defined as C<return Perl_die>, which acts as a hint to the compiler about the control flow [as Perl_die() never returns], but also forces the return type to be OP *. Whilst this is appropriate for pp functions, it's not for S_doparseform() - a1b950687051c32e had to change the return type to OP* and return NULL, just to appease DIE(). Hence use Perl_die() instead, remove return statements, and remove the didn't-return-NULL (dead) code from pp_formline.
-rw-r--r--embed.fnc2
-rw-r--r--pp_ctl.c12
-rw-r--r--proto.h3
3 files changed, 6 insertions, 11 deletions
diff --git a/embed.fnc b/embed.fnc
index 65116ad681..f32471cfdf 100644
--- a/embed.fnc
+++ b/embed.fnc
@@ -1721,7 +1721,7 @@ snR |char * |bytes_to_uni |NN const U8 *start|STRLEN len|NN char *dest
#if defined(PERL_IN_PP_CTL_C)
sR |OP* |docatch |NULLOK OP *o
sR |OP* |dofindlabel |NN OP *o|NN const char *label|NN OP **opstack|NN OP **oplimit
-sR |OP* |doparseform |NN SV *sv
+s |void |doparseform |NN SV *sv
snR |bool |num_overflow |NV value|I32 fldsize|I32 frcsize
sR |I32 |dopoptoeval |I32 startingblock
sR |I32 |dopoptogiven |I32 startingblock
diff --git a/pp_ctl.c b/pp_ctl.c
index 1b0b5f706b..4fb3b40ee8 100644
--- a/pp_ctl.c
+++ b/pp_ctl.c
@@ -547,19 +547,16 @@ PP(pp_formline)
bool item_is_utf8 = FALSE;
bool targ_is_utf8 = FALSE;
SV * nsv = NULL;
- OP * parseres = NULL;
const char *fmt;
if (!SvMAGICAL(tmpForm) || !SvCOMPILED(tmpForm)) {
if (SvREADONLY(tmpForm)) {
SvREADONLY_off(tmpForm);
- parseres = doparseform(tmpForm);
+ doparseform(tmpForm);
SvREADONLY_on(tmpForm);
}
else
- parseres = doparseform(tmpForm);
- if (parseres)
- return parseres;
+ doparseform(tmpForm);
}
SvPV_force(PL_formtarget, len);
if (SvTAINTED(tmpForm))
@@ -4917,7 +4914,7 @@ PP(pp_break)
RETURNOP(cx->blk_givwhen.leave_op);
}
-STATIC OP *
+static void
S_doparseform(pTHX_ SV *sv)
{
STRLEN len;
@@ -5132,8 +5129,7 @@ S_doparseform(pTHX_ SV *sv)
SvCOMPILED_on(sv);
if (unchopnum && repeat)
- DIE(aTHX_ "Repeated format line will never terminate (~~ and @#)");
- return 0;
+ Perl_die(aTHX_ "Repeated format line will never terminate (~~ and @#)");
}
diff --git a/proto.h b/proto.h
index c83fd12fc5..a733e50d6f 100644
--- a/proto.h
+++ b/proto.h
@@ -5710,8 +5710,7 @@ STATIC OP* S_dofindlabel(pTHX_ OP *o, const char *label, OP **opstack, OP **opli
#define PERL_ARGS_ASSERT_DOFINDLABEL \
assert(o); assert(label); assert(opstack); assert(oplimit)
-STATIC OP* S_doparseform(pTHX_ SV *sv)
- __attribute__warn_unused_result__
+STATIC void S_doparseform(pTHX_ SV *sv)
__attribute__nonnull__(pTHX_1);
#define PERL_ARGS_ASSERT_DOPARSEFORM \
assert(sv)