+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,
#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
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;
+2002-06-07 Bruno Haible <bruno@clisp.org>
+
+ * intdiv0.m4: New file.
+ * gettext.m4 (AM_INTL_SUBDIR): Require gt_INTDIV0.
+ * Makefile.am (aclocal_DATA): Add intdiv0.m4.
+ (EXTRA_DIST): Add intdiv0.m4.
+
2002-05-18 Bruno Haible <bruno@clisp.org>
Make it possible to invoke AM_ICONV after AM_GNU_GETTEXT.
## Process this file with automake to produce Makefile.in -*-Makefile-*-
aclocaldir = @aclocaldir@
-aclocal_DATA = codeset.m4 gettext.m4 glibc21.m4 iconv.m4 isc-posix.m4 lib-ld.m4 lib-link.m4 lib-prefix.m4 lcmessage.m4 progtest.m4
+aclocal_DATA = codeset.m4 gettext.m4 glibc21.m4 iconv.m4 intdiv0.m4 isc-posix.m4 lib-ld.m4 lib-link.m4 lib-prefix.m4 lcmessage.m4 progtest.m4
# Generate this list with
# find . -type f -name '*.m4' -printf '%f\n'|sort |fmt |tr '\012' @ \
# |sed 's/@$/%/;s/@/ \\@/g' |tr @% '\012\012'
EXTRA_DIST = README \
backupfile.m4 c-bs-a.m4 codeset.m4 error.m4 flex.m4 fnmatch.m4 getline.m4 \
-gettext.m4 glibc21.m4 hostname.m4 iconv.m4 inttypes_h.m4 isc-posix.m4 \
-javacomp.m4 javaexec.m4 lcmessage.m4 lib-ld.m4 lib-link.m4 lib-prefix.m4 \
-libtool.m4 mbrtowc.m4 mbstate_t.m4 mbswidth.m4 mkdtemp.m4 progtest.m4 \
-setenv.m4 setlocale.m4 siginfo.m4 signalblocking.m4 signed.m4 ssize_t.m4 \
-stdbool.m4 stdint_h.m4 tmpdir.m4 uintmax_t.m4 ulonglong.m4 unionwait.m4
+gettext.m4 glibc21.m4 hostname.m4 iconv.m4 intdiv0.m4 inttypes_h.m4 \
+isc-posix.m4 javacomp.m4 javaexec.m4 lcmessage.m4 lib-ld.m4 lib-link.m4 \
+lib-prefix.m4 libtool.m4 mbrtowc.m4 mbstate_t.m4 mbswidth.m4 mkdtemp.m4 \
+progtest.m4 setenv.m4 setlocale.m4 siginfo.m4 signalblocking.m4 signed.m4 \
+ssize_t.m4 stdbool.m4 stdint_h.m4 tmpdir.m4 uintmax_t.m4 ulonglong.m4 \
+unionwait.m4
AC_REQUIRE([AC_FUNC_ALLOCA])dnl
AC_REQUIRE([AC_FUNC_MMAP])dnl
AC_REQUIRE([jm_GLIBC21])dnl
+ AC_REQUIRE([gt_INTDIV0])dnl
AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h stddef.h \
stdlib.h string.h unistd.h sys/param.h])
--- /dev/null
+# intdiv0.m4 serial 1 (gettext-0.11.3)
+dnl Copyright (C) 2002 Free Software Foundation, Inc.
+dnl This file is free software, distributed under the terms of the GNU
+dnl General Public License. As a special exception to the GNU General
+dnl Public License, this file may be distributed as part of a program
+dnl that contains a configuration script generated by Autoconf, under
+dnl the same distribution terms as the rest of that program.
+
+dnl From Bruno Haible.
+
+AC_DEFUN([gt_INTDIV0],
+[
+ AC_REQUIRE([AC_PROG_CC])dnl
+ AC_REQUIRE([AC_CANONICAL_HOST])dnl
+
+ AC_CACHE_CHECK([whether integer division by zero raises SIGFPE],
+ gt_cv_int_divbyzero_sigfpe,
+ [
+ AC_TRY_RUN([
+#include <stdlib.h>
+#include <signal.h>
+
+static void
+#ifdef __cplusplus
+sigfpe_handler (int sig)
+#else
+sigfpe_handler (sig) int sig;
+#endif
+{
+ /* Exit with code 0 if SIGFPE, with code 1 if any other signal. */
+ exit (sig != SIGFPE);
+}
+
+int x = 1;
+int y = 0;
+int z;
+int nan;
+
+int main ()
+{
+ signal (SIGFPE, sigfpe_handler);
+/* IRIX and AIX (when "xlc -qcheck" is used) yield signal SIGTRAP. */
+#if (defined (__sgi) || defined (_AIX)) && defined (SIGTRAP)
+ signal (SIGTRAP, sigfpe_handler);
+#endif
+/* Linux/SPARC yields signal SIGILL. */
+#if defined (__sparc__) && defined (__linux__)
+ signal (SIGILL, sigfpe_handler);
+#endif
+
+ z = x / y;
+ nan = y / y;
+ exit (1);
+}
+], gt_cv_int_divbyzero_sigfpe=yes, gt_cv_int_divbyzero_sigfpe=no,
+ [
+ # Guess based on the CPU.
+ case "$host_cpu" in
+ alpha* | i[34567]86 | m68k | s390*)
+ gt_cv_int_divbyzero_sigfpe="guessing yes";;
+ *)
+ gt_cv_int_divbyzero_sigfpe="guessing no";;
+ esac
+ ])
+ ])
+ case "$gt_cv_int_divbyzero_sigfpe" in
+ *yes) value=1;;
+ *) value=0;;
+ esac
+ AC_DEFINE_UNQUOTED(INTDIV0_RAISES_SIGFPE, $value,
+ [Define if integer division by zero raises signal SIGFPE.])
+])
+2002-06-07 Bruno Haible <bruno@clisp.org>
+
+ * msgfmt.c (install_sigfpe_handler): Assume the signal is always
+ SIGFPE, regardless of the platform.
+ (uninstall_sigfpe_handler): Likewise.
+
2002-05-29 Bruno Haible <bruno@clisp.org>
* dir-list.h (dir_list_save_reset, dir_list_restore): New declarations.
sigaction (SIGFPE, &action, (struct sigaction *) NULL);
#else
signal (SIGFPE, sigfpe_handler);
- /* Irix and AIX send SIGTRAP, not SIGFPE. */
-# if (defined (__sgi) || defined (_AIX)) && defined (SIGTRAP)
- signal (SIGTRAP, sigfpe_handler);
-# endif
#endif
}
sigaction (SIGFPE, &action, (struct sigaction *) NULL);
#else
signal (SIGFPE, SIG_DFL);
- /* Irix and AIX send SIGTRAP, not SIGFPE. */
-# if (defined (__sgi) || defined (_AIX)) && defined (SIGTRAP)
- signal (SIGTRAP, SIG_DFL);
-# endif
#endif
}