Skip to contentSkip to conversation

checkpatch: Fix stringification macro defect

PATCH New Joe Perches 1 participant 1 message Apr 8, 2013 1 message not in the archive Checkpatch

lore
Share & tools
lore

Joe Perches

author maintainer
#1 lore raw

PATCH 1/1 checkpatch: Fix stringification macro defect

In reply to a message not in the archive

Fix checkpatch misreporting defect with stringification macros

ERROR: Macros with complex values should be enclosed in parenthesis
#27: FILE: arch/arm/include/asm/kgdb.h:41:
+#define ___to_string(X) #X

---
 scripts/checkpatch.pl | 1 +
 1 file changed, 1 insertion(+)
scripts/checkpatch.pl +1 -0
index 3fb6d86..2e802fc 100755
@@ -3024,6 +3024,7 @@ sub process {
 			    $dstat !~ /^'X'$/ &&					# character constants
 			    $dstat !~ /$exceptions/ &&
 			    $dstat !~ /^\.$Ident\s*=/ &&				# .foo =
+			    $dstat !~ /^(?:\#\s*$Ident|\#\s*$Constant)\s*$/ &&		# stringification #foo
 			    $dstat !~ /^do\s*$Constant\s*while\s*$Constant;?$/ &&	# do {...} while (...); // do {...} while (...)
 			    $dstat !~ /^for\s*$Constant$/ &&				# for (...)
 			    $dstat !~ /^for\s*$Constant\s+(?:$Ident|-?$Constant)$/ &&	# for (...) bar()