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

Tyson Dowd trd at stimpy.cs.mu.oz.au
Mon Mar 16 22:18:44 AEDT 1998


On 16-Mar-1998, Fergus Henderson <fjh at cs.mu.OZ.AU> wrote:
> 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?

Yes.  This is much better.  It adequately addresses both our concerns.

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

This list is fine - I don't expect anyone but developers to need to
use them, and they can get the error message and deal with it in
whatever way they see fit.  A silent #undef could mean a lot
of time wasted.




More information about the developers mailing list