Skip to content

Commit

Permalink
Skip diagnostic codes occurring inside a long diagnostic in errorck.
Browse files Browse the repository at this point in the history
  • Loading branch information
Nick Hamann committed Jul 12, 2015
1 parent da1b296 commit 4bc8369
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/etc/errorck.py
Expand Up @@ -23,6 +23,9 @@
errcode_map = {}
error_re = re.compile("(E\d\d\d\d)")

long_diag_begin = "r##\""
long_diag_end = "\"##"

for (dirpath, dirnames, filenames) in os.walk(src_dir):
if "src/test" in dirpath or "src/llvm" in dirpath:
# Short circuit for fast
Expand All @@ -35,7 +38,13 @@
path = os.path.join(dirpath, filename)

with open(path, 'r') as f:
inside_long_diag = False
for line_num, line in enumerate(f, start=1):
if inside_long_diag:
if long_diag_end in line:
inside_long_diag = False
continue

match = error_re.search(line)
if match:
errcode = match.group(1)
Expand All @@ -47,6 +56,9 @@
else:
errcode_map[errcode] = new_record

if long_diag_begin in line:
inside_long_diag = True

errors = False
all_errors = []

Expand Down

0 comments on commit 4bc8369

Please sign in to comment.