scripts/kconfig/kconfig-sym-check.pl

Source file repositories/reference/linux-study-clean/scripts/kconfig/kconfig-sym-check.pl

File Facts

System
Linux kernel
Corpus path
scripts/kconfig/kconfig-sym-check.pl
Extension
.pl
Size
2846 bytes
Lines
133
Domain
Support Tooling And Documentation
Bucket
scripts
Inferred role
Support Tooling And Documentation: scripts
Status
atlas-only

Why This File Exists

Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.

Dependency Surface

Detected Declarations

Annotated Snippet

while (/\\\s*$/) {
			s/\\\s*$/ /;
			my $cont = <F> // last;
			chomp $cont;
			$_ .= $cont;
		}

		next if /^\s*$/;
		next if /^\s*#/;

		/^(\s*)/;
		$level = indent_depth($1);

		if ($help && $level < $help_level) {
			$help = 0;
		}

		next if ($help);

		if (/^\s*(help|\-\-\-help\-\-\-)$/) {
			$help = 1;
			my $next;
			while (defined($next = <F>)) {
				last unless $next =~ /^\s*(?:#.*)?$/;
			}
			last unless defined $next;
			$next =~ /^(\s*)/;
			if (indent_depth($1) >= $level) {
				$help_level = indent_depth($1);
			} else {
				$help = 0;
			}
			$_ = $next;
			redo;
		}

		if (/^\s*(config|menuconfig)\s+([a-zA-Z0-9_]+)\s*(#.*)?$/) {
			$configs{$2}++;
			next;
		}

		if (/^\s*(default|def_bool|def_tristate|select|depends\s+on|imply|visible\s+if|range|if|bool|tristate|int|hex|string|prompt)\s+(.+)\s*$/) {
			my $s = $2;
			$s =~ s/"(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*'//g;
			$s =~ s/#.*//;
			$s =~ s/\$\((?:[^()]*|\((?:[^()]*|\([^()]*\))*\))*\)//g;
			$s =~ s/%%[^%]*%%//g;
			my @syms = split /[^a-zA-Z0-9_]+/, $s;
			map {
				$refs{$_}++ if (/[a-zA-Z]/ && $_ ne "if" && $_ ne "y" && $_ ne "n" && $_ ne "m" && !/^0[xX][0-9a-fA-F]+$/);
			} @syms
		}
	}

	close F;
}

my %known_syms = ();
if (defined $kconfig_sym_check_excludes) {
	my $file = $kconfig_sym_check_excludes;
	open(F, "<", $file) or die "Cannot open $file: $!";
	while (<F>) {
		chomp;
		next if /^\s*$/;
		next if /^\s*#/;
		$known_syms{$1}++ if (/^\s*([a-zA-Z0-9_]+)\s*(#.*)?$/);
	}
}

my $ret = 0;

Annotation

Implementation Notes