瀏覽代碼

tools/dev/checker: new script for macro usage

Nathalie Furmento 7 年之前
父節點
當前提交
f009c0da46
共有 1 個文件被更改,包括 40 次插入0 次删除
  1. 40 0
      tools/dev/checker/starpu_check_config.sh

+ 40 - 0
tools/dev/checker/starpu_check_config.sh

@@ -0,0 +1,40 @@
+#!/bin/bash
+
+# StarPU --- Runtime system for heterogeneous multicore architectures.
+#
+# Copyright (C) 2017 CNRS
+#
+# StarPU is free software; you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation; either version 2.1 of the License, or (at
+# your option) any later version.
+#
+# StarPU is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+#
+# See the GNU Lesser General Public License in COPYING.LGPL for more details.
+
+DIR=$(echo $(dirname $0)/../../../)
+
+SGREP="grep --exclude-dir=.svn --exclude-dir=.git --binary-files=without-match"
+
+for m in $(grep undef $DIR/src/common/config.h.in | awk '{print $2}' | grep -v "^PACKAGE")
+do
+    #echo Check macro $m
+    used=$($SGREP -rsl $m | grep -v Makefile | grep -v "^src" | grep -v configure | grep -v autom4 | grep -v "gcc-plugin" | grep -v "mpi/src" | grep -v "tests/helper.h" | grep -v m4 | grep -v doc )
+    if test -n "$used"
+    then
+	#echo "Checking $m is defined in include config"
+	count=$(grep -c $m $DIR/include/starpu_config.h.in)
+	if test $count == 0
+	then
+	    echo "Error: Macro $m is not defined in include/starpu_config.h.in"
+	    echo "but is used in"
+	    echo $used |  tr ' ' '\012'
+	    echo
+	fi
+    fi
+done
+
+