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

Daniel Dunbar daniel at zuster.org
Wed Jan 28 11:26:20 PST 2009


Author: ddunbar
Date: Wed Jan 28 13:26:20 2009
New Revision: 63220

URL: http://llvm.org/viewvc/llvm-project?rev=63220&view=rev
Log:
ccc: Support -v; invent a version number for ccc for now, will be
shared with clang eventually.

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

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

==============================================================================
--- cfe/trunk/tools/ccc/ccclib/Arguments.py (original)
+++ cfe/trunk/tools/ccc/ccclib/Arguments.py Wed Jan 28 13:26:20 2009
@@ -883,9 +883,9 @@
 
         # Version control.
         # FIXME: Figure out what to do about these.
-        self.BOption = self.addOption(JoinedOrSeparateOption('-B'))
-        self.addOption(JoinedOrSeparateOption('-V'))
-        self.addOption(JoinedOrSeparateOption('-b'))
+        self.BOption = self.addOption(JoinedOrSeparateOption('-B', unsupported=True))
+        self.addOption(JoinedOrSeparateOption('-V', unsupported=True))
+        self.addOption(JoinedOrSeparateOption('-b', unsupported=True))
 
         # Clang static analyzer options (also see -WA,).
         self.analyzeOption = self.addOption(FlagOption('--analyze'))

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

==============================================================================
--- cfe/trunk/tools/ccc/ccclib/Driver.py (original)
+++ cfe/trunk/tools/ccc/ccclib/Driver.py Wed Jan 28 13:26:20 2009
@@ -32,6 +32,9 @@
         self.cccEcho = False
         self.cccFallback = False
 
+        # Certain options suppress the 'no input files' warning.
+        self.suppressMissingInputWarning = False
+
     # Host queries which can be forcibly over-riden by the user for
     # testing purposes.
     #
@@ -208,10 +211,11 @@
                     raise ValueError,'Encountered unknown job.'
             sys.exit(0)
 
+        vArg = args.getLastArg(self.parser.vOption)
         for j in jobs.iterjobs():
             if isinstance(j, Jobs.Command):
-                if self.cccEcho:
-                    print >>sys.stderr, ' '.join(map(repr,j.getArgv()))
+                if vArg or self.cccEcho:
+                    print >>sys.stderr, ' '.join(map(str,j.getArgv()))
                     sys.stderr.flush()
                 res = os.spawnvp(os.P_WAIT, j.executable, j.getArgv())
                 if res:
@@ -220,8 +224,8 @@
                 import subprocess
                 procs = []
                 for sj in j.commands:
-                    if self.cccEcho:
-                        print >> sys.stderr, ' '.join(map(repr,sj.getArgv()))
+                    if vArg or self.cccEcho:
+                        print >> sys.stderr, ' '.join(map(str,sj.getArgv()))
                         sys.stdout.flush()
 
                     if not procs:
@@ -290,6 +294,10 @@
         steps = {}
         for phase in phases:
             printPhase(phase, sys.stdout, steps)
+        
+    def printVersion(self):
+        # FIXME: Print default target triple.
+        print >>sys.stderr,'ccc version 1.0'
 
     def handleImmediateOptions(self, args):
         # FIXME: Some driver Arguments are consumed right off the bat,
@@ -307,6 +315,11 @@
         # FIXME: Do we want to report "argument unused" type errors in the
         # presence of things like -dumpmachine and -print-search-dirs?
         # Probably not.
+        if (args.getLastArg(self.parser.vOption) or
+            args.getLastArg(self.parser.hashHashHashOption)):
+            self.printVersion()
+            self.suppressMissingInputWarning = True
+
         arg = (args.getLastArg(self.parser.dumpmachineOption) or
                args.getLastArg(self.parser.dumpversionOption) or
                args.getLastArg(self.parser.printSearchDirsOption))
@@ -432,8 +445,7 @@
         if arg:
             raise Arguments.InvalidArgumentsError("%s: unsupported use of internal gcc option" % ' '.join(args.render(arg)))
 
-        if (not inputs and 
-            not args.getLastArg(self.parser.hashHashHashOption)):
+        if not inputs and not self.suppressMissingInputWarning:
             raise Arguments.InvalidArgumentsError("no input files")
 
         actions = []

Modified: cfe/trunk/utils/CmpDriver
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/utils/CmpDriver?rev=63220&r1=63219&r2=63220&view=diff

==============================================================================
--- cfe/trunk/utils/CmpDriver (original)
+++ cfe/trunk/utils/CmpDriver Wed Jan 28 13:26:20 2009
@@ -106,7 +106,8 @@
                 ln.startswith('Target: ') or
                 ln.startswith('Configured with: ') or
                 ln.startswith('Thread model: ') or
-                ln.startswith('gcc version')):
+                ln.startswith('gcc version') or
+                ln.startswith('ccc version')):
                 pass
             elif ln.strip().startswith('"'):
                 self.commands.append(list(splitArgs(ln)))





More information about the cfe-commits mailing list