Merge pull request #6811 from davidhorstmann-arm/2.28-fix-check-names-enum-regex

[Backport 2.28] Fix an incorrect regex in check_names.py
diff --git a/tests/scripts/check_names.py b/tests/scripts/check_names.py
index 414ce43..f71a978 100755
--- a/tests/scripts/check_names.py
+++ b/tests/scripts/check_names.py
@@ -435,8 +435,11 @@
                     # 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)):