cFS-GroundSystem
cFS-GroundSystem copied to clipboard
CHeaderParser hangs forever if a line has both "{" and "}"
Describe the bug The CHeaderParser script will hang forever searching for command parameters if a line has both a "{" and a "}". This includes commented lines since there is nothing in the script to ignore comment lines.
To Reproduce
- Add a comment such as /* {TEST_PARSER} */ to a header file
- Add that header file to CHeaderParser-hdr-paths.txt
Expected behavior For one, the parser should ignore structs that are commented out so this line could be ignored entirely, but otherwise it should be adding that line to the list of command structs and continuing
Code snips
From CHeaderParser.py:
`
while inside_struct:
# Check for the end of the structure
# We will still want to know what line this is
if '}' in file_lines[line_num]:
# Clear the flag, we found the end.
inside_struct = False
# Add line number to list, even if it has a '}'
lines_of_struct.append(line_num)
# Now that we know the struct is over, add list of lines
# to the sets of command structures
list_cmd_structs.append(lines_of_struct)
line_num += 1
break
System observed on:
- OS: Ubuntu 20.0.4
- Versions: v3.3.0-rc4