[Python-Dev] -C in Setup files

Guido van Rossum guido@python.org
Fri, 22 Mar 2002 22:29:59 -0500


> On Fri, Mar 22, 2002 at 09:37:53PM -0500, Guido van Rossum wrote:
> >to add "cpparg" to the compiler arguments?  Is that because you need a
> >way to transparently pass compiler arguments, and the C in -C can
> >stand for compiler???
> 
> Yes, this is what Pete is after.  Perhaps he thought -C was the
> relevant option because of 'C for compiler', and because Setup.dist
> says "<cpparg> is anything starting with -I, -D, -U or -C" in a
> comment, which can be taken to imply that -C takes an argument (the
> other three options all do).  

I think -C is not a good choice, since it *does* represent a cc option
with a long history, even if it's not particularly useful.
(Amazingly, compilations with -C mostly just work -- the backend
parser has its own comment stripper, which normally isn't used because
it's more efficient to strip them in the preprocessor.  At least
that's what I remember from aeons ago.)

> Why is -C in makesetup at all?

Probably just because it was one of the 4 CPP options I knew when I
wrote makesetup 1.1.  I don't expect anybody has ever used it.

> It only seems relevant when also used with -E, and makesetup will
> add -E to the link line, not the compile line.

But that doesn't make sense, because makesetup is creating Make rules
that create .o files (and .so files, after *shared*), and -E doesn't
create a .o file.  I think the inclusion of -E in the linker options
is merely an artefact from the rule that passes most uppercase options
to the linker (the case -[A-Zl]* appeared in rev. 1.5, in 1994).  All
this is hopelessly heuristic and has lots of gray areas where it's
unclear what was intended.

> Anyway, looking at makesetup, there's no way to add arbitrary switches
> for the C compiler.  Maybe add -Xcompiler, by analogy with -Xlinker?

Sounds good.

--Guido van Rossum (home page: http://www.python.org/~guido/)