lkml.org 
[lkml]   [2021]   [Jun]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 2/3] checkpatch: tweak extern in C warning
Date
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@gmail.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
\
 
 \ /
  Last update: 2021-06-26 05:40    [W:0.481 / U:0.800 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site