mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 10:40:15 +02:00 
			
		
		
		
	scripts: kernel-doc: get rid of $nested parameter
The check_sections() function has a $nested parameter, meant to identify when a nested struct is present. As we now have a logic that handles it, get rid of such parameter. Suggested-by: Markus Heiser <markus.heiser@darmarit.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com> Signed-off-by: Jonathan Corbet <corbet@lwn.net>
This commit is contained in:
		
							parent
							
								
									8ad7216316
								
							
						
					
					
						commit
						1081de2d2f
					
				
					 1 changed files with 4 additions and 15 deletions
				
			
		| 
						 | 
					@ -1003,7 +1003,6 @@ sub dump_union($$) {
 | 
				
			||||||
sub dump_struct($$) {
 | 
					sub dump_struct($$) {
 | 
				
			||||||
    my $x = shift;
 | 
					    my $x = shift;
 | 
				
			||||||
    my $file = shift;
 | 
					    my $file = shift;
 | 
				
			||||||
    my $nested;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if ($x =~ /(struct|union)\s+(\w+)\s*{(.*)}/) {
 | 
					    if ($x =~ /(struct|union)\s+(\w+)\s*{(.*)}/) {
 | 
				
			||||||
	my $decl_type = $1;
 | 
						my $decl_type = $1;
 | 
				
			||||||
| 
						 | 
					@ -1063,11 +1062,9 @@ sub dump_struct($$) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	# Ignore other nested elements, like enums
 | 
						# Ignore other nested elements, like enums
 | 
				
			||||||
	$members =~ s/({[^\{\}]*})//g;
 | 
						$members =~ s/({[^\{\}]*})//g;
 | 
				
			||||||
	$nested = $decl_type;
 | 
					 | 
				
			||||||
	$nested =~ s/\/\*.*?\*\///gos;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	create_parameterlist($members, ';', $file);
 | 
						create_parameterlist($members, ';', $file);
 | 
				
			||||||
	check_sections($file, $declaration_name, $decl_type, $sectcheck, $struct_actual, $nested);
 | 
						check_sections($file, $declaration_name, $decl_type, $sectcheck, $struct_actual);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	# Adjust declaration for better display
 | 
						# Adjust declaration for better display
 | 
				
			||||||
	$declaration =~ s/([{;])/$1\n/g;
 | 
						$declaration =~ s/([{;])/$1\n/g;
 | 
				
			||||||
| 
						 | 
					@ -1372,8 +1369,8 @@ sub push_parameter($$$) {
 | 
				
			||||||
	$parametertypes{$param} = $type;
 | 
						$parametertypes{$param} = $type;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
sub check_sections($$$$$$) {
 | 
					sub check_sections($$$$$) {
 | 
				
			||||||
	my ($file, $decl_name, $decl_type, $sectcheck, $prmscheck, $nested) = @_;
 | 
						my ($file, $decl_name, $decl_type, $sectcheck, $prmscheck) = @_;
 | 
				
			||||||
	my @sects = split ' ', $sectcheck;
 | 
						my @sects = split ' ', $sectcheck;
 | 
				
			||||||
	my @prms = split ' ', $prmscheck;
 | 
						my @prms = split ' ', $prmscheck;
 | 
				
			||||||
	my $err;
 | 
						my $err;
 | 
				
			||||||
| 
						 | 
					@ -1407,14 +1404,6 @@ sub check_sections($$$$$$) {
 | 
				
			||||||
					"'$sects[$sx]' " .
 | 
										"'$sects[$sx]' " .
 | 
				
			||||||
					"description in '$decl_name'\n";
 | 
										"description in '$decl_name'\n";
 | 
				
			||||||
				++$warnings;
 | 
									++$warnings;
 | 
				
			||||||
			} else {
 | 
					 | 
				
			||||||
				if ($nested !~ m/\Q$sects[$sx]\E/) {
 | 
					 | 
				
			||||||
				    print STDERR "${file}:$.: warning: " .
 | 
					 | 
				
			||||||
					"Excess $decl_type member " .
 | 
					 | 
				
			||||||
					"'$sects[$sx]' " .
 | 
					 | 
				
			||||||
					"description in '$decl_name'\n";
 | 
					 | 
				
			||||||
				    ++$warnings;
 | 
					 | 
				
			||||||
				}
 | 
					 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					@ -1525,7 +1514,7 @@ sub dump_function($$) {
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	my $prms = join " ", @parameterlist;
 | 
						my $prms = join " ", @parameterlist;
 | 
				
			||||||
	check_sections($file, $declaration_name, "function", $sectcheck, $prms, "");
 | 
						check_sections($file, $declaration_name, "function", $sectcheck, $prms);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        # This check emits a lot of warnings at the moment, because many
 | 
					        # This check emits a lot of warnings at the moment, because many
 | 
				
			||||||
        # functions don't have a 'Return' doc section. So until the number
 | 
					        # functions don't have a 'Return' doc section. So until the number
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue