[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1331939074-26865-1-git-send-email-richard@nod.at>
Date: Sat, 17 Mar 2012 00:04:34 +0100
From: Richard Weinberger <richard@....at>
To: joe@...ches.com
Cc: apw@...onical.com, linux-kernel@...r.kernel.org,
Richard Weinberger <richard@....at>, hpa@...or.com
Subject: [PATCH] checkpatch.pl: Check for functions without a real prototype
Functions like this one are evil:
void foo()
{
...
}
Signed-off-by: Richard Weinberger <richard@....at>
CC: hpa@...or.com
---
scripts/checkpatch.pl | 13 +++++++++++++
1 files changed, 13 insertions(+), 0 deletions(-)
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index a3b9782..acc5e0f 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -2304,6 +2304,19 @@ sub process {
"open brace '{' following function declarations go on the next line\n" . $herecurr);
}
+ if ($line=~/$Type\s*$Ident\(\)/) {
+ ERROR("FUNCTION_NO_PROTOTYPE",
+"Function without a real prototype\n" . $herecurr .
+"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");
+ }
+
# open braces for enum, union and struct go on the same line.
if ($line =~ /^.\s*{/ &&
$prevline =~ /^.\s*(?:typedef\s+)?(enum|union|struct)(?:\s+$Ident)?\s*$/) {
--
1.7.7.3
--
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