Commit 176d09827725e82ad3f628f7a33ebbc4e93aa41a

Authored by Masahiro Yamada
Committed by Tom Rini
1 parent ad618992f7

kbuild: sync misc scripts with Linux 3.18-rc1

This commit imports some updates in misc scripts from Linux 3.18-rc1.

[1] commit cbb4d3e6510b99522719c5ef0 by Horia Geanta
scripts/kernel-doc: handle object-like macros

[2] commit 164f0d2efaaef83 by Michal Marek
kbuild: Fix handling of backslashes in *.cmd files

[3] commit 270a00963cd367214e by Randy Dunlap
scripts/kernel-doc: recognize __meminit

[4] commit a4954fd7724c0f55361eb5 by Masahiro Yamada
  kbuild: remove obj-n and lib-n handling

[5] commit 5b2389b45d1a9c12b9f by Masahiro Yamada
kbuild: simplify build, clean, modbuiltin shorthands

Signed-off-by: Horia Geanta <horia.geanta@freescale.com>
Signed-off-by: Michal Marek <mmarek@suse.cz>
Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

Showing 5 changed files with 28 additions and 18 deletions Side-by-side Diff

... ... @@ -1444,7 +1444,7 @@
1444 1444 # Shorthand for $(Q)$(MAKE) -f scripts/Makefile.clean obj=dir
1445 1445 # Usage:
1446 1446 # $(Q)$(MAKE) $(clean)=dir
1447   -clean := -f $(if $(KBUILD_SRC),$(srctree)/)scripts/Makefile.clean obj
  1447 +clean := -f $(srctree)/scripts/Makefile.clean obj
1448 1448  
1449 1449 endif # skip-makefile
1450 1450  
scripts/Kbuild.include
... ... @@ -177,13 +177,13 @@
177 177 # Shorthand for $(Q)$(MAKE) -f scripts/Makefile.build obj=
178 178 # Usage:
179 179 # $(Q)$(MAKE) $(build)=dir
180   -build := -f $(if $(KBUILD_SRC),$(srctree)/)scripts/Makefile.build obj
  180 +build := -f $(srctree)/scripts/Makefile.build obj
181 181  
182 182 ###
183 183 # Shorthand for $(Q)$(MAKE) -f scripts/Makefile.modbuiltin obj=
184 184 # Usage:
185 185 # $(Q)$(MAKE) $(modbuiltin)=dir
186   -modbuiltin := -f $(if $(KBUILD_SRC),$(srctree)/)scripts/Makefile.modbuiltin obj
  186 +modbuiltin := -f $(srctree)/scripts/Makefile.modbuiltin obj
187 187  
188 188 # Prefix -I with $(srctree) if it is not an absolute path.
189 189 # skip if -I has no parameter
... ... @@ -221,11 +221,13 @@
221 221 arg-check = $(if $(strip $(cmd_$@)),,1)
222 222 endif
223 223  
224   -# >'< substitution is for echo to work,
225   -# >$< substitution to preserve $ when reloading .cmd file
226   -# note: when using inline perl scripts [perl -e '...$$t=1;...']
227   -# in $(cmd_xxx) double $$ your perl vars
228   -make-cmd = $(subst \\,\\\\,$(subst \#,\\\#,$(subst $$,$$$$,$(call escsq,$(cmd_$(1))))))
  224 +# Replace >$< with >$$< to preserve $ when reloading the .cmd file
  225 +# (needed for make)
  226 +# Replace >#< with >\#< to avoid starting a comment in the .cmd file
  227 +# (needed for make)
  228 +# Replace >'< with >'\''< to be able to enclose the whole string in '...'
  229 +# (needed for the shell)
  230 +make-cmd = $(call escsq,$(subst \#,\\\#,$(subst $$,$$$$,$(cmd_$(1)))))
229 231  
230 232 # Find any prerequisites that is newer than target or that does not exist.
231 233 # PHONY targets skipped in both cases.
... ... @@ -236,7 +238,7 @@
236 238 if_changed = $(if $(strip $(any-prereq) $(arg-check)), \
237 239 @set -e; \
238 240 $(echo-cmd) $(cmd_$(1)); \
239   - echo 'cmd_$@ := $(make-cmd)' > $(dot-target).cmd)
  241 + printf '%s\n' 'cmd_$@ := $(make-cmd)' > $(dot-target).cmd)
240 242  
241 243 # Execute the command and also postprocess generated .d dependencies file.
242 244 if_changed_dep = $(if $(strip $(any-prereq) $(arg-check) ), \
scripts/Makefile.build
... ... @@ -97,11 +97,11 @@
97 97  
98 98 # ===========================================================================
99 99  
100   -ifneq ($(strip $(lib-y) $(lib-m) $(lib-n) $(lib-)),)
  100 +ifneq ($(strip $(lib-y) $(lib-m) $(lib-)),)
101 101 lib-target := $(obj)/lib.a
102 102 endif
103 103  
104   -ifneq ($(strip $(obj-y) $(obj-m) $(obj-n) $(obj-) $(subdir-m) $(lib-target)),)
  104 +ifneq ($(strip $(obj-y) $(obj-m) $(obj-) $(subdir-m) $(lib-target)),)
105 105 builtin-target := $(obj)/built-in.o
106 106 endif
107 107  
scripts/Makefile.clean
... ... @@ -10,7 +10,7 @@
10 10 # Shorthand for $(Q)$(MAKE) scripts/Makefile.clean obj=dir
11 11 # Usage:
12 12 # $(Q)$(MAKE) $(clean)=dir
13   -clean := -f $(if $(KBUILD_SRC),$(srctree)/)scripts/Makefile.clean obj
  13 +clean := -f $(srctree)/scripts/Makefile.clean obj
14 14  
15 15 # The filename Kbuild has precedence over Makefile
16 16 kbuild-dir := $(if $(filter /%,$(src)),$(src),$(srctree)/$(src))
17 17  
... ... @@ -23,15 +23,13 @@
23 23 subdir-y += $(__subdir-y)
24 24 __subdir-m := $(patsubst %/,%,$(filter %/, $(obj-m)))
25 25 subdir-m += $(__subdir-m)
26   -__subdir-n := $(patsubst %/,%,$(filter %/, $(obj-n)))
27   -subdir-n += $(__subdir-n)
28 26 __subdir- := $(patsubst %/,%,$(filter %/, $(obj-)))
29 27 subdir- += $(__subdir-)
30 28  
31 29 # Subdirectories we need to descend into
32 30  
33 31 subdir-ym := $(sort $(subdir-y) $(subdir-m))
34   -subdir-ymn := $(sort $(subdir-ym) $(subdir-n) $(subdir-))
  32 +subdir-ymn := $(sort $(subdir-ym) $(subdir-))
35 33  
36 34 # Add subdir path
37 35  
... ... @@ -2073,6 +2073,7 @@
2073 2073 sub dump_function($$) {
2074 2074 my $prototype = shift;
2075 2075 my $file = shift;
  2076 + my $noret = 0;
2076 2077  
2077 2078 $prototype =~ s/^static +//;
2078 2079 $prototype =~ s/^extern +//;
2079 2080  
... ... @@ -2084,9 +2085,10 @@
2084 2085 $prototype =~ s/^noinline +//;
2085 2086 $prototype =~ s/__init +//;
2086 2087 $prototype =~ s/__init_or_module +//;
  2088 + $prototype =~ s/__meminit +//;
2087 2089 $prototype =~ s/__must_check +//;
2088 2090 $prototype =~ s/__weak +//;
2089   - $prototype =~ s/^#\s*define\s+//; #ak added
  2091 + my $define = $prototype =~ s/^#\s*define\s+//; #ak added
2090 2092 $prototype =~ s/__attribute__\s*\(\([a-z,]*\)\)//;
2091 2093  
2092 2094 # Yes, this truly is vile. We are looking for:
... ... @@ -2105,7 +2107,15 @@
2105 2107 # - atomic_set (macro)
2106 2108 # - pci_match_device, __copy_to_user (long return type)
2107 2109  
2108   - if ($prototype =~ m/^()([a-zA-Z0-9_~:]+)\s*\(([^\(]*)\)/ ||
  2110 + if ($define && $prototype =~ m/^()([a-zA-Z0-9_~:]+)\s+/) {
  2111 + # This is an object-like macro, it has no return type and no parameter
  2112 + # list.
  2113 + # Function-like macros are not allowed to have spaces between
  2114 + # declaration_name and opening parenthesis (notice the \s+).
  2115 + $return_type = $1;
  2116 + $declaration_name = $2;
  2117 + $noret = 1;
  2118 + } elsif ($prototype =~ m/^()([a-zA-Z0-9_~:]+)\s*\(([^\(]*)\)/ ||
2109 2119 $prototype =~ m/^(\w+)\s+([a-zA-Z0-9_~:]+)\s*\(([^\(]*)\)/ ||
2110 2120 $prototype =~ m/^(\w+\s*\*)\s*([a-zA-Z0-9_~:]+)\s*\(([^\(]*)\)/ ||
2111 2121 $prototype =~ m/^(\w+\s+\w+)\s+([a-zA-Z0-9_~:]+)\s*\(([^\(]*)\)/ ||
... ... @@ -2140,7 +2150,7 @@
2140 2150 # of warnings goes sufficiently down, the check is only performed in
2141 2151 # verbose mode.
2142 2152 # TODO: always perform the check.
2143   - if ($verbose) {
  2153 + if ($verbose && !$noret) {
2144 2154 check_return_section($file, $declaration_name, $return_type);
2145 2155 }
2146 2156