[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: Paul Eggert
Subject: Re: Making _Noreturn a no-op in < Clang 16?
Date: Thu, 19 Jan 2023 13:20:38 -0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.6.0

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:

  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.

> Is there any precedent wrt
> handling miscompilations for actively supported compilers in gnulib and such?

We've run into them before; I don't know of a list of instances. Generally speaking if the workaround is easy and harmless we can install it, otherwise we tell users to get a working compiler.

reply via email to

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