[Python-Dev] -C in Setup files

Guido van Rossum guido@python.org
2002年3月22日 21:37:53 -0500


> Pete Shinners reported that Distutils doesn't treat the -C option in a
> Setup file the same as the makesetup script. He's right, but I don't think
> the -C option is useful in makesetup at all!
>> The relevant bit of code in makesetup is:
> case $arg in
> -framework) libs="$libs $arg"; skip=libs;
> ;;
> -[IDUCfF]*) cpps="$cpps $arg";;
> -Xlinker) libs="$libs $arg"; skip=libs;;
>> '-Cfoo' in a Setup file therefore causes -Cfoo to be added to the list
> of compiler flags, but at least in GCC, that doesn't mean anything; -C
> indicates that the preprocessor shouldn't strip comments, and it
> doesn't take an argument. (Anyone know what -C does in other
> compilers?)

I believe that "don't skip comments" is the traditional meaning. The
makesetup script is technically doing the right thing here -- $arg
will contain the string "-C" if -C is used correctly, so it will add
"-C" to the list of preprocessor options (which are later passed to
the C compiler).
If you want to be strict and disallow -Cfoo, you could change it to
 -[IDUfF]*) cpps="$cpps $arg";;
 -C) cpps="$cpps $arg";;
but I'm not sure I see the point.
> Because of this, I think -C in makesetup has been useless since
> revision 1.1 of makesetup (which is 1994 -- Python 1.0.0), so I doubt
> anyone has ever used it. Distutils should do something useful with
> it, and IMHO that would be to make '-C cpparg' add 'cpparg' to the
> compiler's arguments. Thoughts? Should makesetup be fixed to match?

I agree that there's little use for -C, but I don't think makesetup is
incorrect.
I don't understand what you want it to do in Distutils: above, you say
that "-C" doesn't take an argument, so why would you want "-C cpparg"
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???
--Guido van Rossum (home page: http://www.python.org/~guido/)

AltStyle によって変換されたページ (->オリジナル) /