[cfe-commits] r62702 - in /cfe/trunk/tools/ccc/ccclib: Arguments.py Driver.py

Daniel Dunbar daniel at zuster.org
Wed Jan 21 10:49:34 PST 2009


Author: ddunbar
Date: Wed Jan 21 12:49:34 2009
New Revision: 62702

URL: http://llvm.org/viewvc/llvm-project?rev=62702&view=rev
Log:
ccc: Handle a few long argument form (--) translations using option
groups, and fix misdeclaration of some -W options.

Modified:
    cfe/trunk/tools/ccc/ccclib/Arguments.py
    cfe/trunk/tools/ccc/ccclib/Driver.py

Modified: cfe/trunk/tools/ccc/ccclib/Arguments.py
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/ccc/ccclib/Arguments.py?rev=62702&r1=62701&r2=62702&view=diff

==============================================================================
--- cfe/trunk/tools/ccc/ccclib/Arguments.py (original)
+++ cfe/trunk/tools/ccc/ccclib/Arguments.py Wed Jan 21 12:49:34 2009
@@ -475,17 +475,19 @@
         self.dumpversionOption = self.addOption(FlagOption('-dumpversion'))
         self.dumpmachineOption = self.addOption(FlagOption('-dumpmachine'))
         self.printSearchDirsOption = self.addOption(FlagOption('-print-search-dirs'))
-        self.printLibgccFileNameOption = self.addOption(FlagOption('-print-libgcc-file-name'))
-        # FIXME: Hrm, where does this come from? It isn't always true that
-        # we take both - and --. For example, gcc --S ... ends up sending
-        # -fS to cc1. Investigate.
-        #
-        # FIXME: Need to implement some form of alias support inside
-        # getLastOption to handle this.
-        self.printLibgccFileNameOption2 = self.addOption(FlagOption('--print-libgcc-file-name'))
-        self.printFileNameOption = self.addOption(JoinedOption('-print-file-name='))
-        self.printProgNameOption = self.addOption(JoinedOption('-print-prog-name='))
-        self.printProgNameOption2 = self.addOption(JoinedOption('--print-prog-name='))
+
+        self.printLibgccFileNameOption = OptionGroup('-print-libgcc-file-name')
+        self.addOption(FlagOption('-print-libgcc-file-name', self.printLibgccFileNameOption))
+        self.addOption(FlagOption('--print-libgcc-file-name', self.printLibgccFileNameOption))
+
+        self.printFileNameOption = OptionGroup('-print-file-name=')
+        self.addOption(JoinedOption('-print-file-name=', self.printFileNameOption))
+        self.addOption(JoinedOption('--print-file-name=', self.printFileNameOption))
+
+        self.printProgNameOption = OptionGroup('-print-prog-name=')
+        self.addOption(JoinedOption('-print-prog-name=', self.printProgNameOption))
+        self.addOption(JoinedOption('--print-prog-name=', self.printProgNameOption))
+
         self.printMultiDirectoryOption = self.addOption(FlagOption('-print-multi-directory'))
         self.printMultiLibOption = self.addOption(FlagOption('-print-multi-lib'))
         self.addOption(FlagOption('-print-multi-os-directory'))
@@ -501,8 +503,11 @@
         self.combineOption = self.addOption(FlagOption('-combine'))
         self.noIntegratedCPPOption = self.addOption(FlagOption('-no-integrated-cpp'))
         self.pipeOption = self.addOption(FlagOption('-pipe'))
-        self.saveTempsOption = self.addOption(FlagOption('-save-temps'))
-        self.saveTempsOption2 = self.addOption(FlagOption('--save-temps'))
+
+        self.saveTempsOption = OptionGroup('-save-temps')
+        self.addOption(FlagOption('-save-temps', self.saveTempsOption))
+        self.addOption(FlagOption('--save-temps', self.saveTempsOption))
+
         # FIXME: Error out if this is used.
         self.addOption(JoinedOption('-specs='))
         # FIXME: Implement.
@@ -806,13 +811,13 @@
         self.WGroup = OptionGroup('-W')
         self.ClangWGroup = OptionGroup('-W', self.WGroup)
 
-        self.addOption(JoinedOption('-Wunused-macros', self.ClangWGroup))
-        self.addOption(JoinedOption('-Wfloat-equal', self.ClangWGroup))
-        self.addOption(JoinedOption('-Wreadonly-setter-attrs', self.ClangWGroup))
-        self.addOption(JoinedOption('-Wno-format-nonliteral', self.ClangWGroup))
-        self.addOption(JoinedOption('-Wundef', self.ClangWGroup))
-        self.addOption(JoinedOption('-Wimplicit-function-declaration', self.ClangWGroup))
-        self.addOption(JoinedOption('-Wno-strict-selector-match', self.ClangWGroup))
+        self.addOption(FlagOption('-Wunused-macros', self.ClangWGroup))
+        self.addOption(FlagOption('-Wfloat-equal', self.ClangWGroup))
+        self.addOption(FlagOption('-Wreadonly-setter-attrs', self.ClangWGroup))
+        self.addOption(FlagOption('-Wno-format-nonliteral', self.ClangWGroup))
+        self.addOption(FlagOption('-Wundef', self.ClangWGroup))
+        self.addOption(FlagOption('-Wimplicit-function-declaration', self.ClangWGroup))
+        self.addOption(FlagOption('-Wno-strict-selector-match', self.ClangWGroup))
 
         self.WnonportableCfstringsOption = self.addOption(JoinedOption('-Wnonportable-cfstrings', self.WGroup))
         self.WnoNonportableCfstringsOption = self.addOption(JoinedOption('-Wno-nonportable-cfstrings', self.WGroup))

Modified: cfe/trunk/tools/ccc/ccclib/Driver.py
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/ccc/ccclib/Driver.py?rev=62702&r1=62701&r2=62702&view=diff

==============================================================================
--- cfe/trunk/tools/ccc/ccclib/Driver.py (original)
+++ cfe/trunk/tools/ccc/ccclib/Driver.py Wed Jan 21 12:49:34 2009
@@ -538,8 +538,7 @@
 
         archs = {}
         hasDashM = args.getLastArg(self.parser.MGroup)
-        hasSaveTemps = (args.getLastArg(self.parser.saveTempsOption) or 
-                        args.getLastArg(self.parser.saveTempsOption2))
+        hasSaveTemps = args.getLastArg(self.parser.saveTempsOption)
         for arg in args:
             if arg.opt is self.parser.archOption:
                 # FIXME: Canonicalize this.
@@ -602,8 +601,7 @@
         jobs = Jobs.JobList()
 
         finalOutput = args.getLastArg(self.parser.oOption)
-        hasSaveTemps = (args.getLastArg(self.parser.saveTempsOption) or
-                        args.getLastArg(self.parser.saveTempsOption2))
+        hasSaveTemps = args.getLastArg(self.parser.saveTempsOption)
         hasNoIntegratedCPP = args.getLastArg(self.parser.noIntegratedCPPOption)
         hasTraditionalCPP = args.getLastArg(self.parser.traditionalCPPOption)
         hasPipe = args.getLastArg(self.parser.pipeOption)





More information about the cfe-commits mailing list