Skip to content

Commit 9b13d34

Browse files
authored
[libc][bazel] Remove a no-op libc_internal_target macro. (#135818)
This macro is a no-op after 90c001a: libc_function macro now produce a "regular" cc_library target, without modifying its name, and this target is intended to only be used in tests. Thus, libc_internal_target macro is no longer needed, and we can safely treat libc_function rules and libc_support_library rules identically for test purposes. `libc_function_deps` attribute of a `libc_test` macro can also be cleaned up, but I plan to do this in a subsequent change.
1 parent 7a41761 commit 9b13d34

File tree

2 files changed

+6
-15
lines changed

2 files changed

+6
-15
lines changed

utils/bazel/llvm-project-overlay/libc/libc_build_rules.bzl

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,6 @@ load(":libc_configure_options.bzl", "LIBC_CONFIGURE_OPTIONS")
1010
load(":libc_namespace.bzl", "LIBC_NAMESPACE")
1111
load(":platforms.bzl", "PLATFORM_CPU_X86_64")
1212

13-
# TODO: Remove this helper function once all donwstream users are migrated.
14-
def libc_internal_target(name):
15-
return name
16-
1713
def libc_common_copts():
1814
root_label = Label(":libc")
1915
libc_include_path = paths.join(root_label.workspace_root, root_label.package)
@@ -84,10 +80,7 @@ def libc_function(name, **kwargs):
8480
# Builds "internal" library with a function, exposed as a C++ function in
8581
# the "LIBC_NAMESPACE" namespace. This allows us to test the function in the
8682
# presence of another libc.
87-
_libc_library(
88-
name = libc_internal_target(name),
89-
**kwargs
90-
)
83+
_libc_library(name = name, **kwargs)
9184

9285
LibcLibraryInfo = provider(
9386
"All source files and textual headers for building a particular library.",

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

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,34 +12,32 @@ They come in two flavors:
1212
When performing tests we make sure to always use the internal version.
1313
"""
1414

15-
load("//libc:libc_build_rules.bzl", "libc_common_copts", "libc_internal_target")
15+
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, srcs, libc_function_deps = [], copts = [], deps = [], local_defines = [], **kwargs):
18+
def libc_test(name, libc_function_deps = [], copts = [], deps = [], local_defines = [], **kwargs):
1919
"""Add target for a libc test.
2020
2121
Args:
2222
name: Test target name
23-
srcs: List of sources for the test.
2423
libc_function_deps: List of libc_function targets used by this test.
2524
copts: The list of options to add to the C++ compilation command.
2625
deps: The list of other libraries to be linked in to the test target.
2726
local_defines: The list of target local_defines if any.
28-
**kwargs: Attributes relevant for a libc_test. For example, name, srcs.
27+
**kwargs: Attributes relevant for a cc_test.
2928
"""
3029
native.cc_test(
3130
name = name,
32-
srcs = srcs,
3331
local_defines = local_defines + LIBC_CONFIGURE_OPTIONS,
34-
deps = [libc_internal_target(d) for d in libc_function_deps] + [
32+
deps = [
3533
"//libc/test/UnitTest:LibcUnitTest",
3634
"//libc:__support_macros_config",
3735
"//libc:errno",
3836
"//libc:func_aligned_alloc",
3937
"//libc:func_free",
4038
"//libc:func_malloc",
4139
"//libc:func_realloc",
42-
] + deps,
40+
] + libc_function_deps + deps,
4341
copts = copts + libc_common_copts(),
4442
linkstatic = 1,
4543
**kwargs

0 commit comments

Comments
 (0)