diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2014-10-14 09:27:48 +0200 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-10-14 09:27:48 +0200 |
commit | da92da3638a04894afdca8b99e973ddd20268471 (patch) | |
tree | b24fbfb46d75632104ddb6ada7d95d0321222143 /scripts | |
parent | f33a3faa25c569d2a7640de66bea69e15c12ecd1 (diff) | |
parent | 4204111c028d492019e4440d12e9e3d062db4283 (diff) | |
download | op-kernel-dev-da92da3638a04894afdca8b99e973ddd20268471.zip op-kernel-dev-da92da3638a04894afdca8b99e973ddd20268471.tar.gz |
Merge branch 'misc' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild
Pull misc kbuild updates from Michal Marek:
"This is the less critical kbuild stuff for v3.18-rc1:
- make deb-pkg debuginfo fix, ppc64el support and warning fix for
recent dpkg tools
- make TAGS fixes
- new coccinelle patch
- kbuild documentation improvements"
* 'misc' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild:
deb-pkg: remove obsolete -isp option to dpkg-gencontrol
coccinelle: misc: semantic patch to delete overly complex return code processing
deb-pkg: Add support for powerpc little endian
builddeb: put the dbg files into the correct directory
scripts/tags.sh: fix DEFINE_HASHTABLE in emacs case
scripts/tags.sh: remove *PCGFLAGS regular expressions
scripts/tags.sh: Don't specify kind-spec for emacs' ctags/etags
Documentation: kbuild: Improve grammar
Documentation: kbuild: Remove obsolete dtc_cpp section
Documentation: kbuild: Improve if_changed documentation
Documentation: kbuild: Remove obsolete include/asm symlink step
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/coccinelle/misc/simple_return.cocci | 180 | ||||
-rwxr-xr-x | scripts/package/builddeb | 26 | ||||
-rwxr-xr-x | scripts/tags.sh | 10 |
3 files changed, 193 insertions, 23 deletions
diff --git a/scripts/coccinelle/misc/simple_return.cocci b/scripts/coccinelle/misc/simple_return.cocci new file mode 100644 index 0000000..47f7084 --- /dev/null +++ b/scripts/coccinelle/misc/simple_return.cocci @@ -0,0 +1,180 @@ +/// Simplify a trivial if-return sequence. Possibly combine with a +/// preceding function call. +// +// Confidence: High +// Copyright: (C) 2014 Julia Lawall, INRIA/LIP6. GPLv2. +// Copyright: (C) 2014 Gilles Muller, INRIA/LiP6. GPLv2. +// URL: http://coccinelle.lip6.fr/ +// Comments: +// Options: --no-includes --include-headers + +virtual patch +virtual context +virtual org +virtual report + +@r depends on patch@ +local idexpression e; +identifier i,f,fn; +@@ + +fn(...) { <... +- e@i = ++ return + f(...); +-if (i != 0) return i; +-return 0; +...> } + +@depends on patch@ +identifier r.i; +type t; +@@ + +-t i; + ... when != i + +@depends on patch@ +expression e; +@@ + +-if (e != 0) + return e; +-return 0; + +// ----------------------------------------------------------------------- + +@s1 depends on context || org || report@ +local idexpression e; +identifier i,f,fn; +position p,p1,p2; +@@ + +fn(...) { <... +* e@i@p = f(...); + if (\(i@p1 != 0\|i@p2 < 0\)) + return i; + return 0; +...> } + +@s2 depends on context || org || report forall@ +identifier s1.i; +type t; +position q,s1.p; +expression e,f; +@@ + +* t i@q; + ... when != i + e@p = f(...); + +@s3 depends on context || org || report@ +expression e; +position p1!=s1.p1; +position p2!=s1.p2; +@@ + +*if (\(e@p1 != 0\|e@p2 < 0\)) + return e; + return 0; + +// ----------------------------------------------------------------------- + +@script:python depends on org@ +p << s1.p; +p1 << s1.p1; +q << s2.q; +@@ + +cocci.print_main("decl",q) +cocci.print_secs("use",p) +cocci.include_match(False) + +@script:python depends on org@ +p << s1.p; +p2 << s1.p2; +q << s2.q; +@@ + +cocci.print_main("decl",q) +cocci.print_secs("use with questionable test",p) +cocci.include_match(False) + +@script:python depends on org@ +p << s1.p; +p1 << s1.p1; +@@ + +cocci.print_main("use",p) + +@script:python depends on org@ +p << s1.p; +p2 << s1.p2; +@@ + +cocci.print_main("use with questionable test",p) + +@script:python depends on org@ +p << s3.p1; +@@ + +cocci.print_main("test",p) + +@script:python depends on org@ +p << s3.p2; +@@ + +cocci.print_main("questionable test",p) + +// ----------------------------------------------------------------------- + +@script:python depends on report@ +p << s1.p; +p1 << s1.p1; +q << s2.q; +@@ + +msg = "WARNING: end returns can be simpified and declaration on line %s can be dropped" % (q[0].line) +coccilib.report.print_report(p[0],msg) +cocci.include_match(False) + +@script:python depends on report@ +p << s1.p; +p1 << s1.p1; +q << s2.q +; +@@ + +msg = "WARNING: end returns may be simpified if negative or 0 value and declaration on line %s can be dropped" % (q[0].line) +coccilib.report.print_report(p[0],msg) +cocci.include_match(False) + +@script:python depends on report@ +p << s1.p; +p1 << s1.p1; +@@ + +msg = "WARNING: end returns can be simpified" +coccilib.report.print_report(p[0],msg) + +@script:python depends on report@ +p << s1.p; +p2 << s1.p2; +@@ + +msg = "WARNING: end returns can be simpified if negative or 0 value" +coccilib.report.print_report(p[0],msg) + +@script:python depends on report@ +p << s3.p1; +@@ + +msg = "WARNING: end returns can be simpified" +coccilib.report.print_report(p[0],msg) + +@script:python depends on report@ +p << s3.p2; +@@ + +msg = "WARNING: end returns can be simpified if tested value is negative or 0" +coccilib.report.print_report(p[0],msg) diff --git a/scripts/package/builddeb b/scripts/package/builddeb index 35d5a58..5972624 100755 --- a/scripts/package/builddeb +++ b/scripts/package/builddeb @@ -37,7 +37,7 @@ create_package() { s390*) debarch=s390$(grep -q CONFIG_64BIT=y $KCONFIG_CONFIG && echo x || true) ;; ppc*) - debarch=powerpc ;; + debarch=$(grep -q CPU_LITTLE_ENDIAN=y $KCONFIG_CONFIG && echo ppc64el || echo powerpc) ;; parisc*) debarch=hppa ;; mips*) @@ -64,7 +64,7 @@ create_package() { fi # Create the package - dpkg-gencontrol -isp $forcearch -Vkernel:debarch="${debarch:-$(dpkg --print-architecture)}" -p$pname -P"$pdir" + dpkg-gencontrol $forcearch -Vkernel:debarch="${debarch:-$(dpkg --print-architecture)}" -p$pname -P"$pdir" dpkg --build "$pdir" .. } @@ -152,18 +152,16 @@ if grep -q '^CONFIG_MODULES=y' $KCONFIG_CONFIG ; then rmdir "$tmpdir/lib/modules/$version" fi if [ -n "$BUILD_DEBUG" ] ; then - ( - cd $tmpdir - for module in $(find lib/modules/ -name *.ko); do - mkdir -p $(dirname $dbg_dir/usr/lib/debug/$module) - # only keep debug symbols in the debug file - $OBJCOPY --only-keep-debug $module $dbg_dir/usr/lib/debug/$module - # strip original module from debug symbols - $OBJCOPY --strip-debug $module - # then add a link to those - $OBJCOPY --add-gnu-debuglink=$dbg_dir/usr/lib/debug/$module $module - done - ) + for module in $(find $tmpdir/lib/modules/ -name *.ko -printf '%P\n'); do + module=lib/modules/$module + mkdir -p $(dirname $dbg_dir/usr/lib/debug/$module) + # only keep debug symbols in the debug file + $OBJCOPY --only-keep-debug $tmpdir/$module $dbg_dir/usr/lib/debug/$module + # strip original module from debug symbols + $OBJCOPY --strip-debug $tmpdir/$module + # then add a link to those + $OBJCOPY --add-gnu-debuglink=$dbg_dir/usr/lib/debug/$module $tmpdir/$module + done fi fi diff --git a/scripts/tags.sh b/scripts/tags.sh index 293828b..cdb491d 100755 --- a/scripts/tags.sh +++ b/scripts/tags.sh @@ -193,10 +193,6 @@ exuberant() --regex-c++='/TESTCLEARFLAG_FALSE\(([^,)]*).*/TestClearPage\1/' \ --regex-c++='/__TESTCLEARFLAG_FALSE\(([^,)]*).*/__TestClearPage\1/' \ --regex-c++='/_PE\(([^,)]*).*/PEVENT_ERRNO__\1/' \ - --regex-c++='/TESTPCGFLAG\(([^,)]*).*/PageCgroup\1/' \ - --regex-c++='/SETPCGFLAG\(([^,)]*).*/SetPageCgroup\1/' \ - --regex-c++='/CLEARPCGFLAG\(([^,)]*).*/ClearPageCgroup\1/' \ - --regex-c++='/TESTCLEARPCGFLAG\(([^,)]*).*/TestClearPageCgroup\1/' \ --regex-c++='/TASK_PFA_TEST\([^,]*,\s*([^)]*)\)/task_\1/' \ --regex-c++='/TASK_PFA_SET\([^,]*,\s*([^)]*)\)/task_set_\1/' \ --regex-c++='/TASK_PFA_CLEAR\([^,]*,\s*([^)]*)\)/task_clear_\1/'\ @@ -259,17 +255,13 @@ emacs() --regex='/__CLEARPAGEFLAG_NOOP(\([^,)]*\).*/__ClearPage\1/' \ --regex='/TESTCLEARFLAG_FALSE(\([^,)]*\).*/TestClearPage\1/' \ --regex='/__TESTCLEARFLAG_FALSE(\([^,)]*\).*/__TestClearPage\1/' \ - --regex='/TESTPCGFLAG\(([^,)]*).*/PageCgroup\1/' \ - --regex='/SETPCGFLAG\(([^,)]*).*/SetPageCgroup\1/' \ - --regex='/CLEARPCGFLAG\(([^,)]*).*/ClearPageCgroup\1/' \ - --regex='/TESTCLEARPCGFLAG\(([^,)]*).*/TestClearPageCgroup\1/' \ --regex='/TASK_PFA_TEST\([^,]*,\s*([^)]*)\)/task_\1/' \ --regex='/TASK_PFA_SET\([^,]*,\s*([^)]*)\)/task_set_\1/' \ --regex='/TASK_PFA_CLEAR\([^,]*,\s*([^)]*)\)/task_clear_\1/' \ --regex='/_PE(\([^,)]*\).*/PEVENT_ERRNO__\1/' \ --regex='/PCI_OP_READ(\([a-z]*[a-z]\).*[1-4])/pci_bus_read_config_\1/' \ --regex='/PCI_OP_WRITE(\([a-z]*[a-z]\).*[1-4])/pci_bus_write_config_\1/'\ - --regex='/DEFINE_HASHTABLE\((\w*)/\1/v/' + --regex='/[^#]*DEFINE_HASHTABLE(\([^,)]*\)/\1/' all_kconfigs | xargs $1 -a \ --regex='/^[ \t]*\(\(menu\)*config\)[ \t]+\([a-zA-Z0-9_]+\)/\3/' |