diff options
author | Ingo Molnar <mingo@elte.hu> | 2008-10-28 11:26:12 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-10-28 11:26:12 -0400 |
commit | 7a9787e1eba95a166265e6a260cf30af04ef0a99 (patch) | |
tree | e730a4565e0318140d2fbd2f0415d18a339d7336 /scripts | |
parent | 41b9eb264c8407655db57b60b4457fe1b2ec9977 (diff) | |
parent | 0173a3265b228da319ceb9c1ec6a5682fd1b2d92 (diff) |
Merge commit 'v2.6.28-rc2' into x86/pci-ioapic-boot-irq-quirks
Diffstat (limited to 'scripts')
45 files changed, 2316 insertions, 564 deletions
diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include index d64e6badc942..982dcae7bbe2 100644 --- a/scripts/Kbuild.include +++ b/scripts/Kbuild.include | |||
@@ -105,12 +105,12 @@ as-instr = $(call try-run,\ | |||
105 | # Usage: cflags-y += $(call cc-option,-march=winchip-c6,-march=i586) | 105 | # Usage: cflags-y += $(call cc-option,-march=winchip-c6,-march=i586) |
106 | 106 | ||
107 | cc-option = $(call try-run,\ | 107 | cc-option = $(call try-run,\ |
108 | $(CC) $(KBUILD_CFLAGS) $(1) -S -xc /dev/null -o "$$TMP",$(1),$(2)) | 108 | $(CC) $(KBUILD_CFLAGS) $(1) -c -xc /dev/null -o "$$TMP",$(1),$(2)) |
109 | 109 | ||
110 | # cc-option-yn | 110 | # cc-option-yn |
111 | # Usage: flag := $(call cc-option-yn,-march=winchip-c6) | 111 | # Usage: flag := $(call cc-option-yn,-march=winchip-c6) |
112 | cc-option-yn = $(call try-run,\ | 112 | cc-option-yn = $(call try-run,\ |
113 | $(CC) $(KBUILD_CFLAGS) $(1) -S -xc /dev/null -o "$$TMP",y,n) | 113 | $(CC) $(KBUILD_CFLAGS) $(1) -c -xc /dev/null -o "$$TMP",y,n) |
114 | 114 | ||
115 | # cc-option-align | 115 | # cc-option-align |
116 | # Prefix align with either -falign or -malign | 116 | # Prefix align with either -falign or -malign |
diff --git a/scripts/Makefile b/scripts/Makefile index 1c73c5aea66b..aafdf064feef 100644 --- a/scripts/Makefile +++ b/scripts/Makefile | |||
@@ -20,6 +20,7 @@ hostprogs-y += unifdef | |||
20 | 20 | ||
21 | subdir-$(CONFIG_MODVERSIONS) += genksyms | 21 | subdir-$(CONFIG_MODVERSIONS) += genksyms |
22 | subdir-y += mod | 22 | subdir-y += mod |
23 | subdir-$(CONFIG_SECURITY_SELINUX) += selinux | ||
23 | 24 | ||
24 | # Let clean descend into subdirs | 25 | # Let clean descend into subdirs |
25 | subdir- += basic kconfig package | 26 | subdir- += basic kconfig package selinux |
diff --git a/scripts/Makefile.build b/scripts/Makefile.build index 277cfe0b7100..5ed4cbf1e0e1 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build | |||
@@ -198,10 +198,17 @@ cmd_modversions = \ | |||
198 | fi; | 198 | fi; |
199 | endif | 199 | endif |
200 | 200 | ||
201 | ifdef CONFIG_FTRACE_MCOUNT_RECORD | ||
202 | cmd_record_mcount = perl $(srctree)/scripts/recordmcount.pl \ | ||
203 | "$(ARCH)" "$(OBJDUMP)" "$(OBJCOPY)" "$(CC)" "$(LD)" "$(NM)" "$(RM)" \ | ||
204 | "$(MV)" "$(@)"; | ||
205 | endif | ||
206 | |||
201 | define rule_cc_o_c | 207 | define rule_cc_o_c |
202 | $(call echo-cmd,checksrc) $(cmd_checksrc) \ | 208 | $(call echo-cmd,checksrc) $(cmd_checksrc) \ |
203 | $(call echo-cmd,cc_o_c) $(cmd_cc_o_c); \ | 209 | $(call echo-cmd,cc_o_c) $(cmd_cc_o_c); \ |
204 | $(cmd_modversions) \ | 210 | $(cmd_modversions) \ |
211 | $(cmd_record_mcount) \ | ||
205 | scripts/basic/fixdep $(depfile) $@ '$(call make-cmd,cc_o_c)' > \ | 212 | scripts/basic/fixdep $(depfile) $@ '$(call make-cmd,cc_o_c)' > \ |
206 | $(dot-target).tmp; \ | 213 | $(dot-target).tmp; \ |
207 | rm -f $(depfile); \ | 214 | rm -f $(depfile); \ |
diff --git a/scripts/Makefile.fwinst b/scripts/Makefile.fwinst index c972c0f54ce0..6bf8e87f1dcf 100644 --- a/scripts/Makefile.fwinst +++ b/scripts/Makefile.fwinst | |||
@@ -17,14 +17,15 @@ include $(srctree)/$(obj)/Makefile | |||
17 | 17 | ||
18 | include scripts/Makefile.host | 18 | include scripts/Makefile.host |
19 | 19 | ||
20 | mod-fw := $(addprefix $(INSTALL_FW_PATH)/,$(fw-shipped-m)) | 20 | mod-fw := $(fw-shipped-m) |
21 | |||
22 | # If CONFIG_FIRMWARE_IN_KERNEL isn't set, then install the | 21 | # If CONFIG_FIRMWARE_IN_KERNEL isn't set, then install the |
23 | # firmware for in-kernel drivers too. | 22 | # firmware for in-kernel drivers too. |
24 | ifndef CONFIG_FIRMWARE_IN_KERNEL | 23 | ifndef CONFIG_FIRMWARE_IN_KERNEL |
25 | mod-fw += $(addprefix $(INSTALL_FW_PATH)/,$(fw-shipped-y)) | 24 | mod-fw += $(fw-shipped-y) |
26 | endif | 25 | endif |
27 | 26 | ||
27 | installed-mod-fw := $(addprefix $(INSTALL_FW_PATH)/,$(mod-fw)) | ||
28 | |||
28 | installed-fw := $(addprefix $(INSTALL_FW_PATH)/,$(fw-shipped-all)) | 29 | installed-fw := $(addprefix $(INSTALL_FW_PATH)/,$(fw-shipped-all)) |
29 | installed-fw-dirs := $(sort $(dir $(installed-fw))) $(INSTALL_FW_PATH)/. | 30 | installed-fw-dirs := $(sort $(dir $(installed-fw))) $(INSTALL_FW_PATH)/. |
30 | 31 | ||
@@ -49,7 +50,12 @@ PHONY += __fw_install __fw_modinst FORCE | |||
49 | .PHONY: $(PHONY) | 50 | .PHONY: $(PHONY) |
50 | 51 | ||
51 | __fw_install: $(installed-fw) | 52 | __fw_install: $(installed-fw) |
52 | __fw_modinst: $(mod-fw) | 53 | |
54 | __fw_modinst: $(installed-mod-fw) | ||
55 | @: | ||
56 | |||
57 | __fw_modbuild: $(addprefix $(obj)/,$(mod-fw)) | ||
58 | @: | ||
53 | 59 | ||
54 | FORCE: | 60 | FORCE: |
55 | 61 | ||
diff --git a/scripts/Makefile.headersinst b/scripts/Makefile.headersinst index 53dae3eb3d1f..612dc13ddd85 100644 --- a/scripts/Makefile.headersinst +++ b/scripts/Makefile.headersinst | |||
@@ -1,194 +1,98 @@ | |||
1 | # ========================================================================== | 1 | # ========================================================================== |
2 | # Installing headers | 2 | # Installing headers |
3 | # | 3 | # |
4 | # header-y files will be installed verbatim | 4 | # header-y - list files to be installed. They are preprocessed |
5 | # unifdef-y are the files where unifdef will be run before installing files | 5 | # to remove __KERNEL__ section of the file |
6 | # objhdr-y are generated files that will be installed verbatim | 6 | # unifdef-y - Same as header-y. Obsolete |
7 | # objhdr-y - Same as header-y but for generated files | ||
7 | # | 8 | # |
8 | # ========================================================================== | 9 | # ========================================================================== |
9 | 10 | ||
10 | UNIFDEF := scripts/unifdef -U__KERNEL__ | 11 | # called may set destination dir (when installing to asm/) |
11 | |||
12 | # Eliminate the contents of (and inclusions of) compiler.h | ||
13 | HDRSED := sed -e "s/ inline / __inline__ /g" \ | ||
14 | -e "s/[[:space:]]__user[[:space:]]\{1,\}/ /g" \ | ||
15 | -e "s/(__user[[:space:]]\{1,\}/ (/g" \ | ||
16 | -e "s/[[:space:]]__force[[:space:]]\{1,\}/ /g" \ | ||
17 | -e "s/(__force[[:space:]]\{1,\}/ (/g" \ | ||
18 | -e "s/[[:space:]]__iomem[[:space:]]\{1,\}/ /g" \ | ||
19 | -e "s/(__iomem[[:space:]]\{1,\}/ (/g" \ | ||
20 | -e "s/[[:space:]]__attribute_const__[[:space:]]\{1,\}/\ /g" \ | ||
21 | -e "s/[[:space:]]__attribute_const__$$//" \ | ||
22 | -e "/^\#include <linux\/compiler.h>/d" | ||
23 | |||
24 | _dst := $(if $(dst),$(dst),$(obj)) | 12 | _dst := $(if $(dst),$(dst),$(obj)) |
25 | 13 | ||
26 | ifeq (,$(patsubst include/asm/%,,$(obj)/)) | 14 | kbuild-file := $(srctree)/$(obj)/Kbuild |
27 | # For producing the generated stuff in include/asm for biarch builds, include | 15 | include $(kbuild-file) |
28 | # both sets of Kbuild files; we'll generate anything which is mentioned in | ||
29 | # _either_ arch, and recurse into subdirectories which are mentioned in either | ||
30 | # arch. Since some directories may exist in one but not the other, we must | ||
31 | # use $(wildcard...). | ||
32 | GENASM := 1 | ||
33 | archasm := $(subst include/asm,asm-$(ARCH),$(obj)) | ||
34 | altarchasm := $(subst include/asm,asm-$(ALTARCH),$(obj)) | ||
35 | KBUILDFILES := $(wildcard $(srctree)/include/$(archasm)/Kbuild $(srctree)/include/$(altarchasm)/Kbuild) | ||
36 | else | ||
37 | KBUILDFILES := $(srctree)/$(obj)/Kbuild | ||
38 | endif | ||
39 | 16 | ||
40 | include $(KBUILDFILES) | 17 | include scripts/Kbuild.include |
41 | 18 | ||
42 | include scripts/Kbuild.include | 19 | install := $(INSTALL_HDR_PATH)/$(_dst) |
43 | 20 | ||
44 | # If this is include/asm-$(ARCH) and there's no $(ALTARCH), then | 21 | header-y := $(sort $(header-y) $(unifdef-y)) |
45 | # override $(_dst) so that we install to include/asm directly. | 22 | subdirs := $(patsubst %/,%,$(filter %/, $(header-y))) |
46 | # Unless $(BIASMDIR) is set, in which case we're probably doing | 23 | header-y := $(filter-out %/, $(header-y)) |
47 | # a 'headers_install_all' build and we should keep the -$(ARCH) | ||
48 | # in the directory name. | ||
49 | ifeq ($(obj)$(ALTARCH),include/asm-$(ARCH)$(BIASMDIR)) | ||
50 | _dst := include/asm | ||
51 | endif | ||
52 | 24 | ||
53 | header-y := $(sort $(header-y)) | 25 | # files used to track state of install/check |
54 | unifdef-y := $(sort $(unifdef-y)) | 26 | install-file := $(install)/.install |
55 | subdir-y := $(patsubst %/,%,$(filter %/, $(header-y))) | 27 | check-file := $(install)/.check |
56 | header-y := $(filter-out %/, $(header-y)) | ||
57 | header-y := $(filter-out $(unifdef-y),$(header-y)) | ||
58 | 28 | ||
59 | # stamp files for header checks | 29 | # all headers files for this dir |
60 | check-y := $(patsubst %,.check.%,$(header-y) $(unifdef-y) $(objhdr-y)) | 30 | all-files := $(header-y) $(objhdr-y) |
31 | input-files := $(addprefix $(srctree)/$(obj)/,$(header-y)) \ | ||
32 | $(addprefix $(objtree)/$(obj)/,$(objhdr-y)) | ||
33 | output-files := $(addprefix $(install)/, $(all-files)) | ||
61 | 34 | ||
62 | # Work out what needs to be removed | 35 | # Work out what needs to be removed |
63 | oldheaders := $(patsubst $(INSTALL_HDR_PATH)/$(_dst)/%,%,$(wildcard $(INSTALL_HDR_PATH)/$(_dst)/*.h)) | 36 | oldheaders := $(patsubst $(install)/%,%,$(wildcard $(install)/*.h)) |
64 | unwanted := $(filter-out $(header-y) $(unifdef-y) $(objhdr-y),$(oldheaders)) | 37 | unwanted := $(filter-out $(all-files),$(oldheaders)) |
65 | 38 | ||
66 | oldcheckstamps := $(patsubst $(INSTALL_HDR_PATH)/$(_dst)/%,%,$(wildcard $(INSTALL_HDR_PATH)/$(_dst)/.check.*.h)) | 39 | # Prefix unwanted with full paths to $(INSTALL_HDR_PATH) |
67 | unwanted += $(filter-out $(check-y),$(oldcheckstamps)) | 40 | unwanted-file := $(addprefix $(install)/, $(unwanted)) |
68 | 41 | ||
69 | # Prefix them all with full paths to $(INSTALL_HDR_PATH) | 42 | printdir = $(patsubst $(INSTALL_HDR_PATH)/%/,%,$(dir $@)) |
70 | header-y := $(patsubst %,$(INSTALL_HDR_PATH)/$(_dst)/%,$(header-y)) | ||
71 | unifdef-y := $(patsubst %,$(INSTALL_HDR_PATH)/$(_dst)/%,$(unifdef-y)) | ||
72 | objhdr-y := $(patsubst %,$(INSTALL_HDR_PATH)/$(_dst)/%,$(objhdr-y)) | ||
73 | check-y := $(patsubst %,$(INSTALL_HDR_PATH)/$(_dst)/%,$(check-y)) | ||
74 | 43 | ||
44 | quiet_cmd_install = INSTALL $(printdir) ($(words $(all-files))\ | ||
45 | file$(if $(word 2, $(all-files)),s)) | ||
46 | cmd_install = \ | ||
47 | $(PERL) $< $(srctree)/$(obj) $(install) $(SRCARCH) $(header-y); \ | ||
48 | $(PERL) $< $(objtree)/$(obj) $(install) $(SRCARCH) $(objhdr-y); \ | ||
49 | touch $@ | ||
75 | 50 | ||
76 | ifdef ALTARCH | 51 | quiet_cmd_remove = REMOVE $(unwanted) |
77 | ifeq ($(obj),include/asm-$(ARCH)) | 52 | cmd_remove = rm -f $(unwanted-file) |
78 | altarch-y := altarch-dir | ||
79 | endif | ||
80 | endif | ||
81 | 53 | ||
82 | # Make the definitions visible for recursive make invocations | 54 | quiet_cmd_check = CHECK $(printdir) ($(words $(all-files)) files) |
83 | export ALTARCH | 55 | cmd_check = $(PERL) $< $(INSTALL_HDR_PATH)/include $(SRCARCH) \ |
84 | export ARCHDEF | 56 | $(addprefix $(install)/, $(all-files)); \ |
85 | export ALTARCHDEF | 57 | touch $@ |
86 | |||
87 | quiet_cmd_o_hdr_install = INSTALL $(patsubst $(INSTALL_HDR_PATH)/%,%,$@) | ||
88 | cmd_o_hdr_install = cp $(patsubst $(INSTALL_HDR_PATH)/$(_dst)/%,$(objtree)/$(obj)/%,$@) \ | ||
89 | $(INSTALL_HDR_PATH)/$(_dst) | ||
90 | |||
91 | quiet_cmd_headers_install = INSTALL $(patsubst $(INSTALL_HDR_PATH)/%,%,$@) | ||
92 | cmd_headers_install = $(HDRSED) $(patsubst $(INSTALL_HDR_PATH)/$(_dst)/%,$(srctree)/$(obj)/%,$@) \ | ||
93 | > $@ | ||
94 | |||
95 | quiet_cmd_unifdef = UNIFDEF $(patsubst $(INSTALL_HDR_PATH)/%,%,$@) | ||
96 | cmd_unifdef = $(UNIFDEF) $(patsubst $(INSTALL_HDR_PATH)/$(_dst)/%,$(srctree)/$(obj)/%,$@) \ | ||
97 | | $(HDRSED) > $@ || : | ||
98 | |||
99 | quiet_cmd_check = CHECK $(patsubst $(INSTALL_HDR_PATH)/$(_dst)/.check.%,$(_dst)/%,$@) | ||
100 | cmd_check = $(CONFIG_SHELL) $(srctree)/scripts/hdrcheck.sh \ | ||
101 | $(INSTALL_HDR_PATH)/include $(subst /.check.,/,$@) $@ | ||
102 | |||
103 | quiet_cmd_remove = REMOVE $(_dst)/$@ | ||
104 | cmd_remove = rm -f $(INSTALL_HDR_PATH)/$(_dst)/$@ | ||
105 | |||
106 | quiet_cmd_mkdir = MKDIR $(patsubst $(INSTALL_HDR_PATH)/%,%,$@) | ||
107 | cmd_mkdir = mkdir -p $@ | ||
108 | |||
109 | quiet_cmd_gen = GEN $(patsubst $(INSTALL_HDR_PATH)/%,%,$@) | ||
110 | cmd_gen = \ | ||
111 | FNAME=$(patsubst $(INSTALL_HDR_PATH)/$(_dst)/%,%,$@); \ | ||
112 | STUBDEF=__ASM_STUB_`echo $$FNAME | tr a-z.- A-Z__`; \ | ||
113 | (echo "/* File autogenerated by 'make headers_install' */" ; \ | ||
114 | echo "\#ifndef $$STUBDEF" ; \ | ||
115 | echo "\#define $$STUBDEF" ; \ | ||
116 | echo "\# if $(ARCHDEF)" ; \ | ||
117 | if [ -r $(subst /$(_dst)/,/include/$(archasm)/,$@) ]; then \ | ||
118 | echo "\# include <$(archasm)/$$FNAME>" ; \ | ||
119 | else \ | ||
120 | echo "\# error $(archasm)/$$FNAME does not exist in" \ | ||
121 | "the $(ARCH) architecture" ; \ | ||
122 | fi ; \ | ||
123 | echo "\# elif $(ALTARCHDEF)" ; \ | ||
124 | if [ -r $(subst /$(_dst)/,/include/$(altarchasm)/,$@) ]; then \ | ||
125 | echo "\# include <$(altarchasm)/$$FNAME>" ; \ | ||
126 | else \ | ||
127 | echo "\# error $(altarchasm)/$$FNAME does not exist in" \ | ||
128 | "the $(ALTARCH) architecture" ; \ | ||
129 | fi ; \ | ||
130 | echo "\# else" ; \ | ||
131 | echo "\# warning This machine appears to be" \ | ||
132 | "neither $(ARCH) nor $(ALTARCH)." ; \ | ||
133 | echo "\# endif" ; \ | ||
134 | echo "\#endif /* $$STUBDEF */" ; \ | ||
135 | ) > $@ | ||
136 | |||
137 | .PHONY: __headersinst __headerscheck | ||
138 | |||
139 | ifdef HDRCHECK | ||
140 | __headerscheck: $(subdir-y) $(check-y) | ||
141 | @true | ||
142 | |||
143 | $(check-y) : $(INSTALL_HDR_PATH)/$(_dst)/.check.%.h : $(INSTALL_HDR_PATH)/$(_dst)/%.h | ||
144 | $(call cmd,check) | ||
145 | |||
146 | # Other dependencies for $(check-y) | ||
147 | include /dev/null $(wildcard $(check-y)) | ||
148 | |||
149 | # ... but leave $(check-y) as .PHONY for now until those deps are actually correct. | ||
150 | .PHONY: $(check-y) | ||
151 | 58 | ||
152 | else | 59 | PHONY += __headersinst __headerscheck |
153 | # Rules for installing headers | ||
154 | __headersinst: $(subdir-y) $(header-y) $(unifdef-y) $(altarch-y) $(objhdr-y) | ||
155 | @true | ||
156 | 60 | ||
157 | $(objhdr-y) $(subdir-y) $(header-y) $(unifdef-y): | $(INSTALL_HDR_PATH)/$(_dst) $(unwanted) | 61 | ifndef HDRCHECK |
158 | 62 | # Rules for installing headers | |
159 | $(INSTALL_HDR_PATH)/$(_dst): | 63 | __headersinst: $(subdirs) $(install-file) |
160 | $(call cmd,mkdir) | 64 | @: |
161 | |||
162 | .PHONY: $(unwanted) | ||
163 | $(unwanted): | ||
164 | $(call cmd,remove) | ||
165 | 65 | ||
166 | ifdef GENASM | 66 | targets += $(install-file) |
167 | $(objhdr-y) $(header-y) $(unifdef-y): $(KBUILDFILES) | 67 | $(install-file): scripts/headers_install.pl $(input-files) FORCE |
168 | $(call cmd,gen) | 68 | $(if $(unwanted),$(call cmd,remove),) |
69 | $(if $(wildcard $(dir $@)),,$(shell mkdir -p $(dir $@))) | ||
70 | $(call if_changed,install) | ||
169 | 71 | ||
170 | else | 72 | else |
171 | $(objhdr-y) : $(INSTALL_HDR_PATH)/$(_dst)/%.h: $(objtree)/$(obj)/%.h $(KBUILDFILES) | 73 | __headerscheck: $(subdirs) $(check-file) |
172 | $(call cmd,o_hdr_install) | 74 | @: |
173 | 75 | ||
174 | $(header-y) : $(INSTALL_HDR_PATH)/$(_dst)/%.h: $(srctree)/$(obj)/%.h $(KBUILDFILES) | 76 | targets += $(check-file) |
175 | $(call cmd,headers_install) | 77 | $(check-file): scripts/headers_check.pl $(output-files) FORCE |
78 | $(call if_changed,check) | ||
176 | 79 | ||
177 | $(unifdef-y) : $(INSTALL_HDR_PATH)/$(_dst)/%.h: $(srctree)/$(obj)/%.h $(KBUILDFILES) | ||
178 | $(call cmd,unifdef) | ||
179 | endif | ||
180 | endif | 80 | endif |
181 | 81 | ||
182 | hdrinst := -rR -f $(srctree)/scripts/Makefile.headersinst obj | 82 | # Recursion |
83 | hdr-inst := -rR -f $(srctree)/scripts/Makefile.headersinst obj | ||
84 | .PHONY: $(subdirs) | ||
85 | $(subdirs): | ||
86 | $(Q)$(MAKE) $(hdr-inst)=$(obj)/$@ dst=$(_dst)/$@ | ||
183 | 87 | ||
184 | .PHONY: altarch-dir | 88 | targets := $(wildcard $(sort $(targets))) |
185 | # All the files in the normal arch dir must be created first, since we test | 89 | cmd_files := $(wildcard \ |
186 | # for their existence. | 90 | $(foreach f,$(targets),$(dir $(f)).$(notdir $(f)).cmd)) |
187 | altarch-dir: $(subdir-y) $(header-y) $(unifdef-y) $(objhdr-y) | ||
188 | $(Q)$(MAKE) $(hdrinst)=include/asm-$(ALTARCH) dst=include/asm-$(ALTARCH) | ||
189 | $(Q)$(MAKE) $(hdrinst)=include/asm dst=include/asm$(BIASMDIR) | ||
190 | 91 | ||
191 | # Recursion | 92 | ifneq ($(cmd_files),) |
192 | .PHONY: $(subdir-y) | 93 | include $(cmd_files) |
193 | $(subdir-y): | 94 | endif |
194 | $(Q)$(MAKE) $(hdrinst)=$(obj)/$@ dst=$(_dst)/$@ rel=../$(rel) | 95 | |
96 | .PHONY: $(PHONY) | ||
97 | PHONY += FORCE | ||
98 | FORCE: ; | ||
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib index ea48b82a3707..b4ca38a21158 100644 --- a/scripts/Makefile.lib +++ b/scripts/Makefile.lib | |||
@@ -96,6 +96,14 @@ basename_flags = -D"KBUILD_BASENAME=KBUILD_STR($(call name-fix,$(basetarget)))" | |||
96 | modname_flags = $(if $(filter 1,$(words $(modname))),\ | 96 | modname_flags = $(if $(filter 1,$(words $(modname))),\ |
97 | -D"KBUILD_MODNAME=KBUILD_STR($(call name-fix,$(modname)))") | 97 | -D"KBUILD_MODNAME=KBUILD_STR($(call name-fix,$(modname)))") |
98 | 98 | ||
99 | #hash values | ||
100 | ifdef CONFIG_DYNAMIC_PRINTK_DEBUG | ||
101 | debug_flags = -D"DEBUG_HASH=$(shell ./scripts/basic/hash djb2 $(@D)$(modname))"\ | ||
102 | -D"DEBUG_HASH2=$(shell ./scripts/basic/hash r5 $(@D)$(modname))" | ||
103 | else | ||
104 | debug_flags = | ||
105 | endif | ||
106 | |||
99 | orig_c_flags = $(KBUILD_CFLAGS) $(ccflags-y) $(CFLAGS_$(basetarget).o) | 107 | orig_c_flags = $(KBUILD_CFLAGS) $(ccflags-y) $(CFLAGS_$(basetarget).o) |
100 | _c_flags = $(filter-out $(CFLAGS_REMOVE_$(basetarget).o), $(orig_c_flags)) | 108 | _c_flags = $(filter-out $(CFLAGS_REMOVE_$(basetarget).o), $(orig_c_flags)) |
101 | _a_flags = $(KBUILD_AFLAGS) $(asflags-y) $(AFLAGS_$(basetarget).o) | 109 | _a_flags = $(KBUILD_AFLAGS) $(asflags-y) $(AFLAGS_$(basetarget).o) |
@@ -121,7 +129,8 @@ endif | |||
121 | 129 | ||
122 | c_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(KBUILD_CPPFLAGS) \ | 130 | c_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(KBUILD_CPPFLAGS) \ |
123 | $(__c_flags) $(modkern_cflags) \ | 131 | $(__c_flags) $(modkern_cflags) \ |
124 | -D"KBUILD_STR(s)=\#s" $(basename_flags) $(modname_flags) | 132 | -D"KBUILD_STR(s)=\#s" $(basename_flags) $(modname_flags) \ |
133 | $(debug_flags) | ||
125 | 134 | ||
126 | a_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(KBUILD_CPPFLAGS) \ | 135 | a_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(KBUILD_CPPFLAGS) \ |
127 | $(__a_flags) $(modkern_aflags) | 136 | $(__a_flags) $(modkern_aflags) |
diff --git a/scripts/Makefile.modpost b/scripts/Makefile.modpost index 17092d6c7db3..9ee9783aea57 100644 --- a/scripts/Makefile.modpost +++ b/scripts/Makefile.modpost | |||
@@ -101,6 +101,7 @@ quiet_cmd_kernel-mod = MODPOST $@ | |||
101 | cmd_kernel-mod = $(modpost) $@ | 101 | cmd_kernel-mod = $(modpost) $@ |
102 | 102 | ||
103 | vmlinux.o: FORCE | 103 | vmlinux.o: FORCE |
104 | @rm -fr $(kernelmarkersfile) | ||
104 | $(call cmd,kernel-mod) | 105 | $(call cmd,kernel-mod) |
105 | 106 | ||
106 | # Declare generated files as targets for modpost | 107 | # Declare generated files as targets for modpost |
diff --git a/scripts/basic/.gitignore b/scripts/basic/.gitignore index 7304e19782c7..bf8b199ec598 100644 --- a/scripts/basic/.gitignore +++ b/scripts/basic/.gitignore | |||
@@ -1,3 +1,3 @@ | |||
1 | hash | ||
1 | fixdep | 2 | fixdep |
2 | split-include | ||
3 | docproc | 3 | docproc |
diff --git a/scripts/basic/Makefile b/scripts/basic/Makefile index 4c324a1f1e0e..09559951df12 100644 --- a/scripts/basic/Makefile +++ b/scripts/basic/Makefile | |||
@@ -9,7 +9,7 @@ | |||
9 | # fixdep: Used to generate dependency information during build process | 9 | # fixdep: Used to generate dependency information during build process |
10 | # docproc: Used in Documentation/DocBook | 10 | # docproc: Used in Documentation/DocBook |
11 | 11 | ||
12 | hostprogs-y := fixdep docproc | 12 | hostprogs-y := fixdep docproc hash |
13 | always := $(hostprogs-y) | 13 | always := $(hostprogs-y) |
14 | 14 | ||
15 | # fixdep is needed to compile other host programs | 15 | # fixdep is needed to compile other host programs |
diff --git a/scripts/basic/hash.c b/scripts/basic/hash.c new file mode 100644 index 000000000000..3299ad7fc8c0 --- /dev/null +++ b/scripts/basic/hash.c | |||
@@ -0,0 +1,64 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2008 Red Hat, Inc., Jason Baron <jbaron@redhat.com> | ||
3 | * | ||
4 | */ | ||
5 | |||
6 | #include <stdio.h> | ||
7 | #include <stdlib.h> | ||
8 | #include <string.h> | ||
9 | |||
10 | #define DYNAMIC_DEBUG_HASH_BITS 6 | ||
11 | |||
12 | static const char *program; | ||
13 | |||
14 | static void usage(void) | ||
15 | { | ||
16 | printf("Usage: %s <djb2|r5> <modname>\n", program); | ||
17 | exit(1); | ||
18 | } | ||
19 | |||
20 | /* djb2 hashing algorithm by Dan Bernstein. From: | ||
21 | * http://www.cse.yorku.ca/~oz/hash.html | ||
22 | */ | ||
23 | |||
24 | unsigned int djb2_hash(char *str) | ||
25 | { | ||
26 | unsigned long hash = 5381; | ||
27 | int c; | ||
28 | |||
29 | c = *str; | ||
30 | while (c) { | ||
31 | hash = ((hash << 5) + hash) + c; | ||
32 | c = *++str; | ||
33 | } | ||
34 | return (unsigned int)(hash & ((1 << DYNAMIC_DEBUG_HASH_BITS) - 1)); | ||
35 | } | ||
36 | |||
37 | unsigned int r5_hash(char *str) | ||
38 | { | ||
39 | unsigned long hash = 0; | ||
40 | int c; | ||
41 | |||
42 | c = *str; | ||
43 | while (c) { | ||
44 | hash = (hash + (c << 4) + (c >> 4)) * 11; | ||
45 | c = *++str; | ||
46 | } | ||
47 | return (unsigned int)(hash & ((1 << DYNAMIC_DEBUG_HASH_BITS) - 1)); | ||
48 | } | ||
49 | |||
50 | int main(int argc, char *argv[]) | ||
51 | { | ||
52 | program = argv[0]; | ||
53 | |||
54 | if (argc != 3) | ||
55 | usage(); | ||
56 | if (!strcmp(argv[1], "djb2")) | ||
57 | printf("%d\n", djb2_hash(argv[2])); | ||
58 | else if (!strcmp(argv[1], "r5")) | ||
59 | printf("%d\n", r5_hash(argv[2])); | ||
60 | else | ||
61 | usage(); | ||
62 | exit(0); | ||
63 | } | ||
64 | |||
diff --git a/scripts/bootgraph.pl b/scripts/bootgraph.pl new file mode 100644 index 000000000000..5e7316e5aa39 --- /dev/null +++ b/scripts/bootgraph.pl | |||
@@ -0,0 +1,149 @@ | |||
1 | #!/usr/bin/perl | ||
2 | |||
3 | # Copyright 2008, Intel Corporation | ||
4 | # | ||
5 | # This file is part of the Linux kernel | ||
6 | # | ||
7 | # This program file is free software; you can redistribute it and/or modify it | ||
8 | # under the terms of the GNU General Public License as published by the | ||
9 | # Free Software Foundation; version 2 of the License. | ||
10 | # | ||
11 | # This program is distributed in the hope that it will be useful, but WITHOUT | ||
12 | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
13 | # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
14 | # for more details. | ||
15 | # | ||
16 | # You should have received a copy of the GNU General Public License | ||
17 | # along with this program in a file named COPYING; if not, write to the | ||
18 | # Free Software Foundation, Inc., | ||
19 | # 51 Franklin Street, Fifth Floor, | ||
20 | # Boston, MA 02110-1301 USA | ||
21 | # | ||
22 | # Authors: | ||
23 | # Arjan van de Ven <arjan@linux.intel.com> | ||
24 | |||
25 | |||
26 | # | ||
27 | # This script turns a dmesg output into a SVG graphic that shows which | ||
28 | # functions take how much time. You can view SVG graphics with various | ||
29 | # programs, including Inkscape, The Gimp and Firefox. | ||
30 | # | ||
31 | # | ||
32 | # For this script to work, the kernel needs to be compiled with the | ||
33 | # CONFIG_PRINTK_TIME configuration option enabled, and with | ||
34 | # "initcall_debug" passed on the kernel command line. | ||
35 | # | ||
36 | # usage: | ||
37 | # dmesg | perl scripts/bootgraph.pl > output.svg | ||
38 | # | ||
39 | |||
40 | my %start, %end; | ||
41 | my $done = 0; | ||
42 | my $maxtime = 0; | ||
43 | my $firsttime = 100; | ||
44 | my $count = 0; | ||
45 | my %pids; | ||
46 | |||
47 | while (<>) { | ||
48 | my $line = $_; | ||
49 | if ($line =~ /([0-9\.]+)\] calling ([a-zA-Z0-9\_]+)\+/) { | ||
50 | my $func = $2; | ||
51 | if ($done == 0) { | ||
52 | $start{$func} = $1; | ||
53 | if ($1 < $firsttime) { | ||
54 | $firsttime = $1; | ||
55 | } | ||
56 | } | ||
57 | if ($line =~ /\@ ([0-9]+)/) { | ||
58 | $pids{$func} = $1; | ||
59 | } | ||
60 | $count = $count + 1; | ||
61 | } | ||
62 | |||
63 | if ($line =~ /([0-9\.]+)\] initcall ([a-zA-Z0-9\_]+)\+.*returned/) { | ||
64 | if ($done == 0) { | ||
65 | $end{$2} = $1; | ||
66 | $maxtime = $1; | ||
67 | } | ||
68 | } | ||
69 | if ($line =~ /Write protecting the/) { | ||
70 | $done = 1; | ||
71 | } | ||
72 | if ($line =~ /Freeing unused kernel memory/) { | ||
73 | $done = 1; | ||
74 | } | ||
75 | } | ||
76 | |||
77 | if ($count == 0) { | ||
78 | print "No data found in the dmesg. Make sure that 'printk.time=1' and\n"; | ||
79 | print "'initcall_debug' are passed on the kernel command line.\n\n"; | ||
80 | print "Usage: \n"; | ||
81 | print " dmesg | perl scripts/bootgraph.pl > output.svg\n\n"; | ||
82 | exit; | ||
83 | } | ||
84 | |||
85 | print "<?xml version=\"1.0\" standalone=\"no\"?> \n"; | ||
86 | print "<svg width=\"1000\" height=\"100%\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\">\n"; | ||
87 | |||
88 | my @styles; | ||
89 | |||
90 | $styles[0] = "fill:rgb(0,0,255);fill-opacity:0.5;stroke-width:1;stroke:rgb(0,0,0)"; | ||
91 | $styles[1] = "fill:rgb(0,255,0);fill-opacity:0.5;stroke-width:1;stroke:rgb(0,0,0)"; | ||
92 | $styles[2] = "fill:rgb(255,0,20);fill-opacity:0.5;stroke-width:1;stroke:rgb(0,0,0)"; | ||
93 | $styles[3] = "fill:rgb(255,255,20);fill-opacity:0.5;stroke-width:1;stroke:rgb(0,0,0)"; | ||
94 | $styles[4] = "fill:rgb(255,0,255);fill-opacity:0.5;stroke-width:1;stroke:rgb(0,0,0)"; | ||
95 | $styles[5] = "fill:rgb(0,255,255);fill-opacity:0.5;stroke-width:1;stroke:rgb(0,0,0)"; | ||
96 | $styles[6] = "fill:rgb(0,128,255);fill-opacity:0.5;stroke-width:1;stroke:rgb(0,0,0)"; | ||
97 | $styles[7] = "fill:rgb(0,255,128);fill-opacity:0.5;stroke-width:1;stroke:rgb(0,0,0)"; | ||
98 | $styles[8] = "fill:rgb(255,0,128);fill-opacity:0.5;stroke-width:1;stroke:rgb(0,0,0)"; | ||
99 | $styles[9] = "fill:rgb(255,255,128);fill-opacity:0.5;stroke-width:1;stroke:rgb(0,0,0)"; | ||
100 | $styles[10] = "fill:rgb(255,128,255);fill-opacity:0.5;stroke-width:1;stroke:rgb(0,0,0)"; | ||
101 | $styles[11] = "fill:rgb(128,255,255);fill-opacity:0.5;stroke-width:1;stroke:rgb(0,0,0)"; | ||
102 | |||
103 | my $mult = 950.0 / ($maxtime - $firsttime); | ||
104 | my $threshold = ($maxtime - $firsttime) / 60.0; | ||
105 | my $stylecounter = 0; | ||
106 | my %rows; | ||
107 | my $rowscount = 1; | ||
108 | while (($key,$value) = each %start) { | ||
109 | my $duration = $end{$key} - $start{$key}; | ||
110 | |||
111 | if ($duration >= $threshold) { | ||
112 | my $s, $s2, $e, $y; | ||
113 | $pid = $pids{$key}; | ||
114 | |||
115 | if (!defined($rows{$pid})) { | ||
116 | $rows{$pid} = $rowscount; | ||
117 | $rowscount = $rowscount + 1; | ||
118 | } | ||
119 | $s = ($value - $firsttime) * $mult; | ||
120 | $s2 = $s + 6; | ||
121 | $e = ($end{$key} - $firsttime) * $mult; | ||
122 | $w = $e - $s; | ||
123 | |||
124 | $y = $rows{$pid} * 150; | ||
125 | $y2 = $y + 4; | ||
126 | |||
127 | $style = $styles[$stylecounter]; | ||
128 | $stylecounter = $stylecounter + 1; | ||
129 | if ($stylecounter > 11) { | ||
130 | $stylecounter = 0; | ||
131 | }; | ||
132 | |||
133 | print "<rect x=\"$s\" width=\"$w\" y=\"$y\" height=\"145\" style=\"$style\"/>\n"; | ||
134 | print "<text transform=\"translate($s2,$y2) rotate(90)\">$key</text>\n"; | ||
135 | } | ||
136 | } | ||
137 | |||
138 | |||
139 | # print the time line on top | ||
140 | my $time = $firsttime; | ||
141 | my $step = ($maxtime - $firsttime) / 15; | ||
142 | while ($time < $maxtime) { | ||
143 | my $s2 = ($time - $firsttime) * $mult; | ||
144 | my $tm = int($time * 100) / 100.0; | ||
145 | print "<text transform=\"translate($s2,89) rotate(90)\">$tm</text>\n"; | ||
146 | $time = $time + $step; | ||
147 | } | ||
148 | |||
149 | print "</svg>\n"; | ||
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 6971bf078d13..f88bb3e21cda 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl | |||
@@ -1,5 +1,5 @@ | |||
1 | #!/usr/bin/perl -w | 1 | #!/usr/bin/perl -w |
2 | # (c) 2001, Dave Jones. <davej@codemonkey.org.uk> (the file handling bit) | 2 | # (c) 2001, Dave Jones. <davej@redhat.com> (the file handling bit) |
3 | # (c) 2005, Joel Schopp <jschopp@austin.ibm.com> (the ugly bit) | 3 | # (c) 2005, Joel Schopp <jschopp@austin.ibm.com> (the ugly bit) |
4 | # (c) 2007, Andy Whitcroft <apw@uk.ibm.com> (new conditions, test suite, etc) | 4 | # (c) 2007, Andy Whitcroft <apw@uk.ibm.com> (new conditions, test suite, etc) |
5 | # Licensed under the terms of the GNU GPL License version 2 | 5 | # Licensed under the terms of the GNU GPL License version 2 |
@@ -9,7 +9,7 @@ use strict; | |||
9 | my $P = $0; | 9 | my $P = $0; |
10 | $P =~ s@.*/@@g; | 10 | $P =~ s@.*/@@g; |
11 | 11 | ||
12 | my $V = '0.19'; | 12 | my $V = '0.24'; |
13 | 13 | ||
14 | use Getopt::Long qw(:config no_auto_abbrev); | 14 | use Getopt::Long qw(:config no_auto_abbrev); |
15 | 15 | ||
@@ -17,7 +17,6 @@ my $quiet = 0; | |||
17 | my $tree = 1; | 17 | my $tree = 1; |
18 | my $chk_signoff = 1; | 18 | my $chk_signoff = 1; |
19 | my $chk_patch = 1; | 19 | my $chk_patch = 1; |
20 | my $tst_type = 0; | ||
21 | my $tst_only; | 20 | my $tst_only; |
22 | my $emacs = 0; | 21 | my $emacs = 0; |
23 | my $terse = 0; | 22 | my $terse = 0; |
@@ -44,7 +43,6 @@ GetOptions( | |||
44 | 'summary-file!' => \$summary_file, | 43 | 'summary-file!' => \$summary_file, |
45 | 44 | ||
46 | 'debug=s' => \%debug, | 45 | 'debug=s' => \%debug, |
47 | 'test-type!' => \$tst_type, | ||
48 | 'test-only=s' => \$tst_only, | 46 | 'test-only=s' => \$tst_only, |
49 | ) or exit; | 47 | ) or exit; |
50 | 48 | ||
@@ -67,6 +65,8 @@ if ($#ARGV < 0) { | |||
67 | 65 | ||
68 | my $dbg_values = 0; | 66 | my $dbg_values = 0; |
69 | my $dbg_possible = 0; | 67 | my $dbg_possible = 0; |
68 | my $dbg_type = 0; | ||
69 | my $dbg_attr = 0; | ||
70 | for my $key (keys %debug) { | 70 | for my $key (keys %debug) { |
71 | eval "\${dbg_$key} = '$debug{$key}';" | 71 | eval "\${dbg_$key} = '$debug{$key}';" |
72 | } | 72 | } |
@@ -113,7 +113,10 @@ our $Attribute = qr{ | |||
113 | const| | 113 | const| |
114 | __read_mostly| | 114 | __read_mostly| |
115 | __kprobes| | 115 | __kprobes| |
116 | __(?:mem|cpu|dev|)(?:initdata|init) | 116 | __(?:mem|cpu|dev|)(?:initdata|init)| |
117 | ____cacheline_aligned| | ||
118 | ____cacheline_aligned_in_smp| | ||
119 | ____cacheline_internodealigned_in_smp | ||
117 | }x; | 120 | }x; |
118 | our $Modifier; | 121 | our $Modifier; |
119 | our $Inline = qr{inline|__always_inline|noinline}; | 122 | our $Inline = qr{inline|__always_inline|noinline}; |
@@ -143,6 +146,11 @@ our $UTF8 = qr { | |||
143 | | \xF4[\x80-\x8F][\x80-\xBF]{2} # plane 16 | 146 | | \xF4[\x80-\x8F][\x80-\xBF]{2} # plane 16 |
144 | }x; | 147 | }x; |
145 | 148 | ||
149 | our $typeTypedefs = qr{(?x: | ||
150 | (?:__)?(?:u|s|be|le)(?:\d|\d\d)| | ||
151 | atomic_t | ||
152 | )}; | ||
153 | |||
146 | our @typeList = ( | 154 | our @typeList = ( |
147 | qr{void}, | 155 | qr{void}, |
148 | qr{(?:unsigned\s+)?char}, | 156 | qr{(?:unsigned\s+)?char}, |
@@ -156,7 +164,6 @@ our @typeList = ( | |||
156 | qr{float}, | 164 | qr{float}, |
157 | qr{double}, | 165 | qr{double}, |
158 | qr{bool}, | 166 | qr{bool}, |
159 | qr{(?:__)?(?:u|s|be|le)(?:8|16|32|64)}, | ||
160 | qr{struct\s+$Ident}, | 167 | qr{struct\s+$Ident}, |
161 | qr{union\s+$Ident}, | 168 | qr{union\s+$Ident}, |
162 | qr{enum\s+$Ident}, | 169 | qr{enum\s+$Ident}, |
@@ -169,24 +176,24 @@ our @modifierList = ( | |||
169 | ); | 176 | ); |
170 | 177 | ||
171 | sub build_types { | 178 | sub build_types { |
172 | my $mods = "(?: \n" . join("|\n ", @modifierList) . "\n)"; | 179 | my $mods = "(?x: \n" . join("|\n ", @modifierList) . "\n)"; |
173 | my $all = "(?: \n" . join("|\n ", @typeList) . "\n)"; | 180 | my $all = "(?x: \n" . join("|\n ", @typeList) . "\n)"; |
181 | $Modifier = qr{(?:$Attribute|$Sparse|$mods)}; | ||
174 | $NonptrType = qr{ | 182 | $NonptrType = qr{ |
175 | (?:const\s+)? | 183 | (?:$Modifier\s+|const\s+)* |
176 | (?:$mods\s+)? | ||
177 | (?: | 184 | (?: |
178 | (?:typeof|__typeof__)\s*\(\s*\**\s*$Ident\s*\)| | 185 | (?:typeof|__typeof__)\s*\(\s*\**\s*$Ident\s*\)| |
186 | (?:$typeTypedefs\b)| | ||
179 | (?:${all}\b) | 187 | (?:${all}\b) |
180 | ) | 188 | ) |
181 | (?:\s+$Sparse|\s+const)* | 189 | (?:\s+$Modifier|\s+const)* |
182 | }x; | 190 | }x; |
183 | $Type = qr{ | 191 | $Type = qr{ |
184 | $NonptrType | 192 | $NonptrType |
185 | (?:\s*\*+\s*const|\s*\*+|(?:\s*\[\s*\])+)? | 193 | (?:\s*\*+\s*const|\s*\*+|(?:\s*\[\s*\])+)? |
186 | (?:\s+$Inline|\s+$Sparse|\s+$Attribute|\s+$mods)* | 194 | (?:\s+$Inline|\s+$Modifier)* |
187 | }x; | 195 | }x; |
188 | $Declare = qr{(?:$Storage\s+)?$Type}; | 196 | $Declare = qr{(?:$Storage\s+)?$Type}; |
189 | $Modifier = qr{(?:$Attribute|$Sparse|$mods)}; | ||
190 | } | 197 | } |
191 | build_types(); | 198 | build_types(); |
192 | 199 | ||
@@ -333,7 +340,7 @@ sub sanitise_line { | |||
333 | $off++; | 340 | $off++; |
334 | next; | 341 | next; |
335 | } | 342 | } |
336 | if (substr($line, $off, 2) eq '*/') { | 343 | if ($sanitise_quote eq '*/' && substr($line, $off, 2) eq '*/') { |
337 | $sanitise_quote = ''; | 344 | $sanitise_quote = ''; |
338 | substr($res, $off, 2, "$;$;"); | 345 | substr($res, $off, 2, "$;$;"); |
339 | $off++; | 346 | $off++; |
@@ -406,6 +413,7 @@ sub ctx_statement_block { | |||
406 | # context. | 413 | # context. |
407 | if ($off >= $len) { | 414 | if ($off >= $len) { |
408 | for (; $remain > 0; $line++) { | 415 | for (; $remain > 0; $line++) { |
416 | last if (!defined $lines[$line]); | ||
409 | next if ($lines[$line] =~ /^-/); | 417 | next if ($lines[$line] =~ /^-/); |
410 | $remain--; | 418 | $remain--; |
411 | $loff = $len; | 419 | $loff = $len; |
@@ -470,7 +478,9 @@ sub ctx_statement_block { | |||
470 | } | 478 | } |
471 | $off++; | 479 | $off++; |
472 | } | 480 | } |
481 | # We are truly at the end, so shuffle to the next line. | ||
473 | if ($off == $len) { | 482 | if ($off == $len) { |
483 | $loff = $len + 1; | ||
474 | $line++; | 484 | $line++; |
475 | $remain--; | 485 | $remain--; |
476 | } | 486 | } |
@@ -631,7 +641,7 @@ sub ctx_locate_comment { | |||
631 | my ($first_line, $end_line) = @_; | 641 | my ($first_line, $end_line) = @_; |
632 | 642 | ||
633 | # Catch a comment on the end of the line itself. | 643 | # Catch a comment on the end of the line itself. |
634 | my ($current_comment) = ($rawlines[$end_line - 1] =~ m@.*(/\*.*\*/)\s*$@); | 644 | my ($current_comment) = ($rawlines[$end_line - 1] =~ m@.*(/\*.*\*/)\s*(?:\\\s*)?$@); |
635 | return $current_comment if (defined $current_comment); | 645 | return $current_comment if (defined $current_comment); |
636 | 646 | ||
637 | # Look through the context and try and figure out if there is a | 647 | # Look through the context and try and figure out if there is a |
@@ -669,6 +679,22 @@ sub ctx_has_comment { | |||
669 | return ($cmt ne ''); | 679 | return ($cmt ne ''); |
670 | } | 680 | } |
671 | 681 | ||
682 | sub raw_line { | ||
683 | my ($linenr, $cnt) = @_; | ||
684 | |||
685 | my $offset = $linenr - 1; | ||
686 | $cnt++; | ||
687 | |||
688 | my $line; | ||
689 | while ($cnt) { | ||
690 | $line = $rawlines[$offset++]; | ||
691 | next if (defined($line) && $line =~ /^-/); | ||
692 | $cnt--; | ||
693 | } | ||
694 | |||
695 | return $line; | ||
696 | } | ||
697 | |||
672 | sub cat_vet { | 698 | sub cat_vet { |
673 | my ($vet) = @_; | 699 | my ($vet) = @_; |
674 | my ($res, $coded); | 700 | my ($res, $coded); |
@@ -689,17 +715,20 @@ sub cat_vet { | |||
689 | my $av_preprocessor = 0; | 715 | my $av_preprocessor = 0; |
690 | my $av_pending; | 716 | my $av_pending; |
691 | my @av_paren_type; | 717 | my @av_paren_type; |
718 | my $av_pend_colon; | ||
692 | 719 | ||
693 | sub annotate_reset { | 720 | sub annotate_reset { |
694 | $av_preprocessor = 0; | 721 | $av_preprocessor = 0; |
695 | $av_pending = '_'; | 722 | $av_pending = '_'; |
696 | @av_paren_type = ('E'); | 723 | @av_paren_type = ('E'); |
724 | $av_pend_colon = 'O'; | ||
697 | } | 725 | } |
698 | 726 | ||
699 | sub annotate_values { | 727 | sub annotate_values { |
700 | my ($stream, $type) = @_; | 728 | my ($stream, $type) = @_; |
701 | 729 | ||
702 | my $res; | 730 | my $res; |
731 | my $var = '_' x length($stream); | ||
703 | my $cur = $stream; | 732 | my $cur = $stream; |
704 | 733 | ||
705 | print "$stream\n" if ($dbg_values > 1); | 734 | print "$stream\n" if ($dbg_values > 1); |
@@ -715,10 +744,14 @@ sub annotate_values { | |||
715 | $av_preprocessor = 0; | 744 | $av_preprocessor = 0; |
716 | } | 745 | } |
717 | 746 | ||
718 | } elsif ($cur =~ /^($Type)/) { | 747 | } elsif ($cur =~ /^($Type)\s*(?:$Ident|,|\)|\()/) { |
719 | print "DECLARE($1)\n" if ($dbg_values > 1); | 748 | print "DECLARE($1)\n" if ($dbg_values > 1); |
720 | $type = 'T'; | 749 | $type = 'T'; |
721 | 750 | ||
751 | } elsif ($cur =~ /^($Modifier)\s*/) { | ||
752 | print "MODIFIER($1)\n" if ($dbg_values > 1); | ||
753 | $type = 'T'; | ||
754 | |||
722 | } elsif ($cur =~ /^(\#\s*define\s*$Ident)(\(?)/o) { | 755 | } elsif ($cur =~ /^(\#\s*define\s*$Ident)(\(?)/o) { |
723 | print "DEFINE($1,$2)\n" if ($dbg_values > 1); | 756 | print "DEFINE($1,$2)\n" if ($dbg_values > 1); |
724 | $av_preprocessor = 1; | 757 | $av_preprocessor = 1; |
@@ -775,12 +808,17 @@ sub annotate_values { | |||
775 | } | 808 | } |
776 | $type = 'N'; | 809 | $type = 'N'; |
777 | 810 | ||
778 | } elsif ($cur =~ /^(if|while|typeof|__typeof__|for)\b/o) { | 811 | } elsif ($cur =~ /^(if|while|for)\b/o) { |
779 | print "COND($1)\n" if ($dbg_values > 1); | 812 | print "COND($1)\n" if ($dbg_values > 1); |
780 | $av_pending = 'N'; | 813 | $av_pending = 'E'; |
781 | $type = 'N'; | 814 | $type = 'N'; |
782 | 815 | ||
783 | } elsif ($cur =~/^(return|case|else)/o) { | 816 | } elsif ($cur =~/^(case)/o) { |
817 | print "CASE($1)\n" if ($dbg_values > 1); | ||
818 | $av_pend_colon = 'C'; | ||
819 | $type = 'N'; | ||
820 | |||
821 | } elsif ($cur =~/^(return|else|goto|typeof|__typeof__)\b/o) { | ||
784 | print "KEYWORD($1)\n" if ($dbg_values > 1); | 822 | print "KEYWORD($1)\n" if ($dbg_values > 1); |
785 | $type = 'N'; | 823 | $type = 'N'; |
786 | 824 | ||
@@ -800,10 +838,20 @@ sub annotate_values { | |||
800 | print "PAREN('$1')\n" if ($dbg_values > 1); | 838 | print "PAREN('$1')\n" if ($dbg_values > 1); |
801 | } | 839 | } |
802 | 840 | ||
803 | } elsif ($cur =~ /^($Ident)\(/o) { | 841 | } elsif ($cur =~ /^($Ident)\s*\(/o) { |
804 | print "FUNC($1)\n" if ($dbg_values > 1); | 842 | print "FUNC($1)\n" if ($dbg_values > 1); |
843 | $type = 'V'; | ||
805 | $av_pending = 'V'; | 844 | $av_pending = 'V'; |
806 | 845 | ||
846 | } elsif ($cur =~ /^($Ident\s*):/) { | ||
847 | if ($type eq 'E') { | ||
848 | $av_pend_colon = 'L'; | ||
849 | } elsif ($type eq 'T') { | ||
850 | $av_pend_colon = 'B'; | ||
851 | } | ||
852 | print "IDENT_COLON($1,$type>$av_pend_colon)\n" if ($dbg_values > 1); | ||
853 | $type = 'V'; | ||
854 | |||
807 | } elsif ($cur =~ /^($Ident|$Constant)/o) { | 855 | } elsif ($cur =~ /^($Ident|$Constant)/o) { |
808 | print "IDENT($1)\n" if ($dbg_values > 1); | 856 | print "IDENT($1)\n" if ($dbg_values > 1); |
809 | $type = 'V'; | 857 | $type = 'V'; |
@@ -815,11 +863,40 @@ sub annotate_values { | |||
815 | } elsif ($cur =~/^(;|{|})/) { | 863 | } elsif ($cur =~/^(;|{|})/) { |
816 | print "END($1)\n" if ($dbg_values > 1); | 864 | print "END($1)\n" if ($dbg_values > 1); |
817 | $type = 'E'; | 865 | $type = 'E'; |
866 | $av_pend_colon = 'O'; | ||
867 | |||
868 | } elsif ($cur =~ /^(\?)/o) { | ||
869 | print "QUESTION($1)\n" if ($dbg_values > 1); | ||
870 | $type = 'N'; | ||
871 | |||
872 | } elsif ($cur =~ /^(:)/o) { | ||
873 | print "COLON($1,$av_pend_colon)\n" if ($dbg_values > 1); | ||
874 | |||
875 | substr($var, length($res), 1, $av_pend_colon); | ||
876 | if ($av_pend_colon eq 'C' || $av_pend_colon eq 'L') { | ||
877 | $type = 'E'; | ||
878 | } else { | ||
879 | $type = 'N'; | ||
880 | } | ||
881 | $av_pend_colon = 'O'; | ||
818 | 882 | ||
819 | } elsif ($cur =~ /^(;|\?|:|\[)/o) { | 883 | } elsif ($cur =~ /^(;|\[)/o) { |
820 | print "CLOSE($1)\n" if ($dbg_values > 1); | 884 | print "CLOSE($1)\n" if ($dbg_values > 1); |
821 | $type = 'N'; | 885 | $type = 'N'; |
822 | 886 | ||
887 | } elsif ($cur =~ /^(-(?![->])|\+(?!\+)|\*|\&\&|\&)/o) { | ||
888 | my $variant; | ||
889 | |||
890 | print "OPV($1)\n" if ($dbg_values > 1); | ||
891 | if ($type eq 'V') { | ||
892 | $variant = 'B'; | ||
893 | } else { | ||
894 | $variant = 'U'; | ||
895 | } | ||
896 | |||
897 | substr($var, length($res), 1, $variant); | ||
898 | $type = 'N'; | ||
899 | |||
823 | } elsif ($cur =~ /^($Operators)/o) { | 900 | } elsif ($cur =~ /^($Operators)/o) { |
824 | print "OP($1)\n" if ($dbg_values > 1); | 901 | print "OP($1)\n" if ($dbg_values > 1); |
825 | if ($1 ne '++' && $1 ne '--') { | 902 | if ($1 ne '++' && $1 ne '--') { |
@@ -835,18 +912,28 @@ sub annotate_values { | |||
835 | } | 912 | } |
836 | } | 913 | } |
837 | 914 | ||
838 | return $res; | 915 | return ($res, $var); |
839 | } | 916 | } |
840 | 917 | ||
841 | sub possible { | 918 | sub possible { |
842 | my ($possible, $line) = @_; | 919 | my ($possible, $line) = @_; |
843 | 920 | ||
844 | print "CHECK<$possible> ($line)\n" if ($dbg_possible > 1); | 921 | print "CHECK<$possible> ($line)\n" if ($dbg_possible > 2); |
845 | if ($possible !~ /^(?:$Storage|$Type|DEFINE_\S+)$/ && | 922 | if ($possible !~ /(?: |
846 | $possible ne 'goto' && $possible ne 'return' && | 923 | ^(?: |
847 | $possible ne 'case' && $possible ne 'else' && | 924 | $Modifier| |
848 | $possible ne 'asm' && | 925 | $Storage| |
849 | $possible !~ /^(typedef|struct|enum)\b/) { | 926 | $Type| |
927 | DEFINE_\S+| | ||
928 | goto| | ||
929 | return| | ||
930 | case| | ||
931 | else| | ||
932 | asm|__asm__| | ||
933 | do | ||
934 | )$| | ||
935 | ^(?:typedef|struct|enum)\b | ||
936 | )/x) { | ||
850 | # Check for modifiers. | 937 | # Check for modifiers. |
851 | $possible =~ s/\s*$Storage\s*//g; | 938 | $possible =~ s/\s*$Storage\s*//g; |
852 | $possible =~ s/\s*$Sparse\s*//g; | 939 | $possible =~ s/\s*$Sparse\s*//g; |
@@ -854,14 +941,18 @@ sub possible { | |||
854 | 941 | ||
855 | } elsif ($possible =~ /\s/) { | 942 | } elsif ($possible =~ /\s/) { |
856 | $possible =~ s/\s*$Type\s*//g; | 943 | $possible =~ s/\s*$Type\s*//g; |
857 | warn "MODIFIER: $possible ($line)\n" if ($dbg_possible); | 944 | for my $modifier (split(' ', $possible)) { |
858 | push(@modifierList, $possible); | 945 | warn "MODIFIER: $modifier ($possible) ($line)\n" if ($dbg_possible); |
946 | push(@modifierList, $modifier); | ||
947 | } | ||
859 | 948 | ||
860 | } else { | 949 | } else { |
861 | warn "POSSIBLE: $possible ($line)\n" if ($dbg_possible); | 950 | warn "POSSIBLE: $possible ($line)\n" if ($dbg_possible); |
862 | push(@typeList, $possible); | 951 | push(@typeList, $possible); |
863 | } | 952 | } |
864 | build_types(); | 953 | build_types(); |
954 | } else { | ||
955 | warn "NOTPOSS: $possible ($line)\n" if ($dbg_possible > 1); | ||
865 | } | 956 | } |
866 | } | 957 | } |
867 | 958 | ||
@@ -901,6 +992,33 @@ sub CHK { | |||
901 | } | 992 | } |
902 | } | 993 | } |
903 | 994 | ||
995 | sub check_absolute_file { | ||
996 | my ($absolute, $herecurr) = @_; | ||
997 | my $file = $absolute; | ||
998 | |||
999 | ##print "absolute<$absolute>\n"; | ||
1000 | |||
1001 | # See if any suffix of this path is a path within the tree. | ||
1002 | while ($file =~ s@^[^/]*/@@) { | ||
1003 | if (-f "$root/$file") { | ||
1004 | ##print "file<$file>\n"; | ||
1005 | last; | ||
1006 | } | ||
1007 | } | ||
1008 | if (! -f _) { | ||
1009 | return 0; | ||
1010 | } | ||
1011 | |||
1012 | # It is, so see if the prefix is acceptable. | ||
1013 | my $prefix = $absolute; | ||
1014 | substr($prefix, -length($file)) = ''; | ||
1015 | |||
1016 | ##print "prefix<$prefix>\n"; | ||
1017 | if ($prefix ne ".../") { | ||
1018 | WARN("use relative pathname instead of absolute in changelog text\n" . $herecurr); | ||
1019 | } | ||
1020 | } | ||
1021 | |||
904 | sub process { | 1022 | sub process { |
905 | my $filename = shift; | 1023 | my $filename = shift; |
906 | 1024 | ||
@@ -938,6 +1056,7 @@ sub process { | |||
938 | 1056 | ||
939 | # suppression flags | 1057 | # suppression flags |
940 | my %suppress_ifbraces; | 1058 | my %suppress_ifbraces; |
1059 | my %suppress_whiletrailers; | ||
941 | 1060 | ||
942 | # Pre-scan the patch sanitizing the lines. | 1061 | # Pre-scan the patch sanitizing the lines. |
943 | # Pre-scan the patch looking for any __setup documentation. | 1062 | # Pre-scan the patch looking for any __setup documentation. |
@@ -972,9 +1091,14 @@ sub process { | |||
972 | # edge is a close comment then we must be in a comment | 1091 | # edge is a close comment then we must be in a comment |
973 | # at context start. | 1092 | # at context start. |
974 | my $edge; | 1093 | my $edge; |
975 | for (my $ln = $linenr + 1; $ln < ($linenr + $realcnt); $ln++) { | 1094 | my $cnt = $realcnt; |
976 | next if ($line =~ /^-/); | 1095 | for (my $ln = $linenr + 1; $cnt > 0; $ln++) { |
977 | ($edge) = ($rawlines[$ln - 1] =~ m@(/\*|\*/)@); | 1096 | next if (defined $rawlines[$ln - 1] && |
1097 | $rawlines[$ln - 1] =~ /^-/); | ||
1098 | $cnt--; | ||
1099 | #print "RAW<$rawlines[$ln - 1]>\n"; | ||
1100 | ($edge) = (defined $rawlines[$ln - 1] && | ||
1101 | $rawlines[$ln - 1] =~ m@(/\*|\*/)@); | ||
978 | last if (defined $edge); | 1102 | last if (defined $edge); |
979 | } | 1103 | } |
980 | if (defined $edge && $edge eq '*/') { | 1104 | if (defined $edge && $edge eq '*/') { |
@@ -1022,6 +1146,7 @@ sub process { | |||
1022 | $linenr++; | 1146 | $linenr++; |
1023 | 1147 | ||
1024 | my $rawline = $rawlines[$linenr - 1]; | 1148 | my $rawline = $rawlines[$linenr - 1]; |
1149 | my $hunk_line = ($realcnt != 0); | ||
1025 | 1150 | ||
1026 | #extract the line range in the file after the patch is applied | 1151 | #extract the line range in the file after the patch is applied |
1027 | if ($line=~/^\@\@ -\d+(?:,\d+)? \+(\d+)(,(\d+))? \@\@/) { | 1152 | if ($line=~/^\@\@ -\d+(?:,\d+)? \+(\d+)(,(\d+))? \@\@/) { |
@@ -1037,6 +1162,7 @@ sub process { | |||
1037 | $prev_values = 'E'; | 1162 | $prev_values = 'E'; |
1038 | 1163 | ||
1039 | %suppress_ifbraces = (); | 1164 | %suppress_ifbraces = (); |
1165 | %suppress_whiletrailers = (); | ||
1040 | next; | 1166 | next; |
1041 | 1167 | ||
1042 | # track the line number as we move through the hunk, note that | 1168 | # track the line number as we move through the hunk, note that |
@@ -1072,7 +1198,7 @@ sub process { | |||
1072 | $realfile = $1; | 1198 | $realfile = $1; |
1073 | $realfile =~ s@^[^/]*/@@; | 1199 | $realfile =~ s@^[^/]*/@@; |
1074 | 1200 | ||
1075 | if ($realfile =~ m@include/asm/@) { | 1201 | if ($realfile =~ m@^include/asm/@) { |
1076 | ERROR("do not modify files in include/asm, change architecture specific files in include/asm-<architecture>\n" . "$here$rawline\n"); | 1202 | ERROR("do not modify files in include/asm, change architecture specific files in include/asm-<architecture>\n" . "$here$rawline\n"); |
1077 | } | 1203 | } |
1078 | next; | 1204 | next; |
@@ -1106,6 +1232,20 @@ sub process { | |||
1106 | $herecurr) if (!$emitted_corrupt++); | 1232 | $herecurr) if (!$emitted_corrupt++); |
1107 | } | 1233 | } |
1108 | 1234 | ||
1235 | # Check for absolute kernel paths. | ||
1236 | if ($tree) { | ||
1237 | while ($line =~ m{(?:^|\s)(/\S*)}g) { | ||
1238 | my $file = $1; | ||
1239 | |||
1240 | if ($file =~ m{^(.*?)(?::\d+)+:?$} && | ||
1241 | check_absolute_file($1, $herecurr)) { | ||
1242 | # | ||
1243 | } else { | ||
1244 | check_absolute_file($file, $herecurr); | ||
1245 | } | ||
1246 | } | ||
1247 | } | ||
1248 | |||
1109 | # UTF-8 regex found at http://www.w3.org/International/questions/qa-forms-utf-8.en.php | 1249 | # UTF-8 regex found at http://www.w3.org/International/questions/qa-forms-utf-8.en.php |
1110 | if (($realfile =~ /^$/ || $line =~ /^\+/) && | 1250 | if (($realfile =~ /^$/ || $line =~ /^\+/) && |
1111 | $rawline !~ m/^$UTF8*$/) { | 1251 | $rawline !~ m/^$UTF8*$/) { |
@@ -1118,11 +1258,8 @@ sub process { | |||
1118 | ERROR("Invalid UTF-8, patch and commit message should be encoded in UTF-8\n" . $hereptr); | 1258 | ERROR("Invalid UTF-8, patch and commit message should be encoded in UTF-8\n" . $hereptr); |
1119 | } | 1259 | } |
1120 | 1260 | ||
1121 | #ignore lines being removed | 1261 | # ignore non-hunk lines and lines being removed |
1122 | if ($line=~/^-/) {next;} | 1262 | next if (!$hunk_line || $line =~ /^-/); |
1123 | |||
1124 | # check we are in a valid source file if not then ignore this hunk | ||
1125 | next if ($realfile !~ /\.(h|c|s|S|pl|sh)$/); | ||
1126 | 1263 | ||
1127 | #trailing whitespace | 1264 | #trailing whitespace |
1128 | if ($line =~ /^\+.*\015/) { | 1265 | if ($line =~ /^\+.*\015/) { |
@@ -1133,9 +1270,15 @@ sub process { | |||
1133 | my $herevet = "$here\n" . cat_vet($rawline) . "\n"; | 1270 | my $herevet = "$here\n" . cat_vet($rawline) . "\n"; |
1134 | ERROR("trailing whitespace\n" . $herevet); | 1271 | ERROR("trailing whitespace\n" . $herevet); |
1135 | } | 1272 | } |
1273 | |||
1274 | # check we are in a valid source file if not then ignore this hunk | ||
1275 | next if ($realfile !~ /\.(h|c|s|S|pl|sh)$/); | ||
1276 | |||
1136 | #80 column limit | 1277 | #80 column limit |
1137 | if ($line =~ /^\+/ && $prevrawline !~ /\/\*\*/ && | 1278 | if ($line =~ /^\+/ && $prevrawline !~ /\/\*\*/ && |
1138 | $rawline !~ /^.\s*\*\s*\@$Ident\s/ && $length > 80) | 1279 | $rawline !~ /^.\s*\*\s*\@$Ident\s/ && |
1280 | $line !~ /^\+\s*printk\s*\(\s*(?:KERN_\S+\s*)?"[X\t]*"\s*(?:,|\)\s*;)\s*$/ && | ||
1281 | $length > 80) | ||
1139 | { | 1282 | { |
1140 | WARN("line over 80 characters\n" . $herecurr); | 1283 | WARN("line over 80 characters\n" . $herecurr); |
1141 | } | 1284 | } |
@@ -1145,8 +1288,8 @@ sub process { | |||
1145 | WARN("adding a line without newline at end of file\n" . $herecurr); | 1288 | WARN("adding a line without newline at end of file\n" . $herecurr); |
1146 | } | 1289 | } |
1147 | 1290 | ||
1148 | # check we are in a valid source file *.[hc] if not then ignore this hunk | 1291 | # check we are in a valid source file C or perl if not then ignore this hunk |
1149 | next if ($realfile !~ /\.[hc]$/); | 1292 | next if ($realfile !~ /\.(h|c|pl)$/); |
1150 | 1293 | ||
1151 | # at the beginning of a line any tabs must come first and anything | 1294 | # at the beginning of a line any tabs must come first and anything |
1152 | # more than 8 must use tabs. | 1295 | # more than 8 must use tabs. |
@@ -1156,16 +1299,19 @@ sub process { | |||
1156 | ERROR("code indent should use tabs where possible\n" . $herevet); | 1299 | ERROR("code indent should use tabs where possible\n" . $herevet); |
1157 | } | 1300 | } |
1158 | 1301 | ||
1302 | # check we are in a valid C source file if not then ignore this hunk | ||
1303 | next if ($realfile !~ /\.(h|c)$/); | ||
1304 | |||
1159 | # check for RCS/CVS revision markers | 1305 | # check for RCS/CVS revision markers |
1160 | if ($rawline =~ /^\+.*\$(Revision|Log|Id)(?:\$|)/) { | 1306 | if ($rawline =~ /^\+.*\$(Revision|Log|Id)(?:\$|)/) { |
1161 | WARN("CVS style keyword markers, these will _not_ be updated\n". $herecurr); | 1307 | WARN("CVS style keyword markers, these will _not_ be updated\n". $herecurr); |
1162 | } | 1308 | } |
1163 | 1309 | ||
1164 | # Check for potential 'bare' types | 1310 | # Check for potential 'bare' types |
1165 | my ($stat, $cond); | 1311 | my ($stat, $cond, $line_nr_next, $remain_next, $off_next); |
1166 | if ($realcnt && $line =~ /.\s*\S/) { | 1312 | if ($realcnt && $line =~ /.\s*\S/) { |
1167 | ($stat, $cond) = ctx_statement_block($linenr, | 1313 | ($stat, $cond, $line_nr_next, $remain_next, $off_next) = |
1168 | $realcnt, 0); | 1314 | ctx_statement_block($linenr, $realcnt, 0); |
1169 | $stat =~ s/\n./\n /g; | 1315 | $stat =~ s/\n./\n /g; |
1170 | $cond =~ s/\n./\n /g; | 1316 | $cond =~ s/\n./\n /g; |
1171 | 1317 | ||
@@ -1179,13 +1325,13 @@ sub process { | |||
1179 | } elsif ($s =~ /^.\s*$Ident\s*\(/s) { | 1325 | } elsif ($s =~ /^.\s*$Ident\s*\(/s) { |
1180 | 1326 | ||
1181 | # declarations always start with types | 1327 | # declarations always start with types |
1182 | } elsif ($prev_values eq 'E' && $s =~ /^.\s*(?:$Storage\s+)?(?:$Inline\s+)?(?:const\s+)?((?:\s*$Ident)+)\b(?:\s+$Sparse)?\s*\**\s*(?:$Ident|\(\*[^\)]*\))\s*(?:;|=|,|\()/s) { | 1328 | } elsif ($prev_values eq 'E' && $s =~ /^.\s*(?:$Storage\s+)?(?:$Inline\s+)?(?:const\s+)?((?:\s*$Ident)+?)\b(?:\s+$Sparse)?\s*\**\s*(?:$Ident|\(\*[^\)]*\))(?:\s*$Modifier)?\s*(?:;|=|,|\()/s) { |
1183 | my $type = $1; | 1329 | my $type = $1; |
1184 | $type =~ s/\s+/ /g; | 1330 | $type =~ s/\s+/ /g; |
1185 | possible($type, "A:" . $s); | 1331 | possible($type, "A:" . $s); |
1186 | 1332 | ||
1187 | # definitions in global scope can only start with types | 1333 | # definitions in global scope can only start with types |
1188 | } elsif ($s =~ /^.(?:$Storage\s+)?(?:$Inline\s+)?(?:const\s+)?($Ident)\b/s) { | 1334 | } elsif ($s =~ /^.(?:$Storage\s+)?(?:$Inline\s+)?(?:const\s+)?($Ident)\b\s*(?!:)/s) { |
1189 | possible($1, "B:" . $s); | 1335 | possible($1, "B:" . $s); |
1190 | } | 1336 | } |
1191 | 1337 | ||
@@ -1246,17 +1392,22 @@ sub process { | |||
1246 | my $pre_ctx = "$1$2"; | 1392 | my $pre_ctx = "$1$2"; |
1247 | 1393 | ||
1248 | my ($level, @ctx) = ctx_statement_level($linenr, $realcnt, 0); | 1394 | my ($level, @ctx) = ctx_statement_level($linenr, $realcnt, 0); |
1249 | my $ctx_ln = $linenr + $#ctx + 1; | ||
1250 | my $ctx_cnt = $realcnt - $#ctx - 1; | 1395 | my $ctx_cnt = $realcnt - $#ctx - 1; |
1251 | my $ctx = join("\n", @ctx); | 1396 | my $ctx = join("\n", @ctx); |
1252 | 1397 | ||
1253 | ##warn "realcnt<$realcnt> ctx_cnt<$ctx_cnt>\n"; | 1398 | my $ctx_ln = $linenr; |
1399 | my $ctx_skip = $realcnt; | ||
1254 | 1400 | ||
1255 | # Skip over any removed lines in the context following statement. | 1401 | while ($ctx_skip > $ctx_cnt || ($ctx_skip == $ctx_cnt && |
1256 | while (defined($lines[$ctx_ln - 1]) && $lines[$ctx_ln - 1] =~ /^-/) { | 1402 | defined $lines[$ctx_ln - 1] && |
1403 | $lines[$ctx_ln - 1] =~ /^-/)) { | ||
1404 | ##print "SKIP<$ctx_skip> CNT<$ctx_cnt>\n"; | ||
1405 | $ctx_skip-- if (!defined $lines[$ctx_ln - 1] || $lines[$ctx_ln - 1] !~ /^-/); | ||
1257 | $ctx_ln++; | 1406 | $ctx_ln++; |
1258 | } | 1407 | } |
1259 | ##warn "pre<$pre_ctx>\nline<$line>\nctx<$ctx>\nnext<$lines[$ctx_ln - 1]>\n"; | 1408 | |
1409 | #print "realcnt<$realcnt> ctx_cnt<$ctx_cnt>\n"; | ||
1410 | #print "pre<$pre_ctx>\nline<$line>\nctx<$ctx>\nnext<$lines[$ctx_ln - 1]>\n"; | ||
1260 | 1411 | ||
1261 | if ($ctx !~ /{\s*/ && defined($lines[$ctx_ln -1]) && $lines[$ctx_ln - 1] =~ /^\+\s*{/) { | 1412 | if ($ctx !~ /{\s*/ && defined($lines[$ctx_ln -1]) && $lines[$ctx_ln - 1] =~ /^\+\s*{/) { |
1262 | ERROR("that open brace { should be on the previous line\n" . | 1413 | ERROR("that open brace { should be on the previous line\n" . |
@@ -1274,14 +1425,101 @@ sub process { | |||
1274 | } | 1425 | } |
1275 | } | 1426 | } |
1276 | 1427 | ||
1428 | # Check relative indent for conditionals and blocks. | ||
1429 | if ($line =~ /\b(?:(?:if|while|for)\s*\(|do\b)/ && $line !~ /^.\s*#/ && $line !~ /\}\s*while\s*/) { | ||
1430 | my ($s, $c) = ($stat, $cond); | ||
1431 | |||
1432 | substr($s, 0, length($c), ''); | ||
1433 | |||
1434 | # Make sure we remove the line prefixes as we have | ||
1435 | # none on the first line, and are going to readd them | ||
1436 | # where necessary. | ||
1437 | $s =~ s/\n./\n/gs; | ||
1438 | |||
1439 | # Find out how long the conditional actually is. | ||
1440 | my @newlines = ($c =~ /\n/gs); | ||
1441 | my $cond_lines = 1 + $#newlines; | ||
1442 | |||
1443 | # We want to check the first line inside the block | ||
1444 | # starting at the end of the conditional, so remove: | ||
1445 | # 1) any blank line termination | ||
1446 | # 2) any opening brace { on end of the line | ||
1447 | # 3) any do (...) { | ||
1448 | my $continuation = 0; | ||
1449 | my $check = 0; | ||
1450 | $s =~ s/^.*\bdo\b//; | ||
1451 | $s =~ s/^\s*{//; | ||
1452 | if ($s =~ s/^\s*\\//) { | ||
1453 | $continuation = 1; | ||
1454 | } | ||
1455 | if ($s =~ s/^\s*?\n//) { | ||
1456 | $check = 1; | ||
1457 | $cond_lines++; | ||
1458 | } | ||
1459 | |||
1460 | # Also ignore a loop construct at the end of a | ||
1461 | # preprocessor statement. | ||
1462 | if (($prevline =~ /^.\s*#\s*define\s/ || | ||
1463 | $prevline =~ /\\\s*$/) && $continuation == 0) { | ||
1464 | $check = 0; | ||
1465 | } | ||
1466 | |||
1467 | my $cond_ptr = -1; | ||
1468 | $continuation = 0; | ||
1469 | while ($cond_ptr != $cond_lines) { | ||
1470 | $cond_ptr = $cond_lines; | ||
1471 | |||
1472 | # If we see an #else/#elif then the code | ||
1473 | # is not linear. | ||
1474 | if ($s =~ /^\s*\#\s*(?:else|elif)/) { | ||
1475 | $check = 0; | ||
1476 | } | ||
1477 | |||
1478 | # Ignore: | ||
1479 | # 1) blank lines, they should be at 0, | ||
1480 | # 2) preprocessor lines, and | ||
1481 | # 3) labels. | ||
1482 | if ($continuation || | ||
1483 | $s =~ /^\s*?\n/ || | ||
1484 | $s =~ /^\s*#\s*?/ || | ||
1485 | $s =~ /^\s*$Ident\s*:/) { | ||
1486 | $continuation = ($s =~ /^.*?\\\n/) ? 1 : 0; | ||
1487 | $s =~ s/^.*?\n//; | ||
1488 | $cond_lines++; | ||
1489 | } | ||
1490 | } | ||
1491 | |||
1492 | my (undef, $sindent) = line_stats("+" . $s); | ||
1493 | my $stat_real = raw_line($linenr, $cond_lines); | ||
1494 | |||
1495 | # Check if either of these lines are modified, else | ||
1496 | # this is not this patch's fault. | ||
1497 | if (!defined($stat_real) || | ||
1498 | $stat !~ /^\+/ && $stat_real !~ /^\+/) { | ||
1499 | $check = 0; | ||
1500 | } | ||
1501 | if (defined($stat_real) && $cond_lines > 1) { | ||
1502 | $stat_real = "[...]\n$stat_real"; | ||
1503 | } | ||
1504 | |||
1505 | #print "line<$line> prevline<$prevline> indent<$indent> sindent<$sindent> check<$check> continuation<$continuation> s<$s> cond_lines<$cond_lines> stat_real<$stat_real> stat<$stat>\n"; | ||
1506 | |||
1507 | if ($check && (($sindent % 8) != 0 || | ||
1508 | ($sindent <= $indent && $s ne ''))) { | ||
1509 | WARN("suspect code indent for conditional statements ($indent, $sindent)\n" . $herecurr . "$stat_real\n"); | ||
1510 | } | ||
1511 | } | ||
1512 | |||
1277 | # Track the 'values' across context and added lines. | 1513 | # Track the 'values' across context and added lines. |
1278 | my $opline = $line; $opline =~ s/^./ /; | 1514 | my $opline = $line; $opline =~ s/^./ /; |
1279 | my $curr_values = annotate_values($opline . "\n", $prev_values); | 1515 | my ($curr_values, $curr_vars) = |
1516 | annotate_values($opline . "\n", $prev_values); | ||
1280 | $curr_values = $prev_values . $curr_values; | 1517 | $curr_values = $prev_values . $curr_values; |
1281 | if ($dbg_values) { | 1518 | if ($dbg_values) { |
1282 | my $outline = $opline; $outline =~ s/\t/ /g; | 1519 | my $outline = $opline; $outline =~ s/\t/ /g; |
1283 | print "$linenr > .$outline\n"; | 1520 | print "$linenr > .$outline\n"; |
1284 | print "$linenr > $curr_values\n"; | 1521 | print "$linenr > $curr_values\n"; |
1522 | print "$linenr > $curr_vars\n"; | ||
1285 | } | 1523 | } |
1286 | $prev_values = substr($curr_values, -1); | 1524 | $prev_values = substr($curr_values, -1); |
1287 | 1525 | ||
@@ -1289,8 +1527,21 @@ sub process { | |||
1289 | if ($line=~/^[^\+]/) {next;} | 1527 | if ($line=~/^[^\+]/) {next;} |
1290 | 1528 | ||
1291 | # TEST: allow direct testing of the type matcher. | 1529 | # TEST: allow direct testing of the type matcher. |
1292 | if ($tst_type && $line =~ /^.$Declare$/) { | 1530 | if ($dbg_type) { |
1293 | ERROR("TEST: is type $Declare\n" . $herecurr); | 1531 | if ($line =~ /^.\s*$Declare\s*$/) { |
1532 | ERROR("TEST: is type\n" . $herecurr); | ||
1533 | } elsif ($dbg_type > 1 && $line =~ /^.+($Declare)/) { | ||
1534 | ERROR("TEST: is not type ($1 is)\n". $herecurr); | ||
1535 | } | ||
1536 | next; | ||
1537 | } | ||
1538 | # TEST: allow direct testing of the attribute matcher. | ||
1539 | if ($dbg_attr) { | ||
1540 | if ($line =~ /^.\s*$Attribute\s*$/) { | ||
1541 | ERROR("TEST: is attr\n" . $herecurr); | ||
1542 | } elsif ($dbg_attr > 1 && $line =~ /^.+($Attribute)/) { | ||
1543 | ERROR("TEST: is not attr ($1 is)\n". $herecurr); | ||
1544 | } | ||
1294 | next; | 1545 | next; |
1295 | } | 1546 | } |
1296 | 1547 | ||
@@ -1325,13 +1576,14 @@ sub process { | |||
1325 | if (($line =~ /EXPORT_SYMBOL.*\((.*)\)/) || | 1576 | if (($line =~ /EXPORT_SYMBOL.*\((.*)\)/) || |
1326 | ($line =~ /EXPORT_UNUSED_SYMBOL.*\((.*)\)/)) { | 1577 | ($line =~ /EXPORT_UNUSED_SYMBOL.*\((.*)\)/)) { |
1327 | my $name = $1; | 1578 | my $name = $1; |
1328 | if (($prevline !~ /^}/) && | 1579 | if ($prevline !~ /(?: |
1329 | ($prevline !~ /^\+}/) && | 1580 | ^.}| |
1330 | ($prevline !~ /^ }/) && | 1581 | ^.DEFINE_$Ident\(\Q$name\E\)| |
1331 | ($prevline !~ /^.DECLARE_$Ident\(\Q$name\E\)/) && | 1582 | ^.DECLARE_$Ident\(\Q$name\E\)| |
1332 | ($prevline !~ /^.LIST_HEAD\(\Q$name\E\)/) && | 1583 | ^.LIST_HEAD\(\Q$name\E\)| |
1333 | ($prevline !~ /^.$Type\s*\(\s*\*\s*\Q$name\E\s*\)\s*\(/) && | 1584 | ^.$Type\s*\(\s*\*\s*\Q$name\E\s*\)\s*\(| |
1334 | ($prevline !~ /\b\Q$name\E(?:\s+$Attribute)?\s*(?:;|=|\[)/)) { | 1585 | \b\Q$name\E(?:\s+$Attribute)?\s*(?:;|=|\[) |
1586 | )/x) { | ||
1335 | WARN("EXPORT_SYMBOL(foo); should immediately follow its function/variable\n" . $herecurr); | 1587 | WARN("EXPORT_SYMBOL(foo); should immediately follow its function/variable\n" . $herecurr); |
1336 | } | 1588 | } |
1337 | } | 1589 | } |
@@ -1352,6 +1604,7 @@ sub process { | |||
1352 | if ($line =~ /\btypedef\s/ && | 1604 | if ($line =~ /\btypedef\s/ && |
1353 | $line !~ /\btypedef\s+$Type\s+\(\s*\*?$Ident\s*\)\s*\(/ && | 1605 | $line !~ /\btypedef\s+$Type\s+\(\s*\*?$Ident\s*\)\s*\(/ && |
1354 | $line !~ /\btypedef\s+$Type\s+$Ident\s*\(/ && | 1606 | $line !~ /\btypedef\s+$Type\s+$Ident\s*\(/ && |
1607 | $line !~ /\b$typeTypedefs\b/ && | ||
1355 | $line !~ /\b__bitwise(?:__|)\b/) { | 1608 | $line !~ /\b__bitwise(?:__|)\b/) { |
1356 | WARN("do not add new typedefs\n" . $herecurr); | 1609 | WARN("do not add new typedefs\n" . $herecurr); |
1357 | } | 1610 | } |
@@ -1365,11 +1618,11 @@ sub process { | |||
1365 | ERROR("\"(foo $1 )\" should be \"(foo $1)\"\n" . | 1618 | ERROR("\"(foo $1 )\" should be \"(foo $1)\"\n" . |
1366 | $herecurr); | 1619 | $herecurr); |
1367 | 1620 | ||
1368 | } elsif ($line =~ m{$NonptrType(\*+)(?:\s+(?:$Attribute|$Sparse))?\s+[A-Za-z\d_]+}) { | 1621 | } elsif ($line =~ m{\b$NonptrType(\*+)(?:\s+(?:$Attribute|$Sparse))?\s+[A-Za-z\d_]+}) { |
1369 | ERROR("\"foo$1 bar\" should be \"foo $1bar\"\n" . | 1622 | ERROR("\"foo$1 bar\" should be \"foo $1bar\"\n" . |
1370 | $herecurr); | 1623 | $herecurr); |
1371 | 1624 | ||
1372 | } elsif ($line =~ m{$NonptrType\s+(\*+)(?!\s+(?:$Attribute|$Sparse))\s+[A-Za-z\d_]+}) { | 1625 | } elsif ($line =~ m{\b$NonptrType\s+(\*+)(?!\s+(?:$Attribute|$Sparse))\s+[A-Za-z\d_]+}) { |
1373 | ERROR("\"foo $1 bar\" should be \"foo $1bar\"\n" . | 1626 | ERROR("\"foo $1 bar\" should be \"foo $1bar\"\n" . |
1374 | $herecurr); | 1627 | $herecurr); |
1375 | } | 1628 | } |
@@ -1421,6 +1674,19 @@ sub process { | |||
1421 | ERROR("open brace '{' following $1 go on the same line\n" . $hereprev); | 1674 | ERROR("open brace '{' following $1 go on the same line\n" . $hereprev); |
1422 | } | 1675 | } |
1423 | 1676 | ||
1677 | # check for spacing round square brackets; allowed: | ||
1678 | # 1. with a type on the left -- int [] a; | ||
1679 | # 2. at the beginning of a line for slice initialisers -- [0...10] = 5, | ||
1680 | # 3. inside a curly brace -- = { [0...10] = 5 } | ||
1681 | while ($line =~ /(.*?\s)\[/g) { | ||
1682 | my ($where, $prefix) = ($-[1], $1); | ||
1683 | if ($prefix !~ /$Type\s+$/ && | ||
1684 | ($where != 0 || $prefix !~ /^.\s+$/) && | ||
1685 | $prefix !~ /{\s+$/) { | ||
1686 | ERROR("space prohibited before open square bracket '['\n" . $herecurr); | ||
1687 | } | ||
1688 | } | ||
1689 | |||
1424 | # check for spaces between functions and their parentheses. | 1690 | # check for spaces between functions and their parentheses. |
1425 | while ($line =~ /($Ident)\s+\(/g) { | 1691 | while ($line =~ /($Ident)\s+\(/g) { |
1426 | my $name = $1; | 1692 | my $name = $1; |
@@ -1457,7 +1723,8 @@ sub process { | |||
1457 | <<=|>>=|<=|>=|==|!=| | 1723 | <<=|>>=|<=|>=|==|!=| |
1458 | \+=|-=|\*=|\/=|%=|\^=|\|=|&=| | 1724 | \+=|-=|\*=|\/=|%=|\^=|\|=|&=| |
1459 | =>|->|<<|>>|<|>|=|!|~| | 1725 | =>|->|<<|>>|<|>|=|!|~| |
1460 | &&|\|\||,|\^|\+\+|--|&|\||\+|-|\*|\/|% | 1726 | &&|\|\||,|\^|\+\+|--|&|\||\+|-|\*|\/|%| |
1727 | \?|: | ||
1461 | }x; | 1728 | }x; |
1462 | my @elements = split(/($ops|;)/, $opline); | 1729 | my @elements = split(/($ops|;)/, $opline); |
1463 | my $off = 0; | 1730 | my $off = 0; |
@@ -1504,22 +1771,11 @@ sub process { | |||
1504 | my $ptr = substr($blank, 0, $off) . "^"; | 1771 | my $ptr = substr($blank, 0, $off) . "^"; |
1505 | my $hereptr = "$hereline$ptr\n"; | 1772 | my $hereptr = "$hereline$ptr\n"; |
1506 | 1773 | ||
1507 | # Classify operators into binary, unary, or | 1774 | # Pull out the value of this operator. |
1508 | # definitions (* only) where they have more | ||
1509 | # than one mode. | ||
1510 | my $op_type = substr($curr_values, $off + 1, 1); | 1775 | my $op_type = substr($curr_values, $off + 1, 1); |
1511 | my $op_left = substr($curr_values, $off, 1); | 1776 | |
1512 | my $is_unary; | 1777 | # Get the full operator variant. |
1513 | if ($op_type eq 'T') { | 1778 | my $opv = $op . substr($curr_vars, $off, 1); |
1514 | $is_unary = 2; | ||
1515 | } elsif ($op_left eq 'V') { | ||
1516 | $is_unary = 0; | ||
1517 | } else { | ||
1518 | $is_unary = 1; | ||
1519 | } | ||
1520 | #if ($op eq '-' || $op eq '&' || $op eq '*') { | ||
1521 | # print "UNARY: <$op_left$op_type $is_unary $a:$op:$c> <$ca:$op:$cc> <$unary_ctx>\n"; | ||
1522 | #} | ||
1523 | 1779 | ||
1524 | # Ignore operators passed as parameters. | 1780 | # Ignore operators passed as parameters. |
1525 | if ($op_type ne 'V' && | 1781 | if ($op_type ne 'V' && |
@@ -1538,8 +1794,10 @@ sub process { | |||
1538 | # // is a comment | 1794 | # // is a comment |
1539 | } elsif ($op eq '//') { | 1795 | } elsif ($op eq '//') { |
1540 | 1796 | ||
1541 | # -> should have no spaces | 1797 | # No spaces for: |
1542 | } elsif ($op eq '->') { | 1798 | # -> |
1799 | # : when part of a bitfield | ||
1800 | } elsif ($op eq '->' || $opv eq ':B') { | ||
1543 | if ($ctx =~ /Wx.|.xW/) { | 1801 | if ($ctx =~ /Wx.|.xW/) { |
1544 | ERROR("spaces prohibited around that '$op' $at\n" . $hereptr); | 1802 | ERROR("spaces prohibited around that '$op' $at\n" . $hereptr); |
1545 | } | 1803 | } |
@@ -1551,18 +1809,19 @@ sub process { | |||
1551 | } | 1809 | } |
1552 | 1810 | ||
1553 | # '*' as part of a type definition -- reported already. | 1811 | # '*' as part of a type definition -- reported already. |
1554 | } elsif ($op eq '*' && $is_unary == 2) { | 1812 | } elsif ($opv eq '*_') { |
1555 | #warn "'*' is part of type\n"; | 1813 | #warn "'*' is part of type\n"; |
1556 | 1814 | ||
1557 | # unary operators should have a space before and | 1815 | # unary operators should have a space before and |
1558 | # none after. May be left adjacent to another | 1816 | # none after. May be left adjacent to another |
1559 | # unary operator, or a cast | 1817 | # unary operator, or a cast |
1560 | } elsif ($op eq '!' || $op eq '~' || | 1818 | } elsif ($op eq '!' || $op eq '~' || |
1561 | ($is_unary && ($op eq '*' || $op eq '-' || $op eq '&'))) { | 1819 | $opv eq '*U' || $opv eq '-U' || |
1820 | $opv eq '&U' || $opv eq '&&U') { | ||
1562 | if ($ctx !~ /[WEBC]x./ && $ca !~ /(?:\)|!|~|\*|-|\&|\||\+\+|\-\-|\{)$/) { | 1821 | if ($ctx !~ /[WEBC]x./ && $ca !~ /(?:\)|!|~|\*|-|\&|\||\+\+|\-\-|\{)$/) { |
1563 | ERROR("space required before that '$op' $at\n" . $hereptr); | 1822 | ERROR("space required before that '$op' $at\n" . $hereptr); |
1564 | } | 1823 | } |
1565 | if ($op eq '*' && $cc =~/\s*const\b/) { | 1824 | if ($op eq '*' && $cc =~/\s*const\b/) { |
1566 | # A unary '*' may be const | 1825 | # A unary '*' may be const |
1567 | 1826 | ||
1568 | } elsif ($ctx =~ /.xW/) { | 1827 | } elsif ($ctx =~ /.xW/) { |
@@ -1595,11 +1854,33 @@ sub process { | |||
1595 | $hereptr); | 1854 | $hereptr); |
1596 | } | 1855 | } |
1597 | 1856 | ||
1857 | # A colon needs no spaces before when it is | ||
1858 | # terminating a case value or a label. | ||
1859 | } elsif ($opv eq ':C' || $opv eq ':L') { | ||
1860 | if ($ctx =~ /Wx./) { | ||
1861 | ERROR("space prohibited before that '$op' $at\n" . $hereptr); | ||
1862 | } | ||
1863 | |||
1598 | # All the others need spaces both sides. | 1864 | # All the others need spaces both sides. |
1599 | } elsif ($ctx !~ /[EWC]x[CWE]/) { | 1865 | } elsif ($ctx !~ /[EWC]x[CWE]/) { |
1866 | my $ok = 0; | ||
1867 | |||
1600 | # Ignore email addresses <foo@bar> | 1868 | # Ignore email addresses <foo@bar> |
1601 | if (!($op eq '<' && $cb =~ /$;\S+\@\S+>/) && | 1869 | if (($op eq '<' && |
1602 | !($op eq '>' && $cb =~ /<\S+\@\S+$;/)) { | 1870 | $cc =~ /^\S+\@\S+>/) || |
1871 | ($op eq '>' && | ||
1872 | $ca =~ /<\S+\@\S+$/)) | ||
1873 | { | ||
1874 | $ok = 1; | ||
1875 | } | ||
1876 | |||
1877 | # Ignore ?: | ||
1878 | if (($opv eq ':O' && $ca =~ /\?$/) || | ||
1879 | ($op eq '?' && $cc =~ /^:/)) { | ||
1880 | $ok = 1; | ||
1881 | } | ||
1882 | |||
1883 | if ($ok == 0) { | ||
1603 | ERROR("spaces required around that '$op' $at\n" . $hereptr); | 1884 | ERROR("spaces required around that '$op' $at\n" . $hereptr); |
1604 | } | 1885 | } |
1605 | } | 1886 | } |
@@ -1670,6 +1951,7 @@ sub process { | |||
1670 | my $value = $2; | 1951 | my $value = $2; |
1671 | 1952 | ||
1672 | # Flatten any parentheses and braces | 1953 | # Flatten any parentheses and braces |
1954 | $value =~ s/\)\(/\) \(/g; | ||
1673 | while ($value =~ s/\([^\(\)]*\)/1/) { | 1955 | while ($value =~ s/\([^\(\)]*\)/1/) { |
1674 | } | 1956 | } |
1675 | 1957 | ||
@@ -1686,8 +1968,28 @@ sub process { | |||
1686 | ERROR("space required before the open parenthesis '('\n" . $herecurr); | 1968 | ERROR("space required before the open parenthesis '('\n" . $herecurr); |
1687 | } | 1969 | } |
1688 | 1970 | ||
1689 | # Check for illegal assignment in if conditional. | 1971 | # Check for illegal assignment in if conditional -- and check for trailing |
1690 | if ($line =~ /\bif\s*\(/) { | 1972 | # statements after the conditional. |
1973 | if ($line =~ /do\s*(?!{)/) { | ||
1974 | my ($stat_next) = ctx_statement_block($line_nr_next, | ||
1975 | $remain_next, $off_next); | ||
1976 | $stat_next =~ s/\n./\n /g; | ||
1977 | ##print "stat<$stat> stat_next<$stat_next>\n"; | ||
1978 | |||
1979 | if ($stat_next =~ /^\s*while\b/) { | ||
1980 | # If the statement carries leading newlines, | ||
1981 | # then count those as offsets. | ||
1982 | my ($whitespace) = | ||
1983 | ($stat_next =~ /^((?:\s*\n[+-])*\s*)/s); | ||
1984 | my $offset = | ||
1985 | statement_rawlines($whitespace) - 1; | ||
1986 | |||
1987 | $suppress_whiletrailers{$line_nr_next + | ||
1988 | $offset} = 1; | ||
1989 | } | ||
1990 | } | ||
1991 | if (!defined $suppress_whiletrailers{$linenr} && | ||
1992 | $line =~ /\b(?:if|while|for)\s*\(/ && $line !~ /^.\s*#/) { | ||
1691 | my ($s, $c) = ($stat, $cond); | 1993 | my ($s, $c) = ($stat, $cond); |
1692 | 1994 | ||
1693 | if ($c =~ /\bif\s*\(.*[^<>!=]=[^=].*/) { | 1995 | if ($c =~ /\bif\s*\(.*[^<>!=]=[^=].*/) { |
@@ -1699,10 +2001,19 @@ sub process { | |||
1699 | substr($s, 0, length($c), ''); | 2001 | substr($s, 0, length($c), ''); |
1700 | $s =~ s/\n.*//g; | 2002 | $s =~ s/\n.*//g; |
1701 | $s =~ s/$;//g; # Remove any comments | 2003 | $s =~ s/$;//g; # Remove any comments |
1702 | if (length($c) && $s !~ /^\s*({|;|)\s*\\*\s*$/ && | 2004 | if (length($c) && $s !~ /^\s*{?\s*\\*\s*$/ && |
1703 | $c !~ /^.\s*\#\s*if/) | 2005 | $c !~ /}\s*while\s*/) |
1704 | { | 2006 | { |
1705 | ERROR("trailing statements should be on next line\n" . $herecurr); | 2007 | # Find out how long the conditional actually is. |
2008 | my @newlines = ($c =~ /\n/gs); | ||
2009 | my $cond_lines = 1 + $#newlines; | ||
2010 | |||
2011 | my $stat_real = raw_line($linenr, $cond_lines); | ||
2012 | if (defined($stat_real) && $cond_lines > 1) { | ||
2013 | $stat_real = "[...]\n$stat_real"; | ||
2014 | } | ||
2015 | |||
2016 | ERROR("trailing statements should be on next line\n" . $herecurr . $stat_real); | ||
1706 | } | 2017 | } |
1707 | } | 2018 | } |
1708 | 2019 | ||
@@ -1729,6 +2040,15 @@ sub process { | |||
1729 | ERROR("trailing statements should be on next line\n" . $herecurr); | 2040 | ERROR("trailing statements should be on next line\n" . $herecurr); |
1730 | } | 2041 | } |
1731 | } | 2042 | } |
2043 | # case and default should not have general statements after them | ||
2044 | if ($line =~ /^.\s*(?:case\s*.*|default\s*):/g && | ||
2045 | $line !~ /\G(?: | ||
2046 | (?:\s*$;*)(?:\s*{)?(?:\s*$;*)(?:\s*\\)?\s*$| | ||
2047 | \s*return\s+ | ||
2048 | )/xg) | ||
2049 | { | ||
2050 | ERROR("trailing statements should be on next line\n" . $herecurr); | ||
2051 | } | ||
1732 | 2052 | ||
1733 | # Check for }<nl>else {, these must be at the same | 2053 | # Check for }<nl>else {, these must be at the same |
1734 | # indent level to be relevant to each other. | 2054 | # indent level to be relevant to each other. |
@@ -1765,19 +2085,25 @@ sub process { | |||
1765 | 2085 | ||
1766 | #warn if <asm/foo.h> is #included and <linux/foo.h> is available (uses RAW line) | 2086 | #warn if <asm/foo.h> is #included and <linux/foo.h> is available (uses RAW line) |
1767 | if ($tree && $rawline =~ m{^.\s*\#\s*include\s*\<asm\/(.*)\.h\>}) { | 2087 | if ($tree && $rawline =~ m{^.\s*\#\s*include\s*\<asm\/(.*)\.h\>}) { |
1768 | my $checkfile = "include/linux/$1.h"; | 2088 | my $file = "$1.h"; |
1769 | if (-f "$root/$checkfile" && $realfile ne $checkfile && | 2089 | my $checkfile = "include/linux/$file"; |
2090 | if (-f "$root/$checkfile" && | ||
2091 | $realfile ne $checkfile && | ||
1770 | $1 ne 'irq') | 2092 | $1 ne 'irq') |
1771 | { | 2093 | { |
1772 | WARN("Use #include <linux/$1.h> instead of <asm/$1.h>\n" . | 2094 | if ($realfile =~ m{^arch/}) { |
1773 | $herecurr); | 2095 | CHK("Consider using #include <linux/$file> instead of <asm/$file>\n" . $herecurr); |
2096 | } else { | ||
2097 | WARN("Use #include <linux/$file> instead of <asm/$file>\n" . $herecurr); | ||
2098 | } | ||
1774 | } | 2099 | } |
1775 | } | 2100 | } |
1776 | 2101 | ||
1777 | # multi-statement macros should be enclosed in a do while loop, grab the | 2102 | # multi-statement macros should be enclosed in a do while loop, grab the |
1778 | # first statement and ensure its the whole macro if its not enclosed | 2103 | # first statement and ensure its the whole macro if its not enclosed |
1779 | # in a known good container | 2104 | # in a known good container |
1780 | if ($line =~ /^.\s*\#\s*define\s*$Ident(\()?/) { | 2105 | if ($realfile !~ m@/vmlinux.lds.h$@ && |
2106 | $line =~ /^.\s*\#\s*define\s*$Ident(\()?/) { | ||
1781 | my $ln = $linenr; | 2107 | my $ln = $linenr; |
1782 | my $cnt = $realcnt; | 2108 | my $cnt = $realcnt; |
1783 | my ($off, $dstat, $dcond, $rest); | 2109 | my ($off, $dstat, $dcond, $rest); |
@@ -1791,30 +2117,26 @@ sub process { | |||
1791 | $lines[$ln - 1] =~ /^(?:-|..*\\$)/) | 2117 | $lines[$ln - 1] =~ /^(?:-|..*\\$)/) |
1792 | { | 2118 | { |
1793 | $ctx .= $rawlines[$ln - 1] . "\n"; | 2119 | $ctx .= $rawlines[$ln - 1] . "\n"; |
2120 | $cnt-- if ($lines[$ln - 1] !~ /^-/); | ||
1794 | $ln++; | 2121 | $ln++; |
1795 | $cnt--; | ||
1796 | } | 2122 | } |
1797 | $ctx .= $rawlines[$ln - 1]; | 2123 | $ctx .= $rawlines[$ln - 1]; |
1798 | 2124 | ||
1799 | ($dstat, $dcond, $ln, $cnt, $off) = | 2125 | ($dstat, $dcond, $ln, $cnt, $off) = |
1800 | ctx_statement_block($linenr, $ln - $linenr + 1, 0); | 2126 | ctx_statement_block($linenr, $ln - $linenr + 1, 0); |
1801 | #print "dstat<$dstat> dcond<$dcond> cnt<$cnt> off<$off>\n"; | 2127 | #print "dstat<$dstat> dcond<$dcond> cnt<$cnt> off<$off>\n"; |
1802 | #print "LINE<$lines[$ln]> len<" . length($lines[$ln]) . "\n"; | 2128 | #print "LINE<$lines[$ln-1]> len<" . length($lines[$ln-1]) . "\n"; |
1803 | 2129 | ||
1804 | # Extract the remainder of the define (if any) and | 2130 | # Extract the remainder of the define (if any) and |
1805 | # rip off surrounding spaces, and trailing \'s. | 2131 | # rip off surrounding spaces, and trailing \'s. |
1806 | $rest = ''; | 2132 | $rest = ''; |
1807 | if (defined $lines[$ln - 1] && | 2133 | while ($off != 0 || ($cnt > 0 && $rest =~ /\\\s*$/)) { |
1808 | $off > length($lines[$ln - 1])) | 2134 | #print "ADDING cnt<$cnt> $off <" . substr($lines[$ln - 1], $off) . "> rest<$rest>\n"; |
1809 | { | 2135 | if ($off != 0 || $lines[$ln - 1] !~ /^-/) { |
1810 | $ln++; | 2136 | $rest .= substr($lines[$ln - 1], $off) . "\n"; |
1811 | $cnt--; | 2137 | $cnt--; |
1812 | $off = 0; | 2138 | } |
1813 | } | ||
1814 | while ($cnt > 0) { | ||
1815 | $rest .= substr($lines[$ln - 1], $off) . "\n"; | ||
1816 | $ln++; | 2139 | $ln++; |
1817 | $cnt--; | ||
1818 | $off = 0; | 2140 | $off = 0; |
1819 | } | 2141 | } |
1820 | $rest =~ s/\\\n.//g; | 2142 | $rest =~ s/\\\n.//g; |
@@ -1827,14 +2149,16 @@ sub process { | |||
1827 | } else { | 2149 | } else { |
1828 | $dstat =~ s/^.\s*\#\s*define\s+$Ident\s*//; | 2150 | $dstat =~ s/^.\s*\#\s*define\s+$Ident\s*//; |
1829 | } | 2151 | } |
2152 | $dstat =~ s/$;//g; | ||
1830 | $dstat =~ s/\\\n.//g; | 2153 | $dstat =~ s/\\\n.//g; |
1831 | $dstat =~ s/^\s*//s; | 2154 | $dstat =~ s/^\s*//s; |
1832 | $dstat =~ s/\s*$//s; | 2155 | $dstat =~ s/\s*$//s; |
1833 | 2156 | ||
1834 | # Flatten any parentheses and braces | 2157 | # Flatten any parentheses and braces |
1835 | while ($dstat =~ s/\([^\(\)]*\)/1/) { | 2158 | while ($dstat =~ s/\([^\(\)]*\)/1/ || |
1836 | } | 2159 | $dstat =~ s/\{[^\{\}]*\}/1/ || |
1837 | while ($dstat =~ s/\{[^\{\}]*\}/1/) { | 2160 | $dstat =~ s/\[[^\{\}]*\]/1/) |
2161 | { | ||
1838 | } | 2162 | } |
1839 | 2163 | ||
1840 | my $exceptions = qr{ | 2164 | my $exceptions = qr{ |
@@ -1845,6 +2169,7 @@ sub process { | |||
1845 | DEFINE_PER_CPU| | 2169 | DEFINE_PER_CPU| |
1846 | __typeof__\( | 2170 | __typeof__\( |
1847 | }x; | 2171 | }x; |
2172 | #print "REST<$rest>\n"; | ||
1848 | if ($rest ne '') { | 2173 | if ($rest ne '') { |
1849 | if ($rest !~ /while\s*\(/ && | 2174 | if ($rest !~ /while\s*\(/ && |
1850 | $dstat !~ /$exceptions/) | 2175 | $dstat !~ /$exceptions/) |
@@ -1856,6 +2181,7 @@ sub process { | |||
1856 | if ($dstat ne '' && | 2181 | if ($dstat ne '' && |
1857 | $dstat !~ /^(?:$Ident|-?$Constant)$/ && | 2182 | $dstat !~ /^(?:$Ident|-?$Constant)$/ && |
1858 | $dstat !~ /$exceptions/ && | 2183 | $dstat !~ /$exceptions/ && |
2184 | $dstat !~ /^\.$Ident\s*=/ && | ||
1859 | $dstat =~ /$Operators/) | 2185 | $dstat =~ /$Operators/) |
1860 | { | 2186 | { |
1861 | ERROR("Macros with complex values should be enclosed in parenthesis\n" . "$here\n$ctx\n"); | 2187 | ERROR("Macros with complex values should be enclosed in parenthesis\n" . "$here\n$ctx\n"); |
@@ -1956,10 +2282,10 @@ sub process { | |||
1956 | } | 2282 | } |
1957 | if ($level == 0 && $block =~ /^\s*\{/ && !$allowed) { | 2283 | if ($level == 0 && $block =~ /^\s*\{/ && !$allowed) { |
1958 | my $herectx = $here . "\n";; | 2284 | my $herectx = $here . "\n";; |
1959 | my $end = $linenr + statement_rawlines($block) - 1; | 2285 | my $cnt = statement_rawlines($block); |
1960 | 2286 | ||
1961 | for (my $ln = $linenr - 1; $ln < $end; $ln++) { | 2287 | for (my $n = 0; $n < $cnt; $n++) { |
1962 | $herectx .= $rawlines[$ln] . "\n";; | 2288 | $herectx .= raw_line($linenr, $n) . "\n";; |
1963 | } | 2289 | } |
1964 | 2290 | ||
1965 | WARN("braces {} are not necessary for single statement blocks\n" . $herectx); | 2291 | WARN("braces {} are not necessary for single statement blocks\n" . $herectx); |
@@ -2001,7 +2327,14 @@ sub process { | |||
2001 | if ($prevline =~ /\bif\s*\(([^\)]*)\)/) { | 2327 | if ($prevline =~ /\bif\s*\(([^\)]*)\)/) { |
2002 | my $expr = $1; | 2328 | my $expr = $1; |
2003 | if ($line =~ /\bkfree\(\Q$expr\E\);/) { | 2329 | if ($line =~ /\bkfree\(\Q$expr\E\);/) { |
2004 | WARN("kfree(NULL) is safe this check is probabally not required\n" . $hereprev); | 2330 | WARN("kfree(NULL) is safe this check is probably not required\n" . $hereprev); |
2331 | } | ||
2332 | } | ||
2333 | # check for needless usb_free_urb() checks | ||
2334 | if ($prevline =~ /\bif\s*\(([^\)]*)\)/) { | ||
2335 | my $expr = $1; | ||
2336 | if ($line =~ /\busb_free_urb\(\Q$expr\E\);/) { | ||
2337 | WARN("usb_free_urb(NULL) is safe this check is probably not required\n" . $hereprev); | ||
2005 | } | 2338 | } |
2006 | } | 2339 | } |
2007 | 2340 | ||
@@ -2106,6 +2439,10 @@ sub process { | |||
2106 | if ($line =~ /\bsimple_(strto.*?)\s*\(/) { | 2439 | if ($line =~ /\bsimple_(strto.*?)\s*\(/) { |
2107 | WARN("consider using strict_$1 in preference to simple_$1\n" . $herecurr); | 2440 | WARN("consider using strict_$1 in preference to simple_$1\n" . $herecurr); |
2108 | } | 2441 | } |
2442 | # check for __initcall(), use device_initcall() explicitly please | ||
2443 | if ($line =~ /^.\s*__initcall\s*\(/) { | ||
2444 | WARN("please use device_initcall() instead of __initcall()\n" . $herecurr); | ||
2445 | } | ||
2109 | 2446 | ||
2110 | # use of NR_CPUS is usually wrong | 2447 | # use of NR_CPUS is usually wrong |
2111 | # ignore definitions of NR_CPUS and usage to define arrays as likely right | 2448 | # ignore definitions of NR_CPUS and usage to define arrays as likely right |
@@ -2123,6 +2460,7 @@ sub process { | |||
2123 | my $string; | 2460 | my $string; |
2124 | while ($line =~ /(?:^|")([X\t]*)(?:"|$)/g) { | 2461 | while ($line =~ /(?:^|")([X\t]*)(?:"|$)/g) { |
2125 | $string = substr($rawline, $-[1], $+[1] - $-[1]); | 2462 | $string = substr($rawline, $-[1], $+[1] - $-[1]); |
2463 | $string =~ s/%%/__/g; | ||
2126 | if ($string =~ /(?<!%)%L[udi]/) { | 2464 | if ($string =~ /(?<!%)%L[udi]/) { |
2127 | WARN("\%Ld/%Lu are not-standard C, use %lld/%llu\n" . $herecurr); | 2465 | WARN("\%Ld/%Lu are not-standard C, use %lld/%llu\n" . $herecurr); |
2128 | last; | 2466 | last; |
diff --git a/scripts/checkstack.pl b/scripts/checkstack.pl index 340ad6920511..14ee68e991dd 100755 --- a/scripts/checkstack.pl +++ b/scripts/checkstack.pl | |||
@@ -14,6 +14,7 @@ | |||
14 | # M68k port by Geert Uytterhoeven and Andreas Schwab | 14 | # M68k port by Geert Uytterhoeven and Andreas Schwab |
15 | # AVR32 port by Haavard Skinnemoen <hskinnemoen@atmel.com> | 15 | # AVR32 port by Haavard Skinnemoen <hskinnemoen@atmel.com> |
16 | # PARISC port by Kyle McMartin <kyle@parisc-linux.org> | 16 | # PARISC port by Kyle McMartin <kyle@parisc-linux.org> |
17 | # sparc port by Martin Habets <errandir_news@mph.eclipse.co.uk> | ||
17 | # | 18 | # |
18 | # Usage: | 19 | # Usage: |
19 | # objdump -d vmlinux | scripts/checkstack.pl [arch] | 20 | # objdump -d vmlinux | scripts/checkstack.pl [arch] |
@@ -26,12 +27,17 @@ | |||
26 | # $& (whole re) matches the complete objdump line with the stack growth | 27 | # $& (whole re) matches the complete objdump line with the stack growth |
27 | # $1 (first bracket) matches the size of the stack growth | 28 | # $1 (first bracket) matches the size of the stack growth |
28 | # | 29 | # |
30 | # $dre is similar, but for dynamic stack redutions: | ||
31 | # $& (whole re) matches the complete objdump line with the stack growth | ||
32 | # $1 (first bracket) matches the dynamic amount of the stack growth | ||
33 | # | ||
29 | # use anything else and feel the pain ;) | 34 | # use anything else and feel the pain ;) |
30 | my (@stack, $re, $x, $xs); | 35 | my (@stack, $re, $dre, $x, $xs); |
31 | { | 36 | { |
32 | my $arch = shift; | 37 | my $arch = shift; |
33 | if ($arch eq "") { | 38 | if ($arch eq "") { |
34 | $arch = `uname -m`; | 39 | $arch = `uname -m`; |
40 | chomp($arch); | ||
35 | } | 41 | } |
36 | 42 | ||
37 | $x = "[0-9a-f]"; # hex character | 43 | $x = "[0-9a-f]"; # hex character |
@@ -46,9 +52,11 @@ my (@stack, $re, $x, $xs); | |||
46 | } elsif ($arch =~ /^i[3456]86$/) { | 52 | } elsif ($arch =~ /^i[3456]86$/) { |
47 | #c0105234: 81 ec ac 05 00 00 sub $0x5ac,%esp | 53 | #c0105234: 81 ec ac 05 00 00 sub $0x5ac,%esp |
48 | $re = qr/^.*[as][du][db] \$(0x$x{1,8}),\%esp$/o; | 54 | $re = qr/^.*[as][du][db] \$(0x$x{1,8}),\%esp$/o; |
55 | $dre = qr/^.*[as][du][db] (%.*),\%esp$/o; | ||
49 | } elsif ($arch eq 'x86_64') { | 56 | } elsif ($arch eq 'x86_64') { |
50 | # 2f60: 48 81 ec e8 05 00 00 sub $0x5e8,%rsp | 57 | # 2f60: 48 81 ec e8 05 00 00 sub $0x5e8,%rsp |
51 | $re = qr/^.*[as][du][db] \$(0x$x{1,8}),\%rsp$/o; | 58 | $re = qr/^.*[as][du][db] \$(0x$x{1,8}),\%rsp$/o; |
59 | $dre = qr/^.*[as][du][db] (\%.*),\%rsp$/o; | ||
52 | } elsif ($arch eq 'ia64') { | 60 | } elsif ($arch eq 'ia64') { |
53 | #e0000000044011fc: 01 0f fc 8c adds r12=-384,r12 | 61 | #e0000000044011fc: 01 0f fc 8c adds r12=-384,r12 |
54 | $re = qr/.*adds.*r12=-(([0-9]{2}|[3-9])[0-9]{2}),r12/o; | 62 | $re = qr/.*adds.*r12=-(([0-9]{2}|[3-9])[0-9]{2}),r12/o; |
@@ -74,7 +82,10 @@ my (@stack, $re, $x, $xs); | |||
74 | $re = qr/.*st[dw]u.*r1,-($x{1,8})\(r1\)/o; | 82 | $re = qr/.*st[dw]u.*r1,-($x{1,8})\(r1\)/o; |
75 | } elsif ($arch =~ /^s390x?$/) { | 83 | } elsif ($arch =~ /^s390x?$/) { |
76 | # 11160: a7 fb ff 60 aghi %r15,-160 | 84 | # 11160: a7 fb ff 60 aghi %r15,-160 |
77 | $re = qr/.*ag?hi.*\%r15,-(([0-9]{2}|[3-9])[0-9]{2})/o; | 85 | # or |
86 | # 100092: e3 f0 ff c8 ff 71 lay %r15,-56(%r15) | ||
87 | $re = qr/.*(?:lay|ag?hi).*\%r15,-(([0-9]{2}|[3-9])[0-9]{2}) | ||
88 | (?:\(\%r15\))?$/ox; | ||
78 | } elsif ($arch =~ /^sh64$/) { | 89 | } elsif ($arch =~ /^sh64$/) { |
79 | #XXX: we only check for the immediate case presently, | 90 | #XXX: we only check for the immediate case presently, |
80 | # though we will want to check for the movi/sub | 91 | # though we will want to check for the movi/sub |
@@ -84,8 +95,11 @@ my (@stack, $re, $x, $xs); | |||
84 | } elsif ($arch =~ /^blackfin$/) { | 95 | } elsif ($arch =~ /^blackfin$/) { |
85 | # 0: 00 e8 38 01 LINK 0x4e0; | 96 | # 0: 00 e8 38 01 LINK 0x4e0; |
86 | $re = qr/.*[[:space:]]LINK[[:space:]]*(0x$x{1,8})/o; | 97 | $re = qr/.*[[:space:]]LINK[[:space:]]*(0x$x{1,8})/o; |
98 | } elsif ($arch eq 'sparc' || $arch eq 'sparc64') { | ||
99 | # f0019d10: 9d e3 bf 90 save %sp, -112, %sp | ||
100 | $re = qr/.*save.*%sp, -(([0-9]{2}|[3-9])[0-9]{2}), %sp/o; | ||
87 | } else { | 101 | } else { |
88 | print("wrong or unknown architecture\n"); | 102 | print("wrong or unknown architecture \"$arch\"\n"); |
89 | exit | 103 | exit |
90 | } | 104 | } |
91 | } | 105 | } |
@@ -141,6 +155,22 @@ while (my $line = <STDIN>) { | |||
141 | next if ($size < 100); | 155 | next if ($size < 100); |
142 | push @stack, "$intro$size\n"; | 156 | push @stack, "$intro$size\n"; |
143 | } | 157 | } |
158 | elsif (defined $dre && $line =~ m/$dre/) { | ||
159 | my $size = "Dynamic ($1)"; | ||
160 | |||
161 | next if $line !~ m/^($xs*)/; | ||
162 | my $addr = $1; | ||
163 | $addr =~ s/ /0/g; | ||
164 | $addr = "0x$addr"; | ||
165 | |||
166 | my $intro = "$addr $func [$file]:"; | ||
167 | my $padlen = 56 - length($intro); | ||
168 | while ($padlen > 0) { | ||
169 | $intro .= ' '; | ||
170 | $padlen -= 8; | ||
171 | } | ||
172 | push @stack, "$intro$size\n"; | ||
173 | } | ||
144 | } | 174 | } |
145 | 175 | ||
146 | print sort bysize @stack; | 176 | print sort bysize @stack; |
diff --git a/scripts/checksyscalls.sh b/scripts/checksyscalls.sh index 366f8c7f62bf..41564b142c04 100755 --- a/scripts/checksyscalls.sh +++ b/scripts/checksyscalls.sh | |||
@@ -119,5 +119,5 @@ sed -n -e '/^\#define/ { s/[^_]*__NR_\([^[:space:]]*\).*/\ | |||
119 | \#endif/p }' $1 | 119 | \#endif/p }' $1 |
120 | } | 120 | } |
121 | 121 | ||
122 | (ignore_list && syscall_list ${srctree}/include/asm-x86/unistd_32.h) | \ | 122 | (ignore_list && syscall_list ${srctree}/arch/x86/include/asm/unistd_32.h) | \ |
123 | $* -E -x c - > /dev/null | 123 | $* -E -x c - > /dev/null |
diff --git a/scripts/diffconfig b/scripts/diffconfig new file mode 100755 index 000000000000..b91f3e34d44d --- /dev/null +++ b/scripts/diffconfig | |||
@@ -0,0 +1,129 @@ | |||
1 | #!/usr/bin/python | ||
2 | # | ||
3 | # diffconfig - a tool to compare .config files. | ||
4 | # | ||
5 | # originally written in 2006 by Matt Mackall | ||
6 | # (at least, this was in his bloatwatch source code) | ||
7 | # last worked on 2008 by Tim Bird | ||
8 | # | ||
9 | |||
10 | import sys, os | ||
11 | |||
12 | def usage(): | ||
13 | print """Usage: diffconfig [-h] [-m] [<config1> <config2>] | ||
14 | |||
15 | Diffconfig is a simple utility for comparing two .config files. | ||
16 | Using standard diff to compare .config files often includes extraneous and | ||
17 | distracting information. This utility produces sorted output with only the | ||
18 | changes in configuration values between the two files. | ||
19 | |||
20 | Added and removed items are shown with a leading plus or minus, respectively. | ||
21 | Changed items show the old and new values on a single line. | ||
22 | |||
23 | If -m is specified, then output will be in "merge" style, which has the | ||
24 | changed and new values in kernel config option format. | ||
25 | |||
26 | If no config files are specified, .config and .config.old are used. | ||
27 | |||
28 | Example usage: | ||
29 | $ diffconfig .config config-with-some-changes | ||
30 | -EXT2_FS_XATTR n | ||
31 | -EXT2_FS_XIP n | ||
32 | CRAMFS n -> y | ||
33 | EXT2_FS y -> n | ||
34 | LOG_BUF_SHIFT 14 -> 16 | ||
35 | PRINTK_TIME n -> y | ||
36 | """ | ||
37 | sys.exit(0) | ||
38 | |||
39 | # returns a dictionary of name/value pairs for config items in the file | ||
40 | def readconfig(config_file): | ||
41 | d = {} | ||
42 | for line in config_file: | ||
43 | line = line[:-1] | ||
44 | if line[:7] == "CONFIG_": | ||
45 | name, val = line[7:].split("=", 1) | ||
46 | d[name] = val | ||
47 | if line[-11:] == " is not set": | ||
48 | d[line[9:-11]] = "n" | ||
49 | return d | ||
50 | |||
51 | def print_config(op, config, value, new_value): | ||
52 | global merge_style | ||
53 | |||
54 | if merge_style: | ||
55 | if new_value: | ||
56 | if new_value=="n": | ||
57 | print "# CONFIG_%s is not set" % config | ||
58 | else: | ||
59 | print "CONFIG_%s=%s" % (config, new_value) | ||
60 | else: | ||
61 | if op=="-": | ||
62 | print "-%s %s" % (config, value) | ||
63 | elif op=="+": | ||
64 | print "+%s %s" % (config, new_value) | ||
65 | else: | ||
66 | print " %s %s -> %s" % (config, value, new_value) | ||
67 | |||
68 | def main(): | ||
69 | global merge_style | ||
70 | |||
71 | # parse command line args | ||
72 | if ("-h" in sys.argv or "--help" in sys.argv): | ||
73 | usage() | ||
74 | |||
75 | merge_style = 0 | ||
76 | if "-m" in sys.argv: | ||
77 | merge_style = 1 | ||
78 | sys.argv.remove("-m") | ||
79 | |||
80 | argc = len(sys.argv) | ||
81 | if not (argc==1 or argc == 3): | ||
82 | print "Error: incorrect number of arguments or unrecognized option" | ||
83 | usage() | ||
84 | |||
85 | if argc == 1: | ||
86 | # if no filenames given, assume .config and .config.old | ||
87 | build_dir="" | ||
88 | if os.environ.has_key("KBUILD_OUTPUT"): | ||
89 | build_dir = os.environ["KBUILD_OUTPUT"]+"/" | ||
90 | |||
91 | configa_filename = build_dir + ".config.old" | ||
92 | configb_filename = build_dir + ".config" | ||
93 | else: | ||
94 | configa_filename = sys.argv[1] | ||
95 | configb_filename = sys.argv[2] | ||
96 | |||
97 | a = readconfig(file(configa_filename)) | ||
98 | b = readconfig(file(configb_filename)) | ||
99 | |||
100 | # print items in a but not b (accumulate, sort and print) | ||
101 | old = [] | ||
102 | for config in a: | ||
103 | if config not in b: | ||
104 | old.append(config) | ||
105 | old.sort() | ||
106 | for config in old: | ||
107 | print_config("-", config, a[config], None) | ||
108 | del a[config] | ||
109 | |||
110 | # print items that changed (accumulate, sort, and print) | ||
111 | changed = [] | ||
112 | for config in a: | ||
113 | if a[config] != b[config]: | ||
114 | changed.append(config) | ||
115 | else: | ||
116 | del b[config] | ||
117 | changed.sort() | ||
118 | for config in changed: | ||
119 | print_config("->", config, a[config], b[config]) | ||
120 | del b[config] | ||
121 | |||
122 | # now print items in b but not in a | ||
123 | # (items from b that were in a were removed above) | ||
124 | new = b.keys() | ||
125 | new.sort() | ||
126 | for config in new: | ||
127 | print_config("+", config, None, b[config]) | ||
128 | |||
129 | main() | ||
diff --git a/scripts/genksyms/genksyms.c b/scripts/genksyms/genksyms.c index dca5e0dd09bf..c249274e005a 100644 --- a/scripts/genksyms/genksyms.c +++ b/scripts/genksyms/genksyms.c | |||
@@ -520,8 +520,7 @@ int main(int argc, char **argv) | |||
520 | genksyms_usage(); | 520 | genksyms_usage(); |
521 | return 1; | 521 | return 1; |
522 | } | 522 | } |
523 | if ((strcmp(arch, "v850") == 0) || (strcmp(arch, "h8300") == 0) | 523 | if ((strcmp(arch, "h8300") == 0) || (strcmp(arch, "blackfin") == 0)) |
524 | || (strcmp(arch, "blackfin") == 0)) | ||
525 | mod_prefix = "_"; | 524 | mod_prefix = "_"; |
526 | { | 525 | { |
527 | extern int yydebug; | 526 | extern int yydebug; |
@@ -546,6 +545,8 @@ int main(int argc, char **argv) | |||
546 | } | 545 | } |
547 | fputs(sym->name, dumpfile); | 546 | fputs(sym->name, dumpfile); |
548 | putc(' ', dumpfile); | 547 | putc(' ', dumpfile); |
548 | if (sym->is_extern) | ||
549 | fputs("extern ", dumpfile); | ||
549 | print_list(dumpfile, sym->defn); | 550 | print_list(dumpfile, sym->defn); |
550 | putc('\n', dumpfile); | 551 | putc('\n', dumpfile); |
551 | 552 | ||
diff --git a/scripts/genksyms/lex.c_shipped b/scripts/genksyms/lex.c_shipped index 2a176988d468..2ac23bcca5b5 100644 --- a/scripts/genksyms/lex.c_shipped +++ b/scripts/genksyms/lex.c_shipped | |||
@@ -6,10 +6,19 @@ | |||
6 | 6 | ||
7 | /* A lexical scanner generated by flex */ | 7 | /* A lexical scanner generated by flex */ |
8 | 8 | ||
9 | /* %not-for-header */ | ||
10 | |||
11 | /* %if-c-only */ | ||
12 | /* %if-not-reentrant */ | ||
13 | |||
14 | /* %endif */ | ||
15 | /* %endif */ | ||
16 | /* %ok-for-header */ | ||
17 | |||
9 | #define FLEX_SCANNER | 18 | #define FLEX_SCANNER |
10 | #define YY_FLEX_MAJOR_VERSION 2 | 19 | #define YY_FLEX_MAJOR_VERSION 2 |
11 | #define YY_FLEX_MINOR_VERSION 5 | 20 | #define YY_FLEX_MINOR_VERSION 5 |
12 | #define YY_FLEX_SUBMINOR_VERSION 33 | 21 | #define YY_FLEX_SUBMINOR_VERSION 35 |
13 | #if YY_FLEX_SUBMINOR_VERSION > 0 | 22 | #if YY_FLEX_SUBMINOR_VERSION > 0 |
14 | #define FLEX_BETA | 23 | #define FLEX_BETA |
15 | #endif | 24 | #endif |
@@ -47,7 +56,7 @@ | |||
47 | 56 | ||
48 | /* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */ | 57 | /* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */ |
49 | 58 | ||
50 | #if __STDC_VERSION__ >= 199901L | 59 | #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L |
51 | 60 | ||
52 | /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, | 61 | /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, |
53 | * if you want the limit (max/min) macros for int types. | 62 | * if you want the limit (max/min) macros for int types. |
@@ -70,7 +79,6 @@ typedef int flex_int32_t; | |||
70 | typedef unsigned char flex_uint8_t; | 79 | typedef unsigned char flex_uint8_t; |
71 | typedef unsigned short int flex_uint16_t; | 80 | typedef unsigned short int flex_uint16_t; |
72 | typedef unsigned int flex_uint32_t; | 81 | typedef unsigned int flex_uint32_t; |
73 | #endif /* ! C99 */ | ||
74 | 82 | ||
75 | /* Limits of integral types. */ | 83 | /* Limits of integral types. */ |
76 | #ifndef INT8_MIN | 84 | #ifndef INT8_MIN |
@@ -101,6 +109,8 @@ typedef unsigned int flex_uint32_t; | |||
101 | #define UINT32_MAX (4294967295U) | 109 | #define UINT32_MAX (4294967295U) |
102 | #endif | 110 | #endif |
103 | 111 | ||
112 | #endif /* ! C99 */ | ||
113 | |||
104 | #endif /* ! FLEXINT_H */ | 114 | #endif /* ! FLEXINT_H */ |
105 | 115 | ||
106 | /* %endif */ | 116 | /* %endif */ |
@@ -115,11 +125,12 @@ typedef unsigned int flex_uint32_t; | |||
115 | 125 | ||
116 | #else /* ! __cplusplus */ | 126 | #else /* ! __cplusplus */ |
117 | 127 | ||
118 | #if __STDC__ | 128 | /* C99 requires __STDC__ to be defined as 1. */ |
129 | #if defined (__STDC__) | ||
119 | 130 | ||
120 | #define YY_USE_CONST | 131 | #define YY_USE_CONST |
121 | 132 | ||
122 | #endif /* __STDC__ */ | 133 | #endif /* defined (__STDC__) */ |
123 | #endif /* ! __cplusplus */ | 134 | #endif /* ! __cplusplus */ |
124 | 135 | ||
125 | #ifdef YY_USE_CONST | 136 | #ifdef YY_USE_CONST |
@@ -218,14 +229,9 @@ extern FILE *yyin, *yyout; | |||
218 | 229 | ||
219 | #define unput(c) yyunput( c, (yytext_ptr) ) | 230 | #define unput(c) yyunput( c, (yytext_ptr) ) |
220 | 231 | ||
221 | /* The following is because we cannot portably get our hands on size_t | ||
222 | * (without autoconf's help, which isn't available because we want | ||
223 | * flex-generated scanners to compile on their own). | ||
224 | */ | ||
225 | |||
226 | #ifndef YY_TYPEDEF_YY_SIZE_T | 232 | #ifndef YY_TYPEDEF_YY_SIZE_T |
227 | #define YY_TYPEDEF_YY_SIZE_T | 233 | #define YY_TYPEDEF_YY_SIZE_T |
228 | typedef unsigned int yy_size_t; | 234 | typedef size_t yy_size_t; |
229 | #endif | 235 | #endif |
230 | 236 | ||
231 | #ifndef YY_STRUCT_YY_BUFFER_STATE | 237 | #ifndef YY_STRUCT_YY_BUFFER_STATE |
@@ -401,7 +407,7 @@ void yyfree (void * ); | |||
401 | /* %% [1.0] yytext/yyin/yyout/yy_state_type/yylineno etc. def's & init go here */ | 407 | /* %% [1.0] yytext/yyin/yyout/yy_state_type/yylineno etc. def's & init go here */ |
402 | /* Begin user sect3 */ | 408 | /* Begin user sect3 */ |
403 | 409 | ||
404 | #define yywrap() 1 | 410 | #define yywrap(n) 1 |
405 | #define YY_SKIP_YYWRAP | 411 | #define YY_SKIP_YYWRAP |
406 | 412 | ||
407 | #define FLEX_DEBUG | 413 | #define FLEX_DEBUG |
@@ -613,8 +619,8 @@ int yy_flex_debug = 1; | |||
613 | 619 | ||
614 | static yyconst flex_int16_t yy_rule_linenum[13] = | 620 | static yyconst flex_int16_t yy_rule_linenum[13] = |
615 | { 0, | 621 | { 0, |
616 | 69, 70, 71, 74, 77, 78, 79, 85, 86, 87, | 622 | 71, 72, 73, 76, 79, 80, 81, 87, 88, 89, |
617 | 89, 92 | 623 | 91, 94 |
618 | } ; | 624 | } ; |
619 | 625 | ||
620 | /* The intent behind this definition is that it'll catch | 626 | /* The intent behind this definition is that it'll catch |
@@ -665,7 +671,8 @@ char *yytext; | |||
665 | quite so pedantic. */ | 671 | quite so pedantic. */ |
666 | 672 | ||
667 | /* We don't do multiple input files. */ | 673 | /* We don't do multiple input files. */ |
668 | #line 669 "scripts/genksyms/lex.c" | 674 | #define YY_NO_INPUT 1 |
675 | #line 676 "scripts/genksyms/lex.c" | ||
669 | 676 | ||
670 | #define INITIAL 0 | 677 | #define INITIAL 0 |
671 | #define V2_TOKENS 1 | 678 | #define V2_TOKENS 1 |
@@ -695,9 +702,39 @@ static int yy_init_globals (void ); | |||
695 | /* %endif */ | 702 | /* %endif */ |
696 | /* %if-reentrant */ | 703 | /* %if-reentrant */ |
697 | /* %endif */ | 704 | /* %endif */ |
705 | /* %endif End reentrant structures and macros. */ | ||
706 | |||
707 | /* Accessor methods to globals. | ||
708 | These are made visible to non-reentrant scanners for convenience. */ | ||
709 | |||
710 | int yylex_destroy (void ); | ||
711 | |||
712 | int yyget_debug (void ); | ||
713 | |||
714 | void yyset_debug (int debug_flag ); | ||
715 | |||
716 | YY_EXTRA_TYPE yyget_extra (void ); | ||
717 | |||
718 | void yyset_extra (YY_EXTRA_TYPE user_defined ); | ||
719 | |||
720 | FILE *yyget_in (void ); | ||
721 | |||
722 | void yyset_in (FILE * in_str ); | ||
723 | |||
724 | FILE *yyget_out (void ); | ||
725 | |||
726 | void yyset_out (FILE * out_str ); | ||
727 | |||
728 | int yyget_leng (void ); | ||
729 | |||
730 | char *yyget_text (void ); | ||
731 | |||
732 | int yyget_lineno (void ); | ||
733 | |||
734 | void yyset_lineno (int line_number ); | ||
735 | |||
698 | /* %if-bison-bridge */ | 736 | /* %if-bison-bridge */ |
699 | /* %endif */ | 737 | /* %endif */ |
700 | /* %endif End reentrant structures and macros. */ | ||
701 | 738 | ||
702 | /* Macros after this point can all be overridden by user definitions in | 739 | /* Macros after this point can all be overridden by user definitions in |
703 | * section 1. | 740 | * section 1. |
@@ -756,7 +793,7 @@ static int input (void ); | |||
756 | /* This used to be an fputs(), but since the string might contain NUL's, | 793 | /* This used to be an fputs(), but since the string might contain NUL's, |
757 | * we now use fwrite(). | 794 | * we now use fwrite(). |
758 | */ | 795 | */ |
759 | #define ECHO (void) fwrite( yytext, yyleng, 1, yyout ) | 796 | #define ECHO fwrite( yytext, yyleng, 1, yyout ) |
760 | /* %endif */ | 797 | /* %endif */ |
761 | /* %if-c++-only C++ definition */ | 798 | /* %if-c++-only C++ definition */ |
762 | /* %endif */ | 799 | /* %endif */ |
@@ -881,12 +918,12 @@ YY_DECL | |||
881 | register int yy_act; | 918 | register int yy_act; |
882 | 919 | ||
883 | /* %% [7.0] user's declarations go here */ | 920 | /* %% [7.0] user's declarations go here */ |
884 | #line 65 "scripts/genksyms/lex.l" | 921 | #line 67 "scripts/genksyms/lex.l" |
885 | 922 | ||
886 | 923 | ||
887 | 924 | ||
888 | /* Keep track of our location in the original source files. */ | 925 | /* Keep track of our location in the original source files. */ |
889 | #line 890 "scripts/genksyms/lex.c" | 926 | #line 927 "scripts/genksyms/lex.c" |
890 | 927 | ||
891 | if ( !(yy_init) ) | 928 | if ( !(yy_init) ) |
892 | { | 929 | { |
@@ -1004,42 +1041,42 @@ do_action: /* This label is used only to access EOF actions. */ | |||
1004 | case 1: | 1041 | case 1: |
1005 | /* rule 1 can match eol */ | 1042 | /* rule 1 can match eol */ |
1006 | YY_RULE_SETUP | 1043 | YY_RULE_SETUP |
1007 | #line 69 "scripts/genksyms/lex.l" | 1044 | #line 71 "scripts/genksyms/lex.l" |
1008 | return FILENAME; | 1045 | return FILENAME; |
1009 | YY_BREAK | 1046 | YY_BREAK |
1010 | case 2: | 1047 | case 2: |
1011 | /* rule 2 can match eol */ | 1048 | /* rule 2 can match eol */ |
1012 | YY_RULE_SETUP | 1049 | YY_RULE_SETUP |
1013 | #line 70 "scripts/genksyms/lex.l" | 1050 | #line 72 "scripts/genksyms/lex.l" |
1014 | cur_line++; | 1051 | cur_line++; |
1015 | YY_BREAK | 1052 | YY_BREAK |
1016 | case 3: | 1053 | case 3: |
1017 | /* rule 3 can match eol */ | 1054 | /* rule 3 can match eol */ |
1018 | YY_RULE_SETUP | 1055 | YY_RULE_SETUP |
1019 | #line 71 "scripts/genksyms/lex.l" | 1056 | #line 73 "scripts/genksyms/lex.l" |
1020 | cur_line++; | 1057 | cur_line++; |
1021 | YY_BREAK | 1058 | YY_BREAK |
1022 | /* Ignore all other whitespace. */ | 1059 | /* Ignore all other whitespace. */ |
1023 | case 4: | 1060 | case 4: |
1024 | YY_RULE_SETUP | 1061 | YY_RULE_SETUP |
1025 | #line 74 "scripts/genksyms/lex.l" | 1062 | #line 76 "scripts/genksyms/lex.l" |
1026 | ; | 1063 | ; |
1027 | YY_BREAK | 1064 | YY_BREAK |
1028 | case 5: | 1065 | case 5: |
1029 | /* rule 5 can match eol */ | 1066 | /* rule 5 can match eol */ |
1030 | YY_RULE_SETUP | 1067 | YY_RULE_SETUP |
1031 | #line 77 "scripts/genksyms/lex.l" | 1068 | #line 79 "scripts/genksyms/lex.l" |
1032 | return STRING; | 1069 | return STRING; |
1033 | YY_BREAK | 1070 | YY_BREAK |
1034 | case 6: | 1071 | case 6: |
1035 | /* rule 6 can match eol */ | 1072 | /* rule 6 can match eol */ |
1036 | YY_RULE_SETUP | 1073 | YY_RULE_SETUP |
1037 | #line 78 "scripts/genksyms/lex.l" | 1074 | #line 80 "scripts/genksyms/lex.l" |
1038 | return CHAR; | 1075 | return CHAR; |
1039 | YY_BREAK | 1076 | YY_BREAK |
1040 | case 7: | 1077 | case 7: |
1041 | YY_RULE_SETUP | 1078 | YY_RULE_SETUP |
1042 | #line 79 "scripts/genksyms/lex.l" | 1079 | #line 81 "scripts/genksyms/lex.l" |
1043 | return IDENT; | 1080 | return IDENT; |
1044 | YY_BREAK | 1081 | YY_BREAK |
1045 | /* The Pedant requires that the other C multi-character tokens be | 1082 | /* The Pedant requires that the other C multi-character tokens be |
@@ -1048,36 +1085,36 @@ return IDENT; | |||
1048 | around them properly. */ | 1085 | around them properly. */ |
1049 | case 8: | 1086 | case 8: |
1050 | YY_RULE_SETUP | 1087 | YY_RULE_SETUP |
1051 | #line 85 "scripts/genksyms/lex.l" | 1088 | #line 87 "scripts/genksyms/lex.l" |
1052 | return OTHER; | 1089 | return OTHER; |
1053 | YY_BREAK | 1090 | YY_BREAK |
1054 | case 9: | 1091 | case 9: |
1055 | YY_RULE_SETUP | 1092 | YY_RULE_SETUP |
1056 | #line 86 "scripts/genksyms/lex.l" | 1093 | #line 88 "scripts/genksyms/lex.l" |
1057 | return INT; | 1094 | return INT; |
1058 | YY_BREAK | 1095 | YY_BREAK |
1059 | case 10: | 1096 | case 10: |
1060 | YY_RULE_SETUP | 1097 | YY_RULE_SETUP |
1061 | #line 87 "scripts/genksyms/lex.l" | 1098 | #line 89 "scripts/genksyms/lex.l" |
1062 | return REAL; | 1099 | return REAL; |
1063 | YY_BREAK | 1100 | YY_BREAK |
1064 | case 11: | 1101 | case 11: |
1065 | YY_RULE_SETUP | 1102 | YY_RULE_SETUP |
1066 | #line 89 "scripts/genksyms/lex.l" | 1103 | #line 91 "scripts/genksyms/lex.l" |
1067 | return DOTS; | 1104 | return DOTS; |
1068 | YY_BREAK | 1105 | YY_BREAK |
1069 | /* All other tokens are single characters. */ | 1106 | /* All other tokens are single characters. */ |
1070 | case 12: | 1107 | case 12: |
1071 | YY_RULE_SETUP | 1108 | YY_RULE_SETUP |
1072 | #line 92 "scripts/genksyms/lex.l" | 1109 | #line 94 "scripts/genksyms/lex.l" |
1073 | return yytext[0]; | 1110 | return yytext[0]; |
1074 | YY_BREAK | 1111 | YY_BREAK |
1075 | case 13: | 1112 | case 13: |
1076 | YY_RULE_SETUP | 1113 | YY_RULE_SETUP |
1077 | #line 95 "scripts/genksyms/lex.l" | 1114 | #line 97 "scripts/genksyms/lex.l" |
1078 | ECHO; | 1115 | ECHO; |
1079 | YY_BREAK | 1116 | YY_BREAK |
1080 | #line 1081 "scripts/genksyms/lex.c" | 1117 | #line 1118 "scripts/genksyms/lex.c" |
1081 | case YY_STATE_EOF(INITIAL): | 1118 | case YY_STATE_EOF(INITIAL): |
1082 | case YY_STATE_EOF(V2_TOKENS): | 1119 | case YY_STATE_EOF(V2_TOKENS): |
1083 | yyterminate(); | 1120 | yyterminate(); |
@@ -1346,6 +1383,14 @@ static int yy_get_next_buffer (void) | |||
1346 | else | 1383 | else |
1347 | ret_val = EOB_ACT_CONTINUE_SCAN; | 1384 | ret_val = EOB_ACT_CONTINUE_SCAN; |
1348 | 1385 | ||
1386 | if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { | ||
1387 | /* Extend the array by 50%, plus the number we really need. */ | ||
1388 | yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1); | ||
1389 | YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ); | ||
1390 | if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) | ||
1391 | YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); | ||
1392 | } | ||
1393 | |||
1349 | (yy_n_chars) += number_to_move; | 1394 | (yy_n_chars) += number_to_move; |
1350 | YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR; | 1395 | YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR; |
1351 | YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR; | 1396 | YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR; |
@@ -1851,7 +1896,9 @@ static void yyensure_buffer_stack (void) | |||
1851 | (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc | 1896 | (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc |
1852 | (num_to_alloc * sizeof(struct yy_buffer_state*) | 1897 | (num_to_alloc * sizeof(struct yy_buffer_state*) |
1853 | ); | 1898 | ); |
1854 | 1899 | if ( ! (yy_buffer_stack) ) | |
1900 | YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); | ||
1901 | |||
1855 | memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); | 1902 | memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); |
1856 | 1903 | ||
1857 | (yy_buffer_stack_max) = num_to_alloc; | 1904 | (yy_buffer_stack_max) = num_to_alloc; |
@@ -1869,6 +1916,8 @@ static void yyensure_buffer_stack (void) | |||
1869 | ((yy_buffer_stack), | 1916 | ((yy_buffer_stack), |
1870 | num_to_alloc * sizeof(struct yy_buffer_state*) | 1917 | num_to_alloc * sizeof(struct yy_buffer_state*) |
1871 | ); | 1918 | ); |
1919 | if ( ! (yy_buffer_stack) ) | ||
1920 | YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); | ||
1872 | 1921 | ||
1873 | /* zero only the new slots.*/ | 1922 | /* zero only the new slots.*/ |
1874 | memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*)); | 1923 | memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*)); |
@@ -2092,7 +2141,7 @@ void yyset_debug (int bdebug ) | |||
2092 | /* %if-reentrant */ | 2141 | /* %if-reentrant */ |
2093 | /* %if-bison-bridge */ | 2142 | /* %if-bison-bridge */ |
2094 | /* %endif */ | 2143 | /* %endif */ |
2095 | /* %endif */ | 2144 | /* %endif if-c-only */ |
2096 | 2145 | ||
2097 | /* %if-c-only */ | 2146 | /* %if-c-only */ |
2098 | static int yy_init_globals (void) | 2147 | static int yy_init_globals (void) |
@@ -2124,13 +2173,9 @@ static int yy_init_globals (void) | |||
2124 | } | 2173 | } |
2125 | /* %endif */ | 2174 | /* %endif */ |
2126 | 2175 | ||
2127 | /* %if-c-or-c++ */ | 2176 | /* %if-c-only SNIP! this currently causes conflicts with the c++ scanner */ |
2128 | /* %if-c-only */ | ||
2129 | /* yylex_destroy is for both reentrant and non-reentrant scanners. */ | 2177 | /* yylex_destroy is for both reentrant and non-reentrant scanners. */ |
2130 | int yylex_destroy (void) | 2178 | int yylex_destroy (void) |
2131 | /* %endif */ | ||
2132 | /* %if-c++-only */ | ||
2133 | /* %endif */ | ||
2134 | { | 2179 | { |
2135 | 2180 | ||
2136 | /* Pop the buffer stack, destroying each element. */ | 2181 | /* Pop the buffer stack, destroying each element. */ |
@@ -2144,11 +2189,6 @@ int yylex_destroy (void) | |||
2144 | yyfree((yy_buffer_stack) ); | 2189 | yyfree((yy_buffer_stack) ); |
2145 | (yy_buffer_stack) = NULL; | 2190 | (yy_buffer_stack) = NULL; |
2146 | 2191 | ||
2147 | /* %if-c++-only */ | ||
2148 | /* %endif */ | ||
2149 | |||
2150 | /* %if-c-only */ | ||
2151 | |||
2152 | /* Reset the globals. This is important in a non-reentrant scanner so the next time | 2192 | /* Reset the globals. This is important in a non-reentrant scanner so the next time |
2153 | * yylex() is called, initialization will occur. */ | 2193 | * yylex() is called, initialization will occur. */ |
2154 | yy_init_globals( ); | 2194 | yy_init_globals( ); |
@@ -2156,7 +2196,6 @@ int yylex_destroy (void) | |||
2156 | /* %if-reentrant */ | 2196 | /* %if-reentrant */ |
2157 | /* %endif */ | 2197 | /* %endif */ |
2158 | return 0; | 2198 | return 0; |
2159 | /* %endif */ | ||
2160 | } | 2199 | } |
2161 | /* %endif */ | 2200 | /* %endif */ |
2162 | 2201 | ||
@@ -2213,7 +2252,7 @@ void yyfree (void * ptr ) | |||
2213 | 2252 | ||
2214 | /* %ok-for-header */ | 2253 | /* %ok-for-header */ |
2215 | 2254 | ||
2216 | #line 95 "scripts/genksyms/lex.l" | 2255 | #line 97 "scripts/genksyms/lex.l" |
2217 | 2256 | ||
2218 | 2257 | ||
2219 | 2258 | ||
diff --git a/scripts/genksyms/lex.l b/scripts/genksyms/lex.l index 5e544a06678b..fe50ff9dacd0 100644 --- a/scripts/genksyms/lex.l +++ b/scripts/genksyms/lex.l | |||
@@ -62,6 +62,8 @@ MC_TOKEN ([~%^&*+=|<>/-]=)|(&&)|("||")|(->)|(<<)|(>>) | |||
62 | /* We don't do multiple input files. */ | 62 | /* We don't do multiple input files. */ |
63 | %option noyywrap | 63 | %option noyywrap |
64 | 64 | ||
65 | %option noinput | ||
66 | |||
65 | %% | 67 | %% |
66 | 68 | ||
67 | 69 | ||
diff --git a/scripts/genksyms/parse.c_shipped b/scripts/genksyms/parse.c_shipped index 3e6079f36b9f..eaee44e66a43 100644 --- a/scripts/genksyms/parse.c_shipped +++ b/scripts/genksyms/parse.c_shipped | |||
@@ -504,7 +504,7 @@ static const yytype_uint16 yyprhs[] = | |||
504 | 239, 242, 245, 247, 248, 250, 252, 257, 262, 265, | 504 | 239, 242, 245, 247, 248, 250, 252, 257, 262, 265, |
505 | 269, 273, 277, 278, 280, 283, 287, 291, 292, 294, | 505 | 269, 273, 277, 278, 280, 283, 287, 291, 292, 294, |
506 | 296, 299, 303, 306, 307, 309, 311, 315, 318, 321, | 506 | 296, 299, 303, 306, 307, 309, 311, 315, 318, 321, |
507 | 323, 326, 327, 329, 332, 333, 335 | 507 | 323, 326, 327, 330, 333, 334, 336 |
508 | }; | 508 | }; |
509 | 509 | ||
510 | /* YYRHS -- A `-1'-separated list of the rules' RHS. */ | 510 | /* YYRHS -- A `-1'-separated list of the rules' RHS. */ |
@@ -542,9 +542,9 @@ static const yytype_int8 yyrhs[] = | |||
542 | -1, -1, 89, -1, 90, -1, 89, 90, -1, 64, | 542 | -1, -1, 89, -1, 90, -1, 89, 90, -1, 64, |
543 | 91, 44, -1, 1, 44, -1, -1, 92, -1, 93, | 543 | 91, 44, -1, 1, 44, -1, -1, 92, -1, 93, |
544 | -1, 92, 46, 93, -1, 76, 95, -1, 37, 94, | 544 | -1, 92, 46, 93, -1, 76, 95, -1, 37, 94, |
545 | -1, 94, -1, 52, 34, -1, -1, 31, -1, 30, | 545 | -1, 94, -1, 52, 34, -1, -1, 95, 31, -1, |
546 | 44, -1, -1, 30, -1, 29, 47, 37, 49, 44, | 546 | 30, 44, -1, -1, 30, -1, 29, 47, 37, 49, |
547 | -1 | 547 | 44, -1 |
548 | }; | 548 | }; |
549 | 549 | ||
550 | /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ | 550 | /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ |
@@ -647,7 +647,7 @@ static const yytype_uint8 yyr2[] = | |||
647 | 2, 2, 1, 0, 1, 1, 4, 4, 2, 3, | 647 | 2, 2, 1, 0, 1, 1, 4, 4, 2, 3, |
648 | 3, 3, 0, 1, 2, 3, 3, 0, 1, 1, | 648 | 3, 3, 0, 1, 2, 3, 3, 0, 1, 1, |
649 | 2, 3, 2, 0, 1, 1, 3, 2, 2, 1, | 649 | 2, 3, 2, 0, 1, 1, 3, 2, 2, 1, |
650 | 2, 0, 1, 2, 0, 1, 5 | 650 | 2, 0, 2, 2, 0, 1, 5 |
651 | }; | 651 | }; |
652 | 652 | ||
653 | /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state | 653 | /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state |
@@ -667,9 +667,9 @@ static const yytype_uint8 yydefact[] = | |||
667 | 0, 66, 125, 101, 121, 71, 0, 7, 112, 106, | 667 | 0, 66, 125, 101, 121, 71, 0, 7, 112, 106, |
668 | 76, 77, 0, 0, 0, 121, 75, 0, 114, 115, | 668 | 76, 77, 0, 0, 0, 121, 75, 0, 114, 115, |
669 | 119, 105, 0, 110, 124, 0, 36, 0, 73, 72, | 669 | 119, 105, 0, 110, 124, 0, 36, 0, 73, 72, |
670 | 61, 20, 122, 102, 0, 93, 0, 84, 87, 88, | 670 | 61, 20, 102, 0, 93, 0, 84, 87, 88, 118, |
671 | 118, 0, 76, 0, 120, 74, 117, 80, 0, 111, | 671 | 0, 76, 0, 120, 74, 117, 80, 0, 111, 0, |
672 | 0, 35, 126, 0, 21, 103, 70, 94, 56, 0, | 672 | 35, 126, 122, 0, 21, 103, 70, 94, 56, 0, |
673 | 93, 90, 92, 69, 83, 0, 82, 81, 0, 0, | 673 | 93, 90, 92, 69, 83, 0, 82, 81, 0, 0, |
674 | 116, 104, 0, 95, 0, 91, 98, 0, 85, 89, | 674 | 116, 104, 0, 95, 0, 91, 98, 0, 85, 89, |
675 | 79, 78, 100, 99, 0, 0, 97, 96 | 675 | 79, 78, 100, 99, 0, 0, 97, 96 |
@@ -680,44 +680,44 @@ static const yytype_int16 yydefgoto[] = | |||
680 | { | 680 | { |
681 | -1, 1, 2, 3, 35, 72, 55, 36, 64, 65, | 681 | -1, 1, 2, 3, 35, 72, 55, 36, 64, 65, |
682 | 66, 75, 38, 39, 40, 41, 42, 67, 86, 87, | 682 | 66, 75, 38, 39, 40, 41, 42, 67, 86, 87, |
683 | 43, 114, 69, 105, 106, 126, 127, 128, 129, 151, | 683 | 43, 114, 69, 105, 106, 125, 126, 127, 128, 151, |
684 | 152, 44, 144, 145, 54, 76, 77, 78, 107, 108, | 684 | 152, 44, 144, 145, 54, 76, 77, 78, 107, 108, |
685 | 109, 110, 123, 45, 94, 46 | 685 | 109, 110, 122, 45, 94, 46 |
686 | }; | 686 | }; |
687 | 687 | ||
688 | /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing | 688 | /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing |
689 | STATE-NUM. */ | 689 | STATE-NUM. */ |
690 | #define YYPACT_NINF -135 | 690 | #define YYPACT_NINF -134 |
691 | static const yytype_int16 yypact[] = | 691 | static const yytype_int16 yypact[] = |
692 | { | 692 | { |
693 | -135, 11, -135, 312, -135, -135, 24, -135, -135, -135, | 693 | -134, 16, -134, 312, -134, -134, 20, -134, -134, -134, |
694 | -135, -135, -23, -135, -2, -135, -135, -135, -135, -135, | 694 | -134, -134, -18, -134, -3, -134, -134, -134, -134, -134, |
695 | -135, -135, -135, -135, -17, -135, -11, -135, -135, -135, | 695 | -134, -134, -134, -134, -26, -134, -25, -134, -134, -134, |
696 | -3, 16, 26, -135, -135, -135, -135, 34, 482, -135, | 696 | -7, 5, 27, -134, -134, -134, -134, 46, 482, -134, |
697 | -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, | 697 | -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, |
698 | -8, -135, 22, 97, -135, 482, 22, -135, 482, 56, | 698 | -8, -134, 30, 97, -134, 482, 30, -134, 482, 7, |
699 | -135, -135, 12, 10, 50, 49, -135, 34, -13, 15, | 699 | -134, -134, 12, 10, 42, 55, -134, 46, -15, 15, |
700 | -135, -135, 482, -135, 47, -25, 51, 145, -135, -135, | 700 | -134, -134, 482, -134, 25, 26, 47, 145, -134, -134, |
701 | 34, -135, 356, 52, 71, 77, -135, 10, -135, -135, | 701 | 46, -134, 356, 39, 71, 77, -134, 10, -134, -134, |
702 | 34, -135, -135, -135, 68, -135, 193, -135, -135, -135, | 702 | 46, -134, -134, -134, -134, -134, 193, -134, -134, -134, |
703 | 48, -135, 6, 93, 37, 68, 18, 85, 84, -135, | 703 | 75, -134, 6, 95, 43, -134, 28, 86, 85, -134, |
704 | -135, -135, 87, -135, 102, 86, -135, 89, -135, -135, | 704 | -134, -134, 88, -134, 103, 87, -134, 91, -134, -134, |
705 | -135, -135, -135, 90, 88, 401, 94, 100, 101, -135, | 705 | -134, -134, -23, 90, 401, 94, 101, 102, -134, -134, |
706 | -135, 99, -135, 108, -135, -135, -135, -135, 230, -135, | 706 | 98, -134, 108, -134, -134, 109, -134, 230, -134, 26, |
707 | -25, -135, -135, 105, -135, -135, -135, -135, -135, 9, | 707 | -134, -134, -134, 134, -134, -134, -134, -134, -134, 9, |
708 | 42, -135, 28, -135, -135, 445, -135, -135, 119, 125, | 708 | 48, -134, 35, -134, -134, 445, -134, -134, 125, 126, |
709 | -135, -135, 126, -135, 128, -135, -135, 267, -135, -135, | 709 | -134, -134, 128, -134, 129, -134, -134, 267, -134, -134, |
710 | -135, -135, -135, -135, 129, 130, -135, -135 | 710 | -134, -134, -134, -134, 130, 131, -134, -134 |
711 | }; | 711 | }; |
712 | 712 | ||
713 | /* YYPGOTO[NTERM-NUM]. */ | 713 | /* YYPGOTO[NTERM-NUM]. */ |
714 | static const yytype_int16 yypgoto[] = | 714 | static const yytype_int16 yypgoto[] = |
715 | { | 715 | { |
716 | -135, -135, 179, -135, -135, -135, -135, -47, -135, -135, | 716 | -134, -134, 180, -134, -134, -134, -134, -33, -134, -134, |
717 | 91, 0, -58, -37, -135, -135, -135, -73, -135, -135, | 717 | 93, 0, -58, -37, -134, -134, -134, -73, -134, -134, |
718 | -48, -32, -135, -38, -135, -134, -135, -135, 29, -63, | 718 | -54, -32, -134, -81, -134, -133, -134, -134, 29, -50, |
719 | -135, -135, -135, -135, -20, -135, -135, 106, -135, -135, | 719 | -134, -134, -134, -134, -20, -134, -134, 110, -134, -134, |
720 | 45, 95, 82, -135, -135, -135 | 720 | 49, 96, 80, -134, -134, -134 |
721 | }; | 721 | }; |
722 | 722 | ||
723 | /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If | 723 | /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If |
@@ -727,26 +727,26 @@ static const yytype_int16 yypgoto[] = | |||
727 | #define YYTABLE_NINF -109 | 727 | #define YYTABLE_NINF -109 |
728 | static const yytype_int16 yytable[] = | 728 | static const yytype_int16 yytable[] = |
729 | { | 729 | { |
730 | 82, 70, 104, 37, 159, 68, 57, 131, 79, 49, | 730 | 82, 70, 104, 37, 159, 68, 57, 130, 142, 88, |
731 | 162, 4, 100, 84, 50, 88, 101, 92, 10, 93, | 731 | 162, 52, 56, 84, 49, 92, 4, 93, 10, 50, |
732 | 52, 51, 102, 63, 71, 97, 56, 103, 20, 104, | 732 | 51, 132, 79, 134, 71, 53, 53, 143, 20, 104, |
733 | 85, 104, 73, 175, 53, 91, 81, 29, 125, 120, | 733 | 85, 104, 73, 120, 175, 91, 81, 29, 124, 97, |
734 | 53, 33, -93, 132, 58, 70, 147, 101, 95, 61, | 734 | 58, 33, -93, 131, 83, 70, 147, 101, 95, 61, |
735 | 163, 137, 150, 102, 63, 80, 149, 63, -93, 62, | 735 | 163, 150, 59, 102, 63, 80, 149, 63, -93, 62, |
736 | 63, 166, 96, 59, 133, 138, 135, 104, 47, 48, | 736 | 63, 136, 96, 100, 47, 48, 104, 101, 166, 98, |
737 | 60, 61, 80, 53, 132, 167, 150, 150, 101, 147, | 737 | 99, 60, 80, 102, 63, 137, 150, 150, 103, 124, |
738 | 125, 62, 63, 163, 102, 63, 164, 165, 70, 149, | 738 | 131, 53, 167, 61, 101, 147, 89, 70, 117, 163, |
739 | 63, 98, 99, 83, 89, 90, 111, 125, 74, 122, | 739 | 102, 63, 111, 62, 63, 149, 63, 124, 74, 164, |
740 | 103, 117, 7, 8, 9, 10, 11, 12, 13, 125, | 740 | 165, 90, 7, 8, 9, 10, 11, 12, 13, 124, |
741 | 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, | 741 | 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, |
742 | 118, 26, 27, 28, 29, 30, 119, 134, 33, 139, | 742 | 118, 26, 27, 28, 29, 30, 119, 103, 33, 133, |
743 | 140, 98, 92, 142, -22, 141, 154, 146, 34, 161, | 743 | 138, 139, 98, 92, -22, 141, 140, 154, 34, 146, |
744 | 143, -22, -107, 153, -22, -22, 112, 155, 156, -22, | 744 | 142, -22, -107, 153, -22, -22, 112, 156, 155, -22, |
745 | 7, 8, 9, 10, 11, 12, 13, 157, 15, 16, | 745 | 7, 8, 9, 10, 11, 12, 13, 157, 15, 16, |
746 | 17, 18, 19, 20, 21, 22, 23, 24, 170, 26, | 746 | 17, 18, 19, 20, 21, 22, 23, 24, 161, 26, |
747 | 27, 28, 29, 30, 171, 172, 33, 173, 176, 177, | 747 | 27, 28, 29, 30, 170, 171, 33, 172, 173, 176, |
748 | 5, 121, -22, 113, 169, 160, 34, 136, 0, -22, | 748 | 177, 5, -22, 121, 169, 135, 34, 113, 160, -22, |
749 | -108, 0, -22, -22, 124, 130, 0, -22, 7, 8, | 749 | -108, 0, -22, -22, 123, 0, 129, -22, 7, 8, |
750 | 9, 10, 11, 12, 13, 0, 15, 16, 17, 18, | 750 | 9, 10, 11, 12, 13, 0, 15, 16, 17, 18, |
751 | 19, 20, 21, 22, 23, 24, 0, 26, 27, 28, | 751 | 19, 20, 21, 22, 23, 24, 0, 26, 27, 28, |
752 | 29, 30, 0, 0, 33, 0, 0, 0, 0, -86, | 752 | 29, 30, 0, 0, 33, 0, 0, 0, 0, -86, |
@@ -784,26 +784,26 @@ static const yytype_int16 yytable[] = | |||
784 | 784 | ||
785 | static const yytype_int16 yycheck[] = | 785 | static const yytype_int16 yycheck[] = |
786 | { | 786 | { |
787 | 58, 38, 75, 3, 138, 37, 26, 1, 55, 32, | 787 | 58, 38, 75, 3, 137, 37, 26, 1, 31, 63, |
788 | 1, 0, 37, 1, 37, 63, 41, 30, 8, 32, | 788 | 1, 37, 37, 1, 32, 30, 0, 32, 8, 37, |
789 | 37, 23, 47, 48, 32, 72, 37, 52, 18, 102, | 789 | 23, 102, 55, 104, 32, 51, 51, 50, 18, 102, |
790 | 62, 104, 52, 167, 51, 67, 56, 27, 96, 87, | 790 | 62, 104, 52, 87, 167, 67, 56, 27, 96, 72, |
791 | 51, 31, 33, 37, 47, 82, 37, 41, 33, 37, | 791 | 47, 31, 33, 37, 37, 82, 37, 41, 33, 37, |
792 | 41, 33, 125, 47, 48, 55, 47, 48, 49, 47, | 792 | 41, 124, 47, 47, 48, 55, 47, 48, 49, 47, |
793 | 48, 33, 47, 47, 102, 47, 104, 140, 44, 45, | 793 | 48, 33, 47, 37, 44, 45, 139, 41, 33, 44, |
794 | 44, 37, 72, 51, 37, 47, 149, 150, 41, 37, | 794 | 45, 44, 72, 47, 48, 47, 149, 150, 52, 137, |
795 | 138, 47, 48, 41, 47, 48, 149, 150, 125, 47, | 795 | 37, 51, 47, 37, 41, 37, 44, 124, 49, 41, |
796 | 48, 44, 45, 37, 44, 46, 45, 155, 1, 31, | 796 | 47, 48, 45, 47, 48, 47, 48, 155, 1, 149, |
797 | 52, 49, 5, 6, 7, 8, 9, 10, 11, 167, | 797 | 150, 46, 5, 6, 7, 8, 9, 10, 11, 167, |
798 | 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, | 798 | 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, |
799 | 49, 24, 25, 26, 27, 28, 49, 34, 31, 44, | 799 | 49, 24, 25, 26, 27, 28, 49, 52, 31, 34, |
800 | 46, 44, 30, 44, 37, 49, 36, 49, 41, 34, | 800 | 44, 46, 44, 30, 37, 44, 49, 36, 41, 49, |
801 | 50, 44, 45, 49, 47, 48, 1, 46, 49, 52, | 801 | 31, 44, 45, 49, 47, 48, 1, 49, 46, 52, |
802 | 5, 6, 7, 8, 9, 10, 11, 49, 13, 14, | 802 | 5, 6, 7, 8, 9, 10, 11, 49, 13, 14, |
803 | 15, 16, 17, 18, 19, 20, 21, 22, 49, 24, | 803 | 15, 16, 17, 18, 19, 20, 21, 22, 34, 24, |
804 | 25, 26, 27, 28, 49, 49, 31, 49, 49, 49, | 804 | 25, 26, 27, 28, 49, 49, 31, 49, 49, 49, |
805 | 1, 90, 37, 77, 155, 140, 41, 105, -1, 44, | 805 | 49, 1, 37, 90, 155, 105, 41, 77, 139, 44, |
806 | 45, -1, 47, 48, 1, 100, -1, 52, 5, 6, | 806 | 45, -1, 47, 48, 1, -1, 100, 52, 5, 6, |
807 | 7, 8, 9, 10, 11, -1, 13, 14, 15, 16, | 807 | 7, 8, 9, 10, 11, -1, 13, 14, 15, 16, |
808 | 17, 18, 19, 20, 21, 22, -1, 24, 25, 26, | 808 | 17, 18, 19, 20, 21, 22, -1, 24, 25, 26, |
809 | 27, 28, -1, -1, 31, -1, -1, -1, -1, 36, | 809 | 27, 28, -1, -1, 31, -1, -1, -1, -1, 36, |
@@ -855,9 +855,9 @@ static const yytype_uint8 yystos[] = | |||
855 | 46, 74, 30, 32, 97, 33, 47, 60, 44, 45, | 855 | 46, 74, 30, 32, 97, 33, 47, 60, 44, 45, |
856 | 37, 41, 47, 52, 70, 76, 77, 91, 92, 93, | 856 | 37, 41, 47, 52, 70, 76, 77, 91, 92, 93, |
857 | 94, 45, 1, 90, 74, 48, 49, 49, 49, 49, | 857 | 94, 45, 1, 90, 74, 48, 49, 49, 49, 49, |
858 | 73, 63, 31, 95, 1, 65, 78, 79, 80, 81, | 858 | 73, 63, 95, 1, 65, 78, 79, 80, 81, 94, |
859 | 94, 1, 37, 76, 34, 76, 95, 33, 47, 44, | 859 | 1, 37, 76, 34, 76, 95, 33, 47, 44, 46, |
860 | 46, 49, 44, 50, 85, 86, 49, 37, 41, 47, | 860 | 49, 44, 31, 50, 85, 86, 49, 37, 41, 47, |
861 | 70, 82, 83, 49, 36, 46, 49, 49, 1, 78, | 861 | 70, 82, 83, 49, 36, 46, 49, 49, 1, 78, |
862 | 93, 34, 1, 41, 82, 82, 33, 47, 36, 81, | 862 | 93, 34, 1, 41, 82, 82, 33, 47, 36, 81, |
863 | 49, 49, 49, 49, 1, 78, 49, 49 | 863 | 49, 49, 49, 49, 1, 78, 49, 49 |
diff --git a/scripts/genksyms/parse.y b/scripts/genksyms/parse.y index 408cdf82b271..10d7dc724b6d 100644 --- a/scripts/genksyms/parse.y +++ b/scripts/genksyms/parse.y | |||
@@ -446,7 +446,7 @@ member_bitfield_declarator: | |||
446 | 446 | ||
447 | attribute_opt: | 447 | attribute_opt: |
448 | /* empty */ { $$ = NULL; } | 448 | /* empty */ { $$ = NULL; } |
449 | | ATTRIBUTE_PHRASE | 449 | | attribute_opt ATTRIBUTE_PHRASE |
450 | ; | 450 | ; |
451 | 451 | ||
452 | asm_definition: | 452 | asm_definition: |
diff --git a/scripts/hdrcheck.sh b/scripts/hdrcheck.sh deleted file mode 100755 index 31598584f871..000000000000 --- a/scripts/hdrcheck.sh +++ /dev/null | |||
@@ -1,10 +0,0 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | for FILE in `grep '^[ \t]*#[ \t]*include[ \t]*<' $2 | cut -f2 -d\< | cut -f1 -d\> | egrep ^linux\|^asm` ; do | ||
4 | if [ ! -r $1/$FILE ]; then | ||
5 | echo $2 requires $FILE, which does not exist in exported headers | ||
6 | exit 1 | ||
7 | fi | ||
8 | done | ||
9 | # FIXME: List dependencies into $3 | ||
10 | touch $3 | ||
diff --git a/scripts/headers.sh b/scripts/headers.sh new file mode 100755 index 000000000000..d33426f866db --- /dev/null +++ b/scripts/headers.sh | |||
@@ -0,0 +1,41 @@ | |||
1 | #!/bin/sh | ||
2 | # Run headers_$1 command for all suitable architectures | ||
3 | |||
4 | # Stop on error | ||
5 | set -e | ||
6 | |||
7 | do_command() | ||
8 | { | ||
9 | if [ -f ${srctree}/arch/$2/include/asm/Kbuild ]; then | ||
10 | make ARCH=$2 KBUILD_HEADERS=$1 headers_$1 | ||
11 | elif [ -f ${srctree}/include/asm-$2/Kbuild ]; then | ||
12 | make ARCH=$2 KBUILD_HEADERS=$1 headers_$1 | ||
13 | else | ||
14 | printf "Ignoring arch: %s\n" ${arch} | ||
15 | fi | ||
16 | } | ||
17 | |||
18 | # Do not try this architecture | ||
19 | drop="generic um ppc sparc64 cris" | ||
20 | |||
21 | archs=$(ls ${srctree}/arch) | ||
22 | |||
23 | for arch in ${archs}; do | ||
24 | case ${arch} in | ||
25 | um) # no userspace export | ||
26 | ;; | ||
27 | ppc) # headers exported by powerpc | ||
28 | ;; | ||
29 | sparc64) # headers exported by sparc | ||
30 | ;; | ||
31 | cris) # headers export are known broken | ||
32 | ;; | ||
33 | *) | ||
34 | if [ -d ${srctree}/arch/${arch} ]; then | ||
35 | do_command $1 ${arch} | ||
36 | fi | ||
37 | ;; | ||
38 | esac | ||
39 | done | ||
40 | |||
41 | |||
diff --git a/scripts/headers_check.pl b/scripts/headers_check.pl new file mode 100644 index 000000000000..15d53a6b1a1f --- /dev/null +++ b/scripts/headers_check.pl | |||
@@ -0,0 +1,56 @@ | |||
1 | #!/usr/bin/perl | ||
2 | # | ||
3 | # headers_check.pl execute a number of trivial consistency checks | ||
4 | # | ||
5 | # Usage: headers_check.pl dir [files...] | ||
6 | # dir: dir to look for included files | ||
7 | # arch: architecture | ||
8 | # files: list of files to check | ||
9 | # | ||
10 | # The script reads the supplied files line by line and: | ||
11 | # | ||
12 | # 1) for each include statement it checks if the | ||
13 | # included file actually exists. | ||
14 | # Only include files located in asm* and linux* are checked. | ||
15 | # The rest are assumed to be system include files. | ||
16 | # | ||
17 | # 2) TODO: check for leaked CONFIG_ symbols | ||
18 | |||
19 | use strict; | ||
20 | use warnings; | ||
21 | |||
22 | my ($dir, $arch, @files) = @ARGV; | ||
23 | |||
24 | my $ret = 0; | ||
25 | my $line; | ||
26 | my $lineno = 0; | ||
27 | my $filename; | ||
28 | |||
29 | foreach my $file (@files) { | ||
30 | $filename = $file; | ||
31 | open(my $fh, '<', "$filename") or die "$filename: $!\n"; | ||
32 | $lineno = 0; | ||
33 | while ($line = <$fh>) { | ||
34 | $lineno++; | ||
35 | check_include(); | ||
36 | } | ||
37 | close $fh; | ||
38 | } | ||
39 | exit $ret; | ||
40 | |||
41 | sub check_include | ||
42 | { | ||
43 | if ($line =~ m/^\s*#\s*include\s+<((asm|linux).*)>/) { | ||
44 | my $inc = $1; | ||
45 | my $found; | ||
46 | $found = stat($dir . "/" . $inc); | ||
47 | if (!$found) { | ||
48 | $inc =~ s#asm/#asm-$arch/#; | ||
49 | $found = stat($dir . "/" . $inc); | ||
50 | } | ||
51 | if (!$found) { | ||
52 | printf STDERR "$filename:$lineno: included file '$inc' is not exported\n"; | ||
53 | $ret = 1; | ||
54 | } | ||
55 | } | ||
56 | } | ||
diff --git a/scripts/headers_install.pl b/scripts/headers_install.pl new file mode 100644 index 000000000000..68591cd08731 --- /dev/null +++ b/scripts/headers_install.pl | |||
@@ -0,0 +1,45 @@ | |||
1 | #!/usr/bin/perl | ||
2 | # | ||
3 | # headers_install prepare the listed header files for use in | ||
4 | # user space and copy the files to their destination. | ||
5 | # | ||
6 | # Usage: headers_install.pl readdir installdir arch [files...] | ||
7 | # readdir: dir to open files | ||
8 | # installdir: dir to install the files | ||
9 | # arch: current architecture | ||
10 | # arch is used to force a reinstallation when the arch | ||
11 | # changes because kbuild then detect a command line change. | ||
12 | # files: list of files to check | ||
13 | # | ||
14 | # Step in preparation for users space: | ||
15 | # 1) Drop all use of compiler.h definitions | ||
16 | # 2) Drop include of compiler.h | ||
17 | # 3) Drop all sections defined out by __KERNEL__ (using unifdef) | ||
18 | |||
19 | use strict; | ||
20 | use warnings; | ||
21 | |||
22 | my ($readdir, $installdir, $arch, @files) = @ARGV; | ||
23 | |||
24 | my $unifdef = "scripts/unifdef -U__KERNEL__"; | ||
25 | |||
26 | foreach my $file (@files) { | ||
27 | my $tmpfile = "$installdir/$file.tmp"; | ||
28 | open(my $infile, '<', "$readdir/$file") | ||
29 | or die "$readdir/$file: $!\n"; | ||
30 | open(my $outfile, '>', "$tmpfile") or die "$tmpfile: $!\n"; | ||
31 | while (my $line = <$infile>) { | ||
32 | $line =~ s/([\s(])__user\s/$1/g; | ||
33 | $line =~ s/([\s(])__force\s/$1/g; | ||
34 | $line =~ s/([\s(])__iomem\s/$1/g; | ||
35 | $line =~ s/\s__attribute_const__\s/ /g; | ||
36 | $line =~ s/\s__attribute_const__$//g; | ||
37 | $line =~ s/^#include <linux\/compiler.h>//; | ||
38 | printf $outfile "%s", $line; | ||
39 | } | ||
40 | close $outfile; | ||
41 | close $infile; | ||
42 | system $unifdef . " $tmpfile > $installdir/$file"; | ||
43 | unlink $tmpfile; | ||
44 | } | ||
45 | exit 0; | ||
diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile index fa1a7d565903..fa8c2dd9c983 100644 --- a/scripts/kconfig/Makefile +++ b/scripts/kconfig/Makefile | |||
@@ -4,7 +4,11 @@ | |||
4 | 4 | ||
5 | PHONY += oldconfig xconfig gconfig menuconfig config silentoldconfig update-po-config | 5 | PHONY += oldconfig xconfig gconfig menuconfig config silentoldconfig update-po-config |
6 | 6 | ||
7 | ifdef KBUILD_KCONFIG | ||
8 | Kconfig := $(KBUILD_KCONFIG) | ||
9 | else | ||
7 | Kconfig := arch/$(SRCARCH)/Kconfig | 10 | Kconfig := arch/$(SRCARCH)/Kconfig |
11 | endif | ||
8 | 12 | ||
9 | xconfig: $(obj)/qconf | 13 | xconfig: $(obj)/qconf |
10 | $< $(Kconfig) | 14 | $< $(Kconfig) |
diff --git a/scripts/kconfig/conf.c b/scripts/kconfig/conf.c index fda63136ae68..3e1057f885c6 100644 --- a/scripts/kconfig/conf.c +++ b/scripts/kconfig/conf.c | |||
@@ -32,6 +32,7 @@ char *defconfig_file; | |||
32 | 32 | ||
33 | static int indent = 1; | 33 | static int indent = 1; |
34 | static int valid_stdin = 1; | 34 | static int valid_stdin = 1; |
35 | static int sync_kconfig; | ||
35 | static int conf_cnt; | 36 | static int conf_cnt; |
36 | static char line[128]; | 37 | static char line[128]; |
37 | static struct menu *rootEntry; | 38 | static struct menu *rootEntry; |
@@ -65,7 +66,7 @@ static void strip(char *str) | |||
65 | 66 | ||
66 | static void check_stdin(void) | 67 | static void check_stdin(void) |
67 | { | 68 | { |
68 | if (!valid_stdin && input_mode == ask_silent) { | 69 | if (!valid_stdin) { |
69 | printf(_("aborted!\n\n")); | 70 | printf(_("aborted!\n\n")); |
70 | printf(_("Console input/output is redirected. ")); | 71 | printf(_("Console input/output is redirected. ")); |
71 | printf(_("Run 'make oldconfig' to update configuration.\n\n")); | 72 | printf(_("Run 'make oldconfig' to update configuration.\n\n")); |
@@ -76,7 +77,6 @@ static void check_stdin(void) | |||
76 | static int conf_askvalue(struct symbol *sym, const char *def) | 77 | static int conf_askvalue(struct symbol *sym, const char *def) |
77 | { | 78 | { |
78 | enum symbol_type type = sym_get_type(sym); | 79 | enum symbol_type type = sym_get_type(sym); |
79 | tristate val; | ||
80 | 80 | ||
81 | if (!sym_has_value(sym)) | 81 | if (!sym_has_value(sym)) |
82 | printf(_("(NEW) ")); | 82 | printf(_("(NEW) ")); |
@@ -92,15 +92,6 @@ static int conf_askvalue(struct symbol *sym, const char *def) | |||
92 | } | 92 | } |
93 | 93 | ||
94 | switch (input_mode) { | 94 | switch (input_mode) { |
95 | case set_no: | ||
96 | case set_mod: | ||
97 | case set_yes: | ||
98 | case set_random: | ||
99 | if (sym_has_value(sym)) { | ||
100 | printf("%s\n", def); | ||
101 | return 0; | ||
102 | } | ||
103 | break; | ||
104 | case ask_new: | 95 | case ask_new: |
105 | case ask_silent: | 96 | case ask_silent: |
106 | if (sym_has_value(sym)) { | 97 | if (sym_has_value(sym)) { |
@@ -112,9 +103,6 @@ static int conf_askvalue(struct symbol *sym, const char *def) | |||
112 | fflush(stdout); | 103 | fflush(stdout); |
113 | fgets(line, 128, stdin); | 104 | fgets(line, 128, stdin); |
114 | return 1; | 105 | return 1; |
115 | case set_default: | ||
116 | printf("%s\n", def); | ||
117 | return 1; | ||
118 | default: | 106 | default: |
119 | break; | 107 | break; |
120 | } | 108 | } |
@@ -128,52 +116,6 @@ static int conf_askvalue(struct symbol *sym, const char *def) | |||
128 | default: | 116 | default: |
129 | ; | 117 | ; |
130 | } | 118 | } |
131 | switch (input_mode) { | ||
132 | case set_yes: | ||
133 | if (sym_tristate_within_range(sym, yes)) { | ||
134 | line[0] = 'y'; | ||
135 | line[1] = '\n'; | ||
136 | line[2] = 0; | ||
137 | break; | ||
138 | } | ||
139 | case set_mod: | ||
140 | if (type == S_TRISTATE) { | ||
141 | if (sym_tristate_within_range(sym, mod)) { | ||
142 | line[0] = 'm'; | ||
143 | line[1] = '\n'; | ||
144 | line[2] = 0; | ||
145 | break; | ||
146 | } | ||
147 | } else { | ||
148 | if (sym_tristate_within_range(sym, yes)) { | ||
149 | line[0] = 'y'; | ||
150 | line[1] = '\n'; | ||
151 | line[2] = 0; | ||
152 | break; | ||
153 | } | ||
154 | } | ||
155 | case set_no: | ||
156 | if (sym_tristate_within_range(sym, no)) { | ||
157 | line[0] = 'n'; | ||
158 | line[1] = '\n'; | ||
159 | line[2] = 0; | ||
160 | break; | ||
161 | } | ||
162 | case set_random: | ||
163 | do { | ||
164 | val = (tristate)(rand() % 3); | ||
165 | } while (!sym_tristate_within_range(sym, val)); | ||
166 | switch (val) { | ||
167 | case no: line[0] = 'n'; break; | ||
168 | case mod: line[0] = 'm'; break; | ||
169 | case yes: line[0] = 'y'; break; | ||
170 | } | ||
171 | line[1] = '\n'; | ||
172 | line[2] = 0; | ||
173 | break; | ||
174 | default: | ||
175 | break; | ||
176 | } | ||
177 | printf("%s", line); | 119 | printf("%s", line); |
178 | return 1; | 120 | return 1; |
179 | } | 121 | } |
@@ -374,15 +316,7 @@ static int conf_choice(struct menu *menu) | |||
374 | else | 316 | else |
375 | continue; | 317 | continue; |
376 | break; | 318 | break; |
377 | case set_random: | 319 | default: |
378 | if (is_new) | ||
379 | def = (rand() % cnt) + 1; | ||
380 | case set_default: | ||
381 | case set_yes: | ||
382 | case set_mod: | ||
383 | case set_no: | ||
384 | cnt = def; | ||
385 | printf("%d\n", cnt); | ||
386 | break; | 320 | break; |
387 | } | 321 | } |
388 | 322 | ||
@@ -507,11 +441,11 @@ int main(int ac, char **av) | |||
507 | while ((opt = getopt(ac, av, "osdD:nmyrh")) != -1) { | 441 | while ((opt = getopt(ac, av, "osdD:nmyrh")) != -1) { |
508 | switch (opt) { | 442 | switch (opt) { |
509 | case 'o': | 443 | case 'o': |
510 | input_mode = ask_new; | 444 | input_mode = ask_silent; |
511 | break; | 445 | break; |
512 | case 's': | 446 | case 's': |
513 | input_mode = ask_silent; | 447 | input_mode = ask_silent; |
514 | valid_stdin = isatty(0) && isatty(1) && isatty(2); | 448 | sync_kconfig = 1; |
515 | break; | 449 | break; |
516 | case 'd': | 450 | case 'd': |
517 | input_mode = set_default; | 451 | input_mode = set_default; |
@@ -549,6 +483,19 @@ int main(int ac, char **av) | |||
549 | name = av[optind]; | 483 | name = av[optind]; |
550 | conf_parse(name); | 484 | conf_parse(name); |
551 | //zconfdump(stdout); | 485 | //zconfdump(stdout); |
486 | if (sync_kconfig) { | ||
487 | if (stat(".config", &tmpstat)) { | ||
488 | fprintf(stderr, _("***\n" | ||
489 | "*** You have not yet configured your kernel!\n" | ||
490 | "*** (missing kernel .config file)\n" | ||
491 | "***\n" | ||
492 | "*** Please run some configurator (e.g. \"make oldconfig\" or\n" | ||
493 | "*** \"make menuconfig\" or \"make xconfig\").\n" | ||
494 | "***\n")); | ||
495 | exit(1); | ||
496 | } | ||
497 | } | ||
498 | |||
552 | switch (input_mode) { | 499 | switch (input_mode) { |
553 | case set_default: | 500 | case set_default: |
554 | if (!defconfig_file) | 501 | if (!defconfig_file) |
@@ -561,16 +508,6 @@ int main(int ac, char **av) | |||
561 | } | 508 | } |
562 | break; | 509 | break; |
563 | case ask_silent: | 510 | case ask_silent: |
564 | if (stat(".config", &tmpstat)) { | ||
565 | printf(_("***\n" | ||
566 | "*** You have not yet configured your kernel!\n" | ||
567 | "*** (missing kernel .config file)\n" | ||
568 | "***\n" | ||
569 | "*** Please run some configurator (e.g. \"make oldconfig\" or\n" | ||
570 | "*** \"make menuconfig\" or \"make xconfig\").\n" | ||
571 | "***\n")); | ||
572 | exit(1); | ||
573 | } | ||
574 | case ask_all: | 511 | case ask_all: |
575 | case ask_new: | 512 | case ask_new: |
576 | conf_read(NULL); | 513 | conf_read(NULL); |
@@ -600,35 +537,66 @@ int main(int ac, char **av) | |||
600 | break; | 537 | break; |
601 | } | 538 | } |
602 | 539 | ||
603 | if (input_mode != ask_silent) { | 540 | if (sync_kconfig) { |
541 | if (conf_get_changed()) { | ||
542 | name = getenv("KCONFIG_NOSILENTUPDATE"); | ||
543 | if (name && *name) { | ||
544 | fprintf(stderr, | ||
545 | _("\n*** Kernel configuration requires explicit update.\n\n")); | ||
546 | return 1; | ||
547 | } | ||
548 | } | ||
549 | valid_stdin = isatty(0) && isatty(1) && isatty(2); | ||
550 | } | ||
551 | |||
552 | switch (input_mode) { | ||
553 | case set_no: | ||
554 | conf_set_all_new_symbols(def_no); | ||
555 | break; | ||
556 | case set_yes: | ||
557 | conf_set_all_new_symbols(def_yes); | ||
558 | break; | ||
559 | case set_mod: | ||
560 | conf_set_all_new_symbols(def_mod); | ||
561 | break; | ||
562 | case set_random: | ||
563 | conf_set_all_new_symbols(def_random); | ||
564 | break; | ||
565 | case set_default: | ||
566 | conf_set_all_new_symbols(def_default); | ||
567 | break; | ||
568 | case ask_new: | ||
569 | case ask_all: | ||
604 | rootEntry = &rootmenu; | 570 | rootEntry = &rootmenu; |
605 | conf(&rootmenu); | 571 | conf(&rootmenu); |
606 | if (input_mode == ask_all) { | 572 | input_mode = ask_silent; |
607 | input_mode = ask_silent; | 573 | /* fall through */ |
608 | valid_stdin = 1; | 574 | case ask_silent: |
575 | /* Update until a loop caused no more changes */ | ||
576 | do { | ||
577 | conf_cnt = 0; | ||
578 | check_conf(&rootmenu); | ||
579 | } while (conf_cnt); | ||
580 | break; | ||
581 | } | ||
582 | |||
583 | if (sync_kconfig) { | ||
584 | /* silentoldconfig is used during the build so we shall update autoconf. | ||
585 | * All other commands are only used to generate a config. | ||
586 | */ | ||
587 | if (conf_get_changed() && conf_write(NULL)) { | ||
588 | fprintf(stderr, _("\n*** Error during writing of the kernel configuration.\n\n")); | ||
589 | exit(1); | ||
609 | } | 590 | } |
610 | } else if (conf_get_changed()) { | 591 | if (conf_write_autoconf()) { |
611 | name = getenv("KCONFIG_NOSILENTUPDATE"); | 592 | fprintf(stderr, _("\n*** Error during update of the kernel configuration.\n\n")); |
612 | if (name && *name) { | ||
613 | fprintf(stderr, _("\n*** Kernel configuration requires explicit update.\n\n")); | ||
614 | return 1; | 593 | return 1; |
615 | } | 594 | } |
616 | } else | 595 | } else { |
617 | goto skip_check; | 596 | if (conf_write(NULL)) { |
618 | 597 | fprintf(stderr, _("\n*** Error during writing of the kernel configuration.\n\n")); | |
619 | do { | 598 | exit(1); |
620 | conf_cnt = 0; | 599 | } |
621 | check_conf(&rootmenu); | ||
622 | } while (conf_cnt); | ||
623 | if (conf_write(NULL)) { | ||
624 | fprintf(stderr, _("\n*** Error during writing of the kernel configuration.\n\n")); | ||
625 | return 1; | ||
626 | } | ||
627 | skip_check: | ||
628 | if (input_mode == ask_silent && conf_write_autoconf()) { | ||
629 | fprintf(stderr, _("\n*** Error during writing of the kernel configuration.\n\n")); | ||
630 | return 1; | ||
631 | } | 600 | } |
632 | |||
633 | return 0; | 601 | return 0; |
634 | } | 602 | } |
diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c index ee5fe943d58d..830d9eae11f9 100644 --- a/scripts/kconfig/confdata.c +++ b/scripts/kconfig/confdata.c | |||
@@ -223,7 +223,7 @@ load: | |||
223 | if (def == S_DEF_USER) { | 223 | if (def == S_DEF_USER) { |
224 | sym = sym_find(line + 9); | 224 | sym = sym_find(line + 9); |
225 | if (!sym) { | 225 | if (!sym) { |
226 | conf_warning("trying to assign nonexistent symbol %s", line + 9); | 226 | sym_add_change_count(1); |
227 | break; | 227 | break; |
228 | } | 228 | } |
229 | } else { | 229 | } else { |
@@ -262,7 +262,7 @@ load: | |||
262 | if (def == S_DEF_USER) { | 262 | if (def == S_DEF_USER) { |
263 | sym = sym_find(line + 7); | 263 | sym = sym_find(line + 7); |
264 | if (!sym) { | 264 | if (!sym) { |
265 | conf_warning("trying to assign nonexistent symbol %s", line + 7); | 265 | sym_add_change_count(1); |
266 | break; | 266 | break; |
267 | } | 267 | } |
268 | } else { | 268 | } else { |
@@ -812,3 +812,72 @@ void conf_set_changed_callback(void (*fn)(void)) | |||
812 | { | 812 | { |
813 | conf_changed_callback = fn; | 813 | conf_changed_callback = fn; |
814 | } | 814 | } |
815 | |||
816 | |||
817 | void conf_set_all_new_symbols(enum conf_def_mode mode) | ||
818 | { | ||
819 | struct symbol *sym, *csym; | ||
820 | struct property *prop; | ||
821 | struct expr *e; | ||
822 | int i, cnt, def; | ||
823 | |||
824 | for_all_symbols(i, sym) { | ||
825 | if (sym_has_value(sym)) | ||
826 | continue; | ||
827 | switch (sym_get_type(sym)) { | ||
828 | case S_BOOLEAN: | ||
829 | case S_TRISTATE: | ||
830 | switch (mode) { | ||
831 | case def_yes: | ||
832 | sym->def[S_DEF_USER].tri = yes; | ||
833 | break; | ||
834 | case def_mod: | ||
835 | sym->def[S_DEF_USER].tri = mod; | ||
836 | break; | ||
837 | case def_no: | ||
838 | sym->def[S_DEF_USER].tri = no; | ||
839 | break; | ||
840 | case def_random: | ||
841 | sym->def[S_DEF_USER].tri = (tristate)(rand() % 3); | ||
842 | break; | ||
843 | default: | ||
844 | continue; | ||
845 | } | ||
846 | if (!sym_is_choice(sym) || mode != def_random) | ||
847 | sym->flags |= SYMBOL_DEF_USER; | ||
848 | break; | ||
849 | default: | ||
850 | break; | ||
851 | } | ||
852 | |||
853 | } | ||
854 | |||
855 | sym_clear_all_valid(); | ||
856 | |||
857 | if (mode != def_random) | ||
858 | return; | ||
859 | |||
860 | for_all_symbols(i, csym) { | ||
861 | if (sym_has_value(csym) || !sym_is_choice(csym)) | ||
862 | continue; | ||
863 | |||
864 | sym_calc_value(csym); | ||
865 | prop = sym_get_choice_prop(csym); | ||
866 | def = -1; | ||
867 | while (1) { | ||
868 | cnt = 0; | ||
869 | expr_list_for_each_sym(prop->expr, e, sym) { | ||
870 | if (sym->visible == no) | ||
871 | continue; | ||
872 | if (def == cnt++) { | ||
873 | csym->def[S_DEF_USER].val = sym; | ||
874 | break; | ||
875 | } | ||
876 | } | ||
877 | if (def >= 0 || cnt < 2) | ||
878 | break; | ||
879 | def = (rand() % cnt) + 1; | ||
880 | } | ||
881 | csym->flags |= SYMBOL_DEF_USER; | ||
882 | } | ||
883 | } | ||
diff --git a/scripts/kconfig/lex.zconf.c_shipped b/scripts/kconfig/lex.zconf.c_shipped index 6a61cee4a32c..7342ce0a7780 100644 --- a/scripts/kconfig/lex.zconf.c_shipped +++ b/scripts/kconfig/lex.zconf.c_shipped | |||
@@ -5,10 +5,29 @@ | |||
5 | 5 | ||
6 | /* A lexical scanner generated by flex */ | 6 | /* A lexical scanner generated by flex */ |
7 | 7 | ||
8 | #define yy_create_buffer zconf_create_buffer | ||
9 | #define yy_delete_buffer zconf_delete_buffer | ||
10 | #define yy_flex_debug zconf_flex_debug | ||
11 | #define yy_init_buffer zconf_init_buffer | ||
12 | #define yy_flush_buffer zconf_flush_buffer | ||
13 | #define yy_load_buffer_state zconf_load_buffer_state | ||
14 | #define yy_switch_to_buffer zconf_switch_to_buffer | ||
15 | #define yyin zconfin | ||
16 | #define yyleng zconfleng | ||
17 | #define yylex zconflex | ||
18 | #define yylineno zconflineno | ||
19 | #define yyout zconfout | ||
20 | #define yyrestart zconfrestart | ||
21 | #define yytext zconftext | ||
22 | #define yywrap zconfwrap | ||
23 | #define yyalloc zconfalloc | ||
24 | #define yyrealloc zconfrealloc | ||
25 | #define yyfree zconffree | ||
26 | |||
8 | #define FLEX_SCANNER | 27 | #define FLEX_SCANNER |
9 | #define YY_FLEX_MAJOR_VERSION 2 | 28 | #define YY_FLEX_MAJOR_VERSION 2 |
10 | #define YY_FLEX_MINOR_VERSION 5 | 29 | #define YY_FLEX_MINOR_VERSION 5 |
11 | #define YY_FLEX_SUBMINOR_VERSION 33 | 30 | #define YY_FLEX_SUBMINOR_VERSION 35 |
12 | #if YY_FLEX_SUBMINOR_VERSION > 0 | 31 | #if YY_FLEX_SUBMINOR_VERSION > 0 |
13 | #define FLEX_BETA | 32 | #define FLEX_BETA |
14 | #endif | 33 | #endif |
@@ -30,7 +49,7 @@ | |||
30 | 49 | ||
31 | /* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */ | 50 | /* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */ |
32 | 51 | ||
33 | #if __STDC_VERSION__ >= 199901L | 52 | #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L |
34 | 53 | ||
35 | /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, | 54 | /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, |
36 | * if you want the limit (max/min) macros for int types. | 55 | * if you want the limit (max/min) macros for int types. |
@@ -53,7 +72,6 @@ typedef int flex_int32_t; | |||
53 | typedef unsigned char flex_uint8_t; | 72 | typedef unsigned char flex_uint8_t; |
54 | typedef unsigned short int flex_uint16_t; | 73 | typedef unsigned short int flex_uint16_t; |
55 | typedef unsigned int flex_uint32_t; | 74 | typedef unsigned int flex_uint32_t; |
56 | #endif /* ! C99 */ | ||
57 | 75 | ||
58 | /* Limits of integral types. */ | 76 | /* Limits of integral types. */ |
59 | #ifndef INT8_MIN | 77 | #ifndef INT8_MIN |
@@ -84,6 +102,8 @@ typedef unsigned int flex_uint32_t; | |||
84 | #define UINT32_MAX (4294967295U) | 102 | #define UINT32_MAX (4294967295U) |
85 | #endif | 103 | #endif |
86 | 104 | ||
105 | #endif /* ! C99 */ | ||
106 | |||
87 | #endif /* ! FLEXINT_H */ | 107 | #endif /* ! FLEXINT_H */ |
88 | 108 | ||
89 | #ifdef __cplusplus | 109 | #ifdef __cplusplus |
@@ -93,11 +113,12 @@ typedef unsigned int flex_uint32_t; | |||
93 | 113 | ||
94 | #else /* ! __cplusplus */ | 114 | #else /* ! __cplusplus */ |
95 | 115 | ||
96 | #if __STDC__ | 116 | /* C99 requires __STDC__ to be defined as 1. */ |
117 | #if defined (__STDC__) | ||
97 | 118 | ||
98 | #define YY_USE_CONST | 119 | #define YY_USE_CONST |
99 | 120 | ||
100 | #endif /* __STDC__ */ | 121 | #endif /* defined (__STDC__) */ |
101 | #endif /* ! __cplusplus */ | 122 | #endif /* ! __cplusplus */ |
102 | 123 | ||
103 | #ifdef YY_USE_CONST | 124 | #ifdef YY_USE_CONST |
@@ -177,14 +198,9 @@ extern FILE *zconfin, *zconfout; | |||
177 | 198 | ||
178 | #define unput(c) yyunput( c, (yytext_ptr) ) | 199 | #define unput(c) yyunput( c, (yytext_ptr) ) |
179 | 200 | ||
180 | /* The following is because we cannot portably get our hands on size_t | ||
181 | * (without autoconf's help, which isn't available because we want | ||
182 | * flex-generated scanners to compile on their own). | ||
183 | */ | ||
184 | |||
185 | #ifndef YY_TYPEDEF_YY_SIZE_T | 201 | #ifndef YY_TYPEDEF_YY_SIZE_T |
186 | #define YY_TYPEDEF_YY_SIZE_T | 202 | #define YY_TYPEDEF_YY_SIZE_T |
187 | typedef unsigned int yy_size_t; | 203 | typedef size_t yy_size_t; |
188 | #endif | 204 | #endif |
189 | 205 | ||
190 | #ifndef YY_STRUCT_YY_BUFFER_STATE | 206 | #ifndef YY_STRUCT_YY_BUFFER_STATE |
@@ -335,7 +351,7 @@ void zconffree (void * ); | |||
335 | 351 | ||
336 | /* Begin user sect3 */ | 352 | /* Begin user sect3 */ |
337 | 353 | ||
338 | #define zconfwrap() 1 | 354 | #define zconfwrap(n) 1 |
339 | #define YY_SKIP_YYWRAP | 355 | #define YY_SKIP_YYWRAP |
340 | 356 | ||
341 | typedef unsigned char YY_CHAR; | 357 | typedef unsigned char YY_CHAR; |
@@ -748,6 +764,7 @@ int zconf_flex_debug = 0; | |||
748 | #define YY_MORE_ADJ 0 | 764 | #define YY_MORE_ADJ 0 |
749 | #define YY_RESTORE_YY_MORE_OFFSET | 765 | #define YY_RESTORE_YY_MORE_OFFSET |
750 | char *zconftext; | 766 | char *zconftext; |
767 | #define YY_NO_INPUT 1 | ||
751 | 768 | ||
752 | /* | 769 | /* |
753 | * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org> | 770 | * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org> |
@@ -834,6 +851,35 @@ void alloc_string(const char *str, int size) | |||
834 | 851 | ||
835 | static int yy_init_globals (void ); | 852 | static int yy_init_globals (void ); |
836 | 853 | ||
854 | /* Accessor methods to globals. | ||
855 | These are made visible to non-reentrant scanners for convenience. */ | ||
856 | |||
857 | int zconflex_destroy (void ); | ||
858 | |||
859 | int zconfget_debug (void ); | ||
860 | |||
861 | void zconfset_debug (int debug_flag ); | ||
862 | |||
863 | YY_EXTRA_TYPE zconfget_extra (void ); | ||
864 | |||
865 | void zconfset_extra (YY_EXTRA_TYPE user_defined ); | ||
866 | |||
867 | FILE *zconfget_in (void ); | ||
868 | |||
869 | void zconfset_in (FILE * in_str ); | ||
870 | |||
871 | FILE *zconfget_out (void ); | ||
872 | |||
873 | void zconfset_out (FILE * out_str ); | ||
874 | |||
875 | int zconfget_leng (void ); | ||
876 | |||
877 | char *zconfget_text (void ); | ||
878 | |||
879 | int zconfget_lineno (void ); | ||
880 | |||
881 | void zconfset_lineno (int line_number ); | ||
882 | |||
837 | /* Macros after this point can all be overridden by user definitions in | 883 | /* Macros after this point can all be overridden by user definitions in |
838 | * section 1. | 884 | * section 1. |
839 | */ | 885 | */ |
@@ -876,7 +922,7 @@ static int input (void ); | |||
876 | /* This used to be an fputs(), but since the string might contain NUL's, | 922 | /* This used to be an fputs(), but since the string might contain NUL's, |
877 | * we now use fwrite(). | 923 | * we now use fwrite(). |
878 | */ | 924 | */ |
879 | #define ECHO (void) fwrite( zconftext, zconfleng, 1, zconfout ) | 925 | #define ECHO fwrite( zconftext, zconfleng, 1, zconfout ) |
880 | #endif | 926 | #endif |
881 | 927 | ||
882 | /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, | 928 | /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, |
@@ -1540,6 +1586,14 @@ static int yy_get_next_buffer (void) | |||
1540 | else | 1586 | else |
1541 | ret_val = EOB_ACT_CONTINUE_SCAN; | 1587 | ret_val = EOB_ACT_CONTINUE_SCAN; |
1542 | 1588 | ||
1589 | if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { | ||
1590 | /* Extend the array by 50%, plus the number we really need. */ | ||
1591 | yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1); | ||
1592 | YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) zconfrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ); | ||
1593 | if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) | ||
1594 | YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); | ||
1595 | } | ||
1596 | |||
1543 | (yy_n_chars) += number_to_move; | 1597 | (yy_n_chars) += number_to_move; |
1544 | YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR; | 1598 | YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR; |
1545 | YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR; | 1599 | YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR; |
@@ -1926,7 +1980,9 @@ static void zconfensure_buffer_stack (void) | |||
1926 | (yy_buffer_stack) = (struct yy_buffer_state**)zconfalloc | 1980 | (yy_buffer_stack) = (struct yy_buffer_state**)zconfalloc |
1927 | (num_to_alloc * sizeof(struct yy_buffer_state*) | 1981 | (num_to_alloc * sizeof(struct yy_buffer_state*) |
1928 | ); | 1982 | ); |
1929 | 1983 | if ( ! (yy_buffer_stack) ) | |
1984 | YY_FATAL_ERROR( "out of dynamic memory in zconfensure_buffer_stack()" ); | ||
1985 | |||
1930 | memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); | 1986 | memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); |
1931 | 1987 | ||
1932 | (yy_buffer_stack_max) = num_to_alloc; | 1988 | (yy_buffer_stack_max) = num_to_alloc; |
@@ -1944,6 +2000,8 @@ static void zconfensure_buffer_stack (void) | |||
1944 | ((yy_buffer_stack), | 2000 | ((yy_buffer_stack), |
1945 | num_to_alloc * sizeof(struct yy_buffer_state*) | 2001 | num_to_alloc * sizeof(struct yy_buffer_state*) |
1946 | ); | 2002 | ); |
2003 | if ( ! (yy_buffer_stack) ) | ||
2004 | YY_FATAL_ERROR( "out of dynamic memory in zconfensure_buffer_stack()" ); | ||
1947 | 2005 | ||
1948 | /* zero only the new slots.*/ | 2006 | /* zero only the new slots.*/ |
1949 | memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*)); | 2007 | memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*)); |
diff --git a/scripts/kconfig/lkc.h b/scripts/kconfig/lkc.h index 96521cb087ec..4a9af6f7886b 100644 --- a/scripts/kconfig/lkc.h +++ b/scripts/kconfig/lkc.h | |||
@@ -42,6 +42,14 @@ extern "C" { | |||
42 | #define TF_PARAM 0x0002 | 42 | #define TF_PARAM 0x0002 |
43 | #define TF_OPTION 0x0004 | 43 | #define TF_OPTION 0x0004 |
44 | 44 | ||
45 | enum conf_def_mode { | ||
46 | def_default, | ||
47 | def_yes, | ||
48 | def_mod, | ||
49 | def_no, | ||
50 | def_random | ||
51 | }; | ||
52 | |||
45 | #define T_OPT_MODULES 1 | 53 | #define T_OPT_MODULES 1 |
46 | #define T_OPT_DEFCONFIG_LIST 2 | 54 | #define T_OPT_DEFCONFIG_LIST 2 |
47 | #define T_OPT_ENV 3 | 55 | #define T_OPT_ENV 3 |
@@ -69,6 +77,7 @@ const char *conf_get_configname(void); | |||
69 | char *conf_get_default_confname(void); | 77 | char *conf_get_default_confname(void); |
70 | void sym_set_change_count(int count); | 78 | void sym_set_change_count(int count); |
71 | void sym_add_change_count(int count); | 79 | void sym_add_change_count(int count); |
80 | void conf_set_all_new_symbols(enum conf_def_mode mode); | ||
72 | 81 | ||
73 | /* kconfig_load.c */ | 82 | /* kconfig_load.c */ |
74 | void kconfig_load(void); | 83 | void kconfig_load(void); |
diff --git a/scripts/kconfig/zconf.l b/scripts/kconfig/zconf.l index 4cea5c85cd0a..5164ef7ce499 100644 --- a/scripts/kconfig/zconf.l +++ b/scripts/kconfig/zconf.l | |||
@@ -1,5 +1,6 @@ | |||
1 | %option backup nostdinit noyywrap never-interactive full ecs | 1 | %option backup nostdinit noyywrap never-interactive full ecs |
2 | %option 8bit backup nodefault perf-report perf-report | 2 | %option 8bit backup nodefault perf-report perf-report |
3 | %option noinput | ||
3 | %x COMMAND HELP STRING PARAM | 4 | %x COMMAND HELP STRING PARAM |
4 | %{ | 5 | %{ |
5 | /* | 6 | /* |
diff --git a/scripts/kernel-doc b/scripts/kernel-doc index 88e3934a8b8c..44ee94d2ab76 100755 --- a/scripts/kernel-doc +++ b/scripts/kernel-doc | |||
@@ -781,6 +781,7 @@ sub output_struct_xml(%) { | |||
781 | print " <refsect1>\n"; | 781 | print " <refsect1>\n"; |
782 | print " <title>Members</title>\n"; | 782 | print " <title>Members</title>\n"; |
783 | 783 | ||
784 | if ($#{$args{'parameterlist'}} >= 0) { | ||
784 | print " <variablelist>\n"; | 785 | print " <variablelist>\n"; |
785 | foreach $parameter (@{$args{'parameterlist'}}) { | 786 | foreach $parameter (@{$args{'parameterlist'}}) { |
786 | ($parameter =~ /^#/) && next; | 787 | ($parameter =~ /^#/) && next; |
@@ -798,6 +799,9 @@ sub output_struct_xml(%) { | |||
798 | print " </varlistentry>\n"; | 799 | print " </varlistentry>\n"; |
799 | } | 800 | } |
800 | print " </variablelist>\n"; | 801 | print " </variablelist>\n"; |
802 | } else { | ||
803 | print " <para>\n None\n </para>\n"; | ||
804 | } | ||
801 | print " </refsect1>\n"; | 805 | print " </refsect1>\n"; |
802 | 806 | ||
803 | output_section_xml(@_); | 807 | output_section_xml(@_); |
@@ -1403,7 +1407,7 @@ sub dump_struct($$) { | |||
1403 | my $members = $3; | 1407 | my $members = $3; |
1404 | 1408 | ||
1405 | # ignore embedded structs or unions | 1409 | # ignore embedded structs or unions |
1406 | $members =~ s/{.*?}//g; | 1410 | $members =~ s/{.*}//g; |
1407 | 1411 | ||
1408 | # ignore members marked private: | 1412 | # ignore members marked private: |
1409 | $members =~ s/\/\*.*?private:.*?public:.*?\*\///gos; | 1413 | $members =~ s/\/\*.*?private:.*?public:.*?\*\///gos; |
@@ -1643,6 +1647,7 @@ sub dump_function($$) { | |||
1643 | $prototype =~ s/^__always_inline +//; | 1647 | $prototype =~ s/^__always_inline +//; |
1644 | $prototype =~ s/^noinline +//; | 1648 | $prototype =~ s/^noinline +//; |
1645 | $prototype =~ s/__devinit +//; | 1649 | $prototype =~ s/__devinit +//; |
1650 | $prototype =~ s/__init +//; | ||
1646 | $prototype =~ s/^#define\s+//; #ak added | 1651 | $prototype =~ s/^#define\s+//; #ak added |
1647 | $prototype =~ s/__attribute__\s*\(\([a-z,]*\)\)//; | 1652 | $prototype =~ s/__attribute__\s*\(\([a-z,]*\)\)//; |
1648 | 1653 | ||
diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c index 37d5c363fbcd..d4dc222a74f3 100644 --- a/scripts/mod/file2alias.c +++ b/scripts/mod/file2alias.c | |||
@@ -206,6 +206,20 @@ static void do_usb_table(void *symval, unsigned long size, | |||
206 | do_usb_entry_multi(symval + i, mod); | 206 | do_usb_entry_multi(symval + i, mod); |
207 | } | 207 | } |
208 | 208 | ||
209 | /* Looks like: hid:bNvNpN */ | ||
210 | static int do_hid_entry(const char *filename, | ||
211 | struct hid_device_id *id, char *alias) | ||
212 | { | ||
213 | id->vendor = TO_NATIVE(id->vendor); | ||
214 | id->product = TO_NATIVE(id->product); | ||
215 | |||
216 | sprintf(alias, "hid:b%04X", id->bus); | ||
217 | ADD(alias, "v", id->vendor != HID_ANY_ID, id->vendor); | ||
218 | ADD(alias, "p", id->product != HID_ANY_ID, id->product); | ||
219 | |||
220 | return 1; | ||
221 | } | ||
222 | |||
209 | /* Looks like: ieee1394:venNmoNspNverN */ | 223 | /* Looks like: ieee1394:venNmoNspNverN */ |
210 | static int do_ieee1394_entry(const char *filename, | 224 | static int do_ieee1394_entry(const char *filename, |
211 | struct ieee1394_device_id *id, char *alias) | 225 | struct ieee1394_device_id *id, char *alias) |
@@ -340,11 +354,24 @@ static int do_acpi_entry(const char *filename, | |||
340 | } | 354 | } |
341 | 355 | ||
342 | /* looks like: "pnp:dD" */ | 356 | /* looks like: "pnp:dD" */ |
343 | static int do_pnp_entry(const char *filename, | 357 | static void do_pnp_device_entry(void *symval, unsigned long size, |
344 | struct pnp_device_id *id, char *alias) | 358 | struct module *mod) |
345 | { | 359 | { |
346 | sprintf(alias, "pnp:d%s*", id->id); | 360 | const unsigned long id_size = sizeof(struct pnp_device_id); |
347 | return 1; | 361 | const unsigned int count = (size / id_size)-1; |
362 | const struct pnp_device_id *devs = symval; | ||
363 | unsigned int i; | ||
364 | |||
365 | device_id_check(mod->name, "pnp", size, id_size, symval); | ||
366 | |||
367 | for (i = 0; i < count; i++) { | ||
368 | const char *id = (char *)devs[i].id; | ||
369 | |||
370 | buf_printf(&mod->dev_table_buf, | ||
371 | "MODULE_ALIAS(\"pnp:d%s*\");\n", id); | ||
372 | buf_printf(&mod->dev_table_buf, | ||
373 | "MODULE_ALIAS(\"acpi*:%s:*\");\n", id); | ||
374 | } | ||
348 | } | 375 | } |
349 | 376 | ||
350 | /* looks like: "pnp:dD" for every device of the card */ | 377 | /* looks like: "pnp:dD" for every device of the card */ |
@@ -388,9 +415,12 @@ static void do_pnp_card_entries(void *symval, unsigned long size, | |||
388 | } | 415 | } |
389 | 416 | ||
390 | /* add an individual alias for every device entry */ | 417 | /* add an individual alias for every device entry */ |
391 | if (!dup) | 418 | if (!dup) { |
392 | buf_printf(&mod->dev_table_buf, | 419 | buf_printf(&mod->dev_table_buf, |
393 | "MODULE_ALIAS(\"pnp:d%s*\");\n", id); | 420 | "MODULE_ALIAS(\"pnp:d%s*\");\n", id); |
421 | buf_printf(&mod->dev_table_buf, | ||
422 | "MODULE_ALIAS(\"acpi*:%s:*\");\n", id); | ||
423 | } | ||
394 | } | 424 | } |
395 | } | 425 | } |
396 | } | 426 | } |
@@ -613,7 +643,60 @@ static int do_i2c_entry(const char *filename, struct i2c_device_id *id, | |||
613 | return 1; | 643 | return 1; |
614 | } | 644 | } |
615 | 645 | ||
616 | /* Ignore any prefix, eg. v850 prepends _ */ | 646 | static const struct dmifield { |
647 | const char *prefix; | ||
648 | int field; | ||
649 | } dmi_fields[] = { | ||
650 | { "bvn", DMI_BIOS_VENDOR }, | ||
651 | { "bvr", DMI_BIOS_VERSION }, | ||
652 | { "bd", DMI_BIOS_DATE }, | ||
653 | { "svn", DMI_SYS_VENDOR }, | ||
654 | { "pn", DMI_PRODUCT_NAME }, | ||
655 | { "pvr", DMI_PRODUCT_VERSION }, | ||
656 | { "rvn", DMI_BOARD_VENDOR }, | ||
657 | { "rn", DMI_BOARD_NAME }, | ||
658 | { "rvr", DMI_BOARD_VERSION }, | ||
659 | { "cvn", DMI_CHASSIS_VENDOR }, | ||
660 | { "ct", DMI_CHASSIS_TYPE }, | ||
661 | { "cvr", DMI_CHASSIS_VERSION }, | ||
662 | { NULL, DMI_NONE } | ||
663 | }; | ||
664 | |||
665 | static void dmi_ascii_filter(char *d, const char *s) | ||
666 | { | ||
667 | /* Filter out characters we don't want to see in the modalias string */ | ||
668 | for (; *s; s++) | ||
669 | if (*s > ' ' && *s < 127 && *s != ':') | ||
670 | *(d++) = *s; | ||
671 | |||
672 | *d = 0; | ||
673 | } | ||
674 | |||
675 | |||
676 | static int do_dmi_entry(const char *filename, struct dmi_system_id *id, | ||
677 | char *alias) | ||
678 | { | ||
679 | int i, j; | ||
680 | |||
681 | sprintf(alias, "dmi*"); | ||
682 | |||
683 | for (i = 0; i < ARRAY_SIZE(dmi_fields); i++) { | ||
684 | for (j = 0; j < 4; j++) { | ||
685 | if (id->matches[j].slot && | ||
686 | id->matches[j].slot == dmi_fields[i].field) { | ||
687 | sprintf(alias + strlen(alias), ":%s*", | ||
688 | dmi_fields[i].prefix); | ||
689 | dmi_ascii_filter(alias + strlen(alias), | ||
690 | id->matches[j].substr); | ||
691 | strcat(alias, "*"); | ||
692 | } | ||
693 | } | ||
694 | } | ||
695 | |||
696 | strcat(alias, ":"); | ||
697 | return 1; | ||
698 | } | ||
699 | /* Ignore any prefix, eg. some architectures prepend _ */ | ||
617 | static inline int sym_is(const char *symbol, const char *name) | 700 | static inline int sym_is(const char *symbol, const char *name) |
618 | { | 701 | { |
619 | const char *match; | 702 | const char *match; |
@@ -676,6 +759,10 @@ void handle_moddevtable(struct module *mod, struct elf_info *info, | |||
676 | else if (sym_is(symname, "__mod_usb_device_table")) | 759 | else if (sym_is(symname, "__mod_usb_device_table")) |
677 | /* special case to handle bcdDevice ranges */ | 760 | /* special case to handle bcdDevice ranges */ |
678 | do_usb_table(symval, sym->st_size, mod); | 761 | do_usb_table(symval, sym->st_size, mod); |
762 | else if (sym_is(symname, "__mod_hid_device_table")) | ||
763 | do_table(symval, sym->st_size, | ||
764 | sizeof(struct hid_device_id), "hid", | ||
765 | do_hid_entry, mod); | ||
679 | else if (sym_is(symname, "__mod_ieee1394_device_table")) | 766 | else if (sym_is(symname, "__mod_ieee1394_device_table")) |
680 | do_table(symval, sym->st_size, | 767 | do_table(symval, sym->st_size, |
681 | sizeof(struct ieee1394_device_id), "ieee1394", | 768 | sizeof(struct ieee1394_device_id), "ieee1394", |
@@ -701,9 +788,7 @@ void handle_moddevtable(struct module *mod, struct elf_info *info, | |||
701 | sizeof(struct acpi_device_id), "acpi", | 788 | sizeof(struct acpi_device_id), "acpi", |
702 | do_acpi_entry, mod); | 789 | do_acpi_entry, mod); |
703 | else if (sym_is(symname, "__mod_pnp_device_table")) | 790 | else if (sym_is(symname, "__mod_pnp_device_table")) |
704 | do_table(symval, sym->st_size, | 791 | do_pnp_device_entry(symval, sym->st_size, mod); |
705 | sizeof(struct pnp_device_id), "pnp", | ||
706 | do_pnp_entry, mod); | ||
707 | else if (sym_is(symname, "__mod_pnp_card_device_table")) | 792 | else if (sym_is(symname, "__mod_pnp_card_device_table")) |
708 | do_pnp_card_entries(symval, sym->st_size, mod); | 793 | do_pnp_card_entries(symval, sym->st_size, mod); |
709 | else if (sym_is(symname, "__mod_pcmcia_device_table")) | 794 | else if (sym_is(symname, "__mod_pcmcia_device_table")) |
@@ -746,6 +831,10 @@ void handle_moddevtable(struct module *mod, struct elf_info *info, | |||
746 | do_table(symval, sym->st_size, | 831 | do_table(symval, sym->st_size, |
747 | sizeof(struct i2c_device_id), "i2c", | 832 | sizeof(struct i2c_device_id), "i2c", |
748 | do_i2c_entry, mod); | 833 | do_i2c_entry, mod); |
834 | else if (sym_is(symname, "__mod_dmi_device_table")) | ||
835 | do_table(symval, sym->st_size, | ||
836 | sizeof(struct dmi_system_id), "dmi", | ||
837 | do_dmi_entry, mod); | ||
749 | free(zeros); | 838 | free(zeros); |
750 | } | 839 | } |
751 | 840 | ||
diff --git a/scripts/mod/mk_elfconfig.c b/scripts/mod/mk_elfconfig.c index db3881f14c2d..6a96d47bd1e6 100644 --- a/scripts/mod/mk_elfconfig.c +++ b/scripts/mod/mk_elfconfig.c | |||
@@ -55,7 +55,7 @@ main(int argc, char **argv) | |||
55 | else | 55 | else |
56 | exit(1); | 56 | exit(1); |
57 | 57 | ||
58 | if ((strcmp(argv[1], "v850") == 0) || (strcmp(argv[1], "h8300") == 0) | 58 | if ((strcmp(argv[1], "h8300") == 0) |
59 | || (strcmp(argv[1], "blackfin") == 0)) | 59 | || (strcmp(argv[1], "blackfin") == 0)) |
60 | printf("#define MODULE_SYMBOL_PREFIX \"_\"\n"); | 60 | printf("#define MODULE_SYMBOL_PREFIX \"_\"\n"); |
61 | else | 61 | else |
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c index a07f91aac920..88921611b22e 100644 --- a/scripts/mod/modpost.c +++ b/scripts/mod/modpost.c | |||
@@ -1468,7 +1468,7 @@ static void section_rel(const char *modname, struct elf_info *elf, | |||
1468 | * marked __initdata will be discarded when the module has been intialized. | 1468 | * marked __initdata will be discarded when the module has been intialized. |
1469 | * Likewise for modules used built-in the sections marked __exit | 1469 | * Likewise for modules used built-in the sections marked __exit |
1470 | * are discarded because __exit marked function are supposed to be called | 1470 | * are discarded because __exit marked function are supposed to be called |
1471 | * only when a moduel is unloaded which never happes for built-in modules. | 1471 | * only when a module is unloaded which never happens for built-in modules. |
1472 | * The check_sec_ref() function traverses all relocation records | 1472 | * The check_sec_ref() function traverses all relocation records |
1473 | * to find all references to a section that reference a section that will | 1473 | * to find all references to a section that reference a section that will |
1474 | * be discarded and warns about it. | 1474 | * be discarded and warns about it. |
@@ -1726,6 +1726,14 @@ static void add_header(struct buffer *b, struct module *mod) | |||
1726 | buf_printf(b, "};\n"); | 1726 | buf_printf(b, "};\n"); |
1727 | } | 1727 | } |
1728 | 1728 | ||
1729 | void add_staging_flag(struct buffer *b, const char *name) | ||
1730 | { | ||
1731 | static const char *staging_dir = "drivers/staging"; | ||
1732 | |||
1733 | if (strncmp(staging_dir, name, strlen(staging_dir)) == 0) | ||
1734 | buf_printf(b, "\nMODULE_INFO(staging, \"Y\");\n"); | ||
1735 | } | ||
1736 | |||
1729 | /** | 1737 | /** |
1730 | * Record CRCs for unresolved symbols | 1738 | * Record CRCs for unresolved symbols |
1731 | **/ | 1739 | **/ |
@@ -1986,13 +1994,16 @@ static void read_markers(const char *fname) | |||
1986 | 1994 | ||
1987 | mod = find_module(modname); | 1995 | mod = find_module(modname); |
1988 | if (!mod) { | 1996 | if (!mod) { |
1989 | if (is_vmlinux(modname)) | ||
1990 | have_vmlinux = 1; | ||
1991 | mod = new_module(NOFAIL(strdup(modname))); | 1997 | mod = new_module(NOFAIL(strdup(modname))); |
1992 | mod->skip = 1; | 1998 | mod->skip = 1; |
1993 | } | 1999 | } |
2000 | if (is_vmlinux(modname)) { | ||
2001 | have_vmlinux = 1; | ||
2002 | mod->skip = 0; | ||
2003 | } | ||
1994 | 2004 | ||
1995 | add_marker(mod, marker, fmt); | 2005 | if (!mod->skip) |
2006 | add_marker(mod, marker, fmt); | ||
1996 | } | 2007 | } |
1997 | return; | 2008 | return; |
1998 | fail: | 2009 | fail: |
@@ -2132,6 +2143,7 @@ int main(int argc, char **argv) | |||
2132 | buf.pos = 0; | 2143 | buf.pos = 0; |
2133 | 2144 | ||
2134 | add_header(&buf, mod); | 2145 | add_header(&buf, mod); |
2146 | add_staging_flag(&buf, mod->name); | ||
2135 | err |= add_versions(&buf, mod); | 2147 | err |= add_versions(&buf, mod); |
2136 | add_depends(&buf, mod, modules); | 2148 | add_depends(&buf, mod, modules); |
2137 | add_moddevtable(&buf, mod); | 2149 | add_moddevtable(&buf, mod); |
diff --git a/scripts/patch-kernel b/scripts/patch-kernel index ece46ef0ba54..46a59cae3a0a 100755 --- a/scripts/patch-kernel +++ b/scripts/patch-kernel | |||
@@ -213,6 +213,7 @@ fi | |||
213 | if [ $stopvers != "default" ]; then | 213 | if [ $stopvers != "default" ]; then |
214 | STOPSUBLEVEL=`echo $stopvers | cut -d. -f3` | 214 | STOPSUBLEVEL=`echo $stopvers | cut -d. -f3` |
215 | STOPEXTRA=`echo $stopvers | cut -d. -f4` | 215 | STOPEXTRA=`echo $stopvers | cut -d. -f4` |
216 | STOPFULLVERSION=${stopvers%%.$STOPEXTRA} | ||
216 | #echo "#___STOPSUBLEVEL=/$STOPSUBLEVEL/, STOPEXTRA=/$STOPEXTRA/" | 217 | #echo "#___STOPSUBLEVEL=/$STOPSUBLEVEL/, STOPEXTRA=/$STOPEXTRA/" |
217 | else | 218 | else |
218 | STOPSUBLEVEL=9999 | 219 | STOPSUBLEVEL=9999 |
@@ -249,7 +250,7 @@ while : # incrementing SUBLEVEL (s in v.p.s) | |||
249 | do | 250 | do |
250 | CURRENTFULLVERSION="$VERSION.$PATCHLEVEL.$SUBLEVEL" | 251 | CURRENTFULLVERSION="$VERSION.$PATCHLEVEL.$SUBLEVEL" |
251 | EXTRAVER= | 252 | EXTRAVER= |
252 | if [ $stopvers = $CURRENTFULLVERSION ]; then | 253 | if [ $STOPFULLVERSION = $CURRENTFULLVERSION ]; then |
253 | echo "Stopping at $CURRENTFULLVERSION base as requested." | 254 | echo "Stopping at $CURRENTFULLVERSION base as requested." |
254 | break | 255 | break |
255 | fi | 256 | fi |
diff --git a/scripts/recordmcount.pl b/scripts/recordmcount.pl new file mode 100755 index 000000000000..f56d760bd589 --- /dev/null +++ b/scripts/recordmcount.pl | |||
@@ -0,0 +1,395 @@ | |||
1 | #!/usr/bin/perl -w | ||
2 | # (c) 2008, Steven Rostedt <srostedt@redhat.com> | ||
3 | # Licensed under the terms of the GNU GPL License version 2 | ||
4 | # | ||
5 | # recordmcount.pl - makes a section called __mcount_loc that holds | ||
6 | # all the offsets to the calls to mcount. | ||
7 | # | ||
8 | # | ||
9 | # What we want to end up with is a section in vmlinux called | ||
10 | # __mcount_loc that contains a list of pointers to all the | ||
11 | # call sites in the kernel that call mcount. Later on boot up, the kernel | ||
12 | # will read this list, save the locations and turn them into nops. | ||
13 | # When tracing or profiling is later enabled, these locations will then | ||
14 | # be converted back to pointers to some function. | ||
15 | # | ||
16 | # This is no easy feat. This script is called just after the original | ||
17 | # object is compiled and before it is linked. | ||
18 | # | ||
19 | # The references to the call sites are offsets from the section of text | ||
20 | # that the call site is in. Hence, all functions in a section that | ||
21 | # has a call site to mcount, will have the offset from the beginning of | ||
22 | # the section and not the beginning of the function. | ||
23 | # | ||
24 | # The trick is to find a way to record the beginning of the section. | ||
25 | # The way we do this is to look at the first function in the section | ||
26 | # which will also be the location of that section after final link. | ||
27 | # e.g. | ||
28 | # | ||
29 | # .section ".text.sched" | ||
30 | # .globl my_func | ||
31 | # my_func: | ||
32 | # [...] | ||
33 | # call mcount (offset: 0x5) | ||
34 | # [...] | ||
35 | # ret | ||
36 | # other_func: | ||
37 | # [...] | ||
38 | # call mcount (offset: 0x1b) | ||
39 | # [...] | ||
40 | # | ||
41 | # Both relocation offsets for the mcounts in the above example will be | ||
42 | # offset from .text.sched. If we make another file called tmp.s with: | ||
43 | # | ||
44 | # .section __mcount_loc | ||
45 | # .quad my_func + 0x5 | ||
46 | # .quad my_func + 0x1b | ||
47 | # | ||
48 | # We can then compile this tmp.s into tmp.o, and link it to the original | ||
49 | # object. | ||
50 | # | ||
51 | # But this gets hard if my_func is not globl (a static function). | ||
52 | # In such a case we have: | ||
53 | # | ||
54 | # .section ".text.sched" | ||
55 | # my_func: | ||
56 | # [...] | ||
57 | # call mcount (offset: 0x5) | ||
58 | # [...] | ||
59 | # ret | ||
60 | # .globl my_func | ||
61 | # other_func: | ||
62 | # [...] | ||
63 | # call mcount (offset: 0x1b) | ||
64 | # [...] | ||
65 | # | ||
66 | # If we make the tmp.s the same as above, when we link together with | ||
67 | # the original object, we will end up with two symbols for my_func: | ||
68 | # one local, one global. After final compile, we will end up with | ||
69 | # an undefined reference to my_func. | ||
70 | # | ||
71 | # Since local objects can reference local variables, we need to find | ||
72 | # a way to make tmp.o reference the local objects of the original object | ||
73 | # file after it is linked together. To do this, we convert the my_func | ||
74 | # into a global symbol before linking tmp.o. Then after we link tmp.o | ||
75 | # we will only have a single symbol for my_func that is global. | ||
76 | # We can convert my_func back into a local symbol and we are done. | ||
77 | # | ||
78 | # Here are the steps we take: | ||
79 | # | ||
80 | # 1) Record all the local symbols by using 'nm' | ||
81 | # 2) Use objdump to find all the call site offsets and sections for | ||
82 | # mcount. | ||
83 | # 3) Compile the list into its own object. | ||
84 | # 4) Do we have to deal with local functions? If not, go to step 8. | ||
85 | # 5) Make an object that converts these local functions to global symbols | ||
86 | # with objcopy. | ||
87 | # 6) Link together this new object with the list object. | ||
88 | # 7) Convert the local functions back to local symbols and rename | ||
89 | # the result as the original object. | ||
90 | # End. | ||
91 | # 8) Link the object with the list object. | ||
92 | # 9) Move the result back to the original object. | ||
93 | # End. | ||
94 | # | ||
95 | |||
96 | use strict; | ||
97 | |||
98 | my $P = $0; | ||
99 | $P =~ s@.*/@@g; | ||
100 | |||
101 | my $V = '0.1'; | ||
102 | |||
103 | if ($#ARGV < 6) { | ||
104 | print "usage: $P arch objdump objcopy cc ld nm rm mv inputfile\n"; | ||
105 | print "version: $V\n"; | ||
106 | exit(1); | ||
107 | } | ||
108 | |||
109 | my ($arch, $objdump, $objcopy, $cc, $ld, $nm, $rm, $mv, $inputfile) = @ARGV; | ||
110 | |||
111 | $objdump = "objdump" if ((length $objdump) == 0); | ||
112 | $objcopy = "objcopy" if ((length $objcopy) == 0); | ||
113 | $cc = "gcc" if ((length $cc) == 0); | ||
114 | $ld = "ld" if ((length $ld) == 0); | ||
115 | $nm = "nm" if ((length $nm) == 0); | ||
116 | $rm = "rm" if ((length $rm) == 0); | ||
117 | $mv = "mv" if ((length $mv) == 0); | ||
118 | |||
119 | #print STDERR "running: $P '$arch' '$objdump' '$objcopy' '$cc' '$ld' " . | ||
120 | # "'$nm' '$rm' '$mv' '$inputfile'\n"; | ||
121 | |||
122 | my %locals; # List of local (static) functions | ||
123 | my %weak; # List of weak functions | ||
124 | my %convert; # List of local functions used that needs conversion | ||
125 | |||
126 | my $type; | ||
127 | my $section_regex; # Find the start of a section | ||
128 | my $function_regex; # Find the name of a function | ||
129 | # (return offset and func name) | ||
130 | my $mcount_regex; # Find the call site to mcount (return offset) | ||
131 | |||
132 | if ($arch eq "x86_64") { | ||
133 | $section_regex = "Disassembly of section"; | ||
134 | $function_regex = "^([0-9a-fA-F]+)\\s+<(.*?)>:"; | ||
135 | $mcount_regex = "^\\s*([0-9a-fA-F]+):.*\\smcount([+-]0x[0-9a-zA-Z]+)?\$"; | ||
136 | $type = ".quad"; | ||
137 | |||
138 | # force flags for this arch | ||
139 | $ld .= " -m elf_x86_64"; | ||
140 | $objdump .= " -M x86-64"; | ||
141 | $objcopy .= " -O elf64-x86-64"; | ||
142 | $cc .= " -m64"; | ||
143 | |||
144 | } elsif ($arch eq "i386") { | ||
145 | $section_regex = "Disassembly of section"; | ||
146 | $function_regex = "^([0-9a-fA-F]+)\\s+<(.*?)>:"; | ||
147 | $mcount_regex = "^\\s*([0-9a-fA-F]+):.*\\smcount\$"; | ||
148 | $type = ".long"; | ||
149 | |||
150 | # force flags for this arch | ||
151 | $ld .= " -m elf_i386"; | ||
152 | $objdump .= " -M i386"; | ||
153 | $objcopy .= " -O elf32-i386"; | ||
154 | $cc .= " -m32"; | ||
155 | |||
156 | } else { | ||
157 | die "Arch $arch is not supported with CONFIG_FTRACE_MCOUNT_RECORD"; | ||
158 | } | ||
159 | |||
160 | my $text_found = 0; | ||
161 | my $read_function = 0; | ||
162 | my $opened = 0; | ||
163 | my $mcount_section = "__mcount_loc"; | ||
164 | |||
165 | my $dirname; | ||
166 | my $filename; | ||
167 | my $prefix; | ||
168 | my $ext; | ||
169 | |||
170 | if ($inputfile =~ m,^(.*)/([^/]*)$,) { | ||
171 | $dirname = $1; | ||
172 | $filename = $2; | ||
173 | } else { | ||
174 | $dirname = "."; | ||
175 | $filename = $inputfile; | ||
176 | } | ||
177 | |||
178 | if ($filename =~ m,^(.*)(\.\S),) { | ||
179 | $prefix = $1; | ||
180 | $ext = $2; | ||
181 | } else { | ||
182 | $prefix = $filename; | ||
183 | $ext = ""; | ||
184 | } | ||
185 | |||
186 | my $mcount_s = $dirname . "/.tmp_mc_" . $prefix . ".s"; | ||
187 | my $mcount_o = $dirname . "/.tmp_mc_" . $prefix . ".o"; | ||
188 | |||
189 | # | ||
190 | # --globalize-symbols came out in 2.17, we must test the version | ||
191 | # of objcopy, and if it is less than 2.17, then we can not | ||
192 | # record local functions. | ||
193 | my $use_locals = 01; | ||
194 | my $local_warn_once = 0; | ||
195 | my $found_version = 0; | ||
196 | |||
197 | open (IN, "$objcopy --version |") || die "error running $objcopy"; | ||
198 | while (<IN>) { | ||
199 | if (/objcopy.*\s(\d+)\.(\d+)/) { | ||
200 | my $major = $1; | ||
201 | my $minor = $2; | ||
202 | |||
203 | $found_version = 1; | ||
204 | if ($major < 2 || | ||
205 | ($major == 2 && $minor < 17)) { | ||
206 | $use_locals = 0; | ||
207 | } | ||
208 | last; | ||
209 | } | ||
210 | } | ||
211 | close (IN); | ||
212 | |||
213 | if (!$found_version) { | ||
214 | print STDERR "WARNING: could not find objcopy version.\n" . | ||
215 | "\tDisabling local function references.\n"; | ||
216 | } | ||
217 | |||
218 | |||
219 | # | ||
220 | # Step 1: find all the local (static functions) and weak symbols. | ||
221 | # 't' is local, 'w/W' is weak (we never use a weak function) | ||
222 | # | ||
223 | open (IN, "$nm $inputfile|") || die "error running $nm"; | ||
224 | while (<IN>) { | ||
225 | if (/^[0-9a-fA-F]+\s+t\s+(\S+)/) { | ||
226 | $locals{$1} = 1; | ||
227 | } elsif (/^[0-9a-fA-F]+\s+([wW])\s+(\S+)/) { | ||
228 | $weak{$2} = $1; | ||
229 | } | ||
230 | } | ||
231 | close(IN); | ||
232 | |||
233 | my @offsets; # Array of offsets of mcount callers | ||
234 | my $ref_func; # reference function to use for offsets | ||
235 | my $offset = 0; # offset of ref_func to section beginning | ||
236 | |||
237 | ## | ||
238 | # update_funcs - print out the current mcount callers | ||
239 | # | ||
240 | # Go through the list of offsets to callers and write them to | ||
241 | # the output file in a format that can be read by an assembler. | ||
242 | # | ||
243 | sub update_funcs | ||
244 | { | ||
245 | return if ($#offsets < 0); | ||
246 | |||
247 | defined($ref_func) || die "No function to reference"; | ||
248 | |||
249 | # A section only had a weak function, to represent it. | ||
250 | # Unfortunately, a weak function may be overwritten by another | ||
251 | # function of the same name, making all these offsets incorrect. | ||
252 | # To be safe, we simply print a warning and bail. | ||
253 | if (defined $weak{$ref_func}) { | ||
254 | print STDERR | ||
255 | "$inputfile: WARNING: referencing weak function" . | ||
256 | " $ref_func for mcount\n"; | ||
257 | return; | ||
258 | } | ||
259 | |||
260 | # is this function static? If so, note this fact. | ||
261 | if (defined $locals{$ref_func}) { | ||
262 | |||
263 | # only use locals if objcopy supports globalize-symbols | ||
264 | if (!$use_locals) { | ||
265 | return; | ||
266 | } | ||
267 | $convert{$ref_func} = 1; | ||
268 | } | ||
269 | |||
270 | # Loop through all the mcount caller offsets and print a reference | ||
271 | # to the caller based from the ref_func. | ||
272 | for (my $i=0; $i <= $#offsets; $i++) { | ||
273 | if (!$opened) { | ||
274 | open(FILE, ">$mcount_s") || die "can't create $mcount_s\n"; | ||
275 | $opened = 1; | ||
276 | print FILE "\t.section $mcount_section,\"a\",\@progbits\n"; | ||
277 | } | ||
278 | printf FILE "\t%s %s + %d\n", $type, $ref_func, $offsets[$i] - $offset; | ||
279 | } | ||
280 | } | ||
281 | |||
282 | # | ||
283 | # Step 2: find the sections and mcount call sites | ||
284 | # | ||
285 | open(IN, "$objdump -dr $inputfile|") || die "error running $objdump"; | ||
286 | |||
287 | my $text; | ||
288 | |||
289 | while (<IN>) { | ||
290 | # is it a section? | ||
291 | if (/$section_regex/) { | ||
292 | $read_function = 1; | ||
293 | # print out any recorded offsets | ||
294 | update_funcs() if ($text_found); | ||
295 | |||
296 | # reset all markers and arrays | ||
297 | $text_found = 0; | ||
298 | undef($ref_func); | ||
299 | undef(@offsets); | ||
300 | |||
301 | # section found, now is this a start of a function? | ||
302 | } elsif ($read_function && /$function_regex/) { | ||
303 | $text_found = 1; | ||
304 | $offset = hex $1; | ||
305 | $text = $2; | ||
306 | |||
307 | # if this is either a local function or a weak function | ||
308 | # keep looking for functions that are global that | ||
309 | # we can use safely. | ||
310 | if (!defined($locals{$text}) && !defined($weak{$text})) { | ||
311 | $ref_func = $text; | ||
312 | $read_function = 0; | ||
313 | } else { | ||
314 | # if we already have a function, and this is weak, skip it | ||
315 | if (!defined($ref_func) || !defined($weak{$text})) { | ||
316 | $ref_func = $text; | ||
317 | } | ||
318 | } | ||
319 | } | ||
320 | |||
321 | # is this a call site to mcount? If so, record it to print later | ||
322 | if ($text_found && /$mcount_regex/) { | ||
323 | $offsets[$#offsets + 1] = hex $1; | ||
324 | } | ||
325 | } | ||
326 | |||
327 | # dump out anymore offsets that may have been found | ||
328 | update_funcs() if ($text_found); | ||
329 | |||
330 | # If we did not find any mcount callers, we are done (do nothing). | ||
331 | if (!$opened) { | ||
332 | exit(0); | ||
333 | } | ||
334 | |||
335 | close(FILE); | ||
336 | |||
337 | # | ||
338 | # Step 3: Compile the file that holds the list of call sites to mcount. | ||
339 | # | ||
340 | `$cc -o $mcount_o -c $mcount_s`; | ||
341 | |||
342 | my @converts = keys %convert; | ||
343 | |||
344 | # | ||
345 | # Step 4: Do we have sections that started with local functions? | ||
346 | # | ||
347 | if ($#converts >= 0) { | ||
348 | my $globallist = ""; | ||
349 | my $locallist = ""; | ||
350 | |||
351 | foreach my $con (@converts) { | ||
352 | $globallist .= " --globalize-symbol $con"; | ||
353 | $locallist .= " --localize-symbol $con"; | ||
354 | } | ||
355 | |||
356 | my $globalobj = $dirname . "/.tmp_gl_" . $filename; | ||
357 | my $globalmix = $dirname . "/.tmp_mx_" . $filename; | ||
358 | |||
359 | # | ||
360 | # Step 5: set up each local function as a global | ||
361 | # | ||
362 | `$objcopy $globallist $inputfile $globalobj`; | ||
363 | |||
364 | # | ||
365 | # Step 6: Link the global version to our list. | ||
366 | # | ||
367 | `$ld -r $globalobj $mcount_o -o $globalmix`; | ||
368 | |||
369 | # | ||
370 | # Step 7: Convert the local functions back into local symbols | ||
371 | # | ||
372 | `$objcopy $locallist $globalmix $inputfile`; | ||
373 | |||
374 | # Remove the temp files | ||
375 | `$rm $globalobj $globalmix`; | ||
376 | |||
377 | } else { | ||
378 | |||
379 | my $mix = $dirname . "/.tmp_mx_" . $filename; | ||
380 | |||
381 | # | ||
382 | # Step 8: Link the object with our list of call sites object. | ||
383 | # | ||
384 | `$ld -r $inputfile $mcount_o -o $mix`; | ||
385 | |||
386 | # | ||
387 | # Step 9: Move the result back to the original object. | ||
388 | # | ||
389 | `$mv $mix $inputfile`; | ||
390 | } | ||
391 | |||
392 | # Clean up the temp files | ||
393 | `$rm $mcount_o $mcount_s`; | ||
394 | |||
395 | exit(0); | ||
diff --git a/scripts/selinux/Makefile b/scripts/selinux/Makefile new file mode 100644 index 000000000000..ca4b1ec01822 --- /dev/null +++ b/scripts/selinux/Makefile | |||
@@ -0,0 +1,2 @@ | |||
1 | subdir-y := mdp | ||
2 | subdir- += mdp | ||
diff --git a/scripts/selinux/README b/scripts/selinux/README new file mode 100644 index 000000000000..a936315ba2c8 --- /dev/null +++ b/scripts/selinux/README | |||
@@ -0,0 +1,2 @@ | |||
1 | Please see Documentation/SELinux.txt for information on | ||
2 | installing a dummy SELinux policy. | ||
diff --git a/scripts/selinux/install_policy.sh b/scripts/selinux/install_policy.sh new file mode 100644 index 000000000000..7b9ccf61f8f9 --- /dev/null +++ b/scripts/selinux/install_policy.sh | |||
@@ -0,0 +1,69 @@ | |||
1 | #!/bin/sh | ||
2 | if [ `id -u` -ne 0 ]; then | ||
3 | echo "$0: must be root to install the selinux policy" | ||
4 | exit 1 | ||
5 | fi | ||
6 | SF=`which setfiles` | ||
7 | if [ $? -eq 1 ]; then | ||
8 | if [ -f /sbin/setfiles ]; then | ||
9 | SF="/usr/setfiles" | ||
10 | else | ||
11 | echo "no selinux tools installed: setfiles" | ||
12 | exit 1 | ||
13 | fi | ||
14 | fi | ||
15 | |||
16 | cd mdp | ||
17 | |||
18 | CP=`which checkpolicy` | ||
19 | VERS=`$CP -V | awk '{print $1}'` | ||
20 | |||
21 | ./mdp policy.conf file_contexts | ||
22 | $CP -o policy.$VERS policy.conf | ||
23 | |||
24 | mkdir -p /etc/selinux/dummy/policy | ||
25 | mkdir -p /etc/selinux/dummy/contexts/files | ||
26 | |||
27 | cp file_contexts /etc/selinux/dummy/contexts/files | ||
28 | cp dbus_contexts /etc/selinux/dummy/contexts | ||
29 | cp policy.$VERS /etc/selinux/dummy/policy | ||
30 | FC_FILE=/etc/selinux/dummy/contexts/files/file_contexts | ||
31 | |||
32 | if [ ! -d /etc/selinux ]; then | ||
33 | mkdir -p /etc/selinux | ||
34 | fi | ||
35 | if [ ! -f /etc/selinux/config ]; then | ||
36 | cat > /etc/selinux/config << EOF | ||
37 | SELINUX=enforcing | ||
38 | SELINUXTYPE=dummy | ||
39 | EOF | ||
40 | else | ||
41 | TYPE=`cat /etc/selinux/config | grep "^SELINUXTYPE" | tail -1 | awk -F= '{ print $2 '}` | ||
42 | if [ "eq$TYPE" != "eqdummy" ]; then | ||
43 | selinuxenabled | ||
44 | if [ $? -eq 0 ]; then | ||
45 | echo "SELinux already enabled with a non-dummy policy." | ||
46 | echo "Exiting. Please install policy by hand if that" | ||
47 | echo "is what you REALLY want." | ||
48 | exit 1 | ||
49 | fi | ||
50 | mv /etc/selinux/config /etc/selinux/config.mdpbak | ||
51 | grep -v "^SELINUXTYPE" /etc/selinux/config.mdpbak >> /etc/selinux/config | ||
52 | echo "SELINUXTYPE=dummy" >> /etc/selinux/config | ||
53 | fi | ||
54 | fi | ||
55 | |||
56 | cd /etc/selinux/dummy/contexts/files | ||
57 | $SF file_contexts / | ||
58 | |||
59 | mounts=`cat /proc/$$/mounts | egrep "ext2|ext3|xfs|jfs|ext4|ext4dev|gfs2" | awk '{ print $2 '}` | ||
60 | $SF file_contexts $mounts | ||
61 | |||
62 | |||
63 | dodev=`cat /proc/$$/mounts | grep "/dev "` | ||
64 | if [ "eq$dodev" != "eq" ]; then | ||
65 | mount --move /dev /mnt | ||
66 | $SF file_contexts /dev | ||
67 | mount --move /mnt /dev | ||
68 | fi | ||
69 | |||
diff --git a/scripts/selinux/mdp/.gitignore b/scripts/selinux/mdp/.gitignore new file mode 100644 index 000000000000..654546d8dffd --- /dev/null +++ b/scripts/selinux/mdp/.gitignore | |||
@@ -0,0 +1,2 @@ | |||
1 | # Generated file | ||
2 | mdp | ||
diff --git a/scripts/selinux/mdp/Makefile b/scripts/selinux/mdp/Makefile new file mode 100644 index 000000000000..eb365b333441 --- /dev/null +++ b/scripts/selinux/mdp/Makefile | |||
@@ -0,0 +1,5 @@ | |||
1 | hostprogs-y := mdp | ||
2 | HOST_EXTRACFLAGS += -Isecurity/selinux/include | ||
3 | |||
4 | always := $(hostprogs-y) | ||
5 | clean-files := $(hostprogs-y) policy.* file_contexts | ||
diff --git a/scripts/selinux/mdp/dbus_contexts b/scripts/selinux/mdp/dbus_contexts new file mode 100644 index 000000000000..116e684f9fc1 --- /dev/null +++ b/scripts/selinux/mdp/dbus_contexts | |||
@@ -0,0 +1,6 @@ | |||
1 | <!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN" | ||
2 | "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd"> | ||
3 | <busconfig> | ||
4 | <selinux> | ||
5 | </selinux> | ||
6 | </busconfig> | ||
diff --git a/scripts/selinux/mdp/mdp.c b/scripts/selinux/mdp/mdp.c new file mode 100644 index 000000000000..ca757d486187 --- /dev/null +++ b/scripts/selinux/mdp/mdp.c | |||
@@ -0,0 +1,242 @@ | |||
1 | /* | ||
2 | * | ||
3 | * mdp - make dummy policy | ||
4 | * | ||
5 | * When pointed at a kernel tree, builds a dummy policy for that kernel | ||
6 | * with exactly one type with full rights to itself. | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License as published by | ||
10 | * the Free Software Foundation; either version 2 of the License, or | ||
11 | * (at your option) any later version. | ||
12 | * | ||
13 | * This program is distributed in the hope that it will be useful, | ||
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
16 | * GNU General Public License for more details. | ||
17 | * | ||
18 | * You should have received a copy of the GNU General Public License | ||
19 | * along with this program; if not, write to the Free Software | ||
20 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||
21 | * | ||
22 | * Copyright (C) IBM Corporation, 2006 | ||
23 | * | ||
24 | * Authors: Serge E. Hallyn <serue@us.ibm.com> | ||
25 | */ | ||
26 | |||
27 | #include <stdio.h> | ||
28 | #include <stdlib.h> | ||
29 | #include <unistd.h> | ||
30 | #include <string.h> | ||
31 | |||
32 | #include "flask.h" | ||
33 | |||
34 | void usage(char *name) | ||
35 | { | ||
36 | printf("usage: %s [-m] policy_file context_file\n", name); | ||
37 | exit(1); | ||
38 | } | ||
39 | |||
40 | void find_common_name(char *cname, char *dest, int len) | ||
41 | { | ||
42 | char *start, *end; | ||
43 | |||
44 | start = strchr(cname, '_')+1; | ||
45 | end = strchr(start, '_'); | ||
46 | if (!start || !end || start-cname > len || end-start > len) { | ||
47 | printf("Error with commons defines\n"); | ||
48 | exit(1); | ||
49 | } | ||
50 | strncpy(dest, start, end-start); | ||
51 | dest[end-start] = '\0'; | ||
52 | } | ||
53 | |||
54 | #define S_(x) x, | ||
55 | static char *classlist[] = { | ||
56 | #include "class_to_string.h" | ||
57 | NULL | ||
58 | }; | ||
59 | #undef S_ | ||
60 | |||
61 | #include "initial_sid_to_string.h" | ||
62 | |||
63 | #define TB_(x) char *x[] = { | ||
64 | #define TE_(x) NULL }; | ||
65 | #define S_(x) x, | ||
66 | #include "common_perm_to_string.h" | ||
67 | #undef TB_ | ||
68 | #undef TE_ | ||
69 | #undef S_ | ||
70 | |||
71 | struct common { | ||
72 | char *cname; | ||
73 | char **perms; | ||
74 | }; | ||
75 | struct common common[] = { | ||
76 | #define TB_(x) { #x, x }, | ||
77 | #define S_(x) | ||
78 | #define TE_(x) | ||
79 | #include "common_perm_to_string.h" | ||
80 | #undef TB_ | ||
81 | #undef TE_ | ||
82 | #undef S_ | ||
83 | }; | ||
84 | |||
85 | #define S_(x, y, z) {x, #y}, | ||
86 | struct av_inherit { | ||
87 | int class; | ||
88 | char *common; | ||
89 | }; | ||
90 | struct av_inherit av_inherit[] = { | ||
91 | #include "av_inherit.h" | ||
92 | }; | ||
93 | #undef S_ | ||
94 | |||
95 | #include "av_permissions.h" | ||
96 | #define S_(x, y, z) {x, y, z}, | ||
97 | struct av_perms { | ||
98 | int class; | ||
99 | int perm_i; | ||
100 | char *perm_s; | ||
101 | }; | ||
102 | struct av_perms av_perms[] = { | ||
103 | #include "av_perm_to_string.h" | ||
104 | }; | ||
105 | #undef S_ | ||
106 | |||
107 | int main(int argc, char *argv[]) | ||
108 | { | ||
109 | int i, j, mls = 0; | ||
110 | char **arg, *polout, *ctxout; | ||
111 | int classlist_len, initial_sid_to_string_len; | ||
112 | FILE *fout; | ||
113 | |||
114 | if (argc < 3) | ||
115 | usage(argv[0]); | ||
116 | arg = argv+1; | ||
117 | if (argc==4 && strcmp(argv[1], "-m") == 0) { | ||
118 | mls = 1; | ||
119 | arg++; | ||
120 | } | ||
121 | polout = *arg++; | ||
122 | ctxout = *arg; | ||
123 | |||
124 | fout = fopen(polout, "w"); | ||
125 | if (!fout) { | ||
126 | printf("Could not open %s for writing\n", polout); | ||
127 | usage(argv[0]); | ||
128 | } | ||
129 | |||
130 | classlist_len = sizeof(classlist) / sizeof(char *); | ||
131 | /* print out the classes */ | ||
132 | for (i=1; i < classlist_len; i++) { | ||
133 | if(classlist[i]) | ||
134 | fprintf(fout, "class %s\n", classlist[i]); | ||
135 | else | ||
136 | fprintf(fout, "class user%d\n", i); | ||
137 | } | ||
138 | fprintf(fout, "\n"); | ||
139 | |||
140 | initial_sid_to_string_len = sizeof(initial_sid_to_string) / sizeof (char *); | ||
141 | /* print out the sids */ | ||
142 | for (i=1; i < initial_sid_to_string_len; i++) | ||
143 | fprintf(fout, "sid %s\n", initial_sid_to_string[i]); | ||
144 | fprintf(fout, "\n"); | ||
145 | |||
146 | /* print out the commons */ | ||
147 | for (i=0; i< sizeof(common)/sizeof(struct common); i++) { | ||
148 | char cname[101]; | ||
149 | find_common_name(common[i].cname, cname, 100); | ||
150 | cname[100] = '\0'; | ||
151 | fprintf(fout, "common %s\n{\n", cname); | ||
152 | for (j=0; common[i].perms[j]; j++) | ||
153 | fprintf(fout, "\t%s\n", common[i].perms[j]); | ||
154 | fprintf(fout, "}\n\n"); | ||
155 | } | ||
156 | fprintf(fout, "\n"); | ||
157 | |||
158 | /* print out the class permissions */ | ||
159 | for (i=1; i < classlist_len; i++) { | ||
160 | if (classlist[i]) { | ||
161 | int firstperm = -1, numperms = 0; | ||
162 | |||
163 | fprintf(fout, "class %s\n", classlist[i]); | ||
164 | /* does it inherit from a common? */ | ||
165 | for (j=0; j < sizeof(av_inherit)/sizeof(struct av_inherit); j++) | ||
166 | if (av_inherit[j].class == i) | ||
167 | fprintf(fout, "inherits %s\n", av_inherit[j].common); | ||
168 | |||
169 | for (j=0; j < sizeof(av_perms)/sizeof(struct av_perms); j++) { | ||
170 | if (av_perms[j].class == i) { | ||
171 | if (firstperm == -1) | ||
172 | firstperm = j; | ||
173 | numperms++; | ||
174 | } | ||
175 | } | ||
176 | if (!numperms) { | ||
177 | fprintf(fout, "\n"); | ||
178 | continue; | ||
179 | } | ||
180 | |||
181 | fprintf(fout, "{\n"); | ||
182 | /* print out the av_perms */ | ||
183 | for (j=0; j < numperms; j++) { | ||
184 | fprintf(fout, "\t%s\n", av_perms[firstperm+j].perm_s); | ||
185 | } | ||
186 | fprintf(fout, "}\n\n"); | ||
187 | } | ||
188 | } | ||
189 | fprintf(fout, "\n"); | ||
190 | |||
191 | /* NOW PRINT OUT MLS STUFF */ | ||
192 | if (mls) { | ||
193 | printf("MLS not yet implemented\n"); | ||
194 | exit(1); | ||
195 | } | ||
196 | |||
197 | /* types, roles, and allows */ | ||
198 | fprintf(fout, "type base_t;\n"); | ||
199 | fprintf(fout, "role base_r types { base_t };\n"); | ||
200 | for (i=1; i < classlist_len; i++) { | ||
201 | if (classlist[i]) | ||
202 | fprintf(fout, "allow base_t base_t:%s *;\n", classlist[i]); | ||
203 | else | ||
204 | fprintf(fout, "allow base_t base_t:user%d *;\n", i); | ||
205 | } | ||
206 | fprintf(fout, "user user_u roles { base_r };\n"); | ||
207 | fprintf(fout, "\n"); | ||
208 | |||
209 | /* default sids */ | ||
210 | for (i=1; i < initial_sid_to_string_len; i++) | ||
211 | fprintf(fout, "sid %s user_u:base_r:base_t\n", initial_sid_to_string[i]); | ||
212 | fprintf(fout, "\n"); | ||
213 | |||
214 | |||
215 | fprintf(fout, "fs_use_xattr ext2 user_u:base_r:base_t;\n"); | ||
216 | fprintf(fout, "fs_use_xattr ext3 user_u:base_r:base_t;\n"); | ||
217 | fprintf(fout, "fs_use_xattr jfs user_u:base_r:base_t;\n"); | ||
218 | fprintf(fout, "fs_use_xattr xfs user_u:base_r:base_t;\n"); | ||
219 | fprintf(fout, "fs_use_xattr reiserfs user_u:base_r:base_t;\n"); | ||
220 | |||
221 | fprintf(fout, "fs_use_task pipefs user_u:base_r:base_t;\n"); | ||
222 | fprintf(fout, "fs_use_task sockfs user_u:base_r:base_t;\n"); | ||
223 | |||
224 | fprintf(fout, "fs_use_trans devpts user_u:base_r:base_t;\n"); | ||
225 | fprintf(fout, "fs_use_trans tmpfs user_u:base_r:base_t;\n"); | ||
226 | fprintf(fout, "fs_use_trans shm user_u:base_r:base_t;\n"); | ||
227 | |||
228 | fprintf(fout, "genfscon proc / user_u:base_r:base_t\n"); | ||
229 | |||
230 | fclose(fout); | ||
231 | |||
232 | fout = fopen(ctxout, "w"); | ||
233 | if (!fout) { | ||
234 | printf("Wrote policy, but cannot open %s for writing\n", ctxout); | ||
235 | usage(argv[0]); | ||
236 | } | ||
237 | fprintf(fout, "/ user_u:base_r:base_t\n"); | ||
238 | fprintf(fout, "/.* user_u:base_r:base_t\n"); | ||
239 | fclose(fout); | ||
240 | |||
241 | return 0; | ||
242 | } | ||
diff --git a/scripts/setlocalversion b/scripts/setlocalversion index 1c1bdaf7348a..83b75126c9f7 100755 --- a/scripts/setlocalversion +++ b/scripts/setlocalversion | |||
@@ -12,7 +12,9 @@ cd "${1:-.}" || usage | |||
12 | if head=`git rev-parse --verify HEAD 2>/dev/null`; then | 12 | if head=`git rev-parse --verify HEAD 2>/dev/null`; then |
13 | # Do we have an untagged version? | 13 | # Do we have an untagged version? |
14 | if git name-rev --tags HEAD | grep -E '^HEAD[[:space:]]+(.*~[0-9]*|undefined)$' > /dev/null; then | 14 | if git name-rev --tags HEAD | grep -E '^HEAD[[:space:]]+(.*~[0-9]*|undefined)$' > /dev/null; then |
15 | git describe | awk -F- '{printf("-%05d-%s", $(NF-1),$(NF))}' | 15 | if tag=`git describe 2>/dev/null`; then |
16 | echo $tag | awk -F- '{printf("-%05d-%s", $(NF-1),$(NF))}' | ||
17 | fi | ||
16 | fi | 18 | fi |
17 | 19 | ||
18 | # Are there uncommitted changes? | 20 | # Are there uncommitted changes? |
diff --git a/scripts/ver_linux b/scripts/ver_linux index 7ac0e309be09..dbb3037f1346 100755 --- a/scripts/ver_linux +++ b/scripts/ver_linux | |||
@@ -4,7 +4,6 @@ | |||
4 | # /bin /sbin /usr/bin /usr/sbin /usr/local/bin, but it may | 4 | # /bin /sbin /usr/bin /usr/sbin /usr/local/bin, but it may |
5 | # differ on your system. | 5 | # differ on your system. |
6 | # | 6 | # |
7 | PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/local/sbin:$PATH | ||
8 | echo 'If some fields are empty or look unusual you may have an old version.' | 7 | echo 'If some fields are empty or look unusual you may have an old version.' |
9 | echo 'Compare to the current minimal requirements in Documentation/Changes.' | 8 | echo 'Compare to the current minimal requirements in Documentation/Changes.' |
10 | echo ' ' | 9 | echo ' ' |