Skip to content

Commit

Permalink
Fix cast regexp in C style checker
Browse files Browse the repository at this point in the history
In check_cast, we want to match cast operators with or without spaces
after the closing paren, and then check for spaces after we match.
Also, per the comment, we want to match potential cast operators
followed by an open paren.
  • Loading branch information
greghudson committed Oct 11, 2012
1 parent a9126e9 commit dd25220
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/util/cstyle-file.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ def check_cast(line, ln):
# multiplication operator. We will get false positives from
# "(*fp) (args)" and "if (condition) statement", but both of those
# are erroneous anyway.
for m in re.finditer(r'\(([^(]+)\)(\s+)[a-zA-Z_]', line):
for m in re.finditer(r'\(([^(]+)\)(\s*)[a-zA-Z_(]', line):
if m.group(2):
warn(ln, 'Space after cast operator (or inline if/while body)')
# Check for casts like (char*) which should have a space.
Expand Down

0 comments on commit dd25220

Please sign in to comment.