[m-dev.] trivial diff: fix gcc warning about `struct sigcontext'

Fergus Henderson fjh at cs.mu.OZ.AU
Thu Sep 7 18:44:57 AEDT 2000


Estimated hours taken: 0.5

runtime/mercury_signal.c:
runtime/mercury_memory.c:
runtime/mercury_memory_handlers.c:
	Add a forward declaration of `struct sigcontext' to avoid a
	gcc warning inside <signal.h>.  This is needed since our
	`#define sigcontext_struct sigcontext' hack breaks the Linux
	headers a bit -- it means that an earlier forward declaration
	of `struct sigcontext_struct' won't prevent this warning.
	Also add an XXX comment about the code being duplicated three times.

Workspace: /home/pgrad/fjh/ws/hg
Index: runtime/mercury_memory.c
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_memory.c,v
retrieving revision 1.19
diff -u -d -r1.19 mercury_memory.c
--- runtime/mercury_memory.c	2000/06/29 09:55:36	1.19
+++ runtime/mercury_memory.c	2000/09/07 07:21:54
@@ -36,12 +36,17 @@
 
 #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
Index: runtime/mercury_memory_handlers.c
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_memory_handlers.c,v
retrieving revision 1.14
diff -u -d -r1.14 mercury_memory_handlers.c
--- runtime/mercury_memory_handlers.c	2000/08/03 06:18:49	1.14
+++ runtime/mercury_memory_handlers.c	2000/09/07 07:23:12
@@ -22,12 +22,17 @@
 #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
Index: runtime/mercury_signal.c
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_signal.c,v
retrieving revision 1.7
diff -u -d -r1.7 mercury_signal.c
--- runtime/mercury_signal.c	2000/08/03 06:18:53	1.7
+++ runtime/mercury_signal.c	2000/09/07 07:23:19
@@ -12,12 +12,17 @@
 
 #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

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>  |  of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3        |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list