[cfe-commits] r62872 - in /cfe/trunk/tools/ccc/ccclib: Arguments.py Tools.py
Daniel Dunbar
daniel at zuster.org
Fri Jan 23 12:08:17 PST 2009
Author: ddunbar
Date: Fri Jan 23 14:08:16 2009
New Revision: 62872
URL: http://llvm.org/viewvc/llvm-project?rev=62872&view=rev
Log:
ccc: Finish definition of long argument translations.
- However, these last ones do not actually work; the issue is that
they translate to batches of options and need to be reparsed. For
now we just give an unsupported error on them.
Modified:
cfe/trunk/tools/ccc/ccclib/Arguments.py
cfe/trunk/tools/ccc/ccclib/Tools.py
Modified: cfe/trunk/tools/ccc/ccclib/Arguments.py
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/ccc/ccclib/Arguments.py?rev=62872&r1=62871&r2=62872&view=diff
==============================================================================
--- cfe/trunk/tools/ccc/ccclib/Arguments.py (original)
+++ cfe/trunk/tools/ccc/ccclib/Arguments.py Fri Jan 23 14:08:16 2009
@@ -17,7 +17,8 @@
def __init__(self, name, group=None, alias=None,
isLinkerInput=False, noOptAsInput=False,
forceSeparateRender=False,
- forceJoinedRender=False):
+ forceJoinedRender=False,
+ unsupported=False):
assert group is None or isinstance(group, OptionGroup)
# Multi-level aliases are not supported, and alias options
# cannot have groups. This just simplifies option tracking, it
@@ -32,6 +33,7 @@
self.noOptAsInput = noOptAsInput
self.forceSeparateRender = forceSeparateRender
self.forceJoinedRender = forceJoinedRender
+ self.unsupported = unsupported
def getUnaliasedOption(self):
if self.alias:
@@ -446,6 +448,9 @@
return iter(self.args)
def append(self, arg):
+ if arg.opt.unsupported:
+ raise InvalidArgumentsError('option %r is unsupported' % arg.opt.name)
+
self.args.append(arg)
opt = arg.opt
@@ -814,7 +819,7 @@
self.f_unwindTablesOption = self.addOption(FlagOption('-funwind-tables', self.fGroup))
self.f_writableStringsOption = self.addOption(FlagOption('-fwritable-strings', self.fGroup))
self.f_zeroInitializedInBssOption = self.addOption(FlagOption('-fzero-initialized-in-bss', self.fGroup))
- self.addOption(JoinedOption('-f', self.fGroup))
+ self.fOption = self.addOption(JoinedOption('-f', self.fGroup))
self.coverageOption = self.addOption(FlagOption('-coverage'))
@@ -835,9 +840,9 @@
# Ugh. Need to disambiguate our naming convetion. -m x goes to
# the linker sometimes, wheres -mxxxx is used for a variety of
- # other things.
- self.mOption = self.addOption(SeparateOption('-m'))
- self.addOption(JoinedOption('-m', self.mGroup))
+ # other things.
+ self.mSeparate = self.addOption(SeparateOption('-m', self.mGroup))
+ self.mJoined = self.addOption(JoinedOption('-m', self.mGroup))
# FIXME: Why does Darwin send -a* to cc1?
self.aGroup = OptionGroup('-a')
@@ -974,8 +979,8 @@
self.addOption(JoinedOption('--include-directory=', alias=self.IOption))
self.addOption(SeparateOption('--include-directory', alias=self.IOption,
forceJoinedRender=True))
- self.addOption(JoinedOption('--machine=', alias=self.mOption))
- self.addOption(SeparateOption('--machine', alias=self.mOption,
+ self.addOption(JoinedOption('--machine=', alias=self.mJoined))
+ self.addOption(SeparateOption('--machine', alias=self.mJoined,
forceJoinedRender=True))
self.addOption(JoinedOption('--output-class-directory=', alias=self.f_outputClassDirOption))
self.addOption(SeparateOption('--output-class-directory', alias=self.f_outputClassDirOption,
@@ -1052,6 +1057,35 @@
forceSeparateRender=True))
self.addOption(SeparateOption('--prefix', alias=self.BOption))
+ # Long options with joined forms. gcc's handling of '=' for
+ # long forms makes these a bit odd.
+ #
+ # FIXME: We do not currently support these options. The
+ # problem is that they need to be reparsed in their translated
+ # form; they need to map to the correct option and we have to
+ # find a way to do so without replicating all the declared
+ # names.
+ self.addOption(JoinedOption('--debug=', alias=self.gOption,
+ unsupported=True))
+ self.addOption(FlagOption('--debug', alias=self.gOption,
+ unsupported=True))
+ self.addOption(JoinedOption('--machine-=', alias=self.mJoined,
+ unsupported=True))
+ self.addOption(JoinedOption('--machine-', alias=self.mJoined,
+ unsupported=True))
+ self.addOption(JoinedOption('--optimize=', alias=self.OOption,
+ unsupported=True))
+ self.addOption(FlagOption('--optimize', alias=self.OOption,
+ unsupported=True))
+ self.addOption(JoinedOption('--warn-=', alias=self.WOption,
+ unsupported=True))
+ self.addOption(JoinedOption('--warn-', alias=self.WOption,
+ unsupported=True))
+
+ # Ugh.
+ self.addOption(JoinedOption('--', alias=self.fOption,
+ unsupported=True))
+
def addOption(self, opt):
self.options.append(opt)
return opt
Modified: cfe/trunk/tools/ccc/ccclib/Tools.py
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/ccc/ccclib/Tools.py?rev=62872&r1=62871&r2=62872&view=diff
==============================================================================
--- cfe/trunk/tools/ccc/ccclib/Tools.py (original)
+++ cfe/trunk/tools/ccc/ccclib/Tools.py Fri Jan 23 14:08:16 2009
@@ -996,7 +996,7 @@
arglist.addAllArgs(cmd_args, arglist.parser.uGroup)
arglist.addAllArgs(cmd_args, arglist.parser.AOption)
arglist.addLastArg(cmd_args, arglist.parser.eOption)
- arglist.addAllArgs(cmd_args, arglist.parser.mOption)
+ arglist.addAllArgs(cmd_args, arglist.parser.mSeparate)
arglist.addAllArgs(cmd_args, arglist.parser.rOption)
cmd_args.extend(arglist.render(output))
More information about the cfe-commits
mailing list