summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Mitchell <davem@iabyn.com>2015-06-02 13:50:06 +0100
committerDavid Mitchell <davem@iabyn.com>2015-06-19 08:44:17 +0100
commitdb48a4ad5ec99b1dd01eab799b5b382ca05f6c30 (patch)
treeeecb5b5fe202bcea957f64c3175a30d5f837e2d5
parente1a10f35503e6758601f1a5c97682620c4644bc8 (diff)
downloadperl-db48a4ad5ec99b1dd01eab799b5b382ca05f6c30.tar.gz
Perl_report_uninit(): simplify code
Simplify the code in this function a bit. It should have no functional effect, but will make the next commit easier.
-rw-r--r--sv.c31
1 files changed, 14 insertions, 17 deletions
diff --git a/sv.c b/sv.c
index f2f86d052d..500c2335b9 100644
--- a/sv.c
+++ b/sv.c
@@ -16200,10 +16200,10 @@ Print appropriate "Use of uninitialized variable" warning.
void
Perl_report_uninit(pTHX_ const SV *uninit_sv)
{
- if (PL_op) {
- SV* varname = NULL;
- const char *desc;
+ const char *desc = NULL;
+ SV* varname = NULL;
+ if (PL_op) {
desc = PL_op->op_type == OP_STRINGIFY && PL_op->op_folded
? "join or string"
: OP_DESC(PL_op);
@@ -16212,21 +16212,18 @@ Perl_report_uninit(pTHX_ const SV *uninit_sv)
if (varname)
sv_insert(varname, 0, 0, " ", 1);
}
- /* PL_warn_uninit_sv is constant */
- GCC_DIAG_IGNORE(-Wformat-nonliteral);
- /* diag_listed_as: Use of uninitialized value%s */
- Perl_warner(aTHX_ packWARN(WARN_UNINITIALIZED), PL_warn_uninit_sv,
- SVfARG(varname ? varname : &PL_sv_no),
- " in ", desc);
- GCC_DIAG_RESTORE;
- }
- else {
- /* PL_warn_uninit is constant */
- GCC_DIAG_IGNORE(-Wformat-nonliteral);
- Perl_warner(aTHX_ packWARN(WARN_UNINITIALIZED), PL_warn_uninit,
- "", "", "");
- GCC_DIAG_RESTORE;
}
+ /* PL_warn_uninit_sv is constant */
+ GCC_DIAG_IGNORE(-Wformat-nonliteral);
+ if (desc)
+ /* diag_listed_as: Use of uninitialized value%s */
+ Perl_warner(aTHX_ packWARN(WARN_UNINITIALIZED), PL_warn_uninit_sv,
+ SVfARG(varname ? varname : &PL_sv_no),
+ " in ", desc);
+ else
+ Perl_warner(aTHX_ packWARN(WARN_UNINITIALIZED), PL_warn_uninit,
+ "", "", "");
+ GCC_DIAG_RESTORE;
}
/*