Skip to content

Commit 8d9b80a

Browse files
authored
Fix bug that resulted in empty linker flags on MacOS [AP-3221] (#147)
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 8d9b80a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

cc/toolchains/llvm/unix_cc_toolchain_config.bzl

+2-2
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)