[m-rev.] diff: fix bug in runtime/mercury_signal.h
Simon Taylor
stayl at cs.mu.OZ.AU
Fri Feb 1 19:46:30 AEDT 2002
On 01-Feb-2002, Fergus Henderson <fjh at cs.mu.OZ.AU> wrote:
> On 01-Feb-2002, Simon Taylor <stayl at cs.mu.OZ.AU> wrote:
> >
> > 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 @@
> ...
> > + ** This stuff must come before anything else that might include <signal.h>,
> > + ** otherwise the #define __KERNEL__ may not work.
>
> This is very fragile. There are lots of places that include
> mercury_signal.h. Have you checked that none of them include
> anything which includes <signal.h> before they include mercury_signal.h?
This is only an issue where `struct sigcontext' is needed (mercury_memory.c
and mercury_memory_handlers.c). I've added some more comments.
Simon.
Estimated hours taken: 0.2
runtime/mercury_signal.h:
runtime/mercury_memory.c:
runtime/mercury_memory_handlers.c:
Add a comment that mercury_signal.h must be included
before <signal.h> if `struct_sigcontext' is needed.
Index: mercury_memory.c
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_memory.c,v
retrieving revision 1.25
diff -u -u -r1.25 mercury_memory.c
--- mercury_memory.c 31 Jan 2002 17:10:17 -0000 1.25
+++ mercury_memory.c 1 Feb 2002 07:54:00 -0000
@@ -35,6 +35,11 @@
/*---------------------------------------------------------------------------*/
#include "mercury_imp.h"
+
+/*
+** This include must come before anything else that might include <signal.h>.
+** See the commments in mercury_signal.h.
+*/
#include "mercury_signal.h"
#ifdef HAVE_UNISTD_H
Index: mercury_memory_handlers.c
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_memory_handlers.c,v
retrieving revision 1.23
diff -u -u -r1.23 mercury_memory_handlers.c
--- mercury_memory_handlers.c 31 Jan 2002 17:10:17 -0000 1.23
+++ mercury_memory_handlers.c 1 Feb 2002 07:02:27 -0000
@@ -21,6 +21,11 @@
#include <stdio.h>
#include <string.h>
+
+/*
+** This include must come before anything else that might include <signal.h>.
+** See the commments in mercury_signal.h.
+*/
#include "mercury_signal.h"
#ifdef HAVE_SYS_SIGINFO
Index: mercury_signal.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_signal.h,v
retrieving revision 1.7
diff -u -u -r1.7 mercury_signal.h
--- mercury_signal.h 31 Jan 2002 17:10:17 -0000 1.7
+++ mercury_signal.h 1 Feb 2002 08:22:55 -0000
@@ -8,6 +8,9 @@
** mercury_signal.h - functions for setting up signal handlers.
**
** This defines a generic signal handler setup mechanism.
+**
+** NOTE: If `struct sigcontext' is needed, mercury_signal.h must be
+** included before anything which could include <signal.h>.
*/
#ifndef MERCURY_SIGNAL_H
--------------------------------------------------------------------------
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