checkpatch.pl: disable arch-specific test for syscall tests

Message ID 1474989265-30733-1-git-send-email-riku.voipio@linaro.org
State New
Headers show

Commit Message

Riku Voipio Sept. 27, 2016, 3:14 p.m.
From: Riku Voipio <riku.voipio@linaro.org>


Linux-user and bsd-user code need ifdef guards for new system
calls that aren't implemented on all host/target combinations.
Allow ifdefs for system calls when defined as __NR_foo.

Signed-off-by: Riku Voipio <riku.voipio@linaro.org>

---
 scripts/checkpatch.pl | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

-- 
2.1.4

Patch

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 3afa19a..e17f445 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -2405,8 +2405,10 @@  sub process {
 		}
 # check of hardware specific defines
 # we have e.g. CONFIG_LINUX and CONFIG_WIN32 for common cases
-# where they might be necessary.
-		if ($line =~ m@^.\s*\#\s*if.*\b__@) {
+# where they might be necessary. Ignore __NR and __TARGET_NR
+# definitions that are needed for linux-user builds
+		if (($line =~ m@^.\s*\#\s*if.*\b__@) &&
+		    !($realfile =~ /^(linux|bsd)-user/ && $line =~ /__NR_/)) {
 			WARN("architecture specific defines should be avoided\n" .  $herecurr);
 		}