Commit af487e4209ef5e82b1932b8b15fd59efbd56a955

Authored by Linus Torvalds

Merge branch 'misc' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild

Pull kbuild misc changes from Michal Marek:
 "This is the non-critical part of kbuild

   - scripts/kernel-doc requires a "Return:" section for non-void
     functions
   - ARCH=arm SUBARCH=... support for make tags
   - COMPILED_SOURCE=1 support for make tags (only indexes .c files for
     which a .o exists)
   - New coccinelle check
   - Option parsing fix for scripts/config"

* 'misc' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild:
  scripts/config: Fix wrong "shift" for --keep-case
  scripts/tags.sh: Support compiled source
  scripts/tags.sh: Support subarch for ARM
  scripts/coccinelle/misc/warn.cocci: use WARN
  scripts/kernel-doc: check that non-void fcts describe their return value
  Kernel-doc: Convention: Use a "Return" section to describe return values

Showing 3 changed files Side-by-side Diff

scripts/coccinelle/misc/warn.cocci
  1 +/// Use WARN(1,...) rather than printk followed by WARN_ON(1)
  2 +///
  3 +// Confidence: High
  4 +// Copyright: (C) 2012 Julia Lawall, INRIA/LIP6. GPLv2.
  5 +// Copyright: (C) 2012 Gilles Muller, INRIA/LiP6. GPLv2.
  6 +// URL: http://coccinelle.lip6.fr/
  7 +// Comments:
  8 +// Options: -no_includes -include_headers
  9 +
  10 +virtual patch
  11 +virtual context
  12 +virtual org
  13 +virtual report
  14 +
  15 +@bad1@
  16 +position p;
  17 +@@
  18 +
  19 +printk(...);
  20 +printk@p(...);
  21 +WARN_ON(1);
  22 +
  23 +@r1 depends on context || report || org@
  24 +position p != bad1.p;
  25 +@@
  26 +
  27 + printk@p(...);
  28 +*WARN_ON(1);
  29 +
  30 +@script:python depends on org@
  31 +p << r1.p;
  32 +@@
  33 +
  34 +cocci.print_main("printk + WARN_ON can be just WARN",p)
  35 +
  36 +@script:python depends on report@
  37 +p << r1.p;
  38 +@@
  39 +
  40 +msg = "SUGGESTION: printk + WARN_ON can be just WARN"
  41 +coccilib.report.print_report(p[0],msg)
  42 +
  43 +@ok1 depends on patch@
  44 +expression list es;
  45 +position p != bad1.p;
  46 +@@
  47 +
  48 +-printk@p(
  49 ++WARN(1,
  50 + es);
  51 +-WARN_ON(1);
  52 +
  53 +@depends on patch@
  54 +expression list ok1.es;
  55 +@@
  56 +
  57 +if (...)
  58 +- {
  59 + WARN(1,es);
  60 +- }
  61 +
  62 +// --------------------------------------------------------------------
  63 +
  64 +@bad2@
  65 +position p;
  66 +@@
  67 +
  68 +printk(...);
  69 +printk@p(...);
  70 +WARN_ON_ONCE(1);
  71 +
  72 +@r2 depends on context || report || org@
  73 +position p != bad1.p;
  74 +@@
  75 +
  76 + printk@p(...);
  77 +*WARN_ON_ONCE(1);
  78 +
  79 +@script:python depends on org@
  80 +p << r2.p;
  81 +@@
  82 +
  83 +cocci.print_main("printk + WARN_ON_ONCE can be just WARN_ONCE",p)
  84 +
  85 +@script:python depends on report@
  86 +p << r2.p;
  87 +@@
  88 +
  89 +msg = "SUGGESTION: printk + WARN_ON_ONCE can be just WARN_ONCE"
  90 +coccilib.report.print_report(p[0],msg)
  91 +
  92 +@ok2 depends on patch@
  93 +expression list es;
  94 +position p != bad2.p;
  95 +@@
  96 +
  97 +-printk@p(
  98 ++WARN_ONCE(1,
  99 + es);
  100 +-WARN_ON_ONCE(1);
  101 +
  102 +@depends on patch@
  103 +expression list ok2.es;
  104 +@@
  105 +
  106 +if (...)
  107 +- {
  108 + WARN_ONCE(1,es);
  109 +- }
... ... @@ -101,7 +101,6 @@
101 101 case "$CMD" in
102 102 --keep-case|-k)
103 103 MUNGE_CASE=no
104   - shift
105 104 continue
106 105 ;;
107 106 --refresh)
... ... @@ -48,13 +48,14 @@
48 48 for i in $archincludedir; do
49 49 prune="$prune -wholename $i -prune -o"
50 50 done
51   - find ${tree}arch/$1 $ignore $prune -name "$2" -print;
  51 + find ${tree}arch/$1 $ignore $subarchprune $prune -name "$2" -print;
52 52 }
53 53  
54 54 # find sources in arch/$1/include
55 55 find_arch_include_sources()
56 56 {
57   - include=$(find ${tree}arch/$1/ -name include -type d);
  57 + include=$(find ${tree}arch/$1/ $subarchprune \
  58 + -name include -type d -print);
58 59 if [ -n "$include" ]; then
59 60 archincludedir="$archincludedir $include"
60 61 find $include $ignore -name "$2" -print;
... ... @@ -95,6 +96,32 @@
95 96 find_other_sources '*.[chS]'
96 97 }
97 98  
  99 +all_compiled_sources()
  100 +{
  101 + for i in $(all_sources); do
  102 + case "$i" in
  103 + *.[cS])
  104 + j=${i/\.[cS]/\.o}
  105 + if [ -e $j ]; then
  106 + echo $i
  107 + fi
  108 + ;;
  109 + *)
  110 + echo $i
  111 + ;;
  112 + esac
  113 + done
  114 +}
  115 +
  116 +all_target_sources()
  117 +{
  118 + if [ -n "$COMPILED_SOURCE" ]; then
  119 + all_compiled_sources
  120 + else
  121 + all_sources
  122 + fi
  123 +}
  124 +
98 125 all_kconfigs()
99 126 {
100 127 for arch in $ALLSOURCE_ARCHS; do
101 128  
102 129  
... ... @@ -110,18 +137,18 @@
110 137  
111 138 docscope()
112 139 {
113   - (echo \-k; echo \-q; all_sources) > cscope.files
  140 + (echo \-k; echo \-q; all_target_sources) > cscope.files
114 141 cscope -b -f cscope.out
115 142 }
116 143  
117 144 dogtags()
118 145 {
119   - all_sources | gtags -i -f -
  146 + all_target_sources | gtags -i -f -
120 147 }
121 148  
122 149 exuberant()
123 150 {
124   - all_sources | xargs $1 -a \
  151 + all_target_sources | xargs $1 -a \
125 152 -I __initdata,__exitdata,__acquires,__releases \
126 153 -I __read_mostly,____cacheline_aligned \
127 154 -I ____cacheline_aligned_in_smp \
... ... @@ -173,7 +200,7 @@
173 200  
174 201 emacs()
175 202 {
176   - all_sources | xargs $1 -a \
  203 + all_target_sources | xargs $1 -a \
177 204 --regex='/^(ENTRY|_GLOBAL)(\([^)]*\)).*/\2/' \
178 205 --regex='/^SYSCALL_DEFINE[0-9]?(\([^,)]*\).*/sys_\1/' \
179 206 --regex='/^TRACE_EVENT(\([^,)]*\).*/trace_\1/' \
180 207  
... ... @@ -220,11 +247,10 @@
220 247 elif $1 --version 2>&1 | grep -iq emacs; then
221 248 emacs $1
222 249 else
223   - all_sources | xargs $1 -a
  250 + all_target_sources | xargs $1 -a
224 251 fi
225 252 }
226 253  
227   -
228 254 # Support um (which uses SUBARCH)
229 255 if [ "${ARCH}" = "um" ]; then
230 256 if [ "$SUBARCH" = "i386" ]; then
... ... @@ -234,6 +260,21 @@
234 260 else
235 261 archinclude=${SUBARCH}
236 262 fi
  263 +elif [ "${SRCARCH}" = "arm" -a "${SUBARCH}" != "" ]; then
  264 + subarchdir=$(find ${tree}arch/$SRCARCH/ -name "mach-*" -type d -o \
  265 + -name "plat-*" -type d);
  266 + for i in $subarchdir; do
  267 + case "$i" in
  268 + *"mach-"${SUBARCH})
  269 + ;;
  270 + *"plat-"${SUBARCH})
  271 + ;;
  272 + *)
  273 + subarchprune="$subarchprune \
  274 + -wholename $i -prune -o"
  275 + ;;
  276 + esac
  277 + done
237 278 fi
238 279  
239 280 remove_structs=