summaryrefslogtreecommitdiff
path: root/gcc/mips-tfile.c
diff options
context:
space:
mode:
authorKaveh R. Ghazi <ghazi@caip.rutgers.edu>1998-09-13 06:17:31 +0000
committerKaveh Ghazi <ghazi@gcc.gnu.org>1998-09-13 06:17:31 +0000
commit007e8d2a7821a3a8facedb851012555516d7f9b2 (patch)
tree2f40679e3e943a6f022bdc693a86f98e44155243 /gcc/mips-tfile.c
parent9655bf953a9f230518f1f1ac9303b8056b4babe8 (diff)
downloadgcc-007e8d2a7821a3a8facedb851012555516d7f9b2.tar.gz
Add support for strsignal, for platforms which have it but don't have sys_siglist (like Solaris 2.7.)
Add support for strsignal, for platforms which have it but don't have sys_siglist (like Solaris 2.7.) * acconfig.h (NEED_DECLARATION_STRSIGNAL): Provide a stub. * collect2.c: Don't declare `sys_siglist' here. (my_strsignal): Prototype and define new function. Use it in place of `sys_siglist' hacks. * mips_tfile.c: Likewise. * configure.in (AC_CHECK_FUNCS): Check for strsignal. (GCC_NEED_DECLARATIONS): Likewise. * system.h (strsignal): Prototype it, if necessary. (sys_siglist): Declare it, if necessary. From-SVN: r22403
Diffstat (limited to 'gcc/mips-tfile.c')
-rw-r--r--gcc/mips-tfile.c36
1 files changed, 25 insertions, 11 deletions
diff --git a/gcc/mips-tfile.c b/gcc/mips-tfile.c
index 71c39628133..0922bf1ad14 100644
--- a/gcc/mips-tfile.c
+++ b/gcc/mips-tfile.c
@@ -1722,6 +1722,7 @@ STATIC void free_thead __proto((thead_t *));
STATIC char *local_index __proto((const char *, int));
STATIC char *local_rindex __proto((const char *, int));
+STATIC const char *my_strsignal __proto((int));
extern char *mktemp __proto((char *));
extern long strtol __proto((const char *, char **, int));
@@ -1730,12 +1731,6 @@ extern char *optarg;
extern int optind;
extern int opterr;
extern char *version_string;
-#ifndef NO_SYS_SIGLIST
-#ifndef SYS_SIGLIST_DECLARED
-extern char *sys_siglist[NSIG + 1];
-#endif
-#endif
-
/* List of assembler pseudo ops and beginning sequences that need
special actions. Someday, this should be a hash table, and such,
@@ -5050,6 +5045,29 @@ main (argc, argv)
}
+STATIC const char *
+my_strsignal (s)
+ int s;
+{
+#ifdef HAVE_STRSIGNAL
+ return strsignal (s);
+#else
+ if (s >= 0 && s < NSIG)
+ {
+# ifdef NO_SYS_SIGLIST
+ static char buffer[30];
+
+ sprintf (buffer, "Unknown signal %d", s);
+ return buffer;
+# else
+ return sys_siglist[s];
+# endif
+ }
+ else
+ return NULL;
+#endif /* HAVE_STRSIGNAL */
+}
+
/* Catch a signal and exit without dumping core. */
STATIC void
@@ -5057,11 +5075,7 @@ catch_signal (signum)
int signum;
{
(void) signal (signum, SIG_DFL); /* just in case... */
-#ifdef NO_SYS_SIGLIST
- fatal ("caught signal");
-#else
- fatal (sys_siglist[signum]);
-#endif
+ fatal (my_strsignal(signum));
}
/* Print a fatal error message. NAME is the text.