Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions libc/config/linux/x86_64/entrypoints.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1254,7 +1254,11 @@ if(LLVM_LIBC_FULL_BUILD)
libc.src.stdlib.atexit
libc.src.stdlib.exit
libc.src.stdlib.getenv
libc.src.stdlib.mbstowcs
libc.src.stdlib.mbtowc
libc.src.stdlib.quick_exit
libc.src.stdlib.wcstombs
libc.src.stdlib.wctomb

# signal.h entrypoints
libc.src.signal.kill
Expand Down Expand Up @@ -1372,13 +1376,9 @@ if(LLVM_LIBC_FULL_BUILD)
libc.src.wchar.mbrlen
libc.src.wchar.mbsinit
libc.src.wchar.mbrtowc
libc.src.wchar.mbtowc
libc.src.wchar.mbstowcs
libc.src.wchar.mbsrtowcs
libc.src.wchar.mbsnrtowcs
libc.src.wchar.wcrtomb
libc.src.wchar.wctomb
libc.src.wchar.wcstombs
libc.src.wchar.wcsrtombs
libc.src.wchar.wcsnrtombs

Expand Down
32 changes: 32 additions & 0 deletions libc/include/stdlib.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ types:
- type_name: lldiv_t
- type_name: locale_t
- type_name: size_t
- type_name: wchar_t
enums: []
objects: []
functions:
Expand Down Expand Up @@ -135,6 +136,22 @@ functions:
arguments:
- type: long long
- type: long long
- name: mbstowcs
standards:
- stdc
return_type: size_t
arguments:
- type: wchar_t *__restrict
- type: const char *__restrict
- type: size_t
- name: mbtowc
standards:
- stdc
return_type: int
arguments:
- type: wchar_t *__restrict
- type: const char *__restrict
- type: size_t
- name: memalignment
standards:
- stdc
Expand Down Expand Up @@ -332,3 +349,18 @@ functions:
return_type: int
arguments:
- type: const char *
- name: wctomb
standards:
- stdc
return_type: int
arguments:
- type: char *
- type: wchar_t
- name: wcstombs
standards:
- stdc
return_type: size_t
arguments:
- type: char *__restrict
- type: const wchar_t *__restrict
- type: size_t
31 changes: 0 additions & 31 deletions libc/include/wchar.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,6 @@ functions:
- type: const char *__restrict
- type: size_t
- type: mbstate_t *__restrict
- name: mbtowc
standards:
- stdc
return_type: int
arguments:
- type: wchar_t *__restrict
- type: const char *__restrict
- type: size_t
- name: mbsnrtowcs
standards:
- stdc
Expand All @@ -77,14 +69,6 @@ functions:
- type: const char **__restrict
- type: size_t
- type: mbstate_t *__restrict
- name: mbstowcs
standards:
- stdc
return_type: size_t
arguments:
- type: wchar_t *__restrict
- type: const char *__restrict
- type: size_t
- name: mbsinit
standards:
- stdc
Expand Down Expand Up @@ -269,13 +253,6 @@ functions:
- type: char *__restrict
- type: wchar_t
- type: mbstate_t *__restrict
- name: wctomb
standards:
- stdc
return_type: int
arguments:
- type: char *
- type: wchar_t
- name: wcscpy
standards:
- stdc
Expand Down Expand Up @@ -336,14 +313,6 @@ functions:
- type: const wchar_t *__restrict
- type: wchar_t **__restrict
- type: int
- name: wcstombs
standards:
- stdc
return_type: size_t
arguments:
- type: char *__restrict
- type: const wchar_t *__restrict
- type: size_t
- name: wcstoul
standards:
- stdc
Expand Down
59 changes: 59 additions & 0 deletions libc/src/stdlib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,65 @@ add_entrypoint_object(
libc.hdr.types.size_t
)

add_entrypoint_object(
mbtowc
SRCS
mbtowc.cpp
HDRS
mbtowc.h
DEPENDS
libc.hdr.types.size_t
libc.hdr.types.wchar_t
libc.src.__support.common
libc.src.__support.macros.config
libc.src.__support.libc_errno
libc.src.__support.wchar.mbrtowc
libc.src.__support.wchar.mbstate
)

add_entrypoint_object(
mbstowcs
SRCS
mbstowcs.cpp
HDRS
mbstowcs.h
DEPENDS
libc.hdr.types.size_t
libc.hdr.types.wchar_t
libc.src.__support.common
libc.src.__support.macros.config
libc.src.__support.macros.null_check
libc.src.__support.libc_errno
libc.src.__support.wchar.mbstate
libc.src.__support.wchar.mbsnrtowcs
)

add_entrypoint_object(
wctomb
SRCS
wctomb.cpp
HDRS
wctomb.h
DEPENDS
libc.hdr.types.wchar_t
libc.src.__support.wchar.wcrtomb
libc.src.__support.wchar.mbstate
libc.src.__support.libc_errno
)

add_entrypoint_object(
wcstombs
SRCS
wcstombs.cpp
HDRS
wcstombs.h
DEPENDS
libc.hdr.types.wchar_t
libc.src.__support.wchar.mbstate
libc.src.__support.wchar.wcsnrtombs
libc.src.__support.libc_errno
)

if(NOT LIBC_TARGET_OS_IS_BAREMETAL AND NOT LIBC_TARGET_OS_IS_GPU)
if(LLVM_LIBC_INCLUDE_SCUDO)
set(SCUDO_DEPS "")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
//
//===----------------------------------------------------------------------===//

#include "src/wchar/mbstowcs.h"
#include "src/stdlib/mbstowcs.h"

#include "hdr/types/size_t.h"
#include "hdr/types/wchar_t.h"
Expand Down
6 changes: 3 additions & 3 deletions libc/src/wchar/mbstowcs.h → libc/src/stdlib/mbstowcs.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//

#ifndef LLVM_LIBC_SRC_WCHAR_MBSTOWCS_H
#define LLVM_LIBC_SRC_WCHAR_MBSTOWCS_H
#ifndef LLVM_LIBC_SRC_STDLIB_MBSTOWCS_H
#define LLVM_LIBC_SRC_STDLIB_MBSTOWCS_H

#include "hdr/types/size_t.h"
#include "hdr/types/wchar_t.h"
Expand All @@ -19,4 +19,4 @@ size_t mbstowcs(wchar_t *__restrict pwcs, const char *__restrict s, size_t n);

} // namespace LIBC_NAMESPACE_DECL

#endif // LLVM_LIBC_SRC_WCHAR_MBSTOWCS_H
#endif // LLVM_LIBC_SRC_STDLIB_MBSTOWCS_H
2 changes: 1 addition & 1 deletion libc/src/wchar/mbtowc.cpp → libc/src/stdlib/mbtowc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
//
//===----------------------------------------------------------------------===//

#include "src/wchar/mbtowc.h"
#include "src/stdlib/mbtowc.h"

#include "hdr/types/size_t.h"
#include "hdr/types/wchar_t.h"
Expand Down
6 changes: 3 additions & 3 deletions libc/src/wchar/mbtowc.h → libc/src/stdlib/mbtowc.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//

#ifndef LLVM_LIBC_SRC_WCHAR_MBTOWC_H
#define LLVM_LIBC_SRC_WCHAR_MBTOWC_H
#ifndef LLVM_LIBC_SRC_STDLIB_MBTOWC_H
#define LLVM_LIBC_SRC_STDLIB_MBTOWC_H

#include "hdr/types/size_t.h"
#include "hdr/types/wchar_t.h"
Expand All @@ -19,4 +19,4 @@ int mbtowc(wchar_t *__restrict pwc, const char *__restrict s, size_t n);

} // namespace LIBC_NAMESPACE_DECL

#endif // LLVM_LIBC_SRC_WCHAR_MBTOWC_H
#endif // LLVM_LIBC_SRC_STDLIB_MBTOWC_H
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
//
//===----------------------------------------------------------------------===//

#include "src/wchar/wcstombs.h"
#include "src/stdlib/wcstombs.h"

#include "hdr/types/char32_t.h"
#include "hdr/types/size_t.h"
Expand Down
6 changes: 3 additions & 3 deletions libc/src/wchar/wcstombs.h → libc/src/stdlib/wcstombs.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//

#ifndef LLVM_LIBC_SRC_WCHAR_WCSTOMBS_H
#define LLVM_LIBC_SRC_WCHAR_WCSTOMBS_H
#ifndef LLVM_LIBC_SRC_STDLIB_WCSTOMBS_H
#define LLVM_LIBC_SRC_STDLIB_WCSTOMBS_H

#include "hdr/types/size_t.h"
#include "hdr/types/wchar_t.h"
Expand All @@ -19,4 +19,4 @@ size_t wcstombs(char *__restrict s, const wchar_t *__restrict pwcs, size_t n);

} // namespace LIBC_NAMESPACE_DECL

#endif // LLVM_LIBC_SRC_WCHAR_WCSTOMBS_H
#endif // LLVM_LIBC_SRC_STDLIB_WCSTOMBS_H
2 changes: 1 addition & 1 deletion libc/src/wchar/wctomb.cpp → libc/src/stdlib/wctomb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
//
//===----------------------------------------------------------------------===//

#include "src/wchar/wctomb.h"
#include "src/stdlib/wctomb.h"

#include "hdr/types/wchar_t.h"
#include "src/__support/common.h"
Expand Down
6 changes: 3 additions & 3 deletions libc/src/wchar/wctomb.h → libc/src/stdlib/wctomb.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//

#ifndef LLVM_LIBC_SRC_WCHAR_WCTOMB_H
#define LLVM_LIBC_SRC_WCHAR_WCTOMB_H
#ifndef LLVM_LIBC_SRC_STDLIB_WCTOMB_H
#define LLVM_LIBC_SRC_STDLIB_WCTOMB_H

#include "hdr/types/mbstate_t.h"
#include "hdr/types/wchar_t.h"
Expand All @@ -19,4 +19,4 @@ int wctomb(char *s, wchar_t wc);

} // namespace LIBC_NAMESPACE_DECL

#endif // LLVM_LIBC_SRC_WCHAR_WCTOMB_H
#endif // LLVM_LIBC_SRC_STDLIB_WCTOMB_H
59 changes: 0 additions & 59 deletions libc/src/wchar/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -156,19 +156,6 @@ add_entrypoint_object(
libc.src.__support.wchar.mbstate
)

add_entrypoint_object(
wctomb
SRCS
wctomb.cpp
HDRS
wctomb.h
DEPENDS
libc.hdr.types.wchar_t
libc.src.__support.wchar.wcrtomb
libc.src.__support.wchar.mbstate
libc.src.__support.libc_errno
)

add_entrypoint_object(
mbsinit
SRCS
Expand Down Expand Up @@ -201,39 +188,6 @@ add_entrypoint_object(
libc.src.__support.wchar.mbstate
)

add_entrypoint_object(
mbtowc
SRCS
mbtowc.cpp
HDRS
mbtowc.h
DEPENDS
libc.hdr.types.size_t
libc.hdr.types.wchar_t
libc.src.__support.common
libc.src.__support.macros.config
libc.src.__support.libc_errno
libc.src.__support.wchar.mbrtowc
libc.src.__support.wchar.mbstate
)

add_entrypoint_object(
mbstowcs
SRCS
mbstowcs.cpp
HDRS
mbstowcs.h
DEPENDS
libc.hdr.types.size_t
libc.hdr.types.wchar_t
libc.src.__support.common
libc.src.__support.macros.config
libc.src.__support.macros.null_check
libc.src.__support.libc_errno
libc.src.__support.wchar.mbstate
libc.src.__support.wchar.mbsnrtowcs
)

add_entrypoint_object(
mbsrtowcs
SRCS
Expand Down Expand Up @@ -266,19 +220,6 @@ add_entrypoint_object(
libc.src.__support.wchar.mbsnrtowcs
)

add_entrypoint_object(
wcstombs
SRCS
wcstombs.cpp
HDRS
wcstombs.h
DEPENDS
libc.hdr.types.wchar_t
libc.src.__support.wchar.mbstate
libc.src.__support.wchar.wcsnrtombs
libc.src.__support.libc_errno
)

add_entrypoint_object(
wcsrtombs
SRCS
Expand Down
Loading
Loading