summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIlya Maximets <i.maximets@samsung.com>2019-08-09 14:53:29 +0300
committerIlya Maximets <i.maximets@samsung.com>2019-08-12 10:56:35 +0300
commitaacad8685e3d873d15d7fc7974763655862477de (patch)
tree596b07561aa5f041a3093633dd20b814f55d9c24
parent05629ed271a67c737227a92f35bcff199648d604 (diff)
downloadopenvswitch-aacad8685e3d873d15d7fc7974763655862477de.tar.gz
checkpatch: Fix regexp for if, while, etc inside macros.
This allows to use a one-character expression inside the 'if' statement and multiple spaces before the line continuation character. Fixes false positive in case like this: #define MACRO(ARG) \ if (a) { \ do_work(ARG); \ } Fixes: 16770c6d9179 ("checkpatch: support macro continuation") Signed-off-by: Ilya Maximets <i.maximets@samsung.com> Acked-by: Aaron Conole <aconole@redhat.com>
-rwxr-xr-xtests/checkpatch.at5
-rwxr-xr-xutilities/checkpatch.py2
2 files changed, 6 insertions, 1 deletions
diff --git a/tests/checkpatch.at b/tests/checkpatch.at
index f3b26dd34..fe21acdf2 100755
--- a/tests/checkpatch.at
+++ b/tests/checkpatch.at
@@ -230,6 +230,11 @@ try_checkpatch \
"COMMON_PATCH_HEADER
+ $ctr (first_run) { \\
"
+
+try_checkpatch \
+ "COMMON_PATCH_HEADER
+ + $ctr (a) { \\
+ "
done
AT_CLEANUP
diff --git a/utilities/checkpatch.py b/utilities/checkpatch.py
index de5061406..f8fa00e30 100755
--- a/utilities/checkpatch.py
+++ b/utilities/checkpatch.py
@@ -172,7 +172,7 @@ __regex_has_xxx_mark = re.compile(r'.*xxx.*', re.IGNORECASE)
__regex_added_doc_rst = re.compile(
r'\ndiff .*Documentation/.*rst\nnew file mode')
__regex_empty_return = re.compile(r'\s*return;')
-__regex_if_macros = re.compile(r'^ +(%s) \([\S][\s\S]+[\S]\) { \\' %
+__regex_if_macros = re.compile(r'^ +(%s) \([\S]([\s\S]+[\S])*\) { +\\' %
__parenthesized_constructs)
skip_leading_whitespace_check = False