Skip to contentSkip to conversation

checkpatchpl-check-for-function-declarations-without-arguments.patch removed from -mm tree

merged [email protected] 1 participant 1 message Jan 28, 2014 Checkpatch

lore
Share & tools
lore
#0 lore raw

Subject: [merged] checkpatchpl-check-for-function-declarations-without-arguments.patch removed from -mm tree
To: [email protected],[email protected],[email protected],[email protected]
From: [email protected]
Date: Tue, 28 Jan 2014 11:09:57 -0800

The patch titled
Subject: checkpatch.pl: check for function declarations without arguments
has been removed from the -mm tree. Its filename was
checkpatchpl-check-for-function-declarations-without-arguments.patch

This patch was dropped because it was merged into mainline or a subsystem tree

------------------------------------------------------
From: Joe Perches <[email protected]>
Subject: checkpatch.pl: check for function declarations without arguments

Functions like this one are evil:

void foo()

{
	...
}

Because these functions allow variadic arguments without checking the arguments at all.

Original patch by Richard Weinberger.

Cc Richard Weinberger <[email protected]>
Cc Borislav Petkov <[email protected]>

---

 scripts/checkpatch.pl |    9 +++++++++
 1 file changed, 9 insertions(+)
scripts/checkpatch.pl renamed from scripts/checkpatch.pl~checkpatchpl-check-for-function-declarations-without-arguments +9 -0
diff -puN scripts/checkpatch.pl~checkpatchpl-check-for-function-declarations-without-arguments scripts/checkpatch.pl
@@ -2665,6 +2665,15 @@ sub process {
 				$herecurr);
                }
 
+# check for function declarations without arguments like "int foo()"
+		if ($line =~ /(\b$Type\s+$Ident)\s*\(\s*\)/) {
+			if (ERROR("FUNCTION_WITHOUT_ARGS",
+				  "Bad function definition - $1() should probably be $1(void)\n" . $herecurr) &&
+			    $fix) {
+				$fixed[$linenr - 1] =~ s/(\b($Type)\s+($Ident))\s*\(\s*\)/$2 $3(void)/;
+			}
+		}
+
 # check for uses of DEFINE_PCI_DEVICE_TABLE
 		if ($line =~ /\bDEFINE_PCI_DEVICE_TABLE\s*\(\s*(\w+)\s*\)\s*=/) {
 			if (WARN("DEFINE_PCI_DEVICE_TABLE",

_

Patches currently in -mm which might be from [email protected] are

origin.patch lib-genallocc-add-check-gen_pool_dma_alloc-if-dma-pointer-is-not-null.patch linux-next.patch