[libc] Remove the #include <stdlib.h> header (#114453)
This commit is contained in:
committed by
GitHub
parent
3fb4b6f052
commit
33bdb53d86
@@ -81,6 +81,17 @@ add_proxy_header_library(
|
||||
libc.include.signal
|
||||
)
|
||||
|
||||
add_proxy_header_library(
|
||||
stdlib_macros
|
||||
HDRS
|
||||
stdlib_macros.h
|
||||
DEPENDS
|
||||
.stdlib_overlay
|
||||
FULL_BUILD_DEPENDS
|
||||
libc.include.stdlib
|
||||
libc.include.llvm-libc-macros.stdlib_macros
|
||||
)
|
||||
|
||||
add_header_library(stdio_overlay HDRS stdio_overlay.h)
|
||||
|
||||
add_proxy_header_library(
|
||||
|
||||
22
libc/hdr/stdlib_macros.h
Normal file
22
libc/hdr/stdlib_macros.h
Normal file
@@ -0,0 +1,22 @@
|
||||
//===-- Definition of macros from stdlib.h --------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, 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
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef LLVM_LIBC_HDR_STDLIB_MACROS_H
|
||||
#define LLVM_LIBC_HDR_STDLIB_MACROS_H
|
||||
|
||||
#ifdef LIBC_FULL_BUILD
|
||||
|
||||
#include "include/llvm-libc-macros/stdlib-macros.h"
|
||||
|
||||
#else // Overlay mode
|
||||
|
||||
#include "stdlib_overlay.h"
|
||||
|
||||
#endif // LLVM_LIBC_FULL_BUILD
|
||||
|
||||
#endif // LLVM_LIBC_HDR_STDLIB_MACROS_H
|
||||
36
libc/hdr/stdlib_overlay.h
Normal file
36
libc/hdr/stdlib_overlay.h
Normal file
@@ -0,0 +1,36 @@
|
||||
//===-- Including stdlib.h in overlay mode --------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, 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
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef LLVM_LIBC_HDR_STDLIB_OVERLAY_H
|
||||
#define LLVM_LIBC_HDR_STDLIB_OVERLAY_H
|
||||
|
||||
#ifdef LIBC_FULL_BUILD
|
||||
#error "This header should only be included in overlay mode"
|
||||
#endif
|
||||
|
||||
// Overlay mode
|
||||
|
||||
// glibc <stdlib.h> header might provide extern inline definitions for few
|
||||
// functions, causing external alias errors. They are guarded by
|
||||
// `__USE_FORTIFY_LEVEL`, which will be temporarily disabled.
|
||||
|
||||
#ifdef __USE_FORTIFY_LEVEL
|
||||
#define LIBC_OLD_USE_FORTIFY_LEVEL __USE_FORTIFY_LEVEL
|
||||
#undef __USE_FORTIFY_LEVEL
|
||||
#define __USE_FORTIFY_LEVEL 0
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef LIBC_OLD_USE_FORTIFY_LEVEL
|
||||
#undef __USE_FORTIFY_LEVEL
|
||||
#define __USE_FORTIFY_LEVEL LIBC_OLD_USE_FORTIFY_LEVEL
|
||||
#undef LIBC_OLD_USE_FORTIFY_LEVEL
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -1,3 +1,36 @@
|
||||
add_proxy_header_library(
|
||||
div_t
|
||||
HDRS
|
||||
div_t.h
|
||||
DEPENDS
|
||||
libc.hdr.stdlib_overlay
|
||||
FULL_BUILD_DEPENDS
|
||||
libc.include.llvm-libc-types.div_t
|
||||
libc.include.stdlib
|
||||
)
|
||||
|
||||
add_proxy_header_library(
|
||||
ldiv_t
|
||||
HDRS
|
||||
ldiv_t.h
|
||||
DEPENDS
|
||||
libc.hdr.stdlib_overlay
|
||||
FULL_BUILD_DEPENDS
|
||||
libc.include.llvm-libc-types.ldiv_t
|
||||
libc.include.stdlib
|
||||
)
|
||||
|
||||
add_proxy_header_library(
|
||||
lldiv_t
|
||||
HDRS
|
||||
lldiv_t.h
|
||||
DEPENDS
|
||||
libc.hdr.stdlib_overlay
|
||||
FULL_BUILD_DEPENDS
|
||||
libc.include.llvm-libc-types.lldiv_t
|
||||
libc.include.stdlib
|
||||
)
|
||||
|
||||
add_proxy_header_library(
|
||||
sigset_t
|
||||
HDRS
|
||||
@@ -46,6 +79,14 @@ add_proxy_header_library(
|
||||
libc.include.llvm-libc-types.struct_timespec
|
||||
)
|
||||
|
||||
add_proxy_header_library(
|
||||
size_t
|
||||
HDRS
|
||||
size_t.h
|
||||
FULL_BUILD_DEPENDS
|
||||
libc.include.llvm-libc-types.size_t
|
||||
)
|
||||
|
||||
add_proxy_header_library(
|
||||
mode_t
|
||||
HDRS
|
||||
|
||||
22
libc/hdr/types/div_t.h
Normal file
22
libc/hdr/types/div_t.h
Normal file
@@ -0,0 +1,22 @@
|
||||
//===-- Definition of macros from div_t.h ---------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, 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
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef LLVM_LIBC_HDR_TYPES_DIV_T_H
|
||||
#define LLVM_LIBC_HDR_TYPES_DIV_T_H
|
||||
|
||||
#ifdef LIBC_FULL_BUILD
|
||||
|
||||
#include "include/llvm-libc-types/div_t.h"
|
||||
|
||||
#else // Overlay mode
|
||||
|
||||
#include "hdr/stdlib_overlay.h"
|
||||
|
||||
#endif // LLVM_LIBC_FULL_BUILD
|
||||
|
||||
#endif // LLVM_LIBC_HDR_TYPES_DIV_T_H
|
||||
22
libc/hdr/types/ldiv_t.h
Normal file
22
libc/hdr/types/ldiv_t.h
Normal file
@@ -0,0 +1,22 @@
|
||||
//===-- Definition of macros from ldiv_t.h --------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, 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
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef LLVM_LIBC_HDR_TYPES_LDIV_T_H
|
||||
#define LLVM_LIBC_HDR_TYPES_LDIV_T_H
|
||||
|
||||
#ifdef LIBC_FULL_BUILD
|
||||
|
||||
#include "include/llvm-libc-types/ldiv_t.h"
|
||||
|
||||
#else // Overlay mode
|
||||
|
||||
#include "hdr/stdlib_overlay.h"
|
||||
|
||||
#endif // LLVM_LIBC_FULL_BUILD
|
||||
|
||||
#endif // LLVM_LIBC_HDR_TYPES_LDIV_T_H
|
||||
22
libc/hdr/types/lldiv_t.h
Normal file
22
libc/hdr/types/lldiv_t.h
Normal file
@@ -0,0 +1,22 @@
|
||||
//===-- Definition of macros from lldiv_t.h -------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, 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
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef LLVM_LIBC_HDR_TYPES_LLDIV_T_H
|
||||
#define LLVM_LIBC_HDR_TYPES_LLDIV_T_H
|
||||
|
||||
#ifdef LIBC_FULL_BUILD
|
||||
|
||||
#include "include/llvm-libc-types/lldiv_t.h"
|
||||
|
||||
#else // Overlay mode
|
||||
|
||||
#include "hdr/stdlib_overlay.h"
|
||||
|
||||
#endif // LLVM_LIBC_FULL_BUILD
|
||||
|
||||
#endif // LLVM_LIBC_HDR_TYPES_LLDIV_T_H
|
||||
23
libc/hdr/types/size_t.h
Normal file
23
libc/hdr/types/size_t.h
Normal file
@@ -0,0 +1,23 @@
|
||||
//===-- Proxy for size_t --------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, 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
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
#ifndef LLVM_LIBC_HDR_TYPES_SIZE_T_H
|
||||
#define LLVM_LIBC_HDR_TYPES_SIZE_T_H
|
||||
|
||||
#ifdef LIBC_FULL_BUILD
|
||||
|
||||
#include "include/llvm-libc-types/size_t.h"
|
||||
|
||||
#else
|
||||
|
||||
#define __need_size_t
|
||||
#include <stddef.h>
|
||||
#undef __need_size_t
|
||||
|
||||
#endif // LIBC_FULL_BUILD
|
||||
|
||||
#endif // LLVM_LIBC_HDR_TYPES_SIZE_T_H
|
||||
@@ -7,7 +7,7 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "new.h"
|
||||
#include <stdlib.h>
|
||||
#include <stdlib.h> // For free, etc
|
||||
|
||||
void operator delete(void *mem) noexcept { ::free(mem); }
|
||||
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
#include "src/__support/threads/mutex.h"
|
||||
|
||||
#include <dirent.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
namespace LIBC_NAMESPACE_DECL {
|
||||
|
||||
|
||||
@@ -221,7 +221,7 @@ add_entrypoint_object(
|
||||
HDRS
|
||||
div.h
|
||||
DEPENDS
|
||||
libc.include.stdlib
|
||||
libc.hdr.types.div_t
|
||||
libc.src.__support.integer_operations
|
||||
)
|
||||
|
||||
@@ -232,7 +232,7 @@ add_entrypoint_object(
|
||||
HDRS
|
||||
ldiv.h
|
||||
DEPENDS
|
||||
libc.include.stdlib
|
||||
libc.hdr.types.ldiv_t
|
||||
libc.src.__support.integer_operations
|
||||
)
|
||||
|
||||
@@ -243,7 +243,7 @@ add_entrypoint_object(
|
||||
HDRS
|
||||
lldiv.h
|
||||
DEPENDS
|
||||
libc.include.stdlib
|
||||
libc.hdr.types.lldiv_t
|
||||
libc.src.__support.integer_operations
|
||||
)
|
||||
|
||||
@@ -277,7 +277,7 @@ add_entrypoint_object(
|
||||
qsort.h
|
||||
DEPENDS
|
||||
.qsort_util
|
||||
libc.include.stdlib
|
||||
libc.hdr.types.size_t
|
||||
)
|
||||
|
||||
add_entrypoint_object(
|
||||
@@ -288,7 +288,7 @@ add_entrypoint_object(
|
||||
qsort_r.h
|
||||
DEPENDS
|
||||
.qsort_util
|
||||
libc.include.stdlib
|
||||
libc.hdr.types.size_t
|
||||
)
|
||||
|
||||
add_object_library(
|
||||
@@ -309,7 +309,7 @@ add_entrypoint_object(
|
||||
rand.h
|
||||
DEPENDS
|
||||
.rand_util
|
||||
libc.include.stdlib
|
||||
libc.hdr.stdlib_macros
|
||||
libc.src.__support.threads.sleep
|
||||
)
|
||||
|
||||
@@ -321,7 +321,6 @@ add_entrypoint_object(
|
||||
srand.h
|
||||
DEPENDS
|
||||
.rand_util
|
||||
libc.include.stdlib
|
||||
)
|
||||
|
||||
if(NOT LIBC_TARGET_OS_IS_GPU)
|
||||
|
||||
@@ -9,8 +9,8 @@
|
||||
#ifndef LLVM_LIBC_SRC_STDLIB_DIV_H
|
||||
#define LLVM_LIBC_SRC_STDLIB_DIV_H
|
||||
|
||||
#include "hdr/types/div_t.h"
|
||||
#include "src/__support/macros/config.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
namespace LIBC_NAMESPACE_DECL {
|
||||
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
#define LLVM_LIBC_SRC_STDLIB_EXIT_H
|
||||
|
||||
#include "src/__support/macros/config.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
namespace LIBC_NAMESPACE_DECL {
|
||||
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "src/__support/macros/config.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifndef LLVM_LIBC_SRC_STDLIB_FREE_H
|
||||
#define LLVM_LIBC_SRC_STDLIB_FREE_H
|
||||
|
||||
@@ -9,8 +9,8 @@
|
||||
#ifndef LLVM_LIBC_SRC_STDLIB_LDIV_H
|
||||
#define LLVM_LIBC_SRC_STDLIB_LDIV_H
|
||||
|
||||
#include "hdr/types/ldiv_t.h"
|
||||
#include "src/__support/macros/config.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
namespace LIBC_NAMESPACE_DECL {
|
||||
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
#ifndef LLVM_LIBC_SRC_STDLIB_LLDIV_H
|
||||
#define LLVM_LIBC_SRC_STDLIB_LLDIV_H
|
||||
|
||||
#include "hdr/types/lldiv_t.h"
|
||||
#include "src/__support/macros/config.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
namespace LIBC_NAMESPACE_DECL {
|
||||
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "hdr/types/size_t.h"
|
||||
#include "src/__support/macros/config.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifndef LLVM_LIBC_SRC_STDLIB_MALLOC_H
|
||||
#define LLVM_LIBC_SRC_STDLIB_MALLOC_H
|
||||
|
||||
@@ -9,8 +9,8 @@
|
||||
#ifndef LLVM_LIBC_SRC_STDLIB_QSORT_H
|
||||
#define LLVM_LIBC_SRC_STDLIB_QSORT_H
|
||||
|
||||
#include "hdr/types/size_t.h"
|
||||
#include "src/__support/macros/config.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
namespace LIBC_NAMESPACE_DECL {
|
||||
|
||||
|
||||
@@ -9,8 +9,8 @@
|
||||
#ifndef LLVM_LIBC_SRC_STDLIB_QSORT_R_H
|
||||
#define LLVM_LIBC_SRC_STDLIB_QSORT_R_H
|
||||
|
||||
#include "hdr/types/size_t.h"
|
||||
#include "src/__support/macros/config.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
namespace LIBC_NAMESPACE_DECL {
|
||||
|
||||
|
||||
@@ -9,8 +9,8 @@
|
||||
#ifndef LLVM_LIBC_SRC_STDLIB_RAND_H
|
||||
#define LLVM_LIBC_SRC_STDLIB_RAND_H
|
||||
|
||||
#include "hdr/stdlib_macros.h"
|
||||
#include "src/__support/macros/config.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
namespace LIBC_NAMESPACE_DECL {
|
||||
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
#define LLVM_LIBC_SRC_STDLIB_SRAND_H
|
||||
|
||||
#include "src/__support/macros/config.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
namespace LIBC_NAMESPACE_DECL {
|
||||
|
||||
|
||||
@@ -239,7 +239,7 @@ add_entrypoint_object(
|
||||
DEPENDS
|
||||
.memory_utils.inline_memcpy
|
||||
.string_utils
|
||||
libc.include.stdlib
|
||||
libc.hdr.stdlib_macros
|
||||
libc.src.errno.errno
|
||||
libc.include.llvm-libc-types.size_t
|
||||
)
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "src/string/strdup.h"
|
||||
#include "hdr/stdlib_macros.h"
|
||||
#include "src/__support/macros/config.h"
|
||||
#include "src/errno/libc_errno.h"
|
||||
#include "src/string/allocating_string_utils.h"
|
||||
@@ -14,8 +15,6 @@
|
||||
|
||||
#include "src/__support/common.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
namespace LIBC_NAMESPACE_DECL {
|
||||
|
||||
LLVM_LIBC_FUNCTION(char *, strdup, (const char *src)) {
|
||||
|
||||
@@ -179,7 +179,6 @@ add_entrypoint_object(
|
||||
HDRS
|
||||
../getcwd.h
|
||||
DEPENDS
|
||||
libc.include.stdlib
|
||||
libc.include.unistd
|
||||
libc.include.sys_syscall
|
||||
libc.src.__support.OSUtil.osutil
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
|
||||
#include "src/errno/libc_errno.h"
|
||||
#include <linux/limits.h> // This is safe to include without any name pollution.
|
||||
#include <stdlib.h>
|
||||
#include <sys/syscall.h> // For syscall numbers.
|
||||
|
||||
namespace LIBC_NAMESPACE_DECL {
|
||||
|
||||
@@ -15,7 +15,7 @@ add_libc_test(
|
||||
LibcMemoryHelpers
|
||||
DEPENDS
|
||||
libc.include.stdio
|
||||
libc.include.stdlib
|
||||
libc.hdr.types.size_t
|
||||
libc.src.errno.errno
|
||||
libc.src.__support.CPP.new
|
||||
libc.src.__support.File.file
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
#include "test/UnitTest/MemoryMatcher.h"
|
||||
#include "test/UnitTest/Test.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include "hdr/types/size_t.h"
|
||||
|
||||
using ModeFlags = LIBC_NAMESPACE::File::ModeFlags;
|
||||
using MemoryView = LIBC_NAMESPACE::testing::MemoryView;
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
// #include "src/__support/str_float_conv_utils.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdlib.h> // For string to float functions
|
||||
|
||||
// #include "src/__support/FPUtil/FPBits.h"
|
||||
|
||||
|
||||
@@ -98,7 +98,7 @@ add_libc_test(
|
||||
fopencookie_test.cpp
|
||||
DEPENDS
|
||||
libc.include.stdio
|
||||
libc.include.stdlib
|
||||
libc.hdr.types.size_t
|
||||
libc.src.errno.errno
|
||||
libc.src.stdio.clearerr
|
||||
libc.src.stdio.fclose
|
||||
|
||||
@@ -19,8 +19,8 @@
|
||||
#include "test/UnitTest/Test.h"
|
||||
|
||||
#include "hdr/stdio_macros.h"
|
||||
#include "hdr/types/size_t.h"
|
||||
#include "src/errno/libc_errno.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
using MemoryView = LIBC_NAMESPACE::testing::MemoryView;
|
||||
|
||||
|
||||
@@ -259,7 +259,7 @@ add_libc_test(
|
||||
HDRS
|
||||
DivTest.h
|
||||
DEPENDS
|
||||
libc.include.stdlib
|
||||
libc.hdr.types.div_t
|
||||
libc.src.stdlib.div
|
||||
)
|
||||
|
||||
@@ -272,7 +272,7 @@ add_libc_test(
|
||||
HDRS
|
||||
DivTest.h
|
||||
DEPENDS
|
||||
libc.include.stdlib
|
||||
libc.hdr.types.ldiv_t
|
||||
libc.src.stdlib.ldiv
|
||||
)
|
||||
|
||||
@@ -285,7 +285,7 @@ add_libc_test(
|
||||
HDRS
|
||||
DivTest.h
|
||||
DEPENDS
|
||||
libc.include.stdlib
|
||||
libc.hdr.types.lldiv_t
|
||||
libc.src.stdlib.lldiv
|
||||
)
|
||||
|
||||
@@ -296,7 +296,7 @@ add_libc_test(
|
||||
SRCS
|
||||
bsearch_test.cpp
|
||||
DEPENDS
|
||||
libc.include.stdlib
|
||||
libc.hdr.types.size_t
|
||||
libc.src.stdlib.bsearch
|
||||
)
|
||||
|
||||
@@ -343,7 +343,7 @@ add_libc_test(
|
||||
SRCS
|
||||
qsort_r_test.cpp
|
||||
DEPENDS
|
||||
libc.include.stdlib
|
||||
libc.hdr.types.size_t
|
||||
libc.src.stdlib.qsort_r
|
||||
)
|
||||
|
||||
@@ -354,7 +354,6 @@ add_libc_test(
|
||||
SRCS
|
||||
rand_test.cpp
|
||||
DEPENDS
|
||||
libc.include.stdlib
|
||||
libc.src.stdlib.rand
|
||||
libc.src.stdlib.srand
|
||||
)
|
||||
@@ -370,7 +369,6 @@ if(LLVM_LIBC_FULL_BUILD)
|
||||
SRCS
|
||||
_Exit_test.cpp
|
||||
DEPENDS
|
||||
libc.include.stdlib
|
||||
libc.src.stdlib._Exit
|
||||
libc.src.stdlib.exit
|
||||
)
|
||||
@@ -414,7 +412,6 @@ if(LLVM_LIBC_FULL_BUILD)
|
||||
SRCS
|
||||
abort_test.cpp
|
||||
DEPENDS
|
||||
libc.include.stdlib
|
||||
libc.include.signal
|
||||
libc.src.stdlib.abort
|
||||
libc.src.stdlib._Exit
|
||||
|
||||
@@ -10,8 +10,6 @@
|
||||
#include "src/stdlib/exit.h"
|
||||
#include "test/UnitTest/Test.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
TEST(LlvmLibcStdlib, _Exit) {
|
||||
EXPECT_EXITS([] { LIBC_NAMESPACE::_Exit(1); }, 1);
|
||||
EXPECT_EXITS([] { LIBC_NAMESPACE::_Exit(65); }, 65);
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
#include "test/UnitTest/Test.h"
|
||||
|
||||
#include <signal.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
TEST(LlvmLibcStdlib, abort) {
|
||||
// -1 matches against any signal, which is necessary for now until
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
#include "test/UnitTest/Test.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include "hdr/types/size_t.h"
|
||||
|
||||
static int int_compare(const void *l, const void *r) {
|
||||
int li = *reinterpret_cast<const int *>(l);
|
||||
|
||||
@@ -8,8 +8,7 @@
|
||||
|
||||
#include "DivTest.h"
|
||||
|
||||
#include "hdr/types/div_t.h"
|
||||
#include "src/stdlib/div.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
LIST_DIV_TESTS(int, div_t, LIBC_NAMESPACE::div)
|
||||
|
||||
@@ -8,8 +8,7 @@
|
||||
|
||||
#include "DivTest.h"
|
||||
|
||||
#include "hdr/types/ldiv_t.h"
|
||||
#include "src/stdlib/ldiv.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
LIST_DIV_TESTS(long, ldiv_t, LIBC_NAMESPACE::ldiv)
|
||||
|
||||
@@ -8,8 +8,7 @@
|
||||
|
||||
#include "DivTest.h"
|
||||
|
||||
#include "hdr/types/lldiv_t.h"
|
||||
#include "src/stdlib/lldiv.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
LIST_DIV_TESTS(long long, lldiv_t, LIBC_NAMESPACE::lldiv)
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
#include "test/UnitTest/Test.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include "hdr/types/size_t.h"
|
||||
|
||||
static int int_compare_count(const void *l, const void *r, void *count_arg) {
|
||||
int li = *reinterpret_cast<const int *>(l);
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
#include "test/UnitTest/Test.h"
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
TEST(LlvmLibcRandTest, UnsetSeed) {
|
||||
static int vals[1000];
|
||||
|
||||
@@ -210,7 +210,6 @@ add_libc_test(
|
||||
SRCS
|
||||
strdup_test.cpp
|
||||
DEPENDS
|
||||
libc.include.stdlib
|
||||
libc.src.string.strdup
|
||||
libc.src.errno.errno
|
||||
)
|
||||
@@ -315,7 +314,6 @@ add_libc_test(
|
||||
SRCS
|
||||
strndup_test.cpp
|
||||
DEPENDS
|
||||
libc.include.stdlib
|
||||
libc.src.string.strndup
|
||||
)
|
||||
|
||||
|
||||
@@ -10,8 +10,6 @@
|
||||
#include "src/string/strdup.h"
|
||||
#include "test/UnitTest/Test.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
TEST(LlvmLibcStrDupTest, EmptyString) {
|
||||
const char *empty = "";
|
||||
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
|
||||
#include "src/string/strlcat.h"
|
||||
#include "test/UnitTest/Test.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
TEST(LlvmLibcStrlcatTest, TooBig) {
|
||||
const char *str = "cd";
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
|
||||
#include "src/string/strlcpy.h"
|
||||
#include "test/UnitTest/Test.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
TEST(LlvmLibcStrlcpyTest, TooBig) {
|
||||
const char *str = "abc";
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
|
||||
#include "src/string/strndup.h"
|
||||
#include "test/UnitTest/Test.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
TEST(LlvmLibcstrndupTest, EmptyString) {
|
||||
const char *empty = "";
|
||||
|
||||
Reference in New Issue
Block a user