Changeset 4ca26c9b in mainline
- Timestamp:
- 2010-06-22T11:37:50Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- fdaad75d
- Parents:
- 6b80696
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
tools/checkers/vcc.py
r6b80696 r4ca26c9b 36 36 import subprocess 37 37 import jobfile 38 import re 38 39 39 40 jobs = [ 40 "kernel/kernel.job", 41 "uspace/srv/clip/clip.job" 41 "kernel/kernel.job" 42 42 ] 43 44 re_attribute = re.compile("__attribute__\s*\(\(.*\)\)") 45 re_va_list = re.compile("__builtin_va_list") 43 46 44 47 def usage(prname): 45 48 "Print usage syntax" 46 print prname + " <ROOT> "49 print prname + " <ROOT> [VCC_PATH]" 47 50 48 51 def cygpath(upath): … … 68 71 69 72 for line in preproc.splitlines(): 73 70 74 # Ignore preprocessor directives 75 71 76 if (line.startswith('#')): 72 77 continue 78 79 # Remove __attribute__((.*)) GCC extension 80 81 line = re.sub(re_attribute, "", line) 82 83 # Ignore unsupported __builtin_va_list type 84 # (a better solution replacing __builrin_va_list with 85 # an emulated implementation is needed) 86 87 line = re.sub(re_va_list, "void *", line) 73 88 74 89 tmpf.write("%s\n" % line) … … 80 95 return True 81 96 82 def vcc( root, job):97 def vcc(vcc_path, root, job): 83 98 "Run Vcc on a jobfile" 84 99 … … 120 135 tmpfqname = os.path.join(base, tmpfname) 121 136 137 vccfname = "%s.i" % srcfname 138 vccfqname = os.path.join(base, vccfname); 139 122 140 # Only C files are interesting for us 123 141 if (tool != "cc"): … … 130 148 131 149 # Run Vcc 150 print " -- %s --" % srcfname 151 retval = subprocess.Popen([vcc_path, cygpath(tmpfqname)]).wait() 132 152 133 retval = subprocess.Popen(['vcc', cygpath(tmpfqname)]).wait() 153 if (retval != 0): 154 return False 134 155 135 # Cleanup 156 # Cleanup, but only if verification was successful 157 # (to be able to examine the preprocessed file) 136 158 137 159 if (os.path.isfile(tmpfqname)): 138 160 os.remove(tmpfqname) 139 140 if (retval != 0): 141 return False 161 os.remove(vccfqname) 142 162 143 163 return True … … 149 169 150 170 rootdir = os.path.abspath(sys.argv[1]) 171 if (len(sys.argv) > 2): 172 vcc_path = sys.argv[2] 173 else: 174 vcc_path = "/cygdrive/c/Program Files (x86)/Microsoft Research/Vcc/Binaries/vcc" 175 176 if (not os.path.isfile(vcc_path)): 177 print "%s is not a binary." % vcc_path 178 print "Please supply the full Cygwin path to Vcc as the second argument." 179 return 180 151 181 config = os.path.join(rootdir, "HelenOS.config") 152 182 … … 157 187 158 188 for job in jobs: 159 if (not vcc( rootdir, job)):189 if (not vcc(vcc_path, rootdir, job)): 160 190 print 161 191 print "Failed job: %s" % job
Note:
See TracChangeset
for help on using the changeset viewer.