diff --git a/.travis.yml b/.travis.yml index 52d548e3de..6987a0b55d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -38,6 +38,13 @@ jobs: script: scripts/travis_lint.sh before_cache: + - &string-table-check + stage: Linter + Doxygen + non-debug Ubuntu/gcc-5 test + env: NAME="string-table" + install: + script: scripts/string_table_check.sh + before_cache: + - stage: Linter + Doxygen + non-debug Ubuntu/gcc-5 test env: NAME="DOXYGEN-CHECK" addons: diff --git a/scripts/string_table_check.sh b/scripts/string_table_check.sh new file mode 100755 index 0000000000..5bf6d4b2dd --- /dev/null +++ b/scripts/string_table_check.sh @@ -0,0 +1,30 @@ +#!/bin/bash + +whitelist=" \ +" + +cleanup() +{ + rm -f "$ids_file" +} + +ids_file=$(mktemp) + +trap cleanup EXIT + +gcc -E -P -x c src/util/irep_ids.def \ + -D'IREP_ID_ONE(x)=ID_ ## x' -D'IREP_ID_TWO(x,y)=ID_ ## x' > $ids_file + +for w in $whitelist +do + perl -p -i -e "s/^$w\n//" $ids_file +done + +for i in $(<$ids_file) +do + if ! git grep -w -q -c -F $i + then + echo "$i is never used" + exit 1 + fi +done