This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH, libiberty]: Avoid "enum conversion when passing argument 1 of âgetrusageâ is invalid in C++" warning
- From: Ian Lance Taylor <iant at golang dot org>
- To: Uros Bizjak <ubizjak at gmail dot com>
- Cc: "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>
- Date: Thu, 9 Jul 2015 07:32:38 -0700
- Subject: Re: [PATCH, libiberty]: Avoid "enum conversion when passing argument 1 of âgetrusageâ is invalid in C++" warning
- Authentication-results: sourceware.org; auth=none
- References: <CAFULd4bJLL-Ux_Xa5ws=6yc0-fyi8DM9X=3gH88DLjxiMFXK3g at mail dot gmail dot com> <CAOyqgcUh0fXEH7Rdp7UMS8geQTPq+TrPvO26GEDQamaBNHTq3A at mail dot gmail dot com> <CAFULd4Zk=Rva-Yrwi9QQ-hBEAeeS6aW_HGXUZxMTiYkbs1m8kg at mail dot gmail dot com>
On Thu, Jul 9, 2015 at 7:15 AM, Uros Bizjak <ubizjak@gmail.com> wrote:
> On Thu, Jul 9, 2015 at 3:00 PM, Ian Lance Taylor <iant@golang.org> wrote:
>> On Wed, Jul 1, 2015 at 3:07 AM, Uros Bizjak <ubizjak@gmail.com> wrote:
>>>
>>> This patch avoids "enum conversion when passing argument 1 of
>>> âgetrusageâ is invalid in C++" warning when compiling getruntime.c.
>>> The condition is copied from sys/resource.h.
>>
>> Sorry, I've been on vacation.
>>
>> I think it would be a lot nicer to always use RUSAGE_SELF in the
>> function, and earlier in the file write
>>
>> #ifndef RUSAGE_SELF
>> #define RUSAGE_SELF 0
>> #endif
>
> Indeed, attached patch builds without warning.
>
> 2015-07-09 Uros Bizjak <ubizjak@gmail.com>
>
> * getruntime.c (RUSAGE_SELF): Define if not already defined.
> (get_runtime): Use RUSAGE_SELF as argument 1 of getrusage call.
>
> Bootstrapped on x86_64-linux-gnu.
>
> OK for mainline SVN?
This is OK. Thanks for following up.
Ian