[libc] Add C23 limits.h header. (#78887)

This commit is contained in:
lntue 2024-01-24 16:08:56 -05:00 committed by GitHub
parent fe9f3903f2
commit 72ce629415
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
43 changed files with 318 additions and 39 deletions

View File

@ -173,7 +173,17 @@ function(create_header_library fq_target_name)
target_sources(${fq_target_name} INTERFACE ${ADD_HEADER_HDRS})
if(ADD_HEADER_DEPENDS)
add_dependencies(${fq_target_name} ${ADD_HEADER_DEPENDS})
target_link_libraries(${fq_target_name} INTERFACE ${ADD_HEADER_DEPENDS})
# `*.__copied_hdr__` is created only to copy the header files to the target
# location, not to be linked against.
set(link_lib "")
foreach(dep ${ADD_HEADER_DEPENDS})
if (NOT dep MATCHES "__copied_hdr__")
list(APPEND link_lib ${dep})
endif()
endforeach()
target_link_libraries(${fq_target_name} INTERFACE ${link_lib})
endif()
if(ADD_HEADER_COMPILE_OPTIONS)
target_compile_options(${fq_target_name} INTERFACE ${ADD_HEADER_COMPILE_OPTIONS})

View File

@ -4,6 +4,7 @@ set(TARGET_PUBLIC_HEADERS
libc.include.fenv
libc.include.float
libc.include.inttypes
libc.include.limits
libc.include.math
libc.include.stdlib
libc.include.string

View File

@ -5,6 +5,7 @@ set(TARGET_PUBLIC_HEADERS
#libc.include.fenv
libc.include.float
libc.include.inttypes
libc.include.limits
libc.include.math
libc.include.stdlib
libc.include.string

View File

@ -4,6 +4,7 @@ set(TARGET_PUBLIC_HEADERS
libc.include.string
libc.include.float
libc.include.inttypes
libc.include.limits
libc.include.math
libc.include.fenv
libc.include.time

View File

@ -6,6 +6,7 @@ set(TARGET_PUBLIC_HEADERS
libc.include.fenv
libc.include.float
libc.include.inttypes
libc.include.limits
libc.include.math
libc.include.pthread
libc.include.signal

View File

@ -8,6 +8,7 @@ set(TARGET_PUBLIC_HEADERS
libc.include.fenv
libc.include.float
libc.include.inttypes
libc.include.limits
libc.include.math
libc.include.pthread
libc.include.sched

View File

@ -8,6 +8,7 @@ set(TARGET_PUBLIC_HEADERS
libc.include.fenv
libc.include.float
libc.include.inttypes
libc.include.limits
libc.include.math
libc.include.pthread
libc.include.sched

View File

@ -83,6 +83,14 @@ add_gen_header(
.llvm-libc-macros.float_macros
)
add_gen_header(
limits
DEF_FILE limits.h.def
GEN_HDR limits.h
DEPENDS
.llvm-libc-macros.limits_macros
)
add_gen_header(
math
DEF_FILE math.h.def

14
libc/include/limits.h.def Normal file
View File

@ -0,0 +1,14 @@
//===-- C standard library header limits.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_LIMITS_H
#define LLVM_LIBC_LIMITS_H
#include <llvm-libc-macros/limits-macros.h>
#endif // LLVM_LIBC_LIMITS_H

View File

@ -73,6 +73,12 @@ add_macro_header(
float-macros.h
)
add_macro_header(
limits_macros
HDR
limits-macros.h
)
add_macro_header(
math_macros
HDR

View File

@ -9,8 +9,20 @@
#ifndef __LLVM_LIBC_MACROS_FLOAT_MACROS_H
#define __LLVM_LIBC_MACROS_FLOAT_MACROS_H
// Suppress `#include_next is a language extension` warnings.
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wgnu-include-next"
#else // gcc
#pragma GCC system_header
#endif //__clang__
#include_next <float.h>
#ifdef __clang__
#pragma clang diagnostic pop
#endif //__clang__
#ifndef FLT_RADIX
#define FLT_RADIX __FLT_RADIX__
#endif // FLT_RADIX

View File

@ -0,0 +1,226 @@
//===-- Definition of macros from limits.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_MACROS_LIMITS_MACROS_H
#define __LLVM_LIBC_MACROS_LIMITS_MACROS_H
// Define all C23 macro constants of limits.h
#ifndef CHAR_BIT
#ifdef __CHAR_BIT__
#define CHAR_BIT __CHAR_BIT__
#else
#define CHAR_BIT 8
#endif // __CHAR_BIT__
#endif // CHAR_BIT
// TODO: https://github.com/llvm/llvm-project/issues/79358
// Define MB_LEN_MAX if missing.
// clang: MB_LEN_MAX = 1 -
// https://github.com/llvm/llvm-project/blob/main/clang/lib/Headers/limits.h#L64
// glibc: MB_LEN_MAX = 16 -
// https://github.com/bminor/glibc/blob/master/include/limits.h#L32
// *_WIDTH macros
#ifndef CHAR_WIDTH
#define CHAR_WIDTH CHAR_BIT
#endif // CHAR_WIDTH
#ifndef SCHAR_WIDTH
#define SCHAR_WIDTH CHAR_BIT
#endif // SCHAR_WIDTH
#ifndef UCHAR_WIDTH
#define UCHAR_WIDTH CHAR_BIT
#endif // UCHAR_WIDTH
#ifndef SHRT_WIDTH
#ifdef __SHRT_WIDTH__
#define SHRT_WIDTH __SHRT_WIDTH__
#else
#define SHRT_WIDTH 16
#endif // __SHRT_WIDTH__
#endif // SHRT_WIDTH
#ifndef USHRT_WIDTH
#define USHRT_WIDTH SHRT_WIDTH
#endif // USHRT_WIDTH
#ifndef INT_WIDTH
#ifdef __INT_WIDTH__
#define INT_WIDTH __INT_WIDTH__
#else
#define INT_WIDTH 32
#endif // __INT_WIDTH__
#endif // INT_WIDTH
#ifndef UINT_WIDTH
#define UINT_WIDTH INT_WIDTH
#endif // UINT_WIDTH
#ifndef LONG_WIDTH
#ifdef __LONG_WIDTH__
#define LONG_WIDTH __LONG_WIDTH__
#elif defined(__WORDSIZE)
#define LONG_WIDTH __WORDSIZE
#else
#error "Unknown WORDSIZE to define LONG_WIDTH."
#endif // __LONG_WIDTH__
#endif // LONG_WIDTH
#ifndef ULONG_WIDTH
#define ULONG_WIDTH LONG_WIDTH
#endif // ULONG_WIDTH
#ifndef LLONG_WIDTH
#ifdef __LLONG_WIDTH__
#define LLONG_WIDTH __LLONG_WIDTH__
#else
#define LLONG_WIDTH 64
#endif // __LLONG_WIDTH__
#endif // LLONG_WIDTH
#ifndef ULLONG_WIDTH
#define ULLONG_WIDTH LLONG_WIDTH
#endif // ULLONG_WIDTH
#ifndef BOOL_WIDTH
#ifdef __BOOL_WIDTH__
#define BOOL_WIDTH __BOOL_WIDTH__
#else
#define BOOL_WIDTH 1
#endif // __BOOL_WIDTH__
#endif // BOOL_WIDTH
// *_MAX macros
#ifndef SCHAR_MAX
#ifdef __SCHAR_MAX__
#define SCHAR_MAX __SCHAR_MAX__
#else
#define SCHAR_MAX 0x7f
#endif // __SCHAR_MAX__
#endif // SCHAR_MAX
#ifndef UCHAR_MAX
#define UCHAR_MAX (SCHAR_MAX * 2 + 1)
#endif // UCHAR_MAX
// Check if char is unsigned.
#if !defined(__CHAR_UNSIGNED__) && ('\xff' > 0)
#define __CHAR_UNSIGNED__
#endif
#ifndef CHAR_MAX
#ifdef __CHAR_UNSIGNED__
#define CHAR_MAX UCHAR_MAX
#else
#define CHAR_MAX SCHAR_MAX
#endif // __CHAR_UNSIGNED__
#endif // CHAR_MAX
#ifndef SHRT_MAX
#ifdef __SHRT_MAX__
#define SHRT_MAX __SHRT_MAX__
#else
#define SHRT_MAX 0x7fff
#endif // __SHRT_MAX__
#endif // SHRT_MAX
#ifndef USHRT_MAX
#define USHRT_MAX (SHRT_MAX * 2U + 1U)
#endif // USHRT_MAX
#ifndef INT_MAX
#ifdef __INT_MAX__
#define INT_MAX __INT_MAX__
#else
#define INT_MAX (0 ^ (1 << (INT_WIDTH - 1)))
#endif // __INT_MAX__
#endif // INT_MAX
#ifndef UINT_MAX
#define UINT_MAX (~0U)
#endif // UINT_MAX
#ifndef LONG_MAX
#ifdef __LONG_MAX__
#define LONG_MAX __LONG_MAX__
#else
#define LONG_MAX (0L ^ (1L << (LONG_WIDTH - 1)))
#endif // __LONG_MAX__
#endif // LONG_MAX
#ifndef ULONG_MAX
#define ULONG_MAX (~0UL)
#endif // ULONG_MAX
#ifndef LLONG_MAX
#ifdef __LONG_LONG_MAX__
#define LLONG_MAX __LONG_LONG_MAX__
#else
#define LLONG_MAX (0LL ^ (1LL << (LLONG_WIDTH - 1)))
#endif // __LONG_LONG_MAX__
#endif // LLONG_MAX
#ifndef ULLONG_MAX
#define ULLONG_MAX (~0ULL)
#endif // ULLONG_MAX
// *_MIN macros
#ifndef SCHAR_MIN
#define SCHAR_MIN (-SCHAR_MAX - 1)
#endif // SCHAR_MIN
#ifndef UCHAR_MIN
#define UCHAR_MIN 0
#endif // UCHAR_MIN
#ifndef CHAR_MIN
#ifdef __CHAR_UNSIGNED__
#define CHAR_MIN UCHAR_MIN
#else
#define CHAR_MIN SCHAR_MIN
#endif // __CHAR_UNSIGNED__
#endif // CHAR_MIN
#ifndef SHRT_MIN
#define SHRT_MIN (-SHRT_MAX - 1)
#endif // SHRT_MIN
#ifndef USHRT_MIN
#define USHRT_MIN 0U
#endif // USHRT_MIN
#ifndef INT_MIN
#define INT_MIN (-INT_MAX - 1)
#endif // INT_MIN
#ifndef UINT_MIN
#define UINT_MIN 0U
#endif // UINT_MIN
#ifndef LONG_MIN
#define LONG_MIN (-LONG_MAX - 1L)
#endif // LONG_MIN
#ifndef ULONG_MIN
#define ULONG_MIN 0UL
#endif // ULONG_MIN
#ifndef LLONG_MIN
#define LLONG_MIN (-LLONG_MAX - 1LL)
#endif // LLONG_MIN
#ifndef ULLONG_MIN
#define ULLONG_MIN 0ULL
#endif // ULLONG_MIN
#endif // __LLVM_LIBC_MACROS_LIMITS_MACROS_H

View File

@ -857,6 +857,8 @@ def StdC : StandardSpec<"stdc"> {
]
>;
HeaderSpec Limits = HeaderSpec<"limits.h">;
NamedType SigAtomicT = NamedType<"sig_atomic_t">;
HeaderSpec Signal = HeaderSpec<
"signal.h",
@ -1160,6 +1162,7 @@ def StdC : StandardSpec<"stdc"> {
Errno,
Fenv,
Float,
Limits,
Math,
String,
StdIO,

View File

@ -34,6 +34,7 @@ add_header_library(
HDRS
math_extras.h
DEPENDS
libc.src.__support.CPP.limits
libc.src.__support.CPP.type_traits
libc.src.__support.macros.attributes
libc.src.__support.macros.config

View File

@ -48,6 +48,7 @@ add_header_library(
limits.h
DEPENDS
.type_traits
libc.include.llvm-libc-macros.limits_macros
)
add_header_library(

View File

@ -9,23 +9,14 @@
#ifndef LLVM_LIBC_SRC___SUPPORT_CPP_LIMITS_H
#define LLVM_LIBC_SRC___SUPPORT_CPP_LIMITS_H
#include "include/llvm-libc-macros/limits-macros.h" // CHAR_BIT
#include "src/__support/CPP/type_traits/is_integral.h"
#include "src/__support/CPP/type_traits/is_signed.h"
#include "src/__support/macros/attributes.h" // LIBC_INLINE
#include <limits.h> // CHAR_BIT
namespace LIBC_NAMESPACE {
namespace cpp {
// Some older gcc distributions don't define these for 32 bit targets.
#ifndef LLONG_MAX
constexpr unsigned int LLONG_BIT_WIDTH = sizeof(long long) * 8;
constexpr long long LLONG_MAX = ~0LL ^ (1LL << (LLONG_BIT_WIDTH - 1));
constexpr long long LLONG_MIN = 1LL << (LLONG_BIT_WIDTH - 1);
constexpr unsigned long long ULLONG_MAX = ~0ULL;
#endif
namespace internal {
template <typename T, T min_value, T max_value> struct integer_impl {

View File

@ -84,6 +84,7 @@ add_header_library(
.nearest_integer_operations
.normal_float
libc.src.__support.CPP.bit
libc.src.__support.CPP.limits
libc.src.__support.CPP.type_traits
libc.src.__support.common
libc.src.__support.macros.optimization

View File

@ -14,12 +14,12 @@
#include "NormalFloat.h"
#include "src/__support/CPP/bit.h"
#include "src/__support/CPP/limits.h" // INT_MAX, INT_MIN
#include "src/__support/CPP/type_traits.h"
#include "src/__support/FPUtil/FEnvImpl.h"
#include "src/__support/macros/attributes.h"
#include "src/__support/macros/optimization.h" // LIBC_UNLIKELY
#include <limits.h>
#include <math.h>
namespace LIBC_NAMESPACE {

View File

@ -10,12 +10,11 @@
#ifndef LLVM_LIBC_SRC___SUPPORT_MATH_EXTRAS_H
#define LLVM_LIBC_SRC___SUPPORT_MATH_EXTRAS_H
#include "src/__support/CPP/limits.h" // CHAR_BIT
#include "src/__support/CPP/type_traits.h" // is_unsigned_v
#include "src/__support/macros/attributes.h" // LIBC_INLINE
#include "src/__support/macros/config.h" // LIBC_HAS_BUILTIN
#include <limits.h> // CHAR_BIT
namespace LIBC_NAMESPACE {
// Create a bitmask with the count right-most bits set to 1, and all other bits

View File

@ -15,7 +15,6 @@
#include "src/__support/ctype_utils.h"
#include "src/__support/str_to_num_result.h"
#include "src/errno/libc_errno.h" // For ERANGE
#include <limits.h>
namespace LIBC_NAMESPACE {
namespace internal {

View File

@ -52,5 +52,6 @@ add_object_library(
DEPENDS
libc.include.sys_syscall
libc.src.__support.CPP.atomic
libc.src.__support.CPP.limits
libc.src.__support.OSUtil.osutil
)

View File

@ -9,10 +9,10 @@
#include "futex_word.h"
#include "src/__support/CPP/atomic.h"
#include "src/__support/CPP/limits.h" // INT_MAX
#include "src/__support/OSUtil/syscall.h" // For syscall functions.
#include "src/__support/threads/callonce.h"
#include <limits.h>
#include <linux/futex.h>
#include <sys/syscall.h> // For syscall numbers.

View File

@ -10,6 +10,7 @@ add_object_library(
time_utils.h
DEPENDS
libc.include.time
libc.src.__support.CPP.limits
libc.src.errno.errno
)

View File

@ -10,8 +10,6 @@
#include "src/__support/common.h"
#include "src/time/time_utils.h"
#include <limits.h>
namespace LIBC_NAMESPACE {
using LIBC_NAMESPACE::time_utils::TimeConstants;

View File

@ -7,10 +7,9 @@
//===----------------------------------------------------------------------===//
#include "src/time/time_utils.h"
#include "src/__support/CPP/limits.h" // INT_MIN, INT_MAX
#include "src/__support/common.h"
#include <limits.h>
namespace LIBC_NAMESPACE {
namespace time_utils {

View File

@ -767,6 +767,7 @@ if(NOT LIBC_GPU_TARGET_ARCHITECTURE_IS_NVPTX)
DEPENDS
libc.include.math
libc.src.math.ilogb
libc.src.__support.CPP.limits
libc.src.__support.FPUtil.fp_bits
libc.src.__support.FPUtil.manipulation_functions
)
@ -782,6 +783,7 @@ if(NOT LIBC_GPU_TARGET_ARCHITECTURE_IS_NVPTX)
DEPENDS
libc.include.math
libc.src.math.ilogbf
libc.src.__support.CPP.limits
libc.src.__support.FPUtil.fp_bits
libc.src.__support.FPUtil.manipulation_functions
)
@ -798,6 +800,7 @@ add_fp_unittest(
DEPENDS
libc.include.math
libc.src.math.ilogbl
libc.src.__support.CPP.limits
libc.src.__support.FPUtil.fp_bits
libc.src.__support.FPUtil.manipulation_functions
)
@ -813,6 +816,7 @@ add_fp_unittest(
DEPENDS
libc.include.math
libc.src.math.ldexp
libc.src.__support.CPP.limits
libc.src.__support.FPUtil.fp_bits
libc.src.__support.FPUtil.normal_float
)
@ -828,6 +832,7 @@ add_fp_unittest(
DEPENDS
libc.include.math
libc.src.math.ldexpf
libc.src.__support.CPP.limits
libc.src.__support.FPUtil.fp_bits
libc.src.__support.FPUtil.normal_float
)
@ -843,6 +848,7 @@ add_fp_unittest(
DEPENDS
libc.include.math
libc.src.math.ldexpl
libc.src.__support.CPP.limits
libc.src.__support.FPUtil.fp_bits
libc.src.__support.FPUtil.normal_float
)

View File

@ -9,13 +9,12 @@
#ifndef LLVM_LIBC_TEST_SRC_MATH_ILOGBTEST_H
#define LLVM_LIBC_TEST_SRC_MATH_ILOGBTEST_H
#include "src/__support/CPP/limits.h" // INT_MAX
#include "src/__support/FPUtil/FPBits.h"
#include "src/__support/FPUtil/ManipulationFunctions.h"
#include "test/UnitTest/Test.h"
#include <math.h>
#include <limits.h>
class LlvmLibcILogbTest : public LIBC_NAMESPACE::testing::Test {
public:
template <typename T> struct ILogbFunc {

View File

@ -9,12 +9,12 @@
#ifndef LLVM_LIBC_TEST_SRC_MATH_LDEXPTEST_H
#define LLVM_LIBC_TEST_SRC_MATH_LDEXPTEST_H
#include "src/__support/CPP/limits.h" // INT_MAX
#include "src/__support/FPUtil/FPBits.h"
#include "src/__support/FPUtil/NormalFloat.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
#include <limits.h>
#include <math.h>
#include <stdint.h>

View File

@ -761,6 +761,7 @@ if(NOT LIBC_GPU_TARGET_ARCHITECTURE_IS_NVPTX)
DEPENDS
libc.include.math
libc.src.math.ilogb
libc.src.__support.CPP.limits
libc.src.__support.FPUtil.fp_bits
libc.src.__support.FPUtil.manipulation_functions
)
@ -776,6 +777,7 @@ if(NOT LIBC_GPU_TARGET_ARCHITECTURE_IS_NVPTX)
DEPENDS
libc.include.math
libc.src.math.ilogbf
libc.src.__support.CPP.limits
libc.src.__support.FPUtil.fp_bits
libc.src.__support.FPUtil.manipulation_functions
)
@ -792,6 +794,7 @@ add_fp_unittest(
DEPENDS
libc.include.math
libc.src.math.ilogbl
libc.src.__support.CPP.limits
libc.src.__support.FPUtil.fp_bits
libc.src.__support.FPUtil.manipulation_functions
)
@ -807,6 +810,7 @@ add_fp_unittest(
DEPENDS
libc.include.math
libc.src.math.ldexp
libc.src.__support.CPP.limits
libc.src.__support.FPUtil.fp_bits
libc.src.__support.FPUtil.normal_float
)
@ -822,6 +826,7 @@ add_fp_unittest(
DEPENDS
libc.include.math
libc.src.math.ldexpf
libc.src.__support.CPP.limits
libc.src.__support.FPUtil.fp_bits
libc.src.__support.FPUtil.normal_float
)
@ -837,6 +842,7 @@ add_fp_unittest(
DEPENDS
libc.include.math
libc.src.math.ldexpl
libc.src.__support.CPP.limits
libc.src.__support.FPUtil.fp_bits
libc.src.__support.FPUtil.normal_float
)

View File

@ -9,13 +9,12 @@
#ifndef LLVM_LIBC_TEST_SRC_MATH_ILOGBTEST_H
#define LLVM_LIBC_TEST_SRC_MATH_ILOGBTEST_H
#include "src/__support/CPP/limits.h" // INT_MAX
#include "src/__support/FPUtil/FPBits.h"
#include "src/__support/FPUtil/ManipulationFunctions.h"
#include "test/UnitTest/Test.h"
#include <math.h>
#include <limits.h>
class LlvmLibcILogbTest : public LIBC_NAMESPACE::testing::Test {
public:
template <typename T> struct ILogbFunc {

View File

@ -9,12 +9,12 @@
#ifndef LLVM_LIBC_TEST_SRC_MATH_LDEXPTEST_H
#define LLVM_LIBC_TEST_SRC_MATH_LDEXPTEST_H
#include "src/__support/CPP/limits.h" // INT_MAX
#include "src/__support/FPUtil/FPBits.h"
#include "src/__support/FPUtil/NormalFloat.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
#include <limits.h>
#include <math.h>
#include <stdint.h>

View File

@ -6,11 +6,10 @@
//
//===----------------------------------------------------------------------===//
#include "src/__support/CPP/limits.h" // INT_MAX, INT_MIN, LLONG_MAX, LLONG_MIN
#include "src/__support/CPP/type_traits.h"
#include "test/UnitTest/Test.h"
#include <limits.h>
using LIBC_NAMESPACE::cpp::is_same_v;
template <typename ReturnT>

View File

@ -17,6 +17,7 @@ add_header_library(
AtoiTest.h
DEPENDS
libc.src.errno.errno
libc.src.__support.CPP.limits
libc.src.__support.CPP.type_traits
)

View File

@ -12,7 +12,6 @@
#include "src/errno/libc_errno.h"
#include "test/UnitTest/Test.h"
#include <limits.h>
#include <stddef.h>
using LIBC_NAMESPACE::cpp::is_signed_v;

View File

@ -13,7 +13,6 @@
#include "test/UnitTest/ErrnoSetterMatcher.h"
#include "test/UnitTest/Test.h"
#include <limits.h>
#include <stddef.h>
using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds;

View File

@ -14,7 +14,6 @@
#include "test/UnitTest/RoundingModeUtils.h"
#include "test/UnitTest/Test.h"
#include <limits.h>
#include <stddef.h>
using LIBC_NAMESPACE::fputil::testing::ForceRoundingModeTest;

View File

@ -14,7 +14,6 @@
#include "test/UnitTest/RoundingModeUtils.h"
#include "test/UnitTest/Test.h"
#include <limits.h>
#include <stddef.h>
using LIBC_NAMESPACE::fputil::testing::ForceRoundingModeTest;

View File

@ -13,7 +13,6 @@
#include "test/UnitTest/Test.h"
#include <limits.h>
#include <stddef.h>
#if defined(LIBC_LONG_DOUBLE_IS_FLOAT64)

View File

@ -71,6 +71,7 @@ add_libc_unittest(
TmMatcher.h
DEPENDS
libc.src.time.gmtime
libc.src.__support.CPP.limits
)
add_libc_unittest(
@ -98,6 +99,7 @@ add_libc_unittest(
20
DEPENDS
libc.src.time.mktime
libc.src.__support.CPP.limits
)
# Sleeping is not supported on older NVPTX architectures.

View File

@ -9,7 +9,6 @@
#include "src/time/clock.h"
#include "test/UnitTest/Test.h"
#include <limits.h>
#include <time.h>
TEST(LlvmLibcClockTest, SmokeTest) {

View File

@ -6,6 +6,7 @@
//
//===----------------------------------------------------------------------===//
#include "src/__support/CPP/limits.h" // INT_MAX, INT_MIN
#include "src/errno/libc_errno.h"
#include "src/time/gmtime.h"
#include "src/time/time_utils.h"
@ -13,8 +14,6 @@
#include "test/UnitTest/Test.h"
#include "test/src/time/TmMatcher.h"
#include <limits.h>
using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails;
using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds;
using LIBC_NAMESPACE::time_utils::TimeConstants;

View File

@ -6,6 +6,7 @@
//
//===----------------------------------------------------------------------===//
#include "src/__support/CPP/limits.h" // INT_MAX
#include "src/time/mktime.h"
#include "src/time/time_utils.h"
#include "test/UnitTest/ErrnoSetterMatcher.h"
@ -13,8 +14,6 @@
#include "test/src/time/TmHelper.h"
#include "test/src/time/TmMatcher.h"
#include <limits.h>
using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails;
using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds;
using LIBC_NAMESPACE::time_utils::Month;

View File

@ -9,7 +9,6 @@
#include "src/time/time_func.h"
#include "test/UnitTest/Test.h"
#include <limits.h>
#include <time.h>
TEST(LlvmLibcTimeTest, SmokeTest) {