plperl_helpers.h fix for clang

Started by Peter Eisentrautalmost 14 years ago5 messageshackers
Jump to latest
#1Peter Eisentraut
peter_e@gmx.net

clang warns about that newish SvREFCNT_inc(sv) call in plperl_helpers.h
about an unused return value, because the macro expansion of
SvREFCNT_inc(sv) returns sv. The merit of that warning might be
debatable, but it seems easy to fix by using SvREFCNT_inc_void(sv)
instead.

And we could use SvREFCNT_inc_simple_void(sv), since sv doesn't have any
side effects, but that's optional.

Any concerns?

#2Alex Hunsaker
badalex@gmail.com
In reply to: Peter Eisentraut (#1)
Re: plperl_helpers.h fix for clang

On Thu, May 24, 2012 at 11:19 AM, Peter Eisentraut <peter_e@gmx.net> wrote:

clang warns about that newish SvREFCNT_inc(sv) call in plperl_helpers.h
about an unused return value, because the macro expansion of
SvREFCNT_inc(sv) returns sv.  The merit of that warning might be
debatable, but it seems easy to fix by using SvREFCNT_inc_void(sv)
instead.

And we could use SvREFCNT_inc_simple_void(sv), since sv doesn't have any
side effects, but that's optional.

Any concerns?

Hrm I can't seem to find either of those functions in my copy of perl
5.8.1 or 5.16.0. I also looked for "_inc_" in the event I got casing
wrong :-(.

Perhaps I misunderstood, are you proposing to introduce those
functions? Im fine with that. Or doing (void)SvREFCNT_inc().

#3Alex Hunsaker
badalex@gmail.com
In reply to: Alex Hunsaker (#2)
Re: plperl_helpers.h fix for clang

On Thu, May 24, 2012 at 11:31 AM, Alex Hunsaker <badalex@gmail.com> wrote:

On Thu, May 24, 2012 at 11:19 AM, Peter Eisentraut <peter_e@gmx.net> wrote:

And we could use SvREFCNT_inc_simple_void(sv), since sv doesn't have any
side effects, but that's optional.

Hrm I can't seem to find either of those functions in my copy of perl
5.8.1 or 5.16.0. I also looked for "_inc_" in the event I got casing
wrong :-(.

Doh, it is indeed there in 5.16.0, looks like it got added in 5.10
:-(. (I was on the wrong branch...).

#4Peter Eisentraut
peter_e@gmx.net
In reply to: Alex Hunsaker (#3)
Re: plperl_helpers.h fix for clang

On tor, 2012-05-24 at 11:36 -0600, Alex Hunsaker wrote:

On Thu, May 24, 2012 at 11:31 AM, Alex Hunsaker <badalex@gmail.com> wrote:

On Thu, May 24, 2012 at 11:19 AM, Peter Eisentraut <peter_e@gmx.net> wrote:

And we could use SvREFCNT_inc_simple_void(sv), since sv doesn't have any
side effects, but that's optional.

Hrm I can't seem to find either of those functions in my copy of perl
5.8.1 or 5.16.0. I also looked for "_inc_" in the event I got casing
wrong :-(.

Doh, it is indeed there in 5.16.0, looks like it got added in 5.10
:-(. (I was on the wrong branch...).

It's in ppport.h.

#5Alex Hunsaker
badalex@gmail.com
In reply to: Peter Eisentraut (#4)
Re: plperl_helpers.h fix for clang

On Thu, May 24, 2012 at 12:03 PM, Peter Eisentraut <peter_e@gmx.net> wrote:

On tor, 2012-05-24 at 11:36 -0600, Alex Hunsaker wrote:

Doh, it is indeed there in 5.16.0, looks like it got added in 5.10
:-(. (I was on the wrong branch...).

It's in ppport.h.

Don't see any reason not to then. +1 for the simple_void variant.

[ I completely forgot about ppport.h and was just checking against the
perl source. :-) ]