public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] checkpatch: don't fake typedefs with #define
@ 2012-05-17 12:52 Phil Carmody
  2012-05-17 20:54 ` Joe Perches
  0 siblings, 1 reply; 12+ messages in thread
From: Phil Carmody @ 2012-05-17 12:52 UTC (permalink / raw)
  To: apw; +Cc: linux-kernel, ext-phil.2.carmody

People seemed to be taking the "no typedefs" rule too literally,
and were using #define to abide by the letter rather than the
spirit of the law. E.g. #define FOO_t struct _FOO_t

Signed-off-by: Phil Carmody <ext-phil.2.carmody@nokia.com>
---
 scripts/checkpatch.pl |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index faea0ec..7dc41c5 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -2299,6 +2299,12 @@ sub process {
 			     "do not add new typedefs\n" . $herecurr);
 		}
 
+# check for deliberate avoidance of the above anti-typedef rule
+		if ($line =~ /#\s*define\s+$Ident\s+$Type\b/) {
+			WARN("NEW_TYPEDEFS",
+			     "do not fake typedefs using #define\n" . $herecurr);
+		}
+
 # * goes on variable not on type
 		# (char*[ const])
 		while ($line =~ m{(\($NonptrType(\s*(?:$Modifier\b\s*|\*\s*)+)\))}g) {
-- 
1.7.2.5


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

end of thread, other threads:[~2012-05-23  3:25 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-05-17 12:52 [PATCH 1/1] checkpatch: don't fake typedefs with #define Phil Carmody
2012-05-17 20:54 ` Joe Perches
2012-05-17 21:16   ` Phil Carmody
2012-05-17 21:24     ` Joe Perches
2012-05-21 12:05       ` Phil Carmody
2012-05-21 16:41         ` Joe Perches
2012-05-22  8:01           ` Phil Carmody
2012-05-22 16:48             ` Joe Perches
2012-05-23  1:54     ` Ryan Mallon
2012-05-23  2:02       ` Joe Perches
2012-05-23  2:50         ` Ryan Mallon
2012-05-23  3:25           ` Joe Perches

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox