From 92266db4f6ff5d4d1b5579b40b6ff1b1a8537c19 Mon Sep 17 00:00:00 2001 From: krcroft Date: Tue, 10 Dec 2019 17:08:45 -0800 Subject: [PATCH] Add "warnmore" build-type to the build script --- scripts/automator/build/clang-defaults | 18 +++++++++++------- scripts/automator/build/compiler-defaults | 7 ++++--- scripts/automator/build/gcc-defaults | 18 ++++++++++++------ 3 files changed, 27 insertions(+), 16 deletions(-) diff --git a/scripts/automator/build/clang-defaults b/scripts/automator/build/clang-defaults index bac59575..d577cbd5 100644 --- a/scripts/automator/build/clang-defaults +++ b/scripts/automator/build/clang-defaults @@ -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:-}") diff --git a/scripts/automator/build/compiler-defaults b/scripts/automator/build/compiler-defaults index 33ffc290..376a0266 100644 --- a/scripts/automator/build/compiler-defaults +++ b/scripts/automator/build/compiler-defaults @@ -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) diff --git a/scripts/automator/build/gcc-defaults b/scripts/automator/build/gcc-defaults index 3674d9f9..6497c6e4 100644 --- a/scripts/automator/build/gcc-defaults +++ b/scripts/automator/build/gcc-defaults @@ -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:-}")