Skip to content

Commit a0af0c0

Browse files
authored
Add swift.treat_warnings_as_errors feature (#1147)
This makes it easier for you to negate this feature and not have to worry about command line flag ordering
1 parent 0919507 commit a0af0c0

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

swift/internal/compiling.bzl

+14
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ load(
6262
"SWIFT_FEATURE_SUPPORTS_LIBRARY_EVOLUTION",
6363
"SWIFT_FEATURE_SUPPORTS_SYSTEM_MODULE_FLAG",
6464
"SWIFT_FEATURE_SYSTEM_MODULE",
65+
"SWIFT_FEATURE_TREAT_WARNINGS_AS_ERRORS",
6566
"SWIFT_FEATURE_USE_C_MODULES",
6667
"SWIFT_FEATURE_USE_EXPLICIT_SWIFT_MODULE_MAP",
6768
"SWIFT_FEATURE_USE_GLOBAL_INDEX_STORE",
@@ -527,6 +528,19 @@ def compile_action_configs(
527528
features = [SWIFT_FEATURE_ENABLE_TESTING],
528529
),
529530

531+
# Enable warnings-as-errors if requested.
532+
swift_toolchain_config.action_config(
533+
actions = [
534+
swift_action_names.COMPILE,
535+
swift_action_names.DERIVE_FILES,
536+
swift_action_names.DUMP_AST,
537+
],
538+
configurators = [
539+
swift_toolchain_config.add_arg("-warnings-as-errors"),
540+
],
541+
features = [SWIFT_FEATURE_TREAT_WARNINGS_AS_ERRORS],
542+
),
543+
530544
# Set Developer Framework search paths
531545
swift_toolchain_config.action_config(
532546
actions = [

swift/internal/feature_names.bzl

+3
Original file line numberDiff line numberDiff line change
@@ -336,3 +336,6 @@ SWIFT_FEATURE__FORCE_ALWAYSLINK_TRUE = "swift._force_alwayslink_true"
336336
# 5.9 and above). Users should never manually enable, disable, or query this
337337
# feature.
338338
SWIFT_FEATURE__SUPPORTS_MACROS = "swift._supports_macros"
339+
340+
# Pass -warnings-as-errors to the compiler.
341+
SWIFT_FEATURE_TREAT_WARNINGS_AS_ERRORS = "swift.treat_warnings_as_errors"

0 commit comments

Comments
 (0)