Skip to content

[libc] Reduce direct use of errno in src/stdlib and src/__support tests. #143767

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 11, 2025
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
2 changes: 0 additions & 2 deletions libc/test/src/__support/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,6 @@ add_libc_test(
libc.src.__support.integer_literals
libc.src.__support.str_to_float
libc.src.__support.uint128
libc.src.errno.errno
)


Expand All @@ -140,7 +139,6 @@ add_libc_test(
DEPENDS
libc.src.__support.integer_literals
libc.src.__support.str_to_integer
libc.src.errno.errno
)

add_libc_test(
Expand Down
1 change: 0 additions & 1 deletion libc/test/src/__support/str_to_double_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ TEST(LlvmLibcStrToDblTest, SimpleDecimalConversionExtraTypes) {
uint64_t double_output_mantissa = 0;
uint32_t output_exp2 = 0;

LIBC_NAMESPACE::libc_errno = 0;
auto double_result =
internal::simple_decimal_conversion<double>("123456789012345678900");

Expand Down
1 change: 0 additions & 1 deletion libc/test/src/__support/str_to_float_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ TEST(LlvmLibcStrToFltTest, SimpleDecimalConversionExtraTypes) {
uint32_t float_output_mantissa = 0;
uint32_t output_exp2 = 0;

LIBC_NAMESPACE::libc_errno = 0;
auto float_result =
internal::simple_decimal_conversion<float>("123456789012345678900");
float_output_mantissa = float_result.num.mantissa;
Expand Down
2 changes: 0 additions & 2 deletions libc/test/src/__support/str_to_fp_test.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
#include "src/__support/macros/config.h"
#include "src/__support/str_to_float.h"
#include "src/__support/uint128.h"
#include "src/errno/libc_errno.h"

#include "test/UnitTest/Test.h"

Expand Down Expand Up @@ -67,7 +66,6 @@ template <typename T> struct LlvmLibcStrToFloatTest : public testing::Test {
const int expectedErrno = 0) {
StorageType actual_output_mantissa = 0;
uint32_t actual_output_exp2 = 0;
LIBC_NAMESPACE::libc_errno = 0;

auto result = internal::simple_decimal_conversion<T>(numStart);

Expand Down
1 change: 0 additions & 1 deletion libc/test/src/__support/str_to_integer_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
//===----------------------------------------------------------------------===//

#include "src/__support/str_to_integer.h"
#include "src/errno/libc_errno.h"
#include <stddef.h>

#include "test/UnitTest/Test.h"
Expand Down
5 changes: 5 additions & 0 deletions libc/test/src/stdlib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ add_libc_test(
DEPENDS
libc.src.errno.errno
libc.src.stdlib.atof
libc.test.UnitTest.ErrnoCheckingTest
)

add_header_library(
Expand Down Expand Up @@ -64,6 +65,7 @@ add_fp_unittest(
libc.src.errno.errno
libc.src.stdlib.strtod
libc.src.__support.FPUtil.fenv_impl
libc.test.UnitTest.ErrnoCheckingTest
)

add_fp_unittest(
Expand All @@ -76,6 +78,7 @@ add_fp_unittest(
libc.src.errno.errno
libc.src.stdlib.strtof
libc.src.__support.FPUtil.fenv_impl
libc.test.UnitTest.ErrnoCheckingTest
)

add_header_library(
Expand All @@ -86,6 +89,7 @@ add_header_library(
libc.src.__support.CPP.limits
libc.src.__support.CPP.type_traits
libc.src.errno.errno
libc.test.UnitTest.ErrnoCheckingTest
)

add_libc_test(
Expand Down Expand Up @@ -133,6 +137,7 @@ add_libc_test(
libc.src.errno.errno
libc.src.__support.uint128
libc.src.stdlib.strtold
libc.test.UnitTest.ErrnoCheckingTest
)

add_libc_test(
Expand Down
Loading
Loading