diff options
author | Frederic Weisbecker <fweisbec@gmail.com> | 2009-12-07 01:28:35 -0500 |
---|---|---|
committer | Frederic Weisbecker <fweisbec@gmail.com> | 2009-12-07 01:29:22 -0500 |
commit | 6548698f929814375fa5d62ae1db96959b0418c1 (patch) | |
tree | 340924ae82cb0946aa15045b2b72186de52a8146 /scripts | |
parent | 1d2c6cfd40b2dece3bb958cbbc405a2c1536ab75 (diff) | |
parent | 22763c5cf3690a681551162c15d34d935308c8d7 (diff) |
Merge commit 'v2.6.32' into reiserfs/kill-bkl
Merge-reason: The tree was based 2.6.31. It's better to be up to date
with 2.6.32. Although no conflicting changes were made in between,
it gives benchmarking results closer to the lastest kernel behaviour.
Diffstat (limited to 'scripts')
56 files changed, 1548 insertions, 746 deletions
diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include index c29be8f90248..c67e73ecd5be 100644 --- a/scripts/Kbuild.include +++ b/scripts/Kbuild.include | |||
@@ -83,11 +83,12 @@ TMPOUT := $(if $(KBUILD_EXTMOD),$(firstword $(KBUILD_EXTMOD))/) | |||
83 | # is automatically cleaned up. | 83 | # is automatically cleaned up. |
84 | try-run = $(shell set -e; \ | 84 | try-run = $(shell set -e; \ |
85 | TMP="$(TMPOUT).$$$$.tmp"; \ | 85 | TMP="$(TMPOUT).$$$$.tmp"; \ |
86 | TMPO="$(TMPOUT).$$$$.o"; \ | ||
86 | if ($(1)) >/dev/null 2>&1; \ | 87 | if ($(1)) >/dev/null 2>&1; \ |
87 | then echo "$(2)"; \ | 88 | then echo "$(2)"; \ |
88 | else echo "$(3)"; \ | 89 | else echo "$(3)"; \ |
89 | fi; \ | 90 | fi; \ |
90 | rm -f "$$TMP") | 91 | rm -f "$$TMP" "$$TMPO") |
91 | 92 | ||
92 | # as-option | 93 | # as-option |
93 | # Usage: cflags-y += $(call as-option,-Wa$(comma)-isa=foo,) | 94 | # Usage: cflags-y += $(call as-option,-Wa$(comma)-isa=foo,) |
@@ -99,18 +100,18 @@ as-option = $(call try-run,\ | |||
99 | # Usage: cflags-y += $(call as-instr,instr,option1,option2) | 100 | # Usage: cflags-y += $(call as-instr,instr,option1,option2) |
100 | 101 | ||
101 | as-instr = $(call try-run,\ | 102 | as-instr = $(call try-run,\ |
102 | echo -e "$(1)" | $(CC) $(KBUILD_AFLAGS) -c -xassembler -o "$$TMP" -,$(2),$(3)) | 103 | /bin/echo -e "$(1)" | $(CC) $(KBUILD_AFLAGS) -c -xassembler -o "$$TMP" -,$(2),$(3)) |
103 | 104 | ||
104 | # cc-option | 105 | # cc-option |
105 | # Usage: cflags-y += $(call cc-option,-march=winchip-c6,-march=i586) | 106 | # Usage: cflags-y += $(call cc-option,-march=winchip-c6,-march=i586) |
106 | 107 | ||
107 | cc-option = $(call try-run,\ | 108 | cc-option = $(call try-run,\ |
108 | $(CC) $(KBUILD_CFLAGS) $(1) -c -xc /dev/null -o "$$TMP",$(1),$(2)) | 109 | $(CC) $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) $(1) -c -xc /dev/null -o "$$TMP",$(1),$(2)) |
109 | 110 | ||
110 | # cc-option-yn | 111 | # cc-option-yn |
111 | # Usage: flag := $(call cc-option-yn,-march=winchip-c6) | 112 | # Usage: flag := $(call cc-option-yn,-march=winchip-c6) |
112 | cc-option-yn = $(call try-run,\ | 113 | cc-option-yn = $(call try-run,\ |
113 | $(CC) $(KBUILD_CFLAGS) $(1) -c -xc /dev/null -o "$$TMP",y,n) | 114 | $(CC) $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) $(1) -c -xc /dev/null -o "$$TMP",y,n) |
114 | 115 | ||
115 | # cc-option-align | 116 | # cc-option-align |
116 | # Prefix align with either -falign or -malign | 117 | # Prefix align with either -falign or -malign |
@@ -130,10 +131,15 @@ cc-fullversion = $(shell $(CONFIG_SHELL) \ | |||
130 | # Usage: EXTRA_CFLAGS += $(call cc-ifversion, -lt, 0402, -O1) | 131 | # Usage: EXTRA_CFLAGS += $(call cc-ifversion, -lt, 0402, -O1) |
131 | cc-ifversion = $(shell [ $(call cc-version, $(CC)) $(1) $(2) ] && echo $(3)) | 132 | cc-ifversion = $(shell [ $(call cc-version, $(CC)) $(1) $(2) ] && echo $(3)) |
132 | 133 | ||
134 | # cc-ldoption | ||
135 | # Usage: ldflags += $(call cc-ldoption, -Wl$(comma)--hash-style=both) | ||
136 | cc-ldoption = $(call try-run,\ | ||
137 | $(CC) $(1) -nostdlib -xc /dev/null -o "$$TMP",$(1),$(2)) | ||
138 | |||
133 | # ld-option | 139 | # ld-option |
134 | # Usage: ldflags += $(call ld-option, -Wl$(comma)--hash-style=both) | 140 | # Usage: LDFLAGS += $(call ld-option, -X) |
135 | ld-option = $(call try-run,\ | 141 | ld-option = $(call try-run,\ |
136 | $(CC) $(1) -nostdlib -xc /dev/null -o "$$TMP",$(1),$(2)) | 142 | $(CC) /dev/null -c -o "$$TMPO" ; $(LD) $(1) "$$TMPO" -o "$$TMP",$(1),$(2)) |
137 | 143 | ||
138 | ###### | 144 | ###### |
139 | 145 | ||
diff --git a/scripts/Makefile b/scripts/Makefile index 9dd5b25a1d53..842dbc2d5aed 100644 --- a/scripts/Makefile +++ b/scripts/Makefile | |||
@@ -10,7 +10,6 @@ | |||
10 | hostprogs-$(CONFIG_KALLSYMS) += kallsyms | 10 | hostprogs-$(CONFIG_KALLSYMS) += kallsyms |
11 | hostprogs-$(CONFIG_LOGO) += pnmtologo | 11 | hostprogs-$(CONFIG_LOGO) += pnmtologo |
12 | hostprogs-$(CONFIG_VT) += conmakehash | 12 | hostprogs-$(CONFIG_VT) += conmakehash |
13 | hostprogs-$(CONFIG_PROM_CONSOLE) += conmakehash | ||
14 | hostprogs-$(CONFIG_IKCONFIG) += bin2c | 13 | hostprogs-$(CONFIG_IKCONFIG) += bin2c |
15 | 14 | ||
16 | always := $(hostprogs-y) $(hostprogs-m) | 15 | always := $(hostprogs-y) $(hostprogs-m) |
diff --git a/scripts/Makefile.build b/scripts/Makefile.build index 5c4b7a400c18..341b58902ffc 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build | |||
@@ -206,7 +206,7 @@ cmd_modversions = \ | |||
206 | endif | 206 | endif |
207 | 207 | ||
208 | ifdef CONFIG_FTRACE_MCOUNT_RECORD | 208 | ifdef CONFIG_FTRACE_MCOUNT_RECORD |
209 | cmd_record_mcount = perl $(srctree)/scripts/recordmcount.pl "$(ARCH)" \ | 209 | cmd_record_mcount = set -e ; perl $(srctree)/scripts/recordmcount.pl "$(ARCH)" \ |
210 | "$(if $(CONFIG_64BIT),64,32)" \ | 210 | "$(if $(CONFIG_64BIT),64,32)" \ |
211 | "$(OBJDUMP)" "$(OBJCOPY)" "$(CC)" "$(LD)" "$(NM)" "$(RM)" "$(MV)" \ | 211 | "$(OBJDUMP)" "$(OBJCOPY)" "$(CC)" "$(LD)" "$(NM)" "$(RM)" "$(MV)" \ |
212 | "$(if $(part-of-module),1,0)" "$(@)"; | 212 | "$(if $(part-of-module),1,0)" "$(@)"; |
@@ -216,6 +216,7 @@ define rule_cc_o_c | |||
216 | $(call echo-cmd,checksrc) $(cmd_checksrc) \ | 216 | $(call echo-cmd,checksrc) $(cmd_checksrc) \ |
217 | $(call echo-cmd,cc_o_c) $(cmd_cc_o_c); \ | 217 | $(call echo-cmd,cc_o_c) $(cmd_cc_o_c); \ |
218 | $(cmd_modversions) \ | 218 | $(cmd_modversions) \ |
219 | $(call echo-cmd,record_mcount) \ | ||
219 | $(cmd_record_mcount) \ | 220 | $(cmd_record_mcount) \ |
220 | scripts/basic/fixdep $(depfile) $@ '$(call make-cmd,cc_o_c)' > \ | 221 | scripts/basic/fixdep $(depfile) $@ '$(call make-cmd,cc_o_c)' > \ |
221 | $(dot-target).tmp; \ | 222 | $(dot-target).tmp; \ |
@@ -269,7 +270,8 @@ targets += $(extra-y) $(MAKECMDGOALS) $(always) | |||
269 | # Linker scripts preprocessor (.lds.S -> .lds) | 270 | # Linker scripts preprocessor (.lds.S -> .lds) |
270 | # --------------------------------------------------------------------------- | 271 | # --------------------------------------------------------------------------- |
271 | quiet_cmd_cpp_lds_S = LDS $@ | 272 | quiet_cmd_cpp_lds_S = LDS $@ |
272 | cmd_cpp_lds_S = $(CPP) $(cpp_flags) -D__ASSEMBLY__ -o $@ $< | 273 | cmd_cpp_lds_S = $(CPP) $(cpp_flags) -P -C -U$(ARCH) \ |
274 | -D__ASSEMBLY__ -DLINKER_SCRIPT -o $@ $< | ||
273 | 275 | ||
274 | $(obj)/%.lds: $(src)/%.lds.S FORCE | 276 | $(obj)/%.lds: $(src)/%.lds.S FORCE |
275 | $(call if_changed_dep,cpp_lds_S) | 277 | $(call if_changed_dep,cpp_lds_S) |
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib index 7a7778746ea6..ffdafb26f539 100644 --- a/scripts/Makefile.lib +++ b/scripts/Makefile.lib | |||
@@ -208,7 +208,7 @@ cmd_gzip = (cat $(filter-out FORCE,$^) | gzip -f -9 > $@) || \ | |||
208 | 208 | ||
209 | # Bzip2 and LZMA do not include size in file... so we have to fake that; | 209 | # Bzip2 and LZMA do not include size in file... so we have to fake that; |
210 | # append the size as a 32-bit littleendian number as gzip does. | 210 | # append the size as a 32-bit littleendian number as gzip does. |
211 | size_append = echo -ne $(shell \ | 211 | size_append = /bin/echo -ne $(shell \ |
212 | dec_size=0; \ | 212 | dec_size=0; \ |
213 | for F in $1; do \ | 213 | for F in $1; do \ |
214 | fsize=$$(stat -c "%s" $$F); \ | 214 | fsize=$$(stat -c "%s" $$F); \ |
diff --git a/scripts/Makefile.modpost b/scripts/Makefile.modpost index f4053dc7b5d6..8f14c81abbc7 100644 --- a/scripts/Makefile.modpost +++ b/scripts/Makefile.modpost | |||
@@ -13,7 +13,6 @@ | |||
13 | # 2) modpost is then used to | 13 | # 2) modpost is then used to |
14 | # 3) create one <module>.mod.c file pr. module | 14 | # 3) create one <module>.mod.c file pr. module |
15 | # 4) create one Module.symvers file with CRC for all exported symbols | 15 | # 4) create one Module.symvers file with CRC for all exported symbols |
16 | # 4a) [CONFIG_MARKERS] create one Module.markers file listing defined markers | ||
17 | # 5) compile all <module>.mod.c files | 16 | # 5) compile all <module>.mod.c files |
18 | # 6) final link of the module to a <module.ko> file | 17 | # 6) final link of the module to a <module.ko> file |
19 | 18 | ||
@@ -59,10 +58,6 @@ include scripts/Makefile.lib | |||
59 | 58 | ||
60 | kernelsymfile := $(objtree)/Module.symvers | 59 | kernelsymfile := $(objtree)/Module.symvers |
61 | modulesymfile := $(firstword $(KBUILD_EXTMOD))/Module.symvers | 60 | modulesymfile := $(firstword $(KBUILD_EXTMOD))/Module.symvers |
62 | kernelmarkersfile := $(objtree)/Module.markers | ||
63 | modulemarkersfile := $(firstword $(KBUILD_EXTMOD))/Module.markers | ||
64 | |||
65 | markersfile = $(if $(KBUILD_EXTMOD),$(modulemarkersfile),$(kernelmarkersfile)) | ||
66 | 61 | ||
67 | # Step 1), find all modules listed in $(MODVERDIR)/ | 62 | # Step 1), find all modules listed in $(MODVERDIR)/ |
68 | __modules := $(sort $(shell grep -h '\.ko' /dev/null $(wildcard $(MODVERDIR)/*.mod))) | 63 | __modules := $(sort $(shell grep -h '\.ko' /dev/null $(wildcard $(MODVERDIR)/*.mod))) |
@@ -85,8 +80,6 @@ modpost = scripts/mod/modpost \ | |||
85 | $(if $(KBUILD_EXTRA_SYMBOLS), $(patsubst %, -e %,$(KBUILD_EXTRA_SYMBOLS))) \ | 80 | $(if $(KBUILD_EXTRA_SYMBOLS), $(patsubst %, -e %,$(KBUILD_EXTRA_SYMBOLS))) \ |
86 | $(if $(KBUILD_EXTMOD),-o $(modulesymfile)) \ | 81 | $(if $(KBUILD_EXTMOD),-o $(modulesymfile)) \ |
87 | $(if $(CONFIG_DEBUG_SECTION_MISMATCH),,-S) \ | 82 | $(if $(CONFIG_DEBUG_SECTION_MISMATCH),,-S) \ |
88 | $(if $(CONFIG_MARKERS),-K $(kernelmarkersfile)) \ | ||
89 | $(if $(CONFIG_MARKERS),-M $(markersfile)) \ | ||
90 | $(if $(KBUILD_EXTMOD)$(KBUILD_MODPOST_WARN),-w) \ | 83 | $(if $(KBUILD_EXTMOD)$(KBUILD_MODPOST_WARN),-w) \ |
91 | $(if $(cross_build),-c) | 84 | $(if $(cross_build),-c) |
92 | 85 | ||
@@ -101,17 +94,12 @@ quiet_cmd_kernel-mod = MODPOST $@ | |||
101 | cmd_kernel-mod = $(modpost) $@ | 94 | cmd_kernel-mod = $(modpost) $@ |
102 | 95 | ||
103 | vmlinux.o: FORCE | 96 | vmlinux.o: FORCE |
104 | @rm -fr $(kernelmarkersfile) | ||
105 | $(call cmd,kernel-mod) | 97 | $(call cmd,kernel-mod) |
106 | 98 | ||
107 | # Declare generated files as targets for modpost | 99 | # Declare generated files as targets for modpost |
108 | $(symverfile): __modpost ; | 100 | $(symverfile): __modpost ; |
109 | $(modules:.ko=.mod.c): __modpost ; | 101 | $(modules:.ko=.mod.c): __modpost ; |
110 | 102 | ||
111 | ifdef CONFIG_MARKERS | ||
112 | $(markersfile): __modpost ; | ||
113 | endif | ||
114 | |||
115 | 103 | ||
116 | # Step 5), compile all *.mod.c files | 104 | # Step 5), compile all *.mod.c files |
117 | 105 | ||
diff --git a/scripts/basic/docproc.c b/scripts/basic/docproc.c index 99ca7a698687..79ab973fb43a 100644 --- a/scripts/basic/docproc.c +++ b/scripts/basic/docproc.c | |||
@@ -71,7 +71,7 @@ FILELINE * docsection; | |||
71 | 71 | ||
72 | static char *srctree, *kernsrctree; | 72 | static char *srctree, *kernsrctree; |
73 | 73 | ||
74 | void usage (void) | 74 | static void usage (void) |
75 | { | 75 | { |
76 | fprintf(stderr, "Usage: docproc {doc|depend} file\n"); | 76 | fprintf(stderr, "Usage: docproc {doc|depend} file\n"); |
77 | fprintf(stderr, "Input is read from file.tmpl. Output is sent to stdout\n"); | 77 | fprintf(stderr, "Input is read from file.tmpl. Output is sent to stdout\n"); |
@@ -84,7 +84,7 @@ void usage (void) | |||
84 | /* | 84 | /* |
85 | * Execute kernel-doc with parameters given in svec | 85 | * Execute kernel-doc with parameters given in svec |
86 | */ | 86 | */ |
87 | void exec_kernel_doc(char **svec) | 87 | static void exec_kernel_doc(char **svec) |
88 | { | 88 | { |
89 | pid_t pid; | 89 | pid_t pid; |
90 | int ret; | 90 | int ret; |
@@ -129,7 +129,7 @@ struct symfile | |||
129 | struct symfile symfilelist[MAXFILES]; | 129 | struct symfile symfilelist[MAXFILES]; |
130 | int symfilecnt = 0; | 130 | int symfilecnt = 0; |
131 | 131 | ||
132 | void add_new_symbol(struct symfile *sym, char * symname) | 132 | static void add_new_symbol(struct symfile *sym, char * symname) |
133 | { | 133 | { |
134 | sym->symbollist = | 134 | sym->symbollist = |
135 | realloc(sym->symbollist, (sym->symbolcnt + 1) * sizeof(char *)); | 135 | realloc(sym->symbollist, (sym->symbolcnt + 1) * sizeof(char *)); |
@@ -137,14 +137,14 @@ void add_new_symbol(struct symfile *sym, char * symname) | |||
137 | } | 137 | } |
138 | 138 | ||
139 | /* Add a filename to the list */ | 139 | /* Add a filename to the list */ |
140 | struct symfile * add_new_file(char * filename) | 140 | static struct symfile * add_new_file(char * filename) |
141 | { | 141 | { |
142 | symfilelist[symfilecnt++].filename = strdup(filename); | 142 | symfilelist[symfilecnt++].filename = strdup(filename); |
143 | return &symfilelist[symfilecnt - 1]; | 143 | return &symfilelist[symfilecnt - 1]; |
144 | } | 144 | } |
145 | 145 | ||
146 | /* Check if file already are present in the list */ | 146 | /* Check if file already are present in the list */ |
147 | struct symfile * filename_exist(char * filename) | 147 | static struct symfile * filename_exist(char * filename) |
148 | { | 148 | { |
149 | int i; | 149 | int i; |
150 | for (i=0; i < symfilecnt; i++) | 150 | for (i=0; i < symfilecnt; i++) |
@@ -157,20 +157,20 @@ struct symfile * filename_exist(char * filename) | |||
157 | * List all files referenced within the template file. | 157 | * List all files referenced within the template file. |
158 | * Files are separated by tabs. | 158 | * Files are separated by tabs. |
159 | */ | 159 | */ |
160 | void adddep(char * file) { printf("\t%s", file); } | 160 | static void adddep(char * file) { printf("\t%s", file); } |
161 | void adddep2(char * file, char * line) { line = line; adddep(file); } | 161 | static void adddep2(char * file, char * line) { line = line; adddep(file); } |
162 | void noaction(char * line) { line = line; } | 162 | static void noaction(char * line) { line = line; } |
163 | void noaction2(char * file, char * line) { file = file; line = line; } | 163 | static void noaction2(char * file, char * line) { file = file; line = line; } |
164 | 164 | ||
165 | /* Echo the line without further action */ | 165 | /* Echo the line without further action */ |
166 | void printline(char * line) { printf("%s", line); } | 166 | static void printline(char * line) { printf("%s", line); } |
167 | 167 | ||
168 | /* | 168 | /* |
169 | * Find all symbols in filename that are exported with EXPORT_SYMBOL & | 169 | * Find all symbols in filename that are exported with EXPORT_SYMBOL & |
170 | * EXPORT_SYMBOL_GPL (& EXPORT_SYMBOL_GPL_FUTURE implicitly). | 170 | * EXPORT_SYMBOL_GPL (& EXPORT_SYMBOL_GPL_FUTURE implicitly). |
171 | * All symbols located are stored in symfilelist. | 171 | * All symbols located are stored in symfilelist. |
172 | */ | 172 | */ |
173 | void find_export_symbols(char * filename) | 173 | static void find_export_symbols(char * filename) |
174 | { | 174 | { |
175 | FILE * fp; | 175 | FILE * fp; |
176 | struct symfile *sym; | 176 | struct symfile *sym; |
@@ -227,7 +227,7 @@ void find_export_symbols(char * filename) | |||
227 | * intfunc uses -nofunction | 227 | * intfunc uses -nofunction |
228 | * extfunc uses -function | 228 | * extfunc uses -function |
229 | */ | 229 | */ |
230 | void docfunctions(char * filename, char * type) | 230 | static void docfunctions(char * filename, char * type) |
231 | { | 231 | { |
232 | int i,j; | 232 | int i,j; |
233 | int symcnt = 0; | 233 | int symcnt = 0; |
@@ -258,15 +258,15 @@ void docfunctions(char * filename, char * type) | |||
258 | fflush(stdout); | 258 | fflush(stdout); |
259 | free(vec); | 259 | free(vec); |
260 | } | 260 | } |
261 | void intfunc(char * filename) { docfunctions(filename, NOFUNCTION); } | 261 | static void intfunc(char * filename) { docfunctions(filename, NOFUNCTION); } |
262 | void extfunc(char * filename) { docfunctions(filename, FUNCTION); } | 262 | static void extfunc(char * filename) { docfunctions(filename, FUNCTION); } |
263 | 263 | ||
264 | /* | 264 | /* |
265 | * Document specific function(s) in a file. | 265 | * Document specific function(s) in a file. |
266 | * Call kernel-doc with the following parameters: | 266 | * Call kernel-doc with the following parameters: |
267 | * kernel-doc -docbook -function function1 [-function function2] | 267 | * kernel-doc -docbook -function function1 [-function function2] |
268 | */ | 268 | */ |
269 | void singfunc(char * filename, char * line) | 269 | static void singfunc(char * filename, char * line) |
270 | { | 270 | { |
271 | char *vec[200]; /* Enough for specific functions */ | 271 | char *vec[200]; /* Enough for specific functions */ |
272 | int i, idx = 0; | 272 | int i, idx = 0; |
@@ -297,7 +297,7 @@ void singfunc(char * filename, char * line) | |||
297 | * Call kernel-doc with the following parameters: | 297 | * Call kernel-doc with the following parameters: |
298 | * kernel-doc -docbook -function "doc section" filename | 298 | * kernel-doc -docbook -function "doc section" filename |
299 | */ | 299 | */ |
300 | void docsect(char *filename, char *line) | 300 | static void docsect(char *filename, char *line) |
301 | { | 301 | { |
302 | char *vec[6]; /* kerneldoc -docbook -function "section" file NULL */ | 302 | char *vec[6]; /* kerneldoc -docbook -function "section" file NULL */ |
303 | char *s; | 303 | char *s; |
@@ -324,7 +324,7 @@ void docsect(char *filename, char *line) | |||
324 | * 5) Lines containing !P | 324 | * 5) Lines containing !P |
325 | * 6) Default lines - lines not matching the above | 325 | * 6) Default lines - lines not matching the above |
326 | */ | 326 | */ |
327 | void parse_file(FILE *infile) | 327 | static void parse_file(FILE *infile) |
328 | { | 328 | { |
329 | char line[MAXLINESZ]; | 329 | char line[MAXLINESZ]; |
330 | char * s; | 330 | char * s; |
diff --git a/scripts/basic/fixdep.c b/scripts/basic/fixdep.c index 72c15205bb2b..6bf21f83837d 100644 --- a/scripts/basic/fixdep.c +++ b/scripts/basic/fixdep.c | |||
@@ -16,8 +16,7 @@ | |||
16 | * tells make when to remake a file. | 16 | * tells make when to remake a file. |
17 | * | 17 | * |
18 | * To use this list as-is however has the drawback that virtually | 18 | * To use this list as-is however has the drawback that virtually |
19 | * every file in the kernel includes <linux/config.h> which then again | 19 | * every file in the kernel includes <linux/autoconf.h>. |
20 | * includes <linux/autoconf.h> | ||
21 | * | 20 | * |
22 | * If the user re-runs make *config, linux/autoconf.h will be | 21 | * If the user re-runs make *config, linux/autoconf.h will be |
23 | * regenerated. make notices that and will rebuild every file which | 22 | * regenerated. make notices that and will rebuild every file which |
@@ -125,8 +124,7 @@ char *target; | |||
125 | char *depfile; | 124 | char *depfile; |
126 | char *cmdline; | 125 | char *cmdline; |
127 | 126 | ||
128 | void usage(void) | 127 | static void usage(void) |
129 | |||
130 | { | 128 | { |
131 | fprintf(stderr, "Usage: fixdep <depfile> <target> <cmdline>\n"); | 129 | fprintf(stderr, "Usage: fixdep <depfile> <target> <cmdline>\n"); |
132 | exit(1); | 130 | exit(1); |
@@ -135,7 +133,7 @@ void usage(void) | |||
135 | /* | 133 | /* |
136 | * Print out the commandline prefixed with cmd_<target filename> := | 134 | * Print out the commandline prefixed with cmd_<target filename> := |
137 | */ | 135 | */ |
138 | void print_cmdline(void) | 136 | static void print_cmdline(void) |
139 | { | 137 | { |
140 | printf("cmd_%s := %s\n\n", target, cmdline); | 138 | printf("cmd_%s := %s\n\n", target, cmdline); |
141 | } | 139 | } |
@@ -148,7 +146,7 @@ int len_config = 0; | |||
148 | * Grow the configuration string to a desired length. | 146 | * Grow the configuration string to a desired length. |
149 | * Usually the first growth is plenty. | 147 | * Usually the first growth is plenty. |
150 | */ | 148 | */ |
151 | void grow_config(int len) | 149 | static void grow_config(int len) |
152 | { | 150 | { |
153 | while (len_config + len > size_config) { | 151 | while (len_config + len > size_config) { |
154 | if (size_config == 0) | 152 | if (size_config == 0) |
@@ -164,7 +162,7 @@ void grow_config(int len) | |||
164 | /* | 162 | /* |
165 | * Lookup a value in the configuration string. | 163 | * Lookup a value in the configuration string. |
166 | */ | 164 | */ |
167 | int is_defined_config(const char * name, int len) | 165 | static int is_defined_config(const char * name, int len) |
168 | { | 166 | { |
169 | const char * pconfig; | 167 | const char * pconfig; |
170 | const char * plast = str_config + len_config - len; | 168 | const char * plast = str_config + len_config - len; |
@@ -180,7 +178,7 @@ int is_defined_config(const char * name, int len) | |||
180 | /* | 178 | /* |
181 | * Add a new value to the configuration string. | 179 | * Add a new value to the configuration string. |
182 | */ | 180 | */ |
183 | void define_config(const char * name, int len) | 181 | static void define_config(const char * name, int len) |
184 | { | 182 | { |
185 | grow_config(len + 1); | 183 | grow_config(len + 1); |
186 | 184 | ||
@@ -192,7 +190,7 @@ void define_config(const char * name, int len) | |||
192 | /* | 190 | /* |
193 | * Clear the set of configuration strings. | 191 | * Clear the set of configuration strings. |
194 | */ | 192 | */ |
195 | void clear_config(void) | 193 | static void clear_config(void) |
196 | { | 194 | { |
197 | len_config = 0; | 195 | len_config = 0; |
198 | define_config("", 0); | 196 | define_config("", 0); |
@@ -201,7 +199,7 @@ void clear_config(void) | |||
201 | /* | 199 | /* |
202 | * Record the use of a CONFIG_* word. | 200 | * Record the use of a CONFIG_* word. |
203 | */ | 201 | */ |
204 | void use_config(char *m, int slen) | 202 | static void use_config(char *m, int slen) |
205 | { | 203 | { |
206 | char s[PATH_MAX]; | 204 | char s[PATH_MAX]; |
207 | char *p; | 205 | char *p; |
@@ -222,7 +220,7 @@ void use_config(char *m, int slen) | |||
222 | printf(" $(wildcard include/config/%s.h) \\\n", s); | 220 | printf(" $(wildcard include/config/%s.h) \\\n", s); |
223 | } | 221 | } |
224 | 222 | ||
225 | void parse_config_file(char *map, size_t len) | 223 | static void parse_config_file(char *map, size_t len) |
226 | { | 224 | { |
227 | int *end = (int *) (map + len); | 225 | int *end = (int *) (map + len); |
228 | /* start at +1, so that p can never be < map */ | 226 | /* start at +1, so that p can never be < map */ |
@@ -256,7 +254,7 @@ void parse_config_file(char *map, size_t len) | |||
256 | } | 254 | } |
257 | 255 | ||
258 | /* test is s ends in sub */ | 256 | /* test is s ends in sub */ |
259 | int strrcmp(char *s, char *sub) | 257 | static int strrcmp(char *s, char *sub) |
260 | { | 258 | { |
261 | int slen = strlen(s); | 259 | int slen = strlen(s); |
262 | int sublen = strlen(sub); | 260 | int sublen = strlen(sub); |
@@ -267,7 +265,7 @@ int strrcmp(char *s, char *sub) | |||
267 | return memcmp(s + slen - sublen, sub, sublen); | 265 | return memcmp(s + slen - sublen, sub, sublen); |
268 | } | 266 | } |
269 | 267 | ||
270 | void do_config_file(char *filename) | 268 | static void do_config_file(char *filename) |
271 | { | 269 | { |
272 | struct stat st; | 270 | struct stat st; |
273 | int fd; | 271 | int fd; |
@@ -298,7 +296,7 @@ void do_config_file(char *filename) | |||
298 | close(fd); | 296 | close(fd); |
299 | } | 297 | } |
300 | 298 | ||
301 | void parse_dep_file(void *map, size_t len) | 299 | static void parse_dep_file(void *map, size_t len) |
302 | { | 300 | { |
303 | char *m = map; | 301 | char *m = map; |
304 | char *end = m + len; | 302 | char *end = m + len; |
@@ -338,7 +336,7 @@ void parse_dep_file(void *map, size_t len) | |||
338 | printf("$(deps_%s):\n", target); | 336 | printf("$(deps_%s):\n", target); |
339 | } | 337 | } |
340 | 338 | ||
341 | void print_deps(void) | 339 | static void print_deps(void) |
342 | { | 340 | { |
343 | struct stat st; | 341 | struct stat st; |
344 | int fd; | 342 | int fd; |
@@ -370,7 +368,7 @@ void print_deps(void) | |||
370 | close(fd); | 368 | close(fd); |
371 | } | 369 | } |
372 | 370 | ||
373 | void traps(void) | 371 | static void traps(void) |
374 | { | 372 | { |
375 | static char test[] __attribute__((aligned(sizeof(int)))) = "CONF"; | 373 | static char test[] __attribute__((aligned(sizeof(int)))) = "CONF"; |
376 | int *p = (int *)test; | 374 | int *p = (int *)test; |
diff --git a/scripts/basic/hash.c b/scripts/basic/hash.c index 3299ad7fc8c0..2ef5d3f666b8 100644 --- a/scripts/basic/hash.c +++ b/scripts/basic/hash.c | |||
@@ -21,7 +21,7 @@ static void usage(void) | |||
21 | * http://www.cse.yorku.ca/~oz/hash.html | 21 | * http://www.cse.yorku.ca/~oz/hash.html |
22 | */ | 22 | */ |
23 | 23 | ||
24 | unsigned int djb2_hash(char *str) | 24 | static unsigned int djb2_hash(char *str) |
25 | { | 25 | { |
26 | unsigned long hash = 5381; | 26 | unsigned long hash = 5381; |
27 | int c; | 27 | int c; |
@@ -34,7 +34,7 @@ unsigned int djb2_hash(char *str) | |||
34 | return (unsigned int)(hash & ((1 << DYNAMIC_DEBUG_HASH_BITS) - 1)); | 34 | return (unsigned int)(hash & ((1 << DYNAMIC_DEBUG_HASH_BITS) - 1)); |
35 | } | 35 | } |
36 | 36 | ||
37 | unsigned int r5_hash(char *str) | 37 | static unsigned int r5_hash(char *str) |
38 | { | 38 | { |
39 | unsigned long hash = 0; | 39 | unsigned long hash = 0; |
40 | int c; | 40 | int c; |
diff --git a/scripts/checkincludes.pl b/scripts/checkincludes.pl index 8e6b716c191c..676ddc07d6fa 100755 --- a/scripts/checkincludes.pl +++ b/scripts/checkincludes.pl | |||
@@ -1,24 +1,85 @@ | |||
1 | #!/usr/bin/perl | 1 | #!/usr/bin/perl |
2 | # | 2 | # |
3 | # checkincludes: Find files included more than once in (other) files. | 3 | # checkincludes: find/remove files included more than once |
4 | # | ||
4 | # Copyright abandoned, 2000, Niels Kristian Bech Jensen <nkbj@image.dk>. | 5 | # Copyright abandoned, 2000, Niels Kristian Bech Jensen <nkbj@image.dk>. |
6 | # Copyright 2009 Luis R. Rodriguez <mcgrof@gmail.com> | ||
7 | # | ||
8 | # This script checks for duplicate includes. It also has support | ||
9 | # to remove them in place. Note that this will not take into | ||
10 | # consideration macros so you should run this only if you know | ||
11 | # you do have real dups and do not have them under #ifdef's. You | ||
12 | # could also just review the results. | ||
13 | |||
14 | sub usage { | ||
15 | print "Usage: checkincludes.pl [-r]\n"; | ||
16 | print "By default we just warn of duplicates\n"; | ||
17 | print "To remove duplicated includes in place use -r\n"; | ||
18 | exit 1; | ||
19 | } | ||
20 | |||
21 | my $remove = 0; | ||
22 | |||
23 | if ($#ARGV < 0) { | ||
24 | usage(); | ||
25 | } | ||
26 | |||
27 | if ($#ARGV >= 1) { | ||
28 | if ($ARGV[0] =~ /^-/) { | ||
29 | if ($ARGV[0] eq "-r") { | ||
30 | $remove = 1; | ||
31 | shift; | ||
32 | } else { | ||
33 | usage(); | ||
34 | } | ||
35 | } | ||
36 | } | ||
5 | 37 | ||
6 | foreach $file (@ARGV) { | 38 | foreach $file (@ARGV) { |
7 | open(FILE, $file) or die "Cannot open $file: $!.\n"; | 39 | open(FILE, $file) or die "Cannot open $file: $!.\n"; |
8 | 40 | ||
9 | my %includedfiles = (); | 41 | my %includedfiles = (); |
42 | my @file_lines = (); | ||
10 | 43 | ||
11 | while (<FILE>) { | 44 | while (<FILE>) { |
12 | if (m/^\s*#\s*include\s*[<"](\S*)[>"]/o) { | 45 | if (m/^\s*#\s*include\s*[<"](\S*)[>"]/o) { |
13 | ++$includedfiles{$1}; | 46 | ++$includedfiles{$1}; |
14 | } | 47 | } |
48 | push(@file_lines, $_); | ||
15 | } | 49 | } |
16 | 50 | ||
17 | foreach $filename (keys %includedfiles) { | 51 | close(FILE); |
18 | if ($includedfiles{$filename} > 1) { | 52 | |
19 | print "$file: $filename is included more than once.\n"; | 53 | if (!$remove) { |
54 | foreach $filename (keys %includedfiles) { | ||
55 | if ($includedfiles{$filename} > 1) { | ||
56 | print "$file: $filename is included more than once.\n"; | ||
57 | } | ||
20 | } | 58 | } |
59 | next; | ||
21 | } | 60 | } |
22 | 61 | ||
62 | open(FILE,">$file") || die("Cannot write to $file: $!"); | ||
63 | |||
64 | my $dups = 0; | ||
65 | foreach (@file_lines) { | ||
66 | if (m/^\s*#\s*include\s*[<"](\S*)[>"]/o) { | ||
67 | foreach $filename (keys %includedfiles) { | ||
68 | if ($1 eq $filename) { | ||
69 | if ($includedfiles{$filename} > 1) { | ||
70 | $includedfiles{$filename}--; | ||
71 | $dups++; | ||
72 | } else { | ||
73 | print FILE $_; | ||
74 | } | ||
75 | } | ||
76 | } | ||
77 | } else { | ||
78 | print FILE $_; | ||
79 | } | ||
80 | } | ||
81 | if ($dups > 0) { | ||
82 | print "$file: removed $dups duplicate includes\n"; | ||
83 | } | ||
23 | close(FILE); | 84 | close(FILE); |
24 | } | 85 | } |
diff --git a/scripts/checkkconfigsymbols.sh b/scripts/checkkconfigsymbols.sh index 39677c82747a..46be3c5a62b7 100755 --- a/scripts/checkkconfigsymbols.sh +++ b/scripts/checkkconfigsymbols.sh | |||
@@ -9,7 +9,7 @@ paths="$@" | |||
9 | # Doing this once at the beginning saves a lot of time, on a cache-hot tree. | 9 | # Doing this once at the beginning saves a lot of time, on a cache-hot tree. |
10 | Kconfigs="`find . -name 'Kconfig' -o -name 'Kconfig*[^~]'`" | 10 | Kconfigs="`find . -name 'Kconfig' -o -name 'Kconfig*[^~]'`" |
11 | 11 | ||
12 | echo -e "File list \tundefined symbol used" | 12 | /bin/echo -e "File list \tundefined symbol used" |
13 | find $paths -name '*.[chS]' -o -name 'Makefile' -o -name 'Makefile*[^~]'| while read i | 13 | find $paths -name '*.[chS]' -o -name 'Makefile' -o -name 'Makefile*[^~]'| while read i |
14 | do | 14 | do |
15 | # Output the bare Kconfig variable and the filename; the _MODULE part at | 15 | # Output the bare Kconfig variable and the filename; the _MODULE part at |
@@ -54,6 +54,6 @@ while read symb files; do | |||
54 | # beyond the purpose of this script. | 54 | # beyond the purpose of this script. |
55 | symb_bare=`echo $symb | sed -e 's/_MODULE//'` | 55 | symb_bare=`echo $symb | sed -e 's/_MODULE//'` |
56 | if ! grep -q "\<$symb_bare\>" $Kconfigs; then | 56 | if ! grep -q "\<$symb_bare\>" $Kconfigs; then |
57 | echo -e "$files: \t$symb" | 57 | /bin/echo -e "$files: \t$symb" |
58 | fi | 58 | fi |
59 | done|sort | 59 | done|sort |
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 2d5ece798c4c..bc4114f1ab30 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl | |||
@@ -2,7 +2,7 @@ | |||
2 | # (c) 2001, Dave Jones. <davej@redhat.com> (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,2008, Andy Whitcroft <apw@uk.ibm.com> (new conditions, test suite) | 4 | # (c) 2007,2008, Andy Whitcroft <apw@uk.ibm.com> (new conditions, test suite) |
5 | # (c) 2008, Andy Whitcroft <apw@canonical.com> | 5 | # (c) 2008,2009, Andy Whitcroft <apw@canonical.com> |
6 | # Licensed under the terms of the GNU GPL License version 2 | 6 | # Licensed under the terms of the GNU GPL License version 2 |
7 | 7 | ||
8 | use strict; | 8 | use strict; |
@@ -10,7 +10,7 @@ use strict; | |||
10 | my $P = $0; | 10 | my $P = $0; |
11 | $P =~ s@.*/@@g; | 11 | $P =~ s@.*/@@g; |
12 | 12 | ||
13 | my $V = '0.28'; | 13 | my $V = '0.30'; |
14 | 14 | ||
15 | use Getopt::Long qw(:config no_auto_abbrev); | 15 | use Getopt::Long qw(:config no_auto_abbrev); |
16 | 16 | ||
@@ -28,6 +28,41 @@ my $mailback = 0; | |||
28 | my $summary_file = 0; | 28 | my $summary_file = 0; |
29 | my $root; | 29 | my $root; |
30 | my %debug; | 30 | my %debug; |
31 | my $help = 0; | ||
32 | |||
33 | sub help { | ||
34 | my ($exitcode) = @_; | ||
35 | |||
36 | print << "EOM"; | ||
37 | Usage: $P [OPTION]... [FILE]... | ||
38 | Version: $V | ||
39 | |||
40 | Options: | ||
41 | -q, --quiet quiet | ||
42 | --no-tree run without a kernel tree | ||
43 | --no-signoff do not check for 'Signed-off-by' line | ||
44 | --patch treat FILE as patchfile (default) | ||
45 | --emacs emacs compile window format | ||
46 | --terse one line per report | ||
47 | -f, --file treat FILE as regular source file | ||
48 | --subjective, --strict enable more subjective tests | ||
49 | --root=PATH PATH to the kernel tree root | ||
50 | --no-summary suppress the per-file summary | ||
51 | --mailback only produce a report in case of warnings/errors | ||
52 | --summary-file include the filename in summary | ||
53 | --debug KEY=[0|1] turn on/off debugging of KEY, where KEY is one of | ||
54 | 'values', 'possible', 'type', and 'attr' (default | ||
55 | is all off) | ||
56 | --test-only=WORD report only warnings/errors containing WORD | ||
57 | literally | ||
58 | -h, --help, --version display this help and exit | ||
59 | |||
60 | When FILE is - read standard input. | ||
61 | EOM | ||
62 | |||
63 | exit($exitcode); | ||
64 | } | ||
65 | |||
31 | GetOptions( | 66 | GetOptions( |
32 | 'q|quiet+' => \$quiet, | 67 | 'q|quiet+' => \$quiet, |
33 | 'tree!' => \$tree, | 68 | 'tree!' => \$tree, |
@@ -35,7 +70,7 @@ GetOptions( | |||
35 | 'patch!' => \$chk_patch, | 70 | 'patch!' => \$chk_patch, |
36 | 'emacs!' => \$emacs, | 71 | 'emacs!' => \$emacs, |
37 | 'terse!' => \$terse, | 72 | 'terse!' => \$terse, |
38 | 'file!' => \$file, | 73 | 'f|file!' => \$file, |
39 | 'subjective!' => \$check, | 74 | 'subjective!' => \$check, |
40 | 'strict!' => \$check, | 75 | 'strict!' => \$check, |
41 | 'root=s' => \$root, | 76 | 'root=s' => \$root, |
@@ -45,22 +80,16 @@ GetOptions( | |||
45 | 80 | ||
46 | 'debug=s' => \%debug, | 81 | 'debug=s' => \%debug, |
47 | 'test-only=s' => \$tst_only, | 82 | 'test-only=s' => \$tst_only, |
48 | ) or exit; | 83 | 'h|help' => \$help, |
84 | 'version' => \$help | ||
85 | ) or help(1); | ||
86 | |||
87 | help(0) if ($help); | ||
49 | 88 | ||
50 | my $exit = 0; | 89 | my $exit = 0; |
51 | 90 | ||
52 | if ($#ARGV < 0) { | 91 | if ($#ARGV < 0) { |
53 | print "usage: $P [options] patchfile\n"; | 92 | print "$P: no input files\n"; |
54 | print "version: $V\n"; | ||
55 | print "options: -q => quiet\n"; | ||
56 | print " --no-tree => run without a kernel tree\n"; | ||
57 | print " --terse => one line per report\n"; | ||
58 | print " --emacs => emacs compile window format\n"; | ||
59 | print " --file => check a source file\n"; | ||
60 | print " --strict => enable more subjective tests\n"; | ||
61 | print " --root => path to the kernel tree root\n"; | ||
62 | print " --no-summary => suppress the per-file summary\n"; | ||
63 | print " --summary-file => include the filename in summary\n"; | ||
64 | exit(1); | 93 | exit(1); |
65 | } | 94 | } |
66 | 95 | ||
@@ -101,7 +130,10 @@ if ($tree) { | |||
101 | 130 | ||
102 | my $emitted_corrupt = 0; | 131 | my $emitted_corrupt = 0; |
103 | 132 | ||
104 | our $Ident = qr{[A-Za-z_][A-Za-z\d_]*}; | 133 | our $Ident = qr{ |
134 | [A-Za-z_][A-Za-z\d_]* | ||
135 | (?:\s*\#\#\s*[A-Za-z_][A-Za-z\d_]*)* | ||
136 | }x; | ||
105 | our $Storage = qr{extern|static|asmlinkage}; | 137 | our $Storage = qr{extern|static|asmlinkage}; |
106 | our $Sparse = qr{ | 138 | our $Sparse = qr{ |
107 | __user| | 139 | __user| |
@@ -153,7 +185,7 @@ our $UTF8 = qr { | |||
153 | }x; | 185 | }x; |
154 | 186 | ||
155 | our $typeTypedefs = qr{(?x: | 187 | our $typeTypedefs = qr{(?x: |
156 | (?:__)?(?:u|s|be|le)(?:\d|\d\d)| | 188 | (?:__)?(?:u|s|be|le)(?:8|16|32|64)| |
157 | atomic_t | 189 | atomic_t |
158 | )}; | 190 | )}; |
159 | 191 | ||
@@ -356,6 +388,13 @@ sub sanitise_line { | |||
356 | $off++; | 388 | $off++; |
357 | next; | 389 | next; |
358 | } | 390 | } |
391 | if ($sanitise_quote eq '' && substr($line, $off, 2) eq '//') { | ||
392 | $sanitise_quote = '//'; | ||
393 | |||
394 | substr($res, $off, 2, $sanitise_quote); | ||
395 | $off++; | ||
396 | next; | ||
397 | } | ||
359 | 398 | ||
360 | # A \ in a string means ignore the next character. | 399 | # A \ in a string means ignore the next character. |
361 | if (($sanitise_quote eq "'" || $sanitise_quote eq '"') && | 400 | if (($sanitise_quote eq "'" || $sanitise_quote eq '"') && |
@@ -379,6 +418,8 @@ sub sanitise_line { | |||
379 | #print "c<$c> SQ<$sanitise_quote>\n"; | 418 | #print "c<$c> SQ<$sanitise_quote>\n"; |
380 | if ($off != 0 && $sanitise_quote eq '*/' && $c ne "\t") { | 419 | if ($off != 0 && $sanitise_quote eq '*/' && $c ne "\t") { |
381 | substr($res, $off, 1, $;); | 420 | substr($res, $off, 1, $;); |
421 | } elsif ($off != 0 && $sanitise_quote eq '//' && $c ne "\t") { | ||
422 | substr($res, $off, 1, $;); | ||
382 | } elsif ($off != 0 && $sanitise_quote && $c ne "\t") { | 423 | } elsif ($off != 0 && $sanitise_quote && $c ne "\t") { |
383 | substr($res, $off, 1, 'X'); | 424 | substr($res, $off, 1, 'X'); |
384 | } else { | 425 | } else { |
@@ -386,6 +427,10 @@ sub sanitise_line { | |||
386 | } | 427 | } |
387 | } | 428 | } |
388 | 429 | ||
430 | if ($sanitise_quote eq '//') { | ||
431 | $sanitise_quote = ''; | ||
432 | } | ||
433 | |||
389 | # The pathname on a #include may be surrounded by '<' and '>'. | 434 | # The pathname on a #include may be surrounded by '<' and '>'. |
390 | if ($res =~ /^.\s*\#\s*include\s+\<(.*)\>/) { | 435 | if ($res =~ /^.\s*\#\s*include\s+\<(.*)\>/) { |
391 | my $clean = 'X' x length($1); | 436 | my $clean = 'X' x length($1); |
@@ -955,23 +1000,25 @@ sub annotate_values { | |||
955 | 1000 | ||
956 | sub possible { | 1001 | sub possible { |
957 | my ($possible, $line) = @_; | 1002 | my ($possible, $line) = @_; |
958 | 1003 | my $notPermitted = qr{(?: | |
959 | print "CHECK<$possible> ($line)\n" if ($dbg_possible > 2); | ||
960 | if ($possible !~ /(?: | ||
961 | ^(?: | 1004 | ^(?: |
962 | $Modifier| | 1005 | $Modifier| |
963 | $Storage| | 1006 | $Storage| |
964 | $Type| | 1007 | $Type| |
965 | DEFINE_\S+| | 1008 | DEFINE_\S+ |
1009 | )$| | ||
1010 | ^(?: | ||
966 | goto| | 1011 | goto| |
967 | return| | 1012 | return| |
968 | case| | 1013 | case| |
969 | else| | 1014 | else| |
970 | asm|__asm__| | 1015 | asm|__asm__| |
971 | do | 1016 | do |
972 | )$| | 1017 | )(?:\s|$)| |
973 | ^(?:typedef|struct|enum)\b | 1018 | ^(?:typedef|struct|enum)\b |
974 | )/x) { | 1019 | )}x; |
1020 | warn "CHECK<$possible> ($line)\n" if ($dbg_possible > 2); | ||
1021 | if ($possible !~ $notPermitted) { | ||
975 | # Check for modifiers. | 1022 | # Check for modifiers. |
976 | $possible =~ s/\s*$Storage\s*//g; | 1023 | $possible =~ s/\s*$Storage\s*//g; |
977 | $possible =~ s/\s*$Sparse\s*//g; | 1024 | $possible =~ s/\s*$Sparse\s*//g; |
@@ -980,8 +1027,10 @@ sub possible { | |||
980 | } elsif ($possible =~ /\s/) { | 1027 | } elsif ($possible =~ /\s/) { |
981 | $possible =~ s/\s*$Type\s*//g; | 1028 | $possible =~ s/\s*$Type\s*//g; |
982 | for my $modifier (split(' ', $possible)) { | 1029 | for my $modifier (split(' ', $possible)) { |
983 | warn "MODIFIER: $modifier ($possible) ($line)\n" if ($dbg_possible); | 1030 | if ($modifier !~ $notPermitted) { |
984 | push(@modifierList, $modifier); | 1031 | warn "MODIFIER: $modifier ($possible) ($line)\n" if ($dbg_possible); |
1032 | push(@modifierList, $modifier); | ||
1033 | } | ||
985 | } | 1034 | } |
986 | 1035 | ||
987 | } else { | 1036 | } else { |
@@ -1096,6 +1145,7 @@ sub process { | |||
1096 | # suppression flags | 1145 | # suppression flags |
1097 | my %suppress_ifbraces; | 1146 | my %suppress_ifbraces; |
1098 | my %suppress_whiletrailers; | 1147 | my %suppress_whiletrailers; |
1148 | my %suppress_export; | ||
1099 | 1149 | ||
1100 | # Pre-scan the patch sanitizing the lines. | 1150 | # Pre-scan the patch sanitizing the lines. |
1101 | # Pre-scan the patch looking for any __setup documentation. | 1151 | # Pre-scan the patch looking for any __setup documentation. |
@@ -1188,7 +1238,6 @@ sub process { | |||
1188 | $linenr++; | 1238 | $linenr++; |
1189 | 1239 | ||
1190 | my $rawline = $rawlines[$linenr - 1]; | 1240 | my $rawline = $rawlines[$linenr - 1]; |
1191 | my $hunk_line = ($realcnt != 0); | ||
1192 | 1241 | ||
1193 | #extract the line range in the file after the patch is applied | 1242 | #extract the line range in the file after the patch is applied |
1194 | if ($line=~/^\@\@ -\d+(?:,\d+)? \+(\d+)(,(\d+))? \@\@/) { | 1243 | if ($line=~/^\@\@ -\d+(?:,\d+)? \+(\d+)(,(\d+))? \@\@/) { |
@@ -1205,6 +1254,7 @@ sub process { | |||
1205 | 1254 | ||
1206 | %suppress_ifbraces = (); | 1255 | %suppress_ifbraces = (); |
1207 | %suppress_whiletrailers = (); | 1256 | %suppress_whiletrailers = (); |
1257 | %suppress_export = (); | ||
1208 | next; | 1258 | next; |
1209 | 1259 | ||
1210 | # track the line number as we move through the hunk, note that | 1260 | # track the line number as we move through the hunk, note that |
@@ -1228,6 +1278,8 @@ sub process { | |||
1228 | $realcnt--; | 1278 | $realcnt--; |
1229 | } | 1279 | } |
1230 | 1280 | ||
1281 | my $hunk_line = ($realcnt != 0); | ||
1282 | |||
1231 | #make up the handle for any error we report on this line | 1283 | #make up the handle for any error we report on this line |
1232 | $prefix = "$filename:$realline: " if ($emacs && $file); | 1284 | $prefix = "$filename:$realline: " if ($emacs && $file); |
1233 | $prefix = "$filename:$linenr: " if ($emacs && !$file); | 1285 | $prefix = "$filename:$linenr: " if ($emacs && !$file); |
@@ -1336,6 +1388,18 @@ sub process { | |||
1336 | WARN("adding a line without newline at end of file\n" . $herecurr); | 1388 | WARN("adding a line without newline at end of file\n" . $herecurr); |
1337 | } | 1389 | } |
1338 | 1390 | ||
1391 | # Blackfin: use hi/lo macros | ||
1392 | if ($realfile =~ m@arch/blackfin/.*\.S$@) { | ||
1393 | if ($line =~ /\.[lL][[:space:]]*=.*&[[:space:]]*0x[fF][fF][fF][fF]/) { | ||
1394 | my $herevet = "$here\n" . cat_vet($line) . "\n"; | ||
1395 | ERROR("use the LO() macro, not (... & 0xFFFF)\n" . $herevet); | ||
1396 | } | ||
1397 | if ($line =~ /\.[hH][[:space:]]*=.*>>[[:space:]]*16/) { | ||
1398 | my $herevet = "$here\n" . cat_vet($line) . "\n"; | ||
1399 | ERROR("use the HI() macro, not (... >> 16)\n" . $herevet); | ||
1400 | } | ||
1401 | } | ||
1402 | |||
1339 | # check we are in a valid source file C or perl if not then ignore this hunk | 1403 | # check we are in a valid source file C or perl if not then ignore this hunk |
1340 | next if ($realfile !~ /\.(h|c|pl)$/); | 1404 | next if ($realfile !~ /\.(h|c|pl)$/); |
1341 | 1405 | ||
@@ -1355,14 +1419,33 @@ sub process { | |||
1355 | WARN("CVS style keyword markers, these will _not_ be updated\n". $herecurr); | 1419 | WARN("CVS style keyword markers, these will _not_ be updated\n". $herecurr); |
1356 | } | 1420 | } |
1357 | 1421 | ||
1422 | # Blackfin: don't use __builtin_bfin_[cs]sync | ||
1423 | if ($line =~ /__builtin_bfin_csync/) { | ||
1424 | my $herevet = "$here\n" . cat_vet($line) . "\n"; | ||
1425 | ERROR("use the CSYNC() macro in asm/blackfin.h\n" . $herevet); | ||
1426 | } | ||
1427 | if ($line =~ /__builtin_bfin_ssync/) { | ||
1428 | my $herevet = "$here\n" . cat_vet($line) . "\n"; | ||
1429 | ERROR("use the SSYNC() macro in asm/blackfin.h\n" . $herevet); | ||
1430 | } | ||
1431 | |||
1358 | # Check for potential 'bare' types | 1432 | # Check for potential 'bare' types |
1359 | my ($stat, $cond, $line_nr_next, $remain_next, $off_next); | 1433 | my ($stat, $cond, $line_nr_next, $remain_next, $off_next, |
1434 | $realline_next); | ||
1360 | if ($realcnt && $line =~ /.\s*\S/) { | 1435 | if ($realcnt && $line =~ /.\s*\S/) { |
1361 | ($stat, $cond, $line_nr_next, $remain_next, $off_next) = | 1436 | ($stat, $cond, $line_nr_next, $remain_next, $off_next) = |
1362 | ctx_statement_block($linenr, $realcnt, 0); | 1437 | ctx_statement_block($linenr, $realcnt, 0); |
1363 | $stat =~ s/\n./\n /g; | 1438 | $stat =~ s/\n./\n /g; |
1364 | $cond =~ s/\n./\n /g; | 1439 | $cond =~ s/\n./\n /g; |
1365 | 1440 | ||
1441 | # Find the real next line. | ||
1442 | $realline_next = $line_nr_next; | ||
1443 | if (defined $realline_next && | ||
1444 | (!defined $lines[$realline_next - 1] || | ||
1445 | substr($lines[$realline_next - 1], $off_next) =~ /^\s*$/)) { | ||
1446 | $realline_next++; | ||
1447 | } | ||
1448 | |||
1366 | my $s = $stat; | 1449 | my $s = $stat; |
1367 | $s =~ s/{.*$//s; | 1450 | $s =~ s/{.*$//s; |
1368 | 1451 | ||
@@ -1372,6 +1455,8 @@ sub process { | |||
1372 | # Ignore functions being called | 1455 | # Ignore functions being called |
1373 | } elsif ($s =~ /^.\s*$Ident\s*\(/s) { | 1456 | } elsif ($s =~ /^.\s*$Ident\s*\(/s) { |
1374 | 1457 | ||
1458 | } elsif ($s =~ /^.\s*else\b/s) { | ||
1459 | |||
1375 | # declarations always start with types | 1460 | # declarations always start with types |
1376 | } 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) { | 1461 | } 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) { |
1377 | my $type = $1; | 1462 | my $type = $1; |
@@ -1532,8 +1617,9 @@ sub process { | |||
1532 | $s =~ /^\s*#\s*?/ || | 1617 | $s =~ /^\s*#\s*?/ || |
1533 | $s =~ /^\s*$Ident\s*:/) { | 1618 | $s =~ /^\s*$Ident\s*:/) { |
1534 | $continuation = ($s =~ /^.*?\\\n/) ? 1 : 0; | 1619 | $continuation = ($s =~ /^.*?\\\n/) ? 1 : 0; |
1535 | $s =~ s/^.*?\n//; | 1620 | if ($s =~ s/^.*?\n//) { |
1536 | $cond_lines++; | 1621 | $cond_lines++; |
1622 | } | ||
1537 | } | 1623 | } |
1538 | } | 1624 | } |
1539 | 1625 | ||
@@ -1594,8 +1680,8 @@ sub process { | |||
1594 | } | 1680 | } |
1595 | 1681 | ||
1596 | # check for initialisation to aggregates open brace on the next line | 1682 | # check for initialisation to aggregates open brace on the next line |
1597 | if ($prevline =~ /$Declare\s*$Ident\s*=\s*$/ && | 1683 | if ($line =~ /^.\s*{/ && |
1598 | $line =~ /^.\s*{/) { | 1684 | $prevline =~ /(?:^|[^=])=\s*$/) { |
1599 | ERROR("that open brace { should be on the previous line\n" . $hereprev); | 1685 | ERROR("that open brace { should be on the previous line\n" . $hereprev); |
1600 | } | 1686 | } |
1601 | 1687 | ||
@@ -1620,21 +1706,40 @@ sub process { | |||
1620 | $line =~ s@//.*@@; | 1706 | $line =~ s@//.*@@; |
1621 | $opline =~ s@//.*@@; | 1707 | $opline =~ s@//.*@@; |
1622 | 1708 | ||
1623 | #EXPORT_SYMBOL should immediately follow its function closing }. | 1709 | # EXPORT_SYMBOL should immediately follow the thing it is exporting, consider |
1624 | if (($line =~ /EXPORT_SYMBOL.*\((.*)\)/) || | 1710 | # the whole statement. |
1625 | ($line =~ /EXPORT_UNUSED_SYMBOL.*\((.*)\)/)) { | 1711 | #print "APW <$lines[$realline_next - 1]>\n"; |
1712 | if (defined $realline_next && | ||
1713 | exists $lines[$realline_next - 1] && | ||
1714 | !defined $suppress_export{$realline_next} && | ||
1715 | ($lines[$realline_next - 1] =~ /EXPORT_SYMBOL.*\((.*)\)/ || | ||
1716 | $lines[$realline_next - 1] =~ /EXPORT_UNUSED_SYMBOL.*\((.*)\)/)) { | ||
1626 | my $name = $1; | 1717 | my $name = $1; |
1627 | if ($prevline !~ /(?: | 1718 | if ($stat !~ /(?: |
1628 | ^.}| | 1719 | \n.}\s*$| |
1629 | ^.DEFINE_$Ident\(\Q$name\E\)| | 1720 | ^.DEFINE_$Ident\(\Q$name\E\)| |
1630 | ^.DECLARE_$Ident\(\Q$name\E\)| | 1721 | ^.DECLARE_$Ident\(\Q$name\E\)| |
1631 | ^.LIST_HEAD\(\Q$name\E\)| | 1722 | ^.LIST_HEAD\(\Q$name\E\)| |
1632 | ^.$Type\s*\(\s*\*\s*\Q$name\E\s*\)\s*\(| | 1723 | ^.(?:$Storage\s+)?$Type\s*\(\s*\*\s*\Q$name\E\s*\)\s*\(| |
1633 | \b\Q$name\E(?:\s+$Attribute)?\s*(?:;|=|\[) | 1724 | \b\Q$name\E(?:\s+$Attribute)*\s*(?:;|=|\[|\() |
1634 | )/x) { | 1725 | )/x) { |
1635 | WARN("EXPORT_SYMBOL(foo); should immediately follow its function/variable\n" . $herecurr); | 1726 | #print "FOO A<$lines[$realline_next - 1]> stat<$stat> name<$name>\n"; |
1727 | $suppress_export{$realline_next} = 2; | ||
1728 | } else { | ||
1729 | $suppress_export{$realline_next} = 1; | ||
1636 | } | 1730 | } |
1637 | } | 1731 | } |
1732 | if (!defined $suppress_export{$linenr} && | ||
1733 | $prevline =~ /^.\s*$/ && | ||
1734 | ($line =~ /EXPORT_SYMBOL.*\((.*)\)/ || | ||
1735 | $line =~ /EXPORT_UNUSED_SYMBOL.*\((.*)\)/)) { | ||
1736 | #print "FOO B <$lines[$linenr - 1]>\n"; | ||
1737 | $suppress_export{$linenr} = 2; | ||
1738 | } | ||
1739 | if (defined $suppress_export{$linenr} && | ||
1740 | $suppress_export{$linenr} == 2) { | ||
1741 | WARN("EXPORT_SYMBOL(foo); should immediately follow its function/variable\n" . $herecurr); | ||
1742 | } | ||
1638 | 1743 | ||
1639 | # check for external initialisers. | 1744 | # check for external initialisers. |
1640 | if ($line =~ /^.$Type\s*$Ident\s*(?:\s+$Modifier)*\s*=\s*(0|NULL|false)\s*;/) { | 1745 | if ($line =~ /^.$Type\s*$Ident\s*(?:\s+$Modifier)*\s*=\s*(0|NULL|false)\s*;/) { |
@@ -1891,7 +1996,7 @@ sub process { | |||
1891 | # A unary '*' may be const | 1996 | # A unary '*' may be const |
1892 | 1997 | ||
1893 | } elsif ($ctx =~ /.xW/) { | 1998 | } elsif ($ctx =~ /.xW/) { |
1894 | ERROR("Aspace prohibited after that '$op' $at\n" . $hereptr); | 1999 | ERROR("space prohibited after that '$op' $at\n" . $hereptr); |
1895 | } | 2000 | } |
1896 | 2001 | ||
1897 | # unary ++ and unary -- are allowed no space on one side. | 2002 | # unary ++ and unary -- are allowed no space on one side. |
@@ -2243,7 +2348,8 @@ sub process { | |||
2243 | DECLARE_PER_CPU| | 2348 | DECLARE_PER_CPU| |
2244 | DEFINE_PER_CPU| | 2349 | DEFINE_PER_CPU| |
2245 | __typeof__\(| | 2350 | __typeof__\(| |
2246 | \.$Ident\s*=\s* | 2351 | \.$Ident\s*=\s*| |
2352 | ^\"|\"$ | ||
2247 | }x; | 2353 | }x; |
2248 | #print "REST<$rest> dstat<$dstat>\n"; | 2354 | #print "REST<$rest> dstat<$dstat>\n"; |
2249 | if ($rest ne '') { | 2355 | if ($rest ne '') { |
diff --git a/scripts/conmakehash.c b/scripts/conmakehash.c index e0c6891a9ad4..263a44d57fa9 100644 --- a/scripts/conmakehash.c +++ b/scripts/conmakehash.c | |||
@@ -24,14 +24,14 @@ | |||
24 | 24 | ||
25 | typedef unsigned short unicode; | 25 | typedef unsigned short unicode; |
26 | 26 | ||
27 | void usage(char *argv0) | 27 | static void usage(char *argv0) |
28 | { | 28 | { |
29 | fprintf(stderr, "Usage: \n" | 29 | fprintf(stderr, "Usage: \n" |
30 | " %s chartable [hashsize] [hashstep] [maxhashlevel]\n", argv0); | 30 | " %s chartable [hashsize] [hashstep] [maxhashlevel]\n", argv0); |
31 | exit(EX_USAGE); | 31 | exit(EX_USAGE); |
32 | } | 32 | } |
33 | 33 | ||
34 | int getunicode(char **p0) | 34 | static int getunicode(char **p0) |
35 | { | 35 | { |
36 | char *p = *p0; | 36 | char *p = *p0; |
37 | 37 | ||
@@ -49,7 +49,7 @@ unicode unitable[MAX_FONTLEN][255]; | |||
49 | /* Massive overkill, but who cares? */ | 49 | /* Massive overkill, but who cares? */ |
50 | int unicount[MAX_FONTLEN]; | 50 | int unicount[MAX_FONTLEN]; |
51 | 51 | ||
52 | void addpair(int fp, int un) | 52 | static void addpair(int fp, int un) |
53 | { | 53 | { |
54 | int i; | 54 | int i; |
55 | 55 | ||
diff --git a/scripts/dtc/data.c b/scripts/dtc/data.c index dd2e3d39d4c1..fe555e819bf8 100644 --- a/scripts/dtc/data.c +++ b/scripts/dtc/data.c | |||
@@ -217,7 +217,7 @@ struct data data_insert_at_marker(struct data d, struct marker *m, | |||
217 | return d; | 217 | return d; |
218 | } | 218 | } |
219 | 219 | ||
220 | struct data data_append_markers(struct data d, struct marker *m) | 220 | static struct data data_append_markers(struct data d, struct marker *m) |
221 | { | 221 | { |
222 | struct marker **mp = &d.markers; | 222 | struct marker **mp = &d.markers; |
223 | 223 | ||
diff --git a/scripts/dtc/dtc-lexer.l b/scripts/dtc/dtc-lexer.l index 44dbfd3f0976..a627bbee91d4 100644 --- a/scripts/dtc/dtc-lexer.l +++ b/scripts/dtc/dtc-lexer.l | |||
@@ -18,7 +18,7 @@ | |||
18 | * USA | 18 | * USA |
19 | */ | 19 | */ |
20 | 20 | ||
21 | %option noyywrap nounput yylineno | 21 | %option noyywrap noinput nounput yylineno |
22 | 22 | ||
23 | %x INCLUDE | 23 | %x INCLUDE |
24 | %x BYTESTRING | 24 | %x BYTESTRING |
diff --git a/scripts/dtc/dtc-lexer.lex.c_shipped b/scripts/dtc/dtc-lexer.lex.c_shipped index ac392cb040f6..e27cc636e326 100644 --- a/scripts/dtc/dtc-lexer.lex.c_shipped +++ b/scripts/dtc/dtc-lexer.lex.c_shipped | |||
@@ -9,7 +9,7 @@ | |||
9 | #define FLEX_SCANNER | 9 | #define FLEX_SCANNER |
10 | #define YY_FLEX_MAJOR_VERSION 2 | 10 | #define YY_FLEX_MAJOR_VERSION 2 |
11 | #define YY_FLEX_MINOR_VERSION 5 | 11 | #define YY_FLEX_MINOR_VERSION 5 |
12 | #define YY_FLEX_SUBMINOR_VERSION 34 | 12 | #define YY_FLEX_SUBMINOR_VERSION 35 |
13 | #if YY_FLEX_SUBMINOR_VERSION > 0 | 13 | #if YY_FLEX_SUBMINOR_VERSION > 0 |
14 | #define FLEX_BETA | 14 | #define FLEX_BETA |
15 | #endif | 15 | #endif |
@@ -54,7 +54,6 @@ typedef int flex_int32_t; | |||
54 | typedef unsigned char flex_uint8_t; | 54 | typedef unsigned char flex_uint8_t; |
55 | typedef unsigned short int flex_uint16_t; | 55 | typedef unsigned short int flex_uint16_t; |
56 | typedef unsigned int flex_uint32_t; | 56 | typedef unsigned int flex_uint32_t; |
57 | #endif /* ! C99 */ | ||
58 | 57 | ||
59 | /* Limits of integral types. */ | 58 | /* Limits of integral types. */ |
60 | #ifndef INT8_MIN | 59 | #ifndef INT8_MIN |
@@ -85,6 +84,8 @@ typedef unsigned int flex_uint32_t; | |||
85 | #define UINT32_MAX (4294967295U) | 84 | #define UINT32_MAX (4294967295U) |
86 | #endif | 85 | #endif |
87 | 86 | ||
87 | #endif /* ! C99 */ | ||
88 | |||
88 | #endif /* ! FLEXINT_H */ | 89 | #endif /* ! FLEXINT_H */ |
89 | 90 | ||
90 | #ifdef __cplusplus | 91 | #ifdef __cplusplus |
@@ -141,7 +142,15 @@ typedef unsigned int flex_uint32_t; | |||
141 | 142 | ||
142 | /* Size of default input buffer. */ | 143 | /* Size of default input buffer. */ |
143 | #ifndef YY_BUF_SIZE | 144 | #ifndef YY_BUF_SIZE |
145 | #ifdef __ia64__ | ||
146 | /* On IA-64, the buffer size is 16k, not 8k. | ||
147 | * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case. | ||
148 | * Ditto for the __ia64__ case accordingly. | ||
149 | */ | ||
150 | #define YY_BUF_SIZE 32768 | ||
151 | #else | ||
144 | #define YY_BUF_SIZE 16384 | 152 | #define YY_BUF_SIZE 16384 |
153 | #endif /* __ia64__ */ | ||
145 | #endif | 154 | #endif |
146 | 155 | ||
147 | /* The state buf must be large enough to hold one state per character in the main buffer. | 156 | /* The state buf must be large enough to hold one state per character in the main buffer. |
@@ -192,13 +201,6 @@ extern FILE *yyin, *yyout; | |||
192 | 201 | ||
193 | #define unput(c) yyunput( c, (yytext_ptr) ) | 202 | #define unput(c) yyunput( c, (yytext_ptr) ) |
194 | 203 | ||
195 | /* The following is because we cannot portably get our hands on size_t | ||
196 | * (without autoconf's help, which isn't available because we want | ||
197 | * flex-generated scanners to compile on their own). | ||
198 | * Given that the standard has decreed that size_t exists since 1989, | ||
199 | * I guess we can afford to depend on it. Manoj. | ||
200 | */ | ||
201 | |||
202 | #ifndef YY_TYPEDEF_YY_SIZE_T | 204 | #ifndef YY_TYPEDEF_YY_SIZE_T |
203 | #define YY_TYPEDEF_YY_SIZE_T | 205 | #define YY_TYPEDEF_YY_SIZE_T |
204 | typedef size_t yy_size_t; | 206 | typedef size_t yy_size_t; |
@@ -604,6 +606,7 @@ char *yytext; | |||
604 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 | 606 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 |
605 | * USA | 607 | * USA |
606 | */ | 608 | */ |
609 | #define YY_NO_INPUT 1 | ||
607 | 610 | ||
608 | 611 | ||
609 | 612 | ||
@@ -634,7 +637,7 @@ static int dts_version; /* = 0 */ | |||
634 | 637 | ||
635 | static void push_input_file(const char *filename); | 638 | static void push_input_file(const char *filename); |
636 | static int pop_input_file(void); | 639 | static int pop_input_file(void); |
637 | #line 638 "dtc-lexer.lex.c" | 640 | #line 641 "dtc-lexer.lex.c" |
638 | 641 | ||
639 | #define INITIAL 0 | 642 | #define INITIAL 0 |
640 | #define INCLUDE 1 | 643 | #define INCLUDE 1 |
@@ -656,6 +659,35 @@ static int pop_input_file(void); | |||
656 | 659 | ||
657 | static int yy_init_globals (void ); | 660 | static int yy_init_globals (void ); |
658 | 661 | ||
662 | /* Accessor methods to globals. | ||
663 | These are made visible to non-reentrant scanners for convenience. */ | ||
664 | |||
665 | int yylex_destroy (void ); | ||
666 | |||
667 | int yyget_debug (void ); | ||
668 | |||
669 | void yyset_debug (int debug_flag ); | ||
670 | |||
671 | YY_EXTRA_TYPE yyget_extra (void ); | ||
672 | |||
673 | void yyset_extra (YY_EXTRA_TYPE user_defined ); | ||
674 | |||
675 | FILE *yyget_in (void ); | ||
676 | |||
677 | void yyset_in (FILE * in_str ); | ||
678 | |||
679 | FILE *yyget_out (void ); | ||
680 | |||
681 | void yyset_out (FILE * out_str ); | ||
682 | |||
683 | int yyget_leng (void ); | ||
684 | |||
685 | char *yyget_text (void ); | ||
686 | |||
687 | int yyget_lineno (void ); | ||
688 | |||
689 | void yyset_lineno (int line_number ); | ||
690 | |||
659 | /* Macros after this point can all be overridden by user definitions in | 691 | /* Macros after this point can all be overridden by user definitions in |
660 | * section 1. | 692 | * section 1. |
661 | */ | 693 | */ |
@@ -688,7 +720,12 @@ static int input (void ); | |||
688 | 720 | ||
689 | /* Amount of stuff to slurp up with each read. */ | 721 | /* Amount of stuff to slurp up with each read. */ |
690 | #ifndef YY_READ_BUF_SIZE | 722 | #ifndef YY_READ_BUF_SIZE |
723 | #ifdef __ia64__ | ||
724 | /* On IA-64, the buffer size is 16k, not 8k */ | ||
725 | #define YY_READ_BUF_SIZE 16384 | ||
726 | #else | ||
691 | #define YY_READ_BUF_SIZE 8192 | 727 | #define YY_READ_BUF_SIZE 8192 |
728 | #endif /* __ia64__ */ | ||
692 | #endif | 729 | #endif |
693 | 730 | ||
694 | /* Copy whatever the last rule matched to the standard output. */ | 731 | /* Copy whatever the last rule matched to the standard output. */ |
@@ -696,7 +733,7 @@ static int input (void ); | |||
696 | /* This used to be an fputs(), but since the string might contain NUL's, | 733 | /* This used to be an fputs(), but since the string might contain NUL's, |
697 | * we now use fwrite(). | 734 | * we now use fwrite(). |
698 | */ | 735 | */ |
699 | #define ECHO fwrite( yytext, yyleng, 1, yyout ) | 736 | #define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0) |
700 | #endif | 737 | #endif |
701 | 738 | ||
702 | /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, | 739 | /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, |
@@ -707,7 +744,7 @@ static int input (void ); | |||
707 | if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ | 744 | if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ |
708 | { \ | 745 | { \ |
709 | int c = '*'; \ | 746 | int c = '*'; \ |
710 | int n; \ | 747 | size_t n; \ |
711 | for ( n = 0; n < max_size && \ | 748 | for ( n = 0; n < max_size && \ |
712 | (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ | 749 | (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ |
713 | buf[n] = (char) c; \ | 750 | buf[n] = (char) c; \ |
@@ -791,7 +828,7 @@ YY_DECL | |||
791 | 828 | ||
792 | #line 64 "dtc-lexer.l" | 829 | #line 64 "dtc-lexer.l" |
793 | 830 | ||
794 | #line 795 "dtc-lexer.lex.c" | 831 | #line 832 "dtc-lexer.lex.c" |
795 | 832 | ||
796 | if ( !(yy_init) ) | 833 | if ( !(yy_init) ) |
797 | { | 834 | { |
@@ -1116,7 +1153,7 @@ YY_RULE_SETUP | |||
1116 | #line 222 "dtc-lexer.l" | 1153 | #line 222 "dtc-lexer.l" |
1117 | ECHO; | 1154 | ECHO; |
1118 | YY_BREAK | 1155 | YY_BREAK |
1119 | #line 1120 "dtc-lexer.lex.c" | 1156 | #line 1157 "dtc-lexer.lex.c" |
1120 | 1157 | ||
1121 | case YY_END_OF_BUFFER: | 1158 | case YY_END_OF_BUFFER: |
1122 | { | 1159 | { |
@@ -1840,8 +1877,8 @@ YY_BUFFER_STATE yy_scan_string (yyconst char * yystr ) | |||
1840 | 1877 | ||
1841 | /** Setup the input buffer state to scan the given bytes. The next call to yylex() will | 1878 | /** Setup the input buffer state to scan the given bytes. The next call to yylex() will |
1842 | * scan from a @e copy of @a bytes. | 1879 | * scan from a @e copy of @a bytes. |
1843 | * @param bytes the byte buffer to scan | 1880 | * @param yybytes the byte buffer to scan |
1844 | * @param len the number of bytes in the buffer pointed to by @a bytes. | 1881 | * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes. |
1845 | * | 1882 | * |
1846 | * @return the newly allocated buffer state object. | 1883 | * @return the newly allocated buffer state object. |
1847 | */ | 1884 | */ |
diff --git a/scripts/dtc/libfdt/fdt_ro.c b/scripts/dtc/libfdt/fdt_ro.c index fbbba44fcd0d..22e692919ff9 100644 --- a/scripts/dtc/libfdt/fdt_ro.c +++ b/scripts/dtc/libfdt/fdt_ro.c | |||
@@ -411,7 +411,7 @@ int fdt_node_offset_by_phandle(const void *fdt, uint32_t phandle) | |||
411 | &phandle, sizeof(phandle)); | 411 | &phandle, sizeof(phandle)); |
412 | } | 412 | } |
413 | 413 | ||
414 | int _stringlist_contains(const char *strlist, int listlen, const char *str) | 414 | static int _stringlist_contains(const char *strlist, int listlen, const char *str) |
415 | { | 415 | { |
416 | int len = strlen(str); | 416 | int len = strlen(str); |
417 | const char *p; | 417 | const char *p; |
diff --git a/scripts/dtc/treesource.c b/scripts/dtc/treesource.c index ebeb6eb27907..1521ff11bb97 100644 --- a/scripts/dtc/treesource.c +++ b/scripts/dtc/treesource.c | |||
@@ -52,7 +52,7 @@ static void write_prefix(FILE *f, int level) | |||
52 | fputc('\t', f); | 52 | fputc('\t', f); |
53 | } | 53 | } |
54 | 54 | ||
55 | int isstring(char c) | 55 | static int isstring(char c) |
56 | { | 56 | { |
57 | return (isprint(c) | 57 | return (isprint(c) |
58 | || (c == '\0') | 58 | || (c == '\0') |
diff --git a/scripts/extract-ikconfig b/scripts/extract-ikconfig index 72997c353cb3..de233ff43c1c 100755 --- a/scripts/extract-ikconfig +++ b/scripts/extract-ikconfig | |||
@@ -17,6 +17,10 @@ dump_config() { | |||
17 | return | 17 | return |
18 | fi | 18 | fi |
19 | end=`$binoffset $file $IKCFG_ED 2>/dev/null` | 19 | end=`$binoffset $file $IKCFG_ED 2>/dev/null` |
20 | [ "$?" != "0" ] && end="-1" | ||
21 | if [ "$end" -eq "-1" ]; then | ||
22 | return | ||
23 | fi | ||
20 | 24 | ||
21 | start=`expr $start + 8` | 25 | start=`expr $start + 8` |
22 | size=`expr $end - $start` | 26 | size=`expr $end - $start` |
@@ -55,6 +59,8 @@ dump_config "$image" | |||
55 | GZHDR1="0x1f 0x8b 0x08 0x00" | 59 | GZHDR1="0x1f 0x8b 0x08 0x00" |
56 | GZHDR2="0x1f 0x8b 0x08 0x08" | 60 | GZHDR2="0x1f 0x8b 0x08 0x08" |
57 | 61 | ||
62 | ELFHDR="0x7f 0x45 0x4c 0x46" | ||
63 | |||
58 | # vmlinux.gz: Check for a compressed images | 64 | # vmlinux.gz: Check for a compressed images |
59 | off=`$binoffset "$image" $GZHDR1 2>/dev/null` | 65 | off=`$binoffset "$image" $GZHDR1 2>/dev/null` |
60 | [ "$?" != "0" ] && off="-1" | 66 | [ "$?" != "0" ] && off="-1" |
@@ -69,6 +75,14 @@ elif [ "$off" -ne "-1" ]; then | |||
69 | (dd ibs="$off" skip=1 count=0 && dd bs=512k) <"$image" 2>/dev/null | \ | 75 | (dd ibs="$off" skip=1 count=0 && dd bs=512k) <"$image" 2>/dev/null | \ |
70 | zcat >"$TMPFILE" | 76 | zcat >"$TMPFILE" |
71 | dump_config "$TMPFILE" | 77 | dump_config "$TMPFILE" |
78 | |||
79 | # check if this is simply an ELF file | ||
80 | else | ||
81 | off=`$binoffset "$image" $ELFHDR 2>/dev/null` | ||
82 | [ "$?" != "0" ] && off="-1" | ||
83 | if [ "$off" -eq "0" ]; then | ||
84 | dump_config "$image" | ||
85 | fi | ||
72 | fi | 86 | fi |
73 | 87 | ||
74 | echo "ERROR: Unable to extract kernel configuration information." | 88 | echo "ERROR: Unable to extract kernel configuration information." |
diff --git a/scripts/genksyms/genksyms.c b/scripts/genksyms/genksyms.c index 3a8297b5184c..af6b8363a2d5 100644 --- a/scripts/genksyms/genksyms.c +++ b/scripts/genksyms/genksyms.c | |||
@@ -176,7 +176,7 @@ static int is_unknown_symbol(struct symbol *sym) | |||
176 | strcmp(defn->string, "{") == 0); | 176 | strcmp(defn->string, "{") == 0); |
177 | } | 177 | } |
178 | 178 | ||
179 | struct symbol *__add_symbol(const char *name, enum symbol_type type, | 179 | static struct symbol *__add_symbol(const char *name, enum symbol_type type, |
180 | struct string_list *defn, int is_extern, | 180 | struct string_list *defn, int is_extern, |
181 | int is_reference) | 181 | int is_reference) |
182 | { | 182 | { |
@@ -265,7 +265,7 @@ struct symbol *add_symbol(const char *name, enum symbol_type type, | |||
265 | return __add_symbol(name, type, defn, is_extern, 0); | 265 | return __add_symbol(name, type, defn, is_extern, 0); |
266 | } | 266 | } |
267 | 267 | ||
268 | struct symbol *add_reference_symbol(const char *name, enum symbol_type type, | 268 | static struct symbol *add_reference_symbol(const char *name, enum symbol_type type, |
269 | struct string_list *defn, int is_extern) | 269 | struct string_list *defn, int is_extern) |
270 | { | 270 | { |
271 | return __add_symbol(name, type, defn, is_extern, 1); | 271 | return __add_symbol(name, type, defn, is_extern, 1); |
@@ -313,7 +313,7 @@ static int equal_list(struct string_list *a, struct string_list *b) | |||
313 | 313 | ||
314 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0])) | 314 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0])) |
315 | 315 | ||
316 | struct string_list *read_node(FILE *f) | 316 | static struct string_list *read_node(FILE *f) |
317 | { | 317 | { |
318 | char buffer[256]; | 318 | char buffer[256]; |
319 | struct string_list node = { | 319 | struct string_list node = { |
diff --git a/scripts/genksyms/keywords.c_shipped b/scripts/genksyms/keywords.c_shipped index 971e0113ae7a..287467a2e8c7 100644 --- a/scripts/genksyms/keywords.c_shipped +++ b/scripts/genksyms/keywords.c_shipped | |||
@@ -1,4 +1,4 @@ | |||
1 | /* ANSI-C code produced by gperf version 3.0.2 */ | 1 | /* ANSI-C code produced by gperf version 3.0.3 */ |
2 | /* Command-line: gperf -L ANSI-C -a -C -E -g -H is_reserved_hash -k '1,3,$' -N is_reserved_word -p -t scripts/genksyms/keywords.gperf */ | 2 | /* Command-line: gperf -L ANSI-C -a -C -E -g -H is_reserved_hash -k '1,3,$' -N is_reserved_word -p -t scripts/genksyms/keywords.gperf */ |
3 | 3 | ||
4 | #if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \ | 4 | #if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \ |
@@ -30,7 +30,9 @@ | |||
30 | 30 | ||
31 | #line 1 "scripts/genksyms/keywords.gperf" | 31 | #line 1 "scripts/genksyms/keywords.gperf" |
32 | 32 | ||
33 | #line 3 "scripts/genksyms/keywords.gperf" | 33 | struct resword; |
34 | static const struct resword *is_reserved_word(register const char *str, register unsigned int len); | ||
35 | #line 5 "scripts/genksyms/keywords.gperf" | ||
34 | struct resword { const char *name; int token; }; | 36 | struct resword { const char *name; int token; }; |
35 | /* maximum key range = 62, duplicates = 0 */ | 37 | /* maximum key range = 62, duplicates = 0 */ |
36 | 38 | ||
@@ -78,6 +80,9 @@ is_reserved_hash (register const char *str, register unsigned int len) | |||
78 | 80 | ||
79 | #ifdef __GNUC__ | 81 | #ifdef __GNUC__ |
80 | __inline | 82 | __inline |
83 | #ifdef __GNUC_STDC_INLINE__ | ||
84 | __attribute__ ((__gnu_inline__)) | ||
85 | #endif | ||
81 | #endif | 86 | #endif |
82 | const struct resword * | 87 | const struct resword * |
83 | is_reserved_word (register const char *str, register unsigned int len) | 88 | is_reserved_word (register const char *str, register unsigned int len) |
@@ -94,105 +99,105 @@ is_reserved_word (register const char *str, register unsigned int len) | |||
94 | static const struct resword wordlist[] = | 99 | static const struct resword wordlist[] = |
95 | { | 100 | { |
96 | {""}, {""}, {""}, | 101 | {""}, {""}, {""}, |
97 | #line 26 "scripts/genksyms/keywords.gperf" | 102 | #line 28 "scripts/genksyms/keywords.gperf" |
98 | {"asm", ASM_KEYW}, | 103 | {"asm", ASM_KEYW}, |
99 | {""}, | 104 | {""}, |
100 | #line 8 "scripts/genksyms/keywords.gperf" | 105 | #line 10 "scripts/genksyms/keywords.gperf" |
101 | {"__asm", ASM_KEYW}, | 106 | {"__asm", ASM_KEYW}, |
102 | {""}, | 107 | {""}, |
103 | #line 9 "scripts/genksyms/keywords.gperf" | 108 | #line 11 "scripts/genksyms/keywords.gperf" |
104 | {"__asm__", ASM_KEYW}, | 109 | {"__asm__", ASM_KEYW}, |
105 | {""}, {""}, | 110 | {""}, {""}, |
106 | #line 52 "scripts/genksyms/keywords.gperf" | 111 | #line 54 "scripts/genksyms/keywords.gperf" |
107 | {"__typeof__", TYPEOF_KEYW}, | 112 | {"__typeof__", TYPEOF_KEYW}, |
108 | {""}, | 113 | {""}, |
109 | #line 12 "scripts/genksyms/keywords.gperf" | 114 | #line 14 "scripts/genksyms/keywords.gperf" |
110 | {"__const", CONST_KEYW}, | 115 | {"__const", CONST_KEYW}, |
111 | #line 11 "scripts/genksyms/keywords.gperf" | ||
112 | {"__attribute__", ATTRIBUTE_KEYW}, | ||
113 | #line 13 "scripts/genksyms/keywords.gperf" | 116 | #line 13 "scripts/genksyms/keywords.gperf" |
117 | {"__attribute__", ATTRIBUTE_KEYW}, | ||
118 | #line 15 "scripts/genksyms/keywords.gperf" | ||
114 | {"__const__", CONST_KEYW}, | 119 | {"__const__", CONST_KEYW}, |
115 | #line 18 "scripts/genksyms/keywords.gperf" | 120 | #line 20 "scripts/genksyms/keywords.gperf" |
116 | {"__signed__", SIGNED_KEYW}, | 121 | {"__signed__", SIGNED_KEYW}, |
117 | #line 44 "scripts/genksyms/keywords.gperf" | 122 | #line 46 "scripts/genksyms/keywords.gperf" |
118 | {"static", STATIC_KEYW}, | 123 | {"static", STATIC_KEYW}, |
119 | #line 20 "scripts/genksyms/keywords.gperf" | 124 | #line 22 "scripts/genksyms/keywords.gperf" |
120 | {"__volatile__", VOLATILE_KEYW}, | 125 | {"__volatile__", VOLATILE_KEYW}, |
121 | #line 39 "scripts/genksyms/keywords.gperf" | 126 | #line 41 "scripts/genksyms/keywords.gperf" |
122 | {"int", INT_KEYW}, | 127 | {"int", INT_KEYW}, |
123 | #line 32 "scripts/genksyms/keywords.gperf" | 128 | #line 34 "scripts/genksyms/keywords.gperf" |
124 | {"char", CHAR_KEYW}, | 129 | {"char", CHAR_KEYW}, |
125 | #line 33 "scripts/genksyms/keywords.gperf" | 130 | #line 35 "scripts/genksyms/keywords.gperf" |
126 | {"const", CONST_KEYW}, | 131 | {"const", CONST_KEYW}, |
127 | #line 45 "scripts/genksyms/keywords.gperf" | 132 | #line 47 "scripts/genksyms/keywords.gperf" |
128 | {"struct", STRUCT_KEYW}, | 133 | {"struct", STRUCT_KEYW}, |
129 | #line 24 "scripts/genksyms/keywords.gperf" | 134 | #line 26 "scripts/genksyms/keywords.gperf" |
130 | {"__restrict__", RESTRICT_KEYW}, | 135 | {"__restrict__", RESTRICT_KEYW}, |
131 | #line 25 "scripts/genksyms/keywords.gperf" | 136 | #line 27 "scripts/genksyms/keywords.gperf" |
132 | {"restrict", RESTRICT_KEYW}, | 137 | {"restrict", RESTRICT_KEYW}, |
133 | #line 23 "scripts/genksyms/keywords.gperf" | 138 | #line 25 "scripts/genksyms/keywords.gperf" |
134 | {"_restrict", RESTRICT_KEYW}, | 139 | {"_restrict", RESTRICT_KEYW}, |
135 | #line 16 "scripts/genksyms/keywords.gperf" | 140 | #line 18 "scripts/genksyms/keywords.gperf" |
136 | {"__inline__", INLINE_KEYW}, | 141 | {"__inline__", INLINE_KEYW}, |
137 | #line 10 "scripts/genksyms/keywords.gperf" | 142 | #line 12 "scripts/genksyms/keywords.gperf" |
138 | {"__attribute", ATTRIBUTE_KEYW}, | 143 | {"__attribute", ATTRIBUTE_KEYW}, |
139 | {""}, | 144 | {""}, |
140 | #line 14 "scripts/genksyms/keywords.gperf" | 145 | #line 16 "scripts/genksyms/keywords.gperf" |
141 | {"__extension__", EXTENSION_KEYW}, | 146 | {"__extension__", EXTENSION_KEYW}, |
142 | #line 35 "scripts/genksyms/keywords.gperf" | 147 | #line 37 "scripts/genksyms/keywords.gperf" |
143 | {"enum", ENUM_KEYW}, | 148 | {"enum", ENUM_KEYW}, |
144 | #line 19 "scripts/genksyms/keywords.gperf" | 149 | #line 21 "scripts/genksyms/keywords.gperf" |
145 | {"__volatile", VOLATILE_KEYW}, | 150 | {"__volatile", VOLATILE_KEYW}, |
146 | #line 36 "scripts/genksyms/keywords.gperf" | 151 | #line 38 "scripts/genksyms/keywords.gperf" |
147 | {"extern", EXTERN_KEYW}, | 152 | {"extern", EXTERN_KEYW}, |
148 | {""}, | 153 | {""}, |
149 | #line 17 "scripts/genksyms/keywords.gperf" | 154 | #line 19 "scripts/genksyms/keywords.gperf" |
150 | {"__signed", SIGNED_KEYW}, | 155 | {"__signed", SIGNED_KEYW}, |
151 | #line 7 "scripts/genksyms/keywords.gperf" | 156 | #line 9 "scripts/genksyms/keywords.gperf" |
152 | {"EXPORT_SYMBOL_GPL_FUTURE", EXPORT_SYMBOL_KEYW}, | 157 | {"EXPORT_SYMBOL_GPL_FUTURE", EXPORT_SYMBOL_KEYW}, |
153 | {""}, | 158 | {""}, |
154 | #line 51 "scripts/genksyms/keywords.gperf" | 159 | #line 53 "scripts/genksyms/keywords.gperf" |
155 | {"typeof", TYPEOF_KEYW}, | 160 | {"typeof", TYPEOF_KEYW}, |
156 | #line 46 "scripts/genksyms/keywords.gperf" | 161 | #line 48 "scripts/genksyms/keywords.gperf" |
157 | {"typedef", TYPEDEF_KEYW}, | 162 | {"typedef", TYPEDEF_KEYW}, |
158 | #line 15 "scripts/genksyms/keywords.gperf" | 163 | #line 17 "scripts/genksyms/keywords.gperf" |
159 | {"__inline", INLINE_KEYW}, | 164 | {"__inline", INLINE_KEYW}, |
160 | #line 31 "scripts/genksyms/keywords.gperf" | 165 | #line 33 "scripts/genksyms/keywords.gperf" |
161 | {"auto", AUTO_KEYW}, | 166 | {"auto", AUTO_KEYW}, |
162 | #line 47 "scripts/genksyms/keywords.gperf" | 167 | #line 49 "scripts/genksyms/keywords.gperf" |
163 | {"union", UNION_KEYW}, | 168 | {"union", UNION_KEYW}, |
164 | {""}, {""}, | 169 | {""}, {""}, |
165 | #line 48 "scripts/genksyms/keywords.gperf" | 170 | #line 50 "scripts/genksyms/keywords.gperf" |
166 | {"unsigned", UNSIGNED_KEYW}, | 171 | {"unsigned", UNSIGNED_KEYW}, |
167 | #line 49 "scripts/genksyms/keywords.gperf" | 172 | #line 51 "scripts/genksyms/keywords.gperf" |
168 | {"void", VOID_KEYW}, | 173 | {"void", VOID_KEYW}, |
169 | #line 42 "scripts/genksyms/keywords.gperf" | 174 | #line 44 "scripts/genksyms/keywords.gperf" |
170 | {"short", SHORT_KEYW}, | 175 | {"short", SHORT_KEYW}, |
171 | {""}, {""}, | 176 | {""}, {""}, |
172 | #line 50 "scripts/genksyms/keywords.gperf" | 177 | #line 52 "scripts/genksyms/keywords.gperf" |
173 | {"volatile", VOLATILE_KEYW}, | 178 | {"volatile", VOLATILE_KEYW}, |
174 | {""}, | 179 | {""}, |
175 | #line 37 "scripts/genksyms/keywords.gperf" | 180 | #line 39 "scripts/genksyms/keywords.gperf" |
176 | {"float", FLOAT_KEYW}, | 181 | {"float", FLOAT_KEYW}, |
177 | #line 34 "scripts/genksyms/keywords.gperf" | 182 | #line 36 "scripts/genksyms/keywords.gperf" |
178 | {"double", DOUBLE_KEYW}, | 183 | {"double", DOUBLE_KEYW}, |
179 | {""}, | 184 | {""}, |
180 | #line 5 "scripts/genksyms/keywords.gperf" | 185 | #line 7 "scripts/genksyms/keywords.gperf" |
181 | {"EXPORT_SYMBOL", EXPORT_SYMBOL_KEYW}, | 186 | {"EXPORT_SYMBOL", EXPORT_SYMBOL_KEYW}, |
182 | {""}, {""}, | 187 | {""}, {""}, |
183 | #line 38 "scripts/genksyms/keywords.gperf" | 188 | #line 40 "scripts/genksyms/keywords.gperf" |
184 | {"inline", INLINE_KEYW}, | 189 | {"inline", INLINE_KEYW}, |
185 | #line 6 "scripts/genksyms/keywords.gperf" | 190 | #line 8 "scripts/genksyms/keywords.gperf" |
186 | {"EXPORT_SYMBOL_GPL", EXPORT_SYMBOL_KEYW}, | 191 | {"EXPORT_SYMBOL_GPL", EXPORT_SYMBOL_KEYW}, |
187 | #line 41 "scripts/genksyms/keywords.gperf" | 192 | #line 43 "scripts/genksyms/keywords.gperf" |
188 | {"register", REGISTER_KEYW}, | 193 | {"register", REGISTER_KEYW}, |
189 | {""}, | 194 | {""}, |
190 | #line 22 "scripts/genksyms/keywords.gperf" | 195 | #line 24 "scripts/genksyms/keywords.gperf" |
191 | {"_Bool", BOOL_KEYW}, | 196 | {"_Bool", BOOL_KEYW}, |
192 | #line 43 "scripts/genksyms/keywords.gperf" | 197 | #line 45 "scripts/genksyms/keywords.gperf" |
193 | {"signed", SIGNED_KEYW}, | 198 | {"signed", SIGNED_KEYW}, |
194 | {""}, {""}, | 199 | {""}, {""}, |
195 | #line 40 "scripts/genksyms/keywords.gperf" | 200 | #line 42 "scripts/genksyms/keywords.gperf" |
196 | {"long", LONG_KEYW} | 201 | {"long", LONG_KEYW} |
197 | }; | 202 | }; |
198 | 203 | ||
diff --git a/scripts/genksyms/keywords.gperf b/scripts/genksyms/keywords.gperf index 5ef3733225fb..8fe977a4d57b 100644 --- a/scripts/genksyms/keywords.gperf +++ b/scripts/genksyms/keywords.gperf | |||
@@ -1,4 +1,6 @@ | |||
1 | %{ | 1 | %{ |
2 | struct resword; | ||
3 | static const struct resword *is_reserved_word(register const char *str, register unsigned int len); | ||
2 | %} | 4 | %} |
3 | struct resword { const char *name; int token; } | 5 | struct resword { const char *name; int token; } |
4 | %% | 6 | %% |
diff --git a/scripts/get_maintainer.pl b/scripts/get_maintainer.pl index 278a45bd45a5..81a67a458e78 100755 --- a/scripts/get_maintainer.pl +++ b/scripts/get_maintainer.pl | |||
@@ -5,15 +5,15 @@ | |||
5 | # Print selected MAINTAINERS information for | 5 | # Print selected MAINTAINERS information for |
6 | # the files modified in a patch or for a file | 6 | # the files modified in a patch or for a file |
7 | # | 7 | # |
8 | # usage: perl scripts/get_maintainers.pl [OPTIONS] <patch> | 8 | # usage: perl scripts/get_maintainer.pl [OPTIONS] <patch> |
9 | # perl scripts/get_maintainers.pl [OPTIONS] -f <file> | 9 | # perl scripts/get_maintainer.pl [OPTIONS] -f <file> |
10 | # | 10 | # |
11 | # Licensed under the terms of the GNU GPL License version 2 | 11 | # Licensed under the terms of the GNU GPL License version 2 |
12 | 12 | ||
13 | use strict; | 13 | use strict; |
14 | 14 | ||
15 | my $P = $0; | 15 | my $P = $0; |
16 | my $V = '0.17'; | 16 | my $V = '0.21'; |
17 | 17 | ||
18 | use Getopt::Long qw(:config no_auto_abbrev); | 18 | use Getopt::Long qw(:config no_auto_abbrev); |
19 | 19 | ||
@@ -29,13 +29,17 @@ my $email_git_min_signatures = 1; | |||
29 | my $email_git_max_maintainers = 5; | 29 | my $email_git_max_maintainers = 5; |
30 | my $email_git_min_percent = 5; | 30 | my $email_git_min_percent = 5; |
31 | my $email_git_since = "1-year-ago"; | 31 | my $email_git_since = "1-year-ago"; |
32 | my $email_git_blame = 0; | ||
33 | my $email_remove_duplicates = 1; | ||
32 | my $output_multiline = 1; | 34 | my $output_multiline = 1; |
33 | my $output_separator = ", "; | 35 | my $output_separator = ", "; |
34 | my $scm = 0; | 36 | my $scm = 0; |
35 | my $web = 0; | 37 | my $web = 0; |
36 | my $subsystem = 0; | 38 | my $subsystem = 0; |
37 | my $status = 0; | 39 | my $status = 0; |
40 | my $keywords = 1; | ||
38 | my $from_filename = 0; | 41 | my $from_filename = 0; |
42 | my $pattern_depth = 0; | ||
39 | my $version = 0; | 43 | my $version = 0; |
40 | my $help = 0; | 44 | my $help = 0; |
41 | 45 | ||
@@ -68,6 +72,8 @@ if (!GetOptions( | |||
68 | 'git-max-maintainers=i' => \$email_git_max_maintainers, | 72 | 'git-max-maintainers=i' => \$email_git_max_maintainers, |
69 | 'git-min-percent=i' => \$email_git_min_percent, | 73 | 'git-min-percent=i' => \$email_git_min_percent, |
70 | 'git-since=s' => \$email_git_since, | 74 | 'git-since=s' => \$email_git_since, |
75 | 'git-blame!' => \$email_git_blame, | ||
76 | 'remove-duplicates!' => \$email_remove_duplicates, | ||
71 | 'm!' => \$email_maintainer, | 77 | 'm!' => \$email_maintainer, |
72 | 'n!' => \$email_usename, | 78 | 'n!' => \$email_usename, |
73 | 'l!' => \$email_list, | 79 | 'l!' => \$email_list, |
@@ -78,6 +84,8 @@ if (!GetOptions( | |||
78 | 'status!' => \$status, | 84 | 'status!' => \$status, |
79 | 'scm!' => \$scm, | 85 | 'scm!' => \$scm, |
80 | 'web!' => \$web, | 86 | 'web!' => \$web, |
87 | 'pattern-depth=i' => \$pattern_depth, | ||
88 | 'k|keywords!' => \$keywords, | ||
81 | 'f|file' => \$from_filename, | 89 | 'f|file' => \$from_filename, |
82 | 'v|version' => \$version, | 90 | 'v|version' => \$version, |
83 | 'h|help' => \$help, | 91 | 'h|help' => \$help, |
@@ -101,14 +109,19 @@ if ($#ARGV < 0) { | |||
101 | die "$P: argument missing: patchfile or -f file please\n"; | 109 | die "$P: argument missing: patchfile or -f file please\n"; |
102 | } | 110 | } |
103 | 111 | ||
112 | if ($output_separator ne ", ") { | ||
113 | $output_multiline = 0; | ||
114 | } | ||
115 | |||
104 | my $selections = $email + $scm + $status + $subsystem + $web; | 116 | my $selections = $email + $scm + $status + $subsystem + $web; |
105 | if ($selections == 0) { | 117 | if ($selections == 0) { |
106 | usage(); | 118 | usage(); |
107 | die "$P: Missing required option: email, scm, status, subsystem or web\n"; | 119 | die "$P: Missing required option: email, scm, status, subsystem or web\n"; |
108 | } | 120 | } |
109 | 121 | ||
110 | if ($email && ($email_maintainer + $email_list + $email_subscriber_list | 122 | if ($email && |
111 | + $email_git + $email_git_penguin_chiefs) == 0) { | 123 | ($email_maintainer + $email_list + $email_subscriber_list + |
124 | $email_git + $email_git_penguin_chiefs + $email_git_blame) == 0) { | ||
112 | usage(); | 125 | usage(); |
113 | die "$P: Please select at least 1 email option\n"; | 126 | die "$P: Please select at least 1 email option\n"; |
114 | } | 127 | } |
@@ -121,6 +134,8 @@ if (!top_of_kernel_tree($lk_path)) { | |||
121 | ## Read MAINTAINERS for type/value pairs | 134 | ## Read MAINTAINERS for type/value pairs |
122 | 135 | ||
123 | my @typevalue = (); | 136 | my @typevalue = (); |
137 | my %keyword_hash; | ||
138 | |||
124 | open(MAINT, "<${lk_path}MAINTAINERS") || die "$P: Can't open MAINTAINERS\n"; | 139 | open(MAINT, "<${lk_path}MAINTAINERS") || die "$P: Can't open MAINTAINERS\n"; |
125 | while (<MAINT>) { | 140 | while (<MAINT>) { |
126 | my $line = $_; | 141 | my $line = $_; |
@@ -138,6 +153,8 @@ while (<MAINT>) { | |||
138 | if ((-d $value)) { | 153 | if ((-d $value)) { |
139 | $value =~ s@([^/])$@$1/@; | 154 | $value =~ s@([^/])$@$1/@; |
140 | } | 155 | } |
156 | } elsif ($type eq "K") { | ||
157 | $keyword_hash{@typevalue} = $value; | ||
141 | } | 158 | } |
142 | push(@typevalue, "$type:$value"); | 159 | push(@typevalue, "$type:$value"); |
143 | } elsif (!/^(\s)*$/) { | 160 | } elsif (!/^(\s)*$/) { |
@@ -147,9 +164,37 @@ while (<MAINT>) { | |||
147 | } | 164 | } |
148 | close(MAINT); | 165 | close(MAINT); |
149 | 166 | ||
167 | my %mailmap; | ||
168 | |||
169 | if ($email_remove_duplicates) { | ||
170 | open(MAILMAP, "<${lk_path}.mailmap") || warn "$P: Can't open .mailmap\n"; | ||
171 | while (<MAILMAP>) { | ||
172 | my $line = $_; | ||
173 | |||
174 | next if ($line =~ m/^\s*#/); | ||
175 | next if ($line =~ m/^\s*$/); | ||
176 | |||
177 | my ($name, $address) = parse_email($line); | ||
178 | $line = format_email($name, $address); | ||
179 | |||
180 | next if ($line =~ m/^\s*$/); | ||
181 | |||
182 | if (exists($mailmap{$name})) { | ||
183 | my $obj = $mailmap{$name}; | ||
184 | push(@$obj, $address); | ||
185 | } else { | ||
186 | my @arr = ($address); | ||
187 | $mailmap{$name} = \@arr; | ||
188 | } | ||
189 | } | ||
190 | close(MAILMAP); | ||
191 | } | ||
192 | |||
150 | ## use the filenames on the command line or find the filenames in the patchfiles | 193 | ## use the filenames on the command line or find the filenames in the patchfiles |
151 | 194 | ||
152 | my @files = (); | 195 | my @files = (); |
196 | my @range = (); | ||
197 | my @keyword_tvi = (); | ||
153 | 198 | ||
154 | foreach my $file (@ARGV) { | 199 | foreach my $file (@ARGV) { |
155 | ##if $file is a directory and it lacks a trailing slash, add one | 200 | ##if $file is a directory and it lacks a trailing slash, add one |
@@ -160,15 +205,40 @@ foreach my $file (@ARGV) { | |||
160 | } | 205 | } |
161 | if ($from_filename) { | 206 | if ($from_filename) { |
162 | push(@files, $file); | 207 | push(@files, $file); |
208 | if (-f $file && $keywords) { | ||
209 | open(FILE, "<$file") or die "$P: Can't open ${file}\n"; | ||
210 | while (<FILE>) { | ||
211 | my $patch_line = $_; | ||
212 | foreach my $line (keys %keyword_hash) { | ||
213 | if ($patch_line =~ m/^.*$keyword_hash{$line}/x) { | ||
214 | push(@keyword_tvi, $line); | ||
215 | } | ||
216 | } | ||
217 | } | ||
218 | close(FILE); | ||
219 | } | ||
163 | } else { | 220 | } else { |
164 | my $file_cnt = @files; | 221 | my $file_cnt = @files; |
222 | my $lastfile; | ||
165 | open(PATCH, "<$file") or die "$P: Can't open ${file}\n"; | 223 | open(PATCH, "<$file") or die "$P: Can't open ${file}\n"; |
166 | while (<PATCH>) { | 224 | while (<PATCH>) { |
225 | my $patch_line = $_; | ||
167 | if (m/^\+\+\+\s+(\S+)/) { | 226 | if (m/^\+\+\+\s+(\S+)/) { |
168 | my $filename = $1; | 227 | my $filename = $1; |
169 | $filename =~ s@^[^/]*/@@; | 228 | $filename =~ s@^[^/]*/@@; |
170 | $filename =~ s@\n@@; | 229 | $filename =~ s@\n@@; |
230 | $lastfile = $filename; | ||
171 | push(@files, $filename); | 231 | push(@files, $filename); |
232 | } elsif (m/^\@\@ -(\d+),(\d+)/) { | ||
233 | if ($email_git_blame) { | ||
234 | push(@range, "$lastfile:$1:$2"); | ||
235 | } | ||
236 | } elsif ($keywords) { | ||
237 | foreach my $line (keys %keyword_hash) { | ||
238 | if ($patch_line =~ m/^[+-].*$keyword_hash{$line}/x) { | ||
239 | push(@keyword_tvi, $line); | ||
240 | } | ||
241 | } | ||
172 | } | 242 | } |
173 | } | 243 | } |
174 | close(PATCH); | 244 | close(PATCH); |
@@ -201,6 +271,7 @@ foreach my $file (@files) { | |||
201 | if ($type eq 'X') { | 271 | if ($type eq 'X') { |
202 | if (file_match_pattern($file, $value)) { | 272 | if (file_match_pattern($file, $value)) { |
203 | $exclude = 1; | 273 | $exclude = 1; |
274 | last; | ||
204 | } | 275 | } |
205 | } | 276 | } |
206 | } | 277 | } |
@@ -208,35 +279,52 @@ foreach my $file (@files) { | |||
208 | 279 | ||
209 | if (!$exclude) { | 280 | if (!$exclude) { |
210 | my $tvi = 0; | 281 | my $tvi = 0; |
282 | my %hash; | ||
211 | foreach my $line (@typevalue) { | 283 | foreach my $line (@typevalue) { |
212 | if ($line =~ m/^(\C):\s*(.*)/) { | 284 | if ($line =~ m/^(\C):\s*(.*)/) { |
213 | my $type = $1; | 285 | my $type = $1; |
214 | my $value = $2; | 286 | my $value = $2; |
215 | if ($type eq 'F') { | 287 | if ($type eq 'F') { |
216 | if (file_match_pattern($file, $value)) { | 288 | if (file_match_pattern($file, $value)) { |
217 | add_categories($tvi); | 289 | my $value_pd = ($value =~ tr@/@@); |
290 | my $file_pd = ($file =~ tr@/@@); | ||
291 | $value_pd++ if (substr($value,-1,1) ne "/"); | ||
292 | if ($pattern_depth == 0 || | ||
293 | (($file_pd - $value_pd) < $pattern_depth)) { | ||
294 | $hash{$tvi} = $value_pd; | ||
295 | } | ||
218 | } | 296 | } |
219 | } | 297 | } |
220 | } | 298 | } |
221 | $tvi++; | 299 | $tvi++; |
222 | } | 300 | } |
301 | foreach my $line (sort {$hash{$b} <=> $hash{$a}} keys %hash) { | ||
302 | add_categories($line); | ||
303 | } | ||
223 | } | 304 | } |
224 | 305 | ||
225 | if ($email && $email_git) { | 306 | if ($email && $email_git) { |
226 | recent_git_signoffs($file); | 307 | recent_git_signoffs($file); |
227 | } | 308 | } |
228 | 309 | ||
310 | if ($email && $email_git_blame) { | ||
311 | git_assign_blame($file); | ||
312 | } | ||
313 | } | ||
314 | |||
315 | if ($keywords) { | ||
316 | @keyword_tvi = sort_and_uniq(@keyword_tvi); | ||
317 | foreach my $line (@keyword_tvi) { | ||
318 | add_categories($line); | ||
319 | } | ||
229 | } | 320 | } |
230 | 321 | ||
231 | if ($email) { | 322 | if ($email) { |
232 | foreach my $chief (@penguin_chief) { | 323 | foreach my $chief (@penguin_chief) { |
233 | if ($chief =~ m/^(.*):(.*)/) { | 324 | if ($chief =~ m/^(.*):(.*)/) { |
234 | my $email_address; | 325 | my $email_address; |
235 | if ($email_usename) { | 326 | |
236 | $email_address = format_email($1, $2); | 327 | $email_address = format_email($1, $2); |
237 | } else { | ||
238 | $email_address = $2; | ||
239 | } | ||
240 | if ($email_git_penguin_chiefs) { | 328 | if ($email_git_penguin_chiefs) { |
241 | push(@email_to, $email_address); | 329 | push(@email_to, $email_address); |
242 | } else { | 330 | } else { |
@@ -258,22 +346,22 @@ if ($email || $email_list) { | |||
258 | } | 346 | } |
259 | 347 | ||
260 | if ($scm) { | 348 | if ($scm) { |
261 | @scm = sort_and_uniq(@scm); | 349 | @scm = uniq(@scm); |
262 | output(@scm); | 350 | output(@scm); |
263 | } | 351 | } |
264 | 352 | ||
265 | if ($status) { | 353 | if ($status) { |
266 | @status = sort_and_uniq(@status); | 354 | @status = uniq(@status); |
267 | output(@status); | 355 | output(@status); |
268 | } | 356 | } |
269 | 357 | ||
270 | if ($subsystem) { | 358 | if ($subsystem) { |
271 | @subsystem = sort_and_uniq(@subsystem); | 359 | @subsystem = uniq(@subsystem); |
272 | output(@subsystem); | 360 | output(@subsystem); |
273 | } | 361 | } |
274 | 362 | ||
275 | if ($web) { | 363 | if ($web) { |
276 | @web = sort_and_uniq(@web); | 364 | @web = uniq(@web); |
277 | output(@web); | 365 | output(@web); |
278 | } | 366 | } |
279 | 367 | ||
@@ -311,10 +399,12 @@ MAINTAINER field selection options: | |||
311 | --git-max-maintainers => maximum maintainers to add (default: 5) | 399 | --git-max-maintainers => maximum maintainers to add (default: 5) |
312 | --git-min-percent => minimum percentage of commits required (default: 5) | 400 | --git-min-percent => minimum percentage of commits required (default: 5) |
313 | --git-since => git history to use (default: 1-year-ago) | 401 | --git-since => git history to use (default: 1-year-ago) |
402 | --git-blame => use git blame to find modified commits for patch or file | ||
314 | --m => include maintainer(s) if any | 403 | --m => include maintainer(s) if any |
315 | --n => include name 'Full Name <addr\@domain.tld>' | 404 | --n => include name 'Full Name <addr\@domain.tld>' |
316 | --l => include list(s) if any | 405 | --l => include list(s) if any |
317 | --s => include subscriber only list(s) if any | 406 | --s => include subscriber only list(s) if any |
407 | --remove-duplicates => minimize duplicate email names/addresses | ||
318 | --scm => print SCM tree(s) if any | 408 | --scm => print SCM tree(s) if any |
319 | --status => print status if any | 409 | --status => print status if any |
320 | --subsystem => print subsystem name if any | 410 | --subsystem => print subsystem name if any |
@@ -322,24 +412,29 @@ MAINTAINER field selection options: | |||
322 | 412 | ||
323 | Output type options: | 413 | Output type options: |
324 | --separator [, ] => separator for multiple entries on 1 line | 414 | --separator [, ] => separator for multiple entries on 1 line |
415 | using --separator also sets --nomultiline if --separator is not [, ] | ||
325 | --multiline => print 1 entry per line | 416 | --multiline => print 1 entry per line |
326 | 417 | ||
327 | Default options: | ||
328 | [--email --git --m --n --l --multiline] | ||
329 | |||
330 | Other options: | 418 | Other options: |
419 | --pattern-depth => Number of pattern directory traversals (default: 0 (all)) | ||
420 | --keywords => scan patch for keywords (default: 1 (on)) | ||
331 | --version => show version | 421 | --version => show version |
332 | --help => show this help information | 422 | --help => show this help information |
333 | 423 | ||
424 | Default options: | ||
425 | [--email --git --m --n --l --multiline --pattern-depth=0 --remove-duplicates] | ||
426 | |||
334 | Notes: | 427 | Notes: |
335 | Using "-f directory" may give unexpected results: | 428 | Using "-f directory" may give unexpected results: |
336 | 429 | Used with "--git", git signators for _all_ files in and below | |
337 | Used with "--git", git signators for _all_ files in and below | 430 | directory are examined as git recurses directories. |
338 | directory are examined as git recurses directories. | 431 | Any specified X: (exclude) pattern matches are _not_ ignored. |
339 | Any specified X: (exclude) pattern matches are _not_ ignored. | 432 | Used with "--nogit", directory is used as a pattern match, |
340 | Used with "--nogit", directory is used as a pattern match, | 433 | no individual file within the directory or subdirectory |
341 | no individual file within the directory or subdirectory | 434 | is matched. |
342 | is matched. | 435 | Used with "--git-blame", does not iterate all files in directory |
436 | Using "--git-blame" is slow and may add old committers and authors | ||
437 | that are no longer active maintainers to the output. | ||
343 | EOT | 438 | EOT |
344 | } | 439 | } |
345 | 440 | ||
@@ -370,30 +465,99 @@ sub top_of_kernel_tree { | |||
370 | return 0; | 465 | return 0; |
371 | } | 466 | } |
372 | 467 | ||
373 | sub format_email { | 468 | sub parse_email { |
374 | my ($name, $email) = @_; | 469 | my ($formatted_email) = @_; |
470 | |||
471 | my $name = ""; | ||
472 | my $address = ""; | ||
473 | |||
474 | if ($formatted_email =~ /^([^<]+)<(.+\@.*)>.*$/) { | ||
475 | $name = $1; | ||
476 | $address = $2; | ||
477 | } elsif ($formatted_email =~ /^\s*<(.+\@\S*)>.*$/) { | ||
478 | $address = $1; | ||
479 | } elsif ($formatted_email =~ /^(.+\@\S*).*$/) { | ||
480 | $address = $1; | ||
481 | } | ||
375 | 482 | ||
376 | $name =~ s/^\s+|\s+$//g; | 483 | $name =~ s/^\s+|\s+$//g; |
377 | $name =~ s/^\"|\"$//g; | 484 | $name =~ s/^\"|\"$//g; |
378 | $email =~ s/^\s+|\s+$//g; | 485 | $address =~ s/^\s+|\s+$//g; |
486 | |||
487 | if ($name =~ /[^a-z0-9 \.\-]/i) { ##has "must quote" chars | ||
488 | $name =~ s/(?<!\\)"/\\"/g; ##escape quotes | ||
489 | $name = "\"$name\""; | ||
490 | } | ||
491 | |||
492 | return ($name, $address); | ||
493 | } | ||
494 | |||
495 | sub format_email { | ||
496 | my ($name, $address) = @_; | ||
379 | 497 | ||
380 | my $formatted_email = ""; | 498 | my $formatted_email; |
499 | |||
500 | $name =~ s/^\s+|\s+$//g; | ||
501 | $name =~ s/^\"|\"$//g; | ||
502 | $address =~ s/^\s+|\s+$//g; | ||
381 | 503 | ||
382 | if ($name =~ /[^a-z0-9 \.\-]/i) { ##has "must quote" chars | 504 | if ($name =~ /[^a-z0-9 \.\-]/i) { ##has "must quote" chars |
383 | $name =~ s/(?<!\\)"/\\"/g; ##escape quotes | 505 | $name =~ s/(?<!\\)"/\\"/g; ##escape quotes |
384 | $formatted_email = "\"${name}\"\ \<${email}\>"; | 506 | $name = "\"$name\""; |
507 | } | ||
508 | |||
509 | if ($email_usename) { | ||
510 | if ("$name" eq "") { | ||
511 | $formatted_email = "$address"; | ||
512 | } else { | ||
513 | $formatted_email = "$name <${address}>"; | ||
514 | } | ||
385 | } else { | 515 | } else { |
386 | $formatted_email = "${name} \<${email}\>"; | 516 | $formatted_email = $address; |
387 | } | 517 | } |
518 | |||
388 | return $formatted_email; | 519 | return $formatted_email; |
389 | } | 520 | } |
390 | 521 | ||
391 | sub add_categories { | 522 | sub find_starting_index { |
523 | my ($index) = @_; | ||
524 | |||
525 | while ($index > 0) { | ||
526 | my $tv = $typevalue[$index]; | ||
527 | if (!($tv =~ m/^(\C):\s*(.*)/)) { | ||
528 | last; | ||
529 | } | ||
530 | $index--; | ||
531 | } | ||
532 | |||
533 | return $index; | ||
534 | } | ||
535 | |||
536 | sub find_ending_index { | ||
392 | my ($index) = @_; | 537 | my ($index) = @_; |
393 | 538 | ||
394 | $index = $index - 1; | 539 | while ($index < @typevalue) { |
395 | while ($index >= 0) { | ||
396 | my $tv = $typevalue[$index]; | 540 | my $tv = $typevalue[$index]; |
541 | if (!($tv =~ m/^(\C):\s*(.*)/)) { | ||
542 | last; | ||
543 | } | ||
544 | $index++; | ||
545 | } | ||
546 | |||
547 | return $index; | ||
548 | } | ||
549 | |||
550 | sub add_categories { | ||
551 | my ($index) = @_; | ||
552 | |||
553 | my $i; | ||
554 | my $start = find_starting_index($index); | ||
555 | my $end = find_ending_index($index); | ||
556 | |||
557 | push(@subsystem, $typevalue[$start]); | ||
558 | |||
559 | for ($i = $start + 1; $i < $end; $i++) { | ||
560 | my $tv = $typevalue[$i]; | ||
397 | if ($tv =~ m/^(\C):\s*(.*)/) { | 561 | if ($tv =~ m/^(\C):\s*(.*)/) { |
398 | my $ptype = $1; | 562 | my $ptype = $1; |
399 | my $pvalue = $2; | 563 | my $pvalue = $2; |
@@ -414,19 +578,19 @@ sub add_categories { | |||
414 | } | 578 | } |
415 | } | 579 | } |
416 | } elsif ($ptype eq "M") { | 580 | } elsif ($ptype eq "M") { |
417 | my $p_used = 0; | 581 | my ($name, $address) = parse_email($pvalue); |
418 | if ($index >= 0) { | 582 | if ($name eq "") { |
419 | my $tv = $typevalue[$index - 1]; | 583 | if ($i > 0) { |
420 | if ($tv =~ m/^(\C):\s*(.*)/) { | 584 | my $tv = $typevalue[$i - 1]; |
421 | if ($1 eq "P") { | 585 | if ($tv =~ m/^(\C):\s*(.*)/) { |
422 | if ($email_usename) { | 586 | if ($1 eq "P") { |
423 | push_email_address(format_email($2, $pvalue)); | 587 | $name = $2; |
424 | $p_used = 1; | 588 | $pvalue = format_email($name, $address); |
425 | } | 589 | } |
426 | } | 590 | } |
427 | } | 591 | } |
428 | } | 592 | } |
429 | if (!$p_used) { | 593 | if ($email_maintainer) { |
430 | push_email_addresses($pvalue); | 594 | push_email_addresses($pvalue); |
431 | } | 595 | } |
432 | } elsif ($ptype eq "T") { | 596 | } elsif ($ptype eq "T") { |
@@ -436,31 +600,41 @@ sub add_categories { | |||
436 | } elsif ($ptype eq "S") { | 600 | } elsif ($ptype eq "S") { |
437 | push(@status, $pvalue); | 601 | push(@status, $pvalue); |
438 | } | 602 | } |
439 | |||
440 | $index--; | ||
441 | } else { | ||
442 | push(@subsystem,$tv); | ||
443 | $index = -1; | ||
444 | } | 603 | } |
445 | } | 604 | } |
446 | } | 605 | } |
447 | 606 | ||
607 | my %email_hash_name; | ||
608 | my %email_hash_address; | ||
609 | |||
610 | sub email_inuse { | ||
611 | my ($name, $address) = @_; | ||
612 | |||
613 | return 1 if (($name eq "") && ($address eq "")); | ||
614 | return 1 if (($name ne "") && exists($email_hash_name{$name})); | ||
615 | return 1 if (($address ne "") && exists($email_hash_address{$address})); | ||
616 | |||
617 | return 0; | ||
618 | } | ||
619 | |||
448 | sub push_email_address { | 620 | sub push_email_address { |
449 | my ($email_address) = @_; | 621 | my ($line) = @_; |
622 | |||
623 | my ($name, $address) = parse_email($line); | ||
450 | 624 | ||
451 | my $email_name = ""; | 625 | if ($address eq "") { |
452 | if ($email_address =~ m/([^<]+)<(.*\@.*)>$/) { | 626 | return 0; |
453 | $email_name = $1; | ||
454 | $email_address = $2; | ||
455 | } | 627 | } |
456 | 628 | ||
457 | if ($email_maintainer) { | 629 | if (!$email_remove_duplicates) { |
458 | if ($email_usename && $email_name) { | 630 | push(@email_to, format_email($name, $address)); |
459 | push(@email_to, format_email($email_name, $email_address)); | 631 | } elsif (!email_inuse($name, $address)) { |
460 | } else { | 632 | push(@email_to, format_email($name, $address)); |
461 | push(@email_to, $email_address); | 633 | $email_hash_name{$name}++; |
462 | } | 634 | $email_hash_address{$address}++; |
463 | } | 635 | } |
636 | |||
637 | return 1; | ||
464 | } | 638 | } |
465 | 639 | ||
466 | sub push_email_addresses { | 640 | sub push_email_addresses { |
@@ -476,7 +650,9 @@ sub push_email_addresses { | |||
476 | push_email_address($entry); | 650 | push_email_address($entry); |
477 | } | 651 | } |
478 | } else { | 652 | } else { |
479 | warn("Invalid MAINTAINERS address: '" . $address . "'\n"); | 653 | if (!push_email_address($address)) { |
654 | warn("Invalid MAINTAINERS address: '" . $address . "'\n"); | ||
655 | } | ||
480 | } | 656 | } |
481 | } | 657 | } |
482 | 658 | ||
@@ -492,6 +668,32 @@ sub which { | |||
492 | return ""; | 668 | return ""; |
493 | } | 669 | } |
494 | 670 | ||
671 | sub mailmap { | ||
672 | my @lines = @_; | ||
673 | my %hash; | ||
674 | |||
675 | foreach my $line (@lines) { | ||
676 | my ($name, $address) = parse_email($line); | ||
677 | if (!exists($hash{$name})) { | ||
678 | $hash{$name} = $address; | ||
679 | } elsif ($address ne $hash{$name}) { | ||
680 | $address = $hash{$name}; | ||
681 | $line = format_email($name, $address); | ||
682 | } | ||
683 | if (exists($mailmap{$name})) { | ||
684 | my $obj = $mailmap{$name}; | ||
685 | foreach my $map_address (@$obj) { | ||
686 | if (($map_address eq $address) && | ||
687 | ($map_address ne $hash{$name})) { | ||
688 | $line = format_email($name, $hash{$name}); | ||
689 | } | ||
690 | } | ||
691 | } | ||
692 | } | ||
693 | |||
694 | return @lines; | ||
695 | } | ||
696 | |||
495 | sub recent_git_signoffs { | 697 | sub recent_git_signoffs { |
496 | my ($file) = @_; | 698 | my ($file) = @_; |
497 | 699 | ||
@@ -500,6 +702,7 @@ sub recent_git_signoffs { | |||
500 | my $output = ""; | 702 | my $output = ""; |
501 | my $count = 0; | 703 | my $count = 0; |
502 | my @lines = (); | 704 | my @lines = (); |
705 | my %hash; | ||
503 | my $total_sign_offs; | 706 | my $total_sign_offs; |
504 | 707 | ||
505 | if (which("git") eq "") { | 708 | if (which("git") eq "") { |
@@ -513,53 +716,120 @@ sub recent_git_signoffs { | |||
513 | } | 716 | } |
514 | 717 | ||
515 | $cmd = "git log --since=${email_git_since} -- ${file}"; | 718 | $cmd = "git log --since=${email_git_since} -- ${file}"; |
516 | $cmd .= " | grep -Ei \"^[-_ a-z]+by:.*\\\@.*\$\""; | ||
517 | if (!$email_git_penguin_chiefs) { | ||
518 | $cmd .= " | grep -Ev \"${penguin_chiefs}\""; | ||
519 | } | ||
520 | $cmd .= " | cut -f2- -d\":\""; | ||
521 | $cmd .= " | sort | uniq -c | sort -rn"; | ||
522 | 719 | ||
523 | $output = `${cmd}`; | 720 | $output = `${cmd}`; |
524 | $output =~ s/^\s*//gm; | 721 | $output =~ s/^\s*//gm; |
525 | 722 | ||
526 | @lines = split("\n", $output); | 723 | @lines = split("\n", $output); |
527 | 724 | ||
528 | $total_sign_offs = 0; | 725 | @lines = grep(/^[-_ a-z]+by:.*\@.*$/i, @lines); |
726 | if (!$email_git_penguin_chiefs) { | ||
727 | @lines = grep(!/${penguin_chiefs}/i, @lines); | ||
728 | } | ||
729 | # cut -f2- -d":" | ||
730 | s/.*:\s*(.+)\s*/$1/ for (@lines); | ||
731 | |||
732 | $total_sign_offs = @lines; | ||
733 | |||
734 | if ($email_remove_duplicates) { | ||
735 | @lines = mailmap(@lines); | ||
736 | } | ||
737 | |||
738 | @lines = sort(@lines); | ||
739 | |||
740 | # uniq -c | ||
741 | $hash{$_}++ for @lines; | ||
742 | |||
743 | # sort -rn | ||
744 | foreach my $line (sort {$hash{$b} <=> $hash{$a}} keys %hash) { | ||
745 | my $sign_offs = $hash{$line}; | ||
746 | $count++; | ||
747 | last if ($sign_offs < $email_git_min_signatures || | ||
748 | $count > $email_git_max_maintainers || | ||
749 | $sign_offs * 100 / $total_sign_offs < $email_git_min_percent); | ||
750 | push_email_address($line); | ||
751 | } | ||
752 | } | ||
753 | |||
754 | sub save_commits { | ||
755 | my ($cmd, @commits) = @_; | ||
756 | my $output; | ||
757 | my @lines = (); | ||
758 | |||
759 | $output = `${cmd}`; | ||
760 | |||
761 | @lines = split("\n", $output); | ||
529 | foreach my $line (@lines) { | 762 | foreach my $line (@lines) { |
530 | if ($line =~ m/([0-9]+)\s+(.*)/) { | 763 | if ($line =~ m/^(\w+) /) { |
531 | $total_sign_offs += $1; | 764 | push (@commits, $1); |
532 | } else { | ||
533 | die("$P: Unexpected git output: ${line}\n"); | ||
534 | } | 765 | } |
535 | } | 766 | } |
767 | return @commits; | ||
768 | } | ||
536 | 769 | ||
537 | foreach my $line (@lines) { | 770 | sub git_assign_blame { |
538 | if ($line =~ m/([0-9]+)\s+(.*)/) { | 771 | my ($file) = @_; |
539 | my $sign_offs = $1; | 772 | |
540 | $line = $2; | 773 | my @lines = (); |
541 | $count++; | 774 | my @commits = (); |
542 | if ($sign_offs < $email_git_min_signatures || | 775 | my $cmd; |
543 | $count > $email_git_max_maintainers || | 776 | my $output; |
544 | $sign_offs * 100 / $total_sign_offs < $email_git_min_percent) { | 777 | my %hash; |
545 | last; | 778 | my $total_sign_offs; |
546 | } | 779 | my $count; |
780 | |||
781 | if (@range) { | ||
782 | foreach my $file_range_diff (@range) { | ||
783 | next if (!($file_range_diff =~ m/(.+):(.+):(.+)/)); | ||
784 | my $diff_file = $1; | ||
785 | my $diff_start = $2; | ||
786 | my $diff_length = $3; | ||
787 | next if (!("$file" eq "$diff_file")); | ||
788 | $cmd = "git blame -l -L $diff_start,+$diff_length $file"; | ||
789 | @commits = save_commits($cmd, @commits); | ||
547 | } | 790 | } |
548 | if ($line =~ m/(.+)<(.+)>/) { | 791 | } else { |
549 | my $git_name = $1; | 792 | if (-f $file) { |
550 | my $git_addr = $2; | 793 | $cmd = "git blame -l $file"; |
551 | if ($email_usename) { | 794 | @commits = save_commits($cmd, @commits); |
552 | push(@email_to, format_email($git_name, $git_addr)); | ||
553 | } else { | ||
554 | push(@email_to, $git_addr); | ||
555 | } | ||
556 | } elsif ($line =~ m/<(.+)>/) { | ||
557 | my $git_addr = $1; | ||
558 | push(@email_to, $git_addr); | ||
559 | } else { | ||
560 | push(@email_to, $line); | ||
561 | } | 795 | } |
562 | } | 796 | } |
797 | |||
798 | $total_sign_offs = 0; | ||
799 | @commits = uniq(@commits); | ||
800 | foreach my $commit (@commits) { | ||
801 | $cmd = "git log -1 ${commit}"; | ||
802 | |||
803 | $output = `${cmd}`; | ||
804 | $output =~ s/^\s*//gm; | ||
805 | @lines = split("\n", $output); | ||
806 | |||
807 | @lines = grep(/^[-_ a-z]+by:.*\@.*$/i, @lines); | ||
808 | if (!$email_git_penguin_chiefs) { | ||
809 | @lines = grep(!/${penguin_chiefs}/i, @lines); | ||
810 | } | ||
811 | |||
812 | # cut -f2- -d":" | ||
813 | s/.*:\s*(.+)\s*/$1/ for (@lines); | ||
814 | |||
815 | $total_sign_offs += @lines; | ||
816 | |||
817 | if ($email_remove_duplicates) { | ||
818 | @lines = mailmap(@lines); | ||
819 | } | ||
820 | |||
821 | $hash{$_}++ for @lines; | ||
822 | } | ||
823 | |||
824 | $count = 0; | ||
825 | foreach my $line (sort {$hash{$b} <=> $hash{$a}} keys %hash) { | ||
826 | my $sign_offs = $hash{$line}; | ||
827 | $count++; | ||
828 | last if ($sign_offs < $email_git_min_signatures || | ||
829 | $count > $email_git_max_maintainers || | ||
830 | $sign_offs * 100 / $total_sign_offs < $email_git_min_percent); | ||
831 | push_email_address($line); | ||
832 | } | ||
563 | } | 833 | } |
564 | 834 | ||
565 | sub uniq { | 835 | sub uniq { |
diff --git a/scripts/headers_install.pl b/scripts/headers_install.pl index c6ae4052ab43..b89ca2c58fdb 100644 --- a/scripts/headers_install.pl +++ b/scripts/headers_install.pl | |||
@@ -20,7 +20,7 @@ use strict; | |||
20 | 20 | ||
21 | my ($readdir, $installdir, $arch, @files) = @ARGV; | 21 | my ($readdir, $installdir, $arch, @files) = @ARGV; |
22 | 22 | ||
23 | my $unifdef = "scripts/unifdef -U__KERNEL__"; | 23 | my $unifdef = "scripts/unifdef -U__KERNEL__ -D__EXPORTED_HEADERS__"; |
24 | 24 | ||
25 | foreach my $file (@files) { | 25 | foreach my $file (@files) { |
26 | local *INFILE; | 26 | local *INFILE; |
diff --git a/scripts/kallsyms.c b/scripts/kallsyms.c index 64343cc084b4..86c3896a1e01 100644 --- a/scripts/kallsyms.c +++ b/scripts/kallsyms.c | |||
@@ -585,7 +585,7 @@ static int prefix_underscores_count(const char *str) | |||
585 | { | 585 | { |
586 | const char *tail = str; | 586 | const char *tail = str; |
587 | 587 | ||
588 | while (*tail != '_') | 588 | while (*tail == '_') |
589 | tail++; | 589 | tail++; |
590 | 590 | ||
591 | return tail - str; | 591 | return tail - str; |
diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile index 5ddf8becd7a2..80599e3a7994 100644 --- a/scripts/kconfig/Makefile +++ b/scripts/kconfig/Makefile | |||
@@ -2,7 +2,8 @@ | |||
2 | # Kernel configuration targets | 2 | # Kernel configuration targets |
3 | # These targets are used from top-level makefile | 3 | # These targets are used from top-level makefile |
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 | localmodconfig localyesconfig | ||
6 | 7 | ||
7 | ifdef KBUILD_KCONFIG | 8 | ifdef KBUILD_KCONFIG |
8 | Kconfig := $(KBUILD_KCONFIG) | 9 | Kconfig := $(KBUILD_KCONFIG) |
@@ -28,6 +29,35 @@ oldconfig: $(obj)/conf | |||
28 | silentoldconfig: $(obj)/conf | 29 | silentoldconfig: $(obj)/conf |
29 | $< -s $(Kconfig) | 30 | $< -s $(Kconfig) |
30 | 31 | ||
32 | localmodconfig: $(obj)/streamline_config.pl $(obj)/conf | ||
33 | $(Q)perl $< $(srctree) $(Kconfig) > .tmp.config | ||
34 | $(Q)if [ -f .config ]; then \ | ||
35 | cmp -s .tmp.config .config || \ | ||
36 | (mv -f .config .config.old.1; \ | ||
37 | mv -f .tmp.config .config; \ | ||
38 | $(obj)/conf -s $(Kconfig); \ | ||
39 | mv -f .config.old.1 .config.old) \ | ||
40 | else \ | ||
41 | mv -f .tmp.config .config; \ | ||
42 | $(obj)/conf -s $(Kconfig); \ | ||
43 | fi | ||
44 | $(Q)rm -f .tmp.config | ||
45 | |||
46 | localyesconfig: $(obj)/streamline_config.pl $(obj)/conf | ||
47 | $(Q)perl $< $(srctree) $(Kconfig) > .tmp.config | ||
48 | $(Q)sed -i s/=m/=y/ .tmp.config | ||
49 | $(Q)if [ -f .config ]; then \ | ||
50 | cmp -s .tmp.config .config || \ | ||
51 | (mv -f .config .config.old.1; \ | ||
52 | mv -f .tmp.config .config; \ | ||
53 | $(obj)/conf -s $(Kconfig); \ | ||
54 | mv -f .config.old.1 .config.old) \ | ||
55 | else \ | ||
56 | mv -f .tmp.config .config; \ | ||
57 | $(obj)/conf -s $(Kconfig); \ | ||
58 | fi | ||
59 | $(Q)rm -f .tmp.config | ||
60 | |||
31 | # Create new linux.pot file | 61 | # Create new linux.pot file |
32 | # Adjust charset to UTF-8 in .po file to accept UTF-8 in Kconfig files | 62 | # Adjust charset to UTF-8 in .po file to accept UTF-8 in Kconfig files |
33 | # The symlink is used to repair a deficiency in arch/um | 63 | # The symlink is used to repair a deficiency in arch/um |
@@ -83,6 +113,8 @@ help: | |||
83 | @echo ' xconfig - Update current config utilising a QT based front-end' | 113 | @echo ' xconfig - Update current config utilising a QT based front-end' |
84 | @echo ' gconfig - Update current config utilising a GTK based front-end' | 114 | @echo ' gconfig - Update current config utilising a GTK based front-end' |
85 | @echo ' oldconfig - Update current config utilising a provided .config as base' | 115 | @echo ' oldconfig - Update current config utilising a provided .config as base' |
116 | @echo ' localmodconfig - Update current config disabling modules not loaded' | ||
117 | @echo ' localyesconfig - Update current config converting local mods to core' | ||
86 | @echo ' silentoldconfig - Same as oldconfig, but quietly, additionally update deps' | 118 | @echo ' silentoldconfig - Same as oldconfig, but quietly, additionally update deps' |
87 | @echo ' randconfig - New config with random answer to all options' | 119 | @echo ' randconfig - New config with random answer to all options' |
88 | @echo ' defconfig - New config with default answer to all options' | 120 | @echo ' defconfig - New config with default answer to all options' |
diff --git a/scripts/kconfig/conf.c b/scripts/kconfig/conf.c index 3baaaecd6b13..9960d1c303f8 100644 --- a/scripts/kconfig/conf.c +++ b/scripts/kconfig/conf.c | |||
@@ -38,14 +38,14 @@ static int conf_cnt; | |||
38 | static char line[128]; | 38 | static char line[128]; |
39 | static struct menu *rootEntry; | 39 | static struct menu *rootEntry; |
40 | 40 | ||
41 | static char nohelp_text[] = N_("Sorry, no help available for this option yet.\n"); | 41 | static void print_help(struct menu *menu) |
42 | |||
43 | static const char *get_help(struct menu *menu) | ||
44 | { | 42 | { |
45 | if (menu_has_help(menu)) | 43 | struct gstr help = str_new(); |
46 | return _(menu_get_help(menu)); | 44 | |
47 | else | 45 | menu_get_ext_help(menu, &help); |
48 | return nohelp_text; | 46 | |
47 | printf("\n%s\n", str_get(&help)); | ||
48 | str_free(&help); | ||
49 | } | 49 | } |
50 | 50 | ||
51 | static void strip(char *str) | 51 | static void strip(char *str) |
@@ -121,7 +121,7 @@ static int conf_askvalue(struct symbol *sym, const char *def) | |||
121 | return 1; | 121 | return 1; |
122 | } | 122 | } |
123 | 123 | ||
124 | int conf_string(struct menu *menu) | 124 | static int conf_string(struct menu *menu) |
125 | { | 125 | { |
126 | struct symbol *sym = menu->sym; | 126 | struct symbol *sym = menu->sym; |
127 | const char *def; | 127 | const char *def; |
@@ -140,7 +140,7 @@ int conf_string(struct menu *menu) | |||
140 | case '?': | 140 | case '?': |
141 | /* print help */ | 141 | /* print help */ |
142 | if (line[1] == '\n') { | 142 | if (line[1] == '\n') { |
143 | printf("\n%s\n", get_help(menu)); | 143 | print_help(menu); |
144 | def = NULL; | 144 | def = NULL; |
145 | break; | 145 | break; |
146 | } | 146 | } |
@@ -220,7 +220,7 @@ static int conf_sym(struct menu *menu) | |||
220 | if (sym_set_tristate_value(sym, newval)) | 220 | if (sym_set_tristate_value(sym, newval)) |
221 | return 0; | 221 | return 0; |
222 | help: | 222 | help: |
223 | printf("\n%s\n", get_help(menu)); | 223 | print_help(menu); |
224 | } | 224 | } |
225 | } | 225 | } |
226 | 226 | ||
@@ -307,7 +307,7 @@ static int conf_choice(struct menu *menu) | |||
307 | fgets(line, 128, stdin); | 307 | fgets(line, 128, stdin); |
308 | strip(line); | 308 | strip(line); |
309 | if (line[0] == '?') { | 309 | if (line[0] == '?') { |
310 | printf("\n%s\n", get_help(menu)); | 310 | print_help(menu); |
311 | continue; | 311 | continue; |
312 | } | 312 | } |
313 | if (!line[0]) | 313 | if (!line[0]) |
@@ -331,7 +331,7 @@ static int conf_choice(struct menu *menu) | |||
331 | if (!child) | 331 | if (!child) |
332 | continue; | 332 | continue; |
333 | if (line[strlen(line) - 1] == '?') { | 333 | if (line[strlen(line) - 1] == '?') { |
334 | printf("\n%s\n", get_help(child)); | 334 | print_help(child); |
335 | continue; | 335 | continue; |
336 | } | 336 | } |
337 | sym_set_choice_value(sym, child->sym); | 337 | sym_set_choice_value(sym, child->sym); |
diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c index a04da3459f0f..b55e72ff2fc6 100644 --- a/scripts/kconfig/confdata.c +++ b/scripts/kconfig/confdata.c | |||
@@ -560,7 +560,7 @@ int conf_write(const char *name) | |||
560 | return 0; | 560 | return 0; |
561 | } | 561 | } |
562 | 562 | ||
563 | int conf_split_config(void) | 563 | static int conf_split_config(void) |
564 | { | 564 | { |
565 | const char *name; | 565 | const char *name; |
566 | char path[128]; | 566 | char path[128]; |
diff --git a/scripts/kconfig/expr.c b/scripts/kconfig/expr.c index 579ece4fa584..edd3f39a080a 100644 --- a/scripts/kconfig/expr.c +++ b/scripts/kconfig/expr.c | |||
@@ -348,7 +348,7 @@ struct expr *expr_trans_bool(struct expr *e) | |||
348 | /* | 348 | /* |
349 | * e1 || e2 -> ? | 349 | * e1 || e2 -> ? |
350 | */ | 350 | */ |
351 | struct expr *expr_join_or(struct expr *e1, struct expr *e2) | 351 | static struct expr *expr_join_or(struct expr *e1, struct expr *e2) |
352 | { | 352 | { |
353 | struct expr *tmp; | 353 | struct expr *tmp; |
354 | struct symbol *sym1, *sym2; | 354 | struct symbol *sym1, *sym2; |
@@ -412,7 +412,7 @@ struct expr *expr_join_or(struct expr *e1, struct expr *e2) | |||
412 | return NULL; | 412 | return NULL; |
413 | } | 413 | } |
414 | 414 | ||
415 | struct expr *expr_join_and(struct expr *e1, struct expr *e2) | 415 | static struct expr *expr_join_and(struct expr *e1, struct expr *e2) |
416 | { | 416 | { |
417 | struct expr *tmp; | 417 | struct expr *tmp; |
418 | struct symbol *sym1, *sym2; | 418 | struct symbol *sym1, *sym2; |
@@ -1098,6 +1098,8 @@ void expr_fprint(struct expr *e, FILE *out) | |||
1098 | static void expr_print_gstr_helper(void *data, struct symbol *sym, const char *str) | 1098 | static void expr_print_gstr_helper(void *data, struct symbol *sym, const char *str) |
1099 | { | 1099 | { |
1100 | str_append((struct gstr*)data, str); | 1100 | str_append((struct gstr*)data, str); |
1101 | if (sym) | ||
1102 | str_printf((struct gstr*)data, " [=%s]", sym_get_string_value(sym)); | ||
1101 | } | 1103 | } |
1102 | 1104 | ||
1103 | void expr_gstr_print(struct expr *e, struct gstr *gs) | 1105 | void expr_gstr_print(struct expr *e, struct gstr *gs) |
diff --git a/scripts/kconfig/gconf.c b/scripts/kconfig/gconf.c index 199b22bb49e2..65464366fe38 100644 --- a/scripts/kconfig/gconf.c +++ b/scripts/kconfig/gconf.c | |||
@@ -456,19 +456,9 @@ static void text_insert_help(struct menu *menu) | |||
456 | GtkTextBuffer *buffer; | 456 | GtkTextBuffer *buffer; |
457 | GtkTextIter start, end; | 457 | GtkTextIter start, end; |
458 | const char *prompt = _(menu_get_prompt(menu)); | 458 | const char *prompt = _(menu_get_prompt(menu)); |
459 | gchar *name; | 459 | struct gstr help = str_new(); |
460 | const char *help; | ||
461 | 460 | ||
462 | help = menu_get_help(menu); | 461 | menu_get_ext_help(menu, &help); |
463 | |||
464 | /* Gettextize if the help text not empty */ | ||
465 | if ((help != 0) && (help[0] != 0)) | ||
466 | help = _(help); | ||
467 | |||
468 | if (menu->sym && menu->sym->name) | ||
469 | name = g_strdup_printf(menu->sym->name); | ||
470 | else | ||
471 | name = g_strdup(""); | ||
472 | 462 | ||
473 | buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(text_w)); | 463 | buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(text_w)); |
474 | gtk_text_buffer_get_bounds(buffer, &start, &end); | 464 | gtk_text_buffer_get_bounds(buffer, &start, &end); |
@@ -478,14 +468,11 @@ static void text_insert_help(struct menu *menu) | |||
478 | gtk_text_buffer_get_end_iter(buffer, &end); | 468 | gtk_text_buffer_get_end_iter(buffer, &end); |
479 | gtk_text_buffer_insert_with_tags(buffer, &end, prompt, -1, tag1, | 469 | gtk_text_buffer_insert_with_tags(buffer, &end, prompt, -1, tag1, |
480 | NULL); | 470 | NULL); |
481 | gtk_text_buffer_insert_at_cursor(buffer, " ", 1); | ||
482 | gtk_text_buffer_get_end_iter(buffer, &end); | ||
483 | gtk_text_buffer_insert_with_tags(buffer, &end, name, -1, tag1, | ||
484 | NULL); | ||
485 | gtk_text_buffer_insert_at_cursor(buffer, "\n\n", 2); | 471 | gtk_text_buffer_insert_at_cursor(buffer, "\n\n", 2); |
486 | gtk_text_buffer_get_end_iter(buffer, &end); | 472 | gtk_text_buffer_get_end_iter(buffer, &end); |
487 | gtk_text_buffer_insert_with_tags(buffer, &end, help, -1, tag2, | 473 | gtk_text_buffer_insert_with_tags(buffer, &end, str_get(&help), -1, tag2, |
488 | NULL); | 474 | NULL); |
475 | str_free(&help); | ||
489 | } | 476 | } |
490 | 477 | ||
491 | 478 | ||
diff --git a/scripts/kconfig/gconf.glade b/scripts/kconfig/gconf.glade index 803233fdd6dd..b1c86c19292c 100644 --- a/scripts/kconfig/gconf.glade +++ b/scripts/kconfig/gconf.glade | |||
@@ -547,7 +547,7 @@ | |||
547 | <property name="headers_visible">True</property> | 547 | <property name="headers_visible">True</property> |
548 | <property name="rules_hint">False</property> | 548 | <property name="rules_hint">False</property> |
549 | <property name="reorderable">False</property> | 549 | <property name="reorderable">False</property> |
550 | <property name="enable_search">True</property> | 550 | <property name="enable_search">False</property> |
551 | <signal name="cursor_changed" handler="on_treeview2_cursor_changed" last_modification_time="Sun, 12 Jan 2003 15:58:22 GMT"/> | 551 | <signal name="cursor_changed" handler="on_treeview2_cursor_changed" last_modification_time="Sun, 12 Jan 2003 15:58:22 GMT"/> |
552 | <signal name="button_press_event" handler="on_treeview1_button_press_event" last_modification_time="Sun, 12 Jan 2003 16:03:52 GMT"/> | 552 | <signal name="button_press_event" handler="on_treeview1_button_press_event" last_modification_time="Sun, 12 Jan 2003 16:03:52 GMT"/> |
553 | <signal name="key_press_event" handler="on_treeview2_key_press_event" last_modification_time="Sun, 12 Jan 2003 16:11:44 GMT"/> | 553 | <signal name="key_press_event" handler="on_treeview2_key_press_event" last_modification_time="Sun, 12 Jan 2003 16:11:44 GMT"/> |
@@ -582,7 +582,7 @@ | |||
582 | <property name="headers_visible">True</property> | 582 | <property name="headers_visible">True</property> |
583 | <property name="rules_hint">False</property> | 583 | <property name="rules_hint">False</property> |
584 | <property name="reorderable">False</property> | 584 | <property name="reorderable">False</property> |
585 | <property name="enable_search">True</property> | 585 | <property name="enable_search">False</property> |
586 | <signal name="cursor_changed" handler="on_treeview2_cursor_changed" last_modification_time="Sun, 12 Jan 2003 15:57:55 GMT"/> | 586 | <signal name="cursor_changed" handler="on_treeview2_cursor_changed" last_modification_time="Sun, 12 Jan 2003 15:57:55 GMT"/> |
587 | <signal name="button_press_event" handler="on_treeview2_button_press_event" last_modification_time="Sun, 12 Jan 2003 15:57:58 GMT"/> | 587 | <signal name="button_press_event" handler="on_treeview2_button_press_event" last_modification_time="Sun, 12 Jan 2003 15:57:58 GMT"/> |
588 | <signal name="key_press_event" handler="on_treeview2_key_press_event" last_modification_time="Sun, 12 Jan 2003 15:58:01 GMT"/> | 588 | <signal name="key_press_event" handler="on_treeview2_key_press_event" last_modification_time="Sun, 12 Jan 2003 15:58:01 GMT"/> |
diff --git a/scripts/kconfig/kxgettext.c b/scripts/kconfig/kxgettext.c index 8d9ce22b0fc5..dcc3fcc0cc9a 100644 --- a/scripts/kconfig/kxgettext.c +++ b/scripts/kconfig/kxgettext.c | |||
@@ -166,7 +166,7 @@ static int message__add(const char *msg, char *option, char *file, int lineno) | |||
166 | return rc; | 166 | return rc; |
167 | } | 167 | } |
168 | 168 | ||
169 | void menu_build_message_list(struct menu *menu) | 169 | static void menu_build_message_list(struct menu *menu) |
170 | { | 170 | { |
171 | struct menu *child; | 171 | struct menu *child; |
172 | 172 | ||
@@ -211,7 +211,7 @@ static void message__print_gettext_msgid_msgstr(struct message *self) | |||
211 | "msgstr \"\"\n", self->msg); | 211 | "msgstr \"\"\n", self->msg); |
212 | } | 212 | } |
213 | 213 | ||
214 | void menu__xgettext(void) | 214 | static void menu__xgettext(void) |
215 | { | 215 | { |
216 | struct message *m = message__list; | 216 | struct message *m = message__list; |
217 | 217 | ||
diff --git a/scripts/kconfig/lex.zconf.c_shipped b/scripts/kconfig/lex.zconf.c_shipped index dc3e81807d13..fdc7113b08d1 100644 --- a/scripts/kconfig/lex.zconf.c_shipped +++ b/scripts/kconfig/lex.zconf.c_shipped | |||
@@ -160,7 +160,15 @@ typedef unsigned int flex_uint32_t; | |||
160 | 160 | ||
161 | /* Size of default input buffer. */ | 161 | /* Size of default input buffer. */ |
162 | #ifndef YY_BUF_SIZE | 162 | #ifndef YY_BUF_SIZE |
163 | #ifdef __ia64__ | ||
164 | /* On IA-64, the buffer size is 16k, not 8k. | ||
165 | * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case. | ||
166 | * Ditto for the __ia64__ case accordingly. | ||
167 | */ | ||
168 | #define YY_BUF_SIZE 32768 | ||
169 | #else | ||
163 | #define YY_BUF_SIZE 16384 | 170 | #define YY_BUF_SIZE 16384 |
171 | #endif /* __ia64__ */ | ||
164 | #endif | 172 | #endif |
165 | 173 | ||
166 | /* The state buf must be large enough to hold one state per character in the main buffer. | 174 | /* The state buf must be large enough to hold one state per character in the main buffer. |
@@ -802,7 +810,7 @@ static int last_ts, first_ts; | |||
802 | static void zconf_endhelp(void); | 810 | static void zconf_endhelp(void); |
803 | static void zconf_endfile(void); | 811 | static void zconf_endfile(void); |
804 | 812 | ||
805 | void new_string(void) | 813 | static void new_string(void) |
806 | { | 814 | { |
807 | text = malloc(START_STRSIZE); | 815 | text = malloc(START_STRSIZE); |
808 | text_asize = START_STRSIZE; | 816 | text_asize = START_STRSIZE; |
@@ -810,7 +818,7 @@ void new_string(void) | |||
810 | *text = 0; | 818 | *text = 0; |
811 | } | 819 | } |
812 | 820 | ||
813 | void append_string(const char *str, int size) | 821 | static void append_string(const char *str, int size) |
814 | { | 822 | { |
815 | int new_size = text_size + size + 1; | 823 | int new_size = text_size + size + 1; |
816 | if (new_size > text_asize) { | 824 | if (new_size > text_asize) { |
@@ -824,7 +832,7 @@ void append_string(const char *str, int size) | |||
824 | text[text_size] = 0; | 832 | text[text_size] = 0; |
825 | } | 833 | } |
826 | 834 | ||
827 | void alloc_string(const char *str, int size) | 835 | static void alloc_string(const char *str, int size) |
828 | { | 836 | { |
829 | text = malloc(size + 1); | 837 | text = malloc(size + 1); |
830 | memcpy(text, str, size); | 838 | memcpy(text, str, size); |
@@ -914,7 +922,12 @@ static int input (void ); | |||
914 | 922 | ||
915 | /* Amount of stuff to slurp up with each read. */ | 923 | /* Amount of stuff to slurp up with each read. */ |
916 | #ifndef YY_READ_BUF_SIZE | 924 | #ifndef YY_READ_BUF_SIZE |
925 | #ifdef __ia64__ | ||
926 | /* On IA-64, the buffer size is 16k, not 8k */ | ||
927 | #define YY_READ_BUF_SIZE 16384 | ||
928 | #else | ||
917 | #define YY_READ_BUF_SIZE 8192 | 929 | #define YY_READ_BUF_SIZE 8192 |
930 | #endif /* __ia64__ */ | ||
918 | #endif | 931 | #endif |
919 | 932 | ||
920 | /* Copy whatever the last rule matched to the standard output. */ | 933 | /* Copy whatever the last rule matched to the standard output. */ |
@@ -922,7 +935,7 @@ static int input (void ); | |||
922 | /* This used to be an fputs(), but since the string might contain NUL's, | 935 | /* This used to be an fputs(), but since the string might contain NUL's, |
923 | * we now use fwrite(). | 936 | * we now use fwrite(). |
924 | */ | 937 | */ |
925 | #define ECHO fwrite( zconftext, zconfleng, 1, zconfout ) | 938 | #define ECHO do { if (fwrite( zconftext, zconfleng, 1, zconfout )) {} } while (0) |
926 | #endif | 939 | #endif |
927 | 940 | ||
928 | /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, | 941 | /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, |
@@ -2060,8 +2073,8 @@ YY_BUFFER_STATE zconf_scan_string (yyconst char * yystr ) | |||
2060 | 2073 | ||
2061 | /** Setup the input buffer state to scan the given bytes. The next call to zconflex() will | 2074 | /** Setup the input buffer state to scan the given bytes. The next call to zconflex() will |
2062 | * scan from a @e copy of @a bytes. | 2075 | * scan from a @e copy of @a bytes. |
2063 | * @param bytes the byte buffer to scan | 2076 | * @param yybytes the byte buffer to scan |
2064 | * @param len the number of bytes in the buffer pointed to by @a bytes. | 2077 | * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes. |
2065 | * | 2078 | * |
2066 | * @return the newly allocated buffer state object. | 2079 | * @return the newly allocated buffer state object. |
2067 | */ | 2080 | */ |
diff --git a/scripts/kconfig/lkc_proto.h b/scripts/kconfig/lkc_proto.h index 8e69461313d1..ffeb532b2cff 100644 --- a/scripts/kconfig/lkc_proto.h +++ b/scripts/kconfig/lkc_proto.h | |||
@@ -17,6 +17,8 @@ P(menu_get_root_menu,struct menu *,(struct menu *menu)); | |||
17 | P(menu_get_parent_menu,struct menu *,(struct menu *menu)); | 17 | P(menu_get_parent_menu,struct menu *,(struct menu *menu)); |
18 | P(menu_has_help,bool,(struct menu *menu)); | 18 | P(menu_has_help,bool,(struct menu *menu)); |
19 | P(menu_get_help,const char *,(struct menu *menu)); | 19 | P(menu_get_help,const char *,(struct menu *menu)); |
20 | P(get_symbol_str,void,(struct gstr *r, struct symbol *sym)); | ||
21 | P(menu_get_ext_help,void,(struct menu *menu, struct gstr *help)); | ||
20 | 22 | ||
21 | /* symbol.c */ | 23 | /* symbol.c */ |
22 | P(symbol_hash,struct symbol *,[SYMBOL_HASHSIZE]); | 24 | P(symbol_hash,struct symbol *,[SYMBOL_HASHSIZE]); |
diff --git a/scripts/kconfig/mconf.c b/scripts/kconfig/mconf.c index 25b60bc117f7..d82953573588 100644 --- a/scripts/kconfig/mconf.c +++ b/scripts/kconfig/mconf.c | |||
@@ -199,8 +199,6 @@ inputbox_instructions_string[] = N_( | |||
199 | setmod_text[] = N_( | 199 | setmod_text[] = N_( |
200 | "This feature depends on another which has been configured as a module.\n" | 200 | "This feature depends on another which has been configured as a module.\n" |
201 | "As a result, this feature will be built as a module."), | 201 | "As a result, this feature will be built as a module."), |
202 | nohelp_text[] = N_( | ||
203 | "There is no help available for this kernel option.\n"), | ||
204 | load_config_text[] = N_( | 202 | load_config_text[] = N_( |
205 | "Enter the name of the configuration file you wish to load. " | 203 | "Enter the name of the configuration file you wish to load. " |
206 | "Accept the name shown to restore the configuration you " | 204 | "Accept the name shown to restore the configuration you " |
@@ -284,66 +282,6 @@ static void show_textbox(const char *title, const char *text, int r, int c); | |||
284 | static void show_helptext(const char *title, const char *text); | 282 | static void show_helptext(const char *title, const char *text); |
285 | static void show_help(struct menu *menu); | 283 | static void show_help(struct menu *menu); |
286 | 284 | ||
287 | static void get_prompt_str(struct gstr *r, struct property *prop) | ||
288 | { | ||
289 | int i, j; | ||
290 | struct menu *submenu[8], *menu; | ||
291 | |||
292 | str_printf(r, _("Prompt: %s\n"), _(prop->text)); | ||
293 | str_printf(r, _(" Defined at %s:%d\n"), prop->menu->file->name, | ||
294 | prop->menu->lineno); | ||
295 | if (!expr_is_yes(prop->visible.expr)) { | ||
296 | str_append(r, _(" Depends on: ")); | ||
297 | expr_gstr_print(prop->visible.expr, r); | ||
298 | str_append(r, "\n"); | ||
299 | } | ||
300 | menu = prop->menu->parent; | ||
301 | for (i = 0; menu != &rootmenu && i < 8; menu = menu->parent) | ||
302 | submenu[i++] = menu; | ||
303 | if (i > 0) { | ||
304 | str_printf(r, _(" Location:\n")); | ||
305 | for (j = 4; --i >= 0; j += 2) { | ||
306 | menu = submenu[i]; | ||
307 | str_printf(r, "%*c-> %s", j, ' ', _(menu_get_prompt(menu))); | ||
308 | if (menu->sym) { | ||
309 | str_printf(r, " (%s [=%s])", menu->sym->name ? | ||
310 | menu->sym->name : _("<choice>"), | ||
311 | sym_get_string_value(menu->sym)); | ||
312 | } | ||
313 | str_append(r, "\n"); | ||
314 | } | ||
315 | } | ||
316 | } | ||
317 | |||
318 | static void get_symbol_str(struct gstr *r, struct symbol *sym) | ||
319 | { | ||
320 | bool hit; | ||
321 | struct property *prop; | ||
322 | |||
323 | if (sym && sym->name) | ||
324 | str_printf(r, "Symbol: %s [=%s]\n", sym->name, | ||
325 | sym_get_string_value(sym)); | ||
326 | for_all_prompts(sym, prop) | ||
327 | get_prompt_str(r, prop); | ||
328 | hit = false; | ||
329 | for_all_properties(sym, prop, P_SELECT) { | ||
330 | if (!hit) { | ||
331 | str_append(r, " Selects: "); | ||
332 | hit = true; | ||
333 | } else | ||
334 | str_printf(r, " && "); | ||
335 | expr_gstr_print(prop->expr, r); | ||
336 | } | ||
337 | if (hit) | ||
338 | str_append(r, "\n"); | ||
339 | if (sym->rev_dep.expr) { | ||
340 | str_append(r, _(" Selected by: ")); | ||
341 | expr_gstr_print(sym->rev_dep.expr, r); | ||
342 | str_append(r, "\n"); | ||
343 | } | ||
344 | str_append(r, "\n\n"); | ||
345 | } | ||
346 | |||
347 | static struct gstr get_relations_str(struct symbol **sym_arr) | 285 | static struct gstr get_relations_str(struct symbol **sym_arr) |
348 | { | 286 | { |
349 | struct symbol *sym; | 287 | struct symbol *sym; |
@@ -699,19 +637,9 @@ static void show_helptext(const char *title, const char *text) | |||
699 | static void show_help(struct menu *menu) | 637 | static void show_help(struct menu *menu) |
700 | { | 638 | { |
701 | struct gstr help = str_new(); | 639 | struct gstr help = str_new(); |
702 | struct symbol *sym = menu->sym; | 640 | |
703 | 641 | menu_get_ext_help(menu, &help); | |
704 | if (menu_has_help(menu)) | 642 | |
705 | { | ||
706 | if (sym->name) { | ||
707 | str_printf(&help, "CONFIG_%s:\n\n", sym->name); | ||
708 | str_append(&help, _(menu_get_help(menu))); | ||
709 | str_append(&help, "\n"); | ||
710 | } | ||
711 | } else { | ||
712 | str_append(&help, nohelp_text); | ||
713 | } | ||
714 | get_symbol_str(&help, sym); | ||
715 | show_helptext(_(menu_get_prompt(menu)), str_get(&help)); | 643 | show_helptext(_(menu_get_prompt(menu)), str_get(&help)); |
716 | str_free(&help); | 644 | str_free(&help); |
717 | } | 645 | } |
diff --git a/scripts/kconfig/menu.c b/scripts/kconfig/menu.c index 07ff8d105c9d..059a2465c574 100644 --- a/scripts/kconfig/menu.c +++ b/scripts/kconfig/menu.c | |||
@@ -9,6 +9,9 @@ | |||
9 | #define LKC_DIRECT_LINK | 9 | #define LKC_DIRECT_LINK |
10 | #include "lkc.h" | 10 | #include "lkc.h" |
11 | 11 | ||
12 | static const char nohelp_text[] = N_( | ||
13 | "There is no help available for this kernel option.\n"); | ||
14 | |||
12 | struct menu rootmenu; | 15 | struct menu rootmenu; |
13 | static struct menu **last_entry_ptr; | 16 | static struct menu **last_entry_ptr; |
14 | 17 | ||
@@ -74,7 +77,7 @@ void menu_end_menu(void) | |||
74 | current_menu = current_menu->parent; | 77 | current_menu = current_menu->parent; |
75 | } | 78 | } |
76 | 79 | ||
77 | struct expr *menu_check_dep(struct expr *e) | 80 | static struct expr *menu_check_dep(struct expr *e) |
78 | { | 81 | { |
79 | if (!e) | 82 | if (!e) |
80 | return e; | 83 | return e; |
@@ -184,7 +187,7 @@ static int menu_range_valid_sym(struct symbol *sym, struct symbol *sym2) | |||
184 | (sym2->type == S_UNKNOWN && sym_string_valid(sym, sym2->name)); | 187 | (sym2->type == S_UNKNOWN && sym_string_valid(sym, sym2->name)); |
185 | } | 188 | } |
186 | 189 | ||
187 | void sym_check_prop(struct symbol *sym) | 190 | static void sym_check_prop(struct symbol *sym) |
188 | { | 191 | { |
189 | struct property *prop; | 192 | struct property *prop; |
190 | struct symbol *sym2; | 193 | struct symbol *sym2; |
@@ -451,3 +454,80 @@ const char *menu_get_help(struct menu *menu) | |||
451 | else | 454 | else |
452 | return ""; | 455 | return ""; |
453 | } | 456 | } |
457 | |||
458 | static void get_prompt_str(struct gstr *r, struct property *prop) | ||
459 | { | ||
460 | int i, j; | ||
461 | struct menu *submenu[8], *menu; | ||
462 | |||
463 | str_printf(r, _("Prompt: %s\n"), _(prop->text)); | ||
464 | str_printf(r, _(" Defined at %s:%d\n"), prop->menu->file->name, | ||
465 | prop->menu->lineno); | ||
466 | if (!expr_is_yes(prop->visible.expr)) { | ||
467 | str_append(r, _(" Depends on: ")); | ||
468 | expr_gstr_print(prop->visible.expr, r); | ||
469 | str_append(r, "\n"); | ||
470 | } | ||
471 | menu = prop->menu->parent; | ||
472 | for (i = 0; menu != &rootmenu && i < 8; menu = menu->parent) | ||
473 | submenu[i++] = menu; | ||
474 | if (i > 0) { | ||
475 | str_printf(r, _(" Location:\n")); | ||
476 | for (j = 4; --i >= 0; j += 2) { | ||
477 | menu = submenu[i]; | ||
478 | str_printf(r, "%*c-> %s", j, ' ', _(menu_get_prompt(menu))); | ||
479 | if (menu->sym) { | ||
480 | str_printf(r, " (%s [=%s])", menu->sym->name ? | ||
481 | menu->sym->name : _("<choice>"), | ||
482 | sym_get_string_value(menu->sym)); | ||
483 | } | ||
484 | str_append(r, "\n"); | ||
485 | } | ||
486 | } | ||
487 | } | ||
488 | |||
489 | void get_symbol_str(struct gstr *r, struct symbol *sym) | ||
490 | { | ||
491 | bool hit; | ||
492 | struct property *prop; | ||
493 | |||
494 | if (sym && sym->name) | ||
495 | str_printf(r, "Symbol: %s [=%s]\n", sym->name, | ||
496 | sym_get_string_value(sym)); | ||
497 | for_all_prompts(sym, prop) | ||
498 | get_prompt_str(r, prop); | ||
499 | hit = false; | ||
500 | for_all_properties(sym, prop, P_SELECT) { | ||
501 | if (!hit) { | ||
502 | str_append(r, " Selects: "); | ||
503 | hit = true; | ||
504 | } else | ||
505 | str_printf(r, " && "); | ||
506 | expr_gstr_print(prop->expr, r); | ||
507 | } | ||
508 | if (hit) | ||
509 | str_append(r, "\n"); | ||
510 | if (sym->rev_dep.expr) { | ||
511 | str_append(r, _(" Selected by: ")); | ||
512 | expr_gstr_print(sym->rev_dep.expr, r); | ||
513 | str_append(r, "\n"); | ||
514 | } | ||
515 | str_append(r, "\n\n"); | ||
516 | } | ||
517 | |||
518 | void menu_get_ext_help(struct menu *menu, struct gstr *help) | ||
519 | { | ||
520 | struct symbol *sym = menu->sym; | ||
521 | |||
522 | if (menu_has_help(menu)) { | ||
523 | if (sym->name) { | ||
524 | str_printf(help, "CONFIG_%s:\n\n", sym->name); | ||
525 | str_append(help, _(menu_get_help(menu))); | ||
526 | str_append(help, "\n"); | ||
527 | } | ||
528 | } else { | ||
529 | str_append(help, nohelp_text); | ||
530 | } | ||
531 | if (sym) | ||
532 | get_symbol_str(help, sym); | ||
533 | } | ||
diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc index ce7d508c7520..00c51507cfcc 100644 --- a/scripts/kconfig/qconf.cc +++ b/scripts/kconfig/qconf.cc | |||
@@ -1042,12 +1042,10 @@ void ConfigInfoView::menuInfo(void) | |||
1042 | if (showDebug()) | 1042 | if (showDebug()) |
1043 | debug = debug_info(sym); | 1043 | debug = debug_info(sym); |
1044 | 1044 | ||
1045 | help = menu_get_help(menu); | 1045 | struct gstr help_gstr = str_new(); |
1046 | /* Gettextize if the help text not empty */ | 1046 | menu_get_ext_help(menu, &help_gstr); |
1047 | if (help.isEmpty()) | 1047 | help = print_filter(str_get(&help_gstr)); |
1048 | help = print_filter(menu_get_help(menu)); | 1048 | str_free(&help_gstr); |
1049 | else | ||
1050 | help = print_filter(_(menu_get_help(menu))); | ||
1051 | } else if (menu->prompt) { | 1049 | } else if (menu->prompt) { |
1052 | head += "<big><b>"; | 1050 | head += "<big><b>"; |
1053 | head += print_filter(_(menu->prompt->text)); | 1051 | head += print_filter(_(menu->prompt->text)); |
diff --git a/scripts/kconfig/streamline_config.pl b/scripts/kconfig/streamline_config.pl new file mode 100644 index 000000000000..0d800820c3cd --- /dev/null +++ b/scripts/kconfig/streamline_config.pl | |||
@@ -0,0 +1,366 @@ | |||
1 | #!/usr/bin/perl -w | ||
2 | # | ||
3 | # Copywrite 2005-2009 - Steven Rostedt | ||
4 | # Licensed under the terms of the GNU GPL License version 2 | ||
5 | # | ||
6 | # It's simple enough to figure out how this works. | ||
7 | # If not, then you can ask me at stripconfig@goodmis.org | ||
8 | # | ||
9 | # What it does? | ||
10 | # | ||
11 | # If you have installed a Linux kernel from a distribution | ||
12 | # that turns on way too many modules than you need, and | ||
13 | # you only want the modules you use, then this program | ||
14 | # is perfect for you. | ||
15 | # | ||
16 | # It gives you the ability to turn off all the modules that are | ||
17 | # not loaded on your system. | ||
18 | # | ||
19 | # Howto: | ||
20 | # | ||
21 | # 1. Boot up the kernel that you want to stream line the config on. | ||
22 | # 2. Change directory to the directory holding the source of the | ||
23 | # kernel that you just booted. | ||
24 | # 3. Copy the configuraton file to this directory as .config | ||
25 | # 4. Have all your devices that you need modules for connected and | ||
26 | # operational (make sure that their corresponding modules are loaded) | ||
27 | # 5. Run this script redirecting the output to some other file | ||
28 | # like config_strip. | ||
29 | # 6. Back up your old config (if you want too). | ||
30 | # 7. copy the config_strip file to .config | ||
31 | # 8. Run "make oldconfig" | ||
32 | # | ||
33 | # Now your kernel is ready to be built with only the modules that | ||
34 | # are loaded. | ||
35 | # | ||
36 | # Here's what I did with my Debian distribution. | ||
37 | # | ||
38 | # cd /usr/src/linux-2.6.10 | ||
39 | # cp /boot/config-2.6.10-1-686-smp .config | ||
40 | # ~/bin/streamline_config > config_strip | ||
41 | # mv .config config_sav | ||
42 | # mv config_strip .config | ||
43 | # make oldconfig | ||
44 | # | ||
45 | my $config = ".config"; | ||
46 | |||
47 | my $uname = `uname -r`; | ||
48 | chomp $uname; | ||
49 | |||
50 | my @searchconfigs = ( | ||
51 | { | ||
52 | "file" => ".config", | ||
53 | "exec" => "cat", | ||
54 | }, | ||
55 | { | ||
56 | "file" => "/proc/config.gz", | ||
57 | "exec" => "zcat", | ||
58 | }, | ||
59 | { | ||
60 | "file" => "/boot/config-$uname", | ||
61 | "exec" => "cat", | ||
62 | }, | ||
63 | { | ||
64 | "file" => "/boot/vmlinuz-$uname", | ||
65 | "exec" => "scripts/extract-ikconfig", | ||
66 | "test" => "scripts/extract-ikconfig", | ||
67 | }, | ||
68 | { | ||
69 | "file" => "vmlinux", | ||
70 | "exec" => "scripts/extract-ikconfig", | ||
71 | "test" => "scripts/extract-ikconfig", | ||
72 | }, | ||
73 | { | ||
74 | "file" => "/lib/modules/$uname/kernel/kernel/configs.ko", | ||
75 | "exec" => "scripts/extract-ikconfig", | ||
76 | "test" => "scripts/extract-ikconfig", | ||
77 | }, | ||
78 | { | ||
79 | "file" => "kernel/configs.ko", | ||
80 | "exec" => "scripts/extract-ikconfig", | ||
81 | "test" => "scripts/extract-ikconfig", | ||
82 | }, | ||
83 | { | ||
84 | "file" => "kernel/configs.o", | ||
85 | "exec" => "scripts/extract-ikconfig", | ||
86 | "test" => "scripts/extract-ikconfig", | ||
87 | }, | ||
88 | ); | ||
89 | |||
90 | sub find_config { | ||
91 | foreach my $conf (@searchconfigs) { | ||
92 | my $file = $conf->{"file"}; | ||
93 | |||
94 | next if ( ! -f "$file"); | ||
95 | |||
96 | if (defined($conf->{"test"})) { | ||
97 | `$conf->{"test"} $conf->{"file"} 2>/dev/null`; | ||
98 | next if ($?); | ||
99 | } | ||
100 | |||
101 | my $exec = $conf->{"exec"}; | ||
102 | |||
103 | print STDERR "using config: '$file'\n"; | ||
104 | |||
105 | open(CIN, "$exec $file |") || die "Failed to run $exec $file"; | ||
106 | return; | ||
107 | } | ||
108 | die "No config file found"; | ||
109 | } | ||
110 | |||
111 | find_config; | ||
112 | |||
113 | # Get the build source and top level Kconfig file (passed in) | ||
114 | my $ksource = $ARGV[0]; | ||
115 | my $kconfig = $ARGV[1]; | ||
116 | |||
117 | my @makefiles = `find $ksource -name Makefile`; | ||
118 | my %depends; | ||
119 | my %selects; | ||
120 | my %prompts; | ||
121 | my %objects; | ||
122 | my $var; | ||
123 | my $cont = 0; | ||
124 | |||
125 | # prevent recursion | ||
126 | my %read_kconfigs; | ||
127 | |||
128 | sub read_kconfig { | ||
129 | my ($kconfig) = @_; | ||
130 | |||
131 | my $state = "NONE"; | ||
132 | my $config; | ||
133 | my @kconfigs; | ||
134 | |||
135 | open(KIN, "$ksource/$kconfig") || die "Can't open $kconfig"; | ||
136 | while (<KIN>) { | ||
137 | chomp; | ||
138 | |||
139 | # collect any Kconfig sources | ||
140 | if (/^source\s*"(.*)"/) { | ||
141 | $kconfigs[$#kconfigs+1] = $1; | ||
142 | } | ||
143 | |||
144 | # configs found | ||
145 | if (/^\s*config\s+(\S+)\s*$/) { | ||
146 | $state = "NEW"; | ||
147 | $config = $1; | ||
148 | |||
149 | # collect the depends for the config | ||
150 | } elsif ($state eq "NEW" && /^\s*depends\s+on\s+(.*)$/) { | ||
151 | $state = "DEP"; | ||
152 | $depends{$config} = $1; | ||
153 | } elsif ($state eq "DEP" && /^\s*depends\s+on\s+(.*)$/) { | ||
154 | $depends{$config} .= " " . $1; | ||
155 | |||
156 | # Get the configs that select this config | ||
157 | } elsif ($state ne "NONE" && /^\s*select\s+(\S+)/) { | ||
158 | if (defined($selects{$1})) { | ||
159 | $selects{$1} .= " " . $config; | ||
160 | } else { | ||
161 | $selects{$1} = $config; | ||
162 | } | ||
163 | |||
164 | # configs without prompts must be selected | ||
165 | } elsif ($state ne "NONE" && /^\s*tristate\s\S/) { | ||
166 | # note if the config has a prompt | ||
167 | $prompt{$config} = 1; | ||
168 | |||
169 | # stop on "help" | ||
170 | } elsif (/^\s*help\s*$/) { | ||
171 | $state = "NONE"; | ||
172 | } | ||
173 | } | ||
174 | close(KIN); | ||
175 | |||
176 | # read in any configs that were found. | ||
177 | foreach $kconfig (@kconfigs) { | ||
178 | if (!defined($read_kconfigs{$kconfig})) { | ||
179 | $read_kconfigs{$kconfig} = 1; | ||
180 | read_kconfig($kconfig); | ||
181 | } | ||
182 | } | ||
183 | } | ||
184 | |||
185 | if ($kconfig) { | ||
186 | read_kconfig($kconfig); | ||
187 | } | ||
188 | |||
189 | # Read all Makefiles to map the configs to the objects | ||
190 | foreach my $makefile (@makefiles) { | ||
191 | chomp $makefile; | ||
192 | |||
193 | open(MIN,$makefile) || die "Can't open $makefile"; | ||
194 | while (<MIN>) { | ||
195 | my $objs; | ||
196 | |||
197 | # is this a line after a line with a backslash? | ||
198 | if ($cont && /(\S.*)$/) { | ||
199 | $objs = $1; | ||
200 | } | ||
201 | $cont = 0; | ||
202 | |||
203 | # collect objects after obj-$(CONFIG_FOO_BAR) | ||
204 | if (/obj-\$\((CONFIG_[^\)]*)\)\s*[+:]?=\s*(.*)/) { | ||
205 | $var = $1; | ||
206 | $objs = $2; | ||
207 | } | ||
208 | if (defined($objs)) { | ||
209 | # test if the line ends with a backslash | ||
210 | if ($objs =~ m,(.*)\\$,) { | ||
211 | $objs = $1; | ||
212 | $cont = 1; | ||
213 | } | ||
214 | |||
215 | foreach my $obj (split /\s+/,$objs) { | ||
216 | $obj =~ s/-/_/g; | ||
217 | if ($obj =~ /(.*)\.o$/) { | ||
218 | # Objects may bes enabled by more than one config. | ||
219 | # Store configs in an array. | ||
220 | my @arr; | ||
221 | |||
222 | if (defined($objects{$1})) { | ||
223 | @arr = @{$objects{$1}}; | ||
224 | } | ||
225 | |||
226 | $arr[$#arr+1] = $var; | ||
227 | |||
228 | # The objects have a hash mapping to a reference | ||
229 | # of an array of configs. | ||
230 | $objects{$1} = \@arr; | ||
231 | } | ||
232 | } | ||
233 | } | ||
234 | } | ||
235 | close(MIN); | ||
236 | } | ||
237 | |||
238 | my %modules; | ||
239 | |||
240 | # see what modules are loaded on this system | ||
241 | open(LIN,"/sbin/lsmod|") || die "Cant lsmod"; | ||
242 | while (<LIN>) { | ||
243 | next if (/^Module/); # Skip the first line. | ||
244 | if (/^(\S+)/) { | ||
245 | $modules{$1} = 1; | ||
246 | } | ||
247 | } | ||
248 | close (LIN); | ||
249 | |||
250 | # add to the configs hash all configs that are needed to enable | ||
251 | # a loaded module. | ||
252 | my %configs; | ||
253 | foreach my $module (keys(%modules)) { | ||
254 | if (defined($objects{$module})) { | ||
255 | @arr = @{$objects{$module}}; | ||
256 | foreach my $conf (@arr) { | ||
257 | $configs{$conf} = $module; | ||
258 | } | ||
259 | } else { | ||
260 | # Most likely, someone has a custom (binary?) module loaded. | ||
261 | print STDERR "$module config not found!!\n"; | ||
262 | } | ||
263 | } | ||
264 | |||
265 | my $valid = "A-Za-z_0-9"; | ||
266 | my $repeat = 1; | ||
267 | |||
268 | # | ||
269 | # Note, we do not care about operands (like: &&, ||, !) we want to add any | ||
270 | # config that is in the depend list of another config. This script does | ||
271 | # not enable configs that are not already enabled. If we come across a | ||
272 | # config A that depends on !B, we can still add B to the list of depends | ||
273 | # to keep on. If A was on in the original config, B would not have been | ||
274 | # and B would not be turned on by this script. | ||
275 | # | ||
276 | sub parse_config_dep_select | ||
277 | { | ||
278 | my ($p) = @_; | ||
279 | |||
280 | while ($p =~ /[$valid]/) { | ||
281 | |||
282 | if ($p =~ /^[^$valid]*([$valid]+)/) { | ||
283 | my $conf = "CONFIG_" . $1; | ||
284 | |||
285 | $p =~ s/^[^$valid]*[$valid]+//; | ||
286 | |||
287 | if (!defined($configs{$conf})) { | ||
288 | # We must make sure that this config has its | ||
289 | # dependencies met. | ||
290 | $repeat = 1; # do again | ||
291 | $configs{$conf} = 1; | ||
292 | } | ||
293 | } else { | ||
294 | die "this should never happen"; | ||
295 | } | ||
296 | } | ||
297 | } | ||
298 | |||
299 | while ($repeat) { | ||
300 | $repeat = 0; | ||
301 | |||
302 | foreach my $config (keys %configs) { | ||
303 | $config =~ s/^CONFIG_//; | ||
304 | |||
305 | if (defined($depends{$config})) { | ||
306 | # This config has dependencies. Make sure they are also included | ||
307 | parse_config_dep_select $depends{$config}; | ||
308 | } | ||
309 | |||
310 | if (defined($prompt{$config}) || !defined($selects{$config})) { | ||
311 | next; | ||
312 | } | ||
313 | |||
314 | # config has no prompt and must be selected. | ||
315 | parse_config_dep_select $selects{$config}; | ||
316 | } | ||
317 | } | ||
318 | |||
319 | my %setconfigs; | ||
320 | |||
321 | # Finally, read the .config file and turn off any module enabled that | ||
322 | # we could not find a reason to keep enabled. | ||
323 | while(<CIN>) { | ||
324 | |||
325 | if (/CONFIG_IKCONFIG/) { | ||
326 | if (/# CONFIG_IKCONFIG is not set/) { | ||
327 | # enable IKCONFIG at least as a module | ||
328 | print "CONFIG_IKCONFIG=m\n"; | ||
329 | # don't ask about PROC | ||
330 | print "# CONFIG_IKCONFIG_PROC is not set\n"; | ||
331 | } else { | ||
332 | print; | ||
333 | } | ||
334 | next; | ||
335 | } | ||
336 | |||
337 | if (/^(CONFIG.*)=(m|y)/) { | ||
338 | if (defined($configs{$1})) { | ||
339 | $setconfigs{$1} = $2; | ||
340 | } elsif ($2 eq "m") { | ||
341 | print "# $1 is not set\n"; | ||
342 | next; | ||
343 | } | ||
344 | } | ||
345 | print; | ||
346 | } | ||
347 | close(CIN); | ||
348 | |||
349 | # Integrity check, make sure all modules that we want enabled do | ||
350 | # indeed have their configs set. | ||
351 | loop: | ||
352 | foreach my $module (keys(%modules)) { | ||
353 | if (defined($objects{$module})) { | ||
354 | my @arr = @{$objects{$module}}; | ||
355 | foreach my $conf (@arr) { | ||
356 | if (defined($setconfigs{$conf})) { | ||
357 | next loop; | ||
358 | } | ||
359 | } | ||
360 | print STDERR "module $module did not have configs"; | ||
361 | foreach my $conf (@arr) { | ||
362 | print STDERR " " , $conf; | ||
363 | } | ||
364 | print STDERR "\n"; | ||
365 | } | ||
366 | } | ||
diff --git a/scripts/kconfig/symbol.c b/scripts/kconfig/symbol.c index 18f3e5c33634..6c8fbbb66ebc 100644 --- a/scripts/kconfig/symbol.c +++ b/scripts/kconfig/symbol.c | |||
@@ -36,7 +36,7 @@ tristate modules_val; | |||
36 | 36 | ||
37 | struct expr *sym_env_list; | 37 | struct expr *sym_env_list; |
38 | 38 | ||
39 | void sym_add_default(struct symbol *sym, const char *def) | 39 | static void sym_add_default(struct symbol *sym, const char *def) |
40 | { | 40 | { |
41 | struct property *prop = prop_alloc(P_DEFAULT, sym); | 41 | struct property *prop = prop_alloc(P_DEFAULT, sym); |
42 | 42 | ||
@@ -125,7 +125,7 @@ struct property *sym_get_default_prop(struct symbol *sym) | |||
125 | return NULL; | 125 | return NULL; |
126 | } | 126 | } |
127 | 127 | ||
128 | struct property *sym_get_range_prop(struct symbol *sym) | 128 | static struct property *sym_get_range_prop(struct symbol *sym) |
129 | { | 129 | { |
130 | struct property *prop; | 130 | struct property *prop; |
131 | 131 | ||
@@ -943,7 +943,7 @@ const char *prop_get_type_name(enum prop_type type) | |||
943 | return "unknown"; | 943 | return "unknown"; |
944 | } | 944 | } |
945 | 945 | ||
946 | void prop_add_env(const char *env) | 946 | static void prop_add_env(const char *env) |
947 | { | 947 | { |
948 | struct symbol *sym, *sym2; | 948 | struct symbol *sym, *sym2; |
949 | struct property *prop; | 949 | struct property *prop; |
diff --git a/scripts/kconfig/zconf.gperf b/scripts/kconfig/zconf.gperf index 25ef5d01c0af..d8bc74249622 100644 --- a/scripts/kconfig/zconf.gperf +++ b/scripts/kconfig/zconf.gperf | |||
@@ -9,6 +9,8 @@ | |||
9 | 9 | ||
10 | struct kconf_id; | 10 | struct kconf_id; |
11 | 11 | ||
12 | static struct kconf_id *kconf_id_lookup(register const char *str, register unsigned int len); | ||
13 | |||
12 | %% | 14 | %% |
13 | mainmenu, T_MAINMENU, TF_COMMAND | 15 | mainmenu, T_MAINMENU, TF_COMMAND |
14 | menu, T_MENU, TF_COMMAND | 16 | menu, T_MENU, TF_COMMAND |
diff --git a/scripts/kconfig/zconf.hash.c_shipped b/scripts/kconfig/zconf.hash.c_shipped index 5c73d51339d8..c1748faf4634 100644 --- a/scripts/kconfig/zconf.hash.c_shipped +++ b/scripts/kconfig/zconf.hash.c_shipped | |||
@@ -30,6 +30,8 @@ | |||
30 | #endif | 30 | #endif |
31 | 31 | ||
32 | struct kconf_id; | 32 | struct kconf_id; |
33 | |||
34 | static struct kconf_id *kconf_id_lookup(register const char *str, register unsigned int len); | ||
33 | /* maximum key range = 47, duplicates = 0 */ | 35 | /* maximum key range = 47, duplicates = 0 */ |
34 | 36 | ||
35 | #ifdef __GNUC__ | 37 | #ifdef __GNUC__ |
diff --git a/scripts/kconfig/zconf.l b/scripts/kconfig/zconf.l index 21ff69c9ad4e..d8f7236cb0a3 100644 --- a/scripts/kconfig/zconf.l +++ b/scripts/kconfig/zconf.l | |||
@@ -39,7 +39,7 @@ static int last_ts, first_ts; | |||
39 | static void zconf_endhelp(void); | 39 | static void zconf_endhelp(void); |
40 | static void zconf_endfile(void); | 40 | static void zconf_endfile(void); |
41 | 41 | ||
42 | void new_string(void) | 42 | static void new_string(void) |
43 | { | 43 | { |
44 | text = malloc(START_STRSIZE); | 44 | text = malloc(START_STRSIZE); |
45 | text_asize = START_STRSIZE; | 45 | text_asize = START_STRSIZE; |
@@ -47,7 +47,7 @@ void new_string(void) | |||
47 | *text = 0; | 47 | *text = 0; |
48 | } | 48 | } |
49 | 49 | ||
50 | void append_string(const char *str, int size) | 50 | static void append_string(const char *str, int size) |
51 | { | 51 | { |
52 | int new_size = text_size + size + 1; | 52 | int new_size = text_size + size + 1; |
53 | if (new_size > text_asize) { | 53 | if (new_size > text_asize) { |
@@ -61,7 +61,7 @@ void append_string(const char *str, int size) | |||
61 | text[text_size] = 0; | 61 | text[text_size] = 0; |
62 | } | 62 | } |
63 | 63 | ||
64 | void alloc_string(const char *str, int size) | 64 | static void alloc_string(const char *str, int size) |
65 | { | 65 | { |
66 | text = malloc(size + 1); | 66 | text = malloc(size + 1); |
67 | memcpy(text, str, size); | 67 | memcpy(text, str, size); |
diff --git a/scripts/kconfig/zconf.tab.c_shipped b/scripts/kconfig/zconf.tab.c_shipped index 95df833b5a9d..6e9dcd59aa87 100644 --- a/scripts/kconfig/zconf.tab.c_shipped +++ b/scripts/kconfig/zconf.tab.c_shipped | |||
@@ -1,24 +1,23 @@ | |||
1 | /* A Bison parser, made by GNU Bison 2.3. */ | ||
2 | 1 | ||
3 | /* Skeleton implementation for Bison's Yacc-like parsers in C | 2 | /* A Bison parser, made by GNU Bison 2.4.1. */ |
4 | 3 | ||
5 | Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 | 4 | /* Skeleton implementation for Bison's Yacc-like parsers in C |
5 | |||
6 | Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 | ||
6 | Free Software Foundation, Inc. | 7 | Free Software Foundation, Inc. |
7 | 8 | ||
8 | This program is free software; you can redistribute it and/or modify | 9 | 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 | it under the terms of the GNU General Public License as published by |
10 | the Free Software Foundation; either version 2, or (at your option) | 11 | the Free Software Foundation, either version 3 of the License, or |
11 | any later version. | 12 | (at your option) any later version. |
12 | 13 | ||
13 | This program is distributed in the hope that it will be useful, | 14 | This program is distributed in the hope that it will be useful, |
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 | GNU General Public License for more details. | 17 | GNU General Public License for more details. |
17 | 18 | ||
18 | You should have received a copy of the GNU General Public License | 19 | 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 | along with this program. If not, see <http://www.gnu.org/licenses/>. */ |
20 | Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
21 | Boston, MA 02110-1301, USA. */ | ||
22 | 21 | ||
23 | /* As a special exception, you may create a larger work that contains | 22 | /* As a special exception, you may create a larger work that contains |
24 | part or all of the Bison parser skeleton and distribute that work | 23 | part or all of the Bison parser skeleton and distribute that work |
@@ -29,7 +28,7 @@ | |||
29 | special exception, which will cause the skeleton and the resulting | 28 | special exception, which will cause the skeleton and the resulting |
30 | Bison output files to be licensed under the GNU General Public | 29 | Bison output files to be licensed under the GNU General Public |
31 | License without this special exception. | 30 | License without this special exception. |
32 | 31 | ||
33 | This special exception was added by the Free Software Foundation in | 32 | This special exception was added by the Free Software Foundation in |
34 | version 2.2 of Bison. */ | 33 | version 2.2 of Bison. */ |
35 | 34 | ||
@@ -47,7 +46,7 @@ | |||
47 | #define YYBISON 1 | 46 | #define YYBISON 1 |
48 | 47 | ||
49 | /* Bison version. */ | 48 | /* Bison version. */ |
50 | #define YYBISON_VERSION "2.3" | 49 | #define YYBISON_VERSION "2.4.1" |
51 | 50 | ||
52 | /* Skeleton name. */ | 51 | /* Skeleton name. */ |
53 | #define YYSKELETON_NAME "yacc.c" | 52 | #define YYSKELETON_NAME "yacc.c" |
@@ -55,94 +54,23 @@ | |||
55 | /* Pure parsers. */ | 54 | /* Pure parsers. */ |
56 | #define YYPURE 0 | 55 | #define YYPURE 0 |
57 | 56 | ||
57 | /* Push parsers. */ | ||
58 | #define YYPUSH 0 | ||
59 | |||
60 | /* Pull parsers. */ | ||
61 | #define YYPULL 1 | ||
62 | |||
58 | /* Using locations. */ | 63 | /* Using locations. */ |
59 | #define YYLSP_NEEDED 0 | 64 | #define YYLSP_NEEDED 0 |
60 | 65 | ||
61 | /* Substitute the variable and function names. */ | 66 | /* Substitute the variable and function names. */ |
62 | #define yyparse zconfparse | 67 | #define yyparse zconfparse |
63 | #define yylex zconflex | 68 | #define yylex zconflex |
64 | #define yyerror zconferror | 69 | #define yyerror zconferror |
65 | #define yylval zconflval | 70 | #define yylval zconflval |
66 | #define yychar zconfchar | 71 | #define yychar zconfchar |
67 | #define yydebug zconfdebug | 72 | #define yydebug zconfdebug |
68 | #define yynerrs zconfnerrs | 73 | #define yynerrs zconfnerrs |
69 | |||
70 | |||
71 | /* Tokens. */ | ||
72 | #ifndef YYTOKENTYPE | ||
73 | # define YYTOKENTYPE | ||
74 | /* Put the tokens into the symbol table, so that GDB and other debuggers | ||
75 | know about them. */ | ||
76 | enum yytokentype { | ||
77 | T_MAINMENU = 258, | ||
78 | T_MENU = 259, | ||
79 | T_ENDMENU = 260, | ||
80 | T_SOURCE = 261, | ||
81 | T_CHOICE = 262, | ||
82 | T_ENDCHOICE = 263, | ||
83 | T_COMMENT = 264, | ||
84 | T_CONFIG = 265, | ||
85 | T_MENUCONFIG = 266, | ||
86 | T_HELP = 267, | ||
87 | T_HELPTEXT = 268, | ||
88 | T_IF = 269, | ||
89 | T_ENDIF = 270, | ||
90 | T_DEPENDS = 271, | ||
91 | T_OPTIONAL = 272, | ||
92 | T_PROMPT = 273, | ||
93 | T_TYPE = 274, | ||
94 | T_DEFAULT = 275, | ||
95 | T_SELECT = 276, | ||
96 | T_RANGE = 277, | ||
97 | T_OPTION = 278, | ||
98 | T_ON = 279, | ||
99 | T_WORD = 280, | ||
100 | T_WORD_QUOTE = 281, | ||
101 | T_UNEQUAL = 282, | ||
102 | T_CLOSE_PAREN = 283, | ||
103 | T_OPEN_PAREN = 284, | ||
104 | T_EOL = 285, | ||
105 | T_OR = 286, | ||
106 | T_AND = 287, | ||
107 | T_EQUAL = 288, | ||
108 | T_NOT = 289 | ||
109 | }; | ||
110 | #endif | ||
111 | /* Tokens. */ | ||
112 | #define T_MAINMENU 258 | ||
113 | #define T_MENU 259 | ||
114 | #define T_ENDMENU 260 | ||
115 | #define T_SOURCE 261 | ||
116 | #define T_CHOICE 262 | ||
117 | #define T_ENDCHOICE 263 | ||
118 | #define T_COMMENT 264 | ||
119 | #define T_CONFIG 265 | ||
120 | #define T_MENUCONFIG 266 | ||
121 | #define T_HELP 267 | ||
122 | #define T_HELPTEXT 268 | ||
123 | #define T_IF 269 | ||
124 | #define T_ENDIF 270 | ||
125 | #define T_DEPENDS 271 | ||
126 | #define T_OPTIONAL 272 | ||
127 | #define T_PROMPT 273 | ||
128 | #define T_TYPE 274 | ||
129 | #define T_DEFAULT 275 | ||
130 | #define T_SELECT 276 | ||
131 | #define T_RANGE 277 | ||
132 | #define T_OPTION 278 | ||
133 | #define T_ON 279 | ||
134 | #define T_WORD 280 | ||
135 | #define T_WORD_QUOTE 281 | ||
136 | #define T_UNEQUAL 282 | ||
137 | #define T_CLOSE_PAREN 283 | ||
138 | #define T_OPEN_PAREN 284 | ||
139 | #define T_EOL 285 | ||
140 | #define T_OR 286 | ||
141 | #define T_AND 287 | ||
142 | #define T_EQUAL 288 | ||
143 | #define T_NOT 289 | ||
144 | |||
145 | |||
146 | 74 | ||
147 | 75 | ||
148 | /* Copy the first part of user declarations. */ | 76 | /* Copy the first part of user declarations. */ |
@@ -163,8 +91,6 @@ | |||
163 | #define LKC_DIRECT_LINK | 91 | #define LKC_DIRECT_LINK |
164 | #include "lkc.h" | 92 | #include "lkc.h" |
165 | 93 | ||
166 | #include "zconf.hash.c" | ||
167 | |||
168 | #define printd(mask, fmt...) if (cdebug & (mask)) printf(fmt) | 94 | #define printd(mask, fmt...) if (cdebug & (mask)) printf(fmt) |
169 | 95 | ||
170 | #define PRINTD 0x0001 | 96 | #define PRINTD 0x0001 |
@@ -188,6 +114,7 @@ static struct menu *current_menu, *current_entry; | |||
188 | #endif | 114 | #endif |
189 | 115 | ||
190 | 116 | ||
117 | |||
191 | /* Enabling traces. */ | 118 | /* Enabling traces. */ |
192 | #ifndef YYDEBUG | 119 | #ifndef YYDEBUG |
193 | # define YYDEBUG 0 | 120 | # define YYDEBUG 0 |
@@ -206,31 +133,77 @@ static struct menu *current_menu, *current_entry; | |||
206 | # define YYTOKEN_TABLE 0 | 133 | # define YYTOKEN_TABLE 0 |
207 | #endif | 134 | #endif |
208 | 135 | ||
136 | |||
137 | /* Tokens. */ | ||
138 | #ifndef YYTOKENTYPE | ||
139 | # define YYTOKENTYPE | ||
140 | /* Put the tokens into the symbol table, so that GDB and other debuggers | ||
141 | know about them. */ | ||
142 | enum yytokentype { | ||
143 | T_MAINMENU = 258, | ||
144 | T_MENU = 259, | ||
145 | T_ENDMENU = 260, | ||
146 | T_SOURCE = 261, | ||
147 | T_CHOICE = 262, | ||
148 | T_ENDCHOICE = 263, | ||
149 | T_COMMENT = 264, | ||
150 | T_CONFIG = 265, | ||
151 | T_MENUCONFIG = 266, | ||
152 | T_HELP = 267, | ||
153 | T_HELPTEXT = 268, | ||
154 | T_IF = 269, | ||
155 | T_ENDIF = 270, | ||
156 | T_DEPENDS = 271, | ||
157 | T_OPTIONAL = 272, | ||
158 | T_PROMPT = 273, | ||
159 | T_TYPE = 274, | ||
160 | T_DEFAULT = 275, | ||
161 | T_SELECT = 276, | ||
162 | T_RANGE = 277, | ||
163 | T_OPTION = 278, | ||
164 | T_ON = 279, | ||
165 | T_WORD = 280, | ||
166 | T_WORD_QUOTE = 281, | ||
167 | T_UNEQUAL = 282, | ||
168 | T_CLOSE_PAREN = 283, | ||
169 | T_OPEN_PAREN = 284, | ||
170 | T_EOL = 285, | ||
171 | T_OR = 286, | ||
172 | T_AND = 287, | ||
173 | T_EQUAL = 288, | ||
174 | T_NOT = 289 | ||
175 | }; | ||
176 | #endif | ||
177 | |||
178 | |||
179 | |||
209 | #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED | 180 | #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED |
210 | typedef union YYSTYPE | 181 | typedef union YYSTYPE |
211 | |||
212 | { | 182 | { |
183 | |||
184 | |||
213 | char *string; | 185 | char *string; |
214 | struct file *file; | 186 | struct file *file; |
215 | struct symbol *symbol; | 187 | struct symbol *symbol; |
216 | struct expr *expr; | 188 | struct expr *expr; |
217 | struct menu *menu; | 189 | struct menu *menu; |
218 | struct kconf_id *id; | 190 | struct kconf_id *id; |
219 | } | ||
220 | /* Line 187 of yacc.c. */ | ||
221 | 191 | ||
222 | YYSTYPE; | 192 | |
193 | |||
194 | } YYSTYPE; | ||
195 | # define YYSTYPE_IS_TRIVIAL 1 | ||
223 | # define yystype YYSTYPE /* obsolescent; will be withdrawn */ | 196 | # define yystype YYSTYPE /* obsolescent; will be withdrawn */ |
224 | # define YYSTYPE_IS_DECLARED 1 | 197 | # define YYSTYPE_IS_DECLARED 1 |
225 | # define YYSTYPE_IS_TRIVIAL 1 | ||
226 | #endif | 198 | #endif |
227 | 199 | ||
228 | 200 | ||
229 | |||
230 | /* Copy the second part of user declarations. */ | 201 | /* Copy the second part of user declarations. */ |
231 | 202 | ||
232 | 203 | ||
233 | /* Line 216 of yacc.c. */ | 204 | /* Include zconf.hash.c here so it can see the token constants. */ |
205 | #include "zconf.hash.c" | ||
206 | |||
234 | 207 | ||
235 | 208 | ||
236 | #ifdef short | 209 | #ifdef short |
@@ -306,14 +279,14 @@ typedef short int yytype_int16; | |||
306 | #if (defined __STDC__ || defined __C99__FUNC__ \ | 279 | #if (defined __STDC__ || defined __C99__FUNC__ \ |
307 | || defined __cplusplus || defined _MSC_VER) | 280 | || defined __cplusplus || defined _MSC_VER) |
308 | static int | 281 | static int |
309 | YYID (int i) | 282 | YYID (int yyi) |
310 | #else | 283 | #else |
311 | static int | 284 | static int |
312 | YYID (i) | 285 | YYID (yyi) |
313 | int i; | 286 | int yyi; |
314 | #endif | 287 | #endif |
315 | { | 288 | { |
316 | return i; | 289 | return yyi; |
317 | } | 290 | } |
318 | #endif | 291 | #endif |
319 | 292 | ||
@@ -394,9 +367,9 @@ void free (void *); /* INFRINGES ON USER NAME SPACE */ | |||
394 | /* A type that is properly aligned for any stack member. */ | 367 | /* A type that is properly aligned for any stack member. */ |
395 | union yyalloc | 368 | union yyalloc |
396 | { | 369 | { |
397 | yytype_int16 yyss; | 370 | yytype_int16 yyss_alloc; |
398 | YYSTYPE yyvs; | 371 | YYSTYPE yyvs_alloc; |
399 | }; | 372 | }; |
400 | 373 | ||
401 | /* The size of the maximum gap between one aligned stack and the next. */ | 374 | /* The size of the maximum gap between one aligned stack and the next. */ |
402 | # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) | 375 | # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) |
@@ -430,12 +403,12 @@ union yyalloc | |||
430 | elements in the stack, and YYPTR gives the new location of the | 403 | elements in the stack, and YYPTR gives the new location of the |
431 | stack. Advance YYPTR to a properly aligned location for the next | 404 | stack. Advance YYPTR to a properly aligned location for the next |
432 | stack. */ | 405 | stack. */ |
433 | # define YYSTACK_RELOCATE(Stack) \ | 406 | # define YYSTACK_RELOCATE(Stack_alloc, Stack) \ |
434 | do \ | 407 | do \ |
435 | { \ | 408 | { \ |
436 | YYSIZE_T yynewbytes; \ | 409 | YYSIZE_T yynewbytes; \ |
437 | YYCOPY (&yyptr->Stack, Stack, yysize); \ | 410 | YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ |
438 | Stack = &yyptr->Stack; \ | 411 | Stack = &yyptr->Stack_alloc; \ |
439 | yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ | 412 | yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ |
440 | yyptr += yynewbytes / sizeof (*yyptr); \ | 413 | yyptr += yynewbytes / sizeof (*yyptr); \ |
441 | } \ | 414 | } \ |
@@ -558,18 +531,18 @@ static const yytype_int8 yyrhs[] = | |||
558 | /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ | 531 | /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ |
559 | static const yytype_uint16 yyrline[] = | 532 | static const yytype_uint16 yyrline[] = |
560 | { | 533 | { |
561 | 0, 104, 104, 106, 108, 109, 110, 111, 112, 113, | 534 | 0, 107, 107, 109, 111, 112, 113, 114, 115, 116, |
562 | 114, 118, 122, 122, 122, 122, 122, 122, 122, 126, | 535 | 117, 121, 125, 125, 125, 125, 125, 125, 125, 129, |
563 | 127, 128, 129, 130, 131, 135, 136, 142, 150, 156, | 536 | 130, 131, 132, 133, 134, 138, 139, 145, 153, 159, |
564 | 164, 174, 176, 177, 178, 179, 180, 181, 184, 192, | 537 | 167, 177, 179, 180, 181, 182, 183, 184, 187, 195, |
565 | 198, 208, 214, 220, 223, 225, 236, 237, 242, 251, | 538 | 201, 211, 217, 223, 226, 228, 239, 240, 245, 254, |
566 | 256, 264, 267, 269, 270, 271, 272, 273, 276, 282, | 539 | 259, 267, 270, 272, 273, 274, 275, 276, 279, 285, |
567 | 293, 299, 309, 311, 316, 324, 332, 335, 337, 338, | 540 | 296, 302, 312, 314, 319, 327, 335, 338, 340, 341, |
568 | 339, 344, 351, 356, 364, 367, 369, 370, 371, 374, | 541 | 342, 347, 354, 359, 367, 370, 372, 373, 374, 377, |
569 | 382, 389, 396, 402, 409, 411, 412, 413, 416, 424, | 542 | 385, 392, 399, 405, 412, 414, 415, 416, 419, 427, |
570 | 426, 431, 432, 435, 436, 437, 441, 442, 445, 446, | 543 | 429, 434, 435, 438, 439, 440, 444, 445, 448, 449, |
571 | 449, 450, 451, 452, 453, 454, 455, 458, 459, 462, | 544 | 452, 453, 454, 455, 456, 457, 458, 461, 462, 465, |
572 | 463 | 545 | 466 |
573 | }; | 546 | }; |
574 | #endif | 547 | #endif |
575 | 548 | ||
@@ -985,17 +958,20 @@ yy_symbol_print (yyoutput, yytype, yyvaluep) | |||
985 | #if (defined __STDC__ || defined __C99__FUNC__ \ | 958 | #if (defined __STDC__ || defined __C99__FUNC__ \ |
986 | || defined __cplusplus || defined _MSC_VER) | 959 | || defined __cplusplus || defined _MSC_VER) |
987 | static void | 960 | static void |
988 | yy_stack_print (yytype_int16 *bottom, yytype_int16 *top) | 961 | yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) |
989 | #else | 962 | #else |
990 | static void | 963 | static void |
991 | yy_stack_print (bottom, top) | 964 | yy_stack_print (yybottom, yytop) |
992 | yytype_int16 *bottom; | 965 | yytype_int16 *yybottom; |
993 | yytype_int16 *top; | 966 | yytype_int16 *yytop; |
994 | #endif | 967 | #endif |
995 | { | 968 | { |
996 | YYFPRINTF (stderr, "Stack now"); | 969 | YYFPRINTF (stderr, "Stack now"); |
997 | for (; bottom <= top; ++bottom) | 970 | for (; yybottom <= yytop; yybottom++) |
998 | YYFPRINTF (stderr, " %d", *bottom); | 971 | { |
972 | int yybot = *yybottom; | ||
973 | YYFPRINTF (stderr, " %d", yybot); | ||
974 | } | ||
999 | YYFPRINTF (stderr, "\n"); | 975 | YYFPRINTF (stderr, "\n"); |
1000 | } | 976 | } |
1001 | 977 | ||
@@ -1029,11 +1005,11 @@ yy_reduce_print (yyvsp, yyrule) | |||
1029 | /* The symbols being reduced. */ | 1005 | /* The symbols being reduced. */ |
1030 | for (yyi = 0; yyi < yynrhs; yyi++) | 1006 | for (yyi = 0; yyi < yynrhs; yyi++) |
1031 | { | 1007 | { |
1032 | fprintf (stderr, " $%d = ", yyi + 1); | 1008 | YYFPRINTF (stderr, " $%d = ", yyi + 1); |
1033 | yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], | 1009 | yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], |
1034 | &(yyvsp[(yyi + 1) - (yynrhs)]) | 1010 | &(yyvsp[(yyi + 1) - (yynrhs)]) |
1035 | ); | 1011 | ); |
1036 | fprintf (stderr, "\n"); | 1012 | YYFPRINTF (stderr, "\n"); |
1037 | } | 1013 | } |
1038 | } | 1014 | } |
1039 | 1015 | ||
@@ -1343,10 +1319,8 @@ yydestruct (yymsg, yytype, yyvaluep) | |||
1343 | break; | 1319 | break; |
1344 | } | 1320 | } |
1345 | } | 1321 | } |
1346 | |||
1347 | 1322 | ||
1348 | /* Prevent warnings from -Wmissing-prototypes. */ | 1323 | /* Prevent warnings from -Wmissing-prototypes. */ |
1349 | |||
1350 | #ifdef YYPARSE_PARAM | 1324 | #ifdef YYPARSE_PARAM |
1351 | #if defined __STDC__ || defined __cplusplus | 1325 | #if defined __STDC__ || defined __cplusplus |
1352 | int yyparse (void *YYPARSE_PARAM); | 1326 | int yyparse (void *YYPARSE_PARAM); |
@@ -1362,11 +1336,10 @@ int yyparse (); | |||
1362 | #endif /* ! YYPARSE_PARAM */ | 1336 | #endif /* ! YYPARSE_PARAM */ |
1363 | 1337 | ||
1364 | 1338 | ||
1365 | 1339 | /* The lookahead symbol. */ | |
1366 | /* The look-ahead symbol. */ | ||
1367 | int yychar; | 1340 | int yychar; |
1368 | 1341 | ||
1369 | /* The semantic value of the look-ahead symbol. */ | 1342 | /* The semantic value of the lookahead symbol. */ |
1370 | YYSTYPE yylval; | 1343 | YYSTYPE yylval; |
1371 | 1344 | ||
1372 | /* Number of syntax errors so far. */ | 1345 | /* Number of syntax errors so far. */ |
@@ -1374,9 +1347,9 @@ int yynerrs; | |||
1374 | 1347 | ||
1375 | 1348 | ||
1376 | 1349 | ||
1377 | /*----------. | 1350 | /*-------------------------. |
1378 | | yyparse. | | 1351 | | yyparse or yypush_parse. | |
1379 | `----------*/ | 1352 | `-------------------------*/ |
1380 | 1353 | ||
1381 | #ifdef YYPARSE_PARAM | 1354 | #ifdef YYPARSE_PARAM |
1382 | #if (defined __STDC__ || defined __C99__FUNC__ \ | 1355 | #if (defined __STDC__ || defined __C99__FUNC__ \ |
@@ -1400,66 +1373,68 @@ yyparse () | |||
1400 | #endif | 1373 | #endif |
1401 | #endif | 1374 | #endif |
1402 | { | 1375 | { |
1403 | |||
1404 | int yystate; | ||
1405 | int yyn; | ||
1406 | int yyresult; | ||
1407 | /* Number of tokens to shift before error messages enabled. */ | ||
1408 | int yyerrstatus; | ||
1409 | /* Look-ahead token as an internal (translated) token number. */ | ||
1410 | int yytoken = 0; | ||
1411 | #if YYERROR_VERBOSE | ||
1412 | /* Buffer for error messages, and its allocated size. */ | ||
1413 | char yymsgbuf[128]; | ||
1414 | char *yymsg = yymsgbuf; | ||
1415 | YYSIZE_T yymsg_alloc = sizeof yymsgbuf; | ||
1416 | #endif | ||
1417 | |||
1418 | /* Three stacks and their tools: | ||
1419 | `yyss': related to states, | ||
1420 | `yyvs': related to semantic values, | ||
1421 | `yyls': related to locations. | ||
1422 | 1376 | ||
1423 | Refer to the stacks thru separate pointers, to allow yyoverflow | ||
1424 | to reallocate them elsewhere. */ | ||
1425 | 1377 | ||
1426 | /* The state stack. */ | 1378 | int yystate; |
1427 | yytype_int16 yyssa[YYINITDEPTH]; | 1379 | /* Number of tokens to shift before error messages enabled. */ |
1428 | yytype_int16 *yyss = yyssa; | 1380 | int yyerrstatus; |
1429 | yytype_int16 *yyssp; | ||
1430 | 1381 | ||
1431 | /* The semantic value stack. */ | 1382 | /* The stacks and their tools: |
1432 | YYSTYPE yyvsa[YYINITDEPTH]; | 1383 | `yyss': related to states. |
1433 | YYSTYPE *yyvs = yyvsa; | 1384 | `yyvs': related to semantic values. |
1434 | YYSTYPE *yyvsp; | ||
1435 | 1385 | ||
1386 | Refer to the stacks thru separate pointers, to allow yyoverflow | ||
1387 | to reallocate them elsewhere. */ | ||
1436 | 1388 | ||
1389 | /* The state stack. */ | ||
1390 | yytype_int16 yyssa[YYINITDEPTH]; | ||
1391 | yytype_int16 *yyss; | ||
1392 | yytype_int16 *yyssp; | ||
1437 | 1393 | ||
1438 | #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) | 1394 | /* The semantic value stack. */ |
1395 | YYSTYPE yyvsa[YYINITDEPTH]; | ||
1396 | YYSTYPE *yyvs; | ||
1397 | YYSTYPE *yyvsp; | ||
1439 | 1398 | ||
1440 | YYSIZE_T yystacksize = YYINITDEPTH; | 1399 | YYSIZE_T yystacksize; |
1441 | 1400 | ||
1401 | int yyn; | ||
1402 | int yyresult; | ||
1403 | /* Lookahead token as an internal (translated) token number. */ | ||
1404 | int yytoken; | ||
1442 | /* The variables used to return semantic value and location from the | 1405 | /* The variables used to return semantic value and location from the |
1443 | action routines. */ | 1406 | action routines. */ |
1444 | YYSTYPE yyval; | 1407 | YYSTYPE yyval; |
1445 | 1408 | ||
1409 | #if YYERROR_VERBOSE | ||
1410 | /* Buffer for error messages, and its allocated size. */ | ||
1411 | char yymsgbuf[128]; | ||
1412 | char *yymsg = yymsgbuf; | ||
1413 | YYSIZE_T yymsg_alloc = sizeof yymsgbuf; | ||
1414 | #endif | ||
1415 | |||
1416 | #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) | ||
1446 | 1417 | ||
1447 | /* The number of symbols on the RHS of the reduced rule. | 1418 | /* The number of symbols on the RHS of the reduced rule. |
1448 | Keep to zero when no symbol should be popped. */ | 1419 | Keep to zero when no symbol should be popped. */ |
1449 | int yylen = 0; | 1420 | int yylen = 0; |
1450 | 1421 | ||
1422 | yytoken = 0; | ||
1423 | yyss = yyssa; | ||
1424 | yyvs = yyvsa; | ||
1425 | yystacksize = YYINITDEPTH; | ||
1426 | |||
1451 | YYDPRINTF ((stderr, "Starting parse\n")); | 1427 | YYDPRINTF ((stderr, "Starting parse\n")); |
1452 | 1428 | ||
1453 | yystate = 0; | 1429 | yystate = 0; |
1454 | yyerrstatus = 0; | 1430 | yyerrstatus = 0; |
1455 | yynerrs = 0; | 1431 | yynerrs = 0; |
1456 | yychar = YYEMPTY; /* Cause a token to be read. */ | 1432 | yychar = YYEMPTY; /* Cause a token to be read. */ |
1457 | 1433 | ||
1458 | /* Initialize stack pointers. | 1434 | /* Initialize stack pointers. |
1459 | Waste one element of value and location stack | 1435 | Waste one element of value and location stack |
1460 | so that they stay on the same level as the state stack. | 1436 | so that they stay on the same level as the state stack. |
1461 | The wasted elements are never initialized. */ | 1437 | The wasted elements are never initialized. */ |
1462 | |||
1463 | yyssp = yyss; | 1438 | yyssp = yyss; |
1464 | yyvsp = yyvs; | 1439 | yyvsp = yyvs; |
1465 | 1440 | ||
@@ -1489,7 +1464,6 @@ yyparse () | |||
1489 | YYSTYPE *yyvs1 = yyvs; | 1464 | YYSTYPE *yyvs1 = yyvs; |
1490 | yytype_int16 *yyss1 = yyss; | 1465 | yytype_int16 *yyss1 = yyss; |
1491 | 1466 | ||
1492 | |||
1493 | /* Each stack pointer address is followed by the size of the | 1467 | /* Each stack pointer address is followed by the size of the |
1494 | data in use in that stack, in bytes. This used to be a | 1468 | data in use in that stack, in bytes. This used to be a |
1495 | conditional around just the two extra args, but that might | 1469 | conditional around just the two extra args, but that might |
@@ -1497,7 +1471,6 @@ yyparse () | |||
1497 | yyoverflow (YY_("memory exhausted"), | 1471 | yyoverflow (YY_("memory exhausted"), |
1498 | &yyss1, yysize * sizeof (*yyssp), | 1472 | &yyss1, yysize * sizeof (*yyssp), |
1499 | &yyvs1, yysize * sizeof (*yyvsp), | 1473 | &yyvs1, yysize * sizeof (*yyvsp), |
1500 | |||
1501 | &yystacksize); | 1474 | &yystacksize); |
1502 | 1475 | ||
1503 | yyss = yyss1; | 1476 | yyss = yyss1; |
@@ -1520,9 +1493,8 @@ yyparse () | |||
1520 | (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); | 1493 | (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); |
1521 | if (! yyptr) | 1494 | if (! yyptr) |
1522 | goto yyexhaustedlab; | 1495 | goto yyexhaustedlab; |
1523 | YYSTACK_RELOCATE (yyss); | 1496 | YYSTACK_RELOCATE (yyss_alloc, yyss); |
1524 | YYSTACK_RELOCATE (yyvs); | 1497 | YYSTACK_RELOCATE (yyvs_alloc, yyvs); |
1525 | |||
1526 | # undef YYSTACK_RELOCATE | 1498 | # undef YYSTACK_RELOCATE |
1527 | if (yyss1 != yyssa) | 1499 | if (yyss1 != yyssa) |
1528 | YYSTACK_FREE (yyss1); | 1500 | YYSTACK_FREE (yyss1); |
@@ -1533,7 +1505,6 @@ yyparse () | |||
1533 | yyssp = yyss + yysize - 1; | 1505 | yyssp = yyss + yysize - 1; |
1534 | yyvsp = yyvs + yysize - 1; | 1506 | yyvsp = yyvs + yysize - 1; |
1535 | 1507 | ||
1536 | |||
1537 | YYDPRINTF ((stderr, "Stack size increased to %lu\n", | 1508 | YYDPRINTF ((stderr, "Stack size increased to %lu\n", |
1538 | (unsigned long int) yystacksize)); | 1509 | (unsigned long int) yystacksize)); |
1539 | 1510 | ||
@@ -1543,6 +1514,9 @@ yyparse () | |||
1543 | 1514 | ||
1544 | YYDPRINTF ((stderr, "Entering state %d\n", yystate)); | 1515 | YYDPRINTF ((stderr, "Entering state %d\n", yystate)); |
1545 | 1516 | ||
1517 | if (yystate == YYFINAL) | ||
1518 | YYACCEPT; | ||
1519 | |||
1546 | goto yybackup; | 1520 | goto yybackup; |
1547 | 1521 | ||
1548 | /*-----------. | 1522 | /*-----------. |
@@ -1551,16 +1525,16 @@ yyparse () | |||
1551 | yybackup: | 1525 | yybackup: |
1552 | 1526 | ||
1553 | /* Do appropriate processing given the current state. Read a | 1527 | /* Do appropriate processing given the current state. Read a |
1554 | look-ahead token if we need one and don't already have one. */ | 1528 | lookahead token if we need one and don't already have one. */ |
1555 | 1529 | ||
1556 | /* First try to decide what to do without reference to look-ahead token. */ | 1530 | /* First try to decide what to do without reference to lookahead token. */ |
1557 | yyn = yypact[yystate]; | 1531 | yyn = yypact[yystate]; |
1558 | if (yyn == YYPACT_NINF) | 1532 | if (yyn == YYPACT_NINF) |
1559 | goto yydefault; | 1533 | goto yydefault; |
1560 | 1534 | ||
1561 | /* Not known => get a look-ahead token if don't already have one. */ | 1535 | /* Not known => get a lookahead token if don't already have one. */ |
1562 | 1536 | ||
1563 | /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */ | 1537 | /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ |
1564 | if (yychar == YYEMPTY) | 1538 | if (yychar == YYEMPTY) |
1565 | { | 1539 | { |
1566 | YYDPRINTF ((stderr, "Reading a token: ")); | 1540 | YYDPRINTF ((stderr, "Reading a token: ")); |
@@ -1592,20 +1566,16 @@ yybackup: | |||
1592 | goto yyreduce; | 1566 | goto yyreduce; |
1593 | } | 1567 | } |
1594 | 1568 | ||
1595 | if (yyn == YYFINAL) | ||
1596 | YYACCEPT; | ||
1597 | |||
1598 | /* Count tokens shifted since error; after three, turn off error | 1569 | /* Count tokens shifted since error; after three, turn off error |
1599 | status. */ | 1570 | status. */ |
1600 | if (yyerrstatus) | 1571 | if (yyerrstatus) |
1601 | yyerrstatus--; | 1572 | yyerrstatus--; |
1602 | 1573 | ||
1603 | /* Shift the look-ahead token. */ | 1574 | /* Shift the lookahead token. */ |
1604 | YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); | 1575 | YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); |
1605 | 1576 | ||
1606 | /* Discard the shifted token unless it is eof. */ | 1577 | /* Discard the shifted token. */ |
1607 | if (yychar != YYEOF) | 1578 | yychar = YYEMPTY; |
1608 | yychar = YYEMPTY; | ||
1609 | 1579 | ||
1610 | yystate = yyn; | 1580 | yystate = yyn; |
1611 | *++yyvsp = yylval; | 1581 | *++yyvsp = yylval; |
@@ -2029,7 +1999,6 @@ yyreduce: | |||
2029 | break; | 1999 | break; |
2030 | 2000 | ||
2031 | 2001 | ||
2032 | /* Line 1267 of yacc.c. */ | ||
2033 | 2002 | ||
2034 | default: break; | 2003 | default: break; |
2035 | } | 2004 | } |
@@ -2041,7 +2010,6 @@ yyreduce: | |||
2041 | 2010 | ||
2042 | *++yyvsp = yyval; | 2011 | *++yyvsp = yyval; |
2043 | 2012 | ||
2044 | |||
2045 | /* Now `shift' the result of the reduction. Determine what state | 2013 | /* Now `shift' the result of the reduction. Determine what state |
2046 | that goes to, based on the state we popped back to and the rule | 2014 | that goes to, based on the state we popped back to and the rule |
2047 | number reduced by. */ | 2015 | number reduced by. */ |
@@ -2106,7 +2074,7 @@ yyerrlab: | |||
2106 | 2074 | ||
2107 | if (yyerrstatus == 3) | 2075 | if (yyerrstatus == 3) |
2108 | { | 2076 | { |
2109 | /* If just tried and failed to reuse look-ahead token after an | 2077 | /* If just tried and failed to reuse lookahead token after an |
2110 | error, discard it. */ | 2078 | error, discard it. */ |
2111 | 2079 | ||
2112 | if (yychar <= YYEOF) | 2080 | if (yychar <= YYEOF) |
@@ -2123,7 +2091,7 @@ yyerrlab: | |||
2123 | } | 2091 | } |
2124 | } | 2092 | } |
2125 | 2093 | ||
2126 | /* Else will try to reuse look-ahead token after shifting the error | 2094 | /* Else will try to reuse lookahead token after shifting the error |
2127 | token. */ | 2095 | token. */ |
2128 | goto yyerrlab1; | 2096 | goto yyerrlab1; |
2129 | 2097 | ||
@@ -2180,9 +2148,6 @@ yyerrlab1: | |||
2180 | YY_STACK_PRINT (yyss, yyssp); | 2148 | YY_STACK_PRINT (yyss, yyssp); |
2181 | } | 2149 | } |
2182 | 2150 | ||
2183 | if (yyn == YYFINAL) | ||
2184 | YYACCEPT; | ||
2185 | |||
2186 | *++yyvsp = yylval; | 2151 | *++yyvsp = yylval; |
2187 | 2152 | ||
2188 | 2153 | ||
@@ -2207,7 +2172,7 @@ yyabortlab: | |||
2207 | yyresult = 1; | 2172 | yyresult = 1; |
2208 | goto yyreturn; | 2173 | goto yyreturn; |
2209 | 2174 | ||
2210 | #ifndef yyoverflow | 2175 | #if !defined(yyoverflow) || YYERROR_VERBOSE |
2211 | /*-------------------------------------------------. | 2176 | /*-------------------------------------------------. |
2212 | | yyexhaustedlab -- memory exhaustion comes here. | | 2177 | | yyexhaustedlab -- memory exhaustion comes here. | |
2213 | `-------------------------------------------------*/ | 2178 | `-------------------------------------------------*/ |
@@ -2218,7 +2183,7 @@ yyexhaustedlab: | |||
2218 | #endif | 2183 | #endif |
2219 | 2184 | ||
2220 | yyreturn: | 2185 | yyreturn: |
2221 | if (yychar != YYEOF && yychar != YYEMPTY) | 2186 | if (yychar != YYEMPTY) |
2222 | yydestruct ("Cleanup: discarding lookahead", | 2187 | yydestruct ("Cleanup: discarding lookahead", |
2223 | yytoken, &yylval); | 2188 | yytoken, &yylval); |
2224 | /* Do not reclaim the symbols of the rule which action triggered | 2189 | /* Do not reclaim the symbols of the rule which action triggered |
@@ -2284,7 +2249,7 @@ void conf_parse(const char *name) | |||
2284 | sym_set_change_count(1); | 2249 | sym_set_change_count(1); |
2285 | } | 2250 | } |
2286 | 2251 | ||
2287 | const char *zconf_tokenname(int token) | 2252 | static const char *zconf_tokenname(int token) |
2288 | { | 2253 | { |
2289 | switch (token) { | 2254 | switch (token) { |
2290 | case T_MENU: return "menu"; | 2255 | case T_MENU: return "menu"; |
@@ -2348,7 +2313,7 @@ static void zconferror(const char *err) | |||
2348 | #endif | 2313 | #endif |
2349 | } | 2314 | } |
2350 | 2315 | ||
2351 | void print_quoted_string(FILE *out, const char *str) | 2316 | static void print_quoted_string(FILE *out, const char *str) |
2352 | { | 2317 | { |
2353 | const char *p; | 2318 | const char *p; |
2354 | int len; | 2319 | int len; |
@@ -2365,7 +2330,7 @@ void print_quoted_string(FILE *out, const char *str) | |||
2365 | putc('"', out); | 2330 | putc('"', out); |
2366 | } | 2331 | } |
2367 | 2332 | ||
2368 | void print_symbol(FILE *out, struct menu *menu) | 2333 | static void print_symbol(FILE *out, struct menu *menu) |
2369 | { | 2334 | { |
2370 | struct symbol *sym = menu->sym; | 2335 | struct symbol *sym = menu->sym; |
2371 | struct property *prop; | 2336 | struct property *prop; |
diff --git a/scripts/kconfig/zconf.y b/scripts/kconfig/zconf.y index 9710b82466f2..8c43491f8cc9 100644 --- a/scripts/kconfig/zconf.y +++ b/scripts/kconfig/zconf.y | |||
@@ -14,8 +14,6 @@ | |||
14 | #define LKC_DIRECT_LINK | 14 | #define LKC_DIRECT_LINK |
15 | #include "lkc.h" | 15 | #include "lkc.h" |
16 | 16 | ||
17 | #include "zconf.hash.c" | ||
18 | |||
19 | #define printd(mask, fmt...) if (cdebug & (mask)) printf(fmt) | 17 | #define printd(mask, fmt...) if (cdebug & (mask)) printf(fmt) |
20 | 18 | ||
21 | #define PRINTD 0x0001 | 19 | #define PRINTD 0x0001 |
@@ -100,6 +98,11 @@ static struct menu *current_menu, *current_entry; | |||
100 | menu_end_menu(); | 98 | menu_end_menu(); |
101 | } if_entry menu_entry choice_entry | 99 | } if_entry menu_entry choice_entry |
102 | 100 | ||
101 | %{ | ||
102 | /* Include zconf.hash.c here so it can see the token constants. */ | ||
103 | #include "zconf.hash.c" | ||
104 | %} | ||
105 | |||
103 | %% | 106 | %% |
104 | input: stmt_list; | 107 | input: stmt_list; |
105 | 108 | ||
@@ -501,7 +504,7 @@ void conf_parse(const char *name) | |||
501 | sym_set_change_count(1); | 504 | sym_set_change_count(1); |
502 | } | 505 | } |
503 | 506 | ||
504 | const char *zconf_tokenname(int token) | 507 | static const char *zconf_tokenname(int token) |
505 | { | 508 | { |
506 | switch (token) { | 509 | switch (token) { |
507 | case T_MENU: return "menu"; | 510 | case T_MENU: return "menu"; |
@@ -565,7 +568,7 @@ static void zconferror(const char *err) | |||
565 | #endif | 568 | #endif |
566 | } | 569 | } |
567 | 570 | ||
568 | void print_quoted_string(FILE *out, const char *str) | 571 | static void print_quoted_string(FILE *out, const char *str) |
569 | { | 572 | { |
570 | const char *p; | 573 | const char *p; |
571 | int len; | 574 | int len; |
@@ -582,7 +585,7 @@ void print_quoted_string(FILE *out, const char *str) | |||
582 | putc('"', out); | 585 | putc('"', out); |
583 | } | 586 | } |
584 | 587 | ||
585 | void print_symbol(FILE *out, struct menu *menu) | 588 | static void print_symbol(FILE *out, struct menu *menu) |
586 | { | 589 | { |
587 | struct symbol *sym = menu->sym; | 590 | struct symbol *sym = menu->sym; |
588 | struct property *prop; | 591 | struct property *prop; |
diff --git a/scripts/kernel-doc b/scripts/kernel-doc index b52d340d759d..ea9f8a58678f 100755 --- a/scripts/kernel-doc +++ b/scripts/kernel-doc | |||
@@ -1995,6 +1995,7 @@ sub process_file($) { | |||
1995 | my $identifier; | 1995 | my $identifier; |
1996 | my $func; | 1996 | my $func; |
1997 | my $descr; | 1997 | my $descr; |
1998 | my $in_purpose = 0; | ||
1998 | my $initial_section_counter = $section_counter; | 1999 | my $initial_section_counter = $section_counter; |
1999 | 2000 | ||
2000 | if (defined($ENV{'SRCTREE'})) { | 2001 | if (defined($ENV{'SRCTREE'})) { |
@@ -2044,6 +2045,7 @@ sub process_file($) { | |||
2044 | $descr =~ s/\s*$//; | 2045 | $descr =~ s/\s*$//; |
2045 | $descr =~ s/\s+/ /; | 2046 | $descr =~ s/\s+/ /; |
2046 | $declaration_purpose = xml_escape($descr); | 2047 | $declaration_purpose = xml_escape($descr); |
2048 | $in_purpose = 1; | ||
2047 | } else { | 2049 | } else { |
2048 | $declaration_purpose = ""; | 2050 | $declaration_purpose = ""; |
2049 | } | 2051 | } |
@@ -2090,6 +2092,7 @@ sub process_file($) { | |||
2090 | } | 2092 | } |
2091 | 2093 | ||
2092 | $in_doc_sect = 1; | 2094 | $in_doc_sect = 1; |
2095 | $in_purpose = 0; | ||
2093 | $contents = $newcontents; | 2096 | $contents = $newcontents; |
2094 | if ($contents ne "") { | 2097 | if ($contents ne "") { |
2095 | while ((substr($contents, 0, 1) eq " ") || | 2098 | while ((substr($contents, 0, 1) eq " ") || |
@@ -2119,11 +2122,19 @@ sub process_file($) { | |||
2119 | } elsif (/$doc_content/) { | 2122 | } elsif (/$doc_content/) { |
2120 | # miguel-style comment kludge, look for blank lines after | 2123 | # miguel-style comment kludge, look for blank lines after |
2121 | # @parameter line to signify start of description | 2124 | # @parameter line to signify start of description |
2122 | if ($1 eq "" && | 2125 | if ($1 eq "") { |
2123 | ($section =~ m/^@/ || $section eq $section_context)) { | 2126 | if ($section =~ m/^@/ || $section eq $section_context) { |
2124 | dump_section($file, $section, xml_escape($contents)); | 2127 | dump_section($file, $section, xml_escape($contents)); |
2125 | $section = $section_default; | 2128 | $section = $section_default; |
2126 | $contents = ""; | 2129 | $contents = ""; |
2130 | } else { | ||
2131 | $contents .= "\n"; | ||
2132 | } | ||
2133 | $in_purpose = 0; | ||
2134 | } elsif ($in_purpose == 1) { | ||
2135 | # Continued declaration purpose | ||
2136 | chomp($declaration_purpose); | ||
2137 | $declaration_purpose .= " " . xml_escape($1); | ||
2127 | } else { | 2138 | } else { |
2128 | $contents .= $1 . "\n"; | 2139 | $contents .= $1 . "\n"; |
2129 | } | 2140 | } |
diff --git a/scripts/markup_oops.pl b/scripts/markup_oops.pl index 89774011965d..5f0fcb712e29 100644 --- a/scripts/markup_oops.pl +++ b/scripts/markup_oops.pl | |||
@@ -184,10 +184,7 @@ if ($target eq "0") { | |||
184 | 184 | ||
185 | # if it's a module, we need to find the .ko file and calculate a load offset | 185 | # if it's a module, we need to find the .ko file and calculate a load offset |
186 | if ($module ne "") { | 186 | if ($module ne "") { |
187 | my $dir = dirname($filename); | 187 | my $modulefile = `modinfo $module | grep '^filename:' | awk '{ print \$2 }'`; |
188 | $dir = $dir . "/"; | ||
189 | my $mod = $module . ".ko"; | ||
190 | my $modulefile = `find $dir -name $mod | head -1`; | ||
191 | chomp($modulefile); | 188 | chomp($modulefile); |
192 | $filename = $modulefile; | 189 | $filename = $modulefile; |
193 | if ($filename eq "") { | 190 | if ($filename eq "") { |
diff --git a/scripts/mkcompile_h b/scripts/mkcompile_h index 6a12dd9f1181..bce3d0fe6fbd 100755 --- a/scripts/mkcompile_h +++ b/scripts/mkcompile_h | |||
@@ -1,3 +1,5 @@ | |||
1 | #!/bin/sh | ||
2 | |||
1 | TARGET=$1 | 3 | TARGET=$1 |
2 | ARCH=$2 | 4 | ARCH=$2 |
3 | SMP=$3 | 5 | SMP=$3 |
@@ -50,7 +52,7 @@ UTS_VERSION="$UTS_VERSION $CONFIG_FLAGS $TIMESTAMP" | |||
50 | # Truncate to maximum length | 52 | # Truncate to maximum length |
51 | 53 | ||
52 | UTS_LEN=64 | 54 | UTS_LEN=64 |
53 | UTS_TRUNCATE="sed -e s/\(.\{1,$UTS_LEN\}\).*/\1/" | 55 | UTS_TRUNCATE="cut -b -$UTS_LEN" |
54 | 56 | ||
55 | # Generate a temporary compile.h | 57 | # Generate a temporary compile.h |
56 | 58 | ||
@@ -66,9 +68,13 @@ UTS_TRUNCATE="sed -e s/\(.\{1,$UTS_LEN\}\).*/\1/" | |||
66 | echo \#define LINUX_COMPILE_HOST \"`hostname | $UTS_TRUNCATE`\" | 68 | echo \#define LINUX_COMPILE_HOST \"`hostname | $UTS_TRUNCATE`\" |
67 | 69 | ||
68 | if [ -x /bin/dnsdomainname ]; then | 70 | if [ -x /bin/dnsdomainname ]; then |
69 | echo \#define LINUX_COMPILE_DOMAIN \"`dnsdomainname | $UTS_TRUNCATE`\" | 71 | domain=`dnsdomainname 2> /dev/null` |
70 | elif [ -x /bin/domainname ]; then | 72 | elif [ -x /bin/domainname ]; then |
71 | echo \#define LINUX_COMPILE_DOMAIN \"`domainname | $UTS_TRUNCATE`\" | 73 | domain=`domainname 2> /dev/null` |
74 | fi | ||
75 | |||
76 | if [ -n "$domain" ]; then | ||
77 | echo \#define LINUX_COMPILE_DOMAIN \"`echo $domain | $UTS_TRUNCATE`\" | ||
72 | else | 78 | else |
73 | echo \#define LINUX_COMPILE_DOMAIN | 79 | echo \#define LINUX_COMPILE_DOMAIN |
74 | fi | 80 | fi |
diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c index 40e0045876ee..62a9025cdcc7 100644 --- a/scripts/mod/file2alias.c +++ b/scripts/mod/file2alias.c | |||
@@ -657,6 +657,15 @@ static int do_i2c_entry(const char *filename, struct i2c_device_id *id, | |||
657 | return 1; | 657 | return 1; |
658 | } | 658 | } |
659 | 659 | ||
660 | /* Looks like: spi:S */ | ||
661 | static int do_spi_entry(const char *filename, struct spi_device_id *id, | ||
662 | char *alias) | ||
663 | { | ||
664 | sprintf(alias, SPI_MODULE_PREFIX "%s", id->name); | ||
665 | |||
666 | return 1; | ||
667 | } | ||
668 | |||
660 | static const struct dmifield { | 669 | static const struct dmifield { |
661 | const char *prefix; | 670 | const char *prefix; |
662 | int field; | 671 | int field; |
@@ -853,6 +862,10 @@ void handle_moddevtable(struct module *mod, struct elf_info *info, | |||
853 | do_table(symval, sym->st_size, | 862 | do_table(symval, sym->st_size, |
854 | sizeof(struct i2c_device_id), "i2c", | 863 | sizeof(struct i2c_device_id), "i2c", |
855 | do_i2c_entry, mod); | 864 | do_i2c_entry, mod); |
865 | else if (sym_is(symname, "__mod_spi_device_table")) | ||
866 | do_table(symval, sym->st_size, | ||
867 | sizeof(struct spi_device_id), "spi", | ||
868 | do_spi_entry, mod); | ||
856 | else if (sym_is(symname, "__mod_dmi_device_table")) | 869 | else if (sym_is(symname, "__mod_dmi_device_table")) |
857 | do_table(symval, sym->st_size, | 870 | do_table(symval, sym->st_size, |
858 | sizeof(struct dmi_system_id), "dmi", | 871 | sizeof(struct dmi_system_id), "dmi", |
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c index 4522948a012e..801a16a17545 100644 --- a/scripts/mod/modpost.c +++ b/scripts/mod/modpost.c | |||
@@ -691,7 +691,7 @@ static int number_prefix(const char *sym) | |||
691 | * The $ syntax is for sections where ld append a dot number | 691 | * The $ syntax is for sections where ld append a dot number |
692 | * to make section name unique. | 692 | * to make section name unique. |
693 | */ | 693 | */ |
694 | int match(const char *sym, const char * const pat[]) | 694 | static int match(const char *sym, const char * const pat[]) |
695 | { | 695 | { |
696 | const char *p; | 696 | const char *p; |
697 | while (*pat) { | 697 | while (*pat) { |
@@ -1746,7 +1746,7 @@ static void add_header(struct buffer *b, struct module *mod) | |||
1746 | buf_printf(b, "};\n"); | 1746 | buf_printf(b, "};\n"); |
1747 | } | 1747 | } |
1748 | 1748 | ||
1749 | void add_staging_flag(struct buffer *b, const char *name) | 1749 | static void add_staging_flag(struct buffer *b, const char *name) |
1750 | { | 1750 | { |
1751 | static const char *staging_dir = "drivers/staging"; | 1751 | static const char *staging_dir = "drivers/staging"; |
1752 | 1752 | ||
diff --git a/scripts/mod/sumversion.c b/scripts/mod/sumversion.c index aadc5223dcdb..ecf9c7dc1825 100644 --- a/scripts/mod/sumversion.c +++ b/scripts/mod/sumversion.c | |||
@@ -334,8 +334,6 @@ static int parse_source_files(const char *objfile, struct md4_ctx *md) | |||
334 | deps_drivers/net/dummy.o := \ | 334 | deps_drivers/net/dummy.o := \ |
335 | drivers/net/dummy.c \ | 335 | drivers/net/dummy.c \ |
336 | $(wildcard include/config/net/fastroute.h) \ | 336 | $(wildcard include/config/net/fastroute.h) \ |
337 | include/linux/config.h \ | ||
338 | $(wildcard include/config/h.h) \ | ||
339 | include/linux/module.h \ | 337 | include/linux/module.h \ |
340 | 338 | ||
341 | Sum all files in the same dir or subdirs. | 339 | Sum all files in the same dir or subdirs. |
diff --git a/scripts/module-common.lds b/scripts/module-common.lds new file mode 100644 index 000000000000..47a1f9ae0ede --- /dev/null +++ b/scripts/module-common.lds | |||
@@ -0,0 +1,8 @@ | |||
1 | /* | ||
2 | * Common module linker script, always used when linking a module. | ||
3 | * Archs are free to supply their own linker scripts. ld will | ||
4 | * combine them automatically. | ||
5 | */ | ||
6 | SECTIONS { | ||
7 | /DISCARD/ : { *(.discard) } | ||
8 | } | ||
diff --git a/scripts/package/Makefile b/scripts/package/Makefile index fa4a0a17b7e0..f67cc885c807 100644 --- a/scripts/package/Makefile +++ b/scripts/package/Makefile | |||
@@ -18,6 +18,9 @@ | |||
18 | # e) generate the rpm files, based on kernel.spec | 18 | # e) generate the rpm files, based on kernel.spec |
19 | # - Use /. to avoid tar packing just the symlink | 19 | # - Use /. to avoid tar packing just the symlink |
20 | 20 | ||
21 | # Note that the rpm-pkg target cannot be used with KBUILD_OUTPUT, | ||
22 | # but the binrpm-pkg target can; for some reason O= gets ignored. | ||
23 | |||
21 | # Do we have rpmbuild, otherwise fall back to the older rpm | 24 | # Do we have rpmbuild, otherwise fall back to the older rpm |
22 | RPM := $(shell if [ -x "/usr/bin/rpmbuild" ]; then echo rpmbuild; \ | 25 | RPM := $(shell if [ -x "/usr/bin/rpmbuild" ]; then echo rpmbuild; \ |
23 | else echo rpm; fi) | 26 | else echo rpm; fi) |
@@ -33,6 +36,12 @@ $(objtree)/kernel.spec: $(MKSPEC) $(srctree)/Makefile | |||
33 | $(CONFIG_SHELL) $(MKSPEC) > $@ | 36 | $(CONFIG_SHELL) $(MKSPEC) > $@ |
34 | 37 | ||
35 | rpm-pkg rpm: $(objtree)/kernel.spec FORCE | 38 | rpm-pkg rpm: $(objtree)/kernel.spec FORCE |
39 | @if test -n "$(KBUILD_OUTPUT)"; then \ | ||
40 | echo "Building source + binary RPM is not possible outside the"; \ | ||
41 | echo "kernel source tree. Don't set KBUILD_OUTPUT, or use the"; \ | ||
42 | echo "binrpm-pkg target instead."; \ | ||
43 | false; \ | ||
44 | fi | ||
36 | $(MAKE) clean | 45 | $(MAKE) clean |
37 | $(PREV) ln -sf $(srctree) $(KERNELPATH) | 46 | $(PREV) ln -sf $(srctree) $(KERNELPATH) |
38 | $(CONFIG_SHELL) $(srctree)/scripts/setlocalversion > $(objtree)/.scmversion | 47 | $(CONFIG_SHELL) $(srctree)/scripts/setlocalversion > $(objtree)/.scmversion |
@@ -61,7 +70,7 @@ binrpm-pkg: $(objtree)/binkernel.spec FORCE | |||
61 | set -e; \ | 70 | set -e; \ |
62 | mv -f $(objtree)/.tmp_version $(objtree)/.version | 71 | mv -f $(objtree)/.tmp_version $(objtree)/.version |
63 | 72 | ||
64 | $(RPM) $(RPMOPTS) --define "_builddir $(srctree)" --target \ | 73 | $(RPM) $(RPMOPTS) --define "_builddir $(objtree)" --target \ |
65 | $(UTS_MACHINE) -bb $< | 74 | $(UTS_MACHINE) -bb $< |
66 | 75 | ||
67 | clean-files += $(objtree)/binkernel.spec | 76 | clean-files += $(objtree)/binkernel.spec |
diff --git a/scripts/package/mkspec b/scripts/package/mkspec index 3d93f8c81252..47bdd2f99b78 100755 --- a/scripts/package/mkspec +++ b/scripts/package/mkspec | |||
@@ -70,7 +70,7 @@ echo 'mkdir -p $RPM_BUILD_ROOT/boot $RPM_BUILD_ROOT/lib/modules' | |||
70 | echo 'mkdir -p $RPM_BUILD_ROOT/lib/firmware' | 70 | echo 'mkdir -p $RPM_BUILD_ROOT/lib/firmware' |
71 | echo "%endif" | 71 | echo "%endif" |
72 | 72 | ||
73 | echo 'INSTALL_MOD_PATH=$RPM_BUILD_ROOT make %{_smp_mflags} modules_install' | 73 | echo 'INSTALL_MOD_PATH=$RPM_BUILD_ROOT make %{_smp_mflags} KBUILD_SRC= modules_install' |
74 | echo "%ifarch ia64" | 74 | echo "%ifarch ia64" |
75 | echo 'cp $KBUILD_IMAGE $RPM_BUILD_ROOT'"/boot/efi/vmlinuz-$KERNELRELEASE" | 75 | echo 'cp $KBUILD_IMAGE $RPM_BUILD_ROOT'"/boot/efi/vmlinuz-$KERNELRELEASE" |
76 | echo 'ln -s '"efi/vmlinuz-$KERNELRELEASE" '$RPM_BUILD_ROOT'"/boot/" | 76 | echo 'ln -s '"efi/vmlinuz-$KERNELRELEASE" '$RPM_BUILD_ROOT'"/boot/" |
diff --git a/scripts/recordmcount.pl b/scripts/recordmcount.pl index 911ba7ffab84..090d300d7394 100755 --- a/scripts/recordmcount.pl +++ b/scripts/recordmcount.pl | |||
@@ -57,7 +57,6 @@ | |||
57 | # call mcount (offset: 0x5) | 57 | # call mcount (offset: 0x5) |
58 | # [...] | 58 | # [...] |
59 | # ret | 59 | # ret |
60 | # .globl my_func | ||
61 | # other_func: | 60 | # other_func: |
62 | # [...] | 61 | # [...] |
63 | # call mcount (offset: 0x1b) | 62 | # call mcount (offset: 0x1b) |
diff --git a/scripts/selinux/mdp/mdp.c b/scripts/selinux/mdp/mdp.c index ca757d486187..b4ced8562587 100644 --- a/scripts/selinux/mdp/mdp.c +++ b/scripts/selinux/mdp/mdp.c | |||
@@ -31,13 +31,13 @@ | |||
31 | 31 | ||
32 | #include "flask.h" | 32 | #include "flask.h" |
33 | 33 | ||
34 | void usage(char *name) | 34 | static void usage(char *name) |
35 | { | 35 | { |
36 | printf("usage: %s [-m] policy_file context_file\n", name); | 36 | printf("usage: %s [-m] policy_file context_file\n", name); |
37 | exit(1); | 37 | exit(1); |
38 | } | 38 | } |
39 | 39 | ||
40 | void find_common_name(char *cname, char *dest, int len) | 40 | static void find_common_name(char *cname, char *dest, int len) |
41 | { | 41 | { |
42 | char *start, *end; | 42 | char *start, *end; |
43 | 43 | ||
diff --git a/scripts/tags.sh b/scripts/tags.sh index 4a34ec591e8c..d52f7a01557c 100755 --- a/scripts/tags.sh +++ b/scripts/tags.sh | |||
@@ -101,7 +101,8 @@ exuberant() | |||
101 | -I ____cacheline_aligned_in_smp \ | 101 | -I ____cacheline_aligned_in_smp \ |
102 | -I ____cacheline_internodealigned_in_smp \ | 102 | -I ____cacheline_internodealigned_in_smp \ |
103 | -I EXPORT_SYMBOL,EXPORT_SYMBOL_GPL \ | 103 | -I EXPORT_SYMBOL,EXPORT_SYMBOL_GPL \ |
104 | --extra=+f --c-kinds=+px \ | 104 | -I DEFINE_TRACE,EXPORT_TRACEPOINT_SYMBOL,EXPORT_TRACEPOINT_SYMBOL_GPL \ |
105 | --extra=+f --c-kinds=-px \ | ||
105 | --regex-asm='/^ENTRY\(([^)]*)\).*/\1/' \ | 106 | --regex-asm='/^ENTRY\(([^)]*)\).*/\1/' \ |
106 | --regex-c='/^SYSCALL_DEFINE[[:digit:]]?\(([^,)]*).*/sys_\1/' | 107 | --regex-c='/^SYSCALL_DEFINE[[:digit:]]?\(([^,)]*).*/sys_\1/' |
107 | 108 | ||
diff --git a/scripts/tracing/power.pl b/scripts/tracing/power.pl deleted file mode 100644 index 4f729b3501e0..000000000000 --- a/scripts/tracing/power.pl +++ /dev/null | |||
@@ -1,108 +0,0 @@ | |||
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 cstate ftrace output into a SVG graphic that shows | ||
28 | # historic C-state information | ||
29 | # | ||
30 | # | ||
31 | # cat /sys/kernel/debug/tracing/trace | perl power.pl > out.svg | ||
32 | # | ||
33 | |||
34 | my @styles; | ||
35 | my $base = 0; | ||
36 | |||
37 | my @pstate_last; | ||
38 | my @pstate_level; | ||
39 | |||
40 | $styles[0] = "fill:rgb(0,0,255);fill-opacity:0.5;stroke-width:1;stroke:rgb(0,0,0)"; | ||
41 | $styles[1] = "fill:rgb(0,255,0);fill-opacity:0.5;stroke-width:1;stroke:rgb(0,0,0)"; | ||
42 | $styles[2] = "fill:rgb(255,0,20);fill-opacity:0.5;stroke-width:1;stroke:rgb(0,0,0)"; | ||
43 | $styles[3] = "fill:rgb(255,255,20);fill-opacity:0.5;stroke-width:1;stroke:rgb(0,0,0)"; | ||
44 | $styles[4] = "fill:rgb(255,0,255);fill-opacity:0.5;stroke-width:1;stroke:rgb(0,0,0)"; | ||
45 | $styles[5] = "fill:rgb(0,255,255);fill-opacity:0.5;stroke-width:1;stroke:rgb(0,0,0)"; | ||
46 | $styles[6] = "fill:rgb(0,128,255);fill-opacity:0.5;stroke-width:1;stroke:rgb(0,0,0)"; | ||
47 | $styles[7] = "fill:rgb(0,255,128);fill-opacity:0.5;stroke-width:1;stroke:rgb(0,0,0)"; | ||
48 | $styles[8] = "fill:rgb(0,25,20);fill-opacity:0.5;stroke-width:1;stroke:rgb(0,0,0)"; | ||
49 | |||
50 | |||
51 | print "<?xml version=\"1.0\" standalone=\"no\"?> \n"; | ||
52 | print "<svg width=\"10000\" height=\"100%\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\">\n"; | ||
53 | |||
54 | my $scale = 30000.0; | ||
55 | while (<>) { | ||
56 | my $line = $_; | ||
57 | if ($line =~ /([0-9\.]+)\] CSTATE: Going to C([0-9]) on cpu ([0-9]+) for ([0-9\.]+)/) { | ||
58 | if ($base == 0) { | ||
59 | $base = $1; | ||
60 | } | ||
61 | my $time = $1 - $base; | ||
62 | $time = $time * $scale; | ||
63 | my $C = $2; | ||
64 | my $cpu = $3; | ||
65 | my $y = 400 * $cpu; | ||
66 | my $duration = $4 * $scale; | ||
67 | my $msec = int($4 * 100000)/100.0; | ||
68 | my $height = $C * 20; | ||
69 | $style = $styles[$C]; | ||
70 | |||
71 | $y = $y + 140 - $height; | ||
72 | |||
73 | $x2 = $time + 4; | ||
74 | $y2 = $y + 4; | ||
75 | |||
76 | |||
77 | print "<rect x=\"$time\" width=\"$duration\" y=\"$y\" height=\"$height\" style=\"$style\"/>\n"; | ||
78 | print "<text transform=\"translate($x2,$y2) rotate(90)\">C$C $msec</text>\n"; | ||
79 | } | ||
80 | if ($line =~ /([0-9\.]+)\] PSTATE: Going to P([0-9]) on cpu ([0-9]+)/) { | ||
81 | my $time = $1 - $base; | ||
82 | my $state = $2; | ||
83 | my $cpu = $3; | ||
84 | |||
85 | if (defined($pstate_last[$cpu])) { | ||
86 | my $from = $pstate_last[$cpu]; | ||
87 | my $oldstate = $pstate_state[$cpu]; | ||
88 | my $duration = ($time-$from) * $scale; | ||
89 | |||
90 | $from = $from * $scale; | ||
91 | my $to = $from + $duration; | ||
92 | my $height = 140 - ($oldstate * (140/8)); | ||
93 | |||
94 | my $y = 400 * $cpu + 200 + $height; | ||
95 | my $y2 = $y+4; | ||
96 | my $style = $styles[8]; | ||
97 | |||
98 | print "<rect x=\"$from\" y=\"$y\" width=\"$duration\" height=\"5\" style=\"$style\"/>\n"; | ||
99 | print "<text transform=\"translate($from,$y2)\">P$oldstate (cpu $cpu)</text>\n"; | ||
100 | }; | ||
101 | |||
102 | $pstate_last[$cpu] = $time; | ||
103 | $pstate_state[$cpu] = $state; | ||
104 | } | ||
105 | } | ||
106 | |||
107 | |||
108 | print "</svg>\n"; | ||