Skip to contentSkip to conversation

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

PATCH In review [email protected] 2 participants 2 messages Sep 27, 2016 Checkpatch

lore
Share & tools
lore
#0 lore raw

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

From: Riku Voipio <[email protected]>

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.

---
 scripts/checkpatch.pl | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
scripts/checkpatch.pl +4 -2
index 3afa19a..e17f445 100755
@@ -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);
 		}
 
Signature · 1 line
2.1.4
Acked-by on v1 1/1
#1 lore raw
Quoted 19 lines · On 27/09/2016 17:14, [email protected] wrote:

From: Riku Voipio <[email protected]>

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.

---
 scripts/checkpatch.pl | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
scripts/checkpatch.pl +0 -0
index 3afa19a..e17f445 100755
@@ -2405,8 +2405,10 @@ sub process {
 		}
 # check of hardware specific defines

scripts/checkpatch.pl sub process { · line 2414

Quoted 10 lines
scripts/checkpatch.pl +4 -2
 # 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);
 		}