[m-dev.] tracing code in runtime directory

Fergus Henderson fjh at cs.mu.OZ.AU
Thu Nov 7 01:08:17 AEDT 2002


Why is there code dealing with pid_ts in runtime/mercury_trace_base.h?

This requires inclusion of <unistd.h>, which is a namespace violation;
it's OK for the runtime to make use of <unistd.h> in its implementation,
but IMHO we should not include non-ISO header files in the Mercury header
files which get included in user's programs, since that could result in
name clashes with the user's program in a way that is difficult for the
user to avoid.

Also, this fails on Mingw (or Windows with Cygwin using "gcc -mno-cygwin"),
because on that platform, unistd.h only defines pid_t if -ansi is not
specified.  The file runtime/mercury_trace_base.h gets included in
mercury_imp.h (via mercury_wrapper.h), and lots of files which are compiled
with `mgnuc' rather than `mgnuc --no-ansi' then get errors because the
declaration using pid_t is not syntactically correct.

I think it would be better for mercury_trace_base.h to just have a function
pointer for finalization, and trace/*.c can set this to an appropriate

On a similar note, why is MR_trace_get_action() in
runtime/mercury_trace_base.c rather than some C file in the trace
directory?  It doesn't seem to be used by any code in the runtime.

Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
The University of Melbourne         |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- 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