mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-13 09:33:50 +00:00
[utils] Tweak utils/clang-parse-diagnostics-file to ignore autoconf diagnostics.
- Also, don't print headers if we aren't going to print any diagnostics. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@170973 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
629fb82419
commit
70d4e75a37
@ -1,5 +1,6 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
|
|
||||||
|
import os
|
||||||
import plistlib
|
import plistlib
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
@ -59,20 +60,37 @@ Utility for dumping Clang-style logged diagnostics.\
|
|||||||
</array>
|
</array>
|
||||||
</plist>""" % data
|
</plist>""" % data
|
||||||
|
|
||||||
# Load the diagnostics.
|
# Get the list of files and diagnostics to report.
|
||||||
|
to_report = []
|
||||||
diags = plistlib.readPlistFromString(data)
|
diags = plistlib.readPlistFromString(data)
|
||||||
|
for file_diags in diags:
|
||||||
|
file = file_diags.get('main-file')
|
||||||
|
|
||||||
# Print out the diagnostics.
|
# Ignore diagnostics for 'conftest.c', which is the file autoconf uses
|
||||||
|
# for its tests (which frequently will have warnings).
|
||||||
|
if os.path.basename(file) == 'conftest.c':
|
||||||
|
continue
|
||||||
|
|
||||||
|
# Get the diagnostics for the selected levels.
|
||||||
|
selected_diags = [d
|
||||||
|
for d in file_diags.get('diagnostics', ())
|
||||||
|
if levels[d.get('level')] or opts.all]
|
||||||
|
if selected_diags:
|
||||||
|
to_report.append((file, selected_diags))
|
||||||
|
|
||||||
|
# If there are no diagnostics to report, show nothing.
|
||||||
|
if not to_report:
|
||||||
|
return
|
||||||
|
|
||||||
|
# Otherwise, print out the diagnostics.
|
||||||
print
|
print
|
||||||
print "**** BUILD DIAGNOSTICS ****"
|
print "**** BUILD DIAGNOSTICS ****"
|
||||||
for i, file_diags in enumerate(diags):
|
for file,selected_diags in to_report:
|
||||||
file = file_diags.get('main-file')
|
|
||||||
print "*** %s ***" % file
|
print "*** %s ***" % file
|
||||||
for d in file_diags.get('diagnostics', ()):
|
for d in selected_diags:
|
||||||
if levels[d.get('level')] or opts.all:
|
print " %s:%s:%s: %s: %s" % (
|
||||||
print " %s:%s:%s: %s: %s" % (
|
d.get('filename'), d.get('line'), d.get('column'),
|
||||||
d.get('filename'), d.get('line'), d.get('column'),
|
d.get('level'), d.get('message'))
|
||||||
d.get('level'), d.get('message'))
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user