On Wed, Jul 9, 2008 at 3:32 PM, Gaius Mulley <[EMAIL PROTECTED]> wrote: > > Hi, > > I'm currently trying to implement the exception handling in GNU > Modula-2 and was wondering which of the following two routes to use. > I was initially enthusiastic about using __builtin_setjmp/ > __builtin_longjmp as Modula-2 exceptions can be implemented with these > mechanisms - and it would also be tantalisingly easy to code.. > > However, upon searching this list I see that there are a number of > problems with __builtin_setjmp and __builtin_longjmp and have begun > to examine TRY_CATCH_EXPR nodes instead. It seems that if this later > route is taken then the front end also needs to add: > > DEFTREECODE (THROW_EXPR, "throw", tcc_unary, 1) > > to its language tree.def and gimplify this. Before I embark on this > I'd like to ask whether using __builtin_longjmp/__builtin_setjmp is > definitely the wrong way to go?
Definitely. You will be not able to handle/throw exceptions from other languages if the target ABI doesn't use sjlj exceptions (which only a few use). Richard.