All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] checkpatch: try to catch missing VMLINUX_SYMBOL() in vmlinux.lds.h
@ 2008-11-08 22:56 Mike Frysinger
  2008-11-12 14:02 ` Andy Whitcroft
  0 siblings, 1 reply; 3+ messages in thread
From: Mike Frysinger @ 2008-11-08 22:56 UTC (permalink / raw)
  To: Andy Whitcroft, Andrew Morton; +Cc: linux-kernel

Seems like every other release we have someone who updates vmlinux.lds.h and
adds C-visible symbols without VMLINUX_SYMBOL() around them.  So start
checking the file and only allow assignments that use one of the following
symbols on a side:
	.
	ALIGN(...)
	VMLINUX_SYMBOL(...)

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
---
 scripts/checkpatch.pl |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index f88bb3e..8e96b42 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -2189,6 +2189,19 @@ sub process {
 			}
 		}
 
+# make sure symbols are always wrapped with VMLINUX_SYMBOL() ...
+# all assignments may have only one of the following with an assignment:
+#	.
+#	ALIGN(...)
+#	VMLINUX_SYMBOL(...)
+		if ($realfile =~ /vmlinux.lds.h$/) {
+			if ($line =~ /=/ &&
+			    !($line =~ /([.]|(ALIGN|VMLINUX_SYMBOL)[(][^=]*[)])\s*=\s*([.]|(ALIGN|VMLINUX_SYMBOL)[(][^=]*[)])/))
+			{
+				WARN("vmlinux.lds.h needs VMLINUX_SYMBOL() around C-visible symbols\n" . $herecurr);
+			}
+		}
+
 # check for redundant bracing round if etc
 		if ($line =~ /(^.*)\bif\b/ && $1 !~ /else\s*$/) {
 			my ($level, $endln, @chunks) =
-- 
1.6.0.3


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

end of thread, other threads:[~2008-11-16 12:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-11-08 22:56 [PATCH] checkpatch: try to catch missing VMLINUX_SYMBOL() in vmlinux.lds.h Mike Frysinger
2008-11-12 14:02 ` Andy Whitcroft
2008-11-16 12:06   ` Mike Frysinger

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.