[cfe-commits] [patch] Add the returns_twice attribute to know functions

Jakob Stoklund Olesen stoklund at 2pi.dk
Tue Oct 11 10:02:40 PDT 2011

On Oct 11, 2011, at 8:30 AM, Douglas Gregor wrote:

> Alternatively, we could take returns_twice out of the type system entirely. Is there value in declaring a function pointer to a returns_twice function, and having that be a distinct type from a similar function pointer to any function? If not, then perhaps returns_twice should be just a declaration attribute, and not have any impact on the type system. 

The thought of calling vfork() through a function pointer is very scary indeed, but the calling function needs to know that the called function may return twice.

The returns_twice attribute affects code generation in the caller, not in the callee.

I think that means it needs to be a type attribute.

However, if we allow this:

  int (*fptr)(jmp_buf) = &setjmp;

We lose the information anyway.


More information about the cfe-commits mailing list