[lkml]   [2013]   [Nov]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Patch in this message
Subject[PATCH] Check for functions without a real prototype
Functions like this one are evil:

void foo()

Signed-off-by: Richard Weinberger <>
scripts/ | 13 +++++++++++++
1 file changed, 13 insertions(+)

diff --git a/scripts/ b/scripts/
index 61090e0..a1b846d 100755
--- a/scripts/
+++ b/scripts/
@@ -2785,6 +2785,19 @@ sub process {
"open brace '{' following function declarations go on the next line\n" . $herecurr);

+ if ($line=~/$Type\s*$Ident\(\)/) {
+"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*$/) {

 \ /
  Last update: 2013-11-19 00:21    [W:0.053 / U:6.440 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site