summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsam <sam@138bc75d-0d04-0410-961f-82ee72b054a4>2008-01-03 09:35:04 +0000
committersam <sam@138bc75d-0d04-0410-961f-82ee72b054a4>2008-01-03 09:35:04 +0000
commite0324ff58d5cbc7e9338e55dcdec24ee8fbef03c (patch)
treeea49403f80c5d0fc80e878e9940c64c8c3c9d476
parent361c9aad59cd53541245e876f3b78953e87cff57 (diff)
downloadgcc-e0324ff58d5cbc7e9338e55dcdec24ee8fbef03c.tar.gz
2008-01-03 Tero Koskinen <tero.koskinen@iki.fi>
gcc/ada/ PR ada/34647 * adaint.c (__gnat_open_new_temp, __gnat_tmp_name): Use mkstemp() on OpenBSD as is done on other BSD systems. PR ada/34645 * sysdep.c (__gnat_ttyname, getc_immediate_nowait, getc_immediate_common): Treat OpenBSD as FreeBSD regarding immediate I/O. PR ada/34644 * env.c (__gnat_clearenv): Treat OpenBSD as other BSD systems missing clearenv(). PR ada/34646 * init.c (__gnat_error_handler, __gnat_install_handler, __gnat_init_float): Define for OpenBSD. * initialize.c (__gnat_initialize): Define for OpenBSD. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@131301 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ada/ChangeLog21
-rw-r--r--gcc/ada/adaint.c7
-rw-r--r--gcc/ada/env.c2
-rw-r--r--gcc/ada/init.c66
-rw-r--r--gcc/ada/initialize.c3
-rw-r--r--gcc/ada/sysdep.c6
6 files changed, 96 insertions, 9 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 5c260387ceb..6537c951fb1 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,24 @@
+2008-01-03 Tero Koskinen <tero.koskinen@iki.fi>
+
+ PR ada/34647
+ * adaint.c (__gnat_open_new_temp, __gnat_tmp_name): Use mkstemp()
+ on OpenBSD as is done on other BSD systems.
+
+ PR ada/34645
+ * sysdep.c (__gnat_ttyname, getc_immediate_nowait,
+ getc_immediate_common): Treat OpenBSD as FreeBSD regarding immediate
+ I/O.
+
+ PR ada/34644
+ * env.c (__gnat_clearenv): Treat OpenBSD as other BSD systems missing
+ clearenv().
+
+ PR ada/34646
+ * init.c (__gnat_error_handler, __gnat_install_handler,
+ __gnat_init_float): Define for OpenBSD.
+
+ * initialize.c (__gnat_initialize): Define for OpenBSD.
+
2007-12-27 Samuel Tardieu <sam@rfc1149.net>
PR ada/34553
diff --git a/gcc/ada/adaint.c b/gcc/ada/adaint.c
index 1556b28ffdf..3bc20eb672e 100644
--- a/gcc/ada/adaint.c
+++ b/gcc/ada/adaint.c
@@ -887,8 +887,8 @@ __gnat_open_new_temp (char *path, int fmode)
strcpy (path, "GNAT-XXXXXX");
-#if (defined (__FreeBSD__) || defined (__NetBSD__) || defined (linux)) && \
- !defined (__vxworks)
+#if (defined (__FreeBSD__) || defined (__NetBSD__) || defined (__OpenBSD__) \
+ || defined (linux)) && !defined (__vxworks)
return mkstemp (path);
#elif defined (__Lynx__)
mktemp (path);
@@ -980,7 +980,8 @@ __gnat_tmp_name (char *tmp_filename)
free (pname);
}
-#elif defined (linux) || defined (__FreeBSD__) || defined (__NetBSD__)
+#elif defined (linux) || defined (__FreeBSD__) || defined (__NetBSD__) \
+ || defined (__OpenBSD__)
#define MAX_SAFE_PATH 1000
char *tmpdir = getenv ("TMPDIR");
diff --git a/gcc/ada/env.c b/gcc/ada/env.c
index 6cbb7057a64..46bfe1b0c4e 100644
--- a/gcc/ada/env.c
+++ b/gcc/ada/env.c
@@ -290,7 +290,7 @@ void __gnat_clearenv (void) {
}
#elif defined (__MINGW32__) || defined (__FreeBSD__) || defined (__APPLE__) \
|| (defined (__vxworks) && defined (__RTP__)) || defined (__CYGWIN__) \
- || defined (__NetBSD__)
+ || defined (__NetBSD__) || defined (__OpenBSD__)
/* On Windows, FreeBSD and MacOS there is no function to clean all the
environment but there is a "clean" way to unset a variable. So go
through the environ table and call __gnat_unsetenv on all entries */
diff --git a/gcc/ada/init.c b/gcc/ada/init.c
index fdfd31a6e2a..caf3adc98d7 100644
--- a/gcc/ada/init.c
+++ b/gcc/ada/init.c
@@ -1902,6 +1902,69 @@ __gnat_install_handler(void)
__gnat_handler_installed = 1;
}
+/*******************/
+/* OpenBSD Section */
+/*******************/
+
+#elif defined(__OpenBSD__)
+
+#include <signal.h>
+#include <unistd.h>
+
+static void
+__gnat_error_handler (int sig)
+{
+ struct Exception_Data *exception;
+ const char *msg;
+
+ switch(sig)
+ {
+ case SIGFPE:
+ exception = &constraint_error;
+ msg = "SIGFPE";
+ break;
+ case SIGILL:
+ exception = &constraint_error;
+ msg = "SIGILL";
+ break;
+ case SIGSEGV:
+ exception = &storage_error;
+ msg = "stack overflow or erroneous memory access";
+ break;
+ case SIGBUS:
+ exception = &constraint_error;
+ msg = "SIGBUS";
+ break;
+ default:
+ exception = &program_error;
+ msg = "unhandled signal";
+ }
+
+ Raise_From_Signal_Handler(exception, msg);
+}
+
+void
+__gnat_install_handler(void)
+{
+ struct sigaction act;
+
+ act.sa_handler = __gnat_error_handler;
+ act.sa_flags = SA_NODEFER | SA_RESTART;
+ sigemptyset (&act.sa_mask);
+
+ /* Do not install handlers if interrupt state is "System" */
+ if (__gnat_get_interrupt_state (SIGFPE) != 's')
+ sigaction (SIGFPE, &act, NULL);
+ if (__gnat_get_interrupt_state (SIGILL) != 's')
+ sigaction (SIGILL, &act, NULL);
+ if (__gnat_get_interrupt_state (SIGSEGV) != 's')
+ sigaction (SIGSEGV, &act, NULL);
+ if (__gnat_get_interrupt_state (SIGBUS) != 's')
+ sigaction (SIGBUS, &act, NULL);
+
+ __gnat_handler_installed = 1;
+}
+
#else
/* For all other versions of GNAT, the handler does nothing */
@@ -1927,7 +1990,8 @@ __gnat_install_handler (void)
WIN32 and could be used under OS/2 */
#if defined (_WIN32) || defined (__INTERIX) || defined (__EMX__) \
- || defined (__Lynx__) || defined(__NetBSD__) || defined(__FreeBSD__)
+ || defined (__Lynx__) || defined(__NetBSD__) || defined(__FreeBSD__) \
+ || defined (__OpenBSD__)
#define HAVE_GNAT_INIT_FLOAT
diff --git a/gcc/ada/initialize.c b/gcc/ada/initialize.c
index a06e98ece65..a84f7535dc1 100644
--- a/gcc/ada/initialize.c
+++ b/gcc/ada/initialize.c
@@ -98,7 +98,8 @@ __gnat_initialize (void *eh)
/* __gnat_initialize (init_float version) */
/******************************************/
-#elif defined (__Lynx__) || defined (__FreeBSD__) || defined(__NetBSD__)
+#elif defined (__Lynx__) || defined (__FreeBSD__) || defined(__NetBSD__) \
+ || defined (__OpenBSD__)
extern void __gnat_init_float (void);
diff --git a/gcc/ada/sysdep.c b/gcc/ada/sysdep.c
index 6aca196af76..cf51ebea76a 100644
--- a/gcc/ada/sysdep.c
+++ b/gcc/ada/sysdep.c
@@ -342,7 +342,7 @@ __gnat_ttyname (int filedes)
|| (defined (__osf__) && ! defined (__alpha_vxworks)) || defined (WINNT) \
|| defined (__MACHTEN__) || defined (__hpux__) || defined (_AIX) \
|| (defined (__svr4__) && defined (i386)) || defined (__Lynx__) \
- || defined (__CYGWIN__) || defined (__FreeBSD__)
+ || defined (__CYGWIN__) || defined (__FreeBSD__) || defined (__OpenBSD__)
#ifdef __MINGW32__
#if OLD_MINGW
@@ -399,7 +399,7 @@ getc_immediate_common (FILE *stream,
|| (defined (__osf__) && ! defined (__alpha_vxworks)) \
|| defined (__CYGWIN32__) || defined (__MACHTEN__) || defined (__hpux__) \
|| defined (_AIX) || (defined (__svr4__) && defined (i386)) \
- || defined (__Lynx__) || defined (__FreeBSD__)
+ || defined (__Lynx__) || defined (__FreeBSD__) || defined (__OpenBSD__)
char c;
int nread;
int good_one = 0;
@@ -418,7 +418,7 @@ getc_immediate_common (FILE *stream,
#if defined(linux) || defined (sun) || defined (sgi) || defined (__EMX__) \
|| defined (__osf__) || defined (__MACHTEN__) || defined (__hpux__) \
|| defined (_AIX) || (defined (__svr4__) && defined (i386)) \
- || defined (__Lynx__) || defined (__FreeBSD__)
+ || defined (__Lynx__) || defined (__FreeBSD__) || defined (__OpenBSD__)
eof_ch = termios_rec.c_cc[VEOF];
/* If waiting (i.e. Get_Immediate (Char)), set MIN = 1 and wait for