[PATCH] D27405: Make sancov.py py3-compatible

Michał Górny via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 31 23:48:50 PST 2017


mgorny added inline comments.


================
Comment at: compiler-rt/trunk/lib/sanitizer_common/scripts/sancov.py:73
     size -= 8
-    s = struct.unpack_from(TypeCodeForStruct(bits) * (size * 8 / bits), f.read(size))
-  print >>sys.stderr, "%s: read %d %d-bit PCs from %s" % (prog_name, size * 8 / bits, bits, path)
+    w = size * 8 // bits
+    s = struct.unpack_from(TypeCodeForStruct(bits) * (w), f.read(size))
----------------
That's Python 2.7+ but I guess we don't have to care about 2.6 anymore.


================
Comment at: compiler-rt/trunk/lib/sanitizer_common/scripts/sancov.py:140
   with open(map_path, mode="rt") as f_map:
-    print >> sys.stderr, "%s: reading map %s" % (prog_name, map_path)
+    sys.stderr.write("%s: reading map %s" % (prog_name, map_path))
     bits = int(f_map.readline())
----------------
I think you ate a newline here.


================
Comment at: compiler-rt/trunk/lib/sanitizer_common/scripts/sancov.py:223
   for pc in sorted(missing):
-    print "0x%x" % pc
+    print("0x%x" % pc)
 
----------------
Newline?


Repository:
  rL LLVM

https://reviews.llvm.org/D27405





More information about the llvm-commits mailing list