Skip to content

Skip diagnostic codes occurring inside a long diagnostic in errorck. #26984

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 13, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions src/etc/errorck.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,18 @@
errcode_map = {}
error_re = re.compile("(E\d\d\d\d)")

# In the register_long_diagnostics! macro, entries look like this:
#
# EXXXX: r##"
# <Long diagnostic message>
# "##,
#
# These two variables are for detecting the beginning and end of diagnostic
# messages so that duplicate error codes are not reported when a code occurs
# inside a diagnostic message
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 +47,14 @@
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:
# Skip duplicate error code checking for this line
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 +66,9 @@
else:
errcode_map[errcode] = new_record

if long_diag_begin in line:
inside_long_diag = True

errors = False
all_errors = []

Expand Down