Skip to content

Commit

Permalink
Fix an incorrect regex in check_names.py
Browse files Browse the repository at this point in the history
Allow check_names.py to detect declarations of the form:

enum some_enum_name {

This pattern has only just appeared due to code style correction, which
explains why the issue was not previously noticed.

Signed-off-by: David Horstmann <[email protected]>
  • Loading branch information
davidhorstmann-arm committed Dec 16, 2022
1 parent 63c8be6 commit e1e776c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion tests/scripts/check_names.py
Original file line number Diff line number Diff line change
Expand Up @@ -435,8 +435,11 @@ def parse_enum_consts(self, include, exclude=None):
# Match typedefs and brackets only when they are at the
# beginning of the line -- if they are indented, they might
# be sub-structures within structs, etc.
optional_c_identifier = r"([_a-zA-Z][_a-zA-Z0-9]*)?"
if (state == states.OUTSIDE_KEYWORD and
re.search(r"^(typedef +)?enum +{", line)):
re.search(r"^(typedef +)?enum " + \
optional_c_identifier + \
r" *{", line)):
state = states.IN_BRACES
elif (state == states.OUTSIDE_KEYWORD and
re.search(r"^(typedef +)?enum", line)):
Expand Down

0 comments on commit e1e776c

Please sign in to comment.