This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
handling setjmp/longjmp in new front-end
- To: gcc at gcc dot gnu dot org
- Subject: handling setjmp/longjmp in new front-end
- From: Fergus Henderson <fjh at cs dot mu dot oz dot au>
- Date: Fri, 29 Dec 2000 18:27:00 +1100
I'm working on a new GCC front-end, for Mercury
(<http://www.cs.mu.oz.au/mercury/>). The existing Mercury compiler
generates C code that uses setjmp() and longjmp(). I'm not sure how
to handle this in the GCC front-end, because setjmp() may be a macro,
rather than a function, and because the definition of the jmpbuf type
may vary from platform to platform.
One possibility is to use __builtin_setjmp() and __builtin_longjmp()
instead. This would also solve the problem with jmpbuf.
However, the documentation of __builtin_setjmp() says
| NOTE: This is intended for use by GNAT and the exception handling
| scheme in the compiler and will only work in the method used by
| them.
What exactly are the restrictions? Is it just that __builtin_longjmp()
must always be called with the second argument being `1', or is there
more to it?
Are __builtin_setjmp() and __builtin_longjmp() supported on all targets?
--
Fergus Henderson <fjh@cs.mu.oz.au> | "I have always known that the pursuit
| of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh> | -- the last words of T. S. Garp.