Skip to content

Commit ac1235d

Browse files
committed
Fix bazel rule for __support_fputil_fma when using header modules.
Putting __support/FPUtil/x86_64/FMA.h in `hdrs` will trigger a compilation action for that header, and it will always `#error` out for non-FMA targets. Move these platform-specific headers that are conditionally included to `textual_hdrs` instead.
1 parent 549e118 commit ac1235d

File tree

1 file changed

+18
-20
lines changed

1 file changed

+18
-20
lines changed

utils/bazel/llvm-project-overlay/libc/BUILD.bazel

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,13 @@ cc_library(
3636

3737
cc_library(
3838
name = "__support_cpp_array",
39-
hdrs = ["src/__support/CPP/Array.h",],
39+
hdrs = ["src/__support/CPP/Array.h"],
4040
deps = [":libc_root"],
4141
)
4242

4343
cc_library(
4444
name = "__support_cpp_array_ref",
45-
hdrs = ["src/__support/CPP/ArrayRef.h",],
45+
hdrs = ["src/__support/CPP/ArrayRef.h"],
4646
deps = [
4747
":__support_cpp_array",
4848
":__support_cpp_type_traits",
@@ -52,31 +52,31 @@ cc_library(
5252

5353
cc_library(
5454
name = "__support_cpp_bit",
55-
hdrs = ["src/__support/CPP/Bit.h",],
55+
hdrs = ["src/__support/CPP/Bit.h"],
5656
deps = [":libc_root"],
5757
)
5858

5959
cc_library(
6060
name = "__support_cpp_bitset",
61-
hdrs = ["src/__support/CPP/Bitset.h",],
61+
hdrs = ["src/__support/CPP/Bitset.h"],
6262
deps = [":libc_root"],
6363
)
6464

6565
cc_library(
6666
name = "__support_cpp_functional",
67-
hdrs = ["src/__support/CPP/Functional.h",],
67+
hdrs = ["src/__support/CPP/Functional.h"],
6868
deps = [":libc_root"],
6969
)
7070

7171
cc_library(
7272
name = "__support_cpp_limits",
73-
hdrs = ["src/__support/CPP/Limits.h",],
73+
hdrs = ["src/__support/CPP/Limits.h"],
7474
deps = [":libc_root"],
7575
)
7676

7777
cc_library(
7878
name = "__support_cpp_string_view",
79-
hdrs = ["src/__support/CPP/StringView.h",],
79+
hdrs = ["src/__support/CPP/StringView.h"],
8080
deps = [":libc_root"],
8181
)
8282

@@ -90,7 +90,7 @@ cc_library(
9090

9191
cc_library(
9292
name = "__support_cpp_utility",
93-
hdrs = ["src/__support/CPP/Utility.h",],
93+
hdrs = ["src/__support/CPP/Utility.h"],
9494
deps = [
9595
":__support_cpp_type_traits",
9696
":libc_root",
@@ -99,13 +99,13 @@ cc_library(
9999

100100
cc_library(
101101
name = "__support_cpp_vector",
102-
hdrs = ["src/__support/CPP/vector.h",],
102+
hdrs = ["src/__support/CPP/vector.h"],
103103
deps = [":libc_root"],
104104
)
105105

106106
cc_library(
107107
name = "__support_cpp_atomic",
108-
hdrs = ["src/__support/CPP/atomic.h",],
108+
hdrs = ["src/__support/CPP/atomic.h"],
109109
deps = [
110110
":__support_cpp_type_traits",
111111
":libc_root",
@@ -201,19 +201,17 @@ fma_common_hdrs = [
201201
"src/__support/FPUtil/generic/FMA.h",
202202
]
203203

204-
fma_hdrs = selects.with_or({
205-
"//conditions:default": fma_common_hdrs,
206-
PLATFORM_CPU_X86_64: fma_common_hdrs + [
207-
"src/__support/FPUtil/x86_64/FMA.h",
208-
],
209-
PLATFORM_CPU_ARM64: fma_common_hdrs + [
210-
"src/__support/FPUtil/aarch64/FMA.h",
211-
],
212-
})
204+
fma_platform_hdrs = [
205+
"src/__support/FPUtil/x86_64/FMA.h",
206+
"src/__support/FPUtil/aarch64/FMA.h",
207+
]
213208

214209
cc_library(
215210
name = "__support_fputil_fma",
216-
hdrs = fma_hdrs,
211+
hdrs = fma_common_hdrs,
212+
# These are conditionally included and will #error out if the platform
213+
# doesn't support FMA, so they can't be compiled on their own.
214+
textual_hdrs = fma_platform_hdrs,
217215
deps = [
218216
":__support_common",
219217
":__support_cpp_bit",

0 commit comments

Comments
 (0)