From 176d09827725e82ad3f628f7a33ebbc4e93aa41a Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Thu, 30 Oct 2014 11:06:13 +0900 Subject: 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 Signed-off-by: Michal Marek Signed-off-by: Randy Dunlap Signed-off-by: Masahiro Yamada --- scripts/Kbuild.include | 18 ++++++++++-------- scripts/Makefile.build | 4 ++-- scripts/Makefile.clean | 6 ++---- scripts/kernel-doc | 16 +++++++++++++--- 4 files changed, 27 insertions(+), 17 deletions(-) (limited to 'scripts') diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include index 4c333599c1..d20f20ae32 100644 --- a/scripts/Kbuild.include +++ b/scripts/Kbuild.include @@ -177,13 +177,13 @@ ld-ifversion = $(shell [ $(call ld-version) $(1) $(2) ] && echo $(3)) # Shorthand for $(Q)$(MAKE) -f scripts/Makefile.build obj= # Usage: # $(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= # Usage: # $(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. # skip if -I has no parameter @@ -221,11 +221,13 @@ else arg-check = $(if $(strip $(cmd_$@)),,1) endif -# >'< substitution is for echo to work, -# >$< substitution to preserve $ when reloading .cmd file -# note: when using inline perl scripts [perl -e '...$$t=1;...'] -# in $(cmd_xxx) double $$ your perl vars -make-cmd = $(subst \\,\\\\,$(subst \#,\\\#,$(subst $$,$$$$,$(call escsq,$(cmd_$(1)))))) +# Replace >$< with >$$< to preserve $ when reloading the .cmd file +# (needed for make) +# Replace >#< with >\#< to avoid starting a comment in the .cmd file +# (needed for make) +# 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. # 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)), \ @set -e; \ $(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. if_changed_dep = $(if $(strip $(any-prereq) $(arg-check) ), \ diff --git a/scripts/Makefile.build b/scripts/Makefile.build index 3e12b57306..14cf0925d2 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build @@ -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 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 endif diff --git a/scripts/Makefile.clean b/scripts/Makefile.clean index 88f14e2d8f..21e1f21531 100644 --- a/scripts/Makefile.clean +++ b/scripts/Makefile.clean @@ -10,7 +10,7 @@ __clean: # Shorthand for $(Q)$(MAKE) scripts/Makefile.clean obj=dir # Usage: # $(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 kbuild-dir := $(if $(filter /%,$(src)),$(src),$(srctree)/$(src)) @@ -23,15 +23,13 @@ __subdir-y := $(patsubst %/,%,$(filter %/, $(obj-y))) subdir-y += $(__subdir-y) __subdir-m := $(patsubst %/,%,$(filter %/, $(obj-m))) subdir-m += $(__subdir-m) -__subdir-n := $(patsubst %/,%,$(filter %/, $(obj-n))) -subdir-n += $(__subdir-n) __subdir- := $(patsubst %/,%,$(filter %/, $(obj-))) subdir- += $(__subdir-) # Subdirectories we need to descend into subdir-ym := $(sort $(subdir-y) $(subdir-m)) -subdir-ymn := $(sort $(subdir-ym) $(subdir-n) $(subdir-)) +subdir-ymn := $(sort $(subdir-ym) $(subdir-)) # Add subdir path diff --git a/scripts/kernel-doc b/scripts/kernel-doc index c881b8cb3e..08a6c76845 100755 --- a/scripts/kernel-doc +++ b/scripts/kernel-doc @@ -2073,6 +2073,7 @@ sub check_return_section { sub dump_function($$) { my $prototype = shift; my $file = shift; + my $noret = 0; $prototype =~ s/^static +//; $prototype =~ s/^extern +//; @@ -2084,9 +2085,10 @@ sub dump_function($$) { $prototype =~ s/^noinline +//; $prototype =~ s/__init +//; $prototype =~ s/__init_or_module +//; + $prototype =~ s/__meminit +//; $prototype =~ s/__must_check +//; $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,]*\)\)//; # Yes, this truly is vile. We are looking for: @@ -2105,7 +2107,15 @@ sub dump_function($$) { # - atomic_set (macro) # - 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*\*)\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 # verbose mode. # TODO: always perform the check. - if ($verbose) { + if ($verbose && !$noret) { check_return_section($file, $declaration_name, $return_type); } -- cgit v1.2.1