* Please discard "checkpatch: warn when using extern with function prototypes in .h files"
@ 2013-09-02 13:51 David Howells
2013-09-02 16:21 ` [PATCH] checkpatch: Make extern in .h prototypes quieter Joe Perches
0 siblings, 1 reply; 4+ messages in thread
From: David Howells @ 2013-09-02 13:51 UTC (permalink / raw)
To: joe, akpm, hannes; +Cc: dhowells, linux-kernel, dwmw2
I noticed that a patch got committed to checkpatch to complain about function
prototypes prefixed by "extern".
Please discard/revert this patch:
commit 7cd0f806622836e386ef18ad1950a9a729803019
Author: Joe Perches <joe@perches.com>
Date: Wed Aug 28 10:16:00 2013 +1000
checkpatch: warn when using extern with function prototypes in .h files
Using the extern keyword on function prototypes is superfluous visual
noise so suggest removing it.
This is inaccurate. It's actually a useful visual cue - so if anything, please
make checkpatch indicate that it be added to all future function prototypes.
David
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] checkpatch: Make extern in .h prototypes quieter.
2013-09-02 13:51 Please discard "checkpatch: warn when using extern with function prototypes in .h files" David Howells
@ 2013-09-02 16:21 ` Joe Perches
2013-09-02 20:51 ` Geert Uytterhoeven
0 siblings, 1 reply; 4+ messages in thread
From: Joe Perches @ 2013-09-02 16:21 UTC (permalink / raw)
To: David Howells; +Cc: akpm, hannes, linux-kernel, dwmw2
The use of extern in .h files is a bit contentious.
Make it emitted only when --strict is used on the
command-line.
Signed-off-by: Joe Perches <joe@perches.com>
---
scripts/checkpatch.pl | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 9bb056c..13165ea 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -3927,8 +3927,8 @@ sub process {
# check for new externs in .h files.
if ($realfile =~ /\.h$/ &&
$line =~ /^\+\s*(extern\s+)$Type\s*$Ident\s*\((?!\s*\*)/) {
- if (WARN("AVOID_EXTERNS",
- "extern prototypes should be avoided in .h files\n" . $herecurr) &&
+ if (CHK("AVOID_EXTERNS",
+ "extern prototypes should be avoided in .h files\n" . $herecurr) &&
$fix) {
$fixed[$linenr - 1] =~ s/(.*)\bextern\s+(.*)/$1$2/;
}
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] checkpatch: Make extern in .h prototypes quieter.
2013-09-02 16:21 ` [PATCH] checkpatch: Make extern in .h prototypes quieter Joe Perches
@ 2013-09-02 20:51 ` Geert Uytterhoeven
2013-09-02 20:58 ` Joe Perches
0 siblings, 1 reply; 4+ messages in thread
From: Geert Uytterhoeven @ 2013-09-02 20:51 UTC (permalink / raw)
To: Joe Perches
Cc: David Howells, Andrew Morton, hannes, linux-kernel, David Woodhouse
On Mon, Sep 2, 2013 at 6:21 PM, Joe Perches <joe@perches.com> wrote:
> The use of extern in .h files is a bit contentious.
>
> Make it emitted only when --strict is used on the
> command-line.
IIRC, the original intention was to always use "extern" in external function or
data declarations, and then complain if any "extern" keyword was found
in *.c files. Always using the "extern" keyword makes it easier to flag those.
> - if (WARN("AVOID_EXTERNS",
> - "extern prototypes should be avoided in .h files\n" . $herecurr) &&
> + if (CHK("AVOID_EXTERNS",
> + "extern prototypes should be avoided in .h files\n" . $herecurr) &&
I know it's not the subject of this patch, but shouldn't "extern prototypes"
be "extern keywords"?
> $fix) {
> $fixed[$linenr - 1] =~ s/(.*)\bextern\s+(.*)/$1$2/;
> }
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-09-02 20:58 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-09-02 13:51 Please discard "checkpatch: warn when using extern with function prototypes in .h files" David Howells
2013-09-02 16:21 ` [PATCH] checkpatch: Make extern in .h prototypes quieter Joe Perches
2013-09-02 20:51 ` Geert Uytterhoeven
2013-09-02 20:58 ` Joe Perches
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®