util: Add verifier for opening braces of enums

Make sure that opening braces of enums are not declared
in the same line of the enum name.

This does not work for multi-line enums.

Change-Id: I5fbdc317f954946127e6e79dbcaf46674abccb41
Signed-off-by: Daniel R. Carvalho <odanrc@yahoo.com.br>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/43327
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Gabe Black <gabe.black@gmail.com>
Maintainer: Gabe Black <gabe.black@gmail.com>
This commit is contained in:
Daniel R. Carvalho
2021-03-19 19:20:17 -03:00
committed by Daniel Carvalho
parent 7f1de4e686
commit df8ef51d61

View File

@@ -470,7 +470,7 @@ class ClassBraces(LineVerifier):
test_name = 'class opening brace position'
opt_name = 'classbrace'
regex = re.compile(r'\A(\s*)((class|struct)\s+[A-Z].*\S)\s*\{')
regex = re.compile(r'\A(\s*)((class|struct|enum)\s+[A-Z].*\S)\s*\{')
def check_line(self, line, **kwargs):
return self.regex.search(line) == None