[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210626034016.170306-3-jim.cromie@gmail.com>
Date: Fri, 25 Jun 2021 21:40:15 -0600
From: Jim Cromie <jim.cromie@...il.com>
To: joe@...ches.com, linux-kernel@...r.kernel.org
Cc: Jim Cromie <jim.cromie@...il.com>
Subject: [PATCH 2/3] checkpatch: tweak extern in C warning
The extern-in-C rule has one important exception: the symbol is
defined in/by the linker script. By convention, these almost always
contain: _start, _stop, _end. Suppress the warning on such symbols.
Signed-off-by: Jim Cromie <jim.cromie@...il.com>
---
scripts/checkpatch.pl | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 4fe9fab20009..a8dfba53b593 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -6910,7 +6910,8 @@ sub process {
$stat =~ /^.\s*extern\s+/)
{
WARN("AVOID_EXTERNS",
- "externs should be avoided in .c files\n" . $herecurr);
+ "externs should be avoided in .c files\n($stat)\n" . $herecurr)
+ unless $stat =~ /_start|_stop|_end/;
}
# check for function declarations that have arguments without identifier names
--
2.31.1
Powered by blists - more mailing lists