Skip to contentSkip to conversation

checkpatch-exclude-forward-declarations-of-const-structs.patch removed from -mm tree

merged mm-nonmm-stable Andrew Morton 1 participant 1 message Apr 15

lore
Share & tools
lore

Andrew Morton

author tree notice Applied
#0 lore raw

The quilt patch titled
Subject: checkpatch: exclude forward declarations of const structs
has been removed from the -mm tree. Its filename was
checkpatch-exclude-forward-declarations-of-const-structs.patch

This patch was dropped because it was merged into the mm-nonmm-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

------------------------------------------------------
From: Taylor Nelms <[email protected]>
Subject: checkpatch: exclude forward declarations of const structs
Date: Tue, 31 Mar 2026 14:15:09 -0400

Limit checkpatch warnings for normally-const structs by excluding patterns consistent with forward declarations.

For example, the forward declaration struct regmap_access_table; in a header file currently generates a warning recommending that it is generally declared as const; however, this would apply a useless type qualifier in the empty declaration const struct regmap_access_table;, and subsequently generate compiler warnings.

---

 scripts/checkpatch.pl |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
scripts/checkpatch.pl renamed from scripts/checkpatch.pl~checkpatch-exclude-forward-declarations-of-const-structs +2 -2
@@ -7512,10 +7512,10 @@ sub process {
 		}
 
 # check for various structs that are normally const (ops, kgdb, device_tree)
-# and avoid what seem like struct definitions 'struct foo {'
+# and avoid what seem like struct definitions 'struct foo {' or forward declarations 'struct foo;'
 		if (defined($const_structs) &&
 		    $line !~ /\bconst\b/ &&
-		    $line =~ /\bstruct\s+($const_structs)\b(?!\s*\{)/) {
+		    $line =~ /\bstruct\s+($const_structs)\b(?!\s*[\{;])/) {
 			WARN("CONST_STRUCT",
 			     "struct $1 should normally be const\n" . $herecurr);
 		}

_

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