[m-rev.] diff: fix bug in runtime/mercury_signal.h

Simon Taylor stayl at cs.mu.OZ.AU
Fri Feb 1 04:10:45 AEDT 2002


Estimated hours taken: 0.2

runtime/mercury_signal.h:
	Fix a bug in my last change.
	<signal.h> needs to be included here for `struct sigaction'.

runtime/mercury_signal.c:
runtime/mercury_memory.c:
runtime/mercury_memory_handlers.c:
	Remove some duplicated code.

Index: mercury_memory.c
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_memory.c,v
retrieving revision 1.24
diff -u -u -r1.24 mercury_memory.c
--- mercury_memory.c	24 Nov 2000 06:03:37 -0000	1.24
+++ mercury_memory.c	31 Jan 2002 17:09:29 -0000
@@ -35,39 +35,7 @@
 /*---------------------------------------------------------------------------*/
 
 #include "mercury_imp.h"
-
-/*
-** XXX This code is duplicated in three files:
-** mercury_memory.c, mercury_memory_handlers.c, and mercury_signal.c.
-*/
-#ifdef HAVE_SIGCONTEXT_STRUCT
-  /*
-  ** Some versions of Linux call it struct sigcontext_struct, some call it
-  ** struct sigcontext.  The following #define eliminates the differences.
-  */
-  #define sigcontext_struct sigcontext /* must be before #include <signal.h> */
-  struct sigcontext; /* this forward decl avoids a gcc warning in signal.h */
-
-  /*
-  ** On some systems (e.g. most versions of Linux) we need to #define
-  ** __KERNEL__ to get sigcontext_struct from <signal.h>.
-  ** This stuff must come before anything else that might include <signal.h>,
-  ** otherwise the #define __KERNEL__ may not work.
-  */
-  #define __KERNEL__
-  #include <signal.h>	/* must come third */
-  #undef __KERNEL__
-
-  /*
-  ** Some versions of Linux define it in <signal.h>, others define it in
-  ** <asm/sigcontext.h>.  We try both.
-  */
-  #ifdef HAVE_ASM_SIGCONTEXT
-    #include <asm/sigcontext.h>
-  #endif 
-#else
-  #include <signal.h>
-#endif
+#include "mercury_signal.h"
 
 #ifdef HAVE_UNISTD_H
   #include <unistd.h>
Index: mercury_memory_handlers.c
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_memory_handlers.c,v
retrieving revision 1.22
diff -u -u -r1.22 mercury_memory_handlers.c
--- mercury_memory_handlers.c	30 Jan 2002 14:51:07 -0000	1.22
+++ mercury_memory_handlers.c	31 Jan 2002 15:43:51 -0000
@@ -21,39 +21,7 @@
 
 #include <stdio.h>
 #include <string.h>
-
-/*
-** XXX This code is duplicated in three files:
-** mercury_memory.c, mercury_memory_handlers.c, and mercury_signal.c.
-*/
-#ifdef HAVE_SIGCONTEXT_STRUCT
-  /*
-  ** Some versions of Linux call it struct sigcontext_struct, some call it
-  ** struct sigcontext.  The following #define eliminates the differences.
-  */
-  #define sigcontext_struct sigcontext /* must be before #include <signal.h> */
-  struct sigcontext; /* this forward decl avoids a gcc warning in signal.h */
-
-  /*
-  ** On some systems (e.g. most versions of Linux) we need to #define
-  ** __KERNEL__ to get sigcontext_struct from <signal.h>.
-  ** This stuff must come before anything else that might include <signal.h>,
-  ** otherwise the #define __KERNEL__ may not work.
-  */
-  #define __KERNEL__
-  #include <signal.h>	/* must come third */
-  #undef __KERNEL__
-
-  /*
-  ** Some versions of Linux define it in <signal.h>, others define it in
-  ** <asm/sigcontext.h>.  We try both.
-  */
-  #ifdef HAVE_ASM_SIGCONTEXT
-    #include <asm/sigcontext.h>
-  #endif 
-#else
-  #include <signal.h>
-#endif
+#include "mercury_signal.h"
 
 #ifdef HAVE_SYS_SIGINFO
   #include <sys/siginfo.h>
@@ -76,8 +44,6 @@
   #include <sys/ucontext.h>
 #endif
 
-#include "mercury_imp.h"
-#include "mercury_signal.h"
 #include "mercury_trace_base.h"
 #include "mercury_memory_zones.h"
 #include "mercury_memory_handlers.h"
Index: mercury_signal.c
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_signal.c,v
retrieving revision 1.10
diff -u -u -r1.10 mercury_signal.c
--- mercury_signal.c	30 Jan 2002 14:51:08 -0000	1.10
+++ mercury_signal.c	31 Jan 2002 17:08:34 -0000
@@ -12,39 +12,6 @@
 
 #include "mercury_imp.h"
 
-/*
-** XXX This code is duplicated in three files:
-** mercury_memory.c, mercury_memory_handlers.c, and mercury_signal.c.
-*/
-#ifdef HAVE_SIGCONTEXT_STRUCT
-  /*
-  ** Some versions of Linux call it struct sigcontext_struct, some call it
-  ** struct sigcontext.  The following #define eliminates the differences.
-  */
-  #define sigcontext_struct sigcontext /* must be before #include <signal.h> */
-  struct sigcontext; /* this forward decl avoids a gcc warning in signal.h */
-
-  /*
-  ** On some systems (e.g. most versions of Linux) we need to #define
-  ** __KERNEL__ to get sigcontext_struct from <signal.h>.
-  ** This stuff must come before anything else that might include <signal.h>,
-  ** otherwise the #define __KERNEL__ may not work.
-  */
-  #define __KERNEL__
-  #include <signal.h>	/* must come third */
-  #undef __KERNEL__
-
-  /*
-  ** Some versions of Linux define it in <signal.h>, others define it in
-  ** <asm/sigcontext.h>.  We try both.
-  */
-  #ifdef HAVE_ASM_SIGCONTEXT
-    #include <asm/sigcontext.h>
-  #endif 
-#else
-  #include <signal.h>
-#endif
-
 #ifdef HAVE_UNISTD_H
   #include <unistd.h>
 #endif
@@ -53,6 +20,8 @@
 #include <string.h>
 #include <errno.h>
 
+#include "mercury_signal.h"
+
 #ifdef HAVE_SYS_SIGINFO
   #include <sys/siginfo.h>
 #endif 
@@ -68,9 +37,6 @@
 #ifdef	HAVE_SYS_UCONTEXT
   #include <sys/ucontext.h>
 #endif
-
-#include "mercury_imp.h"
-#include "mercury_signal.h"
 
 /*---------------------------------------------------------------------------*/
 
Index: mercury_signal.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_signal.h,v
retrieving revision 1.6
diff -u -u -r1.6 mercury_signal.h
--- mercury_signal.h	30 Jan 2002 14:51:08 -0000	1.6
+++ mercury_signal.h	31 Jan 2002 15:43:51 -0000
@@ -17,6 +17,35 @@
 #include "mercury_std.h"
 #include "mercury_conf.h"
 
+#ifdef HAVE_SIGCONTEXT_STRUCT
+  /*
+  ** Some versions of Linux call it struct sigcontext_struct, some call it
+  ** struct sigcontext.  The following #define eliminates the differences.
+  */
+  #define sigcontext_struct sigcontext /* must be before #include <signal.h> */
+  struct sigcontext; /* this forward decl avoids a gcc warning in signal.h */
+
+  /*
+  ** On some systems (e.g. most versions of Linux) we need to #define
+  ** __KERNEL__ to get sigcontext_struct from <signal.h>.
+  ** This stuff must come before anything else that might include <signal.h>,
+  ** otherwise the #define __KERNEL__ may not work.
+  */
+  #define __KERNEL__
+  #include <signal.h>	/* must come third */
+  #undef __KERNEL__
+
+  /*
+  ** Some versions of Linux define it in <signal.h>, others define it in
+  ** <asm/sigcontext.h>.  We try both.
+  */
+  #ifdef HAVE_ASM_SIGCONTEXT
+    #include <asm/sigcontext.h>
+  #endif 
+#else
+  #include <signal.h>
+#endif
+
 #ifdef HAVE_SIGACTION
 typedef struct sigaction	MR_signal_action;
 #else
--------------------------------------------------------------------------
mercury-reviews mailing list
post:  mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the reviews mailing list