Bläddra i källkod

- small example of implementing functions_undocumented.sh using Coccinelle's spatch, may serve as a basis for more elaborated static checks...

Olivier Aumage 13 år sedan
förälder
incheckning
30a31a49e8
2 ändrade filer med 33 tillägg och 0 borttagningar
  1. 13 0
      tools/dev/starpu_funcs.cocci
  2. 20 0
      tools/dev/starpu_funcs.sh

+ 13 - 0
tools/dev/starpu_funcs.cocci

@@ -0,0 +1,13 @@
+@starpufunc@
+position p;
+type t;
+identifier f =~ "^starpu_";
+@@
+
+t f@p( ... );
+
+@ script:python @
+p << starpufunc.p;
+f  << starpufunc.f;
+@@
+print "%s:%s,%s" % (f,p[0].file,p[0].line)

+ 20 - 0
tools/dev/starpu_funcs.sh

@@ -0,0 +1,20 @@
+#!/bin/bash
+# Note: expects Coccinelle's spatch command n the PATH
+# See: http://coccinelle.lip6.fr/
+
+stcolor=$(tput sgr0)
+redcolor=$(tput setaf 1)
+greencolor=$(tput setaf 2)
+
+functions=$(spatch -sp_file tools/dev/starpu_funcs.cocci $(find include -name '*.h'))
+for func in $functions ; do
+	fname=$(echo $func|awk -F ':' '{print $1}')
+	location=$(echo $func|awk -F ':' '{print $2}')
+	x=$(grep $fname doc/starpu.texi | grep deftypefun)
+	if test "$x" == "" ; then
+		echo "function ${redcolor}${fname}${stcolor} at location $location is not (or incorrectly) documented"
+	else
+		echo "function ${greencolor}${fname}${stcolor} at location $location is correctly documented"
+	fi
+
+done