Skip to content

Commit

Permalink
Add swift.treat_warnings_as_errors feature (#1147)
Browse files Browse the repository at this point in the history
This makes it easier for you to negate this feature and not have to
worry about command line flag ordering
  • Loading branch information
keith authored Jan 12, 2024
1 parent 0919507 commit a0af0c0
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
14 changes: 14 additions & 0 deletions swift/internal/compiling.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ load(
"SWIFT_FEATURE_SUPPORTS_LIBRARY_EVOLUTION",
"SWIFT_FEATURE_SUPPORTS_SYSTEM_MODULE_FLAG",
"SWIFT_FEATURE_SYSTEM_MODULE",
"SWIFT_FEATURE_TREAT_WARNINGS_AS_ERRORS",
"SWIFT_FEATURE_USE_C_MODULES",
"SWIFT_FEATURE_USE_EXPLICIT_SWIFT_MODULE_MAP",
"SWIFT_FEATURE_USE_GLOBAL_INDEX_STORE",
Expand Down Expand Up @@ -527,6 +528,19 @@ def compile_action_configs(
features = [SWIFT_FEATURE_ENABLE_TESTING],
),

# Enable warnings-as-errors if requested.
swift_toolchain_config.action_config(
actions = [
swift_action_names.COMPILE,
swift_action_names.DERIVE_FILES,
swift_action_names.DUMP_AST,
],
configurators = [
swift_toolchain_config.add_arg("-warnings-as-errors"),
],
features = [SWIFT_FEATURE_TREAT_WARNINGS_AS_ERRORS],
),

# Set Developer Framework search paths
swift_toolchain_config.action_config(
actions = [
Expand Down
3 changes: 3 additions & 0 deletions swift/internal/feature_names.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -336,3 +336,6 @@ SWIFT_FEATURE__FORCE_ALWAYSLINK_TRUE = "swift._force_alwayslink_true"
# 5.9 and above). Users should never manually enable, disable, or query this
# feature.
SWIFT_FEATURE__SUPPORTS_MACROS = "swift._supports_macros"

# Pass -warnings-as-errors to the compiler.
SWIFT_FEATURE_TREAT_WARNINGS_AS_ERRORS = "swift.treat_warnings_as_errors"

0 comments on commit a0af0c0

Please sign in to comment.