[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] scripts/checkpatch.pl: fix false error of exter
From: |
Peter Maydell |
Subject: |
Re: [Qemu-devel] [PATCH] scripts/checkpatch.pl: fix false error of externs checking. |
Date: |
Tue, 10 Oct 2017 10:44:53 +0100 |
On 10 October 2017 at 08:54, Jiang Biao <address@hidden> wrote:
> When adding a function declaration in a .c file without extern
> keywork decoration, checkpatch.pl will report *externs should be
> avoided in .c files* false error. This patch fixes the bug.
I don't think this is a bug. "extern int foo(void);" and
"int foo(void);" have the same effect: they declare a function
prototype that can be called from outside the file.
We don't want to permit that in QEMU. Either:
(1) the function is for use only within this file: the
declaration should be "static int foo(void);"
(2) the function is for use by other files too: the
declaration should be in a header file, not a .c file,
so the other files can use it
Do you have an example of code where this warning is a problem?
thanks
-- PMM