This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: ObjC++: fix testcase failures on Darwin

imagine if C where defined so that int i; in the presence of setjmp/ longjmp were required to work.

I was thinking about the same thing :-)

Having a flag for the C compiler that enables that behaviour would be great. There's plenty of C users
who use setjmp/longjmp and would like a flag that makes them safe (at the expense of some speed obviously).

By the way, as far as I can see, older GCCs (up to 2004) had setjmp_protect() and setjmp_protect_args()
that you could use to protect a function against setjmp clobbering. In fact, until 2002, if -traditional
was passed, GCC would automatically call setjmp_protect() on all functions that used
setjmp(), which is exactly what the flag above would need to do. ;-)

Maybe we could reimplement setjmp_protect() ... a vanilla implementation that just marks all local variables
and arguments in the function as volatile ? Then we can call it in finish_function() if a -fsafe-setjmp flag is
passed and the function contains a call to sejmp ... assuming it works to mark the variables as volatile after
the fact, you'd get no spurious warnings since the volatile warnings are produced earlier.

Anyway, just brainstorming. Maybe someone who knows more about the internals can chip in and suggest
if there is a good way of doing this. ;-)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]