Обсуждение: plperl_helpers.h fix for clang

Поиск
Список
Период
Сортировка

plperl_helpers.h fix for clang

От
Peter Eisentraut
Дата:
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?




Re: plperl_helpers.h fix for clang

От
Alex Hunsaker
Дата:
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().


Re: plperl_helpers.h fix for clang

От
Alex Hunsaker
Дата:
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...).


Re: plperl_helpers.h fix for clang

От
Peter Eisentraut
Дата:
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.



Re: plperl_helpers.h fix for clang

От
Alex Hunsaker
Дата:
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. :-) ]