From: Jarkko Hietaniemi Date: Sun, 24 Jun 2001 13:21:23 +0000 (+0000) Subject: Factor the PERL_SYS_INIT() code, from Hugo van der Sanden. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=c77b533b28c0662914d761b264c2238f98d272a4;p=p5sagit%2Fp5-mst-13.2.git Factor the PERL_SYS_INIT() code, from Hugo van der Sanden. p4raw-id: //depot/perl@10888 --- diff --git a/hints/freebsd.sh b/hints/freebsd.sh index 8eb6ac4..6a105fd 100644 --- a/hints/freebsd.sh +++ b/hints/freebsd.sh @@ -123,6 +123,7 @@ case "$osvers" in 0*|1*|2*|3*) ;; *) + ccflags="${ccflags} -DHAS_FPSETMASK -DHAS_FLOATINGPOINT_H" if /usr/bin/file -L /usr/lib/libc.so | /usr/bin/grep -vq "not stripped" ; then usenm=false fi diff --git a/hints/posix-bc.sh b/hints/posix-bc.sh index 79742af..8a4f289 100644 --- a/hints/posix-bc.sh +++ b/hints/posix-bc.sh @@ -19,10 +19,11 @@ esac # -DPOSIX_BC # -DUSE_PURE_BISON # -D_XOPEN_SOURCE_EXTENDED alters system headers. +# -DPERL_IGNORE_FPUSIG=SIGFPE # Prepend your favorites with Configure -Dccflags=your_favorites case "$ccflags" in -'') ccflags='-K enum_long,llm_case_lower,llm_keep,no_integer_overflow -DPOSIX_BC -DUSE_PURE_BISON -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED' ;; -*) ccflags='$ccflags -Kenum_long,llm_case_lower,llm_keep,no_integer_overflow -DPOSIX_BC -DUSE_PURE_BISON -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED' ;; +'') ccflags='-K enum_long,llm_case_lower,llm_keep,no_integer_overflow -DPOSIX_BC -DUSE_PURE_BISON -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED -DPERL_IGNORE_FPUSIG=SIGFPE' ;; +*) ccflags='$ccflags -Kenum_long,llm_case_lower,llm_keep,no_integer_overflow -DPOSIX_BC -DUSE_PURE_BISON -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED -DPERL_IGNORE_FPUSIG=SIGFPE' ;; esac # ccdlflags have yet to be determined. diff --git a/hints/sco.sh b/hints/sco.sh index 079ab78..1d1d5c2 100644 --- a/hints/sco.sh +++ b/hints/sco.sh @@ -112,7 +112,7 @@ then else ############################################################### # Need this in release 5 because of changed fpu exeption rules - ccflags="$ccflags -D PERL_SCO5" + ccflags="$ccflags -D HAS_FPSETMASK" ############################################################### # In Release 5, always compile ELF objects diff --git a/mpeix/mpeixish.h b/mpeix/mpeixish.h index 821d593..dc8cb19 100644 --- a/mpeix/mpeixish.h +++ b/mpeix/mpeixish.h @@ -113,12 +113,7 @@ #define Mkdir(path,mode) mkdir((path),(mode)) #ifndef PERL_SYS_INIT -#ifdef PERL_SCO5 -/* this should be set in a hint file, not here */ -# define PERL_SYS_INIT(c,v) fpsetmask(0); MALLOC_INIT -#else -# define PERL_SYS_INIT(c,v) MALLOC_INIT -#endif +# define PERL_SYS_INIT(c,v) PERL_FPU_INIT MALLOC_INIT #endif #ifndef PERL_SYS_TERM diff --git a/perl.h b/perl.h index 4c82ca7..7234828 100644 --- a/perl.h +++ b/perl.h @@ -1752,6 +1752,22 @@ typedef struct ptr_tbl PTR_TBL_t; # define NEED_ENVIRON_DUP_FOR_MODIFY #endif +/* + * initialise to avoid floating-point exceptions from overflow, etc + */ +#ifndef PERL_FPU_INIT +# ifdef HAS_FPSETMASK +# if HAS_FLOATINGPOINT_H +# include +# endif +# define PERL_FPU_INIT fpsetmask(0); +# elif PERL_IGNORE_FPUSIG +# define PERL_FPU_INIT signal(PERL_IGNORE_FPUSIG, SIG_IGN); +# else +# define PERL_FPU_INIT +# endif +#endif + #ifndef PERL_SYS_INIT3 # define PERL_SYS_INIT3(argvp,argcp,envp) PERL_SYS_INIT(argvp,argcp) #endif diff --git a/unixish.h b/unixish.h index a7e9a08..fb3a995 100644 --- a/unixish.h +++ b/unixish.h @@ -118,24 +118,8 @@ #define Fflush(fp) fflush(fp) #define Mkdir(path,mode) mkdir((path),(mode)) -/* these should be set in a hint file, not here */ #ifndef PERL_SYS_INIT -#if defined(PERL_SCO5) || defined(__FreeBSD__) -# ifdef __FreeBSD__ -# include -# endif -# define PERL_SYS_INIT(c,v) fpsetmask(0); MALLOC_INIT -#else -# ifdef POSIX_BC -# define PERL_SYS_INIT(c,v) sigignore(SIGFPE); MALLOC_INIT -# else -# ifdef UTS -# define PERL_SYS_INIT(c,v) signal(SIGFPE, SIG_IGN); MALLOC_INIT -# else -# define PERL_SYS_INIT(c,v) MALLOC_INIT -# endif -# endif -#endif +# define PERL_SYS_INIT(c,v) PERL_FPU_INIT MALLOC_INIT #endif #ifndef PERL_SYS_TERM