]> git.ipfire.org Git - thirdparty/krb5.git/commitdiff
Fix cast regexp in C style checker
authorGreg Hudson <ghudson@mit.edu>
Thu, 11 Oct 2012 17:22:29 +0000 (13:22 -0400)
committerGreg Hudson <ghudson@mit.edu>
Thu, 11 Oct 2012 17:22:29 +0000 (13:22 -0400)
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.

src/util/cstyle-file.py

index edf8a3917388fda2751fc92e6544aaeaea684275..229510422045dcca4f1cbe83945bf93104963945 100644 (file)
@@ -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.