From: Joe Perches <joe@perches.com>
To: Richard Weinberger <richard@nod.at>
Cc: apw@canonical.com, linux-kernel@vger.kernel.org, hpa@zytor.com
Subject: Re: [PATCH] checkpatch.pl: Check for functions without a real prototype
Date: Fri, 16 Mar 2012 16:31:47 -0700 [thread overview]
Message-ID: <1331940707.12813.10.camel@joe2Laptop> (raw)
In-Reply-To: <1331939074-26865-1-git-send-email-richard@nod.at>
On Sat, 2012-03-17 at 00:04 +0100, Richard Weinberger wrote:
> Functions like this one are evil:
> void foo()
> {
> ...
> }
[]
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
[]
> @@ -2304,6 +2304,19 @@ sub process {
[]
> + if ($line=~/$Type\s*$Ident\(\)/) {
Perhaps this should be:
if ($line =~ /(\b$Type\s+$Ident)\s*\(\s*\)/) {
> + ERROR("FUNCTION_NO_PROTOTYPE",
> +"Function without a real prototype\n" . $herecurr .
Sensible, but maybe:
"Bad function definition - $1() should probably be $1(void)\n"
> +"Thou shalt not, in the language of C, under any circumstances, on the
> +pain of death, declare or define a function with an empty set of
> +parentheses, for though in the language of C++ it meaneth the same as
> +(void), in C it meaneth (...) which is of meaningless as there be no
> +anchor argument by which the types of the varadic arguments can be
> +expressed, and which misleadeth the compiler into allowing unsavory code
> +and in some cases generate really ugly stuff for varadic handling.
> + -hpa\n");
Humorous once, painful in twice, annoying after.
cheers, Joe
next prev parent reply other threads:[~2012-03-16 23:32 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-16 20:18 [PATCH] x86: Merge x86_32 and x86_64 cpu_idle() Richard Weinberger
2012-03-16 21:22 ` H. Peter Anvin
2012-03-16 21:40 ` [PATCH v2] " Richard Weinberger
2012-03-19 13:05 ` Frederic Weisbecker
2012-03-23 12:25 ` Ingo Molnar
2012-03-23 12:31 ` Richard Weinberger
2012-03-23 12:33 ` Ingo Molnar
2012-03-23 18:20 ` [PATCH] " Richard Weinberger
2012-03-24 7:25 ` Ingo Molnar
2012-03-25 21:00 ` Richard Weinberger
2012-03-26 15:31 ` [tip:x86/urgent] x86: Merge the x86_32 and x86_64 cpu_idle() functions tip-bot for Richard Weinberger
2012-03-16 23:04 ` [PATCH] checkpatch.pl: Check for functions without a real prototype Richard Weinberger
2012-03-16 23:31 ` Joe Perches [this message]
2012-03-16 23:35 ` Richard Weinberger
-- strict thread matches above, loose matches on Subject: below --
2013-11-18 22:31 Richard Weinberger
2013-11-18 22:36 ` Joe Perches
2013-11-18 22:40 ` Richard Weinberger
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=1331940707.12813.10.camel@joe2Laptop \
--to=joe@perches.com \
--cc=apw@canonical.com \
--cc=hpa@zytor.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