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>
This commit is contained in:
parent
ad618992f7
commit
176d098277
2
Makefile
2
Makefile
@ -1444,7 +1444,7 @@ endif
|
|||||||
# Shorthand for $(Q)$(MAKE) -f scripts/Makefile.clean obj=dir
|
# Shorthand for $(Q)$(MAKE) -f scripts/Makefile.clean obj=dir
|
||||||
# Usage:
|
# Usage:
|
||||||
# $(Q)$(MAKE) $(clean)=dir
|
# $(Q)$(MAKE) $(clean)=dir
|
||||||
clean := -f $(if $(KBUILD_SRC),$(srctree)/)scripts/Makefile.clean obj
|
clean := -f $(srctree)/scripts/Makefile.clean obj
|
||||||
|
|
||||||
endif # skip-makefile
|
endif # skip-makefile
|
||||||
|
|
||||||
|
@ -177,13 +177,13 @@ ld-ifversion = $(shell [ $(call ld-version) $(1) $(2) ] && echo $(3))
|
|||||||
# Shorthand for $(Q)$(MAKE) -f scripts/Makefile.build obj=
|
# Shorthand for $(Q)$(MAKE) -f scripts/Makefile.build obj=
|
||||||
# Usage:
|
# Usage:
|
||||||
# $(Q)$(MAKE) $(build)=dir
|
# $(Q)$(MAKE) $(build)=dir
|
||||||
build := -f $(if $(KBUILD_SRC),$(srctree)/)scripts/Makefile.build obj
|
build := -f $(srctree)/scripts/Makefile.build obj
|
||||||
|
|
||||||
###
|
###
|
||||||
# Shorthand for $(Q)$(MAKE) -f scripts/Makefile.modbuiltin obj=
|
# Shorthand for $(Q)$(MAKE) -f scripts/Makefile.modbuiltin obj=
|
||||||
# Usage:
|
# Usage:
|
||||||
# $(Q)$(MAKE) $(modbuiltin)=dir
|
# $(Q)$(MAKE) $(modbuiltin)=dir
|
||||||
modbuiltin := -f $(if $(KBUILD_SRC),$(srctree)/)scripts/Makefile.modbuiltin obj
|
modbuiltin := -f $(srctree)/scripts/Makefile.modbuiltin obj
|
||||||
|
|
||||||
# Prefix -I with $(srctree) if it is not an absolute path.
|
# Prefix -I with $(srctree) if it is not an absolute path.
|
||||||
# skip if -I has no parameter
|
# skip if -I has no parameter
|
||||||
@ -221,11 +221,13 @@ else
|
|||||||
arg-check = $(if $(strip $(cmd_$@)),,1)
|
arg-check = $(if $(strip $(cmd_$@)),,1)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# >'< substitution is for echo to work,
|
# Replace >$< with >$$< to preserve $ when reloading the .cmd file
|
||||||
# >$< substitution to preserve $ when reloading .cmd file
|
# (needed for make)
|
||||||
# note: when using inline perl scripts [perl -e '...$$t=1;...']
|
# Replace >#< with >\#< to avoid starting a comment in the .cmd file
|
||||||
# in $(cmd_xxx) double $$ your perl vars
|
# (needed for make)
|
||||||
make-cmd = $(subst \\,\\\\,$(subst \#,\\\#,$(subst $$,$$$$,$(call escsq,$(cmd_$(1))))))
|
# Replace >'< with >'\''< to be able to enclose the whole string in '...'
|
||||||
|
# (needed for the shell)
|
||||||
|
make-cmd = $(call escsq,$(subst \#,\\\#,$(subst $$,$$$$,$(cmd_$(1)))))
|
||||||
|
|
||||||
# Find any prerequisites that is newer than target or that does not exist.
|
# Find any prerequisites that is newer than target or that does not exist.
|
||||||
# PHONY targets skipped in both cases.
|
# PHONY targets skipped in both cases.
|
||||||
@ -236,7 +238,7 @@ any-prereq = $(filter-out $(PHONY),$?) $(filter-out $(PHONY) $(wildcard $^),$^)
|
|||||||
if_changed = $(if $(strip $(any-prereq) $(arg-check)), \
|
if_changed = $(if $(strip $(any-prereq) $(arg-check)), \
|
||||||
@set -e; \
|
@set -e; \
|
||||||
$(echo-cmd) $(cmd_$(1)); \
|
$(echo-cmd) $(cmd_$(1)); \
|
||||||
echo 'cmd_$@ := $(make-cmd)' > $(dot-target).cmd)
|
printf '%s\n' 'cmd_$@ := $(make-cmd)' > $(dot-target).cmd)
|
||||||
|
|
||||||
# Execute the command and also postprocess generated .d dependencies file.
|
# Execute the command and also postprocess generated .d dependencies file.
|
||||||
if_changed_dep = $(if $(strip $(any-prereq) $(arg-check) ), \
|
if_changed_dep = $(if $(strip $(any-prereq) $(arg-check) ), \
|
||||||
|
@ -97,11 +97,11 @@ endif
|
|||||||
|
|
||||||
# ===========================================================================
|
# ===========================================================================
|
||||||
|
|
||||||
ifneq ($(strip $(lib-y) $(lib-m) $(lib-n) $(lib-)),)
|
ifneq ($(strip $(lib-y) $(lib-m) $(lib-)),)
|
||||||
lib-target := $(obj)/lib.a
|
lib-target := $(obj)/lib.a
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifneq ($(strip $(obj-y) $(obj-m) $(obj-n) $(obj-) $(subdir-m) $(lib-target)),)
|
ifneq ($(strip $(obj-y) $(obj-m) $(obj-) $(subdir-m) $(lib-target)),)
|
||||||
builtin-target := $(obj)/built-in.o
|
builtin-target := $(obj)/built-in.o
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ __clean:
|
|||||||
# Shorthand for $(Q)$(MAKE) scripts/Makefile.clean obj=dir
|
# Shorthand for $(Q)$(MAKE) scripts/Makefile.clean obj=dir
|
||||||
# Usage:
|
# Usage:
|
||||||
# $(Q)$(MAKE) $(clean)=dir
|
# $(Q)$(MAKE) $(clean)=dir
|
||||||
clean := -f $(if $(KBUILD_SRC),$(srctree)/)scripts/Makefile.clean obj
|
clean := -f $(srctree)/scripts/Makefile.clean obj
|
||||||
|
|
||||||
# The filename Kbuild has precedence over Makefile
|
# The filename Kbuild has precedence over Makefile
|
||||||
kbuild-dir := $(if $(filter /%,$(src)),$(src),$(srctree)/$(src))
|
kbuild-dir := $(if $(filter /%,$(src)),$(src),$(srctree)/$(src))
|
||||||
@ -23,15 +23,13 @@ __subdir-y := $(patsubst %/,%,$(filter %/, $(obj-y)))
|
|||||||
subdir-y += $(__subdir-y)
|
subdir-y += $(__subdir-y)
|
||||||
__subdir-m := $(patsubst %/,%,$(filter %/, $(obj-m)))
|
__subdir-m := $(patsubst %/,%,$(filter %/, $(obj-m)))
|
||||||
subdir-m += $(__subdir-m)
|
subdir-m += $(__subdir-m)
|
||||||
__subdir-n := $(patsubst %/,%,$(filter %/, $(obj-n)))
|
|
||||||
subdir-n += $(__subdir-n)
|
|
||||||
__subdir- := $(patsubst %/,%,$(filter %/, $(obj-)))
|
__subdir- := $(patsubst %/,%,$(filter %/, $(obj-)))
|
||||||
subdir- += $(__subdir-)
|
subdir- += $(__subdir-)
|
||||||
|
|
||||||
# Subdirectories we need to descend into
|
# Subdirectories we need to descend into
|
||||||
|
|
||||||
subdir-ym := $(sort $(subdir-y) $(subdir-m))
|
subdir-ym := $(sort $(subdir-y) $(subdir-m))
|
||||||
subdir-ymn := $(sort $(subdir-ym) $(subdir-n) $(subdir-))
|
subdir-ymn := $(sort $(subdir-ym) $(subdir-))
|
||||||
|
|
||||||
# Add subdir path
|
# Add subdir path
|
||||||
|
|
||||||
|
@ -2073,6 +2073,7 @@ sub check_return_section {
|
|||||||
sub dump_function($$) {
|
sub dump_function($$) {
|
||||||
my $prototype = shift;
|
my $prototype = shift;
|
||||||
my $file = shift;
|
my $file = shift;
|
||||||
|
my $noret = 0;
|
||||||
|
|
||||||
$prototype =~ s/^static +//;
|
$prototype =~ s/^static +//;
|
||||||
$prototype =~ s/^extern +//;
|
$prototype =~ s/^extern +//;
|
||||||
@ -2084,9 +2085,10 @@ sub dump_function($$) {
|
|||||||
$prototype =~ s/^noinline +//;
|
$prototype =~ s/^noinline +//;
|
||||||
$prototype =~ s/__init +//;
|
$prototype =~ s/__init +//;
|
||||||
$prototype =~ s/__init_or_module +//;
|
$prototype =~ s/__init_or_module +//;
|
||||||
|
$prototype =~ s/__meminit +//;
|
||||||
$prototype =~ s/__must_check +//;
|
$prototype =~ s/__must_check +//;
|
||||||
$prototype =~ s/__weak +//;
|
$prototype =~ s/__weak +//;
|
||||||
$prototype =~ s/^#\s*define\s+//; #ak added
|
my $define = $prototype =~ s/^#\s*define\s+//; #ak added
|
||||||
$prototype =~ s/__attribute__\s*\(\([a-z,]*\)\)//;
|
$prototype =~ s/__attribute__\s*\(\([a-z,]*\)\)//;
|
||||||
|
|
||||||
# Yes, this truly is vile. We are looking for:
|
# Yes, this truly is vile. We are looking for:
|
||||||
@ -2105,7 +2107,15 @@ sub dump_function($$) {
|
|||||||
# - atomic_set (macro)
|
# - atomic_set (macro)
|
||||||
# - pci_match_device, __copy_to_user (long return type)
|
# - pci_match_device, __copy_to_user (long return type)
|
||||||
|
|
||||||
if ($prototype =~ m/^()([a-zA-Z0-9_~:]+)\s*\(([^\(]*)\)/ ||
|
if ($define && $prototype =~ m/^()([a-zA-Z0-9_~:]+)\s+/) {
|
||||||
|
# This is an object-like macro, it has no return type and no parameter
|
||||||
|
# list.
|
||||||
|
# Function-like macros are not allowed to have spaces between
|
||||||
|
# declaration_name and opening parenthesis (notice the \s+).
|
||||||
|
$return_type = $1;
|
||||||
|
$declaration_name = $2;
|
||||||
|
$noret = 1;
|
||||||
|
} elsif ($prototype =~ m/^()([a-zA-Z0-9_~:]+)\s*\(([^\(]*)\)/ ||
|
||||||
$prototype =~ m/^(\w+)\s+([a-zA-Z0-9_~:]+)\s*\(([^\(]*)\)/ ||
|
$prototype =~ m/^(\w+)\s+([a-zA-Z0-9_~:]+)\s*\(([^\(]*)\)/ ||
|
||||||
$prototype =~ m/^(\w+\s*\*)\s*([a-zA-Z0-9_~:]+)\s*\(([^\(]*)\)/ ||
|
$prototype =~ m/^(\w+\s*\*)\s*([a-zA-Z0-9_~:]+)\s*\(([^\(]*)\)/ ||
|
||||||
$prototype =~ m/^(\w+\s+\w+)\s+([a-zA-Z0-9_~:]+)\s*\(([^\(]*)\)/ ||
|
$prototype =~ m/^(\w+\s+\w+)\s+([a-zA-Z0-9_~:]+)\s*\(([^\(]*)\)/ ||
|
||||||
@ -2140,7 +2150,7 @@ sub dump_function($$) {
|
|||||||
# of warnings goes sufficiently down, the check is only performed in
|
# of warnings goes sufficiently down, the check is only performed in
|
||||||
# verbose mode.
|
# verbose mode.
|
||||||
# TODO: always perform the check.
|
# TODO: always perform the check.
|
||||||
if ($verbose) {
|
if ($verbose && !$noret) {
|
||||||
check_return_section($file, $declaration_name, $return_type);
|
check_return_section($file, $declaration_name, $return_type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user