浏览代码

coccicheck: make SPFLAGS more useful

SPFLAGS is set early, it means that any heuristics done on
coccicheck cannot be overridden currently. Move SPFLAGS
after OPTIONS and set this at the end. This lets you override
any heuristics as coccinelle treats conflicts by only listening
to the last option that makes sense.

v3: this patch was added in the v3 series
v4: Update Documentation/coccinelle.txt explaining how
    SPFLAGS works as well.

Signed-off-by: Luis R. Rodriguez <mcgrof@kernel.org>
Acked-by: Nicolas Palix <nicolas.palix@imag.fr>
Signed-off-by: Michal Marek <mmarek@suse.com>
Luis R. Rodriguez 9 年之前
父节点
当前提交
8e826ad52b
共有 2 个文件被更改,包括 6 次插入2 次删除
  1. 2 1
      Documentation/coccinelle.txt
  2. 4 1
      scripts/coccicheck

+ 2 - 1
Documentation/coccinelle.txt

@@ -146,7 +146,8 @@ MODE variable explained above.
 ~~~~~~~~~~~~~~~~~~
 ~~~~~~~~~~~~~~~~~~
 
 
 Additional flags can be passed to spatch through the SPFLAGS
 Additional flags can be passed to spatch through the SPFLAGS
-variable.
+variable. This works as Coccinelle respects the last flags
+given to it when options are in conflict.
 
 
     make SPFLAGS=--use-glimpse coccicheck
     make SPFLAGS=--use-glimpse coccicheck
     make SPFLAGS=--use-idutils coccicheck
     make SPFLAGS=--use-idutils coccicheck

+ 4 - 1
scripts/coccicheck

@@ -30,7 +30,7 @@ else
 	NPROC="$J"
 	NPROC="$J"
 fi
 fi
 
 
-FLAGS="--very-quiet $SPFLAGS"
+FLAGS="--very-quiet"
 
 
 # spatch only allows include directories with the syntax "-I include"
 # spatch only allows include directories with the syntax "-I include"
 # while gcc also allows "-Iinclude" and "-include include"
 # while gcc also allows "-Iinclude" and "-include include"
@@ -106,6 +106,9 @@ kill_running() {
 	done
 	done
 }
 }
 
 
+# You can override heuristics with SPFLAGS, these must always go last
+OPTIONS="$OPTIONS $SPFLAGS"
+
 coccinelle () {
 coccinelle () {
     COCCI="$1"
     COCCI="$1"