mirror of
				https://git.proxmox.com/git/mirror_zfs.git
				synced 2025-10-26 18:05:04 +03:00 
			
		
		
		
	OpenZFS 8794 - cstyle generates warnings with recent perl
Authored by: Dominik Hassler <hadfl@omniosce.org> Reviewed by: Andy Fiddaman <andy@omniosce.org> Reviewed by: Igor Kozhukhov <igor@dilos.org> Reviewed by: Toomas Soome <tsoome@me.com> Reviewed by: Brian Behlendorf <behlendorf1@llnl.gov> Approved by: Dan McDonald <danmcd@joyent.com> Ported-by: Giuseppe Di Natale <dinatale2@llnl.gov> OpenZFS-issue: https://www.illumos.org/issues/8794 OpenZFS-commit: https://github.com/openzfs/openzfs/commit/578f67364c Closes #6973
This commit is contained in:
		
							parent
							
								
									aebc5df418
								
							
						
					
					
						commit
						d27a40d28f
					
				| @ -383,7 +383,7 @@ line: while (<$filehandle>) { | |||||||
| 
 | 
 | ||||||
| 	# is this the beginning or ending of a function? | 	# is this the beginning or ending of a function? | ||||||
| 	# (not if "struct foo\n{\n") | 	# (not if "struct foo\n{\n") | ||||||
| 	if (/^{$/ && $prev =~ /\)\s*(const\s*)?(\/\*.*\*\/\s*)?\\?$/) { | 	if (/^\{$/ && $prev =~ /\)\s*(const\s*)?(\/\*.*\*\/\s*)?\\?$/) { | ||||||
| 		$in_function = 1; | 		$in_function = 1; | ||||||
| 		$in_declaration = 1; | 		$in_declaration = 1; | ||||||
| 		$in_function_header = 0; | 		$in_function_header = 0; | ||||||
| @ -391,7 +391,7 @@ line: while (<$filehandle>) { | |||||||
| 		$prev = $line; | 		$prev = $line; | ||||||
| 		next line; | 		next line; | ||||||
| 	} | 	} | ||||||
| 	if (/^}\s*(\/\*.*\*\/\s*)*$/) { | 	if (/^\}\s*(\/\*.*\*\/\s*)*$/) { | ||||||
| 		if ($prev =~ /^\s*return\s*;/) { | 		if ($prev =~ /^\s*return\s*;/) { | ||||||
| 			err_prev("unneeded return at end of function"); | 			err_prev("unneeded return at end of function"); | ||||||
| 		} | 		} | ||||||
| @ -401,7 +401,7 @@ line: while (<$filehandle>) { | |||||||
| 		next line; | 		next line; | ||||||
| 	} | 	} | ||||||
| 	if ($in_function_header && ! /^    (\w|\.)/ ) { | 	if ($in_function_header && ! /^    (\w|\.)/ ) { | ||||||
| 		if (/^{}$/ # empty functions | 		if (/^\{\}$/ # empty functions | ||||||
| 		|| /;/ #run function with multiline arguments | 		|| /;/ #run function with multiline arguments | ||||||
| 		|| /#/ #preprocessor commands | 		|| /#/ #preprocessor commands | ||||||
| 		|| /^[^\s\\]*\(.*\)$/ #functions without ; at the end | 		|| /^[^\s\\]*\(.*\)$/ #functions without ; at the end | ||||||
| @ -431,7 +431,7 @@ line: while (<$filehandle>) { | |||||||
| 			$function_header_full_indent = 1; | 			$function_header_full_indent = 1; | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| 	if ($in_function_header && /^{$/) { | 	if ($in_function_header && /^\{$/) { | ||||||
| 		$in_function_header = 0; | 		$in_function_header = 0; | ||||||
| 		$function_header_full_indent = 0; | 		$function_header_full_indent = 0; | ||||||
| 		$in_function = 1; | 		$in_function = 1; | ||||||
| @ -440,7 +440,7 @@ line: while (<$filehandle>) { | |||||||
| 		$in_function_header = 0; | 		$in_function_header = 0; | ||||||
| 		$function_header_full_indent = 0; | 		$function_header_full_indent = 0; | ||||||
| 	} | 	} | ||||||
| 	if ($in_function_header && /{$/ ) { | 	if ($in_function_header && /\{$/ ) { | ||||||
| 		if ($picky) { | 		if ($picky) { | ||||||
| 			err("opening brace on same line as function header"); | 			err("opening brace on same line as function header"); | ||||||
| 		} | 		} | ||||||
| @ -670,14 +670,14 @@ line: while (<$filehandle>) { | |||||||
| 	if (/\S\{/ && !/\{\{/) { | 	if (/\S\{/ && !/\{\{/) { | ||||||
| 		err("missing space before left brace"); | 		err("missing space before left brace"); | ||||||
| 	} | 	} | ||||||
| 	if ($in_function && /^\s+{/ && | 	if ($in_function && /^\s+\{/ && | ||||||
| 	    ($prev =~ /\)\s*$/ || $prev =~ /\bstruct\s+\w+$/)) { | 	    ($prev =~ /\)\s*$/ || $prev =~ /\bstruct\s+\w+$/)) { | ||||||
| 		err("left brace starting a line"); | 		err("left brace starting a line"); | ||||||
| 	} | 	} | ||||||
| 	if (/}(else|while)/) { | 	if (/\}(else|while)/) { | ||||||
| 		err("missing space after right brace"); | 		err("missing space after right brace"); | ||||||
| 	} | 	} | ||||||
| 	if (/}\s\s+(else|while)/) { | 	if (/\}\s\s+(else|while)/) { | ||||||
| 		err("extra space after right brace"); | 		err("extra space after right brace"); | ||||||
| 	} | 	} | ||||||
| 	if (/\b_VOID\b|\bVOID\b|\bSTATIC\b/) { | 	if (/\b_VOID\b|\bVOID\b|\bSTATIC\b/) { | ||||||
| @ -730,18 +730,18 @@ line: while (<$filehandle>) { | |||||||
| 	if ($heuristic) { | 	if ($heuristic) { | ||||||
| 		# cannot check this everywhere due to "struct {\n...\n} foo;" | 		# cannot check this everywhere due to "struct {\n...\n} foo;" | ||||||
| 		if ($in_function && !$in_declaration && | 		if ($in_function && !$in_declaration && | ||||||
| 		    /}./ && !/}\s+=/ && !/{.*}[;,]$/ && !/}(\s|)*$/ && | 		    /\}./ && !/\}\s+=/ && !/\{.*\}[;,]$/ && !/\}(\s|)*$/ && | ||||||
| 		    !/} (else|while)/ && !/}}/) { | 		    !/\} (else|while)/ && !/\}\}/) { | ||||||
| 			err("possible bad text following right brace"); | 			err("possible bad text following right brace"); | ||||||
| 		} | 		} | ||||||
| 		# cannot check this because sub-blocks in | 		# cannot check this because sub-blocks in | ||||||
| 		# the middle of code are ok | 		# the middle of code are ok | ||||||
| 		if ($in_function && /^\s+{/) { | 		if ($in_function && /^\s+\{/) { | ||||||
| 			err("possible left brace starting a line"); | 			err("possible left brace starting a line"); | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| 	if (/^\s*else\W/) { | 	if (/^\s*else\W/) { | ||||||
| 		if ($prev =~ /^\s*}$/) { | 		if ($prev =~ /^\s*\}$/) { | ||||||
| 			err_prefix($prev, | 			err_prefix($prev, | ||||||
| 			    "else and right brace should be on same line"); | 			    "else and right brace should be on same line"); | ||||||
| 		} | 		} | ||||||
| @ -827,8 +827,8 @@ process_indent($) | |||||||
| 
 | 
 | ||||||
| 	# skip over enumerations, array definitions, initializers, etc. | 	# skip over enumerations, array definitions, initializers, etc. | ||||||
| 	if ($cont_off <= 0 && !/^\s*$special/ && | 	if ($cont_off <= 0 && !/^\s*$special/ && | ||||||
| 	    (/(?:(?:\b(?:enum|struct|union)\s*[^\{]*)|(?:\s+=\s*)){/ || | 	    (/(?:(?:\b(?:enum|struct|union)\s*[^\{]*)|(?:\s+=\s*))\{/ || | ||||||
| 	    (/^\s*{/ && $prev =~ /=\s*(?:\/\*.*\*\/\s*)*$/))) { | 	    (/^\s*\{/ && $prev =~ /=\s*(?:\/\*.*\*\/\s*)*$/))) { | ||||||
| 		$cont_in = 0; | 		$cont_in = 0; | ||||||
| 		$cont_off = tr/{/{/ - tr/}/}/; | 		$cont_off = tr/{/{/ - tr/}/}/; | ||||||
| 		return; | 		return; | ||||||
| @ -851,14 +851,14 @@ process_indent($) | |||||||
| 		return		if (/^\s*\}?$/); | 		return		if (/^\s*\}?$/); | ||||||
| 		return		if (/^\s*\}?\s*else\s*\{?$/); | 		return		if (/^\s*\}?\s*else\s*\{?$/); | ||||||
| 		return		if (/^\s*do\s*\{?$/); | 		return		if (/^\s*do\s*\{?$/); | ||||||
| 		return		if (/{$/); | 		return		if (/\{$/); | ||||||
| 		return		if (/}[,;]?$/); | 		return		if (/\}[,;]?$/); | ||||||
| 
 | 
 | ||||||
| 		# Allow macros on their own lines | 		# Allow macros on their own lines | ||||||
| 		return		if (/^\s*[A-Z_][A-Z_0-9]*$/); | 		return		if (/^\s*[A-Z_][A-Z_0-9]*$/); | ||||||
| 
 | 
 | ||||||
| 		# cases we don't deal with, generally non-kosher | 		# cases we don't deal with, generally non-kosher | ||||||
| 		if (/{/) { | 		if (/\{/) { | ||||||
| 			err("stuff after {"); | 			err("stuff after {"); | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
| @ -927,7 +927,7 @@ process_indent($) | |||||||
| 			# | 			# | ||||||
| 			next		if (@cont_paren != 0); | 			next		if (@cont_paren != 0); | ||||||
| 			if ($cont_special) { | 			if ($cont_special) { | ||||||
| 				if ($rest =~ /^\s*{?$/) { | 				if ($rest =~ /^\s*\{?$/) { | ||||||
| 					$cont_in = 0; | 					$cont_in = 0; | ||||||
| 					last; | 					last; | ||||||
| 				} | 				} | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 Dominik Hassler
						Dominik Hassler