https://gcc.gnu.org/bugzilla/show_bug.cgi?id=10837

--- Comment #30 from Xi Ruoyao <xry111 at gcc dot gnu.org> ---
(In reply to Lukas Grätz from comment #29)
> (In reply to Josh Haberman from comment #25)
> > As a result, I now agree with you that `musttail` addresses the complaint in
> > this bug.  While it is odd and unexpected that `noreturn` will inhibit tail
> > calls, I agree that `musttail` appears to override this behavior, providing
> > an escape hatch for users who want tail calls on `noreturn` functions.
> > 
> > It is somewhat unfortunate that this requires the attribute to be at every
> > call site,  instead of on the `noreturn` function itself, but at least it 
> > is 
> > possible.
> 
> Having a musttail attribute on the signature of the noreturn function itself
> is probably not a good idea, if you think about it more. Take the function
> abort(): If you want to change the signature, you need to change the
> standard library headers. And if you wrote a noreturn function like temp2()
> yourself, it is still not a good idea to force musttail on it, I would say.
> Because this is a big restriction on how your function can be called.

No, musttail is a statement attribute, not function attribute.  Thus you add it
at the statement calling abort(), not the system header.

Reply via email to