[m-dev.] for review: clean up handling of config macros

Fergus Henderson fjh at cs.mu.OZ.AU
Mon Mar 16 22:08:53 AEDT 1998


On 16-Mar-1998, Tyson Dowd <trd at stimpy.cs.mu.oz.au> wrote:
> On 15-Mar-1998, Fergus Henderson <fjh at cs.mu.OZ.AU> wrote:
> > 
> > /*
> > ** MR_USE_STACK_LAYOUTS -- stack layouts are in use, generate stack
> > **                         layout structures.
> > */
> > #if defined(MR_STACK_TRACE) || defined(NATIVE_GC)
> >   #define MR_USE_STACK_LAYOUTS
> > #else
> >   #undef MR_USE_STACK_LAYOUTS
> > #endif
> 
> I'm not sure about #undefing.  It should be possible to set flags using
> -D and have them work -- won't this file would just undefine them?

The idea was to clearly separate the flags which could be set on the
command line from those which are computed based on the values of
the flags on the command line.

So for *some* flags, you can set them on the command line with -D,
but others are basically for internal use only, and so you should
just leave them alone.  (Or in other words, if you want to change
them, you should change the #ifdef in the header file.)

The code above enforces this by ignoring any command-line setting.
But probably it would be better to do

	#ifdef MR_USE_STACK_LAYOUTS
	  #error "MR_USE_STACK_LAYOUTS should not be defined on the cmd line"
	#endif
	#if defined(MR_STACK_TRACE) || defined(NATIVE_GC)
	  #define MR_USE_STACK_LAYOUTS
	#endif

Would you be happy with that?

Now, it is possible that I may have put some flags in the wrong
category.  The ones for "internal use only" are

	MR_USE_STACK_LAYOUTS
	MR_INSERT_LABELS
	MR_STATIC_ADDRESSES
	MR_NEED_INITIALIZATION_CODE

-- 
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.



More information about the developers mailing list