Skip to content

Commit f79b453

Browse files
committed
Check that the string table does not include unused entries
1 parent 61ca5df commit f79b453

File tree

2 files changed

+37
-0
lines changed

2 files changed

+37
-0
lines changed

.travis.yml

+7
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,13 @@ jobs:
3838
script: scripts/travis_lint.sh
3939
before_cache:
4040

41+
- &string-table-check
42+
stage: Linter + Doxygen + non-debug Ubuntu/gcc-5 test
43+
env: NAME="string-table"
44+
install:
45+
script: scripts/string_table_check.sh
46+
before_cache:
47+
4148
- stage: Linter + Doxygen + non-debug Ubuntu/gcc-5 test
4249
env: NAME="DOXYGEN-CHECK"
4350
addons:

scripts/string_table_check.sh

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#!/bin/bash
2+
3+
whitelist=" \
4+
"
5+
6+
cleanup()
7+
{
8+
rm -f "$ids_file"
9+
}
10+
11+
ids_file=$(mktemp)
12+
13+
trap cleanup EXIT
14+
15+
gcc -E -P -x c src/util/irep_ids.def \
16+
-D'IREP_ID_ONE(x)=ID_ ## x' -D'IREP_ID_TWO(x,y)=ID_ ## x' > $ids_file
17+
18+
for w in $whitelist
19+
do
20+
perl -p -i -e "s/^$w\n//" $ids_file
21+
done
22+
23+
for i in $(<$ids_file)
24+
do
25+
if ! git grep -w -q -c -F $i
26+
then
27+
echo "$i is never used"
28+
exit 1
29+
fi
30+
done

0 commit comments

Comments
 (0)