This warning should only be displayed for C files. Fix it and update the
test.
Signed-off-by: Simon Glass <sjg@chromium.org>
}
# use if instead of #if
- if ($line =~ /^\+#if.*CONFIG.*/) {
+ if ($realfile =~ /\.c$/ && $line =~ /^\+#if.*CONFIG.*/) {
WARN("PREFER_IF",
"Use 'if (IS_ENABLED(CONFIG...))' instead of '#if or #ifdef' where possible\n" . $herecurr);
}
"""Test for Use the livetree API"""
pm = PatchMaker()
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")
def testCommandUseDefconfig(self):