[cfe-commits] [patch] Add the returns_twice attribute to know functions
Rafael Ávila de Espíndola
rafael.espindola at gmail.com
Tue Oct 11 15:49:59 PDT 2011
> Note that there *is* a subtyping relationship here: a normal
> function can be safely used as a returns_twice function (which simply
> never actually returns twice). But that's useless.
> I agree that abstractly this ought to be a type attribute, and I
> don't think it would be difficult to take advantage of the current
> 'noreturn conversion' hooks to make the (unsafe) implicit conversion
> work, but I'm not sure there's any real value to adding this
OK, so I think the consensus is
* The hard coded list will be removed after 3.0 branches and dragonegg
producing this attribute too.
* The attribute should be part of the type
* We should try to avoid allowing unsafe conversions like
int (*fptr)(jmp_buf) = &setjmp;
but a returns_twice function pointer can point to a function with an
otherwise matching type.
I will update the patch and add tests for that.
More information about the cfe-commits