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
33
33
* ~
34
34
* .log
35
35
* .trs
36
+ compile_commands.commands.json
37
+ compile_commands.json
36
38
src /libsecp256k1-config.h
37
39
src /libsecp256k1-config.h.in
38
40
src /ecmult_static_context.h
Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ addons:
12
12
- libgmp-dev
13
13
- valgrind
14
14
- libtool-bin
15
+ - bear
15
16
compiler :
16
17
- clang
17
18
- gcc
@@ -47,6 +48,7 @@ matrix:
47
48
- libgmp-dev:i386
48
49
- valgrind
49
50
- libtool-bin
51
+ - bear
50
52
- libc6-dbg:i386
51
53
- compiler : clang
52
54
env : HOST=i686-linux-gnu
@@ -57,6 +59,7 @@ matrix:
57
59
- gcc-multilib
58
60
- valgrind
59
61
- libtool-bin
62
+ - bear
60
63
- libc6-dbg:i386
61
64
- compiler : gcc
62
65
env : HOST=i686-linux-gnu
@@ -104,5 +107,6 @@ after_script:
104
107
- cat ./exhaustive_tests.log
105
108
- cat ./valgrind_ctime_test.log
106
109
- cat ./bench.log
110
+ - cat ./compile_commands.json
107
111
- $CC --version
108
112
- 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 23
23
24
24
if [ -n " $BUILD " ]
25
25
then
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
+ # We need to update this to "bear -- make" when we move to bear 3.0.
31
+ bear make -j2
32
+ fi
33
+ make -j2 " $BUILD "
27
34
fi
28
35
if [ " $RUN_VALGRIND " = " yes" ]
29
36
then
@@ -66,3 +73,9 @@ if [ "$CTIMETEST" = "yes" ]
66
73
then
67
74
./libtool --mode=execute valgrind --error-exitcode=42 ./valgrind_ctime_test > valgrind_ctime_test.log 2>&1
68
75
fi
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