bug-time
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug-time] time-1.8: building with gcc7 and --enable-gcc-warnings fa


From: Jim Meyering
Subject: Re: [Bug-time] time-1.8: building with gcc7 and --enable-gcc-warnings fails
Date: Wed, 8 Nov 2017 13:21:44 -0800

On Wed, Nov 8, 2017 at 12:52 PM, Assaf Gordon <address@hidden> wrote:
> Hello Jim,
>
> On 2017-11-08 07:35 AM, Jim Meyering wrote:
>>
>> Thanks a lot for reviving GNU time and for making a new release.
>> Sorry I didn't see this sooner:
>> ...
>> src/time.c: In function 'getargs':
>> src/time.c:664:4: warning: this statement may fall through
>> [-Wimplicit-fallthrough=]
>>      usage (EXIT_SUCCESS);
>>      ^~~~~~~~~~~~~~~~~~~~
>> src/time.c:665:2: note: here
>>    case 'o':
>>    ^~~~
>
>
> Thanks for the report.
>
> I wonder could this be a false-positive?
>
> The function usage() never returns, it always calls exit(3),
> and exit(3) is marked as "__attribute__ ((__noreturn__));".
>
> If I specifically mark usage() as "noreturn",
> the warning disappears.
>
> Does gcc-7 not able to deduce the non-return-ness of usage() ?

Yes, it does feel like it should deduce that...
A workaround is to declare usage like this:

  void usage (int status) ATTRIBUTE_NORETURN;



reply via email to

[Prev in Thread] Current Thread [Next in Thread]