aboutsummaryrefslogtreecommitdiffstats
path: root/lint
diff options
context:
space:
mode:
authorOliver Smith <osmith@sysmocom.de>2021-07-12 16:22:07 +0200
committerOliver Smith <osmith@sysmocom.de>2021-07-15 10:21:05 +0200
commitb6e2adb0aa8fca574cfdc98d2aca4f11ee4f598a (patch)
tree0b87ade6fb3a88139149f9a6b3fd8087452687b9 /lint
parent444ca841e65b1d4974c82ccb9d120b10bebff270 (diff)
lint: checkpatch.pl: allow spaces below (g)DEFUN
Do not complain if indenting with exactly 6/7 spaces below (g)DEFUN(, as it's often done in VTY-related code in Osmocom. This patch assumes that if the line starts with 6/7 spaces and " or a word, it's probably below DEFUN( or gDEFUN(. I've considered implementing a more accurate check, but that would be too much effort (e.g. when more macros are involved). Other related macros, such as DEFUN_ATTR are longer. Indentation below those should be done with one tab (+ spaces for padding), the linter doesn't need to be adjusted for those. Related: OS#5087 Change-Id: I0934b63a62500e7a3e09c753cc63aa331e580cc6
Diffstat (limited to 'lint')
-rwxr-xr-xlint/checkpatch/checkpatch.pl4
1 files changed, 3 insertions, 1 deletions
diff --git a/lint/checkpatch/checkpatch.pl b/lint/checkpatch/checkpatch.pl
index ad99e0c..4da42a9 100755
--- a/lint/checkpatch/checkpatch.pl
+++ b/lint/checkpatch/checkpatch.pl
@@ -3973,7 +3973,9 @@ sub process {
# 1) within comments
# 2) indented preprocessor commands
# 3) hanging labels
- if ($rawline =~ /^\+ / && $line !~ /^\+ *(?:$;|#|$Ident:)/) {
+ if ($rawline =~ /^\+ / && $line !~ /^\+ *(?:$;|#|$Ident:)/ &&
+ # Osmocom specific, below 'DEFUN(' or 'gDEFUN('
+ $line !~ /^\+ {6,7}["\w].*$/) {
my $herevet = "$here\n" . cat_vet($rawline) . "\n";
if (WARN("LEADING_SPACE",
"please, no spaces at the start of a line\n" . $herevet) &&