diff options
Diffstat (limited to 'scripts')
33 files changed, 903 insertions, 341 deletions
diff --git a/scripts/.gitignore b/scripts/.gitignore index b939fbd0119..52cab46ae35 100644 --- a/scripts/.gitignore +++ b/scripts/.gitignore @@ -7,3 +7,4 @@ pnmtologo bin2c unifdef binoffset +ihex2fw diff --git a/scripts/Makefile.headersinst b/scripts/Makefile.headersinst index 095cfc8b9db..0fcd8383877 100644 --- a/scripts/Makefile.headersinst +++ b/scripts/Makefile.headersinst @@ -54,8 +54,12 @@ quiet_cmd_remove = REMOVE $(unwanted) cmd_remove = rm -f $(unwanted-file) quiet_cmd_check = CHECK $(printdir) ($(words $(all-files)) files) - cmd_check = $(PERL) $< $(INSTALL_HDR_PATH)/include $(SRCARCH) \ - $(addprefix $(install)/, $(all-files)); \ +# Headers list can be pretty long, xargs helps to avoid +# the "Argument list too long" error. + cmd_check = for f in $(all-files); do \ + echo "$(install)/$${f}"; done \ + | xargs \ + $(PERL) $< $(INSTALL_HDR_PATH)/include $(SRCARCH); \ touch $@ PHONY += __headersinst __headerscheck diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib index 2b706617c89..7a7778746ea 100644 --- a/scripts/Makefile.lib +++ b/scripts/Makefile.lib @@ -116,6 +116,17 @@ _a_flags = $(KBUILD_CPPFLAGS) $(KBUILD_AFLAGS) $(KBUILD_SUBDIR_ASFLAGS) \ $(asflags-y) $(AFLAGS_$(basetarget).o) _cpp_flags = $(KBUILD_CPPFLAGS) $(cppflags-y) $(CPPFLAGS_$(@F)) +# +# Enable gcov profiling flags for a file, directory or for all files depending +# on variables GCOV_PROFILE_obj.o, GCOV_PROFILE and CONFIG_GCOV_PROFILE_ALL +# (in this order) +# +ifeq ($(CONFIG_GCOV_KERNEL),y) +_c_flags += $(if $(patsubst n%,, \ + $(GCOV_PROFILE_$(basetarget).o)$(GCOV_PROFILE)$(CONFIG_GCOV_PROFILE_ALL)), \ + $(CFLAGS_GCOV)) +endif + # If building the kernel in a separate objtree expand all occurrences # of -Idir to -I$(srctree)/dir except for absolute paths (starting with '/'). diff --git a/scripts/basic/docproc.c b/scripts/basic/docproc.c index 35bdc68b6e6..99ca7a69868 100644 --- a/scripts/basic/docproc.c +++ b/scripts/basic/docproc.c @@ -69,7 +69,7 @@ FILELINE * docsection; #define NOFUNCTION "-nofunction" #define NODOCSECTIONS "-no-doc-sections" -char *srctree; +static char *srctree, *kernsrctree; void usage (void) { @@ -77,7 +77,8 @@ void usage (void) fprintf(stderr, "Input is read from file.tmpl. Output is sent to stdout\n"); fprintf(stderr, "doc: frontend when generating kernel documentation\n"); fprintf(stderr, "depend: generate list of files referenced within file\n"); - fprintf(stderr, "Environment variable SRCTREE: absolute path to kernel source tree.\n"); + fprintf(stderr, "Environment variable SRCTREE: absolute path to sources.\n"); + fprintf(stderr, " KBUILD_SRC: absolute path to kernel source tree.\n"); } /* @@ -96,8 +97,8 @@ void exec_kernel_doc(char **svec) exit(1); case 0: memset(real_filename, 0, sizeof(real_filename)); - strncat(real_filename, srctree, PATH_MAX); - strncat(real_filename, KERNELDOCPATH KERNELDOC, + strncat(real_filename, kernsrctree, PATH_MAX); + strncat(real_filename, "/" KERNELDOCPATH KERNELDOC, PATH_MAX - strlen(real_filename)); execvp(real_filename, svec); fprintf(stderr, "exec "); @@ -178,6 +179,7 @@ void find_export_symbols(char * filename) char real_filename[PATH_MAX + 1]; memset(real_filename, 0, sizeof(real_filename)); strncat(real_filename, srctree, PATH_MAX); + strncat(real_filename, "/", PATH_MAX - strlen(real_filename)); strncat(real_filename, filename, PATH_MAX - strlen(real_filename)); sym = add_new_file(filename); @@ -382,6 +384,9 @@ int main(int argc, char *argv[]) srctree = getenv("SRCTREE"); if (!srctree) srctree = getcwd(NULL, 0); + kernsrctree = getenv("KBUILD_SRC"); + if (!kernsrctree || !*kernsrctree) + kernsrctree = srctree; if (argc != 3) { usage(); exit(1); diff --git a/scripts/basic/fixdep.c b/scripts/basic/fixdep.c index 8912c0f5460..72c15205bb2 100644 --- a/scripts/basic/fixdep.c +++ b/scripts/basic/fixdep.c @@ -373,10 +373,11 @@ void print_deps(void) void traps(void) { static char test[] __attribute__((aligned(sizeof(int)))) = "CONF"; + int *p = (int *)test; - if (*(int *)test != INT_CONF) { + if (*p != INT_CONF) { fprintf(stderr, "fixdep: sizeof(int) != 4 or wrong endianess? %#x\n", - *(int *)test); + *p); exit(2); } } diff --git a/scripts/checksyscalls.sh b/scripts/checksyscalls.sh index 60d00d1c4ee..66ad375612f 100755 --- a/scripts/checksyscalls.sh +++ b/scripts/checksyscalls.sh @@ -14,6 +14,57 @@ cat << EOF #include <asm/types.h> #include <asm/unistd.h> +/* *at */ +#define __IGNORE_open /* openat */ +#define __IGNORE_link /* linkat */ +#define __IGNORE_unlink /* unlinkat */ +#define __IGNORE_mknod /* mknodat */ +#define __IGNORE_chmod /* fchmodat */ +#define __IGNORE_chown /* fchownat */ +#define __IGNORE_mkdir /* mkdirat */ +#define __IGNORE_rmdir /* unlinkat */ +#define __IGNORE_lchown /* fchownat */ +#define __IGNORE_access /* faccessat */ +#define __IGNORE_rename /* renameat */ +#define __IGNORE_readlink /* readlinkat */ +#define __IGNORE_symlink /* symlinkat */ +#define __IGNORE_utimes /* futimesat */ +#if BITS_PER_LONG == 64 +#define __IGNORE_stat /* fstatat */ +#define __IGNORE_lstat /* fstatat */ +#else +#define __IGNORE_stat64 /* fstatat64 */ +#define __IGNORE_lstat64 /* fstatat64 */ +#endif + +/* CLOEXEC flag */ +#define __IGNORE_pipe /* pipe2 */ +#define __IGNORE_dup2 /* dup3 */ +#define __IGNORE_epoll_create /* epoll_create1 */ +#define __IGNORE_inotify_init /* inotify_init1 */ +#define __IGNORE_eventfd /* eventfd2 */ +#define __IGNORE_signalfd /* signalfd4 */ + +/* MMU */ +#ifndef CONFIG_MMU +#define __IGNORE_madvise +#define __IGNORE_mbind +#define __IGNORE_mincore +#define __IGNORE_mlock +#define __IGNORE_mlockall +#define __IGNORE_munlock +#define __IGNORE_munlockall +#define __IGNORE_mprotect +#define __IGNORE_msync +#define __IGNORE_migrate_pages +#define __IGNORE_move_pages +#define __IGNORE_remap_file_pages +#define __IGNORE_get_mempolicy +#define __IGNORE_set_mempolicy +#define __IGNORE_swapoff +#define __IGNORE_swapon +#endif + /* System calls for 32-bit kernels only */ #if BITS_PER_LONG == 64 #define __IGNORE_sendfile64 @@ -27,6 +78,22 @@ cat << EOF #define __IGNORE_fstatat64 #define __IGNORE_fstatfs64 #define __IGNORE_statfs64 +#define __IGNORE_llseek +#define __IGNORE_mmap2 +#else +#define __IGNORE_sendfile +#define __IGNORE_ftruncate +#define __IGNORE_truncate +#define __IGNORE_stat +#define __IGNORE_lstat +#define __IGNORE_fstat +#define __IGNORE_fcntl +#define __IGNORE_fadvise64 +#define __IGNORE_newfstatat +#define __IGNORE_fstatfs +#define __IGNORE_statfs +#define __IGNORE_lseek +#define __IGNORE_mmap #endif /* i386-specific or historical system calls */ @@ -44,7 +111,6 @@ cat << EOF #define __IGNORE_idle #define __IGNORE_modify_ldt #define __IGNORE_ugetrlimit -#define __IGNORE_mmap2 #define __IGNORE_vm86 #define __IGNORE_vm86old #define __IGNORE_set_thread_area @@ -55,7 +121,6 @@ cat << EOF #define __IGNORE_oldlstat #define __IGNORE_oldolduname #define __IGNORE_olduname -#define __IGNORE_umount2 #define __IGNORE_umount #define __IGNORE_waitpid #define __IGNORE_stime @@ -75,9 +140,12 @@ cat << EOF #define __IGNORE__llseek #define __IGNORE__newselect #define __IGNORE_create_module -#define __IGNORE_delete_module #define __IGNORE_query_module #define __IGNORE_get_kernel_syms +#define __IGNORE_sysfs +#define __IGNORE_uselib +#define __IGNORE__sysctl + /* ... including the "new" 32-bit uid syscalls */ #define __IGNORE_lchown32 #define __IGNORE_getuid32 @@ -99,6 +167,24 @@ cat << EOF #define __IGNORE_setfsuid32 #define __IGNORE_setfsgid32 +/* these can be expressed using other calls */ +#define __IGNORE_alarm /* setitimer */ +#define __IGNORE_creat /* open */ +#define __IGNORE_fork /* clone */ +#define __IGNORE_futimesat /* utimensat */ +#define __IGNORE_getpgrp /* getpgid */ +#define __IGNORE_getdents /* getdents64 */ +#define __IGNORE_pause /* sigsuspend */ +#define __IGNORE_poll /* ppoll */ +#define __IGNORE_select /* pselect6 */ +#define __IGNORE_epoll_wait /* epoll_pwait */ +#define __IGNORE_time /* gettimeofday */ +#define __IGNORE_uname /* newuname */ +#define __IGNORE_ustat /* statfs */ +#define __IGNORE_utime /* utimes */ +#define __IGNORE_vfork /* clone */ +#define __IGNORE_wait4 /* waitid */ + /* sync_file_range had a stupid ABI. Allow sync_file_range2 instead */ #ifdef __NR_sync_file_range2 #define __IGNORE_sync_file_range diff --git a/scripts/config b/scripts/config index db6084b78a1..608d7fdb13e 100755 --- a/scripts/config +++ b/scripts/config @@ -9,8 +9,10 @@ config options command ... commands: --enable|-e option Enable option --disable|-d option Disable option - --module|-m option Turn option into a module - --state|-s option Print state of option (n,y,m,undef) + --module|-m option Turn option into a module + --set-str option value + Set option to "value" + --state|-s option Print state of option (n,y,m,undef) --enable-after|-E beforeopt option Enable option directly after other option @@ -26,8 +28,6 @@ options: config doesn't check the validity of the .config file. This is done at next make time. -The options need to be already in the file before they can be changed, -but sometimes you can cheat with the --*-after options. EOL exit 1 } @@ -45,8 +45,18 @@ checkarg() { ARG="`echo $ARG | tr a-z A-Z`" } -replace() { - sed -i -e "$@" $FN +set_var() { + local name=$1 new=$2 before=$3 + + name_re="^($name=|# $name is not set)" + before_re="^($before=|# $before is not set)" + if test -n "$before" && grep -Eq "$before_re" "$FN"; then + sed -ri "/$before_re/a $new" "$FN" + elif grep -Eq "$name_re" "$FN"; then + sed -ri "s:$name_re.*:$new:" "$FN" + else + echo "$new" >>"$FN" + fi } if [ "$1" = "--file" ]; then @@ -54,8 +64,7 @@ if [ "$1" = "--file" ]; then if [ "$FN" = "" ] ; then usage fi - shift - shift + shift 2 else FN=.config fi @@ -68,27 +77,39 @@ while [ "$1" != "" ] ; do CMD="$1" shift case "$CMD" in - --enable|-e) + --refresh) + ;; + --*-after) + checkarg "$1" + A=$ARG + checkarg "$2" + B=$ARG + shift 2 + ;; + --*) checkarg "$1" - replace "s/# CONFIG_$ARG is not set/CONFIG_$ARG=y/" shift ;; + esac + case "$CMD" in + --enable|-e) + set_var "CONFIG_$ARG" "CONFIG_$ARG=y" + ;; --disable|-d) - checkarg "$1" - replace "s/CONFIG_$ARG=[my]/# CONFIG_$ARG is not set/" - shift + set_var "CONFIG_$ARG" "# CONFIG_$ARG is not set" ;; --module|-m) - checkarg "$1" - replace "s/CONFIG_$ARG=y/CONFIG_$ARG=m/" \ - -e "s/# CONFIG_$ARG is not set/CONFIG_$ARG=m/" + set_var "CONFIG_$ARG" "CONFIG_$ARG=m" + ;; + + --set-str) + set_var "CONFIG_$ARG" "CONFIG_$ARG=\"$1\"" shift ;; --state|-s) - checkarg "$1" if grep -q "# CONFIG_$ARG is not set" $FN ; then echo n else @@ -101,44 +122,18 @@ while [ "$1" != "" ] ; do echo "$V" fi fi - shift ;; --enable-after|-E) - checkarg "$1" - A=$ARG - checkarg "$2" - B=$ARG - replace "/CONFIG_$A=[my]/aCONFIG_$B=y" \ - -e "/# CONFIG_$ARG is not set/a/CONFIG_$ARG=y" \ - -e "s/# CONFIG_$ARG is not set/CONFIG_$ARG=y/" - shift - shift + set_var "CONFIG_$B" "CONFIG_$B=y" "CONFIG_$A" ;; --disable-after|-D) - checkarg "$1" - A=$ARG - checkarg "$2" - B=$ARG - replace "/CONFIG_$A=[my]/a# CONFIG_$B is not set" \ - -e "/# CONFIG_$ARG is not set/a/# CONFIG_$ARG is not set" \ - -e "s/CONFIG_$ARG=[my]/# CONFIG_$ARG is not set/" - shift - shift + set_var "CONFIG_$B" "# CONFIG_$B is not set" "CONFIG_$A" ;; --module-after|-M) - checkarg "$1" - A=$ARG - checkarg "$2" - B=$ARG - replace "/CONFIG_$A=[my]/aCONFIG_$B=m" \ - -e "/# CONFIG_$ARG is not set/a/CONFIG_$ARG=m" \ - -e "s/CONFIG_$ARG=y/CONFIG_$ARG=m/" \ - -e "s/# CONFIG_$ARG is not set/CONFIG_$ARG=m/" - shift - shift + set_var "CONFIG_$B" "CONFIG_$B=m" "CONFIG_$A" ;; # undocumented because it ignores --file (fixme) diff --git a/scripts/dtc/.gitignore b/scripts/dtc/.gitignore new file mode 100644 index 00000000000..095acb49a37 --- /dev/null +++ b/scripts/dtc/.gitignore @@ -0,0 +1,5 @@ +dtc +dtc-lexer.lex.c +dtc-parser.tab.c +dtc-parser.tab.h + diff --git a/scripts/gcc-version.sh b/scripts/gcc-version.sh index cc767b388ba..debecb5561c 100644 --- a/scripts/gcc-version.sh +++ b/scripts/gcc-version.sh @@ -18,7 +18,7 @@ compiler="$*" if [ ${#compiler} -eq 0 ]; then echo "Error: No compiler specified." - echo -e "Usage:\n\t$0 <gcc-command>" + printf "Usage:\n\t$0 <gcc-command>\n" exit 1 fi diff --git a/scripts/get_maintainer.pl b/scripts/get_maintainer.pl index 60dc0c48c92..3e733146cd5 100755 --- a/scripts/get_maintainer.pl +++ b/scripts/get_maintainer.pl @@ -13,7 +13,7 @@ use strict; my $P = $0; -my $V = '0.15'; +my $V = '0.16'; use Getopt::Long qw(:config no_auto_abbrev); @@ -55,6 +55,10 @@ foreach my $chief (@penguin_chief) { } my $penguin_chiefs = "\(" . join("|",@penguin_chief_names) . "\)"; +# rfc822 email address - preloaded methods go here. +my $rfc822_lwsp = "(?:(?:\\r\\n)?[ \\t])"; +my $rfc822_char = '[\\000-\\377]'; + if (!GetOptions( 'email!' => \$email, 'git!' => \$email_git, @@ -161,7 +165,7 @@ foreach my $file (@ARGV) { } close(PATCH); if ($file_cnt == @files) { - die "$P: file '${file}' doesn't appear to be a patch. " + warn "$P: file '${file}' doesn't appear to be a patch. " . "Add -f to options?\n"; } @files = sort_and_uniq(@files); @@ -169,6 +173,7 @@ foreach my $file (@ARGV) { } my @email_to = (); +my @list_to = (); my @scm = (); my @web = (); my @subsystem = (); @@ -182,7 +187,7 @@ foreach my $file (@files) { my $exclude = 0; foreach my $line (@typevalue) { - if ($line =~ m/^(\C):(.*)/) { + if ($line =~ m/^(\C):\s*(.*)/) { my $type = $1; my $value = $2; if ($type eq 'X') { @@ -196,7 +201,7 @@ foreach my $file (@files) { if (!$exclude) { my $tvi = 0; foreach my $line (@typevalue) { - if ($line =~ m/^(\C):(.*)/) { + if ($line =~ m/^(\C):\s*(.*)/) { my $type = $1; my $value = $2; if ($type eq 'F') { @@ -215,29 +220,33 @@ foreach my $file (@files) { } -if ($email_git_penguin_chiefs) { +if ($email) { foreach my $chief (@penguin_chief) { if ($chief =~ m/^(.*):(.*)/) { - my $chief_name = $1; - my $chief_addr = $2; + my $email_address; if ($email_usename) { - push(@email_to, format_email($chief_name, $chief_addr)); + $email_address = format_email($1, $2); + } else { + $email_address = $2; + } + if ($email_git_penguin_chiefs) { + push(@email_to, $email_address); } else { - push(@email_to, $chief_addr); + @email_to = grep(!/${email_address}/, @email_to); } } } } -if ($email) { - my $address_cnt = @email_to; - if ($address_cnt == 0 && $email_list) { - push(@email_to, "linux-kernel\@vger.kernel.org"); +if ($email || $email_list) { + my @to = (); + if ($email) { + @to = (@to, @email_to); } - -#Don't sort email address list, but do remove duplicates - @email_to = uniq(@email_to); - output(@email_to); + if ($email_list) { + @to = (@to, @list_to); + } + output(uniq(@to)); } if ($scm) { @@ -307,10 +316,10 @@ Output type options: --multiline => print 1 entry per line Default options: - [--email --git --m --l --multiline] + [--email --git --m --n --l --multiline] Other options: - --version -> show version + --version => show version --help => show this help information EOT @@ -347,6 +356,7 @@ sub format_email { my ($name, $email) = @_; $name =~ s/^\s+|\s+$//g; + $name =~ s/^\"|\"$//g; $email =~ s/^\s+|\s+$//g; my $formatted_email = ""; @@ -366,36 +376,41 @@ sub add_categories { $index = $index - 1; while ($index >= 0) { my $tv = $typevalue[$index]; - if ($tv =~ m/^(\C):(.*)/) { + if ($tv =~ m/^(\C):\s*(.*)/) { my $ptype = $1; my $pvalue = $2; if ($ptype eq "L") { - my $subscr = $pvalue; - if ($subscr =~ m/\s*\(subscribers-only\)/) { + my $list_address = $pvalue; + my $list_additional = ""; + if ($list_address =~ m/([^\s]+)\s+(.*)$/) { + $list_address = $1; + $list_additional = $2; + } + if ($list_additional =~ m/subscribers-only/) { if ($email_subscriber_list) { - $subscr =~ s/\s*\(subscribers-only\)//g; - push(@email_to, $subscr); + push(@list_to, $list_address); } } else { if ($email_list) { - push(@email_to, $pvalue); + push(@list_to, $list_address); } } } elsif ($ptype eq "M") { - if ($email_maintainer) { - if ($index >= 0) { - my $tv = $typevalue[$index - 1]; - if ($tv =~ m/^(\C):(.*)/) { - if ($1 eq "P" && $email_usename) { - push(@email_to, format_email($2, $pvalue)); - } else { - push(@email_to, $pvalue); + my $p_used = 0; + if ($index >= 0) { + my $tv = $typevalue[$index - 1]; + if ($tv =~ m/^(\C):\s*(.*)/) { + if ($1 eq "P") { + if ($email_usename) { + push_email_address(format_email($2, $pvalue)); + $p_used = 1; } } - } else { - push(@email_to, $pvalue); } } + if (!$p_used) { + push_email_addresses($pvalue); + } } elsif ($ptype eq "T") { push(@scm, $pvalue); } elsif ($ptype eq "W") { @@ -412,10 +427,45 @@ sub add_categories { } } +sub push_email_address { + my ($email_address) = @_; + + my $email_name = ""; + if ($email_address =~ m/([^<]+)<(.*\@.*)>$/) { + $email_name = $1; + $email_address = $2; + } + + if ($email_maintainer) { + if ($email_usename && $email_name) { + push(@email_to, format_email($email_name, $email_address)); + } else { + push(@email_to, $email_address); + } + } +} + +sub push_email_addresses { + my ($address) = @_; + + my @address_list = (); + + if (rfc822_valid($address)) { + push_email_address($address); + } elsif (@address_list = rfc822_validlist($address)) { + my $array_count = shift(@address_list); + while (my $entry = shift(@address_list)) { + push_email_address($entry); + } + } else { + warn("Invalid MAINTAINERS address: '" . $address . "'\n"); + } +} + sub which { my ($bin) = @_; - foreach my $path (split /:/, $ENV{PATH}) { + foreach my $path (split(/:/, $ENV{PATH})) { if (-e "$path/$bin") { return "$path/$bin"; } @@ -434,16 +484,21 @@ sub recent_git_signoffs { my @lines = (); if (which("git") eq "") { - die("$P: git not found. Add --nogit to options?\n"); + warn("$P: git not found. Add --nogit to options?\n"); + return; + } + if (!(-d ".git")) { + warn("$P: .git directory not found. Use a git repository for better results.\n"); + warn("$P: perhaps 'git clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git'\n"); + return; } $cmd = "git log --since=${email_git_since} -- ${file}"; - $cmd .= " | grep -Pi \"^[-_ a-z]+by:.*\\\@\""; + $cmd .= " | grep -Ei \"^[-_ a-z]+by:.*\\\@.*\$\""; if (!$email_git_penguin_chiefs) { - $cmd .= " | grep -Pv \"${penguin_chiefs}\""; + $cmd .= " | grep -Ev \"${penguin_chiefs}\""; } $cmd .= " | cut -f2- -d\":\""; - $cmd .= " | sed -e \"s/^\\s+//g\""; $cmd .= " | sort | uniq -c | sort -rn"; $output = `${cmd}`; @@ -465,10 +520,6 @@ sub recent_git_signoffs { if ($line =~ m/(.+)<(.+)>/) { my $git_name = $1; my $git_addr = $2; - $git_name =~ tr/^\"//; - $git_name =~ tr/^\\s*//; - $git_name =~ tr/\"$//; - $git_name =~ tr/\\s*$//; if ($email_usename) { push(@email_to, format_email($git_name, $git_addr)); } else { @@ -481,7 +532,6 @@ sub recent_git_signoffs { push(@email_to, $line); } } - return $output; } sub uniq { @@ -513,3 +563,97 @@ sub output { print("\n"); } } + +my $rfc822re; + +sub make_rfc822re { +# Basic lexical tokens are specials, domain_literal, quoted_string, atom, and +# comment. We must allow for rfc822_lwsp (or comments) after each of these. +# This regexp will only work on addresses which have had comments stripped +# and replaced with rfc822_lwsp. + + my $specials = '()<>@,;:\\\\".\\[\\]'; + my $controls = '\\000-\\037\\177'; + + my $dtext = "[^\\[\\]\\r\\\\]"; + my $domain_literal = "\\[(?:$dtext|\\\\.)*\\]$rfc822_lwsp*"; + + my $quoted_string = "\"(?:[^\\\"\\r\\\\]|\\\\.|$rfc822_lwsp)*\"$rfc822_lwsp*"; + +# Use zero-width assertion to spot the limit of an atom. A simple +# $rfc822_lwsp* causes the regexp engine to hang occasionally. + my $atom = "[^$specials $controls]+(?:$rfc822_lwsp+|\\Z|(?=[\\[\"$specials]))"; + my $word = "(?:$atom|$quoted_string)"; + my $localpart = "$word(?:\\.$rfc822_lwsp*$word)*"; + + my $sub_domain = "(?:$atom|$domain_literal)"; + my $domain = "$sub_domain(?:\\.$rfc822_lwsp*$sub_domain)*"; + + my $addr_spec = "$localpart\@$rfc822_lwsp*$domain"; + + my $phrase = "$word*"; + my $route = "(?:\@$domain(?:,\@$rfc822_lwsp*$domain)*:$rfc822_lwsp*)"; + my $route_addr = "\\<$rfc822_lwsp*$route?$addr_spec\\>$rfc822_lwsp*"; + my $mailbox = "(?:$addr_spec|$phrase$route_addr)"; + + my $group = "$phrase:$rfc822_lwsp*(?:$mailbox(?:,\\s*$mailbox)*)?;\\s*"; + my $address = "(?:$mailbox|$group)"; + + return "$rfc822_lwsp*$address"; +} + +sub rfc822_strip_comments { + my $s = shift; +# Recursively remove comments, and replace with a single space. The simpler +# regexps in the Email Addressing FAQ are imperfect - they will miss escaped +# chars in atoms, for example. + + while ($s =~ s/^((?:[^"\\]|\\.)* + (?:"(?:[^"\\]|\\.)*"(?:[^"\\]|\\.)*)*) + \((?:[^()\\]|\\.)*\)/$1 /osx) {} + return $s; +} + +# valid: returns true if the parameter is an RFC822 valid address +# +sub rfc822_valid ($) { + my $s = rfc822_strip_comments(shift); + + if (!$rfc822re) { + $rfc822re = make_rfc822re(); + } + + return $s =~ m/^$rfc822re$/so && $s =~ m/^$rfc822_char*$/; +} + +# validlist: In scalar context, returns true if the parameter is an RFC822 +# valid list of addresses. +# +# In list context, returns an empty list on failure (an invalid +# address was found); otherwise a list whose first element is the +# number of addresses found and whose remaining elements are the +# addresses. This is needed to disambiguate failure (invalid) +# from success with no addresses found, because an empty string is +# a valid list. + +sub rfc822_validlist ($) { + my $s = rfc822_strip_comments(shift); + + if (!$rfc822re) { + $rfc822re = make_rfc822re(); + } + # * null list items are valid according to the RFC + # * the '1' business is to aid in distinguishing failure from no results + + my @r; + if ($s =~ m/^(?:$rfc822re)?(?:,(?:$rfc822re)?)*$/so && + $s =~ m/^$rfc822_char*$/) { + while ($s =~ m/(?:^|,$rfc822_lwsp*)($rfc822re)/gos) { + push @r, $1; + } + return wantarray ? (scalar(@r), @r) : 1; + } + else { + return wantarray ? () : 0; + } +} diff --git a/scripts/gfp-translate b/scripts/gfp-translate new file mode 100644 index 00000000000..073cb6d152a --- /dev/null +++ b/scripts/gfp-translate @@ -0,0 +1,81 @@ +#!/bin/bash +# Translate the bits making up a GFP mask +# (c) 2009, Mel Gorman <mel@csn.ul.ie> +# Licensed under the terms of the GNU GPL License version 2 +SOURCE= +GFPMASK=none + +# Helper function to report failures and exit +die() { + echo ERROR: $@ + if [ "$TMPFILE" != "" ]; then + rm -f $TMPFILE + fi + exit -1 +} + +usage() { + echo "usage: gfp-translate [-h] [ --source DIRECTORY ] gfpmask" + exit 0 +} + +# Parse command-line arguements +while [ $# -gt 0 ]; do + case $1 in + --source) + SOURCE=$2 + shift 2 + ;; + -h) + usage + ;; + --help) + usage + ;; + *) + GFPMASK=$1 + shift + ;; + esac +done + +# Guess the kernel source directory if it's not set. Preference is in order of +# o current directory +# o /usr/src/linux +if [ "$SOURCE" = "" ]; then + if [ -r "/usr/src/linux/Makefile" ]; then + SOURCE=/usr/src/linux + fi + if [ -r "`pwd`/Makefile" ]; then + SOURCE=`pwd` + fi +fi + +# Confirm that a source directory exists +if [ ! -r "$SOURCE/Makefile" ]; then + die "Could not locate kernel source directory or it is invalid" +fi + +# Confirm that a GFP mask has been specified +if [ "$GFPMASK" = "none" ]; then + usage +fi + +# Extract GFP flags from the kernel source +TMPFILE=`mktemp -t gfptranslate-XXXXXX` || exit 1 +grep "^#define __GFP" $SOURCE/include/linux/gfp.h | sed -e 's/(__force gfp_t)//' | sed -e 's/u)/)/' | grep -v GFP_BITS | sed -e 's/)\//) \//' > $TMPFILE + +# Parse the flags +IFS=" +" +echo Source: $SOURCE +echo Parsing: $GFPMASK +for LINE in `cat $TMPFILE`; do + MASK=`echo $LINE | awk '{print $3}'` + if [ $(($GFPMASK&$MASK)) -ne 0 ]; then + echo $LINE + fi +done + +rm -f $TMPFILE +exit 0 diff --git a/scripts/headers.sh b/scripts/headers.sh index d33426f866d..0308ecc10d5 100755 --- a/scripts/headers.sh +++ b/scripts/headers.sh @@ -15,19 +15,12 @@ do_command() fi } -# Do not try this architecture -drop="generic um ppc sparc64 cris" - archs=$(ls ${srctree}/arch) for arch in ${archs}; do case ${arch} in um) # no userspace export ;; - ppc) # headers exported by powerpc - ;; - sparc64) # headers exported by sparc - ;; cris) # headers export are known broken ;; *) diff --git a/scripts/headers_check.pl b/scripts/headers_check.pl index 56f90a48089..db1dd7a549f 100644 --- a/scripts/headers_check.pl +++ b/scripts/headers_check.pl @@ -2,7 +2,7 @@ # # headers_check.pl execute a number of trivial consistency checks # -# Usage: headers_check.pl dir [files...] +# Usage: headers_check.pl dir arch [files...] # dir: dir to look for included files # arch: architecture # files: list of files to check @@ -37,7 +37,7 @@ foreach my $file (@files) { &check_include(); &check_asm_types(); &check_sizetypes(); - &check_prototypes(); + &check_declarations(); # Dropped for now. Too much noise &check_config(); } close FH; @@ -61,16 +61,18 @@ sub check_include } } -sub check_prototypes +sub check_declarations { - if ($line =~ m/^\s*extern\b/) { - printf STDERR "$filename:$lineno: extern's make no sense in userspace\n"; + if ($line =~m/^\s*extern\b/) { + printf STDERR "$filename:$lineno: " . + "userspace cannot call function or variable " . + "defined in the kernel\n"; } } sub check_config { - if ($line =~ m/[^a-zA-Z0-9_]+CONFIG_([a-zA-Z0-9]+)[^a-zA-Z0-9]/) { + if ($line =~ m/[^a-zA-Z0-9_]+CONFIG_([a-zA-Z0-9_]+)[^a-zA-Z0-9_]/) { printf STDERR "$filename:$lineno: leaks CONFIG_$1 to userspace where it is not valid\n"; } } diff --git a/scripts/kallsyms.c b/scripts/kallsyms.c index 6654cbed965..64343cc084b 100644 --- a/scripts/kallsyms.c +++ b/scripts/kallsyms.c @@ -23,6 +23,10 @@ #include <string.h> #include <ctype.h> +#ifndef ARRAY_SIZE +#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof(arr[0])) +#endif + #define KSYM_NAME_LEN 128 struct sym_entry { @@ -32,9 +36,23 @@ struct sym_entry { unsigned char *sym; }; +struct text_range { + const char *stext, *etext; + unsigned long long start, end; +}; + +static unsigned long long _text; +static struct text_range text_ranges[] = { + { "_stext", "_etext" }, + { "_sinittext", "_einittext" }, + { "_stext_l1", "_etext_l1" }, /* Blackfin on-chip L1 inst SRAM */ + { "_stext_l2", "_etext_l2" }, /* Blackfin on-chip L2 SRAM */ +}; +#define text_range_text (&text_ranges[0]) +#define text_range_inittext (&text_ranges[1]) + static struct sym_entry *table; static unsigned int table_size, table_cnt; -static unsigned long long _text, _stext, _etext, _sinittext, _einittext; static int all_symbols = 0; static char symbol_prefix_char = '\0'; @@ -61,6 +79,26 @@ static inline int is_arm_mapping_symbol(const char *str) && (str[2] == '\0' || str[2] == '.'); } +static int read_symbol_tr(const char *sym, unsigned long long addr) +{ + size_t i; + struct text_range *tr; + + for (i = 0; i < ARRAY_SIZE(text_ranges); ++i) { + tr = &text_ranges[i]; + + if (strcmp(sym, tr->stext) == 0) { + tr->start = addr; + return 0; + } else if (strcmp(sym, tr->etext) == 0) { + tr->end = addr; + return 0; + } + } + + return 1; +} + static int read_symbol(FILE *in, struct sym_entry *s) { char str[500]; @@ -84,14 +122,8 @@ static int read_symbol(FILE *in, struct sym_entry *s) /* Ignore most absolute/undefined (?) symbols. */ if (strcmp(sym, "_text") == 0) _text = s->addr; - else if (strcmp(sym, "_stext") == 0) - _stext = s->addr; - else if (strcmp(sym, "_etext") == 0) - _etext = s->addr; - else if (strcmp(sym, "_sinittext") == 0) - _sinittext = s->addr; - else if (strcmp(sym, "_einittext") == 0) - _einittext = s->addr; + else if (read_symbol_tr(sym, s->addr) == 0) + /* nothing to do */; else if (toupper(stype) == 'A') { /* Keep these useful absolute symbols */ @@ -127,6 +159,21 @@ static int read_symbol(FILE *in, struct sym_entry *s) return 0; } +static int symbol_valid_tr(struct sym_entry *s) +{ + size_t i; + struct text_range *tr; + + for (i = 0; i < ARRAY_SIZE(text_ranges); ++i) { + tr = &text_ranges[i]; + + if (s->addr >= tr->start && s->addr <= tr->end) + return 1; + } + + return 0; +} + static int symbol_valid(struct sym_entry *s) { /* Symbols which vary between passes. Passes 1 and 2 must have @@ -156,8 +203,7 @@ static int symbol_valid(struct sym_entry *s) /* if --all-symbols is not specified, then symbols outside the text * and inittext sections are discarded */ if (!all_symbols) { - if ((s->addr < _stext || s->addr > _etext) - && (s->addr < _sinittext || s->addr > _einittext)) + if (symbol_valid_tr(s) == 0) return 0; /* Corner case. Discard any symbols with the same value as * _etext _einittext; they can move between pass 1 and 2 when @@ -165,10 +211,10 @@ static int symbol_valid(struct sym_entry *s) * they may get dropped in pass 2, which breaks the kallsyms * rules. */ - if ((s->addr == _etext && - strcmp((char *)s->sym + offset, "_etext")) || - (s->addr == _einittext && - strcmp((char *)s->sym + offset, "_einittext"))) + if ((s->addr == text_range_text->end && + strcmp((char *)s->sym + offset, text_range_text->etext)) || + (s->addr == text_range_inittext->end && + strcmp((char *)s->sym + offset, text_range_inittext->etext))) return 0; } diff --git a/scripts/kconfig/.gitignore b/scripts/kconfig/.gitignore index b49584c932c..6a36a76e660 100644 --- a/scripts/kconfig/.gitignore +++ b/scripts/kconfig/.gitignore @@ -8,6 +8,9 @@ lex.*.c zconf.hash.c *.moc lkc_defs.h +gconf.glade.h +*.pot +*.mo # # configuration programs diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile index fa8c2dd9c98..5ddf8becd7a 100644 --- a/scripts/kconfig/Makefile +++ b/scripts/kconfig/Makefile @@ -83,7 +83,7 @@ help: @echo ' xconfig - Update current config utilising a QT based front-end' @echo ' gconfig - Update current config utilising a GTK based front-end' @echo ' oldconfig - Update current config utilising a provided .config as base' - @echo ' silentoldconfig - Same as oldconfig, but quietly' + @echo ' silentoldconfig - Same as oldconfig, but quietly, additionally update deps' @echo ' randconfig - New config with random answer to all options' @echo ' defconfig - New config with default answer to all options' @echo ' allmodconfig - New config selecting modules when possible' @@ -104,7 +104,7 @@ HOST_EXTRACFLAGS += -DLOCALE # =========================================================================== # Shared Makefile for the various kconfig executables: # conf: Used for defconfig, oldconfig and related targets -# mconf: Used for the mconfig target. +# mconf: Used for the menuconfig target # Utilizes the lxdialog package # qconf: Used for the xconfig target # Based on QT which needs to be installed to compile it diff --git a/scripts/kconfig/conf.c b/scripts/kconfig/conf.c index d190092c3b6..3baaaecd6b1 100644 --- a/scripts/kconfig/conf.c +++ b/scripts/kconfig/conf.c @@ -498,14 +498,15 @@ int main(int ac, char **av) conf_parse(name); //zconfdump(stdout); if (sync_kconfig) { - if (stat(".config", &tmpstat)) { + name = conf_get_configname(); + if (stat(name, &tmpstat)) { fprintf(stderr, _("***\n" "*** You have not yet configured your kernel!\n" - "*** (missing kernel .config file)\n" + "*** (missing kernel config file \"%s\")\n" "***\n" "*** Please run some configurator (e.g. \"make oldconfig\" or\n" "*** \"make menuconfig\" or \"make xconfig\").\n" - "***\n")); + "***\n"), name); exit(1); } } diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c index 273d73888f9..a04da3459f0 100644 --- a/scripts/kconfig/confdata.c +++ b/scripts/kconfig/confdata.c @@ -41,6 +41,13 @@ const char *conf_get_configname(void) return name ? name : ".config"; } +const char *conf_get_autoconfig_name(void) +{ + char *name = getenv("KCONFIG_AUTOCONFIG"); + + return name ? name : "include/config/auto.conf"; +} + static char *conf_expand_value(const char *in) { struct symbol *sym; @@ -555,15 +562,14 @@ int conf_write(const char *name) int conf_split_config(void) { - char *name, path[128]; + const char *name; + char path[128]; char *s, *d, c; struct symbol *sym; struct stat sb; int res, i, fd; - name = getenv("KCONFIG_AUTOCONFIG"); - if (!name) - name = "include/config/auto.conf"; + name = conf_get_autoconfig_name(); conf_read_simple(name, S_DEF_AUTO); if (chdir("include/config")) @@ -670,7 +676,7 @@ int conf_write_autoconf(void) { struct symbol *sym; const char *str; - char *name; + const char *name; FILE *out, *out_h; time_t now; int i, l; @@ -773,9 +779,7 @@ int conf_write_autoconf(void) name = "include/linux/autoconf.h"; if (rename(".tmpconfig.h", name)) return 1; - name = getenv("KCONFIG_AUTOCONFIG"); - if (!name) - name = "include/config/auto.conf"; + name = conf_get_autoconfig_name(); /* * This must be the last step, kbuild has a dependency on auto.conf * and this marks the successful completion of the previous steps. diff --git a/scripts/kconfig/lkc.h b/scripts/kconfig/lkc.h index 4a9af6f7886..f379b0bf8c9 100644 --- a/scripts/kconfig/lkc.h +++ b/scripts/kconfig/lkc.h @@ -74,6 +74,7 @@ char *zconf_curname(void); /* confdata.c */ const char *conf_get_configname(void); +const char *conf_get_autoconfig_name(void); char *conf_get_default_confname(void); void sym_set_change_count(int count); void sym_add_change_count(int count); diff --git a/scripts/kconfig/lxdialog/checklist.c b/scripts/kconfig/lxdialog/checklist.c index b2a878c936d..bcc6f19c3a3 100644 --- a/scripts/kconfig/lxdialog/checklist.c +++ b/scripts/kconfig/lxdialog/checklist.c @@ -41,7 +41,8 @@ static void print_item(WINDOW * win, int choice, int selected) wmove(win, choice, check_x); wattrset(win, selected ? dlg.check_selected.atr : dlg.check.atr); - wprintw(win, "(%c)", item_is_tag('X') ? 'X' : ' '); + if (!item_is_tag(':')) + wprintw(win, "(%c)", item_is_tag('X') ? 'X' : ' '); wattrset(win, selected ? dlg.tag_selected.atr : dlg.tag.atr); mvwaddch(win, choice, item_x, item_str()[0]); diff --git a/scripts/kconfig/mconf.c b/scripts/kconfig/mconf.c index 6841e95c098..3bcacb4bfd3 100644 --- a/scripts/kconfig/mconf.c +++ b/scripts/kconfig/mconf.c @@ -732,7 +732,12 @@ static void conf_choice(struct menu *menu) for (child = menu->list; child; child = child->next) { if (!menu_is_visible(child)) continue; - item_make("%s", _(menu_get_prompt(child))); + if (child->sym) + item_make("%s", _(menu_get_prompt(child))); + else { + item_make("*** %s ***", _(menu_get_prompt(child))); + item_set_tag(':'); + } item_set_data(child); if (child->sym == active) item_set_selected(1); @@ -748,6 +753,9 @@ static void conf_choice(struct menu *menu) case 0: if (selected) { child = item_data(); + if (!child->sym) + break; + sym_set_tristate_value(child->sym, yes); } return; diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc index 5d0fd38b089..ce7d508c752 100644 --- a/scripts/kconfig/qconf.cc +++ b/scripts/kconfig/qconf.cc @@ -5,6 +5,7 @@ #include <qapplication.h> #include <qmainwindow.h> +#include <qdesktopwidget.h> #include <qtoolbar.h> #include <qlayout.h> #include <qvbox.h> @@ -297,10 +298,10 @@ void ConfigLineEdit::show(ConfigItem* i) void ConfigLineEdit::keyPressEvent(QKeyEvent* e) { switch (e->key()) { - case Key_Escape: + case Qt::Key_Escape: break; - case Key_Return: - case Key_Enter: + case Qt::Key_Return: + case Qt::Key_Enter: sym_set_string_value(item->menu->sym, text().latin1()); parent()->updateList(item); break; @@ -639,7 +640,7 @@ void ConfigList::keyPressEvent(QKeyEvent* ev) struct menu *menu; enum prop_type type; - if (ev->key() == Key_Escape && mode != fullMode && mode != listMode) { + if (ev->key() == Qt::Key_Escape && mode != fullMode && mode != listMode) { emit parentSelected(); ev->accept(); return; @@ -652,8 +653,8 @@ void ConfigList::keyPressEvent(QKeyEvent* ev) item = (ConfigItem*)i; switch (ev->key()) { - case Key_Return: - case Key_Enter: + case Qt::Key_Return: + case Qt::Key_Enter: if (item->goParent) { emit parentSelected(); break; @@ -667,16 +668,16 @@ void ConfigList::keyPressEvent(QKeyEvent* ev) emit menuSelected(menu); break; } - case Key_Space: + case Qt::Key_Space: changeValue(item); break; - case Key_N: + case Qt::Key_N: setValue(item, no); break; - case Key_M: + case Qt::Key_M: setValue(item, mod); break; - case Key_Y: + case Qt::Key_Y: setValue(item, yes); break; default: @@ -920,7 +921,7 @@ void ConfigView::updateListAll(void) } ConfigInfoView::ConfigInfoView(QWidget* parent, const char *name) - : Parent(parent, name), menu(0), sym(0) + : Parent(parent, name), sym(0), menu(0) { if (name) { configSettings->beginGroup(name); @@ -1199,7 +1200,7 @@ ConfigSearchWindow::ConfigSearchWindow(ConfigMainWindow* parent, const char *nam layout1->addLayout(layout2); split = new QSplitter(this); - split->setOrientation(QSplitter::Vertical); + split->setOrientation(Qt::Vertical); list = new ConfigView(split, name); list->list->mode = listMode; info = new ConfigInfoView(split, name); @@ -1275,7 +1276,7 @@ ConfigMainWindow::ConfigMainWindow(void) int x, y, width, height; char title[256]; - QWidget *d = configApp->desktop(); + QDesktopWidget *d = configApp->desktop(); snprintf(title, sizeof(title), _("Linux Kernel v%s Configuration"), getenv("KERNELVERSION")); setCaption(title); @@ -1290,14 +1291,14 @@ ConfigMainWindow::ConfigMainWindow(void) move(x, y); split1 = new QSplitter(this); - split1->setOrientation(QSplitter::Horizontal); + split1->setOrientation(Qt::Horizontal); setCentralWidget(split1); menuView = new ConfigView(split1, "menu"); menuList = menuView->list; split2 = new QSplitter(split1); - split2->setOrientation(QSplitter::Vertical); + split2->setOrientation(Qt::Vertical); // create config tree configView = new ConfigView(split2, "config"); @@ -1315,18 +1316,18 @@ ConfigMainWindow::ConfigMainWindow(void) backAction = new QAction("Back", QPixmap(xpm_back), _("Back"), 0, this); connect(backAction, SIGNAL(activated()), SLOT(goBack())); backAction->setEnabled(FALSE); - QAction *quitAction = new QAction("Quit", _("&Quit"), CTRL+Key_Q, this); + QAction *quitAction = new QAction("Quit", _("&Quit"), Qt::CTRL + Qt::Key_Q, this); connect(quitAction, SIGNAL(activated()), SLOT(close())); - QAction *loadAction = new QAction("Load", QPixmap(xpm_load), _("&Load"), CTRL+Key_L, this); + QAction *loadAction = new QAction("Load", QPixmap(xpm_load), _("&Load"), Qt::CTRL + Qt::Key_L, this); connect(loadAction, SIGNAL(activated()), SLOT(loadConfig())); - saveAction = new QAction("Save", QPixmap(xpm_save), _("&Save"), CTRL+Key_S, this); + saveAction = new QAction("Save", QPixmap(xpm_save), _("&Save"), Qt::CTRL + Qt::Key_S, this); connect(saveAction, SIGNAL(activated()), SLOT(saveConfig())); conf_set_changed_callback(conf_changed); // Set saveAction's initial state conf_changed(); QAction *saveAsAction = new QAction("Save As...", _("Save &As..."), 0, this); connect(saveAsAction, SIGNAL(activated()), SLOT(saveConfigAs())); - QAction *searchAction = new QAction("Find", _("&Find"), CTRL+Key_F, this); + QAction *searchAction = new QAction("Find", _("&Find"), Qt::CTRL + Qt::Key_F, this); connect(searchAction, SIGNAL(activated()), SLOT(searchConfig())); QAction *singleViewAction = new QAction("Single View", QPixmap(xpm_single_view), _("Single View"), 0, this); connect(singleViewAction, SIGNAL(activated()), SLOT(showSingleView())); @@ -1447,7 +1448,7 @@ ConfigMainWindow::ConfigMainWindow(void) void ConfigMainWindow::loadConfig(void) { - QString s = QFileDialog::getOpenFileName(".config", NULL, this); + QString s = QFileDialog::getOpenFileName(conf_get_configname(), NULL, this); if (s.isNull()) return; if (conf_read(QFile::encodeName(s))) @@ -1463,7 +1464,7 @@ void ConfigMainWindow::saveConfig(void) void ConfigMainWindow::saveConfigAs(void) { - QString s = QFileDialog::getSaveFileName(".config", NULL, this); + QString s = QFileDialog::getSaveFileName(conf_get_configname(), NULL, this); if (s.isNull()) return; if (conf_write(QFile::encodeName(s))) @@ -1524,6 +1525,8 @@ void ConfigMainWindow::setMenuLink(struct menu *menu) case fullMode: list = configList; break; + default: + break; } if (list) { @@ -1673,6 +1676,9 @@ void ConfigMainWindow::saveSettings(void) case fullMode : entry = "full"; break; + + default: + break; } configSettings->writeEntry("/listMode", entry); diff --git a/scripts/kconfig/util.c b/scripts/kconfig/util.c index 3cc9f936903..b6b2a46af14 100644 --- a/scripts/kconfig/util.c +++ b/scripts/kconfig/util.c @@ -46,8 +46,8 @@ int file_write_dep(const char *name) else fprintf(out, "\t%s\n", file->name); } - fprintf(out, "\ninclude/config/auto.conf: \\\n" - "\t$(deps_config)\n\n"); + fprintf(out, "\n%s: \\\n" + "\t$(deps_config)\n\n", conf_get_autoconfig_name()); expr_list_for_each_sym(sym_env_list, e, sym) { struct property *prop; @@ -61,7 +61,7 @@ int file_write_dep(const char *name) if (!value) value = ""; fprintf(out, "ifneq \"$(%s)\" \"%s\"\n", env_sym->name, value); - fprintf(out, "include/config/auto.conf: FORCE\n"); + fprintf(out, "%s: FORCE\n", conf_get_autoconfig_name()); fprintf(out, "endif\n"); } diff --git a/scripts/kernel-doc b/scripts/kernel-doc index acd8c4a8e3e..b52d340d759 100755 --- a/scripts/kernel-doc +++ b/scripts/kernel-doc @@ -5,7 +5,7 @@ use strict; ## Copyright (c) 1998 Michael Zucchi, All Rights Reserved ## ## Copyright (C) 2000, 1 Tim Waugh <twaugh@redhat.com> ## ## Copyright (C) 2001 Simon Huggins ## -## Copyright (C) 2005-2008 Randy Dunlap ## +## Copyright (C) 2005-2009 Randy Dunlap ## ## ## ## #define enhancements by Armin Kuster <akuster@mvista.com> ## ## Copyright (c) 2000 MontaVista Software, Inc. ## @@ -85,7 +85,7 @@ use strict; # # /** # * my_function -# **/ +# */ # # If the Description: header tag is omitted, then there must be a blank line # after the last parameter specification. @@ -105,7 +105,7 @@ use strict; # */ # etc. # -# Beside functions you can also write documentation for structs, unions, +# Besides functions you can also write documentation for structs, unions, # enums and typedefs. Instead of the function name you must write the name # of the declaration; the struct/union/enum/typedef must always precede # the name. Nesting of declarations is not supported. @@ -223,7 +223,7 @@ sub usage { } # read arguments -if ($#ARGV==-1) { +if ($#ARGV == -1) { usage(); } @@ -240,12 +240,12 @@ my $man_date = ('January', 'February', 'March', 'April', 'May', 'June', " " . ((localtime)[5]+1900); # Essentially these are globals -# They probably want to be tidied up made more localised or summat. -# CAVEAT EMPTOR! Some of the others I localised may not want to be which +# They probably want to be tidied up, made more localised or something. +# CAVEAT EMPTOR! Some of the others I localised may not want to be, which # could cause "use of undefined value" or other bugs. -my ($function, %function_table,%parametertypes,$declaration_purpose); -my ($type,$declaration_name,$return_type); -my ($newsection,$newcontents,$prototype,$filelist, $brcount, %source_map); +my ($function, %function_table, %parametertypes, $declaration_purpose); +my ($type, $declaration_name, $return_type); +my ($newsection, $newcontents, $prototype, $filelist, $brcount, %source_map); if (defined($ENV{'KBUILD_VERBOSE'})) { $verbose = "$ENV{'KBUILD_VERBOSE'}"; @@ -279,10 +279,10 @@ my $doc_special = "\@\%\$\&"; my $doc_start = '^/\*\*\s*$'; # Allow whitespace at end of comment start. my $doc_end = '\*/'; my $doc_com = '\s*\*\s*'; -my $doc_decl = $doc_com.'(\w+)'; -my $doc_sect = $doc_com.'(['.$doc_special.']?[\w\s]+):(.*)'; -my $doc_content = $doc_com.'(.*)'; -my $doc_block = $doc_com.'DOC:\s*(.*)?'; +my $doc_decl = $doc_com . '(\w+)'; +my $doc_sect = $doc_com . '([' . $doc_special . ']?[\w\s]+):(.*)'; +my $doc_content = $doc_com . '(.*)'; +my $doc_block = $doc_com . 'DOC:\s*(.*)?'; my %constants; my %parameterdescs; @@ -485,12 +485,12 @@ sub output_enum_html(%) { my %args = %{$_[0]}; my ($parameter); my $count; - print "<h2>enum ".$args{'enum'}."</h2>\n"; + print "<h2>enum " . $args{'enum'} . "</h2>\n"; - print "<b>enum ".$args{'enum'}."</b> {<br>\n"; + print "<b>enum " . $args{'enum'} . "</b> {<br>\n"; $count = 0; foreach $parameter (@{$args{'parameterlist'}}) { - print " <b>".$parameter."</b>"; + print " <b>" . $parameter . "</b>"; if ($count != $#{$args{'parameterlist'}}) { $count++; print ",\n"; @@ -502,7 +502,7 @@ sub output_enum_html(%) { print "<h3>Constants</h3>\n"; print "<dl>\n"; foreach $parameter (@{$args{'parameterlist'}}) { - print "<dt><b>".$parameter."</b>\n"; + print "<dt><b>" . $parameter . "</b>\n"; print "<dd>"; output_highlight($args{'parameterdescs'}{$parameter}); } @@ -516,9 +516,9 @@ sub output_typedef_html(%) { my %args = %{$_[0]}; my ($parameter); my $count; - print "<h2>typedef ".$args{'typedef'}."</h2>\n"; + print "<h2>typedef " . $args{'typedef'} . "</h2>\n"; - print "<b>typedef ".$args{'typedef'}."</b>\n"; + print "<b>typedef " . $args{'typedef'} . "</b>\n"; output_section_html(@_); print "<hr>\n"; } @@ -528,8 +528,8 @@ sub output_struct_html(%) { my %args = %{$_[0]}; my ($parameter); - print "<h2>".$args{'type'}." ".$args{'struct'}. " - " .$args{'purpose'}."</h2>\n"; - print "<b>".$args{'type'}." ".$args{'struct'}."</b> {<br>\n"; + print "<h2>" . $args{'type'} . " " . $args{'struct'} . " - " . $args{'purpose'} . "</h2>\n"; + print "<b>" . $args{'type'} . " " . $args{'struct'} . "</b> {<br>\n"; foreach $parameter (@{$args{'parameterlist'}}) { if ($parameter =~ /^#/) { print "$parameter<br>\n"; @@ -561,7 +561,7 @@ sub output_struct_html(%) { $parameter_name =~ s/\[.*//; ($args{'parameterdescs'}{$parameter_name} ne $undescribed) || next; - print "<dt><b>".$parameter."</b>\n"; + print "<dt><b>" . $parameter . "</b>\n"; print "<dd>"; output_highlight($args{'parameterdescs'}{$parameter_name}); } @@ -576,9 +576,9 @@ sub output_function_html(%) { my ($parameter, $section); my $count; - print "<h2>" .$args{'function'}." - ".$args{'purpose'}."</h2>\n"; - print "<i>".$args{'functiontype'}."</i>\n"; - print "<b>".$args{'function'}."</b>\n"; + print "<h2>" . $args{'function'} . " - " . $args{'purpose'} . "</h2>\n"; + print "<i>" . $args{'functiontype'} . "</i>\n"; + print "<b>" . $args{'function'} . "</b>\n"; print "("; $count = 0; foreach $parameter (@{$args{'parameterlist'}}) { @@ -587,7 +587,7 @@ sub output_function_html(%) { # pointer-to-function print "<i>$1</i><b>$parameter</b>) <i>($2)</i>"; } else { - print "<i>".$type."</i> <b>".$parameter."</b>"; + print "<i>" . $type . "</i> <b>" . $parameter . "</b>"; } if ($count != $#{$args{'parameterlist'}}) { $count++; @@ -603,7 +603,7 @@ sub output_function_html(%) { $parameter_name =~ s/\[.*//; ($args{'parameterdescs'}{$parameter_name} ne $undescribed) || next; - print "<dt><b>".$parameter."</b>\n"; + print "<dt><b>" . $parameter . "</b>\n"; print "<dd>"; output_highlight($args{'parameterdescs'}{$parameter_name}); } @@ -657,7 +657,7 @@ sub output_function_xml(%) { my $count; my $id; - $id = "API-".$args{'function'}; + $id = "API-" . $args{'function'}; $id =~ s/[^A-Za-z0-9]/-/g; print "<refentry id=\"$id\">\n"; @@ -667,12 +667,12 @@ sub output_function_xml(%) { print " <date>$man_date</date>\n"; print "</refentryinfo>\n"; print "<refmeta>\n"; - print " <refentrytitle><phrase>".$args{'function'}."</phrase></refentrytitle>\n"; + print " <refentrytitle><phrase>" . $args{'function'} . "</phrase></refentrytitle>\n"; print " <manvolnum>9</manvolnum>\n"; print " <refmiscinfo class=\"version\">" . $kernelversion . "</refmiscinfo>\n"; print "</refmeta>\n"; print "<refnamediv>\n"; - print " <refname>".$args{'function'}."</refname>\n"; + print " <refname>" . $args{'function'} . "</refname>\n"; print " <refpurpose>\n"; print " "; output_highlight ($args{'purpose'}); @@ -682,8 +682,8 @@ sub output_function_xml(%) { print "<refsynopsisdiv>\n"; print " <title>Synopsis</title>\n"; print " <funcsynopsis><funcprototype>\n"; - print " <funcdef>".$args{'functiontype'}." "; - print "<function>".$args{'function'}." </function></funcdef>\n"; + print " <funcdef>" . $args{'functiontype'} . " "; + print "<function>" . $args{'function'} . " </function></funcdef>\n"; $count = 0; if ($#{$args{'parameterlist'}} >= 0) { @@ -694,7 +694,7 @@ sub output_function_xml(%) { print " <paramdef>$1<parameter>$parameter</parameter>)\n"; print " <funcparams>$2</funcparams></paramdef>\n"; } else { - print " <paramdef>".$type; + print " <paramdef>" . $type; print " <parameter>$parameter</parameter></paramdef>\n"; } } @@ -734,7 +734,7 @@ sub output_struct_xml(%) { my ($parameter, $section); my $id; - $id = "API-struct-".$args{'struct'}; + $id = "API-struct-" . $args{'struct'}; $id =~ s/[^A-Za-z0-9]/-/g; print "<refentry id=\"$id\">\n"; @@ -744,12 +744,12 @@ sub output_struct_xml(%) { print " <date>$man_date</date>\n"; print "</refentryinfo>\n"; print "<refmeta>\n"; - print " <refentrytitle><phrase>".$args{'type'}." ".$args{'struct'}."</phrase></refentrytitle>\n"; + print " <refentrytitle><phrase>" . $args{'type'} . " " . $args{'struct'} . "</phrase></refentrytitle>\n"; print " <manvolnum>9</manvolnum>\n"; print " <refmiscinfo class=\"version\">" . $kernelversion . "</refmiscinfo>\n"; print "</refmeta>\n"; print "<refnamediv>\n"; - print " <refname>".$args{'type'}." ".$args{'struct'}."</refname>\n"; + print " <refname>" . $args{'type'} . " " . $args{'struct'} . "</refname>\n"; print " <refpurpose>\n"; print " "; output_highlight ($args{'purpose'}); @@ -759,7 +759,7 @@ sub output_struct_xml(%) { print "<refsynopsisdiv>\n"; print " <title>Synopsis</title>\n"; print " <programlisting>\n"; - print $args{'type'}." ".$args{'struct'}." {\n"; + print $args{'type'} . " " . $args{'struct'} . " {\n"; foreach $parameter (@{$args{'parameterlist'}}) { if ($parameter =~ /^#/) { print "$parameter\n"; @@ -779,7 +779,7 @@ sub output_struct_xml(%) { # bitfield print " $1 $parameter$2;\n"; } else { - print " ".$type." ".$parameter.";\n"; + print " " . $type . " " . $parameter . ";\n"; } } print "};"; @@ -824,7 +824,7 @@ sub output_enum_xml(%) { my $count; my $id; - $id = "API-enum-".$args{'enum'}; + $id = "API-enum-" . $args{'enum'}; $id =~ s/[^A-Za-z0-9]/-/g; print "<refentry id=\"$id\">\n"; @@ -834,12 +834,12 @@ sub output_enum_xml(%) { print " <date>$man_date</date>\n"; print "</refentryinfo>\n"; print "<refmeta>\n"; - print " <refentrytitle><phrase>enum ".$args{'enum'}."</phrase></refentrytitle>\n"; + print " <refentrytitle><phrase>enum " . $args{'enum'} . "</phrase></refentrytitle>\n"; print " <manvolnum>9</manvolnum>\n"; print " <refmiscinfo class=\"version\">" . $kernelversion . "</refmiscinfo>\n"; print "</refmeta>\n"; print "<refnamediv>\n"; - print " <refname>enum ".$args{'enum'}."</refname>\n"; + print " <refname>enum " . $args{'enum'} . "</refname>\n"; print " <refpurpose>\n"; print " "; output_highlight ($args{'purpose'}); @@ -849,7 +849,7 @@ sub output_enum_xml(%) { print "<refsynopsisdiv>\n"; print " <title>Synopsis</title>\n"; print " <programlisting>\n"; - print "enum ".$args{'enum'}." {\n"; + print "enum " . $args{'enum'} . " {\n"; $count = 0; foreach $parameter (@{$args{'parameterlist'}}) { print " $parameter"; @@ -891,7 +891,7 @@ sub output_typedef_xml(%) { my ($parameter, $section); my $id; - $id = "API-typedef-".$args{'typedef'}; + $id = "API-typedef-" . $args{'typedef'}; $id =~ s/[^A-Za-z0-9]/-/g; print "<refentry id=\"$id\">\n"; @@ -901,11 +901,11 @@ sub output_typedef_xml(%) { print " <date>$man_date</date>\n"; print "</refentryinfo>\n"; print "<refmeta>\n"; - print " <refentrytitle><phrase>typedef ".$args{'typedef'}."</phrase></refentrytitle>\n"; + print " <refentrytitle><phrase>typedef " . $args{'typedef'} . "</phrase></refentrytitle>\n"; print " <manvolnum>9</manvolnum>\n"; print "</refmeta>\n"; print "<refnamediv>\n"; - print " <refname>typedef ".$args{'typedef'}."</refname>\n"; + print " <refname>typedef " . $args{'typedef'} . "</refname>\n"; print " <refpurpose>\n"; print " "; output_highlight ($args{'purpose'}); @@ -914,7 +914,7 @@ sub output_typedef_xml(%) { print "<refsynopsisdiv>\n"; print " <title>Synopsis</title>\n"; - print " <synopsis>typedef ".$args{'typedef'}.";</synopsis>\n"; + print " <synopsis>typedef " . $args{'typedef'} . ";</synopsis>\n"; print "</refsynopsisdiv>\n"; output_section_xml(@_); @@ -963,15 +963,15 @@ sub output_function_gnome { my $count; my $id; - $id = $args{'module'}."-".$args{'function'}; + $id = $args{'module'} . "-" . $args{'function'}; $id =~ s/[^A-Za-z0-9]/-/g; print "<sect2>\n"; - print " <title id=\"$id\">".$args{'function'}."</title>\n"; + print " <title id=\"$id\">" . $args{'function'} . "</title>\n"; print " <funcsynopsis>\n"; - print " <funcdef>".$args{'functiontype'}." "; - print "<function>".$args{'function'}." "; + print " <funcdef>" . $args{'functiontype'} . " "; + print "<function>" . $args{'function'} . " "; print "</function></funcdef>\n"; $count = 0; @@ -983,7 +983,7 @@ sub output_function_gnome { print " <paramdef>$1 <parameter>$parameter</parameter>)\n"; print " <funcparams>$2</funcparams></paramdef>\n"; } else { - print " <paramdef>".$type; + print " <paramdef>" . $type; print " <parameter>$parameter</parameter></paramdef>\n"; } } @@ -1043,13 +1043,13 @@ sub output_function_man(%) { print ".TH \"$args{'function'}\" 9 \"$args{'function'}\" \"$man_date\" \"Kernel Hacker's Manual\" LINUX\n"; print ".SH NAME\n"; - print $args{'function'}." \\- ".$args{'purpose'}."\n"; + print $args{'function'} . " \\- " . $args{'purpose'} . "\n"; print ".SH SYNOPSIS\n"; if ($args{'functiontype'} ne "") { - print ".B \"".$args{'functiontype'}."\" ".$args{'function'}."\n"; + print ".B \"" . $args{'functiontype'} . "\" " . $args{'function'} . "\n"; } else { - print ".B \"".$args{'function'}."\n"; + print ".B \"" . $args{'function'} . "\n"; } $count = 0; my $parenth = "("; @@ -1061,10 +1061,10 @@ sub output_function_man(%) { $type = $args{'parametertypes'}{$parameter}; if ($type =~ m/([^\(]*\(\*)\s*\)\s*\(([^\)]*)\)/) { # pointer-to-function - print ".BI \"".$parenth.$1."\" ".$parameter." \") (".$2.")".$post."\"\n"; + print ".BI \"" . $parenth . $1 . "\" " . $parameter . " \") (" . $2 . ")" . $post . "\"\n"; } else { $type =~ s/([^\*])$/$1 /; - print ".BI \"".$parenth.$type."\" ".$parameter." \"".$post."\"\n"; + print ".BI \"" . $parenth . $type . "\" " . $parameter . " \"" . $post . "\"\n"; } $count++; $parenth = ""; @@ -1075,7 +1075,7 @@ sub output_function_man(%) { my $parameter_name = $parameter; $parameter_name =~ s/\[.*//; - print ".IP \"".$parameter."\" 12\n"; + print ".IP \"" . $parameter . "\" 12\n"; output_highlight($args{'parameterdescs'}{$parameter_name}); } foreach $section (@{$args{'sectionlist'}}) { @@ -1094,10 +1094,10 @@ sub output_enum_man(%) { print ".TH \"$args{'module'}\" 9 \"enum $args{'enum'}\" \"$man_date\" \"API Manual\" LINUX\n"; print ".SH NAME\n"; - print "enum ".$args{'enum'}." \\- ".$args{'purpose'}."\n"; + print "enum " . $args{'enum'} . " \\- " . $args{'purpose'} . "\n"; print ".SH SYNOPSIS\n"; - print "enum ".$args{'enum'}." {\n"; + print "enum " . $args{'enum'} . " {\n"; $count = 0; foreach my $parameter (@{$args{'parameterlist'}}) { print ".br\n.BI \" $parameter\"\n"; @@ -1116,7 +1116,7 @@ sub output_enum_man(%) { my $parameter_name = $parameter; $parameter_name =~ s/\[.*//; - print ".IP \"".$parameter."\" 12\n"; + print ".IP \"" . $parameter . "\" 12\n"; output_highlight($args{'parameterdescs'}{$parameter_name}); } foreach $section (@{$args{'sectionlist'}}) { @@ -1131,13 +1131,13 @@ sub output_struct_man(%) { my %args = %{$_[0]}; my ($parameter, $section); - print ".TH \"$args{'module'}\" 9 \"".$args{'type'}." ".$args{'struct'}."\" \"$man_date\" \"API Manual\" LINUX\n"; + print ".TH \"$args{'module'}\" 9 \"" . $args{'type'} . " " . $args{'struct'} . "\" \"$man_date\" \"API Manual\" LINUX\n"; print ".SH NAME\n"; - print $args{'type'}." ".$args{'struct'}." \\- ".$args{'purpose'}."\n"; + print $args{'type'} . " " . $args{'struct'} . " \\- " . $args{'purpose'} . "\n"; print ".SH SYNOPSIS\n"; - print $args{'type'}." ".$args{'struct'}." {\n.br\n"; + print $args{'type'} . " " . $args{'struct'} . " {\n.br\n"; foreach my $parameter (@{$args{'parameterlist'}}) { if ($parameter =~ /^#/) { @@ -1151,13 +1151,13 @@ sub output_struct_man(%) { $type = $args{'parametertypes'}{$parameter}; if ($type =~ m/([^\(]*\(\*)\s*\)\s*\(([^\)]*)\)/) { # pointer-to-function - print ".BI \" ".$1."\" ".$parameter." \") (".$2.")"."\"\n;\n"; + print ".BI \" " . $1 . "\" " . $parameter . " \") (" . $2 . ")" . "\"\n;\n"; } elsif ($type =~ m/^(.*?)\s*(:.*)/) { # bitfield - print ".BI \" ".$1."\ \" ".$parameter.$2." \""."\"\n;\n"; + print ".BI \" " . $1 . "\ \" " . $parameter . $2 . " \"" . "\"\n;\n"; } else { $type =~ s/([^\*])$/$1 /; - print ".BI \" ".$type."\" ".$parameter." \""."\"\n;\n"; + print ".BI \" " . $type . "\" " . $parameter . " \"" . "\"\n;\n"; } print "\n.br\n"; } @@ -1171,7 +1171,7 @@ sub output_struct_man(%) { $parameter_name =~ s/\[.*//; ($args{'parameterdescs'}{$parameter_name} ne $undescribed) || next; - print ".IP \"".$parameter."\" 12\n"; + print ".IP \"" . $parameter . "\" 12\n"; output_highlight($args{'parameterdescs'}{$parameter_name}); } foreach $section (@{$args{'sectionlist'}}) { @@ -1189,7 +1189,7 @@ sub output_typedef_man(%) { print ".TH \"$args{'module'}\" 9 \"$args{'typedef'}\" \"$man_date\" \"API Manual\" LINUX\n"; print ".SH NAME\n"; - print "typedef ".$args{'typedef'}." \\- ".$args{'purpose'}."\n"; + print "typedef " . $args{'typedef'} . " \\- " . $args{'purpose'} . "\n"; foreach $section (@{$args{'sectionlist'}}) { print ".SH \"$section\"\n"; @@ -1218,13 +1218,13 @@ sub output_function_text(%) { my $start; print "Name:\n\n"; - print $args{'function'}." - ".$args{'purpose'}."\n"; + print $args{'function'} . " - " . $args{'purpose'} . "\n"; print "\nSynopsis:\n\n"; if ($args{'functiontype'} ne "") { - $start = $args{'functiontype'}." ".$args{'function'}." ("; + $start = $args{'functiontype'} . " " . $args{'function'} . " ("; } else { - $start = $args{'function'}." ("; + $start = $args{'function'} . " ("; } print $start; @@ -1233,9 +1233,9 @@ sub output_function_text(%) { $type = $args{'parametertypes'}{$parameter}; if ($type =~ m/([^\(]*\(\*)\s*\)\s*\(([^\)]*)\)/) { # pointer-to-function - print $1.$parameter.") (".$2; + print $1 . $parameter . ") (" . $2; } else { - print $type." ".$parameter; + print $type . " " . $parameter; } if ($count != $#{$args{'parameterlist'}}) { $count++; @@ -1251,7 +1251,7 @@ sub output_function_text(%) { my $parameter_name = $parameter; $parameter_name =~ s/\[.*//; - print $parameter."\n\t".$args{'parameterdescs'}{$parameter_name}."\n"; + print $parameter . "\n\t" . $args{'parameterdescs'}{$parameter_name} . "\n"; } output_section_text(@_); } @@ -1276,8 +1276,8 @@ sub output_enum_text(%) { my $count; print "Enum:\n\n"; - print "enum ".$args{'enum'}." - ".$args{'purpose'}."\n\n"; - print "enum ".$args{'enum'}." {\n"; + print "enum " . $args{'enum'} . " - " . $args{'purpose'} . "\n\n"; + print "enum " . $args{'enum'} . " {\n"; $count = 0; foreach $parameter (@{$args{'parameterlist'}}) { print "\t$parameter"; @@ -1292,7 +1292,7 @@ sub output_enum_text(%) { print "Constants:\n\n"; foreach $parameter (@{$args{'parameterlist'}}) { print "$parameter\n\t"; - print $args{'parameterdescs'}{$parameter}."\n"; + print $args{'parameterdescs'}{$parameter} . "\n"; } output_section_text(@_); @@ -1305,7 +1305,7 @@ sub output_typedef_text(%) { my $count; print "Typedef:\n\n"; - print "typedef ".$args{'typedef'}." - ".$args{'purpose'}."\n"; + print "typedef " . $args{'typedef'} . " - " . $args{'purpose'} . "\n"; output_section_text(@_); } @@ -1314,8 +1314,8 @@ sub output_struct_text(%) { my %args = %{$_[0]}; my ($parameter); - print $args{'type'}." ".$args{'struct'}." - ".$args{'purpose'}."\n\n"; - print $args{'type'}." ".$args{'struct'}." {\n"; + print $args{'type'} . " " . $args{'struct'} . " - " . $args{'purpose'} . "\n\n"; + print $args{'type'} . " " . $args{'struct'} . " {\n"; foreach $parameter (@{$args{'parameterlist'}}) { if ($parameter =~ /^#/) { print "$parameter\n"; @@ -1334,7 +1334,7 @@ sub output_struct_text(%) { # bitfield print "\t$1 $parameter$2;\n"; } else { - print "\t".$type." ".$parameter.";\n"; + print "\t" . $type . " " . $parameter . ";\n"; } } print "};\n\n"; @@ -1348,7 +1348,7 @@ sub output_struct_text(%) { ($args{'parameterdescs'}{$parameter_name} ne $undescribed) || next; print "$parameter\n\t"; - print $args{'parameterdescs'}{$parameter_name}."\n"; + print $args{'parameterdescs'}{$parameter_name} . "\n"; } print "\n"; output_section_text(@_); @@ -1387,7 +1387,7 @@ sub output_declaration { # generic output function - calls the right one based on current output mode. sub output_blockhead { no strict 'refs'; - my $func = "output_blockhead_".$output_mode; + my $func = "output_blockhead_" . $output_mode; &$func(@_); $section_counter++; } @@ -1398,7 +1398,7 @@ sub output_blockhead { sub dump_declaration($$) { no strict 'refs'; my ($prototype, $file) = @_; - my $func = "dump_".$decl_type; + my $func = "dump_" . $decl_type; &$func(@_); } @@ -1426,6 +1426,8 @@ sub dump_struct($$) { # strip comments: $members =~ s/\/\*.*?\*\///gos; $nested =~ s/\/\*.*?\*\///gos; + # strip kmemcheck_bitfield_{begin,end}.*; + $members =~ s/kmemcheck_bitfield_.*?;//gos; create_parameterlist($members, ';', $file); check_sections($file, $declaration_name, "struct", $sectcheck, $struct_actual, $nested); @@ -1645,12 +1647,21 @@ sub push_parameter($$$) { "or member '$param' not " . "described in '$declaration_name'\n"; } - print STDERR "Warning(${file}:$.):". + print STDERR "Warning(${file}:$.):" . " No description found for parameter '$param'\n"; ++$warnings; } } + # strip spaces from $param so that it is one continous string + # on @parameterlist; + # this fixes a problem where check_sections() cannot find + # a parameter like "addr[6 + 2]" because it actually appears + # as "addr[6", "+", "2]" on the parameter list; + # but it's better to maintain the param string unchanged for output, + # so just weaken the string compare in check_sections() to ignore + # "[blah" in a parameter string; + ###$param =~ s/\s*//g; push @parameterlist, $param; $parametertypes{$param} = $type; } @@ -1669,6 +1680,14 @@ sub check_sections($$$$$$) { $prm_clean = $prms[$px]; $prm_clean =~ s/\[.*\]//; $prm_clean =~ s/__attribute__\s*\(\([a-z,_\*\s\(\)]*\)\)//; + # ignore array size in a parameter string; + # however, the original param string may contain + # spaces, e.g.: addr[6 + 2] + # and this appears in @prms as "addr[6" since the + # parameter list is split at spaces; + # hence just ignore "[..." for the sections check; + $prm_clean =~ s/\[.*//; + ##$prm_clean =~ s/^\**//; if ($prm_clean eq $sects[$sx]) { $err = 0; @@ -1929,7 +1948,7 @@ sub process_state3_type($$) { ($2 eq '{') && $brcount++; ($2 eq '}') && $brcount--; if (($2 eq ';') && ($brcount == 0)) { - dump_declaration($prototype,$file); + dump_declaration($prototype, $file); reset_state(); last; } @@ -2106,7 +2125,7 @@ sub process_file($) { $section = $section_default; $contents = ""; } else { - $contents .= $1."\n"; + $contents .= $1 . "\n"; } } else { # i dont know - bad line? ignore. diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c index a3344285ccf..40e0045876e 100644 --- a/scripts/mod/file2alias.c +++ b/scripts/mod/file2alias.c @@ -641,7 +641,7 @@ static int do_virtio_entry(const char *filename, struct virtio_device_id *id, id->vendor = TO_NATIVE(id->vendor); strcpy(alias, "virtio:"); - ADD(alias, "d", 1, id->device); + ADD(alias, "d", id->device != VIRTIO_DEV_ANY_ID, id->device); ADD(alias, "v", id->vendor != VIRTIO_DEV_ANY_ID, id->vendor); add_wildcard(alias); diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c index 161b7846733..4522948a012 100644 --- a/scripts/mod/modpost.c +++ b/scripts/mod/modpost.c @@ -763,6 +763,8 @@ static void check_section(const char *modname, struct elf_info *elf, #define ALL_INIT_DATA_SECTIONS \ + ".init.setup$", ".init.rodata$", \ + ".devinit.rodata$", ".cpuinit.rodata$", ".meminit.rodata$" \ ".init.data$", ".devinit.data$", ".cpuinit.data$", ".meminit.data$" #define ALL_EXIT_DATA_SECTIONS \ ".exit.data$", ".devexit.data$", ".cpuexit.data$", ".memexit.data$" @@ -772,21 +774,23 @@ static void check_section(const char *modname, struct elf_info *elf, #define ALL_EXIT_TEXT_SECTIONS \ ".exit.text$", ".devexit.text$", ".cpuexit.text$", ".memexit.text$" -#define ALL_INIT_SECTIONS ALL_INIT_DATA_SECTIONS, ALL_INIT_TEXT_SECTIONS -#define ALL_EXIT_SECTIONS ALL_EXIT_DATA_SECTIONS, ALL_EXIT_TEXT_SECTIONS +#define ALL_INIT_SECTIONS INIT_SECTIONS, DEV_INIT_SECTIONS, \ + CPU_INIT_SECTIONS, MEM_INIT_SECTIONS +#define ALL_EXIT_SECTIONS EXIT_SECTIONS, DEV_EXIT_SECTIONS, \ + CPU_EXIT_SECTIONS, MEM_EXIT_SECTIONS #define DATA_SECTIONS ".data$", ".data.rel$" #define TEXT_SECTIONS ".text$" -#define INIT_SECTIONS ".init.data$", ".init.text$" -#define DEV_INIT_SECTIONS ".devinit.data$", ".devinit.text$" -#define CPU_INIT_SECTIONS ".cpuinit.data$", ".cpuinit.text$" -#define MEM_INIT_SECTIONS ".meminit.data$", ".meminit.text$" +#define INIT_SECTIONS ".init.*" +#define DEV_INIT_SECTIONS ".devinit.*" +#define CPU_INIT_SECTIONS ".cpuinit.*" +#define MEM_INIT_SECTIONS ".meminit.*" -#define EXIT_SECTIONS ".exit.data$", ".exit.text$" -#define DEV_EXIT_SECTIONS ".devexit.data$", ".devexit.text$" -#define CPU_EXIT_SECTIONS ".cpuexit.data$", ".cpuexit.text$" -#define MEM_EXIT_SECTIONS ".memexit.data$", ".memexit.text$" +#define EXIT_SECTIONS ".exit.*" +#define DEV_EXIT_SECTIONS ".devexit.*" +#define CPU_EXIT_SECTIONS ".cpuexit.*" +#define MEM_EXIT_SECTIONS ".memexit.*" /* init data sections */ static const char *init_data_sections[] = { ALL_INIT_DATA_SECTIONS, NULL }; @@ -869,12 +873,36 @@ const struct sectioncheck sectioncheck[] = { .tosec = { INIT_SECTIONS, NULL }, .mismatch = XXXINIT_TO_INIT, }, +/* Do not reference cpuinit code/data from meminit code/data */ +{ + .fromsec = { MEM_INIT_SECTIONS, NULL }, + .tosec = { CPU_INIT_SECTIONS, NULL }, + .mismatch = XXXINIT_TO_INIT, +}, +/* Do not reference meminit code/data from cpuinit code/data */ +{ + .fromsec = { CPU_INIT_SECTIONS, NULL }, + .tosec = { MEM_INIT_SECTIONS, NULL }, + .mismatch = XXXINIT_TO_INIT, +}, /* Do not reference exit code/data from devexit/cpuexit/memexit code/data */ { .fromsec = { DEV_EXIT_SECTIONS, CPU_EXIT_SECTIONS, MEM_EXIT_SECTIONS, NULL }, .tosec = { EXIT_SECTIONS, NULL }, .mismatch = XXXEXIT_TO_EXIT, }, +/* Do not reference cpuexit code/data from memexit code/data */ +{ + .fromsec = { MEM_EXIT_SECTIONS, NULL }, + .tosec = { CPU_EXIT_SECTIONS, NULL }, + .mismatch = XXXEXIT_TO_EXIT, +}, +/* Do not reference memexit code/data from cpuexit code/data */ +{ + .fromsec = { CPU_EXIT_SECTIONS, NULL }, + .tosec = { MEM_EXIT_SECTIONS, NULL }, + .mismatch = XXXEXIT_TO_EXIT, +}, /* Do not use exit code/data from init code */ { .fromsec = { ALL_INIT_SECTIONS, NULL }, @@ -1168,7 +1196,7 @@ static void report_sec_mismatch(const char *modname, enum mismatch mismatch, "The variable %s references\n" "the %s %s%s%s\n" "If the reference is valid then annotate the\n" - "variable with __init* (see linux/init.h) " + "variable with __init* or __refdata (see linux/init.h) " "or name the variable:\n", fromsym, to, sec2annotation(tosec), tosym, to_p); while (*s) diff --git a/scripts/package/builddeb b/scripts/package/builddeb index 1264b8e2829..b19f1f4962e 100644 --- a/scripts/package/builddeb +++ b/scripts/package/builddeb @@ -1,38 +1,60 @@ #!/bin/sh # -# builddeb 1.2 +# builddeb 1.3 # Copyright 2003 Wichert Akkerman <wichert@wiggy.net> # # Simple script to generate a deb package for a Linux kernel. All the -# complexity of what to do with a kernel after it is installer or removed +# complexity of what to do with a kernel after it is installed or removed # is left to other scripts and packages: they can install scripts in the -# /etc/kernel/{pre,post}{inst,rm}.d/ directories that will be called on -# package install and removal. +# /etc/kernel/{pre,post}{inst,rm}.d/ directories (or an alternative location +# specified in KDEB_HOOKDIR) that will be called on package install and +# removal. set -e +create_package() { + local pname="$1" pdir="$2" + + cp debian/copyright "$pdir/usr/share/doc/$pname/" + cp debian/changelog "$pdir/usr/share/doc/$pname/changelog.Debian" + gzip -9 "$pdir/usr/share/doc/$pname/changelog.Debian" + + # Fix ownership and permissions + chown -R root:root "$pdir" + chmod -R go-w "$pdir" + + # Create the package + dpkg-gencontrol -isp -p$pname -P"$pdir" + dpkg --build "$pdir" .. +} + # Some variables and settings used throughout the script version=$KERNELRELEASE -revision=`cat .version` +revision=$(cat .version) +if [ -n "$KDEB_PKGVERSION" ]; then + packageversion=$KDEB_PKGVERSION +else + packageversion=$version-$revision +fi tmpdir="$objtree/debian/tmp" fwdir="$objtree/debian/fwtmp" -packagename=linux-$version +packagename=linux-image-$version fwpackagename=linux-firmware-image -if [ "$ARCH" == "um" ] ; then +if [ "$ARCH" = "um" ] ; then packagename=user-mode-linux-$version fi # Setup the directory structure rm -rf "$tmpdir" "$fwdir" -mkdir -p "$tmpdir/DEBIAN" "$tmpdir/lib" "$tmpdir/boot" -mkdir -p "$fwdir/DEBIAN" "$fwdir/lib" -if [ "$ARCH" == "um" ] ; then - mkdir -p "$tmpdir/usr/lib/uml/modules/$version" "$tmpdir/usr/share/doc/$packagename" "$tmpdir/usr/bin" +mkdir -p "$tmpdir/DEBIAN" "$tmpdir/lib" "$tmpdir/boot" "$tmpdir/usr/share/doc/$packagename" +mkdir -p "$fwdir/DEBIAN" "$fwdir/lib" "$fwdir/usr/share/doc/$fwpackagename" +if [ "$ARCH" = "um" ] ; then + mkdir -p "$tmpdir/usr/lib/uml/modules/$version" "$tmpdir/usr/bin" fi # Build and install the kernel -if [ "$ARCH" == "um" ] ; then +if [ "$ARCH" = "um" ] ; then $MAKE linux cp System.map "$tmpdir/usr/lib/uml/modules/$version/System.map" cp .config "$tmpdir/usr/share/doc/$packagename/config" @@ -41,53 +63,100 @@ if [ "$ARCH" == "um" ] ; then else cp System.map "$tmpdir/boot/System.map-$version" cp .config "$tmpdir/boot/config-$version" - cp $KBUILD_IMAGE "$tmpdir/boot/vmlinuz-$version" + # Not all arches include the boot path in KBUILD_IMAGE + if ! cp $KBUILD_IMAGE "$tmpdir/boot/vmlinuz-$version"; then + cp arch/$ARCH/boot/$KBUILD_IMAGE "$tmpdir/boot/vmlinuz-$version" + fi fi if grep -q '^CONFIG_MODULES=y' .config ; then INSTALL_MOD_PATH="$tmpdir" make KBUILD_SRC= modules_install - if [ "$ARCH" == "um" ] ; then + if [ "$ARCH" = "um" ] ; then mv "$tmpdir/lib/modules/$version"/* "$tmpdir/usr/lib/uml/modules/$version/" rmdir "$tmpdir/lib/modules/$version" fi fi # Install the maintainer scripts +# Note: hook scripts under /etc/kernel are also executed by official Debian +# kernel packages, as well as kernel packages built using make-kpkg +debhookdir=${KDEB_HOOKDIR:-/etc/kernel} for script in postinst postrm preinst prerm ; do - mkdir -p "$tmpdir/etc/kernel/$script.d" + mkdir -p "$tmpdir$debhookdir/$script.d" cat <<EOF > "$tmpdir/DEBIAN/$script" #!/bin/sh set -e -test -d /etc/kernel/$script.d && run-parts --arg="$version" /etc/kernel/$script.d +# Pass maintainer script parameters to hook scripts +export DEB_MAINT_PARAMS="\$@" + +test -d $debhookdir/$script.d && run-parts --arg="$version" $debhookdir/$script.d exit 0 EOF chmod 755 "$tmpdir/DEBIAN/$script" done -name="Kernel Compiler <$(id -nu)@$(hostname -f)>" +# Try to determine maintainer and email values +if [ -n "$DEBEMAIL" ]; then + email=$DEBEMAIL +elif [ -n "$EMAIL" ]; then + email=$EMAIL +else + email=$(id -nu)@$(hostname -f) +fi +if [ -n "$DEBFULLNAME" ]; then + name=$DEBFULLNAME +elif [ -n "$NAME" ]; then + name=$NAME +else + name="Anonymous" +fi +maintainer="$name <$email>" + # Generate a simple changelog template cat <<EOF > debian/changelog -linux ($version-$revision) unstable; urgency=low +linux-upstream ($packageversion) unstable; urgency=low - * A standard release + * Custom built Linux kernel. - -- $name $(date -R) + -- $maintainer $(date -R) EOF -# Generate a control file -if [ "$ARCH" == "um" ]; then +# Generate copyright file +cat <<EOF > debian/copyright +This is a packacked upstream version of the Linux kernel. + +The sources may be found at most Linux ftp sites, including: +ftp://ftp.kernel.org/pub/linux/kernel +Copyright: 1991 - 2009 Linus Torvalds and others. + +The git repository for mainline kernel development is at: +git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 dated June, 1991. + +On Debian GNU/Linux systems, the complete text of the GNU General Public +License version 2 can be found in \`/usr/share/common-licenses/GPL-2'. +EOF + +# Generate a control file cat <<EOF > debian/control -Source: linux -Section: base +Source: linux-upstream +Section: admin Priority: optional -Maintainer: $name -Standards-Version: 3.6.1 +Maintainer: $maintainer +Standards-Version: 3.8.1 +EOF + +if [ "$ARCH" = "um" ]; then + cat <<EOF >> debian/control Package: $packagename -Provides: kernel-image-$version, linux-image-$version +Provides: linux-image, linux-image-2.6, linux-modules-$version Architecture: any Description: User Mode Linux kernel, version $version User-mode Linux is a port of the Linux kernel to its own system call @@ -97,30 +166,22 @@ Description: User Mode Linux kernel, version $version many other things. . This package contains the Linux kernel, modules and corresponding other - files version $version + files, version: $version. EOF else -cat <<EOF > debian/control -Source: linux -Section: base -Priority: optional -Maintainer: $name -Standards-Version: 3.6.1 + cat <<EOF >> debian/control Package: $packagename -Provides: kernel-image-$version, linux-image-$version +Provides: linux-image, linux-image-2.6, linux-modules-$version Suggests: $fwpackagename Architecture: any Description: Linux kernel, version $version This package contains the Linux kernel, modules and corresponding other - files version $version + files, version: $version. EOF -fi -# Fix some ownership and permissions -chown -R root:root "$tmpdir" -chmod -R go-w "$tmpdir" +fi # Do we have firmware? Move it out of the way and build it into a package. if [ -e "$tmpdir/lib/firmware" ]; then @@ -131,16 +192,12 @@ if [ -e "$tmpdir/lib/firmware" ]; then Package: $fwpackagename Architecture: all Description: Linux kernel firmware, version $version - This package contains firmware from the Linux kernel, version $version + This package contains firmware from the Linux kernel, version $version. EOF - dpkg-gencontrol -isp -p$fwpackagename -P"$fwdir" - dpkg --build "$fwdir" .. + create_package "$fwpackagename" "$fwdir" fi -# Perform the final magic -dpkg-gencontrol -isp -p$packagename -dpkg --build "$tmpdir" .. +create_package "$packagename" "$tmpdir" exit 0 - diff --git a/scripts/pnmtologo.c b/scripts/pnmtologo.c index 6aa2a2483f8..5c113123ed9 100644 --- a/scripts/pnmtologo.c +++ b/scripts/pnmtologo.c @@ -244,15 +244,15 @@ static void write_header(void) static void write_footer(void) { fputs("\n};\n\n", out); - fprintf(out, "struct linux_logo %s __initdata = {\n", logoname); - fprintf(out, " .type\t= %s,\n", logo_types[logo_type]); - fprintf(out, " .width\t= %d,\n", logo_width); - fprintf(out, " .height\t= %d,\n", logo_height); + fprintf(out, "const struct linux_logo %s __initconst = {\n", logoname); + fprintf(out, "\t.type\t\t= %s,\n", logo_types[logo_type]); + fprintf(out, "\t.width\t\t= %d,\n", logo_width); + fprintf(out, "\t.height\t\t= %d,\n", logo_height); if (logo_type == LINUX_LOGO_CLUT224) { - fprintf(out, " .clutsize\t= %d,\n", logo_clutsize); - fprintf(out, " .clut\t= %s_clut,\n", logoname); + fprintf(out, "\t.clutsize\t= %d,\n", logo_clutsize); + fprintf(out, "\t.clut\t\t= %s_clut,\n", logoname); } - fprintf(out, " .data\t= %s_data\n", logoname); + fprintf(out, "\t.data\t\t= %s_data\n", logoname); fputs("};\n\n", out); /* close logo file */ diff --git a/scripts/recordmcount.pl b/scripts/recordmcount.pl index 0fae7da0529..7109e2b5bc0 100755 --- a/scripts/recordmcount.pl +++ b/scripts/recordmcount.pl @@ -185,6 +185,19 @@ if ($arch eq "x86_64") { $objcopy .= " -O elf32-i386"; $cc .= " -m32"; +} elsif ($arch eq "s390" && $bits == 32) { + $mcount_regex = "^\\s*([0-9a-fA-F]+):\\s*R_390_32\\s+_mcount\$"; + $alignment = 4; + $ld .= " -m elf_s390"; + $cc .= " -m31"; + +} elsif ($arch eq "s390" && $bits == 64) { + $mcount_regex = "^\\s*([0-9a-fA-F]+):\\s*R_390_(PC|PLT)32DBL\\s+_mcount\\+0x2\$"; + $alignment = 8; + $type = ".quad"; + $ld .= " -m elf64_s390"; + $cc .= " -m64"; + } elsif ($arch eq "sh") { $alignment = 2; @@ -213,6 +226,26 @@ if ($arch eq "x86_64") { if ($is_module eq "0") { $cc .= " -mconstant-gp"; } +} elsif ($arch eq "sparc64") { + # In the objdump output there are giblets like: + # 0000000000000000 <igmp_net_exit-0x18>: + # As there's some data blobs that get emitted into the + # text section before the first instructions and the first + # real symbols. We don't want to match that, so to combat + # this we use '\w' so we'll match just plain symbol names, + # and not those that also include hex offsets inside of the + # '<>' brackets. Actually the generic function_regex setting + # could safely use this too. + $function_regex = "^([0-9a-fA-F]+)\\s+<(\\w*?)>:"; + + # Sparc64 calls '_mcount' instead of plain 'mcount'. + $mcount_regex = "^\\s*([0-9a-fA-F]+):.*\\s_mcount\$"; + + $alignment = 8; + $type = ".xword"; + $ld .= " -m elf64_sparc"; + $cc .= " -m64"; + $objcopy .= " -O elf64-sparc"; } else { die "Arch $arch is not supported with CONFIG_FTRACE_MCOUNT_RECORD"; } diff --git a/scripts/setlocalversion b/scripts/setlocalversion index 00790472f64..46989b88d73 100755 --- a/scripts/setlocalversion +++ b/scripts/setlocalversion @@ -39,8 +39,10 @@ if head=`git rev-parse --verify --short HEAD 2>/dev/null`; then printf -- '-svn%s' "`git svn find-rev $head`" fi - # Are there uncommitted changes? - git update-index --refresh --unmerged > /dev/null + # Update index only on r/w media + [ -w . ] && git update-index --refresh --unmerged > /dev/null + + # Check for uncommitted changes if git diff-index --name-only HEAD | grep -v "^scripts/package" \ | read dummy; then printf '%s' -dirty diff --git a/scripts/tracing/draw_functrace.py b/scripts/tracing/draw_functrace.py index 902f9a99262..db40fa04cd5 100644 --- a/scripts/tracing/draw_functrace.py +++ b/scripts/tracing/draw_functrace.py @@ -12,10 +12,9 @@ calls. Only the functions's names and the the call time are provided. Usage: Be sure that you have CONFIG_FUNCTION_TRACER - # mkdir /debugfs - # mount -t debug debug /debug - # echo function > /debug/tracing/current_tracer - $ cat /debug/tracing/trace_pipe > ~/raw_trace_func + # mount -t debugfs nodev /sys/kernel/debug + # echo function > /sys/kernel/debug/tracing/current_tracer + $ cat /sys/kernel/debug/tracing/trace_pipe > ~/raw_trace_func Wait some times but not too much, the script is a bit slow. Break the pipe (Ctrl + Z) $ scripts/draw_functrace.py < raw_trace_func > draw_functrace diff --git a/scripts/unifdef.c b/scripts/unifdef.c index 05a31a6c7e1..30d459fb070 100644 --- a/scripts/unifdef.c +++ b/scripts/unifdef.c @@ -678,8 +678,10 @@ eval_unary(const struct ops *ops, int *valp, const char **cpp) if (*cp == '!') { debug("eval%d !", ops - eval_ops); cp++; - if (eval_unary(ops, valp, &cp) == LT_IF) + if (eval_unary(ops, valp, &cp) == LT_IF) { + *cpp = cp; return (LT_IF); + } *valp = !*valp; } else if (*cp == '(') { cp++; @@ -700,13 +702,16 @@ eval_unary(const struct ops *ops, int *valp, const char **cpp) return (LT_IF); cp = skipcomment(cp); sym = findsym(cp); - if (sym < 0) - return (LT_IF); - *valp = (value[sym] != NULL); cp = skipsym(cp); cp = skipcomment(cp); if (*cp++ != ')') return (LT_IF); + if (sym >= 0) + *valp = (value[sym] != NULL); + else { + *cpp = cp; + return (LT_IF); + } keepthis = false; } else if (!endsym(*cp)) { debug("eval%d symbol", ops - eval_ops); @@ -741,11 +746,11 @@ eval_table(const struct ops *ops, int *valp, const char **cpp) const struct op *op; const char *cp; int val; + Linetype lhs, rhs; debug("eval%d", ops - eval_ops); cp = *cpp; - if (ops->inner(ops+1, valp, &cp) == LT_IF) - return (LT_IF); + lhs = ops->inner(ops+1, valp, &cp); for (;;) { cp = skipcomment(cp); for (op = ops->op; op->str != NULL; op++) @@ -755,14 +760,32 @@ eval_table(const struct ops *ops, int *valp, const char **cpp) break; cp += strlen(op->str); debug("eval%d %s", ops - eval_ops, op->str); - if (ops->inner(ops+1, &val, &cp) == LT_IF) - return (LT_IF); - *valp = op->fn(*valp, val); + rhs = ops->inner(ops+1, &val, &cp); + if (op->fn == op_and && (lhs == LT_FALSE || rhs == LT_FALSE)) { + debug("eval%d: and always false", ops - eval_ops); + if (lhs == LT_IF) + *valp = val; + lhs = LT_FALSE; + continue; + } + if (op->fn == op_or && (lhs == LT_TRUE || rhs == LT_TRUE)) { + debug("eval%d: or always true", ops - eval_ops); + if (lhs == LT_IF) + *valp = val; + lhs = LT_TRUE; + continue; + } + if (rhs == LT_IF) + lhs = LT_IF; + if (lhs != LT_IF) + *valp = op->fn(*valp, val); } *cpp = cp; debug("eval%d = %d", ops - eval_ops, *valp); - return (*valp ? LT_TRUE : LT_FALSE); + if (lhs != LT_IF) + lhs = (*valp ? LT_TRUE : LT_FALSE); + return lhs; } /* @@ -773,12 +796,15 @@ eval_table(const struct ops *ops, int *valp, const char **cpp) static Linetype ifeval(const char **cpp) { + const char *cp = *cpp; int ret; int val; debug("eval %s", *cpp); keepthis = killconsts ? false : true; - ret = eval_table(eval_ops, &val, cpp); + ret = eval_table(eval_ops, &val, &cp); + if (ret != LT_IF) + *cpp = cp; debug("eval = %d", val); return (keepthis ? LT_IF : ret); } diff --git a/scripts/ver_linux b/scripts/ver_linux index dbb3037f134..7de36df4eaa 100755 --- a/scripts/ver_linux +++ b/scripts/ver_linux @@ -65,7 +65,7 @@ sed -n -e '/^.*\/libc-\([^/]*\)\.so$/{s//\1/;p;q}' < /proc/self/maps ldd -v > /dev/null 2>&1 && ldd -v || ldd --version |head -n 1 | awk \ 'NR==1{print "Dynamic linker (ldd) ", $NF}' -ls -l /usr/lib/lib{g,stdc}++.so 2>/dev/null | awk -F. \ +ls -l /usr/lib/libg++.so /usr/lib/libstdc++.so 2>/dev/null | awk -F. \ '{print "Linux C++ Library " $4"."$5"."$6}' ps --version 2>&1 | grep version | awk \ |