diff options
author | Yves Orton <demerphq@gmail.com> | 2023-02-18 03:09:35 +0100 |
---|---|---|
committer | Yves Orton <demerphq@gmail.com> | 2023-02-19 09:42:04 +0800 |
commit | 553cf0eba0eec3b18c81a40d258405a01765e06d (patch) | |
tree | ca2c95bd3543c36d08da267654e9265fb75463a9 /ext | |
parent | 6dc20c079fd2534c3c46b72016af032eb0fd0824 (diff) | |
download | perl-553cf0eba0eec3b18c81a40d258405a01765e06d.tar.gz |
mro.xs - silence maybe-uninitialized warning on gcc 12
Silence the following bogus warning:
mro.xs:561:25: warning:
‘fq_subname_len’ may be used uninitialized [-Wmaybe-uninitialized]
561 | subname_len = fq_subname_len - (subname - fq_subname);
The code does not need to be structured the way it was, and we actually
don't need to define fq_subname_len at all. So restructure the code and
remove it and make gcc-12 shut up.
Fixes GH Issue #20816
Diffstat (limited to 'ext')
-rw-r--r-- | ext/mro/mro.pm | 2 | ||||
-rw-r--r-- | ext/mro/mro.xs | 12 |
2 files changed, 4 insertions, 10 deletions
diff --git a/ext/mro/mro.pm b/ext/mro/mro.pm index d95733bd41..6637ea8eb7 100644 --- a/ext/mro/mro.pm +++ b/ext/mro/mro.pm @@ -12,7 +12,7 @@ use warnings; # mro.pm versions < 1.00 reserved for MRO::Compat # for partial back-compat to 5.[68].x -our $VERSION = '1.27'; +our $VERSION = '1.28'; require XSLoader; XSLoader::load('mro'); diff --git a/ext/mro/mro.xs b/ext/mro/mro.xs index 79293c035a..ba9921f469 100644 --- a/ext/mro/mro.xs +++ b/ext/mro/mro.xs @@ -505,7 +505,6 @@ mro__nextcan(...) cxix = __dopoptosub_at(ccstack, cxix); for (;;) { GV* cvgv; - STRLEN fq_subname_len; /* we may be in a higher stacklevel, so dig down deeper */ while (cxix < 0) { @@ -546,19 +545,14 @@ mro__nextcan(...) if(SvPOK(sv)) { fq_subname = SvPVX(sv); - fq_subname_len = SvCUR(sv); - - subname_utf8 = SvUTF8(sv) ? 1 : 0; subname = strrchr(fq_subname, ':'); - } else { - subname = NULL; - } - + } if(!subname) Perl_croak(aTHX_ "next::method/next::can/maybe::next::method cannot find enclosing method"); + subname_utf8 = SvUTF8(sv) ? 1 : 0; subname++; - subname_len = fq_subname_len - (subname - fq_subname); + subname_len = SvCUR(sv) - (subname - fq_subname); if(memEQs(subname, subname_len, "__ANON__")) { cxix = __dopoptosub_at(ccstack, cxix - 1); continue; |