Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
84 changes: 0 additions & 84 deletions templates/linux/cc_toolchain_config.bzl.template
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down Expand Up @@ -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",
Comment on lines 285 to 287
Expand Down Expand Up @@ -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,
Expand Down
160 changes: 0 additions & 160 deletions templates/linux/cc_toolchain_flags.bzl.template
Original file line number Diff line number Diff line change
Expand Up @@ -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",
])

84 changes: 0 additions & 84 deletions templates/qnx/cc_toolchain_config.bzl.template
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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,
Expand Down
Loading
Loading