diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2012-10-06 19:26:03 -0700 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2012-10-06 19:26:03 -0700 |
commit | c622b48f7894fc904cdc95edff47f2173240f0cf (patch) | |
tree | 498fcede7d0dbde0fe60d338198396633ac433dd | |
parent | 559e479cbb1e1fb88325c90a22f7b7fdb5c3c95b (diff) | |
download | emacs-c622b48f7894fc904cdc95edff47f2173240f0cf.tar.gz |
Improve sys_siglist detection.
* configure.ac (sys_siglist): Look for its decl in <signal.h>.
Otherwise, it's not found in either Fedora 17 or Solaris 11.
* src/sysdep.c (sys_siglist, init_signals): Use _sys_siglist if it's
defined as a macro, as is done in Solaris.
(sys_siglist_entries): New macro.
(save_strsignal): Use it.
* src/syssignal.h (safe_strsignal): Now ATTRIBUTE_CONST, to pacify
GCC 4.7.2 on Fedora 17 with the fixed sys_siglist detection.
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | configure.ac | 6 | ||||
-rw-r--r-- | src/ChangeLog | 10 | ||||
-rw-r--r-- | src/sysdep.c | 18 | ||||
-rw-r--r-- | src/syssignal.h | 2 |
5 files changed, 35 insertions, 7 deletions
diff --git a/ChangeLog b/ChangeLog index 90b57c4c3da..2d4d7a66eb0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2012-10-07 Paul Eggert <eggert@cs.ucla.edu> + + Improve sys_siglist detection. + * configure.ac (sys_siglist): Look for its decl in <signal.h>. + Otherwise, it's not found in either Fedora 17 or Solaris 11. + 2012-10-04 Paul Eggert <eggert@cs.ucla.edu> Merge from gnulib, incorporating: diff --git a/configure.ac b/configure.ac index edbae29c59f..626395220bd 100644 --- a/configure.ac +++ b/configure.ac @@ -1284,10 +1284,12 @@ dnl On Solaris 8 there's a compilation warning for term.h because dnl it doesn't define `bool'. AC_CHECK_HEADERS(term.h, , , -) AC_HEADER_TIME -AC_CHECK_DECLS([sys_siglist]) +AC_CHECK_DECLS([sys_siglist], [], [], [[#include <signal.h> + ]]) if test $ac_cv_have_decl_sys_siglist != yes; then # For Tru64, at least: - AC_CHECK_DECLS([__sys_siglist]) + AC_CHECK_DECLS([__sys_siglist], [], [], [[#include <signal.h> + ]]) if test $ac_cv_have_decl___sys_siglist = yes; then AC_DEFINE(sys_siglist, __sys_siglist, [Define to any substitute for sys_siglist.]) diff --git a/src/ChangeLog b/src/ChangeLog index b960837eaab..a30dde5e4ea 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,13 @@ +2012-10-07 Paul Eggert <eggert@cs.ucla.edu> + + Improve sys_siglist detection. + * sysdep.c (sys_siglist, init_signals): Use _sys_siglist if it's + defined as a macro, as is done in Solaris. + (sys_siglist_entries): New macro. + (save_strsignal): Use it. + * syssignal.h (safe_strsignal): Now ATTRIBUTE_CONST, to pacify + GCC 4.7.2 on Fedora 17 with the fixed sys_siglist detection. + 2012-10-06 Jan Djärv <jan.h.d@swipnet.se> * nsfns.m (Fx_create_frame): Call x_default_parameter with diff --git a/src/sysdep.c b/src/sysdep.c index 74617fcaf0f..35beeaa7202 100644 --- a/src/sysdep.c +++ b/src/sysdep.c @@ -1545,8 +1545,18 @@ deliver_thread_signal (int sig, signal_handler_t handler) #if !HAVE_DECL_SYS_SIGLIST # undef sys_siglist -# define sys_siglist my_sys_siglist +# ifdef _sys_siglist +# define sys_siglist _sys_siglist +# else +# define sys_siglist my_sys_siglist static char const *sys_siglist[NSIG]; +# endif +#endif + +#ifdef _sys_nsig +# define sys_siglist_entries _sys_nsig +#else +# define sys_siglist_entries NSIG #endif /* Handle bus errors, invalid instruction, etc. */ @@ -1609,7 +1619,7 @@ init_signals (bool dumping) main_thread = pthread_self (); #endif -#if !HAVE_DECL_SYS_SIGLIST +#if !HAVE_DECL_SYS_SIGLIST && !defined _sys_siglist if (! initialized) { sys_siglist[SIGABRT] = "Aborted"; @@ -1757,7 +1767,7 @@ init_signals (bool dumping) sys_siglist[SIGXFSZ] = "File size limit exceeded"; # endif } -#endif /* !HAVE_DECL_SYS_SIGLIST */ +#endif /* !HAVE_DECL_SYS_SIGLIST && !_sys_siglist */ /* Don't alter signal handlers if dumping. On some machines, changing signal handlers sets static data that would make signals @@ -2285,7 +2295,7 @@ safe_strsignal (int code) { char const *signame = 0; - if (0 <= code && code < NSIG) + if (0 <= code && code < sys_siglist_entries) signame = sys_siglist[code]; if (! signame) signame = "Unknown signal"; diff --git a/src/syssignal.h b/src/syssignal.h index 83ab19698dd..2bf2f046aa5 100644 --- a/src/syssignal.h +++ b/src/syssignal.h @@ -43,7 +43,7 @@ extern sigset_t empty_mask; typedef void (*signal_handler_t) (int); extern void emacs_sigaction_init (struct sigaction *, signal_handler_t); -char const *safe_strsignal (int); +char const *safe_strsignal (int) ATTRIBUTE_CONST; #if NSIG < NSIG_MINIMUM # undef NSIG |