summaryrefslogtreecommitdiff
path: root/other/analysis
diff options
context:
space:
mode:
authoriphydf <iphydf@users.noreply.github.com>2018-02-23 02:22:38 +0000
committeriphydf <iphydf@users.noreply.github.com>2018-02-24 22:20:22 +0000
commitd3b286cb434ed228e7b62cc70cb293e7a5554bfa (patch)
tree9ab3dd66f9dba2ca861ba8c6e098fb96754aa80b /other/analysis
parentafc80922e720f5d2a93bdfb3745da058e5ddf81b (diff)
Fix a bunch of compiler warnings and remove suppressions.
Diffstat (limited to 'other/analysis')
-rw-r--r--other/analysis/gen-file.sh48
-rwxr-xr-xother/analysis/run-clang7
-rwxr-xr-xother/analysis/run-cppcheck7
-rwxr-xr-xother/analysis/run-gcc72
-rwxr-xr-xother/analysis/run-infer10
-rwxr-xr-xother/analysis/run-sparse9
6 files changed, 153 insertions, 0 deletions
diff --git a/other/analysis/gen-file.sh b/other/analysis/gen-file.sh
new file mode 100644
index 00000000..710e20d7
--- /dev/null
+++ b/other/analysis/gen-file.sh
@@ -0,0 +1,48 @@
1CPPFLAGS="-DMIN_LOGGER_LEVEL=LOG_TRACE -Iauto_tests -Itoxcore -Itoxav -Itoxencryptsave `pkg-config --cflags libsodium opus vpx`"
2
3put() {
4 if [ "$SKIP_LINES" = "" ]; then
5 echo "#line 1 \"$1\"" >> test.c
6 fi
7 cat $1 >> test.c
8}
9
10:> test.c
11
12put toxcore/tox.c
13
14put toxcore/DHT.c
15put toxcore/LAN_discovery.c
16put toxcore/Messenger.c
17put toxcore/TCP_client.c
18put toxcore/TCP_connection.c
19put toxcore/TCP_server.c
20put toxcore/crypto_core.c
21put toxcore/crypto_core_mem.c
22put toxcore/friend_connection.c
23put toxcore/friend_requests.c
24put toxcore/group.c
25put toxcore/list.c
26put toxcore/logger.c
27put toxcore/network.c
28put toxcore/net_crypto.c
29put toxcore/onion.c
30put toxcore/onion_announce.c
31put toxcore/onion_client.c
32put toxcore/ping.c
33put toxcore/ping_array.c
34put toxcore/tox_api.c
35put toxcore/util.c
36
37# Not included yet, since there are too many issues with this code.
38#put toxav/audio.c
39#put toxav/bwcontroller.c
40#put toxav/groupav.c
41#put toxav/msi.c
42#put toxav/ring_buffer.c
43#put toxav/rtp.c
44#put toxav/toxav.c
45#put toxav/toxav_old.c
46#put toxav/video.c
47
48put toxencryptsave/toxencryptsave.c
diff --git a/other/analysis/run-clang b/other/analysis/run-clang
new file mode 100755
index 00000000..1c8da7ea
--- /dev/null
+++ b/other/analysis/run-clang
@@ -0,0 +1,7 @@
1#!/bin/sh
2
3. other/analysis/gen-file.sh
4
5put auto_tests/lan_discovery_test.c
6
7clang --analyze test.c $CPPFLAGS
diff --git a/other/analysis/run-cppcheck b/other/analysis/run-cppcheck
new file mode 100755
index 00000000..9e928c9a
--- /dev/null
+++ b/other/analysis/run-cppcheck
@@ -0,0 +1,7 @@
1#!/bin/sh
2
3. other/analysis/gen-file.sh
4
5put auto_tests/lan_discovery_test.c
6
7cppcheck test.c $CPPFLAGS
diff --git a/other/analysis/run-gcc b/other/analysis/run-gcc
new file mode 100755
index 00000000..ffd42f4e
--- /dev/null
+++ b/other/analysis/run-gcc
@@ -0,0 +1,72 @@
1#!/bin/sh
2
3. other/analysis/gen-file.sh
4
5put auto_tests/lan_discovery_test.c
6
7# TODO(iphydf): Get rid of all VLAs, then enable -fstack-protector -Wstack-protector
8gcc -O3 -c -o /dev/null test.c $CPPFLAGS \
9 -std=c99 \
10 -pedantic \
11 -Wall \
12 -Wextra \
13 -Wno-aggregate-return \
14 -Wno-aggressive-loop-optimizations \
15 -Wno-float-conversion \
16 -Wno-format-signedness \
17 -Wno-missing-field-initializers \
18 -Wno-padded \
19 -Wno-sign-compare \
20 -Wno-sign-conversion \
21 -Wno-switch-default \
22 -Wno-unused-parameter \
23 -Wstrict-aliasing=0 \
24 -Wstrict-overflow=1 \
25 \
26 -Wbad-function-cast \
27 -Wmissing-declarations \
28 -Wmissing-parameter-type \
29 -Wmissing-prototypes \
30 -Wnested-externs \
31 -Wold-style-declaration \
32 -Wold-style-definition \
33 -Wstrict-prototypes \
34 -Wbool-compare \
35 -Wc99-c11-compat \
36 -Wc++-compat \
37 -Wcast-align \
38 -Wcast-qual \
39 -Wchar-subscripts \
40 -Wdouble-promotion \
41 -Wduplicated-cond \
42 -Wempty-body \
43 -Wenum-compare \
44 -Wfloat-equal \
45 -Wformat=2 \
46 -Wframe-address \
47 -Wframe-larger-than=133168 \
48 -Wjump-misses-init \
49 -Wignored-qualifiers \
50 -Wignored-attributes \
51 -Wincompatible-pointer-types \
52 -Winit-self \
53 -Winline \
54 -Wlarger-than=133120 \
55 -Wmaybe-uninitialized \
56 -Wmemset-transposed-args \
57 -Wmisleading-indentation \
58 -Wnonnull \
59 -Wnonnull-compare \
60 -Wnull-dereference \
61 -Wodr \
62 -Wredundant-decls \
63 -Wreturn-type \
64 -Wshadow \
65 -Wsuggest-attribute=format \
66 -Wundef \
67 -Wunsafe-loop-optimizations \
68 -Wunused-label \
69 -Wunused-local-typedefs \
70 -Wunused-value \
71 -Wunused-but-set-parameter \
72 -Wunused-but-set-variable \
diff --git a/other/analysis/run-infer b/other/analysis/run-infer
new file mode 100755
index 00000000..942d0cfd
--- /dev/null
+++ b/other/analysis/run-infer
@@ -0,0 +1,10 @@
1#!/bin/sh
2
3# Infer ignores everything that's not in the "current file".
4SKIP_LINES=1
5
6. other/analysis/gen-file.sh
7
8put auto_tests/lan_discovery_test.c
9
10infer -- clang -fsyntax-only test.c $CPPFLAGS
diff --git a/other/analysis/run-sparse b/other/analysis/run-sparse
new file mode 100755
index 00000000..b4d0f736
--- /dev/null
+++ b/other/analysis/run-sparse
@@ -0,0 +1,9 @@
1#!/bin/sh
2
3. other/analysis/gen-file.sh
4
5put auto_tests/lan_discovery_test.c
6
7sparse test.c $CPPFLAGS \
8 -Wsparse-all \
9 -Wno-declaration-after-statement