This is the mail archive of the gcc@gcc.gnu.org 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: implementing exception handlers in a front end


On Wed, Jul 9, 2008 at 3:32 PM, Gaius Mulley <gaius@glam.ac.uk> 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.


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