1
0
Fork 0

Add "warnmore" build-type to the build script

This commit is contained in:
krcroft 2019-12-10 17:08:45 -08:00 committed by Patryk Obara
parent 5beac8e310
commit 92266db4f6
3 changed files with 27 additions and 16 deletions

View file

@ -3,17 +3,21 @@ cc="clang${postfix}"
cxx="clang++${postfix}"
# Flag additions
TYPES+=("debug" "profile")
cflags_release=("${cflags[@]}" "-Os")
cflags_debug=("${cflags[@]}" "-g" "-Og" "-fno-omit-frame-pointer")
cflags_profile=("${cflags_debug[@]}" "-fprofile-instr-generate" "-fcoverage-mapping")
TYPES+=(debug warnmore profile)
cflags_release=("${cflags[@]}" -Os)
cflags_debug=("${cflags[@]}" -g -Og -fno-omit-frame-pointer)
cflags_profile=("${cflags_debug[@]}" -fprofile-instr-generate -fcoverage-mapping)
cflags_warnmore=("${cflags_debug[@]}" -Wextra -Wshadow -Wcast-align -Wunused
-Woverloaded-virtual -Wpedantic -Wconversion -Wsign-conversion
-Wdouble-promotion -Wformat=2)
cxxonly_warnmore=(-Wnon-virtual-dtor -Woverloaded-virtual)
# Colorize output only for interactive shells
if [[ $- == *i* ]]; then
cflags+=("-fcolor-diagnostics")
cflags+=(-fcolor-diagnostics)
fi
# Modifier additions
MODIFIERS=("fdo")
ldflags_fdo=("-fprofile-instr-generate")
MODIFIERS=(fdo)
ldflags_fdo=(-fprofile-instr-generate)
cflags_fdo=("-fprofile-sample-use=${FDO_FILE:-}")

View file

@ -1,14 +1,15 @@
# Tools and flags for all compilers
VARIABLES=("ar" "cc" "cxx" "ld" "ranlib" "cflags" "ldflags" "libs")
VARIABLES=(ar cc cxx ld ranlib cflags cxxonly ldflags libs)
ar=""
cc=""
cxx=""
ld=""
ranlib=""
cflags=("-Wall" "-pipe")
cflags=(-Wall -pipe)
cxxonly=("")
ldflags=("")
libs=("")
# Builds for all compilers
TYPES=("release")
TYPES=(release)
cflags_release=("${cflags[@]}" -DNDEBUG)

View file

@ -6,12 +6,18 @@ ld="gcc${postfix}"
ranlib="gcc-ranlib${postfix}"
# Flag additions
TYPES+=("debug" "profile")
cflags+=("-fstack-protector" "-fdiagnostics-color=auto")
cflags_release=("${cflags[@]}" "-Ofast" "-ffunction-sections" "-fdata-sections")
cflags_debug=("${cflags[@]}" "-g" "-Og" "-fno-omit-frame-pointer")
cflags_profile=("${cflags_debug[@]}" "-pg")
TYPES+=(debug warnmore profile)
cflags+=(-fstack-protector -fdiagnostics-color=auto)
cflags_debug=("${cflags[@]}" -g -Og -fno-omit-frame-pointer)
cflags_release=("${cflags[@]}" -Ofast -ffunction-sections -fdata-sections)
cflags_profile=("${cflags_debug[@]}" -pg)
cflags_warnmore=("${cflags_debug[@]}" -pedantic -Wcast-align -Wdouble-promotion
-Wduplicated-branches -Wduplicated-cond -Wextra -Wformat=2
-Wlogical-op -Wmisleading-indentation -Wnull-dereference
-Wshadow -Wunused)
cxxonly_warnmore=(-Weffc++ -Wnon-virtual-dtor -Woverloaded-virtual -Wuseless-cast)
# Modifier additions
MODIFIERS=("fdo")
MODIFIERS=(fdo)
cflags_fdo=("-fauto-profile=${FDO_FILE:-}")