alexfh wrote:

> Is the proposed plan of action marking the functions `[[noreturn]]` ? As per 
> [#145166 
> (comment)](https://github.com/llvm/llvm-project/pull/145166#issuecomment-3004769089)
>  , marking the functions ``[[noreturn]]` was discouraged.

There are two problems here:
1. the problem demonstrated by the example in 
https://gcc.godbolt.org/z/bv1ac475d, i.e. that the `InferredNoReturnAttr` is 
attached to the explicit specialization of a function that does actually return 
(I think, it's not controversial that this is an incorrect behavior and should 
be fixed).
2. the general approach with deriving an implicit noreturn attribute from a 
function definition - this is debatable, and @erichkeane seems to agree with 
your approach, but I believe cross-function diagnostics in general have a 
potential for inconsistent behavior, e.g. when moving functions across 
translation units. I'd prefer to rely on explicitly stated noreturn annotations 
rather than deriving them from function definitions. IMO `[[noreturn]]` is a 
part of the function API, since it affects how callers can use it.

I'd like @erichkeane and @AaronBallman to chime in on the second part - maybe 
this should be reconsidered.

IMO, the motivating issue for this PR should be solved in the user code rather 
than in the compiler 
(https://github.com/llvm/llvm-project/issues/144952#issuecomment-3100190298).

Now, getting back to the issue # 1: if you have a trivial fix for this, please 
go ahead and implement it (assuming the decision on # 2 is to leave this 
feature in Clang). If the fix is not obvious, I'd suggest to revert the commit 
and re-send it for review together with the fix.

https://github.com/llvm/llvm-project/pull/145166
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to