Blame SOURCES/perl-5.27.2-EU-Constant-avoid-uninit-warning.patch

243a19
From 389f3ef2fdfbba2c2816e7334a69a5f540c0a33d Mon Sep 17 00:00:00 2001
243a19
From: David Mitchell <davem@iabyn.com>
243a19
Date: Mon, 15 Dec 2014 16:14:13 +0000
243a19
Subject: [PATCH] EU::Constant: avoid 'uninit' warning
243a19
MIME-Version: 1.0
243a19
Content-Type: text/plain; charset=UTF-8
243a19
Content-Transfer-Encoding: 8bit
243a19
243a19
The code generated by ExtUtils::Constant can look something like:
243a19
243a19
static int
243a19
constant (..., IV *iv_return) {
243a19
   switch (...) {
243a19
     case ...:
243a19
       *iv_return = ...;
243a19
       return PERL_constant_ISIV;
243a19
     ...
243a19
  }
243a19
}
243a19
243a19
{
243a19
    int type;
243a19
    IV iv;
243a19
    type = constant(..., &iv;;
243a19
    switch (type) {
243a19
        case PERL_constant_ISIV:
243a19
            PUSHi(iv);
243a19
    ...
243a19
    }
243a19
}
243a19
243a19
and the compiler isn't clever enough to realise that the value of iv
243a19
is only used in the code path where its been set.
243a19
243a19
So initialise it to zero to shut gcc up. Ditto nv and pv.
243a19
243a19
Signed-off-by: Petr Písař <ppisar@redhat.com>
243a19
---
243a19
 cpan/ExtUtils-Constant/lib/ExtUtils/Constant.pm | 6 +++---
243a19
 1 file changed, 3 insertions(+), 3 deletions(-)
243a19
243a19
diff --git a/cpan/ExtUtils-Constant/lib/ExtUtils/Constant.pm b/cpan/ExtUtils-Constant/lib/ExtUtils/Constant.pm
243a19
index 0dc9258..cf0e1ca 100644
243a19
--- a/cpan/ExtUtils-Constant/lib/ExtUtils/Constant.pm
243a19
+++ b/cpan/ExtUtils-Constant/lib/ExtUtils/Constant.pm
243a19
@@ -198,17 +198,17 @@ $XS_subname(sv)
243a19
 EOT
243a19
 
243a19
   if ($params->{IV}) {
243a19
-    $xs .= "	IV		iv;\n";
243a19
+    $xs .= "	IV		iv = 0; /* avoid uninit var warning */\n";
243a19
   } else {
243a19
     $xs .= "	/* IV\t\tiv;\tUncomment this if you need to return IVs */\n";
243a19
   }
243a19
   if ($params->{NV}) {
243a19
-    $xs .= "	NV		nv;\n";
243a19
+    $xs .= "	NV		nv = 0.0; /* avoid uninit var warning */\n";
243a19
   } else {
243a19
     $xs .= "	/* NV\t\tnv;\tUncomment this if you need to return NVs */\n";
243a19
   }
243a19
   if ($params->{PV}) {
243a19
-    $xs .= "	const char	*pv;\n";
243a19
+    $xs .= "	const char	*pv = NULL; /* avoid uninit var warning */\n";
243a19
   } else {
243a19
     $xs .=
243a19
       "	/* const char\t*pv;\tUncomment this if you need to return PVs */\n";
243a19
-- 
243a19
2.9.4
243a19