Messages in this thread Patch in this message | | | From | Jim Cromie <> | Subject | [PATCH 2/3] checkpatch: tweak extern in C warning | Date | Fri, 25 Jun 2021 21:40:15 -0600 |
| |
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
| |