Signed-off-by: Joe Stringer <j...@ovn.org>
---
 utilities/checkpatch.py | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/utilities/checkpatch.py b/utilities/checkpatch.py
index 26eb5c32b9bc..e795646de4a8 100755
--- a/utilities/checkpatch.py
+++ b/utilities/checkpatch.py
@@ -68,6 +68,7 @@ __regex_is_for_if_single_line_bracket = \
     re.compile(r'^ +(if|for|while) \(.*\)')
 __regex_ends_with_bracket = \
     re.compile(r'[^\s]\) {(\s+/\*[\s\Sa-zA-Z0-9\.,\?\*/+-]*)?$')
+__regex_pointer_declaration_missing_whitespace = re.compile(r'[a-zA-Z0-9]\*')
 
 skip_leading_whitespace_check = False
 skip_trailing_whitespace_check = False
@@ -157,6 +158,15 @@ def if_and_for_end_with_bracket_check(line):
     return True
 
 
+def pointer_whitespace_check(line):
+    """Return TRUE if there is not an asterisk between a pointer name and the
+       asterisk that denotes this is a apionter type, ie: 'struct foo*'"""
+
+    if __regex_pointer_declaration_missing_whitespace.search(line) is not None:
+        return True
+    return False
+
+
 def ovs_checkpatch_parse(text):
     global print_file_name
     lineno = 0
@@ -257,6 +267,10 @@ def ovs_checkpatch_parse(text):
             if not if_and_for_end_with_bracket_check(cmp_line):
                 print_line = True
                 print_error("Inappropriate bracing around statement", lineno)
+            if pointer_whitespace_check(cmp_line):
+                print_line = True
+                print_error("Inappropriate spacing in pointer declaration",
+                            lineno)
             if print_line:
                 print("\n%s\n" % line)
     if __errors or __warnings:
-- 
2.11.1

_______________________________________________
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to