提交 8af45b1f 编写于 作者: S Simon Glass

checkpatch: Don't warn about PREFER_IF in headers/DT files

This warning should only be displayed for C files. Fix it and update the
test.
Signed-off-by: NSimon Glass <sjg@chromium.org>
上级 5c430761
...@@ -2343,7 +2343,7 @@ sub u_boot_line { ...@@ -2343,7 +2343,7 @@ sub u_boot_line {
} }
# use if instead of #if # use if instead of #if
if ($line =~ /^\+#if.*CONFIG.*/) { if ($realfile =~ /\.c$/ && $line =~ /^\+#if.*CONFIG.*/) {
WARN("PREFER_IF", WARN("PREFER_IF",
"Use 'if (IS_ENABLED(CONFIG...))' instead of '#if or #ifdef' where possible\n" . $herecurr); "Use 'if (IS_ENABLED(CONFIG...))' instead of '#if or #ifdef' where possible\n" . $herecurr);
} }
......
...@@ -388,6 +388,8 @@ index 0000000..2234c87 ...@@ -388,6 +388,8 @@ index 0000000..2234c87
"""Test for Use the livetree API""" """Test for Use the livetree API"""
pm = PatchMaker() pm = PatchMaker()
pm.add_line('common/main.c', '#ifdef CONFIG_YELLOW') pm.add_line('common/main.c', '#ifdef CONFIG_YELLOW')
pm.add_line('common/init.h', '#ifdef CONFIG_YELLOW')
pm.add_line('fred.dtsi', '#ifdef CONFIG_YELLOW')
self.checkSingleMessage(pm, "PREFER_IF") self.checkSingleMessage(pm, "PREFER_IF")
def testCommandUseDefconfig(self): def testCommandUseDefconfig(self):
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册