diff options
author | Bruno Haible <bruno@clisp.org> | 2002-06-07 12:41:14 +0000 |
---|---|---|
committer | Bruno Haible <bruno@clisp.org> | 2009-06-23 12:08:35 +0200 |
commit | debd770197aea679bc013ab123db6bd8f9c5f9e4 (patch) | |
tree | c2d1d2219cb57d89da9552a20b097b2ccad6ba32 /intl | |
parent | 39286fc473b3c9f2c980e249022069e678e28318 (diff) | |
download | external_gettext-debd770197aea679bc013ab123db6bd8f9c5f9e4.zip external_gettext-debd770197aea679bc013ab123db6bd8f9c5f9e4.tar.gz external_gettext-debd770197aea679bc013ab123db6bd8f9c5f9e4.tar.bz2 |
Make division by zero signal SIGFPE on all platforms.
Diffstat (limited to 'intl')
-rw-r--r-- | intl/ChangeLog | 7 | ||||
-rw-r--r-- | intl/dcigettext.c | 14 | ||||
-rw-r--r-- | intl/eval-plural.h | 8 |
3 files changed, 29 insertions, 0 deletions
diff --git a/intl/ChangeLog b/intl/ChangeLog index 35ff7f8..2e18e90 100644 --- a/intl/ChangeLog +++ b/intl/ChangeLog @@ -1,3 +1,10 @@ +2002-06-07 Bruno Haible <bruno@clisp.org> + + * dcigettext.c (INTDIV0_RAISES_SIGFPE): Define a fallback. + Include <signal.h>. + * eval-plural.h (plural_eval): Let division by zero cause SIGFPE on + all platforms. + 2002-05-30 Bruno Haible <bruno@clisp.org> * libgnuintl.h (_INTL_REDIRECT_ASM, _INTL_REDIRECT_INLINE, diff --git a/intl/dcigettext.c b/intl/dcigettext.c index 329dc09..b5bf3fb 100644 --- a/intl/dcigettext.c +++ b/intl/dcigettext.c @@ -64,6 +64,20 @@ extern int errno; #include <locale.h> +#ifdef _LIBC + /* Guess whether integer division by zero raises signal SIGFPE. + Set to 1 only if you know for sure. In case of doubt, set to 0. */ +# if defined __alpha__ || defined __arm__ || defined __i386__ \ + || defined __m68k__ || defined __s390__ +# define INTDIV0_RAISES_SIGFPE 1 +# else +# define INTDIV0_RAISES_SIGFPE 0 +# endif +#endif +#if !INTDIV0_RAISES_SIGFPE +# include <signal.h> +#endif + #if defined HAVE_SYS_PARAM_H || defined _LIBC # include <sys/param.h> #endif diff --git a/intl/eval-plural.h b/intl/eval-plural.h index 44f4934..19c7ca6 100644 --- a/intl/eval-plural.h +++ b/intl/eval-plural.h @@ -68,8 +68,16 @@ plural_eval (pexp, n) case mult: return leftarg * rightarg; case divide: +#if !INTDIV0_RAISES_SIGFPE + if (rightarg == 0) + raise (SIGFPE); +#endif return leftarg / rightarg; case module: +#if !INTDIV0_RAISES_SIGFPE + if (rightarg == 0) + raise (SIGFPE); +#endif return leftarg % rightarg; case plus: return leftarg + rightarg; |