Skip to content

Commit

Permalink
Check the fuzzing compilation mode with analysers.
Browse files Browse the repository at this point in the history
  • Loading branch information
iphydf committed Dec 23, 2021
1 parent b35f5f1 commit d278b64
Show file tree
Hide file tree
Showing 3 changed files with 103 additions and 85 deletions.
52 changes: 29 additions & 23 deletions other/analysis/run-clang
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,32 @@
. other/analysis/gen-file.sh

echo "Running Clang compiler"
clang++ -o /dev/null amalgamation.cc \
"${CPPFLAGS[@]}" \
"${LDFLAGS[@]}" \
-std=c++11 \
-Werror \
-Weverything \
-Wno-alloca \
-Wno-c++98-compat-pedantic \
-Wno-c99-extensions \
-Wno-conversion \
-Wno-covered-switch-default \
-Wno-disabled-macro-expansion \
-Wno-documentation-deprecated-sync \
-Wno-global-constructors \
-Wno-missing-braces \
-Wno-missing-field-initializers \
-Wno-old-style-cast \
-Wno-padded \
-Wno-sign-compare \
-Wno-unreachable-code-return \
-Wno-unused-parameter \
-Wno-used-but-marked-unused \
-Wno-source-uses-openmp
run() {
clang++ -o /dev/null amalgamation.cc \
"${CPPFLAGS[@]}" \
"${LDFLAGS[@]}" \
"$@" \
-std=c++11 \
-Werror \
-Weverything \
-Wno-alloca \
-Wno-c++98-compat-pedantic \
-Wno-c99-extensions \
-Wno-conversion \
-Wno-covered-switch-default \
-Wno-disabled-macro-expansion \
-Wno-documentation-deprecated-sync \
-Wno-global-constructors \
-Wno-missing-braces \
-Wno-missing-field-initializers \
-Wno-old-style-cast \
-Wno-padded \
-Wno-sign-compare \
-Wno-unreachable-code-return \
-Wno-unused-parameter \
-Wno-used-but-marked-unused \
-Wno-source-uses-openmp
}

run
run -DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
12 changes: 9 additions & 3 deletions other/analysis/run-clang-analyze
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@
. other/analysis/gen-file.sh

echo "Running Clang static analyzer"
clang++ --analyze amalgamation.cc \
"${CPPFLAGS[@]}" \
-std=c++11
run() {
clang++ --analyze amalgamation.cc \
"${CPPFLAGS[@]}" \
"$@" \
-std=c++11
}

run
run -DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
124 changes: 65 additions & 59 deletions other/analysis/run-gcc
Original file line number Diff line number Diff line change
Expand Up @@ -4,62 +4,68 @@

echo "Running GCC"
# TODO(iphydf): Get rid of all VLAs, then enable -fstack-protector -Wstack-protector
g++ -O3 -o /dev/null amalgamation.cc \
"${CPPFLAGS[@]}" \
"${LDFLAGS[@]}" \
-std=c++11 \
-fdiagnostics-color=always \
-Wall \
-Wextra \
-Werror \
-Wno-aggressive-loop-optimizations \
-Wno-error=null-dereference \
-Wno-error=type-limits \
-Wno-float-conversion \
-Wno-format-signedness \
-Wno-missing-field-initializers \
-Wno-padded \
-Wno-sign-compare \
-Wno-sign-conversion \
-Wno-switch-default \
-Wno-unused-parameter \
-Wstrict-aliasing=0 \
-Wstrict-overflow=1 \
\
-Wmissing-declarations \
-Wbool-compare \
-Wcast-align \
-Wcast-qual \
-Wchar-subscripts \
-Wdouble-promotion \
-Wduplicated-cond \
-Wempty-body \
-Wenum-compare \
-Wfloat-equal \
-Wformat=2 \
-Wframe-address \
-Wframe-larger-than=133168 \
-Wignored-qualifiers \
-Wignored-attributes \
-Winit-self \
-Winline \
-Wlarger-than=133120 \
-Wmaybe-uninitialized \
-Wmemset-transposed-args \
-Wmisleading-indentation \
-Wnonnull \
-Wnonnull-compare \
-Wnull-dereference \
-Wodr \
-Wredundant-decls \
-Wreturn-type \
-Wshadow \
-Wsuggest-attribute=format \
-Wundef \
-Wunsafe-loop-optimizations \
-Wunused-label \
-Wunused-local-typedefs \
-Wunused-value \
-Wunused-but-set-parameter \
-Wunused-but-set-variable \
-fopenmp
run() {
g++ -O3 -o /dev/null amalgamation.cc \
"${CPPFLAGS[@]}" \
"${LDFLAGS[@]}" \
"$@" \
-std=c++11 \
-fdiagnostics-color=always \
-Wall \
-Wextra \
-Werror \
-Wno-aggressive-loop-optimizations \
-Wno-error=null-dereference \
-Wno-error=type-limits \
-Wno-float-conversion \
-Wno-format-signedness \
-Wno-missing-field-initializers \
-Wno-padded \
-Wno-sign-compare \
-Wno-sign-conversion \
-Wno-switch-default \
-Wno-unused-parameter \
-Wstrict-aliasing=0 \
-Wstrict-overflow=1 \
\
-Wmissing-declarations \
-Wbool-compare \
-Wcast-align \
-Wcast-qual \
-Wchar-subscripts \
-Wdouble-promotion \
-Wduplicated-cond \
-Wempty-body \
-Wenum-compare \
-Wfloat-equal \
-Wformat=2 \
-Wframe-address \
-Wframe-larger-than=133168 \
-Wignored-qualifiers \
-Wignored-attributes \
-Winit-self \
-Winline \
-Wlarger-than=133120 \
-Wmaybe-uninitialized \
-Wmemset-transposed-args \
-Wmisleading-indentation \
-Wnonnull \
-Wnonnull-compare \
-Wnull-dereference \
-Wodr \
-Wredundant-decls \
-Wreturn-type \
-Wshadow \
-Wsuggest-attribute=format \
-Wundef \
-Wunsafe-loop-optimizations \
-Wunused-label \
-Wunused-local-typedefs \
-Wunused-value \
-Wunused-but-set-parameter \
-Wunused-but-set-variable \
-fopenmp
}

run
run -DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION

0 comments on commit d278b64

Please sign in to comment.