develooper Front page | perl.perl5.porters | Postings from May 2010

Re: [PATCH] enum conversion warnings in pp_sys.c

From:
Rafael Garcia-Suarez
Date:
May 3, 2010 05:30
Subject:
Re: [PATCH] enum conversion warnings in pp_sys.c
Message ID:
m2ib77c1dce1005030530z623ee838tff21e3d0bbd3d3e2@mail.gmail.com
On 27 April 2010 11:15, Robin Barker <r.m.barker@btinternet.com> wrote:
> On Apr 26, 3:49 pm, r...@consttype.org (Rafael Garcia-Suarez) wrote:
>> On 23 April 2010 18:02, Robin Barker <perlbug-follo...@perl.org> wrote:
>>
>> > I get a warning with gcc 4.5.0 from pp_sys.c
>>
>> > pp_sys.c: In function ‘Perl_pp_getpriority’:
>> > pp_sys.c:4412:5: warning: enum conversion when passing argument 1 of ‘getpriority’ is invalid in C++
>> > /usr/include/sys/resource.h:94:12: note: expected ‘__priority_which_t’ but argument is of type ‘int’
>>
>> > and a similar warning for Perl_pp_setpriority.
>>
>> > The patch fixes this by casting argument 1 to (__priority_which_t)
>>
>> But __priority_which_t is a Linux typedef, right ? (or at least a
>> glibc thing, but not a gcc thing)
>> So your patch isn't portable ?
>
> If I include defined(_GNU_SOURCE) in the #if would it be portable?
> I can't find helful documentation of __USE_GNU or _GNU_SOURCE or
> __priority_which_t.

Me neither. Maybe use __GLIBC__ instead ?
See also this neat site for reference on the predefined C symbols :
http://predef.sourceforge.net/



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About