Skip to content

Commit

Permalink
fix find root source msg
Browse files Browse the repository at this point in the history
  • Loading branch information
srz-zumix committed Aug 21, 2020
1 parent d8b5f25 commit 65f8667
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions tools/python/iutest_compile_error_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ class ErrorMessage:
checked = False
target = False
expansion = False
root_is_expansion = False

def set_type(self, str):
s = str.strip()
Expand Down Expand Up @@ -149,11 +150,12 @@ def get_root_msg(self):

def get_source_msg(self):
root = self.get_root_msg()
while root.child:
if root.child.expansion:
root = root.child
else:
break
if self.root_is_expansion:
while root.child:
if root.child.expansion:
root = root.child
else:
break
return root


Expand Down Expand Up @@ -219,7 +221,7 @@ def parse_command_line():
return options


def parse_gcc_clang(options, f, r_expansion, note_is_child):
def parse_gcc_clang(options, f, r_expansion, note_is_child, root_is_expansion):
re_fatal = re.compile(r'(\S+)\s*:\s*fatal\s*error\s*.*')

class rmessage:
Expand Down Expand Up @@ -303,6 +305,7 @@ def message(self):
msg.file = m.file()
msg.line = m.line()
msg.type = ""
msg.root_is_expansion = root_is_expansion
n = re_message.match(line)
if n:
msg.set_type(n.group(1))
Expand Down Expand Up @@ -335,11 +338,11 @@ def message(self):


def parse_gcc(options, f):
return parse_gcc_clang(options, f, r'in (definition|expansion) of macro', False)
return parse_gcc_clang(options, f, r'in (definition|expansion) of macro', False, True)


def parse_clang(options, f):
return parse_gcc_clang(options, f, r'expanded from ', True)
return parse_gcc_clang(options, f, r'expanded from ', True, False)


def parse_vc(options, f):
Expand Down

0 comments on commit 65f8667

Please sign in to comment.