[libc][bazel] Added wchar functions to bazel (#146126)

Added wchar functions, apart from ones that use mbstate_t. to the bazel
files

---------

Co-authored-by: Sriya Pratipati <sriyap@google.com>
This commit is contained in:
sribee8
2025-06-30 20:05:26 +00:00
committed by GitHub
parent 163a7e1b4f
commit 4bf0c6b5f8
2 changed files with 526 additions and 0 deletions

View File

@@ -268,6 +268,19 @@ libc_support_library(
hdrs = ["hdr/unistd_overlay.h"],
)
libc_support_library(
name = "hdr_wchar_macros",
hdrs = ["hdr/wchar_macros.h"],
deps = [
":hdr_wchar_overlay",
],
)
libc_support_library(
name = "hdr_wchar_overlay",
hdrs = ["hdr/wchar_overlay.h"],
)
############################ Type Proxy Header Files ###########################
libc_support_library(
@@ -432,6 +445,22 @@ libc_support_library(
hdrs = ["hdr/types/struct_msghdr.h"],
)
libc_support_library(
name = "types_wchar_t",
hdrs = ["hdr/types/wchar_t.h"],
deps = [
":hdr_wchar_overlay",
],
)
libc_support_library(
name = "types_wint_t",
hdrs = ["hdr/types/wint_t.h"],
deps = [
":hdr_wchar_overlay",
],
)
############################### Support libraries ##############################
libc_support_library(
@@ -1645,6 +1674,16 @@ libc_support_library(
],
)
libc_support_library(
name = "__support_wctype_utils",
hdrs = ["src/__support/wctype_utils.h"],
deps = [
":__support_cpp_optional",
":__support_macros_attributes",
":__support_macros_config",
],
)
########################## externally shared targets ###########################
libc_header_library(
@@ -5685,3 +5724,276 @@ libc_function(
":types_struct_timespec",
],
)
############################## wchar targets ###############################
libc_function(
name = "btowc",
srcs = ["src/wchar/btowc.cpp"],
hdrs = ["src/wchar/btowc.h"],
deps = [
":__support_common",
":__support_macros_config",
":__support_wctype_utils",
":hdr_wchar_macros",
":types_wint_t",
],
)
libc_function(
name = "wcpcpy",
srcs = ["src/wchar/wcpcpy.cpp"],
hdrs = ["src/wchar/wcpcpy.h"],
deps = [
":__support_common",
":__support_macros_config",
":string_utils",
":types_size_t",
":types_wchar_t",
],
)
libc_function(
name = "wcpncpy",
srcs = ["src/wchar/wcpncpy.cpp"],
hdrs = ["src/wchar/wcpncpy.h"],
deps = [
":__support_common",
":__support_macros_config",
":__support_macros_null_check",
":types_size_t",
":types_wchar_t",
],
)
libc_function(
name = "wcscat",
srcs = ["src/wchar/wcscat.cpp"],
hdrs = ["src/wchar/wcscat.h"],
deps = [
":__support_common",
":__support_macros_config",
":string_utils",
":types_size_t",
":types_wchar_t",
],
)
libc_function(
name = "wcschr",
srcs = ["src/wchar/wcschr.cpp"],
hdrs = ["src/wchar/wcschr.h"],
deps = [
":__support_common",
":__support_macros_config",
":types_wchar_t",
],
)
libc_function(
name = "wcscmp",
srcs = ["src/wchar/wcscmp.cpp"],
hdrs = ["src/wchar/wcscmp.h"],
deps = [
":__support_common",
":__support_macros_null_check",
":types_size_t",
":types_wchar_t",
],
)
libc_function(
name = "wcscpy",
srcs = ["src/wchar/wcscpy.cpp"],
hdrs = ["src/wchar/wcscpy.h"],
deps = [
":__support_common",
":__support_macros_config",
":string_utils",
":types_size_t",
":types_wchar_t",
],
)
libc_function(
name = "wcslen",
srcs = ["src/wchar/wcslen.cpp"],
hdrs = ["src/wchar/wcslen.h"],
deps = [
":__support_common",
":__support_macros_config",
":string_utils",
":types_size_t",
":types_wchar_t",
],
)
libc_function(
name = "wcsncat",
srcs = ["src/wchar/wcsncat.cpp"],
hdrs = ["src/wchar/wcsncat.h"],
deps = [
":__support_common",
":__support_macros_config",
":string_utils",
":types_size_t",
":types_wchar_t",
],
)
libc_function(
name = "wcsncmp",
srcs = ["src/wchar/wcsncmp.cpp"],
hdrs = ["src/wchar/wcsncmp.h"],
deps = [
":__support_common",
":__support_macros_null_check",
":types_size_t",
":types_wchar_t",
],
)
libc_function(
name = "wcsncpy",
srcs = ["src/wchar/wcsncpy.cpp"],
hdrs = ["src/wchar/wcsncpy.h"],
deps = [
":__support_common",
":__support_macros_config",
":types_size_t",
":types_wchar_t",
],
)
libc_function(
name = "wcspbrk",
srcs = ["src/wchar/wcspbrk.cpp"],
hdrs = ["src/wchar/wcspbrk.h"],
deps = [
":__support_common",
":__support_macros_null_check",
":types_wchar_t",
],
)
libc_function(
name = "wcsrchr",
srcs = ["src/wchar/wcsrchr.cpp"],
hdrs = ["src/wchar/wcsrchr.h"],
deps = [
":__support_common",
":__support_macros_config",
":__support_macros_null_check",
":types_wchar_t",
],
)
libc_function(
name = "wcsspn",
srcs = ["src/wchar/wcsspn.cpp"],
hdrs = ["src/wchar/wcsspn.h"],
deps = [
":__support_common",
":__support_macros_config",
":types_size_t",
":types_wchar_t",
],
)
libc_function(
name = "wcsstr",
srcs = ["src/wchar/wcsstr.cpp"],
hdrs = ["src/wchar/wcsstr.h"],
deps = [
":__support_common",
":__support_macros_config",
":string_utils",
":types_size_t",
":types_wchar_t",
],
)
libc_function(
name = "wctob",
srcs = ["src/wchar/wctob.cpp"],
hdrs = ["src/wchar/wctob.h"],
deps = [
":__support_common",
":__support_macros_config",
":__support_macros_null_check",
":__support_wctype_utils",
":hdr_stdio_macros",
":types_wint_t",
],
)
libc_function(
name = "wmemchr",
srcs = ["src/wchar/wmemchr.cpp"],
hdrs = ["src/wchar/wmemchr.h"],
deps = [
":__support_common",
":__support_macros_config",
":types_size_t",
":types_wchar_t",
],
)
libc_function(
name = "wmemcmp",
srcs = ["src/wchar/wmemcmp.cpp"],
hdrs = ["src/wchar/wmemcmp.h"],
deps = [
":__support_common",
":__support_macros_config",
":__support_macros_null_check",
":types_size_t",
":types_wchar_t",
],
)
libc_function(
name = "wmemcpy",
srcs = ["src/wchar/wmemcpy.cpp"],
hdrs = ["src/wchar/wmemcpy.h"],
deps = [
":__support_common",
":__support_macros_config",
":types_size_t",
":types_wchar_t",
],
)
libc_function(
name = "wmemmove",
srcs = ["src/wchar/wmemmove.cpp"],
hdrs = ["src/wchar/wmemmove.h"],
deps = [
":__support_common",
":__support_macros_null_check",
":types_size_t",
":types_wchar_t",
],
)
libc_function(
name = "wmempcpy",
srcs = ["src/wchar/wmempcpy.cpp"],
hdrs = ["src/wchar/wmempcpy.h"],
deps = [
":__support_common",
":types_size_t",
":types_wchar_t",
],
)
libc_function(
name = "wmemset",
srcs = ["src/wchar/wmemset.cpp"],
hdrs = ["src/wchar/wmemset.h"],
deps = [
":__support_common",
":types_size_t",
":types_wchar_t",
],
)

View File

@@ -0,0 +1,214 @@
# This file is licensed under the Apache License v2.0 with LLVM Exceptions.
# See https://llvm.org/LICENSE.txt for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
# Tests for LLVM libc wchar.h functions.
load("//libc/test:libc_test_rules.bzl", "libc_test")
package(default_visibility = ["//visibility:public"])
licenses(["notice"])
libc_test(
name = "btowc_test",
srcs = ["btowc_test.cpp"],
deps = [
"//libc:btowc",
"//libc:hdr_wchar_macros",
],
)
libc_test(
name = "wcpcpy_test",
srcs = ["wcpcpy_test.cpp"],
deps = [
"//libc:types_wchar_t",
"//libc:wcpcpy",
],
)
libc_test(
name = "wcpncpy_test",
srcs = ["wcpncpy_test.cpp"],
deps = [
"//libc:types_wchar_t",
"//libc:wcpncpy",
],
)
libc_test(
name = "wcscat_test",
srcs = ["wcscat_test.cpp"],
deps = [
"//libc:types_wchar_t",
"//libc:wcscat",
],
)
libc_test(
name = "wcschr_test",
srcs = ["wcschr_test.cpp"],
deps = [
"//libc:types_wchar_t",
"//libc:wcschr",
],
)
libc_test(
name = "wcscmp_test",
srcs = ["wcscmp_test.cpp"],
deps = [
"//libc:types_wchar_t",
"//libc:wcscmp",
],
)
libc_test(
name = "wcscpy_test",
srcs = ["wcscpy_test.cpp"],
deps = [
"//libc:types_wchar_t",
"//libc:wcscpy",
],
)
libc_test(
name = "wcslen_test",
srcs = ["wcslen_test.cpp"],
deps = [
"//libc:types_size_t",
"//libc:types_wchar_t",
"//libc:wcslen",
],
)
libc_test(
name = "wcsncat_test",
srcs = ["wcsncat_test.cpp"],
deps = [
"//libc:types_wchar_t",
"//libc:wcsncat",
],
)
libc_test(
name = "wcsncmp_test",
srcs = ["wcsncmp_test.cpp"],
deps = [
"//libc:types_wchar_t",
"//libc:wcsncmp",
],
)
libc_test(
name = "wcsncpy_test",
srcs = ["wcsncpy_test.cpp"],
deps = [
"//libc:types_wchar_t",
"//libc:wcsncpy",
],
)
libc_test(
name = "wcsrchr_test",
srcs = ["wcsrchr_test.cpp"],
deps = [
"//libc:types_wchar_t",
"//libc:wcsrchr",
],
)
libc_test(
name = "wcspbrk_test",
srcs = ["wcspbrk_test.cpp"],
deps = [
"//libc:types_wchar_t",
"//libc:wcspbrk",
],
)
libc_test(
name = "wcsspn_test",
srcs = ["wcsspn_test.cpp"],
deps = [
"//libc:types_size_t",
"//libc:types_wchar_t",
"//libc:wcsspn",
],
)
libc_test(
name = "wcsstr_test",
srcs = ["wcsstr_test.cpp"],
deps = [
"//libc:types_wchar_t",
"//libc:wcsstr",
],
)
libc_test(
name = "wctob_test",
srcs = ["wctob_test.cpp"],
deps = [
"//libc:hdr_stdio_macros",
"//libc:wctob",
],
)
libc_test(
name = "wmemchr_test",
srcs = ["wmemchr_test.cpp"],
deps = [
"//libc:types_wchar_t",
"//libc:wmemchr",
],
)
libc_test(
name = "wmemcmp_test",
srcs = ["wmemcmp_test.cpp"],
deps = [
"//libc:types_size_t",
"//libc:types_wchar_t",
"//libc:wmemcmp",
],
)
libc_test(
name = "wmemcpy_test",
srcs = ["wmemcpy_test.cpp"],
deps = [
"//libc:types_size_t",
"//libc:types_wchar_t",
"//libc:wmemcpy",
],
)
libc_test(
name = "wmemmove_test",
srcs = ["wmemmove_test.cpp"],
deps = [
"//libc:types_size_t",
"//libc:types_wchar_t",
"//libc:wmemmove",
],
)
libc_test(
name = "wmempcpy_test",
srcs = ["wmempcpy_test.cpp"],
deps = [
"//libc:wmempcpy",
],
)
libc_test(
name = "wmemset_test",
srcs = ["wmemset_test.cpp"],
deps = [
"//libc:types_size_t",
"//libc:types_wchar_t",
"//libc:wmemset",
],
)