mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] checkpatch.pl: Check for functions without a real prototype
@ 2013-11-18 22:31 Richard Weinberger
  2013-11-18 22:36 ` Joe Perches
  0 siblings, 1 reply; 5+ messages in thread
From: Richard Weinberger @ 2013-11-18 22:31 UTC (permalink / raw)
  To: hpa; +Cc: linux-kernel, apw, joe, bp, Richard Weinberger

Functions like this one are evil:

void foo()
{
	...
}

Signed-off-by: Richard Weinberger <richard@nod.at>
CC: hpa@zytor.com
---
 scripts/checkpatch.pl | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 61090e0..a1b846d 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -2785,6 +2785,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.8.4.2


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-11-18 23:30 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®