diff --git a/templates/linux/cc_toolchain_config.bzl.template b/templates/linux/cc_toolchain_config.bzl.template index 3a8fbdb..7046ad5 100644 --- a/templates/linux/cc_toolchain_config.bzl.template +++ b/templates/linux/cc_toolchain_config.bzl.template @@ -39,16 +39,6 @@ load(":flags.bzl", "DEFAULT_LINK_FLAGS", "DBG_COMPILE_FLAGS", "OPT_COMPILE_FLAGS", - "MINIMAL_WARNINGS_FLAGS", - "MINIMAL_C_WARNINGS_FLAGS", - "MINIMAL_CXX_WARNINGS_FLAGS", - "STRICT_WARNINGS_FLAGS", - "STRICT_C_WARNINGS_FLAGS", - "STRICT_CXX_WARNINGS_FLAGS", - "ALL_WALL_WARNINGS", - "ALL_WALL_C_WARNINGS", - "ALL_WALL_CXX_WARNINGS", - "WARNINGS_AS_ERRORS", ) all_cpp_compile_actions = [ @@ -292,76 +282,6 @@ def _impl(ctx): ], ) - minimal_warnings_feature = feature( - name = "minimal_warnings", - enabled = False, - flag_sets = [ - flag_set( - actions = all_compile_actions, - flag_groups = MINIMAL_WARNINGS_FLAGS, - ), - flag_set( - actions = all_c_compile_actions, - flag_groups = MINIMAL_C_WARNINGS_FLAGS, - ), - flag_set( - actions = all_cpp_compile_actions, - flag_groups = MINIMAL_CXX_WARNINGS_FLAGS, - ), - ], - ) - - strict_warnings_feature = feature( - name = "strict_warnings", - implies = ["minimal_warnings"], - enabled = False, - flag_sets = [ - flag_set( - actions = all_compile_actions, - flag_groups = STRICT_WARNINGS_FLAGS, - ), - flag_set( - actions = all_cpp_compile_actions, - flag_groups = STRICT_CXX_WARNINGS_FLAGS, - ), - flag_set( - actions = all_c_compile_actions, - flag_groups = STRICT_C_WARNINGS_FLAGS, - ), - ], - ) - - all_wall_warnings_feature = feature( - name = "all_wall_warnings", - implies = ["strict_warnings"], - enabled = False, - flag_sets = [ - flag_set( - actions = all_compile_actions, - flag_groups = ALL_WALL_WARNINGS, - ), - flag_set( - actions = all_c_compile_actions, - flag_groups = ALL_WALL_C_WARNINGS, - ), - flag_set( - actions = all_cpp_compile_actions, - flag_groups = ALL_WALL_CXX_WARNINGS, - ), - ], - ) - - warnings_as_errors_feature = feature( - name = "warnings_as_errors", - enabled = False, - flag_sets = [ - flag_set( - actions = all_compile_actions, - flag_groups = WARNINGS_AS_ERRORS, - ), - ], - ) - extra_compile_flags = %{extra_compile_flags} extra_compile_flags_feature = feature( name = "extra_compile_flags", @@ -1047,10 +967,6 @@ def _impl(ctx): fully_static_link_feature, sysroot_link_flags_feature, pthread_feature, - minimal_warnings_feature, - strict_warnings_feature, - all_wall_warnings_feature, - warnings_as_errors_feature, extra_compile_flags_feature, extra_c_compile_flags_feature, extra_cxx_compile_flags_feature, diff --git a/templates/linux/cc_toolchain_flags.bzl.template b/templates/linux/cc_toolchain_flags.bzl.template index b42f862..416275e 100644 --- a/templates/linux/cc_toolchain_flags.bzl.template +++ b/templates/linux/cc_toolchain_flags.bzl.template @@ -93,163 +93,3 @@ DEFAULT_LINK_FLAGS = get_flag_group([ "-static-libgcc", ]) -# Minimal set of warning flags to enable useful warnings without overwhelming the user. -# ----------------------------------------------------------------------------- -# MINIMAL: The Base Group -# ----------------------------------------------------------------------------- -MINIMAL_WARNINGS_FLAGS = get_flag_group([ - "-Wall", - "-Wcast-align", - "-Wcast-qual", - "-Wformat-nonliteral", - "-Wformat-signedness", - "-Wformat=2", - "-Wmissing-format-attribute", - "-Wpointer-arith", - "-Wredundant-decls", - "-Wreturn-local-addr", - "-Wsizeof-array-argument", - "-Wundef", - "-Wwrite-strings", -]) - -MINIMAL_C_WARNINGS_FLAGS = get_flag_group([ - "-Wbad-function-cast", - "-Wmissing-prototypes", -]) - -MINIMAL_CXX_WARNINGS_FLAGS = get_flag_group([ - "-Wodr", - "-Wreorder", -]) - -# ----------------------------------------------------------------------------- -# STRICT: Extends MINIMAL -# (Excludes flags already defined in MINIMAL) -# ----------------------------------------------------------------------------- -STRICT_WARNINGS_FLAGS = get_flag_group([ - "-Wbool-compare", - "-Wconversion", - "-Wdouble-promotion", - "-Wextra", - "-Winvalid-pch", - "-Wlogical-not-parentheses", - "-Wlogical-op", - "-Wpedantic", - "-Wswitch-bool", - "-Wunused-but-set-parameter", - "-Wvla", -]) - -STRICT_C_WARNINGS_FLAGS = get_flag_group([ - # No additional strict C warnings for now -]) - -STRICT_CXX_WARNINGS_FLAGS = get_flag_group([ - "-Wnarrowing", -]) - -# ----------------------------------------------------------------------------- -# ALL: Extends STRICT -# (Excludes flags already defined in MINIMAL or STRICT) -# ----------------------------------------------------------------------------- -ALL_WALL_C_WARNINGS = get_flag_group([ - "-Wimplicit", - "-Wimplicit-function-declaration", - "-Wimplicit-int", - "-Wpointer-sign", - "-Wvla-parameter", -]) - -ALL_WALL_CXX_WARNINGS = get_flag_group([ - "-Waligned-new", - "-Wc++11-compat", - "-Wc++14-compat", - "-Wc++17-compat", - "-Wc++20-compat", - "-Wcatch-value", - "-Wclass-memaccess", - "-Wdelete-non-virtual-dtor", - # "-Wenum-int-mismatch", not supported in GCC12.2 - # "-Wargument-mismatch", cc1plus: warning: command-line option '-Wduplicate-decl-specifier' is valid for C/ObjC but not for C++ - "-Wmismatched-new-delete", - "-Woverloaded-virtual", - # -Woverloaded-virtual=1, not supported in GCC12.2 - "-Wpessimizing-move", - "-Wrange-loop-construct", - # "-Wself-move", not supported in GCC12.2 - "-Wuseless-cast", -]) - -ALL_WALL_WARNINGS = get_flag_group([ - "-Waddress", - "-Warray-bounds=1", - "-Warray-compare", - "-Warray-parameter=2", - "-Wbool-operation", - "-Wchar-subscripts", - "-Wcomment", - "-Wdangling-else", - "-Wdangling-pointer=2", - "-Wduplicate-decl-specifier", - "-Wenum-compare", - "-Wformat-contains-nul", - "-Wformat-diag", - "-Wformat-extra-args", - "-Wformat-overflow=1", - "-Wformat-truncation=1", - "-Wformat-zero-length", - "-Wformat=1", - "-Wframe-address", - "-Winfinite-recursion", - "-Winit-self", - "-Wint-in-bool-context", - "-Wmain", - "-Wmaybe-uninitialized", - "-Wmemset-elt-size", - "-Wmemset-transposed-args", - "-Wmisleading-indentation", - "-Wmismatched-dealloc", - "-Wmissing-attributes", - "-Wmissing-braces", - "-Wmultistatement-macros", - "-Wnonnull", - "-Wnonnull-compare", - "-Wopenmp-simd", - "-Wpacked-not-aligned", - "-Wparentheses", - "-Wrestrict", - "-Wreturn-type", - "-Wsequence-point", - "-Wsign-compare", - "-Wsizeof-array-div", - "-Wsizeof-pointer-div", - "-Wsizeof-pointer-memaccess", - "-Wstrict-aliasing", - "-Wstrict-overflow=1", - "-Wswitch", - "-Wtautological-compare", - "-Wtrigraphs", - "-Wuninitialized", - "-Wunknown-pragmas", - "-Wunused", - "-Wunused-but-set-variable", - "-Wunused-const-variable=1", - "-Wunused-function", - "-Wunused-label", - "-Wunused-local-typedefs", - "-Wunused-value", - "-Wunused-variable", - "-Wuse-after-free=2", - "-Wvolatile-register-var", - "-Wzero-length-bounds", -]) - -# ----------------------------------------------------------------------------- -# : Turn all warinings into errors -# ----------------------------------------------------------------------------- -WARNINGS_AS_ERRORS = get_flag_group([ - "-Werror", - "-Wno-error=deprecated-declarations", -]) - diff --git a/templates/qnx/cc_toolchain_config.bzl.template b/templates/qnx/cc_toolchain_config.bzl.template index 861378b..08f0bab 100644 --- a/templates/qnx/cc_toolchain_config.bzl.template +++ b/templates/qnx/cc_toolchain_config.bzl.template @@ -37,16 +37,6 @@ load(":flags.bzl", "DEFAULT_LINK_FLAGS", "DBG_COMPILE_FLAGS", "OPT_COMPILE_FLAGS", - "MINIMAL_WARNINGS_FLAGS", - "MINIMAL_C_WARNINGS_FLAGS", - "MINIMAL_CXX_WARNINGS_FLAGS", - "STRICT_WARNINGS_FLAGS", - "STRICT_C_WARNINGS_FLAGS", - "STRICT_CXX_WARNINGS_FLAGS", - "ALL_WALL_WARNINGS", - "ALL_WALL_C_WARNINGS", - "ALL_WALL_CXX_WARNINGS", - "WARNINGS_AS_ERRORS", ) all_cpp_compile_actions = [ @@ -549,76 +539,6 @@ def _impl(ctx): ], ) - minimal_warnings_feature = feature( - name = "minimal_warnings", - enabled = True, - flag_sets = [ - flag_set( - actions = all_compile_actions, - flag_groups = MINIMAL_WARNINGS_FLAGS, - ), - flag_set( - actions = all_c_compile_actions, - flag_groups = MINIMAL_C_WARNINGS_FLAGS, - ), - flag_set( - actions = all_cpp_compile_actions, - flag_groups = MINIMAL_CXX_WARNINGS_FLAGS, - ), - ], - ) - - strict_warnings_feature = feature( - name = "strict_warnings", - implies = ["minimal_warnings"], - enabled = False, - flag_sets = [ - flag_set( - actions = all_compile_actions, - flag_groups = STRICT_WARNINGS_FLAGS, - ), - flag_set( - actions = all_cpp_compile_actions, - flag_groups = STRICT_CXX_WARNINGS_FLAGS, - ), - flag_set( - actions = all_c_compile_actions, - flag_groups = STRICT_C_WARNINGS_FLAGS, - ), - ], - ) - - all_wall_warnings_feature = feature( - name = "all_wall_warnings", - implies = ["strict_warnings"], - enabled = False, - flag_sets = [ - flag_set( - actions = all_compile_actions, - flag_groups = ALL_WALL_WARNINGS, - ), - flag_set( - actions = all_c_compile_actions, - flag_groups = ALL_WALL_C_WARNINGS, - ), - flag_set( - actions = all_cpp_compile_actions, - flag_groups = ALL_WALL_CXX_WARNINGS, - ), - ], - ) - - warnings_as_errors_feature = feature( - name = "warnings_as_errors", - enabled = False, - flag_sets = [ - flag_set( - actions = all_compile_actions, - flag_groups = WARNINGS_AS_ERRORS, - ), - ], - ) - extra_compile_flags = %{extra_compile_flags} extra_compile_flags_feature = feature( name = "extra_compile_flags", @@ -822,10 +742,6 @@ def _impl(ctx): shared_flag_feature, output_execpath_flags_feature, libraries_to_link_feature, - minimal_warnings_feature, - strict_warnings_feature, - all_wall_warnings_feature, - warnings_as_errors_feature, extra_compile_flags_feature, extra_link_flags_feature, opt_feature, diff --git a/templates/qnx/cc_toolchain_flags.bzl.template b/templates/qnx/cc_toolchain_flags.bzl.template index ba18bc6..52c2bf3 100644 --- a/templates/qnx/cc_toolchain_flags.bzl.template +++ b/templates/qnx/cc_toolchain_flags.bzl.template @@ -79,41 +79,3 @@ DEFAULT_LINK_FLAGS = get_flag_group([ "-lm", "-Wl,--pop-state", ]) - -# Minimal set of warning flags to enable useful warnings without overwhelming the user. -# ----------------------------------------------------------------------------- -# MINIMAL: The Base Group -# ----------------------------------------------------------------------------- -MINIMAL_WARNINGS_FLAGS = get_flag_group([ - "-Wall", - "-Wno-error=deprecated-declarations", - "-Wno-error=mismatched-new-delete", # See what we will do with this (only on GCC12.2.0 supported!) -]) -MINIMAL_C_WARNINGS_FLAGS = get_flag_group([]) -MINIMAL_CXX_WARNINGS_FLAGS = get_flag_group([]) - -# ----------------------------------------------------------------------------- -# STRICT: Extends MINIMAL -# (Excludes flags already defined in MINIMAL) -# ----------------------------------------------------------------------------- -STRICT_WARNINGS_FLAGS = get_flag_group([ - "-Wextra", - "-Wpedantic", -]) -STRICT_C_WARNINGS_FLAGS = get_flag_group([]) -STRICT_CXX_WARNINGS_FLAGS = get_flag_group([]) - -# ----------------------------------------------------------------------------- -# ALL: Extends STRICT -# (Excludes flags already defined in MINIMAL or STRICT) -# ----------------------------------------------------------------------------- -ALL_WALL_C_WARNINGS = get_flag_group([]) -ALL_WALL_CXX_WARNINGS = get_flag_group([]) -ALL_WALL_WARNINGS = get_flag_group([]) - -# ----------------------------------------------------------------------------- -# : Turn all warinings into errors -# ----------------------------------------------------------------------------- -WARNINGS_AS_ERRORS = get_flag_group([ - "-Werror", -])