Silence -Wunused-variable in release builds.
[llvm/stm8.git] / utils / show-diagnostics
blob3a69793abc90e12dff6c1fb370d41361fad8d8a9
1 #!/usr/bin/env python
3 import plistlib
5 def main():
6 from optparse import OptionParser, OptionGroup
7 parser = OptionParser("""\
8 usage: %prog [options] <path>
10 Utility for dumping Clang-style logged diagnostics.\
11 """)
12 (opts, args) = parser.parse_args()
14 if len(args) != 1:
15 parser.error("invalid number of arguments")
17 path, = args
19 # Read the diagnostics log.
20 f = open(path)
21 try:
22 data = f.read()
23 finally:
24 f.close()
26 # Complete the plist (the log itself is just the chunks).
27 data = """\
28 <?xml version="1.0" encoding="UTF-8"?>
29 <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" \
30 "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
31 <plist version="1.0">
32 <array>
34 </array>
35 </plist>""" % data
37 # Load the diagnostics.
38 diags = plistlib.readPlistFromString(data)
40 # Print out the diagnostics.
41 print
42 print "**** BUILD DIAGNOSTICS ****"
43 for i, file_diags in enumerate(diags):
44 file = file_diags.get('main-file')
45 print "*** %s ***" % file
46 for d in file_diags.get('diagnostics', ()):
47 print "%s:%s:%s: %s: %s" % (
48 d.get('filename'), d.get('line'), d.get('column'),
49 d.get('level'), d.get('message'))
51 if __name__ == "__main__":
52 main()