mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 02:30:34 +02:00 
			
		
		
		
	checkpatch: fix a number of COMPLEX_MACRO false positives
A simple search over the kernel souce displays a number of correctly defined multiline macro, which generally are used as an array element initializer: % find ../linux -type f | xargs grep -B1 -H '^[:space]*\[.*\\$' However checkpatch.pl unexpectedly complains about all these macro definitions: % ./scripts/checkpatch.pl --types COMPLEX_MACRO -f include/linux/perf/arm_pmu.h ERROR: Macros with complex values should be enclosed in parentheses +#define PERF_MAP_ALL_UNSUPPORTED \ + [0 ... PERF_COUNT_HW_MAX - 1] = HW_OP_UNSUPPORTED The change intends to fix this type of false positives by flattening only array members and skipping array element designators. Signed-off-by: Vladimir Zapolskiy <vz@mleia.com> Acked-by: Joe Perches <joe@perches.com> Cc: Andy Whitcroft <apw@canonical.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
		
							parent
							
								
									62e15a6daa
								
							
						
					
					
						commit
						6b10df4257
					
				
					 1 changed files with 3 additions and 2 deletions
				
			
		| 
						 | 
					@ -4550,7 +4550,7 @@ sub process {
 | 
				
			||||||
			# Flatten any parentheses and braces
 | 
								# Flatten any parentheses and braces
 | 
				
			||||||
			while ($dstat =~ s/\([^\(\)]*\)/1/ ||
 | 
								while ($dstat =~ s/\([^\(\)]*\)/1/ ||
 | 
				
			||||||
			       $dstat =~ s/\{[^\{\}]*\}/1/ ||
 | 
								       $dstat =~ s/\{[^\{\}]*\}/1/ ||
 | 
				
			||||||
			       $dstat =~ s/\[[^\[\]]*\]/1/)
 | 
								       $dstat =~ s/.\[[^\[\]]*\]/1/)
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -4570,7 +4570,8 @@ sub process {
 | 
				
			||||||
				union|
 | 
									union|
 | 
				
			||||||
				struct|
 | 
									struct|
 | 
				
			||||||
				\.$Ident\s*=\s*|
 | 
									\.$Ident\s*=\s*|
 | 
				
			||||||
				^\"|\"$
 | 
									^\"|\"$|
 | 
				
			||||||
 | 
									^\[
 | 
				
			||||||
			}x;
 | 
								}x;
 | 
				
			||||||
			#print "REST<$rest> dstat<$dstat> ctx<$ctx>\n";
 | 
								#print "REST<$rest> dstat<$dstat> ctx<$ctx>\n";
 | 
				
			||||||
			if ($dstat ne '' &&
 | 
								if ($dstat ne '' &&
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue