Skip to content

Commit 71d0916

Browse files
authored
[libc][bazel] Fold "libc_function_deps" into "deps" for libc_tests. (#135835)
libc_function_deps and deps are now identical, as we no longer need or have special treatment for libc_function targets. Merge these attributes passed to the libc_test macro, and fix all relevant libc_test macro invocations. This change is a no-op. This concludes cleanup started in 9b13d34.
1 parent 517605c commit 71d0916

File tree

13 files changed

+208
-281
lines changed

13 files changed

+208
-281
lines changed

utils/bazel/llvm-project-overlay/libc/test/libc_test_rules.bzl

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,13 @@ When performing tests we make sure to always use the internal version.
1515
load("//libc:libc_build_rules.bzl", "libc_common_copts")
1616
load("//libc:libc_configure_options.bzl", "LIBC_CONFIGURE_OPTIONS")
1717

18-
def libc_test(name, libc_function_deps = [], copts = [], deps = [], local_defines = [], **kwargs):
18+
def libc_test(name, copts = [], deps = [], local_defines = [], **kwargs):
1919
"""Add target for a libc test.
2020
2121
Args:
2222
name: Test target name
23-
libc_function_deps: List of libc_function targets used by this test.
2423
copts: The list of options to add to the C++ compilation command.
25-
deps: The list of other libraries to be linked in to the test target.
24+
deps: The list of libc functions and libraries to be linked in.
2625
local_defines: The list of target local_defines if any.
2726
**kwargs: Attributes relevant for a cc_test.
2827
"""
@@ -37,7 +36,7 @@ def libc_test(name, libc_function_deps = [], copts = [], deps = [], local_define
3736
"//libc:func_free",
3837
"//libc:func_malloc",
3938
"//libc:func_realloc",
40-
] + libc_function_deps + deps,
39+
] + deps,
4140
copts = copts + libc_common_copts(),
4241
linkstatic = 1,
4342
**kwargs

utils/bazel/llvm-project-overlay/libc/test/src/complex/BUILD.bazel

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@ load("//libc/test:libc_test_rules.bzl", "libc_test")
77
"CImagTest.h",
88
func_name + "_test.cpp",
99
],
10-
libc_function_deps = ["//libc:func_name".replace("func_name", func_name)],
11-
deps = [
10+
deps = ["//libc:func_name".replace("func_name", func_name)] + [
1211
"//libc:hdr_math_macros",
1312
"//libc/test/UnitTest:fp_test_helpers",
1413
],
@@ -29,8 +28,7 @@ load("//libc/test:libc_test_rules.bzl", "libc_test")
2928
"ConjTest.h",
3029
func_name + "_test.cpp",
3130
],
32-
libc_function_deps = ["//libc:func_name".replace("func_name", func_name)],
33-
deps = [
31+
deps = ["//libc:func_name".replace("func_name", func_name)] + [
3432
"//libc:hdr_math_macros",
3533
"//libc/test/UnitTest:fp_test_helpers",
3634
],
@@ -51,8 +49,7 @@ load("//libc/test:libc_test_rules.bzl", "libc_test")
5149
"CprojTest.h",
5250
func_name + "_test.cpp",
5351
],
54-
libc_function_deps = ["//libc:func_name".replace("func_name", func_name)],
55-
deps = [
52+
deps = ["//libc:func_name".replace("func_name", func_name)] + [
5653
"//libc:hdr_math_macros",
5754
"//libc/test/UnitTest:fp_test_helpers",
5855
] + (["//libc/utils/MPCWrapper:mpc_wrapper"] if func_name == "cprojf" else []),
@@ -73,8 +70,7 @@ load("//libc/test:libc_test_rules.bzl", "libc_test")
7370
"CRealTest.h",
7471
func_name + "_test.cpp",
7572
],
76-
libc_function_deps = ["//libc:func_name".replace("func_name", func_name)],
77-
deps = [
73+
deps = ["//libc:func_name".replace("func_name", func_name)] + [
7874
"//libc:hdr_math_macros",
7975
"//libc/test/UnitTest:fp_test_helpers",
8076
],

utils/bazel/llvm-project-overlay/libc/test/src/fenv/BUILD.bazel

Lines changed: 17 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,12 @@ libc_test(
1616
"exception_status_test.cpp",
1717
"excepts.h",
1818
],
19-
libc_function_deps = [
19+
deps = [
20+
"//libc:__support_fputil_fenv_impl",
2021
"//libc:feclearexcept",
2122
"//libc:feraiseexcept",
2223
"//libc:fesetexcept",
2324
"//libc:fetestexcept",
24-
],
25-
deps = [
26-
"//libc:__support_fputil_fenv_impl",
2725
"//libc:hdr_fenv_macros",
2826
"//libc/test/UnitTest:fp_test_helpers",
2927
],
@@ -35,11 +33,9 @@ libc_test(
3533
"excepts.h",
3634
"rounding_mode_test.cpp",
3735
],
38-
libc_function_deps = [
36+
deps = [
3937
"//libc:fegetround",
4038
"//libc:fesetround",
41-
],
42-
deps = [
4339
"//libc:hdr_fenv_macros",
4440
"//libc/test/UnitTest:fp_test_helpers",
4541
],
@@ -51,16 +47,14 @@ libc_test(
5147
"enabled_exceptions_test.cpp",
5248
"excepts.h",
5349
],
54-
libc_function_deps = [
55-
"//libc:feclearexcept",
56-
"//libc:feraiseexcept",
57-
"//libc:fetestexcept",
58-
],
5950
tags = ["nosan"],
6051
deps = [
6152
"//libc:__support_common",
6253
"//libc:__support_fputil_fenv_impl",
6354
"//libc:__support_macros_properties_architectures",
55+
"//libc:feclearexcept",
56+
"//libc:feraiseexcept",
57+
"//libc:fetestexcept",
6458
"//libc:hdr_fenv_macros",
6559
"//libc/test/UnitTest:fp_test_helpers",
6660
],
@@ -72,14 +66,12 @@ libc_test(
7266
"excepts.h",
7367
"feholdexcept_test.cpp",
7468
],
75-
libc_function_deps = [
76-
"//libc:feholdexcept",
77-
],
7869
tags = ["nosan"],
7970
deps = [
8071
"//libc:__support_common",
8172
"//libc:__support_fputil_fenv_impl",
8273
"//libc:__support_macros_properties_architectures",
74+
"//libc:feholdexcept",
8375
"//libc:hdr_fenv_macros",
8476
"//libc:types_fenv_t",
8577
"//libc/test/UnitTest:fp_test_helpers",
@@ -92,13 +84,11 @@ libc_test(
9284
"exception_flags_test.cpp",
9385
"excepts.h",
9486
],
95-
libc_function_deps = [
87+
deps = [
88+
"//libc:__support_fputil_fenv_impl",
9689
"//libc:fegetexceptflag",
9790
"//libc:fesetexceptflag",
9891
"//libc:fetestexceptflag",
99-
],
100-
deps = [
101-
"//libc:__support_fputil_fenv_impl",
10292
"//libc:hdr_fenv_macros",
10393
"//libc:types_fexcept_t",
10494
"//libc/test/UnitTest:fp_test_helpers",
@@ -111,11 +101,9 @@ libc_test(
111101
"excepts.h",
112102
"feclearexcept_test.cpp",
113103
],
114-
libc_function_deps = [
115-
"//libc:feclearexcept",
116-
],
117104
deps = [
118105
"//libc:__support_fputil_fenv_impl",
106+
"//libc:feclearexcept",
119107
"//libc:hdr_fenv_macros",
120108
"//libc/test/UnitTest:fp_test_helpers",
121109
],
@@ -127,14 +115,12 @@ libc_test(
127115
"excepts.h",
128116
"feenableexcept_test.cpp",
129117
],
130-
libc_function_deps = [
131-
"//libc:fedisableexcept",
132-
"//libc:feenableexcept",
133-
"//libc:fegetexcept",
134-
],
135118
deps = [
136119
"//libc:__support_common",
137120
"//libc:__support_macros_properties_architectures",
121+
"//libc:fedisableexcept",
122+
"//libc:feenableexcept",
123+
"//libc:fegetexcept",
138124
"//libc:hdr_fenv_macros",
139125
"//libc/test/UnitTest:fp_test_helpers",
140126
],
@@ -146,11 +132,9 @@ libc_test(
146132
"excepts.h",
147133
"feupdateenv_test.cpp",
148134
],
149-
libc_function_deps = [
150-
"//libc:feupdateenv",
151-
],
152135
deps = [
153136
"//libc:__support_fputil_fenv_impl",
137+
"//libc:feupdateenv",
154138
"//libc:hdr_fenv_macros",
155139
"//libc:types_fenv_t",
156140
"//libc/test/UnitTest:fp_test_helpers",
@@ -163,15 +147,13 @@ libc_test(
163147
"excepts.h",
164148
"getenv_and_setenv_test.cpp",
165149
],
166-
libc_function_deps = [
150+
deps = [
151+
"//libc:__support_fputil_fenv_impl",
152+
"//libc:__support_macros_properties_os",
167153
"//libc:fegetenv",
168154
"//libc:fegetround",
169155
"//libc:fesetenv",
170156
"//libc:fesetround",
171-
],
172-
deps = [
173-
"//libc:__support_fputil_fenv_impl",
174-
"//libc:__support_macros_properties_os",
175157
"//libc:hdr_fenv_macros",
176158
"//libc:types_fenv_t",
177159
"//libc/test/UnitTest:fp_test_helpers",

utils/bazel/llvm-project-overlay/libc/test/src/inttypes/BUILD.bazel

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,16 @@ licenses(["notice"])
1313
libc_test(
1414
name = "imaxabs_test",
1515
srcs = ["imaxabs_test.cpp"],
16-
libc_function_deps = [
16+
deps = [
1717
"//libc:imaxabs",
1818
],
1919
)
2020

2121
libc_test(
2222
name = "imaxdiv_test",
2323
srcs = ["imaxdiv_test.cpp"],
24-
libc_function_deps = [
25-
"//libc:imaxdiv",
26-
],
2724
deps = [
25+
"//libc:imaxdiv",
2826
"//libc/test/src/stdlib:div_test_helper",
2927
],
3028
)

utils/bazel/llvm-project-overlay/libc/test/src/math/libc_math_test_rules.bzl

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,7 @@ def math_test(name, hdrs = [], deps = [], **kwargs):
2323
libc_test(
2424
name = test_name,
2525
srcs = [test_name + ".cpp"] + hdrs,
26-
libc_function_deps = ["//libc:func_name".replace("func_name", name)],
27-
deps = [
26+
deps = ["//libc:func_name".replace("func_name", name)] + [
2827
"//libc:__support_cpp_algorithm",
2928
"//libc:__support_cpp_bit",
3029
"//libc:__support_cpp_limits",

utils/bazel/llvm-project-overlay/libc/test/src/stdbit/BUILD.bazel

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,12 @@ bit_prefix_list = [
3939
libc_test(
4040
name = bit_prefix + bit_suffix + "_test",
4141
srcs = [bit_prefix + bit_suffix + "_test.cpp"],
42-
libc_function_deps = ["//libc:func_name".replace(
43-
"func_name",
44-
bit_prefix + bit_suffix,
45-
)],
46-
deps = ["//libc:__support_cpp_limits"],
42+
deps = [
43+
"//libc:func_name".replace(
44+
"func_name",
45+
bit_prefix + bit_suffix,
46+
),
47+
] + ["//libc:__support_cpp_limits"],
4748
)
4849
for bit_prefix in bit_prefix_list
4950
for bit_suffix in bit_suffix_list

0 commit comments

Comments
 (0)