[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1331940707.12813.10.camel@joe2Laptop>
Date: Fri, 16 Mar 2012 16:31:47 -0700
From: Joe Perches <joe@...ches.com>
To: Richard Weinberger <richard@....at>
Cc: apw@...onical.com, linux-kernel@...r.kernel.org, hpa@...or.com
Subject: Re: [PATCH] checkpatch.pl: Check for functions without a real
prototype
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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists