From: Borislav Petkov <bp@alien8.de>
To: Joe Perches <joe@perches.com>
Cc: Richard Weinberger <richard@nod.at>,
Andrew Morton <akpm@linux-foundation.org>,
hpa@zytor.com, linux-kernel@vger.kernel.org, apw@canonical.com
Subject: Re: [PATCH] checkpatch.pl: Check for function declarations without arguments
Date: Tue, 19 Nov 2013 00:30:28 +0100 [thread overview]
Message-ID: <20131118233028.GB27541@pd.tnic> (raw)
In-Reply-To: <1384816981.17783.10.camel@joe-AO722>
On Mon, Nov 18, 2013 at 03:23:01PM -0800, Joe Perches wrote:
> Functions like this one are evil:
>
> void foo()
> {
> ...
> }
>
> Because these functions allow variadic arguments without
> checking the arguments at all.
>
> Original-patch-by: Richard Weinberger <richard@nod.at>
> Signed-off-by: Joe Perches <joe@perches.com>
> ---
> scripts/checkpatch.pl | 9 +++++++++
> 1 file changed, 9 insertions(+)
>
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> index 61090e0..2e1ff0c 100755
> --- a/scripts/checkpatch.pl
> +++ b/scripts/checkpatch.pl
> @@ -2634,6 +2634,15 @@ sub process {
> $herecurr);
> }
>
> +# check for function declarations without arguments like "int foo()"
> + if ($line =~ /(\b$Type\s+$Ident)\s*\(\s*\)/) {
> + if (ERROR("FUNCTION_WITHOUT_ARGS",
> + "Bad function definition - $1() should probably be $1(void)\n" . $herecurr) &&
I liked the nice preaching comment better - this one is boring.
--
Regards/Gruss,
Boris.
Sent from a fat crate under my desk. Formatting is fine.
--
prev parent reply other threads:[~2013-11-18 23:30 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-18 22:31 [PATCH] checkpatch.pl: Check for functions without a real prototype Richard Weinberger
2013-11-18 22:36 ` Joe Perches
2013-11-18 22:40 ` Richard Weinberger
2013-11-18 23:23 ` [PATCH] checkpatch.pl: Check for function declarations without arguments Joe Perches
2013-11-18 23:30 ` Borislav Petkov [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20131118233028.GB27541@pd.tnic \
--to=bp@alien8.de \
--cc=akpm@linux-foundation.org \
--cc=apw@canonical.com \
--cc=hpa@zytor.com \
--cc=joe@perches.com \
--cc=linux-kernel@vger.kernel.org \
--cc=richard@nod.at \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox