diff mbox series

[PULL,01/10] scripts/checkpatch.pl: Ignore ObjC #import lines for operator spacing

Message ID 20241108104312.534448-2-thuth@redhat.com (mailing list archive)
State New
Headers show
Series [PULL,01/10] scripts/checkpatch.pl: Ignore ObjC #import lines for operator spacing | expand

Commit Message

Thomas Huth Nov. 8, 2024, 10:43 a.m. UTC
From: Phil Dennis-Jordan <phil@philjordan.eu>

checkpatch.pl lints for spaces around operators including / (slash).
Code lines starting with #include are ignored, as slashes in those
represent path separators.

In Objective-C code, #import is often used in preference to #include,
as preprocessor-based multiple-#include defenses are considered
non-idiomatic in that language.

This change extends checkpatch.pl to treat #import lines in the same
way as #include, avoiding false positives for "missing" spaces
around path separators on those lines.

Signed-off-by: Phil Dennis-Jordan <phil@philjordan.eu>
Message-ID: <20241024123555.25861-1-phil@philjordan.eu>
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 scripts/checkpatch.pl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 1b21249c91..06d07e6c22 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -2246,7 +2246,7 @@  sub process {
 			}
 		}
 # Check operator spacing.
-		if (!($line=~/\#\s*include/)) {
+		if (!($line=~/\#\s*(include|import)/)) {
 			my $ops = qr{
 				<<=|>>=|<=|>=|==|!=|
 				\+=|-=|\*=|\/=|%=|\^=|\|=|&=|