From d82ca00733c629df6e89e181192696afaeba1936 Mon Sep 17 00:00:00 2001 From: Thomas Tanner Date: Sun, 8 Nov 2015 09:46:30 +0000 Subject: Separated out the include what you use mappings into separate files, more improvements --- massage_messages.py | 39 ++++++++++++++++++++++++++++++++------- 1 file changed, 32 insertions(+), 7 deletions(-) (limited to 'massage_messages.py') diff --git a/massage_messages.py b/massage_messages.py index c1b31c96..159c2950 100644 --- a/massage_messages.py +++ b/massage_messages.py @@ -4,6 +4,8 @@ import fileinput import re +import subprocess +import sys removing = None @@ -11,15 +13,18 @@ includes = dict foundline = 0 -for line in fileinput.input(): +def process_next_line(line): # Look for '\) : ([^:])?:' # Replace with ') : \1 I0000: + global removing + global includes + global foundline line = line.rstrip() if removing: if line == '': removing = None print - continue + return else: # Really we should stash these so that if we get a 'class xxx' in the # add lines we can print it here. also we could do the case fixing. @@ -29,16 +34,22 @@ for line in fileinput.input(): print '%s(%s) : warning I0001: Unnecessary include of %s' % (removing, m.group(2), m.group(1)) foundline = m.group(1) else: - m = re.match(r'- (.*); +// lines (.*)-', line) + m = re.match(r'- (.*) +// lines (.*)-', line) if m: print '%s(%s) : warning I0002: Unnecessary forward ref of %s' % (removing, m.group(2), m.group(1)) foundline = m.group(1) else: print '********* I got confused **********' - line = re.sub(r'\)\s*:\s*([^:]*):', r') : \1 I1234:', line) - # Sadly qt doesn't seem to support 'info' in the issues tab. - line = re.sub(r': note I1234:', r': warning I1234:', line) + # Replace clang :line:column: type: with ms (line) : type nnnn: + # filename:line:column type: + # replace with brackets + line = re.sub(r':(\d+):\d+: ([^:]*):', r'(\1) : \2 I1234:', line) + + if ': note I1234:' in line: + line = ' ' + line + line = line.replace(': note I1234:', '') + print line if line.endswith(' should remove these lines:'): removing = (line.split(' '))[0] @@ -71,4 +82,18 @@ namespace Ui { class AboutDialog; } // lines 31-31 --- """ -# added lines should come after the first entry with a line number. + # added lines should come after the first entry with a line number. + +process = subprocess.Popen(sys.argv[1:], + stdout = subprocess.PIPE, stderr = subprocess.STDOUT) +while True: + output = process.stdout.readline() + if output == '' and process.poll() is not None: + break + if output: + process_next_line(output) +rc = process.poll() +# The return code you get appears to be more to do with the amount of output +# generated than any real error. We should error if any ': error:' lines are +# detected + -- cgit v1.3.1