[Top][All Lists]

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

Re: Making _Noreturn a no-op in < Clang 16?

From: Sam James
Subject: Re: Making _Noreturn a no-op in < Clang 16?
Date: Thu, 19 Jan 2023 21:30:05 +0000

> On 19 Jan 2023, at 21:20, Paul Eggert <eggert@cs.ucla.edu> wrote:
> On 1/19/23 12:44, Sam James wrote:
>> _Noreturn is pretty much just an optimisation (and I'm not convinced that 
>> it's _needed_  in a lot of cases, rather just a useful hint).
> _Noreturn is not just an optimization: it's also useful for static checking. 
> For example:
>  int
>  f (int x)
>  {
>     if (x < INT_MAX)
>       return x + 1;
>     error (1, 0, "x is too large");
>  }
> Since error is _Noreturn the compiler knows not to warn that F might return 
> garbage. It's useful to suppress false alarms, even when Clang is the 
> compiler.

Right, I just meant that we don't tend to care about quieting warnings with 
older compilers,
and it's not useful from a static analysis perspective here either given that 
older Clangs can't be trusted.

It is of course useful as an attribute in general. I don't think either of 
these things are really
a downside to committing the workaround here. If we get folks who get build 
failures with extra warnings
enabled, we can tell them to upgrade their compiler.

Attachment: signature.asc
Description: Message signed with OpenPGP

reply via email to

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