> Right, I didn't look at the details of the uses of
> DONT_USE_BUILTIN_SETJMP and JMP_BUF_SIZE but it looks like the ones in
> picochip and stormy16 are redundant too:
>
> For picochip, this port defines DONT_USE_BUILTIN_SETJMP but in the .c
> file (and after all #includes), so it is never exported and not
> otherwise referenced in picochip.c, hence dead:
> config/picochip/picochip.c:#undef DONT_USE_BUILTIN_SETJMP
> config/picochip/picochip.c:#define DONT_USE_BUILTIN_SETJMP 1
>
> stormy16 only undefines DONT_USE_BUILTIN_SETJMP (which is the default
> anyway) so these two lines are redundant:
> config/stormy16/stormy16.h:#undef  DONT_USE_BUILTIN_SETJMP
> config/stormy16/stormy16.h:#define JMP_BUF_SIZE  8

That's my understanding as well.

> That leaves only rl78 and ia64:
> $ egrep "DONT_USE_BUILTIN_SETJMP|JMP_BUF_SIZE" config/* config/*/*
> config/ia64/freebsd.h:#define JMP_BUF_SIZE  76
> config/ia64/hpux.h:#define JMP_BUF_SIZE  (8 * 76)
> config/ia64/ia64.h:#define DONT_USE_BUILTIN_SETJMP
> config/ia64/linux.h:#define JMP_BUF_SIZE  76
> config/ia64/vms.h:#define JMP_BUF_SIZE  (8 * 76)
> config/rl78/rl78.h:/*#define DONT_USE_BUILTIN_SETJMP 1*/
> config/rl78/rl78.h:#undef DONT_USE_BUILTIN_SETJMP
> config/rl78/rl78.h:#define JMP_BUF_SIZE (8*3+8)
>
> The ia64 ones have no useful comments. The 76 is a magic number and it
> seems strange to me that the size of JMP_BUF_SIZE depends on the OS
> (linux and freebsd have 76, hpux has 8*76, and vms copied the hpux
> example with the comment: "Maybe same as HPUX?  Needs to be
> checked."). And anyway, these macros are only relevant for SJLJ
> exceptions - who uses that on ia64??

It looks like DONT_USE_BUILTIN_SETJMP was invented for the IA-64, probably 
because of the Register Stack Engine.  But SPARC also has register windows, 
albeit less sophisticated, and can do without it.  Morever, the Ada compiler 
uses __builtin_setjmp/__builtin_longjmp internally on the host (EH is used for 
error recovery) and is known to work fine on IA-64/Linux, HP-UX and VMS.

In the end, it would appear that DONT_USE_BUILTIN_SETJMP was a quick trick to 
solve specific issues that could very likely have been solved otherwise.  We 
should probably keep it for the sake of IA-64 and get rid of it for all other 
architectures, documenting that it isn't to be used in normal circumstances.

-- 
Eric Botcazou

Reply via email to