File tree Expand file tree Collapse file tree 4 files changed +55
-1
lines changed Expand file tree Collapse file tree 4 files changed +55
-1
lines changed Original file line number Diff line number Diff line change @@ -33,6 +33,8 @@ libtool
3333* ~
3434* .log
3535* .trs
36+ compile_commands.commands.json
37+ compile_commands.json
3638src /libsecp256k1-config.h
3739src /libsecp256k1-config.h.in
3840src /ecmult_static_context.h
Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ addons:
1212 - libgmp-dev
1313 - valgrind
1414 - libtool-bin
15+ - bear
1516compiler :
1617 - clang
1718 - gcc
@@ -47,6 +48,7 @@ matrix:
4748 - libgmp-dev:i386
4849 - valgrind
4950 - libtool-bin
51+ - bear
5052 - libc6-dbg:i386
5153 - compiler : clang
5254 env : HOST=i686-linux-gnu
@@ -57,6 +59,7 @@ matrix:
5759 - gcc-multilib
5860 - valgrind
5961 - libtool-bin
62+ - bear
6063 - libc6-dbg:i386
6164 - compiler : gcc
6265 env : HOST=i686-linux-gnu
@@ -104,5 +107,6 @@ after_script:
104107 - cat ./exhaustive_tests.log
105108 - cat ./valgrind_ctime_test.log
106109 - cat ./bench.log
110+ - cat ./compile_commands.json
107111 - $CC --version
108112 - valgrind --version
Original file line number Diff line number Diff line change 1+ #! /bin/sh
2+
3+ set -u
4+
5+ matcher=$( cat << 'EOF '
6+ set print-matcher true
7+
8+ # expressions of any floating point type (unless in a system header)
9+ match expr(allOf(unless(isExpansionInSystemHeader()), hasType(realFloatingPointType())))
10+
11+ # calls to memcmp (secp256k1_memcmp_var should be used instead)
12+ match callExpr(callee(functionDecl(hasName("memcmp"))))
13+
14+ quit
15+ EOF
16+ )
17+
18+ output=$( echo " $matcher " | clang-query src/* .c)
19+ status=$?
20+ if [ $status -ne 0 ]
21+ then
22+ exit $status
23+ fi
24+ echo " $output "
25+ # For some reason, clang-query returns a zero status even if clang failed to process the file.
26+ # This is not a big issue. If clang errors, we'll notice that when trying to compile with clang anyway.
27+ # We still try to catch this case by grepping also for "error:".
28+ echo " $output " | grep -qE " ^Match #|error:"
29+ if [ $? -eq 0 ]
30+ then
31+ exit 1
32+ fi
33+
34+ echo
35+ exit 0
Original file line number Diff line number Diff line change 2323
2424if [ -n " $BUILD " ]
2525then
26- make -j2 " $BUILD "
26+ if [ " $TRAVIS_COMPILER " = " clang" ]
27+ then
28+ # Use bear to generate compile_commands.json
29+ # This needs to be the first make command because otherwise make does not invoke the compiler because the files are up to date.
30+ # This needs to be a separate make command because bear does not seem to like our "make check".
31+ bear -- make -j2
32+ fi
33+ make -j2 " $BUILD "
2734fi
2835if [ " $RUN_VALGRIND " = " yes" ]
2936then
@@ -66,3 +73,9 @@ if [ "$CTIMETEST" = "yes" ]
6673then
6774 ./libtool --mode=execute valgrind --error-exitcode=42 ./valgrind_ctime_test > valgrind_ctime_test.log 2>&1
6875fi
76+
77+ # This would also run on gcc builds but there's no need to run it for both compilers.
78+ if [ " $TRAVIS_COMPILER " = " clang" ]
79+ then
80+ ./clang-query.sh
81+ fi
You can’t perform that action at this time.
0 commit comments