This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: specs: *predefine oddity


Michael Meissner writes:
 > On Tue, Nov 02, 1999 at 06:45:57PM +0100, Ralf Corsepius wrote:
 > > 3)
 > > *predefines:
 > > -Dfoo -D__foo__
 > > Expands to this weird and unnecessarily lengthy line:
 > > -Dfoo -D__foo__ -D__foo__ -D__foo__ -D__foo
 > > 
 > > Is this really the desired behaviour ? Is it documented somewhere and
 > > can we rely on this behaviour to be kept in future gcc-versions?
 > 
 > Yes, it is desired beahvior.  

Michael's comments are all correct, but I assumed Ralf's question
was not about the treatment of -Dfoo, but about the treatment of
-D__foo__ (although it might have been about both).

 > Yes, it is documented (look for the documentation for
 > CPP_PREDEFINES in the tm.texi part of the manual).

GCC's treatment of -D__foo__ is not documented (at CPP_PREDEFINES 
at least).  (Nor is it documented that -Dfoo will also produce
-D__foo.)  This is unfortunate.  Documenting the behavior of
CPP_PREDEFINES more fully would be an easy beginners project
for someone looking for something to do (you'd need to consult
the code in gcc to be sure of it's behavior).

I suspect the reason that the treatment of -D__foo__ is not documented
is because no-one expects -D__foo__ to be put in CPP_PREDEFINES, but
that instead it would be put into CPP_SPECS.  If you need a -D__foo__
but don't want a -Dfoo, put the -D__foo__ into CPP_SPECS not 
CPP_PREDEFINES.  This too could be added to the docs.

Another possible issue here is that while we document the macros
that produce the default specs, we don't document the actual specs.
I don't know how many people mess with the specs file but not with
the target macros, but perhaps there are enough of them to justify
documenting the specs themselves separate from the target macros
that produce them.  Someone could reorganize the doc so that, for
example, the current doc for CPP_PREDEFINES is moved into new doc
for the spec *predefines, and the doc for CPP_PREDEFINES would be
changed to indicate that it's value is the initial value for
*predefines.

Anyway enough rambling, thanks for the note Ralf, and hopefully
we've given you enough to go forward on.

                                         -gavin...


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]