Skip to content

Commit aa9019f

Browse files
committed
Fix bug that resulted in empty linker flags
In `9b5d663`, a bug was introduced that resulted in empty linker flags on MacOS. In Starlark, `[a] + [b] if c else []` results in `[]`, if `c` is False. To just make `[b]` conditional, parenthesis must be used: `[a] + ([b] if c else [])`.
1 parent e1db23f commit aa9019f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

cc/toolchains/llvm/unix_cc_toolchain_config.bzl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ def _impl(ctx):
298298
] if ctx.attr.opt_link_flags else []),
299299
with_features = [with_feature_set(features = ["opt"])],
300300
),
301-
] + [flag_set(
301+
] + ([flag_set(
302302
actions = all_link_actions + lto_index_actions,
303303
flag_groups = ([
304304
flag_group(
@@ -312,7 +312,7 @@ def _impl(ctx):
312312
),
313313
]),
314314
with_features = [with_feature_set(features = ["libcpp"])],
315-
)] if is_linux else [],
315+
)] if is_linux else []),
316316
)
317317

318318
dbg_feature = feature(name = "dbg")

0 commit comments

Comments
 (0)