[libc-commits] [libc] [libc] Mass replace enclosing namespace (PR #67032)
Guillaume Chatelet via libc-commits
libc-commits at lists.llvm.org
Thu Sep 21 08:37:47 PDT 2023
https://github.com/gchatelet created https://github.com/llvm/llvm-project/pull/67032
This is step 4 of https://discourse.llvm.org/t/rfc-customizable-namespace-to-allow-testing-the-libc-when-the-system-libc-is-also-llvms-libc/73079
>From 3919c337180777cce3ace97d102ec22ae308581c Mon Sep 17 00:00:00 2001
From: Guillaume Chatelet <gchatelet at google.com>
Date: Thu, 21 Sep 2023 15:35:55 +0000
Subject: [PATCH] [libc] Mass replace enclosing namespace
---
libc/benchmarks/CMakeLists.txt | 2 +-
.../benchmarks/LibcDefaultImplementations.cpp | 16 +-
libc/benchmarks/LibcMemoryBenchmark.h | 2 +-
libc/benchmarks/LibcMemoryBenchmarkMain.cpp | 4 +-
libc/benchmarks/automemcpy/lib/CodeGen.cpp | 12 +-
.../automemcpy/unittests/CodeGenTest.cpp | 24 +-
libc/config/linux/app.h | 4 +-
libc/docs/dev/clang_tidy_checks.rst | 16 +-
libc/docs/dev/code_style.rst | 2 +-
libc/docs/dev/implementation_standard.rst | 12 +-
libc/fuzzing/math/Compare.h | 9 +-
libc/fuzzing/math/RemQuoDiff.h | 4 +-
libc/fuzzing/math/math_differential_fuzz.cpp | 92 +-
.../math/nextafter_differential_fuzz.cpp | 4 +-
libc/fuzzing/stdio/printf_float_conv_fuzz.cpp | 10 +-
libc/fuzzing/stdio/printf_parser_fuzz.cpp | 2 +-
.../fuzzing/stdlib/atof_differential_fuzz.cpp | 3 +-
libc/fuzzing/stdlib/qsort_fuzz.cpp | 2 +-
libc/fuzzing/stdlib/strtofloat_fuzz.cpp | 10 +-
.../stdlib/strtointeger_differential_fuzz.cpp | 14 +-
libc/fuzzing/stdlib/strtointeger_fuzz.cpp | 16 +-
libc/fuzzing/string/strcmp_fuzz.cpp | 4 +-
libc/fuzzing/string/strcpy_fuzz.cpp | 2 +-
libc/fuzzing/string/strstr_fuzz.cpp | 6 +-
.../llvm-libc-macros/linux/unistd-macros.h | 7 +-
libc/src/__support/CPP/README.md | 2 +-
libc/src/__support/CPP/algorithm.h | 4 +-
libc/src/__support/CPP/array.h | 7 +-
libc/src/__support/CPP/atomic.h | 4 +-
libc/src/__support/CPP/bit.h | 4 +-
libc/src/__support/CPP/bitset.h | 6 +-
libc/src/__support/CPP/cstddef.h | 4 +-
libc/src/__support/CPP/expected.h | 4 +-
libc/src/__support/CPP/functional.h | 4 +-
libc/src/__support/CPP/limits.h | 4 +-
libc/src/__support/CPP/new.h | 36 +-
libc/src/__support/CPP/optional.h | 4 +-
libc/src/__support/CPP/span.h | 4 +-
libc/src/__support/CPP/string.h | 6 +-
libc/src/__support/CPP/string_view.h | 4 +-
libc/src/__support/CPP/stringstream.h | 4 +-
.../CPP/type_traits/add_lvalue_reference.h | 4 +-
.../__support/CPP/type_traits/add_pointer.h | 4 +-
.../CPP/type_traits/add_rvalue_reference.h | 4 +-
.../__support/CPP/type_traits/always_false.h | 4 +-
.../__support/CPP/type_traits/bool_constant.h | 4 +-
.../__support/CPP/type_traits/conditional.h | 4 +-
libc/src/__support/CPP/type_traits/decay.h | 4 +-
.../src/__support/CPP/type_traits/enable_if.h | 4 +-
.../__support/CPP/type_traits/false_type.h | 4 +-
.../CPP/type_traits/integral_constant.h | 4 +-
libc/src/__support/CPP/type_traits/invoke.h | 4 +-
.../__support/CPP/type_traits/invoke_result.h | 4 +-
.../__support/CPP/type_traits/is_arithmetic.h | 4 +-
libc/src/__support/CPP/type_traits/is_array.h | 4 +-
.../__support/CPP/type_traits/is_base_of.h | 4 +-
libc/src/__support/CPP/type_traits/is_class.h | 4 +-
libc/src/__support/CPP/type_traits/is_const.h | 4 +-
.../CPP/type_traits/is_convertible.h | 4 +-
.../CPP/type_traits/is_destructible.h | 4 +-
libc/src/__support/CPP/type_traits/is_enum.h | 4 +-
.../CPP/type_traits/is_floating_point.h | 4 +-
.../__support/CPP/type_traits/is_function.h | 4 +-
.../__support/CPP/type_traits/is_integral.h | 4 +-
.../CPP/type_traits/is_lvalue_reference.h | 4 +-
.../CPP/type_traits/is_member_pointer.h | 4 +-
.../CPP/type_traits/is_null_pointer.h | 4 +-
.../src/__support/CPP/type_traits/is_object.h | 4 +-
.../__support/CPP/type_traits/is_pointer.h | 4 +-
.../__support/CPP/type_traits/is_reference.h | 4 +-
.../CPP/type_traits/is_rvalue_reference.h | 4 +-
libc/src/__support/CPP/type_traits/is_same.h | 4 +-
.../src/__support/CPP/type_traits/is_scalar.h | 4 +-
.../src/__support/CPP/type_traits/is_signed.h | 4 +-
.../type_traits/is_trivially_constructible.h | 4 +-
.../CPP/type_traits/is_trivially_copyable.h | 4 +-
.../type_traits/is_trivially_destructible.h | 4 +-
libc/src/__support/CPP/type_traits/is_union.h | 4 +-
.../__support/CPP/type_traits/is_unsigned.h | 4 +-
libc/src/__support/CPP/type_traits/is_void.h | 4 +-
.../__support/CPP/type_traits/make_signed.h | 4 +-
.../__support/CPP/type_traits/make_unsigned.h | 4 +-
.../CPP/type_traits/remove_all_extents.h | 4 +-
.../src/__support/CPP/type_traits/remove_cv.h | 4 +-
.../__support/CPP/type_traits/remove_cvref.h | 4 +-
.../__support/CPP/type_traits/remove_extent.h | 4 +-
.../CPP/type_traits/remove_reference.h | 4 +-
.../src/__support/CPP/type_traits/true_type.h | 4 +-
.../__support/CPP/type_traits/type_identity.h | 4 +-
libc/src/__support/CPP/type_traits/void_t.h | 4 +-
libc/src/__support/CPP/utility/declval.h | 4 +-
libc/src/__support/CPP/utility/forward.h | 4 +-
libc/src/__support/CPP/utility/in_place.h | 4 +-
.../__support/CPP/utility/integer_sequence.h | 4 +-
libc/src/__support/CPP/utility/move.h | 4 +-
libc/src/__support/FPUtil/BasicOperations.h | 4 +-
.../FPUtil/DivisionAndRemainderOperations.h | 10 +-
libc/src/__support/FPUtil/FEnvImpl.h | 8 +-
libc/src/__support/FPUtil/FMA.h | 4 +-
libc/src/__support/FPUtil/FPBits.h | 4 +-
libc/src/__support/FPUtil/FloatProperties.h | 4 +-
libc/src/__support/FPUtil/Hypot.h | 4 +-
.../__support/FPUtil/ManipulationFunctions.h | 4 +-
.../FPUtil/NearestIntegerOperations.h | 4 +-
libc/src/__support/FPUtil/NormalFloat.h | 4 +-
libc/src/__support/FPUtil/PolyEval.h | 4 +-
libc/src/__support/FPUtil/XFloat.h | 4 +-
libc/src/__support/FPUtil/aarch64/FEnvImpl.h | 4 +-
libc/src/__support/FPUtil/aarch64/FMA.h | 4 +-
.../FPUtil/aarch64/fenv_darwin_impl.h | 4 +-
.../FPUtil/aarch64/nearest_integer.h | 4 +-
libc/src/__support/FPUtil/aarch64/sqrt.h | 4 +-
libc/src/__support/FPUtil/arm/FEnvImpl.h | 4 +-
libc/src/__support/FPUtil/double_double.h | 6 +-
libc/src/__support/FPUtil/dyadic_float.h | 6 +-
.../src/__support/FPUtil/except_value_utils.h | 4 +-
libc/src/__support/FPUtil/fpbits_str.h | 4 +-
libc/src/__support/FPUtil/generic/FMA.h | 4 +-
libc/src/__support/FPUtil/generic/FMod.h | 4 +-
libc/src/__support/FPUtil/generic/README.md | 6 +-
libc/src/__support/FPUtil/generic/sqrt.h | 4 +-
.../FPUtil/generic/sqrt_80_bit_long_double.h | 4 +-
libc/src/__support/FPUtil/gpu/FMA.h | 4 +-
libc/src/__support/FPUtil/multiply_add.h | 8 +-
libc/src/__support/FPUtil/nearest_integer.h | 4 +-
libc/src/__support/FPUtil/riscv32/FEnvImpl.h | 4 +-
libc/src/__support/FPUtil/riscv64/FEnvImpl.h | 4 +-
libc/src/__support/FPUtil/riscv64/FMA.h | 4 +-
libc/src/__support/FPUtil/riscv64/sqrt.h | 4 +-
libc/src/__support/FPUtil/rounding_mode.h | 4 +-
libc/src/__support/FPUtil/triple_double.h | 4 +-
libc/src/__support/FPUtil/x86_64/FEnvImpl.h | 4 +-
libc/src/__support/FPUtil/x86_64/FMA.h | 4 +-
.../__support/FPUtil/x86_64/LongDoubleBits.h | 4 +-
.../FPUtil/x86_64/NextAfterLongDouble.h | 4 +-
libc/src/__support/FPUtil/x86_64/PolyEval.h | 4 +-
.../__support/FPUtil/x86_64/nearest_integer.h | 4 +-
libc/src/__support/FPUtil/x86_64/sqrt.h | 4 +-
libc/src/__support/File/dir.cpp | 12 +-
libc/src/__support/File/dir.h | 4 +-
libc/src/__support/File/file.cpp | 4 +-
libc/src/__support/File/file.h | 4 +-
libc/src/__support/File/linux/dir.cpp | 18 +-
libc/src/__support/File/linux/file.cpp | 18 +-
libc/src/__support/File/linux/file.h | 4 +-
libc/src/__support/File/linux/lseekImpl.h | 8 +-
libc/src/__support/File/linux/stderr.cpp | 6 +-
libc/src/__support/File/linux/stdin.cpp | 6 +-
libc/src/__support/File/linux/stdout.cpp | 6 +-
libc/src/__support/GPU/amdgpu/utils.h | 4 +-
libc/src/__support/GPU/generic/utils.h | 4 +-
libc/src/__support/GPU/nvptx/utils.h | 4 +-
libc/src/__support/GPU/utils.h | 4 +-
.../src/__support/OSUtil/darwin/arm/syscall.h | 4 +-
libc/src/__support/OSUtil/darwin/io.h | 8 +-
libc/src/__support/OSUtil/darwin/quick_exit.h | 6 +-
libc/src/__support/OSUtil/darwin/syscall.h | 4 +-
libc/src/__support/OSUtil/fuchsia/io.h | 4 +-
libc/src/__support/OSUtil/gpu/io.cpp | 4 +-
libc/src/__support/OSUtil/gpu/io.h | 4 +-
libc/src/__support/OSUtil/gpu/quick_exit.cpp | 4 +-
libc/src/__support/OSUtil/gpu/quick_exit.h | 4 +-
.../__support/OSUtil/linux/aarch64/syscall.h | 4 +-
libc/src/__support/OSUtil/linux/arm/syscall.h | 4 +-
libc/src/__support/OSUtil/linux/io.h | 8 +-
libc/src/__support/OSUtil/linux/quick_exit.h | 8 +-
.../__support/OSUtil/linux/riscv64/syscall.h | 4 +-
libc/src/__support/OSUtil/linux/syscall.h | 4 +-
.../__support/OSUtil/linux/x86_64/syscall.h | 4 +-
libc/src/__support/RPC/rpc.h | 4 +-
libc/src/__support/RPC/rpc_client.cpp | 6 +-
libc/src/__support/RPC/rpc_client.h | 4 +-
libc/src/__support/RPC/rpc_util.h | 4 +-
.../__support/StringUtil/error_to_string.cpp | 4 +-
.../__support/StringUtil/error_to_string.h | 4 +-
.../src/__support/StringUtil/message_mapper.h | 4 +-
.../__support/StringUtil/signal_to_string.cpp | 4 +-
.../__support/StringUtil/signal_to_string.h | 4 +-
.../tables/linux_extension_errors.h | 4 +-
.../tables/linux_extension_signals.h | 4 +-
.../StringUtil/tables/linux_platform_errors.h | 4 +-
.../tables/linux_platform_signals.h | 4 +-
.../tables/minimal_platform_errors.h | 4 +-
.../tables/minimal_platform_signals.h | 4 +-
.../StringUtil/tables/posix_errors.h | 4 +-
.../StringUtil/tables/posix_signals.h | 4 +-
.../StringUtil/tables/signal_table.h | 4 +-
.../__support/StringUtil/tables/stdc_errors.h | 4 +-
.../StringUtil/tables/stdc_signals.h | 4 +-
libc/src/__support/UInt.h | 4 +-
libc/src/__support/UInt128.h | 4 +-
libc/src/__support/arg_list.h | 4 +-
libc/src/__support/blockstore.h | 4 +-
libc/src/__support/builtin_wrappers.h | 4 +-
libc/src/__support/c_string.h | 4 +-
libc/src/__support/char_vector.h | 4 +-
libc/src/__support/common.h | 10 +-
libc/src/__support/ctype_utils.h | 4 +-
libc/src/__support/detailed_powers_of_ten.h | 4 +-
libc/src/__support/endian.h | 4 +-
libc/src/__support/error_or.h | 4 +-
libc/src/__support/fixedvector.h | 4 +-
libc/src/__support/float_to_string.h | 4 +-
libc/src/__support/high_precision_decimal.h | 4 +-
libc/src/__support/integer_operations.h | 4 +-
libc/src/__support/integer_to_string.h | 4 +-
libc/src/__support/integer_utils.h | 4 +-
libc/src/__support/libc_assert.h | 16 +-
libc/src/__support/macros/optimization.h | 9 +-
libc/src/__support/number_pair.h | 4 +-
libc/src/__support/str_to_float.h | 4 +-
libc/src/__support/str_to_integer.h | 4 +-
libc/src/__support/str_to_num_result.h | 4 +-
libc/src/__support/threads/callonce.h | 4 +-
libc/src/__support/threads/fork_callbacks.cpp | 4 +-
libc/src/__support/threads/fork_callbacks.h | 4 +-
libc/src/__support/threads/gpu/mutex.h | 4 +-
libc/src/__support/threads/linux/callonce.cpp | 14 +-
libc/src/__support/threads/linux/futex_word.h | 4 +-
libc/src/__support/threads/linux/mutex.h | 12 +-
libc/src/__support/threads/linux/thread.cpp | 60 +-
libc/src/__support/threads/mutex.h | 4 +-
libc/src/__support/threads/mutex_common.h | 4 +-
libc/src/__support/threads/thread.cpp | 4 +-
libc/src/__support/threads/thread.h | 4 +-
libc/src/__support/wctype_utils.h | 4 +-
libc/src/assert/__assert_fail.h | 4 +-
libc/src/assert/assert.h | 4 +-
libc/src/assert/generic/__assert_fail.cpp | 8 +-
libc/src/assert/gpu/__assert_fail.cpp | 8 +-
libc/src/ctype/isalnum.cpp | 4 +-
libc/src/ctype/isalnum.h | 4 +-
libc/src/ctype/isalpha.cpp | 4 +-
libc/src/ctype/isalpha.h | 4 +-
libc/src/ctype/isascii.cpp | 4 +-
libc/src/ctype/isascii.h | 4 +-
libc/src/ctype/isblank.cpp | 4 +-
libc/src/ctype/isblank.h | 4 +-
libc/src/ctype/iscntrl.cpp | 4 +-
libc/src/ctype/iscntrl.h | 4 +-
libc/src/ctype/isdigit.cpp | 4 +-
libc/src/ctype/isdigit.h | 4 +-
libc/src/ctype/isgraph.cpp | 4 +-
libc/src/ctype/isgraph.h | 4 +-
libc/src/ctype/islower.cpp | 4 +-
libc/src/ctype/islower.h | 4 +-
libc/src/ctype/isprint.cpp | 4 +-
libc/src/ctype/isprint.h | 4 +-
libc/src/ctype/ispunct.cpp | 4 +-
libc/src/ctype/ispunct.h | 4 +-
libc/src/ctype/isspace.cpp | 4 +-
libc/src/ctype/isspace.h | 4 +-
libc/src/ctype/isupper.cpp | 4 +-
libc/src/ctype/isupper.h | 4 +-
libc/src/ctype/isxdigit.cpp | 4 +-
libc/src/ctype/isxdigit.h | 4 +-
libc/src/ctype/toascii.cpp | 4 +-
libc/src/ctype/toascii.h | 4 +-
libc/src/ctype/tolower.cpp | 4 +-
libc/src/ctype/tolower.h | 4 +-
libc/src/ctype/toupper.cpp | 4 +-
libc/src/ctype/toupper.h | 4 +-
libc/src/dirent/closedir.cpp | 6 +-
libc/src/dirent/closedir.h | 4 +-
libc/src/dirent/dirfd.cpp | 6 +-
libc/src/dirent/dirfd.h | 4 +-
libc/src/dirent/opendir.cpp | 4 +-
libc/src/dirent/opendir.h | 4 +-
libc/src/dirent/readdir.cpp | 6 +-
libc/src/dirent/readdir.h | 4 +-
libc/src/errno/libc_errno.cpp | 4 +-
libc/src/errno/libc_errno.h | 12 +-
libc/src/fcntl/creat.h | 4 +-
libc/src/fcntl/linux/creat.cpp | 8 +-
libc/src/fcntl/linux/open.cpp | 10 +-
libc/src/fcntl/linux/openat.cpp | 8 +-
libc/src/fcntl/open.h | 4 +-
libc/src/fcntl/openat.h | 4 +-
libc/src/fenv/feclearexcept.cpp | 4 +-
libc/src/fenv/feclearexcept.h | 4 +-
libc/src/fenv/fedisableexcept.cpp | 4 +-
libc/src/fenv/fedisableexcept.h | 4 +-
libc/src/fenv/feenableexcept.cpp | 4 +-
libc/src/fenv/feenableexcept.h | 4 +-
libc/src/fenv/fegetenv.cpp | 4 +-
libc/src/fenv/fegetenv.h | 4 +-
libc/src/fenv/fegetexcept.cpp | 4 +-
libc/src/fenv/fegetexcept.h | 4 +-
libc/src/fenv/fegetexceptflag.cpp | 4 +-
libc/src/fenv/fegetexceptflag.h | 4 +-
libc/src/fenv/fegetround.cpp | 4 +-
libc/src/fenv/fegetround.h | 4 +-
libc/src/fenv/feholdexcept.cpp | 4 +-
libc/src/fenv/feholdexcept.h | 4 +-
libc/src/fenv/feraiseexcept.cpp | 4 +-
libc/src/fenv/feraiseexcept.h | 4 +-
libc/src/fenv/fesetenv.cpp | 4 +-
libc/src/fenv/fesetenv.h | 4 +-
libc/src/fenv/fesetexceptflag.cpp | 4 +-
libc/src/fenv/fesetexceptflag.h | 4 +-
libc/src/fenv/fesetround.cpp | 4 +-
libc/src/fenv/fesetround.h | 4 +-
libc/src/fenv/fetestexcept.cpp | 4 +-
libc/src/fenv/fetestexcept.h | 4 +-
libc/src/fenv/feupdateenv.cpp | 4 +-
libc/src/fenv/feupdateenv.h | 4 +-
libc/src/gpu/rpc_host_call.cpp | 4 +-
libc/src/gpu/rpc_host_call.h | 4 +-
libc/src/gpu/rpc_reset.cpp | 6 +-
libc/src/gpu/rpc_reset.h | 4 +-
libc/src/inttypes/imaxabs.cpp | 4 +-
libc/src/inttypes/imaxabs.h | 4 +-
libc/src/inttypes/imaxdiv.cpp | 4 +-
libc/src/inttypes/imaxdiv.h | 4 +-
libc/src/inttypes/strtoimax.cpp | 4 +-
libc/src/inttypes/strtoimax.h | 4 +-
libc/src/inttypes/strtoumax.cpp | 4 +-
libc/src/inttypes/strtoumax.h | 4 +-
libc/src/math/aarch64/ceil.cpp | 4 +-
libc/src/math/aarch64/ceilf.cpp | 4 +-
libc/src/math/aarch64/floor.cpp | 4 +-
libc/src/math/aarch64/floorf.cpp | 4 +-
libc/src/math/aarch64/round.cpp | 4 +-
libc/src/math/aarch64/roundf.cpp | 4 +-
libc/src/math/aarch64/trunc.cpp | 4 +-
libc/src/math/aarch64/truncf.cpp | 4 +-
libc/src/math/acosf.h | 4 +-
libc/src/math/acoshf.h | 4 +-
libc/src/math/asinf.h | 4 +-
libc/src/math/asinhf.h | 4 +-
libc/src/math/atanf.h | 4 +-
libc/src/math/atanhf.h | 4 +-
libc/src/math/ceil.h | 4 +-
libc/src/math/ceilf.h | 4 +-
libc/src/math/ceill.h | 4 +-
libc/src/math/copysign.h | 4 +-
libc/src/math/copysignf.h | 4 +-
libc/src/math/copysignl.h | 4 +-
libc/src/math/cos.h | 4 +-
libc/src/math/cosf.h | 4 +-
libc/src/math/cosh.h | 4 +-
libc/src/math/coshf.h | 4 +-
libc/src/math/docs/add_math_function.md | 6 +-
libc/src/math/erff.h | 4 +-
libc/src/math/exp.h | 4 +-
libc/src/math/exp10.h | 4 +-
libc/src/math/exp10f.h | 4 +-
libc/src/math/exp2.h | 4 +-
libc/src/math/exp2f.h | 4 +-
libc/src/math/expf.h | 4 +-
libc/src/math/expm1f.h | 4 +-
libc/src/math/fabs.h | 4 +-
libc/src/math/fabsf.h | 4 +-
libc/src/math/fabsl.h | 4 +-
libc/src/math/fdim.h | 4 +-
libc/src/math/fdimf.h | 4 +-
libc/src/math/fdiml.h | 4 +-
libc/src/math/floor.h | 4 +-
libc/src/math/floorf.h | 4 +-
libc/src/math/floorl.h | 4 +-
libc/src/math/fma.h | 4 +-
libc/src/math/fmaf.h | 4 +-
libc/src/math/fmax.h | 4 +-
libc/src/math/fmaxf.h | 4 +-
libc/src/math/fmaxl.h | 4 +-
libc/src/math/fmin.h | 4 +-
libc/src/math/fminf.h | 4 +-
libc/src/math/fminl.h | 4 +-
libc/src/math/fmod.h | 4 +-
libc/src/math/fmodf.h | 4 +-
libc/src/math/frexp.h | 4 +-
libc/src/math/frexpf.h | 4 +-
libc/src/math/frexpl.h | 4 +-
libc/src/math/generic/acosf.cpp | 4 +-
libc/src/math/generic/acoshf.cpp | 4 +-
libc/src/math/generic/asinf.cpp | 4 +-
libc/src/math/generic/asinhf.cpp | 4 +-
libc/src/math/generic/atanf.cpp | 4 +-
libc/src/math/generic/atanhf.cpp | 4 +-
libc/src/math/generic/ceil.cpp | 4 +-
libc/src/math/generic/ceilf.cpp | 4 +-
libc/src/math/generic/ceill.cpp | 4 +-
libc/src/math/generic/common_constants.cpp | 4 +-
libc/src/math/generic/common_constants.h | 4 +-
libc/src/math/generic/copysign.cpp | 4 +-
libc/src/math/generic/copysignf.cpp | 4 +-
libc/src/math/generic/copysignl.cpp | 4 +-
libc/src/math/generic/cosf.cpp | 4 +-
libc/src/math/generic/coshf.cpp | 4 +-
libc/src/math/generic/erff.cpp | 4 +-
libc/src/math/generic/exp.cpp | 4 +-
libc/src/math/generic/exp10.cpp | 4 +-
libc/src/math/generic/exp10f.cpp | 4 +-
libc/src/math/generic/exp2.cpp | 4 +-
libc/src/math/generic/exp2f.cpp | 4 +-
libc/src/math/generic/exp_utils.cpp | 4 +-
libc/src/math/generic/exp_utils.h | 4 +-
libc/src/math/generic/expf.cpp | 4 +-
libc/src/math/generic/explogxf.cpp | 4 +-
libc/src/math/generic/explogxf.h | 6 +-
libc/src/math/generic/expm1f.cpp | 4 +-
libc/src/math/generic/fabs.cpp | 4 +-
libc/src/math/generic/fabsf.cpp | 4 +-
libc/src/math/generic/fabsl.cpp | 4 +-
libc/src/math/generic/fdim.cpp | 4 +-
libc/src/math/generic/fdimf.cpp | 4 +-
libc/src/math/generic/fdiml.cpp | 4 +-
libc/src/math/generic/floor.cpp | 4 +-
libc/src/math/generic/floorf.cpp | 4 +-
libc/src/math/generic/floorl.cpp | 4 +-
libc/src/math/generic/fma.cpp | 4 +-
libc/src/math/generic/fmaf.cpp | 4 +-
libc/src/math/generic/fmax.cpp | 4 +-
libc/src/math/generic/fmaxf.cpp | 4 +-
libc/src/math/generic/fmaxl.cpp | 4 +-
libc/src/math/generic/fmin.cpp | 4 +-
libc/src/math/generic/fminf.cpp | 4 +-
libc/src/math/generic/fminl.cpp | 4 +-
libc/src/math/generic/fmod.cpp | 4 +-
libc/src/math/generic/fmodf.cpp | 4 +-
libc/src/math/generic/frexp.cpp | 4 +-
libc/src/math/generic/frexpf.cpp | 4 +-
libc/src/math/generic/frexpl.cpp | 4 +-
libc/src/math/generic/hypot.cpp | 6 +-
libc/src/math/generic/hypotf.cpp | 4 +-
libc/src/math/generic/ilogb.cpp | 4 +-
libc/src/math/generic/ilogbf.cpp | 4 +-
libc/src/math/generic/ilogbl.cpp | 4 +-
libc/src/math/generic/inv_trigf_utils.cpp | 4 +-
libc/src/math/generic/inv_trigf_utils.h | 16 +-
libc/src/math/generic/ldexp.cpp | 4 +-
libc/src/math/generic/ldexpf.cpp | 4 +-
libc/src/math/generic/ldexpl.cpp | 4 +-
libc/src/math/generic/llrint.cpp | 4 +-
libc/src/math/generic/llrintf.cpp | 4 +-
libc/src/math/generic/llrintl.cpp | 4 +-
libc/src/math/generic/llround.cpp | 4 +-
libc/src/math/generic/llroundf.cpp | 4 +-
libc/src/math/generic/llroundl.cpp | 4 +-
libc/src/math/generic/log.cpp | 4 +-
libc/src/math/generic/log10.cpp | 4 +-
libc/src/math/generic/log10f.cpp | 4 +-
libc/src/math/generic/log1p.cpp | 4 +-
libc/src/math/generic/log1pf.cpp | 4 +-
libc/src/math/generic/log2.cpp | 4 +-
libc/src/math/generic/log2f.cpp | 4 +-
libc/src/math/generic/log_range_reduction.h | 4 +-
libc/src/math/generic/logb.cpp | 4 +-
libc/src/math/generic/logbf.cpp | 4 +-
libc/src/math/generic/logbl.cpp | 4 +-
libc/src/math/generic/logf.cpp | 4 +-
libc/src/math/generic/lrint.cpp | 4 +-
libc/src/math/generic/lrintf.cpp | 4 +-
libc/src/math/generic/lrintl.cpp | 4 +-
libc/src/math/generic/lround.cpp | 4 +-
libc/src/math/generic/lroundf.cpp | 4 +-
libc/src/math/generic/lroundl.cpp | 4 +-
libc/src/math/generic/math_utils.cpp | 4 +-
libc/src/math/generic/math_utils.h | 4 +-
libc/src/math/generic/modf.cpp | 4 +-
libc/src/math/generic/modff.cpp | 4 +-
libc/src/math/generic/modfl.cpp | 4 +-
libc/src/math/generic/nearbyint.cpp | 4 +-
libc/src/math/generic/nearbyintf.cpp | 4 +-
libc/src/math/generic/nearbyintl.cpp | 4 +-
libc/src/math/generic/nextafter.cpp | 4 +-
libc/src/math/generic/nextafterf.cpp | 4 +-
libc/src/math/generic/nextafterl.cpp | 4 +-
libc/src/math/generic/range_reduction.h | 4 +-
libc/src/math/generic/range_reduction_fma.h | 4 +-
libc/src/math/generic/remainder.cpp | 4 +-
libc/src/math/generic/remainderf.cpp | 4 +-
libc/src/math/generic/remainderl.cpp | 4 +-
libc/src/math/generic/remquo.cpp | 4 +-
libc/src/math/generic/remquof.cpp | 4 +-
libc/src/math/generic/remquol.cpp | 4 +-
libc/src/math/generic/rint.cpp | 4 +-
libc/src/math/generic/rintf.cpp | 4 +-
libc/src/math/generic/rintl.cpp | 4 +-
libc/src/math/generic/round.cpp | 4 +-
libc/src/math/generic/roundf.cpp | 4 +-
libc/src/math/generic/roundl.cpp | 4 +-
libc/src/math/generic/scalbn.cpp | 4 +-
libc/src/math/generic/scalbnf.cpp | 4 +-
libc/src/math/generic/scalbnl.cpp | 4 +-
libc/src/math/generic/sincosf.cpp | 4 +-
libc/src/math/generic/sincosf_utils.h | 20 +-
libc/src/math/generic/sinf.cpp | 4 +-
libc/src/math/generic/sinhf.cpp | 4 +-
libc/src/math/generic/sqrt.cpp | 4 +-
libc/src/math/generic/sqrtf.cpp | 4 +-
libc/src/math/generic/sqrtl.cpp | 4 +-
libc/src/math/generic/tanf.cpp | 4 +-
libc/src/math/generic/tanhf.cpp | 4 +-
libc/src/math/generic/trunc.cpp | 4 +-
libc/src/math/generic/truncf.cpp | 4 +-
libc/src/math/generic/truncl.cpp | 4 +-
libc/src/math/gpu/ceil.cpp | 4 +-
libc/src/math/gpu/ceilf.cpp | 4 +-
libc/src/math/gpu/copysign.cpp | 4 +-
libc/src/math/gpu/copysignf.cpp | 4 +-
libc/src/math/gpu/fabs.cpp | 4 +-
libc/src/math/gpu/fabsf.cpp | 4 +-
libc/src/math/gpu/floor.cpp | 4 +-
libc/src/math/gpu/floorf.cpp | 4 +-
libc/src/math/gpu/fma.cpp | 4 +-
libc/src/math/gpu/fmaf.cpp | 4 +-
libc/src/math/gpu/fmax.cpp | 4 +-
libc/src/math/gpu/fmaxf.cpp | 4 +-
libc/src/math/gpu/fmin.cpp | 4 +-
libc/src/math/gpu/fminf.cpp | 4 +-
libc/src/math/gpu/fmod.cpp | 4 +-
libc/src/math/gpu/fmodf.cpp | 4 +-
libc/src/math/gpu/modf.cpp | 4 +-
libc/src/math/gpu/modff.cpp | 4 +-
libc/src/math/gpu/nearbyint.cpp | 4 +-
libc/src/math/gpu/nearbyintf.cpp | 4 +-
libc/src/math/gpu/remainder.cpp | 4 +-
libc/src/math/gpu/remainderf.cpp | 4 +-
libc/src/math/gpu/rint.cpp | 4 +-
libc/src/math/gpu/rintf.cpp | 4 +-
libc/src/math/gpu/round.cpp | 4 +-
libc/src/math/gpu/roundf.cpp | 4 +-
libc/src/math/gpu/sinh.cpp | 4 +-
libc/src/math/gpu/sinhf.cpp | 4 +-
libc/src/math/gpu/sqrt.cpp | 4 +-
libc/src/math/gpu/sqrtf.cpp | 4 +-
libc/src/math/gpu/tan.cpp | 4 +-
libc/src/math/gpu/tanf.cpp | 4 +-
libc/src/math/gpu/tanh.cpp | 4 +-
libc/src/math/gpu/tanhf.cpp | 4 +-
libc/src/math/gpu/trunc.cpp | 4 +-
libc/src/math/gpu/truncf.cpp | 4 +-
libc/src/math/gpu/vendor/acosf.cpp | 4 +-
libc/src/math/gpu/vendor/acoshf.cpp | 4 +-
libc/src/math/gpu/vendor/amdgpu/amdgpu.h | 4 +-
.../src/math/gpu/vendor/amdgpu/declarations.h | 4 +-
libc/src/math/gpu/vendor/amdgpu/platform.h | 4 +-
libc/src/math/gpu/vendor/asinf.cpp | 4 +-
libc/src/math/gpu/vendor/asinhf.cpp | 4 +-
libc/src/math/gpu/vendor/atanf.cpp | 4 +-
libc/src/math/gpu/vendor/atanhf.cpp | 4 +-
libc/src/math/gpu/vendor/cos.cpp | 4 +-
libc/src/math/gpu/vendor/cosf.cpp | 4 +-
libc/src/math/gpu/vendor/cosh.cpp | 4 +-
libc/src/math/gpu/vendor/coshf.cpp | 4 +-
libc/src/math/gpu/vendor/exp10f.cpp | 4 +-
libc/src/math/gpu/vendor/exp2f.cpp | 4 +-
libc/src/math/gpu/vendor/expf.cpp | 4 +-
libc/src/math/gpu/vendor/expm1f.cpp | 4 +-
libc/src/math/gpu/vendor/fdim.cpp | 4 +-
libc/src/math/gpu/vendor/fdimf.cpp | 4 +-
libc/src/math/gpu/vendor/frexp.cpp | 4 +-
libc/src/math/gpu/vendor/frexpf.cpp | 4 +-
libc/src/math/gpu/vendor/hypot.cpp | 4 +-
libc/src/math/gpu/vendor/hypotf.cpp | 4 +-
libc/src/math/gpu/vendor/ilogb.cpp | 4 +-
libc/src/math/gpu/vendor/ilogbf.cpp | 4 +-
libc/src/math/gpu/vendor/ldexp.cpp | 4 +-
libc/src/math/gpu/vendor/ldexpf.cpp | 4 +-
libc/src/math/gpu/vendor/llrint.cpp | 4 +-
libc/src/math/gpu/vendor/llrintf.cpp | 4 +-
libc/src/math/gpu/vendor/llround.cpp | 4 +-
libc/src/math/gpu/vendor/llroundf.cpp | 4 +-
libc/src/math/gpu/vendor/nextafter.cpp | 4 +-
libc/src/math/gpu/vendor/nextafterf.cpp | 4 +-
libc/src/math/gpu/vendor/nvptx/declarations.h | 4 +-
libc/src/math/gpu/vendor/nvptx/nvptx.h | 4 +-
libc/src/math/gpu/vendor/pow.cpp | 4 +-
libc/src/math/gpu/vendor/powf.cpp | 4 +-
libc/src/math/gpu/vendor/remquo.cpp | 4 +-
libc/src/math/gpu/vendor/remquof.cpp | 4 +-
libc/src/math/gpu/vendor/scalbn.cpp | 4 +-
libc/src/math/gpu/vendor/scalbnf.cpp | 4 +-
libc/src/math/gpu/vendor/sin.cpp | 4 +-
libc/src/math/gpu/vendor/sincos.cpp | 4 +-
libc/src/math/gpu/vendor/sincosf.cpp | 4 +-
libc/src/math/gpu/vendor/sinf.cpp | 4 +-
libc/src/math/gpu/vendor/sinh.cpp | 4 +-
libc/src/math/gpu/vendor/sinhf.cpp | 4 +-
libc/src/math/gpu/vendor/tan.cpp | 4 +-
libc/src/math/gpu/vendor/tanf.cpp | 4 +-
libc/src/math/gpu/vendor/tanh.cpp | 4 +-
libc/src/math/gpu/vendor/tanhf.cpp | 4 +-
libc/src/math/hypot.h | 4 +-
libc/src/math/hypotf.h | 4 +-
libc/src/math/ilogb.h | 4 +-
libc/src/math/ilogbf.h | 4 +-
libc/src/math/ilogbl.h | 4 +-
libc/src/math/ldexp.h | 4 +-
libc/src/math/ldexpf.h | 4 +-
libc/src/math/ldexpl.h | 4 +-
libc/src/math/llrint.h | 4 +-
libc/src/math/llrintf.h | 4 +-
libc/src/math/llrintl.h | 4 +-
libc/src/math/llround.h | 4 +-
libc/src/math/llroundf.h | 4 +-
libc/src/math/llroundl.h | 4 +-
libc/src/math/log.h | 4 +-
libc/src/math/log10.h | 4 +-
libc/src/math/log10f.h | 4 +-
libc/src/math/log1p.h | 4 +-
libc/src/math/log1pf.h | 4 +-
libc/src/math/log2.h | 4 +-
libc/src/math/log2f.h | 4 +-
libc/src/math/logb.h | 4 +-
libc/src/math/logbf.h | 4 +-
libc/src/math/logbl.h | 4 +-
libc/src/math/logf.h | 4 +-
libc/src/math/lrint.h | 4 +-
libc/src/math/lrintf.h | 4 +-
libc/src/math/lrintl.h | 4 +-
libc/src/math/lround.h | 4 +-
libc/src/math/lroundf.h | 4 +-
libc/src/math/lroundl.h | 4 +-
libc/src/math/modf.h | 4 +-
libc/src/math/modff.h | 4 +-
libc/src/math/modfl.h | 4 +-
libc/src/math/nearbyint.h | 4 +-
libc/src/math/nearbyintf.h | 4 +-
libc/src/math/nearbyintl.h | 4 +-
libc/src/math/nextafter.h | 4 +-
libc/src/math/nextafterf.h | 4 +-
libc/src/math/nextafterl.h | 4 +-
libc/src/math/pow.h | 4 +-
libc/src/math/powf.h | 4 +-
libc/src/math/remainder.h | 4 +-
libc/src/math/remainderf.h | 4 +-
libc/src/math/remainderl.h | 4 +-
libc/src/math/remquo.h | 4 +-
libc/src/math/remquof.h | 4 +-
libc/src/math/remquol.h | 4 +-
libc/src/math/rint.h | 4 +-
libc/src/math/rintf.h | 4 +-
libc/src/math/rintl.h | 4 +-
libc/src/math/round.h | 4 +-
libc/src/math/roundf.h | 4 +-
libc/src/math/roundl.h | 4 +-
libc/src/math/scalbn.h | 4 +-
libc/src/math/scalbnf.h | 4 +-
libc/src/math/scalbnl.h | 4 +-
libc/src/math/sin.h | 4 +-
libc/src/math/sincosf.h | 4 +-
libc/src/math/sinf.h | 4 +-
libc/src/math/sinh.h | 4 +-
libc/src/math/sinhf.h | 4 +-
libc/src/math/sqrt.h | 4 +-
libc/src/math/sqrtf.h | 4 +-
libc/src/math/sqrtl.h | 4 +-
libc/src/math/tan.h | 4 +-
libc/src/math/tanf.h | 4 +-
libc/src/math/tanh.h | 4 +-
libc/src/math/tanhf.h | 4 +-
libc/src/math/trunc.h | 4 +-
libc/src/math/truncf.h | 4 +-
libc/src/math/truncl.h | 4 +-
libc/src/math/x86_64/cos.cpp | 4 +-
libc/src/math/x86_64/sin.cpp | 4 +-
libc/src/math/x86_64/tan.cpp | 4 +-
libc/src/network/htonl.cpp | 4 +-
libc/src/network/htonl.h | 4 +-
libc/src/network/htons.cpp | 4 +-
libc/src/network/htons.h | 4 +-
libc/src/network/ntohl.cpp | 4 +-
libc/src/network/ntohl.h | 4 +-
libc/src/network/ntohs.cpp | 4 +-
libc/src/network/ntohs.h | 4 +-
libc/src/pthread/pthread_atfork.cpp | 4 +-
libc/src/pthread/pthread_atfork.h | 4 +-
libc/src/pthread/pthread_attr_destroy.cpp | 4 +-
libc/src/pthread/pthread_attr_destroy.h | 4 +-
.../pthread/pthread_attr_getdetachstate.cpp | 4 +-
.../src/pthread/pthread_attr_getdetachstate.h | 4 +-
.../src/pthread/pthread_attr_getguardsize.cpp | 4 +-
libc/src/pthread/pthread_attr_getguardsize.h | 4 +-
libc/src/pthread/pthread_attr_getstack.cpp | 6 +-
libc/src/pthread/pthread_attr_getstack.h | 4 +-
.../src/pthread/pthread_attr_getstacksize.cpp | 4 +-
libc/src/pthread/pthread_attr_getstacksize.h | 4 +-
libc/src/pthread/pthread_attr_init.cpp | 4 +-
libc/src/pthread/pthread_attr_init.h | 4 +-
.../pthread/pthread_attr_setdetachstate.cpp | 4 +-
.../src/pthread/pthread_attr_setdetachstate.h | 4 +-
.../src/pthread/pthread_attr_setguardsize.cpp | 4 +-
libc/src/pthread/pthread_attr_setguardsize.h | 4 +-
libc/src/pthread/pthread_attr_setstack.cpp | 4 +-
libc/src/pthread/pthread_attr_setstack.h | 4 +-
.../src/pthread/pthread_attr_setstacksize.cpp | 4 +-
libc/src/pthread/pthread_attr_setstacksize.h | 4 +-
libc/src/pthread/pthread_create.cpp | 20 +-
libc/src/pthread/pthread_create.h | 4 +-
libc/src/pthread/pthread_detach.cpp | 6 +-
libc/src/pthread/pthread_detach.h | 4 +-
libc/src/pthread/pthread_equal.cpp | 6 +-
libc/src/pthread/pthread_equal.h | 4 +-
libc/src/pthread/pthread_exit.cpp | 8 +-
libc/src/pthread/pthread_exit.h | 4 +-
libc/src/pthread/pthread_getname_np.cpp | 8 +-
libc/src/pthread/pthread_getname_np.h | 4 +-
libc/src/pthread/pthread_getspecific.cpp | 4 +-
libc/src/pthread/pthread_getspecific.h | 4 +-
libc/src/pthread/pthread_join.cpp | 6 +-
libc/src/pthread/pthread_join.h | 4 +-
libc/src/pthread/pthread_key_create.cpp | 6 +-
libc/src/pthread/pthread_key_create.h | 4 +-
libc/src/pthread/pthread_key_delete.cpp | 6 +-
libc/src/pthread/pthread_key_delete.h | 4 +-
libc/src/pthread/pthread_mutex_destroy.cpp | 4 +-
libc/src/pthread/pthread_mutex_destroy.h | 4 +-
libc/src/pthread/pthread_mutex_init.cpp | 4 +-
libc/src/pthread/pthread_mutex_init.h | 4 +-
libc/src/pthread/pthread_mutex_lock.cpp | 4 +-
libc/src/pthread/pthread_mutex_lock.h | 4 +-
libc/src/pthread/pthread_mutex_unlock.cpp | 4 +-
libc/src/pthread/pthread_mutex_unlock.h | 4 +-
libc/src/pthread/pthread_mutexattr.h | 4 +-
.../src/pthread/pthread_mutexattr_destroy.cpp | 4 +-
libc/src/pthread/pthread_mutexattr_destroy.h | 4 +-
.../pthread/pthread_mutexattr_getpshared.cpp | 4 +-
.../pthread/pthread_mutexattr_getpshared.h | 4 +-
.../pthread/pthread_mutexattr_getrobust.cpp | 4 +-
.../src/pthread/pthread_mutexattr_getrobust.h | 4 +-
.../src/pthread/pthread_mutexattr_gettype.cpp | 4 +-
libc/src/pthread/pthread_mutexattr_gettype.h | 4 +-
libc/src/pthread/pthread_mutexattr_init.cpp | 4 +-
libc/src/pthread/pthread_mutexattr_init.h | 4 +-
.../pthread/pthread_mutexattr_setpshared.cpp | 4 +-
.../pthread/pthread_mutexattr_setpshared.h | 4 +-
.../pthread/pthread_mutexattr_setrobust.cpp | 4 +-
.../src/pthread/pthread_mutexattr_setrobust.h | 4 +-
.../src/pthread/pthread_mutexattr_settype.cpp | 4 +-
libc/src/pthread/pthread_mutexattr_settype.h | 4 +-
libc/src/pthread/pthread_once.cpp | 4 +-
libc/src/pthread/pthread_once.h | 4 +-
libc/src/pthread/pthread_self.cpp | 6 +-
libc/src/pthread/pthread_self.h | 4 +-
libc/src/pthread/pthread_setname_np.cpp | 8 +-
libc/src/pthread/pthread_setname_np.h | 4 +-
libc/src/pthread/pthread_setspecific.cpp | 4 +-
libc/src/pthread/pthread_setspecific.h | 4 +-
.../sched/linux/sched_get_priority_max.cpp | 7 +-
.../sched/linux/sched_get_priority_min.cpp | 7 +-
libc/src/sched/linux/sched_getaffinity.cpp | 8 +-
libc/src/sched/linux/sched_getcpucount.cpp | 4 +-
libc/src/sched/linux/sched_getparam.cpp | 6 +-
libc/src/sched/linux/sched_getscheduler.cpp | 6 +-
.../src/sched/linux/sched_rr_get_interval.cpp | 15 +-
libc/src/sched/linux/sched_setaffinity.cpp | 8 +-
libc/src/sched/linux/sched_setparam.cpp | 6 +-
libc/src/sched/linux/sched_setscheduler.cpp | 8 +-
libc/src/sched/linux/sched_yield.cpp | 6 +-
libc/src/sched/sched_get_priority_max.h | 4 +-
libc/src/sched/sched_get_priority_min.h | 4 +-
libc/src/sched/sched_getaffinity.h | 4 +-
libc/src/sched/sched_getcpucount.h | 4 +-
libc/src/sched/sched_getparam.h | 4 +-
libc/src/sched/sched_getscheduler.h | 4 +-
libc/src/sched/sched_rr_get_interval.h | 4 +-
libc/src/sched/sched_setaffinity.h | 4 +-
libc/src/sched/sched_setparam.h | 4 +-
libc/src/sched/sched_setscheduler.h | 4 +-
libc/src/sched/sched_yield.h | 4 +-
libc/src/setjmp/longjmp.h | 4 +-
libc/src/setjmp/riscv64/longjmp.cpp | 4 +-
libc/src/setjmp/riscv64/setjmp.cpp | 4 +-
libc/src/setjmp/setjmp_impl.h | 4 +-
libc/src/setjmp/x86_64/longjmp.cpp | 4 +-
libc/src/setjmp/x86_64/setjmp.cpp | 4 +-
libc/src/signal/kill.h | 4 +-
libc/src/signal/linux/__restore.cpp | 6 +-
libc/src/signal/linux/kill.cpp | 6 +-
libc/src/signal/linux/raise.cpp | 10 +-
libc/src/signal/linux/sigaction.cpp | 6 +-
libc/src/signal/linux/sigaddset.cpp | 4 +-
libc/src/signal/linux/sigaltstack.cpp | 6 +-
libc/src/signal/linux/sigdelset.cpp | 4 +-
libc/src/signal/linux/sigemptyset.cpp | 4 +-
libc/src/signal/linux/sigfillset.cpp | 4 +-
libc/src/signal/linux/signal.cpp | 9 +-
libc/src/signal/linux/signal_utils.h | 12 +-
libc/src/signal/linux/sigprocmask.cpp | 8 +-
libc/src/signal/raise.h | 4 +-
libc/src/signal/sigaction.h | 4 +-
libc/src/signal/sigaddset.h | 4 +-
libc/src/signal/sigaltstack.h | 4 +-
libc/src/signal/sigdelset.h | 4 +-
libc/src/signal/sigemptyset.h | 4 +-
libc/src/signal/sigfillset.h | 4 +-
libc/src/signal/signal.h | 4 +-
libc/src/signal/sigprocmask.h | 4 +-
libc/src/spawn/file_actions.h | 4 +-
libc/src/spawn/linux/posix_spawn.cpp | 26 +-
libc/src/spawn/posix_spawn.h | 4 +-
.../posix_spawn_file_actions_addclose.cpp | 4 +-
.../spawn/posix_spawn_file_actions_addclose.h | 4 +-
.../posix_spawn_file_actions_adddup2.cpp | 4 +-
.../spawn/posix_spawn_file_actions_adddup2.h | 4 +-
.../posix_spawn_file_actions_addopen.cpp | 4 +-
.../spawn/posix_spawn_file_actions_addopen.h | 4 +-
.../posix_spawn_file_actions_destroy.cpp | 4 +-
.../spawn/posix_spawn_file_actions_destroy.h | 4 +-
.../spawn/posix_spawn_file_actions_init.cpp | 4 +-
.../src/spawn/posix_spawn_file_actions_init.h | 4 +-
libc/src/stdio/clearerr.h | 4 +-
libc/src/stdio/clearerr_unlocked.h | 4 +-
libc/src/stdio/fclose.h | 4 +-
libc/src/stdio/feof.h | 4 +-
libc/src/stdio/feof_unlocked.h | 4 +-
libc/src/stdio/ferror.h | 4 +-
libc/src/stdio/ferror_unlocked.h | 4 +-
libc/src/stdio/fflush.cpp | 6 +-
libc/src/stdio/fflush.h | 4 +-
libc/src/stdio/fgetc.h | 4 +-
libc/src/stdio/fgetc_unlocked.h | 4 +-
libc/src/stdio/fgets.h | 4 +-
libc/src/stdio/flockfile.cpp | 6 +-
libc/src/stdio/flockfile.h | 4 +-
libc/src/stdio/fopen.h | 4 +-
libc/src/stdio/fopencookie.cpp | 6 +-
libc/src/stdio/fopencookie.h | 4 +-
libc/src/stdio/fprintf.cpp | 4 +-
libc/src/stdio/fprintf.h | 4 +-
libc/src/stdio/fputc.h | 4 +-
libc/src/stdio/fputs.h | 4 +-
libc/src/stdio/fread.h | 4 +-
libc/src/stdio/fread_unlocked.h | 4 +-
libc/src/stdio/fscanf.cpp | 4 +-
libc/src/stdio/fscanf.h | 4 +-
libc/src/stdio/fseek.cpp | 6 +-
libc/src/stdio/fseek.h | 4 +-
libc/src/stdio/ftell.cpp | 6 +-
libc/src/stdio/ftell.h | 4 +-
libc/src/stdio/funlockfile.cpp | 6 +-
libc/src/stdio/funlockfile.h | 4 +-
libc/src/stdio/fwrite.h | 4 +-
libc/src/stdio/fwrite_unlocked.h | 4 +-
libc/src/stdio/generic/clearerr.cpp | 6 +-
libc/src/stdio/generic/clearerr_unlocked.cpp | 6 +-
libc/src/stdio/generic/fclose.cpp | 6 +-
libc/src/stdio/generic/feof.cpp | 6 +-
libc/src/stdio/generic/feof_unlocked.cpp | 6 +-
libc/src/stdio/generic/ferror.cpp | 6 +-
libc/src/stdio/generic/ferror_unlocked.cpp | 6 +-
libc/src/stdio/generic/fgetc.cpp | 6 +-
libc/src/stdio/generic/fgetc_unlocked.cpp | 6 +-
libc/src/stdio/generic/fgets.cpp | 6 +-
libc/src/stdio/generic/fopen.cpp | 6 +-
libc/src/stdio/generic/fputc.cpp | 6 +-
libc/src/stdio/generic/fputs.cpp | 6 +-
libc/src/stdio/generic/fread.cpp | 8 +-
libc/src/stdio/generic/fread_unlocked.cpp | 6 +-
libc/src/stdio/generic/fwrite.cpp | 6 +-
libc/src/stdio/generic/fwrite_unlocked.cpp | 9 +-
libc/src/stdio/generic/getc.cpp | 6 +-
libc/src/stdio/generic/getc_unlocked.cpp | 6 +-
libc/src/stdio/generic/getchar.cpp | 4 +-
libc/src/stdio/generic/getchar_unlocked.cpp | 4 +-
libc/src/stdio/generic/putc.cpp | 6 +-
libc/src/stdio/generic/putchar.cpp | 6 +-
libc/src/stdio/generic/puts.cpp | 8 +-
libc/src/stdio/getc.h | 4 +-
libc/src/stdio/getc_unlocked.h | 4 +-
libc/src/stdio/getchar.h | 4 +-
libc/src/stdio/getchar_unlocked.h | 4 +-
libc/src/stdio/gpu/clearerr.cpp | 4 +-
libc/src/stdio/gpu/fclose.cpp | 4 +-
libc/src/stdio/gpu/feof.cpp | 4 +-
libc/src/stdio/gpu/ferror.cpp | 4 +-
libc/src/stdio/gpu/fgetc.cpp | 4 +-
libc/src/stdio/gpu/fgets.cpp | 8 +-
libc/src/stdio/gpu/file.h | 4 +-
libc/src/stdio/gpu/fopen.cpp | 4 +-
libc/src/stdio/gpu/fputc.cpp | 4 +-
libc/src/stdio/gpu/fputs.cpp | 4 +-
libc/src/stdio/gpu/fread.cpp | 4 +-
libc/src/stdio/gpu/fwrite.cpp | 4 +-
libc/src/stdio/gpu/getc.cpp | 4 +-
libc/src/stdio/gpu/getchar.cpp | 4 +-
libc/src/stdio/gpu/putc.cpp | 4 +-
libc/src/stdio/gpu/putchar.cpp | 4 +-
libc/src/stdio/gpu/puts.cpp | 4 +-
libc/src/stdio/gpu/stderr.cpp | 6 +-
libc/src/stdio/gpu/stdin.cpp | 6 +-
libc/src/stdio/gpu/stdout.cpp | 6 +-
libc/src/stdio/linux/remove.cpp | 10 +-
libc/src/stdio/printf.cpp | 6 +-
libc/src/stdio/printf.h | 4 +-
libc/src/stdio/printf_core/char_converter.h | 4 +-
libc/src/stdio/printf_core/converter.cpp | 4 +-
libc/src/stdio/printf_core/converter.h | 4 +-
libc/src/stdio/printf_core/converter_utils.h | 4 +-
libc/src/stdio/printf_core/core_structs.h | 4 +-
.../stdio/printf_core/float_dec_converter.h | 4 +-
.../stdio/printf_core/float_hex_converter.h | 4 +-
.../printf_core/float_inf_nan_converter.h | 4 +-
libc/src/stdio/printf_core/int_converter.h | 4 +-
libc/src/stdio/printf_core/parser.cpp | 4 +-
libc/src/stdio/printf_core/parser.h | 4 +-
libc/src/stdio/printf_core/printf_main.cpp | 4 +-
libc/src/stdio/printf_core/printf_main.h | 4 +-
libc/src/stdio/printf_core/ptr_converter.h | 4 +-
libc/src/stdio/printf_core/string_converter.h | 4 +-
.../src/stdio/printf_core/vfprintf_internal.h | 14 +-
.../stdio/printf_core/write_int_converter.h | 4 +-
libc/src/stdio/printf_core/writer.cpp | 4 +-
libc/src/stdio/printf_core/writer.h | 4 +-
libc/src/stdio/putc.h | 4 +-
libc/src/stdio/putchar.h | 4 +-
libc/src/stdio/puts.h | 4 +-
libc/src/stdio/remove.h | 4 +-
libc/src/stdio/scanf.cpp | 6 +-
libc/src/stdio/scanf.h | 4 +-
libc/src/stdio/scanf_core/converter.cpp | 4 +-
libc/src/stdio/scanf_core/converter.h | 4 +-
libc/src/stdio/scanf_core/converter_utils.h | 4 +-
libc/src/stdio/scanf_core/core_structs.h | 4 +-
.../stdio/scanf_core/current_pos_converter.h | 4 +-
libc/src/stdio/scanf_core/file_reader.cpp | 4 +-
libc/src/stdio/scanf_core/file_reader.h | 8 +-
libc/src/stdio/scanf_core/float_converter.cpp | 4 +-
libc/src/stdio/scanf_core/float_converter.h | 4 +-
libc/src/stdio/scanf_core/int_converter.cpp | 4 +-
libc/src/stdio/scanf_core/int_converter.h | 4 +-
libc/src/stdio/scanf_core/parser.cpp | 4 +-
libc/src/stdio/scanf_core/parser.h | 4 +-
libc/src/stdio/scanf_core/ptr_converter.cpp | 4 +-
libc/src/stdio/scanf_core/ptr_converter.h | 4 +-
libc/src/stdio/scanf_core/reader.cpp | 4 +-
libc/src/stdio/scanf_core/reader.h | 4 +-
libc/src/stdio/scanf_core/scanf_main.cpp | 4 +-
libc/src/stdio/scanf_core/scanf_main.h | 4 +-
.../src/stdio/scanf_core/string_converter.cpp | 4 +-
libc/src/stdio/scanf_core/string_converter.h | 4 +-
libc/src/stdio/scanf_core/string_reader.cpp | 4 +-
libc/src/stdio/scanf_core/string_reader.h | 4 +-
.../src/stdio/scanf_core/vfscanf_internal.cpp | 4 +-
libc/src/stdio/scanf_core/vfscanf_internal.h | 4 +-
libc/src/stdio/setbuf.cpp | 6 +-
libc/src/stdio/setbuf.h | 4 +-
libc/src/stdio/setvbuf.cpp | 8 +-
libc/src/stdio/setvbuf.h | 4 +-
libc/src/stdio/snprintf.cpp | 4 +-
libc/src/stdio/snprintf.h | 4 +-
libc/src/stdio/sprintf.cpp | 4 +-
libc/src/stdio/sprintf.h | 4 +-
libc/src/stdio/sscanf.cpp | 4 +-
libc/src/stdio/sscanf.h | 4 +-
libc/src/stdio/ungetc.cpp | 6 +-
libc/src/stdio/ungetc.h | 4 +-
libc/src/stdio/vfprintf.cpp | 4 +-
libc/src/stdio/vfprintf.h | 4 +-
libc/src/stdio/vprintf.cpp | 6 +-
libc/src/stdio/vprintf.h | 4 +-
libc/src/stdio/vsnprintf.cpp | 4 +-
libc/src/stdio/vsnprintf.h | 4 +-
libc/src/stdio/vsprintf.cpp | 4 +-
libc/src/stdio/vsprintf.h | 4 +-
libc/src/stdlib/_Exit.cpp | 4 +-
libc/src/stdlib/_Exit.h | 4 +-
libc/src/stdlib/abort.h | 4 +-
libc/src/stdlib/abs.cpp | 4 +-
libc/src/stdlib/abs.h | 4 +-
libc/src/stdlib/atexit.cpp | 4 +-
libc/src/stdlib/atexit.h | 4 +-
libc/src/stdlib/atof.cpp | 4 +-
libc/src/stdlib/atof.h | 4 +-
libc/src/stdlib/atoi.cpp | 4 +-
libc/src/stdlib/atoi.h | 4 +-
libc/src/stdlib/atol.cpp | 4 +-
libc/src/stdlib/atol.h | 4 +-
libc/src/stdlib/atoll.cpp | 4 +-
libc/src/stdlib/atoll.h | 4 +-
libc/src/stdlib/baremetal/abort.cpp | 4 +-
libc/src/stdlib/bsearch.cpp | 4 +-
libc/src/stdlib/bsearch.h | 4 +-
libc/src/stdlib/div.cpp | 4 +-
libc/src/stdlib/div.h | 4 +-
libc/src/stdlib/exit.cpp | 4 +-
libc/src/stdlib/exit.h | 4 +-
libc/src/stdlib/free.h | 4 +-
libc/src/stdlib/getenv.cpp | 10 +-
libc/src/stdlib/getenv.h | 4 +-
libc/src/stdlib/gpu/abort.cpp | 4 +-
libc/src/stdlib/gpu/free.cpp | 4 +-
libc/src/stdlib/gpu/malloc.cpp | 4 +-
libc/src/stdlib/labs.cpp | 4 +-
libc/src/stdlib/labs.h | 4 +-
libc/src/stdlib/ldiv.cpp | 4 +-
libc/src/stdlib/ldiv.h | 4 +-
libc/src/stdlib/linux/abort.cpp | 10 +-
libc/src/stdlib/llabs.cpp | 4 +-
libc/src/stdlib/llabs.h | 4 +-
libc/src/stdlib/lldiv.cpp | 4 +-
libc/src/stdlib/lldiv.h | 4 +-
libc/src/stdlib/malloc.h | 4 +-
libc/src/stdlib/qsort.cpp | 4 +-
libc/src/stdlib/qsort.h | 4 +-
libc/src/stdlib/qsort_r.cpp | 4 +-
libc/src/stdlib/qsort_r.h | 4 +-
libc/src/stdlib/qsort_util.h | 4 +-
libc/src/stdlib/rand.cpp | 4 +-
libc/src/stdlib/rand.h | 4 +-
libc/src/stdlib/rand_util.cpp | 4 +-
libc/src/stdlib/rand_util.h | 4 +-
libc/src/stdlib/srand.cpp | 4 +-
libc/src/stdlib/srand.h | 4 +-
libc/src/stdlib/strtod.cpp | 4 +-
libc/src/stdlib/strtod.h | 4 +-
libc/src/stdlib/strtof.cpp | 4 +-
libc/src/stdlib/strtof.h | 4 +-
libc/src/stdlib/strtol.cpp | 4 +-
libc/src/stdlib/strtol.h | 4 +-
libc/src/stdlib/strtold.cpp | 4 +-
libc/src/stdlib/strtold.h | 4 +-
libc/src/stdlib/strtoll.cpp | 4 +-
libc/src/stdlib/strtoll.h | 4 +-
libc/src/stdlib/strtoul.cpp | 4 +-
libc/src/stdlib/strtoul.h | 4 +-
libc/src/stdlib/strtoull.cpp | 4 +-
libc/src/stdlib/strtoull.h | 4 +-
libc/src/string/allocating_string_utils.h | 4 +-
libc/src/string/bcmp.cpp | 4 +-
libc/src/string/bcmp.h | 4 +-
libc/src/string/bcopy.cpp | 4 +-
libc/src/string/bcopy.h | 4 +-
libc/src/string/bzero.cpp | 4 +-
libc/src/string/bzero.h | 4 +-
libc/src/string/index.cpp | 4 +-
libc/src/string/index.h | 4 +-
libc/src/string/memccpy.cpp | 4 +-
libc/src/string/memccpy.h | 4 +-
libc/src/string/memchr.cpp | 4 +-
libc/src/string/memchr.h | 4 +-
libc/src/string/memcmp.cpp | 4 +-
libc/src/string/memcmp.h | 4 +-
libc/src/string/memcpy.cpp | 4 +-
libc/src/string/memcpy.h | 4 +-
libc/src/string/memmem.cpp | 4 +-
libc/src/string/memmem.h | 4 +-
libc/src/string/memmove.cpp | 4 +-
libc/src/string/memmove.h | 4 +-
.../string/memory_utils/aarch64/inline_bcmp.h | 4 +-
.../memory_utils/aarch64/inline_memcmp.h | 4 +-
.../memory_utils/aarch64/inline_memcpy.h | 4 +-
.../memory_utils/aarch64/inline_memmove.h | 4 +-
.../memory_utils/aarch64/inline_memset.h | 4 +-
.../memory_utils/generic/aligned_access.h | 4 +-
.../memory_utils/generic/byte_per_byte.h | 4 +-
libc/src/string/memory_utils/inline_bcmp.h | 4 +-
libc/src/string/memory_utils/inline_bzero.h | 4 +-
libc/src/string/memory_utils/inline_memcmp.h | 4 +-
libc/src/string/memory_utils/inline_memcpy.h | 4 +-
libc/src/string/memory_utils/inline_memmem.h | 4 +-
libc/src/string/memory_utils/inline_memmove.h | 4 +-
libc/src/string/memory_utils/inline_memset.h | 4 +-
libc/src/string/memory_utils/inline_strcmp.h | 4 +-
libc/src/string/memory_utils/inline_strstr.h | 4 +-
libc/src/string/memory_utils/op_aarch64.h | 8 +-
libc/src/string/memory_utils/op_builtin.h | 4 +-
libc/src/string/memory_utils/op_generic.h | 14 +-
libc/src/string/memory_utils/op_riscv.h | 4 +-
libc/src/string/memory_utils/op_x86.h | 8 +-
.../string/memory_utils/riscv/inline_bcmp.h | 4 +-
.../string/memory_utils/riscv/inline_memcmp.h | 4 +-
.../string/memory_utils/riscv/inline_memcpy.h | 4 +-
.../memory_utils/riscv/inline_memmove.h | 4 +-
.../string/memory_utils/riscv/inline_memset.h | 4 +-
libc/src/string/memory_utils/utils.h | 4 +-
.../string/memory_utils/x86_64/inline_bcmp.h | 4 +-
.../memory_utils/x86_64/inline_memcmp.h | 4 +-
.../memory_utils/x86_64/inline_memcpy.h | 8 +-
.../memory_utils/x86_64/inline_memmove.h | 4 +-
.../memory_utils/x86_64/inline_memset.h | 4 +-
libc/src/string/mempcpy.cpp | 4 +-
libc/src/string/mempcpy.h | 4 +-
libc/src/string/memrchr.cpp | 4 +-
libc/src/string/memrchr.h | 4 +-
libc/src/string/memset.cpp | 4 +-
libc/src/string/memset.h | 4 +-
libc/src/string/rindex.cpp | 4 +-
libc/src/string/rindex.h | 4 +-
libc/src/string/stpcpy.cpp | 6 +-
libc/src/string/stpcpy.h | 4 +-
libc/src/string/stpncpy.cpp | 4 +-
libc/src/string/stpncpy.h | 4 +-
libc/src/string/strcasecmp.cpp | 8 +-
libc/src/string/strcasecmp.h | 4 +-
libc/src/string/strcasestr.cpp | 8 +-
libc/src/string/strcasestr.h | 4 +-
libc/src/string/strcat.cpp | 6 +-
libc/src/string/strcat.h | 4 +-
libc/src/string/strchr.cpp | 4 +-
libc/src/string/strchr.h | 4 +-
libc/src/string/strchrnul.cpp | 4 +-
libc/src/string/strchrnul.h | 4 +-
libc/src/string/strcmp.cpp | 4 +-
libc/src/string/strcmp.h | 4 +-
libc/src/string/strcoll.cpp | 4 +-
libc/src/string/strcoll.h | 4 +-
libc/src/string/strcpy.cpp | 4 +-
libc/src/string/strcpy.h | 4 +-
libc/src/string/strcspn.cpp | 4 +-
libc/src/string/strcspn.h | 4 +-
libc/src/string/strdup.cpp | 4 +-
libc/src/string/strdup.h | 4 +-
libc/src/string/strerror.cpp | 4 +-
libc/src/string/strerror.h | 4 +-
libc/src/string/strerror_r.cpp | 4 +-
libc/src/string/strerror_r.h | 4 +-
libc/src/string/string_utils.h | 4 +-
libc/src/string/strlcat.cpp | 4 +-
libc/src/string/strlcat.h | 4 +-
libc/src/string/strlcpy.cpp | 4 +-
libc/src/string/strlcpy.h | 4 +-
libc/src/string/strlen.cpp | 4 +-
libc/src/string/strlen.h | 4 +-
libc/src/string/strncasecmp.cpp | 8 +-
libc/src/string/strncasecmp.h | 4 +-
libc/src/string/strncat.cpp | 6 +-
libc/src/string/strncat.h | 4 +-
libc/src/string/strncmp.cpp | 4 +-
libc/src/string/strncmp.h | 4 +-
libc/src/string/strncpy.cpp | 4 +-
libc/src/string/strncpy.h | 4 +-
libc/src/string/strndup.cpp | 4 +-
libc/src/string/strndup.h | 4 +-
libc/src/string/strnlen.cpp | 4 +-
libc/src/string/strnlen.h | 4 +-
libc/src/string/strpbrk.cpp | 4 +-
libc/src/string/strpbrk.h | 4 +-
libc/src/string/strrchr.cpp | 4 +-
libc/src/string/strrchr.h | 4 +-
libc/src/string/strsep.cpp | 4 +-
libc/src/string/strsep.h | 4 +-
libc/src/string/strsignal.cpp | 4 +-
libc/src/string/strsignal.h | 4 +-
libc/src/string/strspn.cpp | 4 +-
libc/src/string/strspn.h | 4 +-
libc/src/string/strstr.cpp | 4 +-
libc/src/string/strstr.h | 4 +-
libc/src/string/strtok.cpp | 4 +-
libc/src/string/strtok.h | 4 +-
libc/src/string/strtok_r.cpp | 4 +-
libc/src/string/strtok_r.h | 4 +-
libc/src/string/strxfrm.cpp | 4 +-
libc/src/string/strxfrm.h | 4 +-
libc/src/sys/mman/linux/madvise.cpp | 6 +-
libc/src/sys/mman/linux/mmap.cpp | 8 +-
libc/src/sys/mman/linux/mprotect.cpp | 6 +-
libc/src/sys/mman/linux/munmap.cpp | 8 +-
libc/src/sys/mman/linux/posix_madvise.cpp | 6 +-
libc/src/sys/mman/madvise.h | 4 +-
libc/src/sys/mman/mmap.h | 4 +-
libc/src/sys/mman/mprotect.h | 4 +-
libc/src/sys/mman/munmap.h | 4 +-
libc/src/sys/mman/posix_madvise.h | 4 +-
libc/src/sys/random/getrandom.h | 4 +-
libc/src/sys/random/linux/getrandom.cpp | 6 +-
libc/src/sys/resource/getrlimit.h | 4 +-
libc/src/sys/resource/linux/getrlimit.cpp | 6 +-
libc/src/sys/resource/linux/setrlimit.cpp | 6 +-
libc/src/sys/resource/setrlimit.h | 4 +-
libc/src/sys/select/linux/select.cpp | 12 +-
libc/src/sys/select/select.h | 4 +-
libc/src/sys/sendfile/linux/sendfile.cpp | 12 +-
libc/src/sys/sendfile/sendfile.h | 4 +-
libc/src/sys/socket/linux/socket.cpp | 11 +-
libc/src/sys/socket/socket.h | 4 +-
libc/src/sys/stat/chmod.h | 4 +-
libc/src/sys/stat/fchmod.h | 4 +-
libc/src/sys/stat/fchmodat.h | 4 +-
libc/src/sys/stat/fstat.h | 4 +-
libc/src/sys/stat/linux/chmod.cpp | 9 +-
libc/src/sys/stat/linux/fchmod.cpp | 6 +-
libc/src/sys/stat/linux/fchmodat.cpp | 6 +-
libc/src/sys/stat/linux/fstat.cpp | 4 +-
libc/src/sys/stat/linux/kernel_statx.h | 8 +-
libc/src/sys/stat/linux/lstat.cpp | 4 +-
libc/src/sys/stat/linux/mkdir.cpp | 9 +-
libc/src/sys/stat/linux/mkdirat.cpp | 6 +-
libc/src/sys/stat/linux/stat.cpp | 4 +-
libc/src/sys/stat/lstat.h | 4 +-
libc/src/sys/stat/mkdir.h | 4 +-
libc/src/sys/stat/mkdirat.h | 4 +-
libc/src/sys/stat/stat.h | 4 +-
libc/src/sys/utsname/linux/uname.cpp | 6 +-
libc/src/sys/utsname/uname.h | 4 +-
libc/src/sys/wait/linux/wait.cpp | 4 +-
libc/src/sys/wait/linux/wait4.cpp | 4 +-
libc/src/sys/wait/linux/waitpid.cpp | 4 +-
libc/src/sys/wait/wait.h | 4 +-
libc/src/sys/wait/wait4.h | 4 +-
libc/src/sys/wait/wait4Impl.h | 12 +-
libc/src/sys/wait/waitpid.h | 4 +-
libc/src/termios/cfgetispeed.h | 4 +-
libc/src/termios/cfgetospeed.h | 4 +-
libc/src/termios/cfsetispeed.h | 4 +-
libc/src/termios/cfsetospeed.h | 4 +-
libc/src/termios/linux/cfgetispeed.cpp | 4 +-
libc/src/termios/linux/cfgetospeed.cpp | 4 +-
libc/src/termios/linux/cfsetispeed.cpp | 4 +-
libc/src/termios/linux/cfsetospeed.cpp | 4 +-
libc/src/termios/linux/kernel_termios.h | 4 +-
libc/src/termios/linux/tcdrain.cpp | 6 +-
libc/src/termios/linux/tcflow.cpp | 6 +-
libc/src/termios/linux/tcflush.cpp | 6 +-
libc/src/termios/linux/tcgetattr.cpp | 8 +-
libc/src/termios/linux/tcgetsid.cpp | 6 +-
libc/src/termios/linux/tcsendbreak.cpp | 6 +-
libc/src/termios/linux/tcsetattr.cpp | 6 +-
libc/src/termios/tcdrain.h | 4 +-
libc/src/termios/tcflow.h | 4 +-
libc/src/termios/tcflush.h | 4 +-
libc/src/termios/tcgetattr.h | 4 +-
libc/src/termios/tcgetsid.h | 4 +-
libc/src/termios/tcsendbreak.h | 4 +-
libc/src/termios/tcsetattr.h | 4 +-
libc/src/threads/call_once.cpp | 4 +-
libc/src/threads/call_once.h | 4 +-
libc/src/threads/cnd_broadcast.h | 4 +-
libc/src/threads/cnd_destroy.h | 4 +-
libc/src/threads/cnd_init.h | 4 +-
libc/src/threads/cnd_signal.h | 4 +-
libc/src/threads/cnd_wait.h | 4 +-
libc/src/threads/linux/CndVar.h | 12 +-
libc/src/threads/linux/Futex.h | 4 +-
libc/src/threads/linux/call_once.cpp | 14 +-
libc/src/threads/linux/cnd_broadcast.cpp | 4 +-
libc/src/threads/linux/cnd_destroy.cpp | 4 +-
libc/src/threads/linux/cnd_init.cpp | 4 +-
libc/src/threads/linux/cnd_signal.cpp | 4 +-
libc/src/threads/linux/cnd_wait.cpp | 4 +-
libc/src/threads/mtx_destroy.cpp | 4 +-
libc/src/threads/mtx_destroy.h | 4 +-
libc/src/threads/mtx_init.cpp | 4 +-
libc/src/threads/mtx_init.h | 4 +-
libc/src/threads/mtx_lock.cpp | 4 +-
libc/src/threads/mtx_lock.h | 4 +-
libc/src/threads/mtx_unlock.cpp | 4 +-
libc/src/threads/mtx_unlock.h | 4 +-
libc/src/threads/thrd_create.cpp | 8 +-
libc/src/threads/thrd_create.h | 4 +-
libc/src/threads/thrd_current.cpp | 6 +-
libc/src/threads/thrd_current.h | 4 +-
libc/src/threads/thrd_detach.cpp | 6 +-
libc/src/threads/thrd_detach.h | 4 +-
libc/src/threads/thrd_equal.cpp | 6 +-
libc/src/threads/thrd_equal.h | 4 +-
libc/src/threads/thrd_exit.cpp | 6 +-
libc/src/threads/thrd_exit.h | 4 +-
libc/src/threads/thrd_join.cpp | 6 +-
libc/src/threads/thrd_join.h | 4 +-
libc/src/threads/tss_create.cpp | 6 +-
libc/src/threads/tss_create.h | 4 +-
libc/src/threads/tss_delete.cpp | 6 +-
libc/src/threads/tss_delete.h | 4 +-
libc/src/threads/tss_get.cpp | 4 +-
libc/src/threads/tss_get.h | 4 +-
libc/src/threads/tss_set.cpp | 4 +-
libc/src/threads/tss_set.h | 4 +-
libc/src/time/asctime.cpp | 6 +-
libc/src/time/asctime.h | 4 +-
libc/src/time/asctime_r.cpp | 6 +-
libc/src/time/asctime_r.h | 4 +-
libc/src/time/clock.h | 4 +-
libc/src/time/clock_gettime.h | 4 +-
libc/src/time/difftime.cpp | 4 +-
libc/src/time/difftime.h | 4 +-
libc/src/time/gettimeofday.h | 4 +-
libc/src/time/gmtime.cpp | 4 +-
libc/src/time/gmtime.h | 4 +-
libc/src/time/gmtime_r.cpp | 4 +-
libc/src/time/gmtime_r.h | 4 +-
libc/src/time/gpu/clock.cpp | 4 +-
libc/src/time/gpu/nanosleep.cpp | 4 +-
libc/src/time/gpu/time_utils.cpp | 6 +-
libc/src/time/gpu/time_utils.h | 8 +-
libc/src/time/linux/clock.cpp | 4 +-
libc/src/time/linux/clockGetTimeImpl.h | 16 +-
libc/src/time/linux/clock_gettime.cpp | 4 +-
libc/src/time/linux/gettimeofday.cpp | 4 +-
libc/src/time/linux/nanosleep.cpp | 10 +-
libc/src/time/linux/time.cpp | 4 +-
libc/src/time/mktime.cpp | 6 +-
libc/src/time/mktime.h | 4 +-
libc/src/time/nanosleep.h | 4 +-
libc/src/time/time_func.h | 4 +-
libc/src/time/time_utils.cpp | 6 +-
libc/src/time/time_utils.h | 4 +-
libc/src/unistd/access.h | 4 +-
libc/src/unistd/chdir.h | 4 +-
libc/src/unistd/close.h | 4 +-
libc/src/unistd/dup.h | 4 +-
libc/src/unistd/dup2.h | 4 +-
libc/src/unistd/dup3.h | 4 +-
libc/src/unistd/environ.cpp | 4 +-
libc/src/unistd/environ.h | 4 +-
libc/src/unistd/execv.h | 4 +-
libc/src/unistd/execve.h | 4 +-
libc/src/unistd/fchdir.h | 4 +-
libc/src/unistd/fork.h | 4 +-
libc/src/unistd/fsync.h | 4 +-
libc/src/unistd/ftruncate.h | 4 +-
libc/src/unistd/getcwd.h | 4 +-
libc/src/unistd/geteuid.h | 4 +-
libc/src/unistd/getopt.cpp | 9 +-
libc/src/unistd/getopt.h | 4 +-
libc/src/unistd/getpid.h | 4 +-
libc/src/unistd/getppid.h | 4 +-
libc/src/unistd/getuid.h | 4 +-
libc/src/unistd/isatty.h | 4 +-
libc/src/unistd/link.h | 4 +-
libc/src/unistd/linkat.h | 4 +-
libc/src/unistd/linux/access.cpp | 8 +-
libc/src/unistd/linux/chdir.cpp | 6 +-
libc/src/unistd/linux/close.cpp | 6 +-
libc/src/unistd/linux/dup.cpp | 6 +-
libc/src/unistd/linux/dup2.cpp | 12 +-
libc/src/unistd/linux/dup3.cpp | 6 +-
libc/src/unistd/linux/execv.cpp | 8 +-
libc/src/unistd/linux/execve.cpp | 6 +-
libc/src/unistd/linux/fchdir.cpp | 6 +-
libc/src/unistd/linux/fork.cpp | 10 +-
libc/src/unistd/linux/fsync.cpp | 6 +-
libc/src/unistd/linux/ftruncate.cpp | 10 +-
libc/src/unistd/linux/getcwd.cpp | 6 +-
libc/src/unistd/linux/geteuid.cpp | 6 +-
libc/src/unistd/linux/getpid.cpp | 6 +-
libc/src/unistd/linux/getppid.cpp | 6 +-
libc/src/unistd/linux/getuid.cpp | 6 +-
libc/src/unistd/linux/isatty.cpp | 6 +-
libc/src/unistd/linux/link.cpp | 10 +-
libc/src/unistd/linux/linkat.cpp | 8 +-
libc/src/unistd/linux/lseek.cpp | 4 +-
libc/src/unistd/linux/pread.cpp | 10 +-
libc/src/unistd/linux/pwrite.cpp | 10 +-
libc/src/unistd/linux/read.cpp | 6 +-
libc/src/unistd/linux/readlink.cpp | 10 +-
libc/src/unistd/linux/readlinkat.cpp | 8 +-
libc/src/unistd/linux/rmdir.cpp | 10 +-
libc/src/unistd/linux/symlink.cpp | 8 +-
libc/src/unistd/linux/symlinkat.cpp | 6 +-
libc/src/unistd/linux/syscall.cpp | 10 +-
libc/src/unistd/linux/sysconf.cpp | 4 +-
libc/src/unistd/linux/truncate.cpp | 10 +-
libc/src/unistd/linux/unlink.cpp | 8 +-
libc/src/unistd/linux/unlinkat.cpp | 6 +-
libc/src/unistd/linux/write.cpp | 7 +-
libc/src/unistd/lseek.h | 4 +-
libc/src/unistd/pread.h | 4 +-
libc/src/unistd/pwrite.h | 4 +-
libc/src/unistd/read.h | 4 +-
libc/src/unistd/readlink.h | 4 +-
libc/src/unistd/readlinkat.h | 4 +-
libc/src/unistd/rmdir.h | 4 +-
libc/src/unistd/swab.cpp | 4 +-
libc/src/unistd/swab.h | 4 +-
libc/src/unistd/symlink.h | 4 +-
libc/src/unistd/symlinkat.h | 4 +-
libc/src/unistd/syscall.h | 8 +-
libc/src/unistd/sysconf.h | 4 +-
libc/src/unistd/truncate.h | 4 +-
libc/src/unistd/unlink.h | 4 +-
libc/src/unistd/unlinkat.h | 4 +-
libc/src/unistd/write.h | 4 +-
libc/src/wchar/btowc.cpp | 4 +-
libc/src/wchar/btowc.h | 4 +-
libc/src/wchar/wctob.cpp | 4 +-
libc/src/wchar/wctob.h | 4 +-
libc/startup/gpu/amdgpu/start.cpp | 16 +-
libc/startup/gpu/nvptx/start.cpp | 14 +-
libc/startup/linux/aarch64/start.cpp | 46 +-
libc/startup/linux/riscv64/start.cpp | 54 +-
libc/startup/linux/x86_64/start.cpp | 50 +-
libc/test/IntegrationTest/test.cpp | 18 +-
libc/test/IntegrationTest/test.h | 16 +-
libc/test/UnitTest/BazelFilePath.cpp | 4 +-
libc/test/UnitTest/CmakeFilePath.cpp | 4 +-
libc/test/UnitTest/ErrnoSetterMatcher.h | 4 +-
libc/test/UnitTest/ExecuteFunction.h | 4 +-
libc/test/UnitTest/ExecuteFunctionUnix.cpp | 4 +-
libc/test/UnitTest/FPExceptMatcher.cpp | 4 +-
libc/test/UnitTest/FPExceptMatcher.h | 8 +-
libc/test/UnitTest/FPMatcher.h | 50 +-
libc/test/UnitTest/FuchsiaTest.h | 2 +-
libc/test/UnitTest/HermeticTestUtils.cpp | 18 +-
libc/test/UnitTest/LibcDeathTestExecutors.cpp | 4 +-
libc/test/UnitTest/LibcTest.cpp | 77 +-
libc/test/UnitTest/LibcTest.h | 52 +-
libc/test/UnitTest/LibcTestMain.cpp | 8 +-
libc/test/UnitTest/MemoryMatcher.cpp | 6 +-
libc/test/UnitTest/MemoryMatcher.h | 22 +-
libc/test/UnitTest/PigweedTest.h | 2 +-
libc/test/UnitTest/PrintfMatcher.cpp | 4 +-
libc/test/UnitTest/PrintfMatcher.h | 8 +-
libc/test/UnitTest/RoundingModeUtils.cpp | 4 +-
libc/test/UnitTest/RoundingModeUtils.h | 4 +-
libc/test/UnitTest/ScanfMatcher.cpp | 4 +-
libc/test/UnitTest/ScanfMatcher.h | 8 +-
libc/test/UnitTest/StringUtils.h | 4 +-
libc/test/UnitTest/TestLogger.cpp | 6 +-
libc/test/UnitTest/TestLogger.h | 4 +-
.../__support/threads/thread_detach_test.cpp | 10 +-
.../src/__support/threads/thread_tls_test.cpp | 4 +-
.../src/pthread/pthread_create_test.cpp | 72 +-
.../src/pthread/pthread_equal_test.cpp | 25 +-
.../src/pthread/pthread_exit_test.cpp | 8 +-
.../src/pthread/pthread_join_test.cpp | 5 +-
.../src/pthread/pthread_mutex_test.cpp | 82 +-
.../src/pthread/pthread_name_test.cpp | 42 +-
.../src/pthread/pthread_once_test.cpp | 38 +-
.../integration/src/pthread/pthread_test.cpp | 11 +-
.../src/pthread/pthread_tss_test.cpp | 30 +-
.../src/spawn/posix_spawn_test.cpp | 14 +-
.../src/stdio/sprintf_size_test.cpp | 5 +-
.../integration/src/stdlib/getenv_test.cpp | 22 +-
.../src/threads/call_once_test.cpp | 34 +-
.../test/integration/src/threads/cnd_test.cpp | 91 +-
.../test/integration/src/threads/mtx_test.cpp | 84 +-
.../src/threads/thrd_equal_test.cpp | 24 +-
.../src/threads/thrd_exit_test.cpp | 8 +-
.../integration/src/threads/thrd_test.cpp | 11 +-
.../test/integration/src/threads/tss_test.cpp | 16 +-
.../integration/src/unistd/execv_test.cpp | 12 +-
.../integration/src/unistd/execve_test.cpp | 12 +-
.../test/integration/src/unistd/fork_test.cpp | 39 +-
.../integration/src/unistd/getcwd_test.cpp | 14 +-
.../startup/gpu/rpc_interface_test.cpp | 2 +-
.../startup/gpu/rpc_stream_test.cpp | 2 +-
.../test/integration/startup/gpu/rpc_test.cpp | 2 +-
.../integration/startup/linux/tls_test.cpp | 4 +-
libc/test/src/__support/CPP/atomic_test.cpp | 16 +-
libc/test/src/__support/CPP/bitset_test.cpp | 28 +-
libc/test/src/__support/CPP/cstddef_test.cpp | 4 +-
.../__support/CPP/integer_sequence_test.cpp | 2 +-
libc/test/src/__support/CPP/limits_test.cpp | 10 +-
libc/test/src/__support/CPP/optional_test.cpp | 4 +-
libc/test/src/__support/CPP/span_test.cpp | 4 +-
libc/test/src/__support/CPP/string_test.cpp | 6 +-
.../src/__support/CPP/stringstream_test.cpp | 4 +-
.../src/__support/CPP/stringview_test.cpp | 2 +-
.../src/__support/CPP/type_traits_test.cpp | 4 +-
.../__support/FPUtil/dyadic_float_test.cpp | 6 +-
.../test/src/__support/FPUtil/fpbits_test.cpp | 88 +-
.../__support/FPUtil/rounding_mode_test.cpp | 14 +-
libc/test/src/__support/File/file_test.cpp | 38 +-
.../src/__support/File/platform_file_test.cpp | 4 +-
.../__support/File/platform_stderr_test.cpp | 2 +-
.../__support/File/platform_stdin_test.cpp | 2 +-
.../__support/File/platform_stdout_test.cpp | 2 +-
.../OSUtil/linux/x86_64/syscall_test.cpp | 24 +-
.../test/src/__support/RPC/rpc_smoke_test.cpp | 4 +-
libc/test/src/__support/arg_list_test.cpp | 12 +-
libc/test/src/__support/blockstore_test.cpp | 10 +-
libc/test/src/__support/char_vector_test.cpp | 2 +-
libc/test/src/__support/endian_test.cpp | 4 +-
libc/test/src/__support/fixedvector_test.cpp | 8 +-
.../__support/high_precision_decimal_test.cpp | 50 +-
.../src/__support/integer_to_string_test.cpp | 18 +-
libc/test/src/__support/str_to_float_test.cpp | 84 +-
libc/test/src/__support/uint_test.cpp | 24 +-
libc/test/src/assert/assert_test.cpp | 2 +-
libc/test/src/ctype/isalnum_test.cpp | 4 +-
libc/test/src/ctype/isalpha_test.cpp | 4 +-
libc/test/src/ctype/isascii_test.cpp | 4 +-
libc/test/src/ctype/isblank_test.cpp | 4 +-
libc/test/src/ctype/iscntrl_test.cpp | 4 +-
libc/test/src/ctype/isdigit_test.cpp | 4 +-
libc/test/src/ctype/isgraph_test.cpp | 4 +-
libc/test/src/ctype/islower_test.cpp | 4 +-
libc/test/src/ctype/isprint_test.cpp | 4 +-
libc/test/src/ctype/ispunct_test.cpp | 4 +-
libc/test/src/ctype/isspace_test.cpp | 4 +-
libc/test/src/ctype/isupper_test.cpp | 4 +-
libc/test/src/ctype/isxdigit_test.cpp | 4 +-
libc/test/src/ctype/toascii_test.cpp | 4 +-
libc/test/src/ctype/tolower_test.cpp | 4 +-
libc/test/src/ctype/toupper_test.cpp | 4 +-
libc/test/src/dirent/dirent_test.cpp | 14 +-
libc/test/src/fcntl/creat_test.cpp | 10 +-
libc/test/src/fcntl/openat_test.cpp | 16 +-
.../test/src/fenv/enabled_exceptions_test.cpp | 24 +-
libc/test/src/fenv/exception_flags_test.cpp | 32 +-
libc/test/src/fenv/exception_status_test.cpp | 46 +-
libc/test/src/fenv/feclearexcept_test.cpp | 16 +-
libc/test/src/fenv/feenableexcept_test.cpp | 40 +-
libc/test/src/fenv/feholdexcept_test.cpp | 24 +-
libc/test/src/fenv/feupdateenv_test.cpp | 12 +-
libc/test/src/fenv/getenv_and_setenv_test.cpp | 38 +-
libc/test/src/fenv/rounding_mode_test.cpp | 22 +-
libc/test/src/inttypes/imaxabs_test.cpp | 6 +-
libc/test/src/inttypes/imaxdiv_test.cpp | 2 +-
libc/test/src/inttypes/strtoimax_test.cpp | 2 +-
libc/test/src/inttypes/strtoumax_test.cpp | 2 +-
libc/test/src/math/CeilTest.h | 4 +-
libc/test/src/math/CopySignTest.h | 5 +-
libc/test/src/math/FAbsTest.h | 4 +-
libc/test/src/math/FDimTest.h | 14 +-
libc/test/src/math/FMaxTest.h | 4 +-
libc/test/src/math/FMinTest.h | 4 +-
libc/test/src/math/FModTest.h | 4 +-
libc/test/src/math/FloorTest.h | 4 +-
libc/test/src/math/FmaTest.h | 20 +-
libc/test/src/math/FrexpTest.h | 10 +-
libc/test/src/math/HypotTest.h | 6 +-
libc/test/src/math/ILogbTest.h | 21 +-
libc/test/src/math/LdExpTest.h | 18 +-
libc/test/src/math/LogbTest.h | 8 +-
libc/test/src/math/ModfTest.h | 8 +-
libc/test/src/math/NextAfterTest.h | 48 +-
libc/test/src/math/RIntTest.h | 16 +-
libc/test/src/math/RandUtils.cpp | 4 +-
libc/test/src/math/RandUtils.h | 4 +-
libc/test/src/math/RemQuoTest.h | 16 +-
libc/test/src/math/RoundTest.h | 4 +-
libc/test/src/math/RoundToIntegerTest.h | 48 +-
libc/test/src/math/SqrtTest.h | 10 +-
libc/test/src/math/TruncTest.h | 4 +-
libc/test/src/math/acosf_test.cpp | 22 +-
libc/test/src/math/acoshf_test.cpp | 18 +-
libc/test/src/math/asinf_test.cpp | 20 +-
libc/test/src/math/asinhf_test.cpp | 22 +-
libc/test/src/math/atanf_test.cpp | 22 +-
libc/test/src/math/atanhf_test.cpp | 56 +-
libc/test/src/math/ceil_test.cpp | 2 +-
libc/test/src/math/ceilf_test.cpp | 2 +-
libc/test/src/math/ceill_test.cpp | 2 +-
libc/test/src/math/copysign_test.cpp | 2 +-
libc/test/src/math/copysignf_test.cpp | 2 +-
libc/test/src/math/copysignl_test.cpp | 2 +-
libc/test/src/math/cos_test.cpp | 4 +-
libc/test/src/math/cosf_test.cpp | 24 +-
libc/test/src/math/coshf_test.cpp | 26 +-
.../BinaryOpSingleOutputDiff.h | 8 +-
.../SingleInputSingleOutputDiff.h | 8 +-
.../src/math/differential_testing/Timer.cpp | 4 +-
.../src/math/differential_testing/Timer.h | 4 +-
.../math/differential_testing/ceilf_diff.cpp | 2 +-
.../math/differential_testing/ceilf_perf.cpp | 2 +-
.../math/differential_testing/cosf_diff.cpp | 2 +-
.../math/differential_testing/cosf_perf.cpp | 2 +-
.../math/differential_testing/exp2f_diff.cpp | 2 +-
.../math/differential_testing/exp2f_perf.cpp | 2 +-
.../math/differential_testing/expf_diff.cpp | 2 +-
.../math/differential_testing/expf_perf.cpp | 2 +-
.../math/differential_testing/expm1f_diff.cpp | 2 +-
.../math/differential_testing/expm1f_perf.cpp | 2 +-
.../math/differential_testing/fabsf_diff.cpp | 2 +-
.../math/differential_testing/fabsf_perf.cpp | 2 +-
.../math/differential_testing/floorf_diff.cpp | 2 +-
.../math/differential_testing/floorf_perf.cpp | 2 +-
.../math/differential_testing/fmod_diff.cpp | 3 +-
.../math/differential_testing/fmod_perf.cpp | 3 +-
.../math/differential_testing/fmodf_diff.cpp | 2 +-
.../math/differential_testing/fmodf_perf.cpp | 2 +-
.../math/differential_testing/hypot_diff.cpp | 2 +-
.../math/differential_testing/hypot_perf.cpp | 2 +-
.../math/differential_testing/hypotf_diff.cpp | 2 +-
.../math/differential_testing/hypotf_perf.cpp | 2 +-
.../math/differential_testing/log10f_perf.cpp | 2 +-
.../math/differential_testing/log1pf_perf.cpp | 2 +-
.../math/differential_testing/log2f_diff.cpp | 2 +-
.../math/differential_testing/log2f_perf.cpp | 2 +-
.../math/differential_testing/logbf_diff.cpp | 2 +-
.../math/differential_testing/logbf_perf.cpp | 2 +-
.../math/differential_testing/logf_diff.cpp | 2 +-
.../math/differential_testing/logf_perf.cpp | 2 +-
.../differential_testing/nearbyintf_diff.cpp | 2 +-
.../differential_testing/nearbyintf_perf.cpp | 2 +-
.../math/differential_testing/rintf_diff.cpp | 2 +-
.../math/differential_testing/rintf_perf.cpp | 2 +-
.../math/differential_testing/roundf_diff.cpp | 2 +-
.../math/differential_testing/roundf_perf.cpp | 2 +-
.../math/differential_testing/sinf_diff.cpp | 2 +-
.../math/differential_testing/sinf_perf.cpp | 2 +-
.../math/differential_testing/sqrtf_diff.cpp | 2 +-
.../math/differential_testing/sqrtf_perf.cpp | 2 +-
.../math/differential_testing/truncf_diff.cpp | 2 +-
.../math/differential_testing/truncf_perf.cpp | 2 +-
libc/test/src/math/erff_test.cpp | 20 +-
libc/test/src/math/exhaustive/acosf_test.cpp | 4 +-
libc/test/src/math/exhaustive/acoshf_test.cpp | 4 +-
libc/test/src/math/exhaustive/asinf_test.cpp | 4 +-
libc/test/src/math/exhaustive/asinhf_test.cpp | 4 +-
libc/test/src/math/exhaustive/atanf_test.cpp | 4 +-
libc/test/src/math/exhaustive/atanhf_test.cpp | 4 +-
libc/test/src/math/exhaustive/cosf_test.cpp | 4 +-
libc/test/src/math/exhaustive/coshf_test.cpp | 4 +-
libc/test/src/math/exhaustive/erff_test.cpp | 4 +-
.../src/math/exhaustive/exhaustive_test.h | 13 +-
libc/test/src/math/exhaustive/exp10f_test.cpp | 4 +-
libc/test/src/math/exhaustive/exp2f_test.cpp | 4 +-
libc/test/src/math/exhaustive/expf_test.cpp | 4 +-
libc/test/src/math/exhaustive/expm1f_test.cpp | 4 +-
.../exhaustive/fmod_generic_impl_test.cpp | 14 +-
libc/test/src/math/exhaustive/hypotf_test.cpp | 12 +-
libc/test/src/math/exhaustive/log10f_test.cpp | 4 +-
libc/test/src/math/exhaustive/log1pf_test.cpp | 4 +-
libc/test/src/math/exhaustive/log2f_test.cpp | 4 +-
libc/test/src/math/exhaustive/logf_test.cpp | 4 +-
.../test/src/math/exhaustive/sincosf_test.cpp | 8 +-
libc/test/src/math/exhaustive/sinf_test.cpp | 4 +-
libc/test/src/math/exhaustive/sinhf_test.cpp | 4 +-
libc/test/src/math/exhaustive/sqrtf_test.cpp | 4 +-
libc/test/src/math/exhaustive/tanf_test.cpp | 4 +-
libc/test/src/math/exhaustive/tanhf_test.cpp | 4 +-
libc/test/src/math/exp10_test.cpp | 27 +-
libc/test/src/math/exp10f_test.cpp | 32 +-
libc/test/src/math/exp2_test.cpp | 27 +-
libc/test/src/math/exp2f_test.cpp | 32 +-
libc/test/src/math/exp_test.cpp | 29 +-
libc/test/src/math/expf_test.cpp | 52 +-
libc/test/src/math/explogxf_test.cpp | 14 +-
libc/test/src/math/expm1f_test.cpp | 44 +-
libc/test/src/math/fabs_test.cpp | 2 +-
libc/test/src/math/fabsf_test.cpp | 2 +-
libc/test/src/math/fabsl_test.cpp | 2 +-
libc/test/src/math/fdim_test.cpp | 12 +-
libc/test/src/math/fdimf_test.cpp | 12 +-
libc/test/src/math/fdiml_test.cpp | 12 +-
libc/test/src/math/floor_test.cpp | 2 +-
libc/test/src/math/floorf_test.cpp | 2 +-
libc/test/src/math/floorl_test.cpp | 2 +-
libc/test/src/math/fma_test.cpp | 10 +-
libc/test/src/math/fmaf_test.cpp | 8 +-
libc/test/src/math/fmax_test.cpp | 2 +-
libc/test/src/math/fmaxf_test.cpp | 2 +-
libc/test/src/math/fmaxl_test.cpp | 2 +-
libc/test/src/math/fmin_test.cpp | 2 +-
libc/test/src/math/fminf_test.cpp | 2 +-
libc/test/src/math/fminl_test.cpp | 2 +-
libc/test/src/math/fmod_test.cpp | 2 +-
libc/test/src/math/fmodf_test.cpp | 2 +-
libc/test/src/math/frexp_test.cpp | 2 +-
libc/test/src/math/frexpf_test.cpp | 2 +-
libc/test/src/math/frexpl_test.cpp | 2 +-
libc/test/src/math/generic_sqrt_test.cpp | 2 +-
libc/test/src/math/generic_sqrtf_test.cpp | 2 +-
libc/test/src/math/generic_sqrtl_test.cpp | 2 +-
libc/test/src/math/hypot_test.cpp | 6 +-
libc/test/src/math/hypotf_hard_to_round.h | 2 +-
libc/test/src/math/hypotf_test.cpp | 9 +-
libc/test/src/math/ilogb_test.cpp | 10 +-
libc/test/src/math/ilogbf_test.cpp | 10 +-
libc/test/src/math/ilogbl_test.cpp | 10 +-
libc/test/src/math/inv_trigf_utils_test.cpp | 8 +-
libc/test/src/math/ldexp_test.cpp | 2 +-
libc/test/src/math/ldexpf_test.cpp | 2 +-
libc/test/src/math/ldexpl_test.cpp | 2 +-
libc/test/src/math/llrint_test.cpp | 3 +-
libc/test/src/math/llrintf_test.cpp | 3 +-
libc/test/src/math/llrintl_test.cpp | 2 +-
libc/test/src/math/llround_test.cpp | 2 +-
libc/test/src/math/llroundf_test.cpp | 2 +-
libc/test/src/math/llroundl_test.cpp | 2 +-
libc/test/src/math/log10_test.cpp | 26 +-
libc/test/src/math/log10f_test.cpp | 21 +-
libc/test/src/math/log1p_test.cpp | 25 +-
libc/test/src/math/log1pf_test.cpp | 18 +-
libc/test/src/math/log2_test.cpp | 25 +-
libc/test/src/math/log2f_test.cpp | 24 +-
libc/test/src/math/log_test.cpp | 28 +-
libc/test/src/math/logb_test.cpp | 2 +-
libc/test/src/math/logbf_test.cpp | 2 +-
libc/test/src/math/logbl_test.cpp | 2 +-
libc/test/src/math/logf_test.cpp | 22 +-
libc/test/src/math/lrint_test.cpp | 2 +-
libc/test/src/math/lrintf_test.cpp | 2 +-
libc/test/src/math/lrintl_test.cpp | 3 +-
libc/test/src/math/lround_test.cpp | 2 +-
libc/test/src/math/lroundf_test.cpp | 2 +-
libc/test/src/math/lroundl_test.cpp | 2 +-
libc/test/src/math/modf_test.cpp | 2 +-
libc/test/src/math/modff_test.cpp | 2 +-
libc/test/src/math/modfl_test.cpp | 2 +-
libc/test/src/math/nextafter_test.cpp | 2 +-
libc/test/src/math/nextafterf_test.cpp | 2 +-
libc/test/src/math/nextafterl_test.cpp | 2 +-
libc/test/src/math/remquo_test.cpp | 2 +-
libc/test/src/math/remquof_test.cpp | 2 +-
libc/test/src/math/remquol_test.cpp | 2 +-
libc/test/src/math/rint_test.cpp | 2 +-
libc/test/src/math/rintf_test.cpp | 2 +-
libc/test/src/math/rintl_test.cpp | 2 +-
libc/test/src/math/round_test.cpp | 2 +-
libc/test/src/math/roundf_test.cpp | 2 +-
libc/test/src/math/roundl_test.cpp | 2 +-
libc/test/src/math/scalbn_test.cpp | 2 +-
libc/test/src/math/scalbnf_test.cpp | 2 +-
libc/test/src/math/scalbnl_test.cpp | 2 +-
libc/test/src/math/sdcomp26094.h | 6 +-
libc/test/src/math/sin_test.cpp | 4 +-
libc/test/src/math/sincosf_test.cpp | 26 +-
libc/test/src/math/sinf_test.cpp | 32 +-
libc/test/src/math/sinhf_test.cpp | 30 +-
libc/test/src/math/smoke/CeilTest.h | 2 +-
libc/test/src/math/smoke/CopySignTest.h | 3 +-
libc/test/src/math/smoke/FAbsTest.h | 2 +-
libc/test/src/math/smoke/FDimTest.h | 14 +-
libc/test/src/math/smoke/FMaxTest.h | 2 +-
libc/test/src/math/smoke/FMinTest.h | 2 +-
libc/test/src/math/smoke/FModTest.h | 4 +-
libc/test/src/math/smoke/FloorTest.h | 2 +-
libc/test/src/math/smoke/FmaTest.h | 14 +-
libc/test/src/math/smoke/FrexpTest.h | 4 +-
libc/test/src/math/smoke/HypotTest.h | 4 +-
libc/test/src/math/smoke/ILogbTest.h | 21 +-
libc/test/src/math/smoke/LdExpTest.h | 18 +-
libc/test/src/math/smoke/LogbTest.h | 6 +-
libc/test/src/math/smoke/ModfTest.h | 6 +-
libc/test/src/math/smoke/NextAfterTest.h | 48 +-
libc/test/src/math/smoke/RIntTest.h | 6 +-
libc/test/src/math/smoke/RemQuoTest.h | 14 +-
libc/test/src/math/smoke/RoundTest.h | 2 +-
libc/test/src/math/smoke/RoundToIntegerTest.h | 38 +-
libc/test/src/math/smoke/SqrtTest.h | 4 +-
libc/test/src/math/smoke/TruncTest.h | 2 +-
libc/test/src/math/smoke/acosf_test.cpp | 14 +-
libc/test/src/math/smoke/acoshf_test.cpp | 12 +-
libc/test/src/math/smoke/asinf_test.cpp | 16 +-
libc/test/src/math/smoke/asinhf_test.cpp | 12 +-
libc/test/src/math/smoke/atanf_test.cpp | 14 +-
libc/test/src/math/smoke/atanhf_test.cpp | 30 +-
libc/test/src/math/smoke/ceil_test.cpp | 2 +-
libc/test/src/math/smoke/ceilf_test.cpp | 2 +-
libc/test/src/math/smoke/ceill_test.cpp | 2 +-
libc/test/src/math/smoke/copysign_test.cpp | 2 +-
libc/test/src/math/smoke/copysignf_test.cpp | 2 +-
libc/test/src/math/smoke/copysignl_test.cpp | 2 +-
libc/test/src/math/smoke/cosf_test.cpp | 12 +-
libc/test/src/math/smoke/coshf_test.cpp | 18 +-
libc/test/src/math/smoke/erff_test.cpp | 12 +-
libc/test/src/math/smoke/exp10_test.cpp | 23 +-
libc/test/src/math/smoke/exp10f_test.cpp | 22 +-
libc/test/src/math/smoke/exp2_test.cpp | 25 +-
libc/test/src/math/smoke/exp2f_test.cpp | 24 +-
libc/test/src/math/smoke/exp_test.cpp | 17 +-
libc/test/src/math/smoke/expf_test.cpp | 16 +-
libc/test/src/math/smoke/expm1f_test.cpp | 16 +-
libc/test/src/math/smoke/fabs_test.cpp | 2 +-
libc/test/src/math/smoke/fabsf_test.cpp | 2 +-
libc/test/src/math/smoke/fabsl_test.cpp | 2 +-
libc/test/src/math/smoke/fdim_test.cpp | 12 +-
libc/test/src/math/smoke/fdimf_test.cpp | 12 +-
libc/test/src/math/smoke/fdiml_test.cpp | 12 +-
libc/test/src/math/smoke/floor_test.cpp | 2 +-
libc/test/src/math/smoke/floorf_test.cpp | 2 +-
libc/test/src/math/smoke/floorl_test.cpp | 2 +-
libc/test/src/math/smoke/fma_test.cpp | 2 +-
libc/test/src/math/smoke/fmaf_test.cpp | 2 +-
libc/test/src/math/smoke/fmax_test.cpp | 2 +-
libc/test/src/math/smoke/fmaxf_test.cpp | 2 +-
libc/test/src/math/smoke/fmaxl_test.cpp | 2 +-
libc/test/src/math/smoke/fmin_test.cpp | 2 +-
libc/test/src/math/smoke/fminf_test.cpp | 2 +-
libc/test/src/math/smoke/fminl_test.cpp | 2 +-
libc/test/src/math/smoke/fmod_test.cpp | 2 +-
libc/test/src/math/smoke/fmodf_test.cpp | 2 +-
libc/test/src/math/smoke/frexp_test.cpp | 2 +-
libc/test/src/math/smoke/frexpf_test.cpp | 2 +-
libc/test/src/math/smoke/frexpl_test.cpp | 2 +-
.../test/src/math/smoke/generic_sqrt_test.cpp | 2 +-
.../src/math/smoke/generic_sqrtf_test.cpp | 2 +-
.../src/math/smoke/generic_sqrtl_test.cpp | 2 +-
libc/test/src/math/smoke/hypot_test.cpp | 2 +-
libc/test/src/math/smoke/hypotf_test.cpp | 2 +-
libc/test/src/math/smoke/ilogb_test.cpp | 10 +-
libc/test/src/math/smoke/ilogbf_test.cpp | 10 +-
libc/test/src/math/smoke/ilogbl_test.cpp | 10 +-
libc/test/src/math/smoke/ldexp_test.cpp | 2 +-
libc/test/src/math/smoke/ldexpf_test.cpp | 2 +-
libc/test/src/math/smoke/ldexpl_test.cpp | 2 +-
libc/test/src/math/smoke/llrint_test.cpp | 3 +-
libc/test/src/math/smoke/llrintf_test.cpp | 3 +-
libc/test/src/math/smoke/llrintl_test.cpp | 2 +-
libc/test/src/math/smoke/llround_test.cpp | 2 +-
libc/test/src/math/smoke/llroundf_test.cpp | 2 +-
libc/test/src/math/smoke/llroundl_test.cpp | 2 +-
libc/test/src/math/smoke/log10_test.cpp | 20 +-
libc/test/src/math/smoke/log10f_test.cpp | 17 +-
libc/test/src/math/smoke/log1p_test.cpp | 17 +-
libc/test/src/math/smoke/log1pf_test.cpp | 12 +-
libc/test/src/math/smoke/log2_test.cpp | 17 +-
libc/test/src/math/smoke/log2f_test.cpp | 16 +-
libc/test/src/math/smoke/log_test.cpp | 16 +-
libc/test/src/math/smoke/logb_test.cpp | 2 +-
libc/test/src/math/smoke/logbf_test.cpp | 2 +-
libc/test/src/math/smoke/logbl_test.cpp | 2 +-
libc/test/src/math/smoke/logf_test.cpp | 16 +-
libc/test/src/math/smoke/lrint_test.cpp | 2 +-
libc/test/src/math/smoke/lrintf_test.cpp | 2 +-
libc/test/src/math/smoke/lrintl_test.cpp | 3 +-
libc/test/src/math/smoke/lround_test.cpp | 2 +-
libc/test/src/math/smoke/lroundf_test.cpp | 2 +-
libc/test/src/math/smoke/lroundl_test.cpp | 2 +-
libc/test/src/math/smoke/modf_test.cpp | 2 +-
libc/test/src/math/smoke/modff_test.cpp | 2 +-
libc/test/src/math/smoke/modfl_test.cpp | 2 +-
libc/test/src/math/smoke/nextafter_test.cpp | 2 +-
libc/test/src/math/smoke/nextafterf_test.cpp | 2 +-
libc/test/src/math/smoke/nextafterl_test.cpp | 2 +-
libc/test/src/math/smoke/remquo_test.cpp | 2 +-
libc/test/src/math/smoke/remquof_test.cpp | 2 +-
libc/test/src/math/smoke/remquol_test.cpp | 2 +-
libc/test/src/math/smoke/rint_test.cpp | 2 +-
libc/test/src/math/smoke/rintf_test.cpp | 2 +-
libc/test/src/math/smoke/rintl_test.cpp | 2 +-
libc/test/src/math/smoke/round_test.cpp | 2 +-
libc/test/src/math/smoke/roundf_test.cpp | 2 +-
libc/test/src/math/smoke/roundl_test.cpp | 2 +-
libc/test/src/math/smoke/scalbn_test.cpp | 2 +-
libc/test/src/math/smoke/scalbnf_test.cpp | 2 +-
libc/test/src/math/smoke/scalbnl_test.cpp | 2 +-
libc/test/src/math/smoke/sincosf_test.cpp | 12 +-
libc/test/src/math/smoke/sinf_test.cpp | 12 +-
libc/test/src/math/smoke/sinhf_test.cpp | 22 +-
libc/test/src/math/smoke/sqrt_test.cpp | 2 +-
libc/test/src/math/smoke/sqrtf_test.cpp | 2 +-
libc/test/src/math/smoke/sqrtl_test.cpp | 2 +-
libc/test/src/math/smoke/tanf_test.cpp | 12 +-
libc/test/src/math/smoke/tanhf_test.cpp | 12 +-
libc/test/src/math/smoke/trunc_test.cpp | 2 +-
libc/test/src/math/smoke/truncf_test.cpp | 2 +-
libc/test/src/math/smoke/truncl_test.cpp | 2 +-
libc/test/src/math/sqrt_test.cpp | 2 +-
libc/test/src/math/sqrtf_test.cpp | 2 +-
libc/test/src/math/sqrtl_test.cpp | 2 +-
libc/test/src/math/tan_test.cpp | 4 +-
libc/test/src/math/tanf_test.cpp | 24 +-
libc/test/src/math/tanhf_test.cpp | 20 +-
libc/test/src/math/trunc_test.cpp | 2 +-
libc/test/src/math/truncf_test.cpp | 2 +-
libc/test/src/math/truncl_test.cpp | 2 +-
libc/test/src/network/htonl_test.cpp | 6 +-
libc/test/src/network/htons_test.cpp | 6 +-
libc/test/src/network/ntohl_test.cpp | 6 +-
libc/test/src/network/ntohs_test.cpp | 6 +-
libc/test/src/pthread/pthread_attr_test.cpp | 66 +-
.../src/pthread/pthread_mutexattr_test.cpp | 59 +-
libc/test/src/sched/affinity_test.cpp | 22 +-
libc/test/src/sched/cpu_count_test.cpp | 8 +-
libc/test/src/sched/get_priority_test.cpp | 28 +-
.../src/sched/param_and_scheduler_test.cpp | 46 +-
.../src/sched/sched_rr_get_interval_test.cpp | 16 +-
libc/test/src/sched/yield_test.cpp | 2 +-
libc/test/src/setjmp/setjmp_test.cpp | 6 +-
libc/test/src/signal/kill_test.cpp | 10 +-
libc/test/src/signal/raise_test.cpp | 4 +-
libc/test/src/signal/sigaction_test.cpp | 27 +-
libc/test/src/signal/sigaddset_test.cpp | 16 +-
libc/test/src/signal/sigaltstack_test.cpp | 18 +-
libc/test/src/signal/sigdelset_test.cpp | 17 +-
libc/test/src/signal/sigfillset_test.cpp | 13 +-
libc/test/src/signal/signal_test.cpp | 17 +-
libc/test/src/signal/sigprocmask_test.cpp | 30 +-
.../spawn/posix_spawn_file_actions_test.cpp | 50 +-
libc/test/src/stdio/fgetc_test.cpp | 24 +-
libc/test/src/stdio/fgetc_unlocked_test.cpp | 29 +-
libc/test/src/stdio/fgets_test.cpp | 32 +-
libc/test/src/stdio/fileop_test.cpp | 114 +-
libc/test/src/stdio/fopen_test.cpp | 12 +-
libc/test/src/stdio/fopencookie_test.cpp | 79 +-
libc/test/src/stdio/fprintf_test.cpp | 16 +-
libc/test/src/stdio/fputc_test.cpp | 6 +-
libc/test/src/stdio/fputs_test.cpp | 8 +-
libc/test/src/stdio/fscanf_test.cpp | 37 +-
libc/test/src/stdio/ftell_test.cpp | 26 +-
.../src/stdio/printf_core/converter_test.cpp | 76 +-
.../src/stdio/printf_core/parser_test.cpp | 134 +-
.../src/stdio/printf_core/writer_test.cpp | 10 +-
libc/test/src/stdio/printf_test.cpp | 6 +-
libc/test/src/stdio/putc_test.cpp | 16 +-
libc/test/src/stdio/puts_test.cpp | 6 +-
libc/test/src/stdio/remove_test.cpp | 31 +-
.../src/stdio/scanf_core/converter_test.cpp | 202 +--
.../test/src/stdio/scanf_core/parser_test.cpp | 166 +--
.../stdio/scanf_core/string_reader_test.cpp | 12 +-
libc/test/src/stdio/setbuf_test.cpp | 38 +-
libc/test/src/stdio/setvbuf_test.cpp | 53 +-
libc/test/src/stdio/snprintf_test.cpp | 16 +-
libc/test/src/stdio/sprintf_test.cpp | 1320 +++++++++--------
libc/test/src/stdio/sscanf_test.cpp | 371 ++---
libc/test/src/stdio/ungetc_test.cpp | 31 +-
libc/test/src/stdio/unlocked_fileop_test.cpp | 44 +-
libc/test/src/stdio/vfprintf_test.cpp | 10 +-
libc/test/src/stdio/vprintf_test.cpp | 2 +-
libc/test/src/stdio/vsnprintf_test.cpp | 2 +-
libc/test/src/stdio/vsprintf_test.cpp | 2 +-
libc/test/src/stdlib/AtoiTest.h | 5 +-
libc/test/src/stdlib/DivTest.h | 2 +-
libc/test/src/stdlib/StrtolTest.h | 8 +-
libc/test/src/stdlib/_Exit_test.cpp | 8 +-
libc/test/src/stdlib/abort_test.cpp | 4 +-
libc/test/src/stdlib/abs_test.cpp | 6 +-
libc/test/src/stdlib/atexit_test.cpp | 29 +-
libc/test/src/stdlib/atof_test.cpp | 10 +-
libc/test/src/stdlib/atoi_test.cpp | 2 +-
libc/test/src/stdlib/atol_test.cpp | 2 +-
libc/test/src/stdlib/atoll_test.cpp | 2 +-
libc/test/src/stdlib/bsearch_test.cpp | 35 +-
libc/test/src/stdlib/div_test.cpp | 2 +-
libc/test/src/stdlib/labs_test.cpp | 6 +-
libc/test/src/stdlib/ldiv_test.cpp | 2 +-
libc/test/src/stdlib/llabs_test.cpp | 10 +-
libc/test/src/stdlib/lldiv_test.cpp | 2 +-
libc/test/src/stdlib/malloc_test.cpp | 4 +-
libc/test/src/stdlib/qsort_r_test.cpp | 14 +-
libc/test/src/stdlib/qsort_test.cpp | 32 +-
libc/test/src/stdlib/rand_test.cpp | 14 +-
libc/test/src/stdlib/strtod_test.cpp | 16 +-
libc/test/src/stdlib/strtof_test.cpp | 12 +-
libc/test/src/stdlib/strtoint32_test.cpp | 8 +-
libc/test/src/stdlib/strtoint64_test.cpp | 8 +-
libc/test/src/stdlib/strtol_test.cpp | 2 +-
libc/test/src/stdlib/strtold_test.cpp | 14 +-
libc/test/src/stdlib/strtoll_test.cpp | 2 +-
libc/test/src/stdlib/strtoul_test.cpp | 2 +-
libc/test/src/stdlib/strtoull_test.cpp | 2 +-
libc/test/src/string/StrchrTest.h | 4 +-
libc/test/src/string/bcmp_test.cpp | 14 +-
libc/test/src/string/bcopy_test.cpp | 22 +-
libc/test/src/string/bzero_test.cpp | 6 +-
libc/test/src/string/index_test.cpp | 2 +-
libc/test/src/string/memccpy_test.cpp | 10 +-
libc/test/src/string/memchr_test.cpp | 6 +-
libc/test/src/string/memcmp_test.cpp | 14 +-
libc/test/src/string/memcpy_test.cpp | 6 +-
libc/test/src/string/memmem_test.cpp | 36 +-
libc/test/src/string/memmove_test.cpp | 22 +-
.../string/memory_utils/memory_check_utils.h | 4 +-
.../test/src/string/memory_utils/op_tests.cpp | 4 +-
.../src/string/memory_utils/utils_test.cpp | 4 +-
libc/test/src/string/mempcpy_test.cpp | 4 +-
libc/test/src/string/memrchr_test.cpp | 2 +-
libc/test/src/string/memset_test.cpp | 6 +-
libc/test/src/string/rindex_test.cpp | 2 +-
libc/test/src/string/stpcpy_test.cpp | 12 +-
libc/test/src/string/stpncpy_test.cpp | 10 +-
libc/test/src/string/strcasecmp_test.cpp | 12 +-
libc/test/src/string/strcasestr_test.cpp | 16 +-
libc/test/src/string/strcat_test.cpp | 4 +-
libc/test/src/string/strchr_test.cpp | 2 +-
libc/test/src/string/strchrnul_test.cpp | 28 +-
libc/test/src/string/strcmp_test.cpp | 32 +-
libc/test/src/string/strcoll_test.cpp | 8 +-
libc/test/src/string/strcpy_test.cpp | 6 +-
libc/test/src/string/strcspn_test.cpp | 34 +-
libc/test/src/string/strdup_test.cpp | 6 +-
libc/test/src/string/strerror_r_test.cpp | 4 +-
libc/test/src/string/strerror_test.cpp | 15 +-
libc/test/src/string/strlcat_test.cpp | 10 +-
libc/test/src/string/strlcpy_test.cpp | 6 +-
libc/test/src/string/strlen_test.cpp | 4 +-
libc/test/src/string/strncasecmp_test.cpp | 12 +-
libc/test/src/string/strncat_test.cpp | 16 +-
libc/test/src/string/strncmp_test.cpp | 52 +-
libc/test/src/string/strncpy_test.cpp | 10 +-
libc/test/src/string/strndup_test.cpp | 10 +-
libc/test/src/string/strnlen_test.cpp | 24 +-
libc/test/src/string/strpbrk_test.cpp | 38 +-
libc/test/src/string/strrchr_test.cpp | 2 +-
libc/test/src/string/strsep_test.cpp | 12 +-
libc/test/src/string/strsignal_test.cpp | 16 +-
libc/test/src/string/strspn_test.cpp | 66 +-
libc/test/src/string/strstr_test.cpp | 44 +-
libc/test/src/string/strtok_r_test.cpp | 68 +-
libc/test/src/string/strtok_test.cpp | 42 +-
libc/test/src/string/strxfrm_test.cpp | 10 +-
libc/test/src/sys/mman/linux/madvise_test.cpp | 16 +-
libc/test/src/sys/mman/linux/mmap_test.cpp | 16 +-
.../test/src/sys/mman/linux/mprotect_test.cpp | 19 +-
.../src/sys/mman/linux/posix_madvise_test.cpp | 17 +-
.../src/sys/random/linux/getrandom_test.cpp | 18 +-
.../sys/resource/getrlimit_setrlimit_test.cpp | 32 +-
.../src/sys/select/select_failure_test.cpp | 4 +-
libc/test/src/sys/select/select_ui_test.cpp | 7 +-
libc/test/src/sys/sendfile/sendfile_test.cpp | 30 +-
.../test/src/sys/socket/linux/socket_test.cpp | 4 +-
libc/test/src/sys/stat/chmod_test.cpp | 30 +-
libc/test/src/sys/stat/fchmod_test.cpp | 27 +-
libc/test/src/sys/stat/fchmodat_test.cpp | 32 +-
libc/test/src/sys/stat/fstat_test.cpp | 16 +-
libc/test/src/sys/stat/lstat_test.cpp | 17 +-
libc/test/src/sys/stat/mkdirat_test.cpp | 14 +-
libc/test/src/sys/stat/stat_test.cpp | 17 +-
libc/test/src/sys/utsname/uname_test.cpp | 2 +-
libc/test/src/sys/wait/wait4_test.cpp | 5 +-
libc/test/src/sys/wait/waitpid_test.cpp | 4 +-
libc/test/src/termios/termios_test.cpp | 28 +-
libc/test/src/time/TmHelper.h | 6 +-
libc/test/src/time/TmMatcher.h | 6 +-
libc/test/src/time/asctime_r_test.cpp | 12 +-
libc/test/src/time/asctime_test.cpp | 6 +-
libc/test/src/time/clock_gettime_test.cpp | 6 +-
libc/test/src/time/clock_test.cpp | 4 +-
libc/test/src/time/difftime_test.cpp | 18 +-
libc/test/src/time/gettimeofday_test.cpp | 10 +-
libc/test/src/time/gmtime_r_test.cpp | 6 +-
libc/test/src/time/gmtime_test.cpp | 42 +-
libc/test/src/time/mktime_test.cpp | 52 +-
libc/test/src/time/nanosleep_test.cpp | 6 +-
libc/test/src/time/time_test.cpp | 4 +-
libc/test/src/unistd/access_test.cpp | 30 +-
libc/test/src/unistd/chdir_test.cpp | 16 +-
libc/test/src/unistd/dup2_test.cpp | 27 +-
libc/test/src/unistd/dup3_test.cpp | 29 +-
libc/test/src/unistd/dup_test.cpp | 25 +-
libc/test/src/unistd/fchdir_test.cpp | 20 +-
libc/test/src/unistd/ftruncate_test.cpp | 34 +-
libc/test/src/unistd/geteuid_test.cpp | 2 +-
libc/test/src/unistd/getopt_test.cpp | 40 +-
libc/test/src/unistd/getpid_test.cpp | 2 +-
libc/test/src/unistd/getppid_test.cpp | 2 +-
libc/test/src/unistd/getuid_test.cpp | 2 +-
libc/test/src/unistd/isatty_test.cpp | 32 +-
libc/test/src/unistd/link_test.cpp | 20 +-
libc/test/src/unistd/linkat_test.cpp | 30 +-
libc/test/src/unistd/lseek_test.cpp | 27 +-
libc/test/src/unistd/pread_pwrite_test.cpp | 37 +-
libc/test/src/unistd/read_write_test.cpp | 28 +-
libc/test/src/unistd/readlink_test.cpp | 14 +-
libc/test/src/unistd/readlinkat_test.cpp | 18 +-
libc/test/src/unistd/rmdir_test.cpp | 11 +-
libc/test/src/unistd/swab_test.cpp | 30 +-
libc/test/src/unistd/symlink_test.cpp | 22 +-
libc/test/src/unistd/symlinkat_test.cpp | 27 +-
libc/test/src/unistd/syscall_test.cpp | 68 +-
libc/test/src/unistd/sysconf_test.cpp | 2 +-
libc/test/src/unistd/truncate_test.cpp | 30 +-
libc/test/src/unistd/unlink_test.cpp | 13 +-
libc/test/src/unistd/unlinkat_test.cpp | 22 +-
libc/test/src/wchar/btowc_test.cpp | 4 +-
libc/test/src/wchar/wctob_test.cpp | 4 +-
.../utils/FPUtil/x86_long_double_test.cpp | 2 +-
libc/test/utils/UnitTest/testfilter_test.cpp | 14 +-
.../PrototypeTestGen/PrototypeTestGen.cpp | 3 +-
libc/utils/MPFRWrapper/MPFRUtils.cpp | 8 +-
libc/utils/MPFRWrapper/MPFRUtils.h | 40 +-
libc/utils/gpu/loader/amdgpu/Loader.cpp | 2 +-
libc/utils/gpu/server/rpc_server.cpp | 2 +-
libc/utils/gpu/server/rpc_server.h | 2 +-
2041 files changed, 8538 insertions(+), 8361 deletions(-)
diff --git a/libc/benchmarks/CMakeLists.txt b/libc/benchmarks/CMakeLists.txt
index 48f5f48ff832248..4978da65850ccba 100644
--- a/libc/benchmarks/CMakeLists.txt
+++ b/libc/benchmarks/CMakeLists.txt
@@ -162,7 +162,7 @@ function(add_libc_multi_impl_benchmark name)
get_target_property(entrypoint_object_file ${fq_config_name} "OBJECT_FILE_RAW")
target_link_libraries(${benchmark_name} PUBLIC json ${entrypoint_object_file})
string(TOUPPER ${name} name_upper)
- target_compile_definitions(${benchmark_name} PRIVATE "-DLIBC_BENCHMARK_FUNCTION_${name_upper}=__llvm_libc::${name}" "-DLIBC_BENCHMARK_FUNCTION_NAME=\"${fq_config_name}\"")
+ target_compile_definitions(${benchmark_name} PRIVATE "-DLIBC_BENCHMARK_FUNCTION_${name_upper}=LIBC_NAMESPACE::${name}" "-DLIBC_BENCHMARK_FUNCTION_NAME=\"${fq_config_name}\"")
llvm_update_compile_flags(${benchmark_name})
else()
message(STATUS "Skipping benchmark for '${fq_config_name}' insufficient host cpu features '${required_cpu_features}'")
diff --git a/libc/benchmarks/LibcDefaultImplementations.cpp b/libc/benchmarks/LibcDefaultImplementations.cpp
index 95077cd6591530e..c50ae00ffa105ea 100644
--- a/libc/benchmarks/LibcDefaultImplementations.cpp
+++ b/libc/benchmarks/LibcDefaultImplementations.cpp
@@ -2,7 +2,7 @@
#include "llvm/ADT/ArrayRef.h"
#include <cstddef>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
extern void *memcpy(void *__restrict, const void *__restrict, size_t);
extern void *memmove(void *, const void *, size_t);
@@ -11,7 +11,7 @@ extern void bzero(void *, size_t);
extern int memcmp(const void *, const void *, size_t);
extern int bcmp(const void *, const void *, size_t);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
// List of implementations to test.
@@ -23,31 +23,31 @@ using llvm::libc_benchmarks::MemsetConfiguration;
llvm::ArrayRef<MemcpyConfiguration> getMemcpyConfigurations() {
static constexpr MemcpyConfiguration kMemcpyConfigurations[] = {
- {__llvm_libc::memcpy, "__llvm_libc::memcpy"}};
+ {LIBC_NAMESPACE::memcpy, "LIBC_NAMESPACE::memcpy"}};
return llvm::ArrayRef(kMemcpyConfigurations);
}
llvm::ArrayRef<MemmoveConfiguration> getMemmoveConfigurations() {
static constexpr MemmoveConfiguration kMemmoveConfigurations[] = {
- {__llvm_libc::memmove, "__llvm_libc::memmove"}};
+ {LIBC_NAMESPACE::memmove, "LIBC_NAMESPACE::memmove"}};
return llvm::ArrayRef(kMemmoveConfigurations);
}
llvm::ArrayRef<MemcmpOrBcmpConfiguration> getMemcmpConfigurations() {
static constexpr MemcmpOrBcmpConfiguration kMemcmpConfiguration[] = {
- {__llvm_libc::memcmp, "__llvm_libc::memcmp"}};
+ {LIBC_NAMESPACE::memcmp, "LIBC_NAMESPACE::memcmp"}};
return llvm::ArrayRef(kMemcmpConfiguration);
}
llvm::ArrayRef<MemcmpOrBcmpConfiguration> getBcmpConfigurations() {
static constexpr MemcmpOrBcmpConfiguration kBcmpConfigurations[] = {
- {__llvm_libc::bcmp, "__llvm_libc::bcmp"}};
+ {LIBC_NAMESPACE::bcmp, "LIBC_NAMESPACE::bcmp"}};
return llvm::ArrayRef(kBcmpConfigurations);
}
llvm::ArrayRef<MemsetConfiguration> getMemsetConfigurations() {
static constexpr MemsetConfiguration kMemsetConfigurations[] = {
- {__llvm_libc::memset, "__llvm_libc::memset"}};
+ {LIBC_NAMESPACE::memset, "LIBC_NAMESPACE::memset"}};
return llvm::ArrayRef(kMemsetConfigurations);
}
llvm::ArrayRef<BzeroConfiguration> getBzeroConfigurations() {
static constexpr BzeroConfiguration kBzeroConfigurations[] = {
- {__llvm_libc::bzero, "__llvm_libc::bzero"}};
+ {LIBC_NAMESPACE::bzero, "LIBC_NAMESPACE::bzero"}};
return llvm::ArrayRef(kBzeroConfigurations);
}
diff --git a/libc/benchmarks/LibcMemoryBenchmark.h b/libc/benchmarks/LibcMemoryBenchmark.h
index f00bed4f6931176..5ba8b936a0cafa6 100644
--- a/libc/benchmarks/LibcMemoryBenchmark.h
+++ b/libc/benchmarks/LibcMemoryBenchmark.h
@@ -32,7 +32,7 @@ namespace libc_benchmarks {
struct StudyConfiguration {
// One of 'memcpy', 'memset', 'memcmp'.
// The underlying implementation is always the llvm libc one.
- // e.g. 'memcpy' will test '__llvm_libc::memcpy'
+ // e.g. 'memcpy' will test 'LIBC_NAMESPACE::memcpy'
std::string Function;
// The number of trials to run for this benchmark.
diff --git a/libc/benchmarks/LibcMemoryBenchmarkMain.cpp b/libc/benchmarks/LibcMemoryBenchmarkMain.cpp
index 4fc6777cec45d00..acd7c30717597a1 100644
--- a/libc/benchmarks/LibcMemoryBenchmarkMain.cpp
+++ b/libc/benchmarks/LibcMemoryBenchmarkMain.cpp
@@ -21,7 +21,7 @@
#include <cstring>
#include <unistd.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
extern void *memcpy(void *__restrict, const void *__restrict, size_t);
extern void *memmove(void *, const void *, size_t);
@@ -30,7 +30,7 @@ extern void bzero(void *, size_t);
extern int memcmp(const void *, const void *, size_t);
extern int bcmp(const void *, const void *, size_t);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
namespace llvm {
namespace libc_benchmarks {
diff --git a/libc/benchmarks/automemcpy/lib/CodeGen.cpp b/libc/benchmarks/automemcpy/lib/CodeGen.cpp
index f4060099bddd77c..3837bd97d9f9a70 100644
--- a/libc/benchmarks/automemcpy/lib/CodeGen.cpp
+++ b/libc/benchmarks/automemcpy/lib/CodeGen.cpp
@@ -62,7 +62,7 @@ namespace functions {
// static void memcpy_0xB20D4702493C397E(char *__restrict dst,
// const char *__restrict src,
// size_t size) {
-// using namespace __llvm_libc::x86;
+// using namespace LIBC_NAMESPACE::x86;
// if(size == 0) return;
// if(size == 1) return copy<_1>(dst, src);
// if(size < 4) return copy<HeadTail<_2>>(dst, src, size);
@@ -249,7 +249,7 @@ static raw_ostream &operator<<(raw_ostream &Stream,
const auto &Ctx = FI.Ctx;
Stream << "static " << Ctx.FunctionReturnType << ' ' << FI.Name
<< Ctx.FunctionArgs << " {\n";
- Stream << kIndent << "using namespace __llvm_libc::" << FI.ElementClass
+ Stream << kIndent << "using namespace LIBC_NAMESPACE::" << FI.ElementClass
<< ";\n";
for (const auto &I : FI.Individuals)
if (I.Element.Size == 0)
@@ -428,7 +428,7 @@ namespace configurations {
// ------------------------------------------------------------
// e.g.
// llvm::ArrayRef<MemcpyConfiguration> getMemcpyConfigurations() {
-// using namespace __llvm_libc;
+// using namespace LIBC_NAMESPACE;
// static constexpr MemcpyConfiguration kConfigurations[] = {
// {Wrap<memcpy_0xE00E29EE73994E2B>, "memcpy_0xE00E29EE73994E2B"},
// {Wrap<memcpy_0x8661D80472487AB5>, "memcpy_0x8661D80472487AB5"},
@@ -504,7 +504,7 @@ static raw_ostream &operator<<(raw_ostream &Stream, const Configuration &C) {
if (C.Descriptors.empty())
Stream << kIndent << "return {};\n";
else {
- Stream << kIndent << "using namespace __llvm_libc;\n";
+ Stream << kIndent << "using namespace LIBC_NAMESPACE;\n";
Stream << kIndent << "static constexpr " << C.Type
<< " kConfigurations[] = {\n";
Stream << C.Descriptors;
@@ -542,11 +542,11 @@ static void Serialize(raw_ostream &Stream,
Stream << "using llvm::libc_benchmarks::MemmoveConfiguration;\n";
Stream << "using llvm::libc_benchmarks::MemsetConfiguration;\n";
Stream << "\n";
- Stream << "namespace __llvm_libc {\n";
+ Stream << "namespace LIBC_NAMESPACE {\n";
Stream << "\n";
codegen::functions::Serialize(Stream, Descriptors);
Stream << "\n";
- Stream << "} // namespace __llvm_libc\n";
+ Stream << "} // namespace LIBC_NAMESPACE\n";
Stream << "\n";
Stream << "namespace llvm {\n";
Stream << "namespace automemcpy {\n";
diff --git a/libc/benchmarks/automemcpy/unittests/CodeGenTest.cpp b/libc/benchmarks/automemcpy/unittests/CodeGenTest.cpp
index b0c5f3a05734de1..5084b1d67dcd5e3 100644
--- a/libc/benchmarks/automemcpy/unittests/CodeGenTest.cpp
+++ b/libc/benchmarks/automemcpy/unittests/CodeGenTest.cpp
@@ -63,14 +63,14 @@ using llvm::libc_benchmarks::MemcpyConfiguration;
using llvm::libc_benchmarks::MemmoveConfiguration;
using llvm::libc_benchmarks::MemsetConfiguration;
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
static void memcpy_0xE00E29EE73994E2B(char *__restrict dst, const char *__restrict src, size_t size) {
- using namespace __llvm_libc::x86;
+ using namespace LIBC_NAMESPACE::x86;
return copy<Accelerator>(dst, src, size);
}
static void memcpy_0x7381B60C7BE75EF9(char *__restrict dst, const char *__restrict src, size_t size) {
- using namespace __llvm_libc::x86;
+ using namespace LIBC_NAMESPACE::x86;
if(size == 0) return;
if(size == 1) return copy<_1>(dst, src);
if(size == 2) return copy<_2>(dst, src);
@@ -84,7 +84,7 @@ static void memcpy_0x7381B60C7BE75EF9(char *__restrict dst, const char *__restri
return copy<Loop<_64>>(dst, src, size);
}
static int memcmp_0x348D7BA6DB0EE033(const char * lhs, const char * rhs, size_t size) {
- using namespace __llvm_libc::x86;
+ using namespace LIBC_NAMESPACE::x86;
if(size == 0) return 0;
if(size == 1) return three_way_compare<_1>(lhs, rhs);
if(size < 4) return three_way_compare<HeadTail<_2>>(lhs, rhs, size);
@@ -95,7 +95,7 @@ static int memcmp_0x348D7BA6DB0EE033(const char * lhs, const char * rhs, size_t
return three_way_compare<Align<_16,Arg::Lhs>::Then<Loop<_16>>>(lhs, rhs, size);
}
static void memset_0x71E761699B999863(char * dst, int value, size_t size) {
- using namespace __llvm_libc::x86;
+ using namespace LIBC_NAMESPACE::x86;
if(size == 0) return;
if(size == 1) return splat_set<_1>(dst, value);
if(size < 4) return splat_set<HeadTail<_2>>(dst, value, size);
@@ -108,7 +108,7 @@ static void memset_0x71E761699B999863(char * dst, int value, size_t size) {
return splat_set<Align<_16,Arg::Dst>::Then<Loop<_32>>>(dst, value, size);
}
static void memset_0x3DF0F44E2ED6A50F(char * dst, int value, size_t size) {
- using namespace __llvm_libc::x86;
+ using namespace LIBC_NAMESPACE::x86;
if(size == 0) return;
if(size == 1) return splat_set<_1>(dst, value);
if(size < 4) return splat_set<HeadTail<_2>>(dst, value, size);
@@ -121,7 +121,7 @@ static void memset_0x3DF0F44E2ED6A50F(char * dst, int value, size_t size) {
return splat_set<Align<_32,Arg::Dst>::Then<Loop<_32>>>(dst, value, size);
}
static void bzero_0x475977492C218AD4(char * dst, size_t size) {
- using namespace __llvm_libc::x86;
+ using namespace LIBC_NAMESPACE::x86;
if(size == 0) return;
if(size == 1) return splat_set<_1>(dst, 0);
if(size == 2) return splat_set<_2>(dst, 0);
@@ -134,7 +134,7 @@ static void bzero_0x475977492C218AD4(char * dst, size_t size) {
return splat_set<Align<_32,Arg::Dst>::Then<Loop<_32>>>(dst, 0, size);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
namespace llvm {
namespace automemcpy {
@@ -163,7 +163,7 @@ void *Wrap(void *__restrict dst, const void *__restrict src, size_t size) {
return dst;
}
llvm::ArrayRef<MemcpyConfiguration> getMemcpyConfigurations() {
- using namespace __llvm_libc;
+ using namespace LIBC_NAMESPACE;
static constexpr MemcpyConfiguration kConfigurations[] = {
{Wrap<memcpy_0xE00E29EE73994E2B>, "memcpy_0xE00E29EE73994E2B"},
{Wrap<memcpy_0x7381B60C7BE75EF9>, "memcpy_0x7381B60C7BE75EF9"},
@@ -178,7 +178,7 @@ int Wrap(const void *lhs, const void *rhs, size_t size) {
reinterpret_cast<const char *>(rhs), size);
}
llvm::ArrayRef<MemcmpOrBcmpConfiguration> getMemcmpConfigurations() {
- using namespace __llvm_libc;
+ using namespace LIBC_NAMESPACE;
static constexpr MemcmpOrBcmpConfiguration kConfigurations[] = {
{Wrap<memcmp_0x348D7BA6DB0EE033>, "memcmp_0x348D7BA6DB0EE033"},
};
@@ -194,7 +194,7 @@ template <MemsetStub Foo> void *Wrap(void *dst, int value, size_t size) {
return dst;
}
llvm::ArrayRef<MemsetConfiguration> getMemsetConfigurations() {
- using namespace __llvm_libc;
+ using namespace LIBC_NAMESPACE;
static constexpr MemsetConfiguration kConfigurations[] = {
{Wrap<memset_0x71E761699B999863>, "memset_0x71E761699B999863"},
{Wrap<memset_0x3DF0F44E2ED6A50F>, "memset_0x3DF0F44E2ED6A50F"},
@@ -207,7 +207,7 @@ template <BzeroStub Foo> void Wrap(void *dst, size_t size) {
Foo(reinterpret_cast<char *>(dst), size);
}
llvm::ArrayRef<BzeroConfiguration> getBzeroConfigurations() {
- using namespace __llvm_libc;
+ using namespace LIBC_NAMESPACE;
static constexpr BzeroConfiguration kConfigurations[] = {
{Wrap<bzero_0x475977492C218AD4>, "bzero_0x475977492C218AD4"},
};
diff --git a/libc/config/linux/app.h b/libc/config/linux/app.h
index 40a45078f6c8f35..5521991e3e1c36d 100644
--- a/libc/config/linux/app.h
+++ b/libc/config/linux/app.h
@@ -13,7 +13,7 @@
#include <stdint.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
// Data structure to capture properties of the linux/ELF TLS image.
struct TLSImage {
@@ -106,6 +106,6 @@ void init_tls(TLSDescriptor &tls);
// Cleanup the TLS area as described in |tls_descriptor|.
void cleanup_tls(uintptr_t tls_addr, uintptr_t tls_size);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_CONFIG_LINUX_APP_H
diff --git a/libc/docs/dev/clang_tidy_checks.rst b/libc/docs/dev/clang_tidy_checks.rst
index e635f84a5a1a462..18c011e67b4b916 100644
--- a/libc/docs/dev/clang_tidy_checks.rst
+++ b/libc/docs/dev/clang_tidy_checks.rst
@@ -30,19 +30,19 @@ implementation-in-namespace
---------------------------
It is part of our implementation standards that all implementation pieces live
-under the ``__llvm_libc`` namespace. This prevents pollution of the global
+under the ``LIBC_NAMESPACE`` namespace. This prevents pollution of the global
namespace. Without a formal check to ensure this, an implementation might
compile and pass unit tests, but not produce a usable libc function.
This check that ensures any function call resolves to a function within the
-``__llvm_libc`` namespace.
+``LIBC_NAMESPACE`` namespace.
.. code-block:: c++
// Correct: implementation inside the correct namespace.
- namespace __llvm_libc {
+ namespace LIBC_NAMESPACE {
void LLVM_LIBC_ENTRYPOINT(strcpy)(char *dest, const char *src) {}
- // Namespaces within __llvm_libc namespace are allowed.
+ // Namespaces within LIBC_NAMESPACE namespace are allowed.
namespace inner{
int localVar = 0;
}
@@ -67,7 +67,7 @@ creates some uncertainty about which library a call resolves to especially when
a public header with non-namespaced functions like ``string.h`` is included.
This check ensures any function call resolves to a function within the
-__llvm_libc namespace.
+LIBC_NAMESPACE namespace.
There are exceptions for the following functions:
``__errno_location`` so that ``errno`` can be set;
@@ -76,10 +76,10 @@ are always external and can be intercepted.
.. code-block:: c++
- namespace __llvm_libc {
+ namespace LIBC_NAMESPACE {
// Allow calls with the fully qualified name.
- __llvm_libc::strlen("hello");
+ LIBC_NAMESPACE::strlen("hello");
// Allow calls to compiler provided functions.
(void)__builtin_abs(-1);
@@ -93,4 +93,4 @@ are always external and can be intercepted.
// Allow calling into specific global functions (explained above)
::malloc(10);
- } // namespace __llvm_libc
+ } // namespace LIBC_NAMESPACE
diff --git a/libc/docs/dev/code_style.rst b/libc/docs/dev/code_style.rst
index 4b03217b18c33fa..a28f7b9d717d4d0 100644
--- a/libc/docs/dev/code_style.rst
+++ b/libc/docs/dev/code_style.rst
@@ -158,7 +158,7 @@ this:
...
- __llvm_libc::AllocChecker ac;
+ LIBC_NAMESPACE::AllocChecker ac;
auto *obj = new (ac) Type(...);
if (!ac) {
// handle allocator failure.
diff --git a/libc/docs/dev/implementation_standard.rst b/libc/docs/dev/implementation_standard.rst
index 0fdbb7c3c3d74d8..389981a42f76c16 100644
--- a/libc/docs/dev/implementation_standard.rst
+++ b/libc/docs/dev/implementation_standard.rst
@@ -33,17 +33,17 @@ example. The ``round`` function will be declared in an internal header file
#ifndef LLVM_LIBC_SRC_MATH_ROUND_ROUND_H
#define LLVM_LIBC_SRC_MATH_ROUND_ROUND_H
- namespace __llvm_libc {
+ namespace LIBC_NAMESPACE {
double round(double);
- } // namespace __llvm_libc
+ } // namespace LIBC_NAMESPACE
#endif LLVM_LIBC_SRC_MATH_ROUND_ROUND_H
Notice that the ``round`` function declaration is nested inside the namespace
-``__llvm_libc``. All implementation constructs in LLVM-libc are declared within
-the namespace ``__llvm_libc``.
+``LIBC_NAMESPACE``. All implementation constructs in LLVM-libc are declared within
+the namespace ``LIBC_NAMESPACE``.
``.cpp`` File Structure
-----------------------
@@ -55,13 +55,13 @@ the entrypoint function should make use of a special macro. For example, the
// --- round.cpp --- //
- namespace __llvm_libc {
+ namespace LIBC_NAMESPACE {
double LLVM_LIBC_ENTRYPOINT(round)(double d) {
// ... implementation goes here.
}
- } // namespace __llvm_libc
+ } // namespace LIBC_NAMESPACE
Notice the use of the macro ``LLVM_LIBC_ENTRYPOINT``. This macro helps us define
an C alias symbol for the C++ implementation. The C alias need not be added by
diff --git a/libc/fuzzing/math/Compare.h b/libc/fuzzing/math/Compare.h
index e690e5168d27b81..2b84ad3ab462137 100644
--- a/libc/fuzzing/math/Compare.h
+++ b/libc/fuzzing/math/Compare.h
@@ -13,10 +13,11 @@
#include "src/__support/FPUtil/FPBits.h"
template <typename T>
-__llvm_libc::cpp::enable_if_t<__llvm_libc::cpp::is_floating_point_v<T>, bool>
+LIBC_NAMESPACE::cpp::enable_if_t<LIBC_NAMESPACE::cpp::is_floating_point_v<T>,
+ bool>
ValuesEqual(T x1, T x2) {
- __llvm_libc::fputil::FPBits<T> bits1(x1);
- __llvm_libc::fputil::FPBits<T> bits2(x2);
+ LIBC_NAMESPACE::fputil::FPBits<T> bits1(x1);
+ LIBC_NAMESPACE::fputil::FPBits<T> bits2(x2);
// If either is NaN, we want both to be NaN.
if (bits1.is_nan() || bits2.is_nan())
return bits2.is_nan() && bits2.is_nan();
@@ -26,7 +27,7 @@ ValuesEqual(T x1, T x2) {
}
template <typename T>
-__llvm_libc::cpp::enable_if_t<__llvm_libc::cpp::is_integral_v<T>, bool>
+LIBC_NAMESPACE::cpp::enable_if_t<LIBC_NAMESPACE::cpp::is_integral_v<T>, bool>
ValuesEqual(T x1, T x2) {
return x1 == x2;
}
diff --git a/libc/fuzzing/math/RemQuoDiff.h b/libc/fuzzing/math/RemQuoDiff.h
index b934bc885876991..2a9622496176737 100644
--- a/libc/fuzzing/math/RemQuoDiff.h
+++ b/libc/fuzzing/math/RemQuoDiff.h
@@ -44,8 +44,8 @@ void RemQuoDiff(RemQuoFunc<T> func1, RemQuoFunc<T> func2, const uint8_t *data,
if ((q1 & 0x7) != (q2 & 0x7))
__builtin_trap();
- __llvm_libc::fputil::FPBits<T> bits1(remainder1);
- __llvm_libc::fputil::FPBits<T> bits2(remainder2);
+ LIBC_NAMESPACE::fputil::FPBits<T> bits1(remainder1);
+ LIBC_NAMESPACE::fputil::FPBits<T> bits2(remainder2);
if (bits1.uintval() != bits2.uintval())
__builtin_trap();
}
diff --git a/libc/fuzzing/math/math_differential_fuzz.cpp b/libc/fuzzing/math/math_differential_fuzz.cpp
index f315b6a99e1e52b..0e66377cfba90d5 100644
--- a/libc/fuzzing/math/math_differential_fuzz.cpp
+++ b/libc/fuzzing/math/math_differential_fuzz.cpp
@@ -70,83 +70,89 @@
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
- SingleInputSingleOutputDiff<float>(&__llvm_libc::ceilf, &::ceilf, data, size);
- SingleInputSingleOutputDiff<double>(&__llvm_libc::ceil, &::ceil, data, size);
- SingleInputSingleOutputDiff<long double>(&__llvm_libc::ceill, &::ceill, data,
- size);
+ SingleInputSingleOutputDiff<float>(&LIBC_NAMESPACE::ceilf, &::ceilf, data,
+ size);
+ SingleInputSingleOutputDiff<double>(&LIBC_NAMESPACE::ceil, &::ceil, data,
+ size);
+ SingleInputSingleOutputDiff<long double>(&LIBC_NAMESPACE::ceill, &::ceill,
+ data, size);
- SingleInputSingleOutputDiff<float>(&__llvm_libc::floorf, &::floorf, data,
+ SingleInputSingleOutputDiff<float>(&LIBC_NAMESPACE::floorf, &::floorf, data,
size);
- SingleInputSingleOutputDiff<double>(&__llvm_libc::floor, &::floor, data,
+ SingleInputSingleOutputDiff<double>(&LIBC_NAMESPACE::floor, &::floor, data,
size);
- SingleInputSingleOutputDiff<long double>(&__llvm_libc::floorl, &::floorl,
+ SingleInputSingleOutputDiff<long double>(&LIBC_NAMESPACE::floorl, &::floorl,
data, size);
- SingleInputSingleOutputDiff<float>(&__llvm_libc::roundf, &::roundf, data,
+ SingleInputSingleOutputDiff<float>(&LIBC_NAMESPACE::roundf, &::roundf, data,
size);
- SingleInputSingleOutputDiff<double>(&__llvm_libc::round, &::round, data,
+ SingleInputSingleOutputDiff<double>(&LIBC_NAMESPACE::round, &::round, data,
size);
- SingleInputSingleOutputDiff<long double>(&__llvm_libc::roundl, &::roundl,
+ SingleInputSingleOutputDiff<long double>(&LIBC_NAMESPACE::roundl, &::roundl,
data, size);
- SingleInputSingleOutputDiff<float>(&__llvm_libc::truncf, &::truncf, data,
+ SingleInputSingleOutputDiff<float>(&LIBC_NAMESPACE::truncf, &::truncf, data,
size);
- SingleInputSingleOutputDiff<double>(&__llvm_libc::trunc, &::trunc, data,
+ SingleInputSingleOutputDiff<double>(&LIBC_NAMESPACE::trunc, &::trunc, data,
size);
- SingleInputSingleOutputDiff<long double>(&__llvm_libc::truncl, &::truncl,
+ SingleInputSingleOutputDiff<long double>(&LIBC_NAMESPACE::truncl, &::truncl,
data, size);
- SingleInputSingleOutputDiff<float>(&__llvm_libc::logbf, &::logbf, data, size);
- SingleInputSingleOutputDiff<double>(&__llvm_libc::logb, &::logb, data, size);
- SingleInputSingleOutputDiff<long double>(&__llvm_libc::logbl, &::logbl, data,
- size);
+ SingleInputSingleOutputDiff<float>(&LIBC_NAMESPACE::logbf, &::logbf, data,
+ size);
+ SingleInputSingleOutputDiff<double>(&LIBC_NAMESPACE::logb, &::logb, data,
+ size);
+ SingleInputSingleOutputDiff<long double>(&LIBC_NAMESPACE::logbl, &::logbl,
+ data, size);
- TwoInputSingleOutputDiff<float, float>(&__llvm_libc::hypotf, &::hypotf, data,
- size);
+ TwoInputSingleOutputDiff<float, float>(&LIBC_NAMESPACE::hypotf, &::hypotf,
+ data, size);
- TwoInputSingleOutputDiff<float, float>(&__llvm_libc::remainderf,
+ TwoInputSingleOutputDiff<float, float>(&LIBC_NAMESPACE::remainderf,
&::remainderf, data, size);
- TwoInputSingleOutputDiff<double, double>(&__llvm_libc::remainder,
+ TwoInputSingleOutputDiff<double, double>(&LIBC_NAMESPACE::remainder,
&::remainder, data, size);
- TwoInputSingleOutputDiff<long double, long double>(&__llvm_libc::remainderl,
- &::remainderl, data, size);
+ TwoInputSingleOutputDiff<long double, long double>(
+ &LIBC_NAMESPACE::remainderl, &::remainderl, data, size);
- TwoInputSingleOutputDiff<float, float>(&__llvm_libc::fdimf, &::fdimf, data,
+ TwoInputSingleOutputDiff<float, float>(&LIBC_NAMESPACE::fdimf, &::fdimf, data,
size);
- TwoInputSingleOutputDiff<double, double>(&__llvm_libc::fdim, &::fdim, data,
+ TwoInputSingleOutputDiff<double, double>(&LIBC_NAMESPACE::fdim, &::fdim, data,
size);
- TwoInputSingleOutputDiff<long double, long double>(&__llvm_libc::fdiml,
+ TwoInputSingleOutputDiff<long double, long double>(&LIBC_NAMESPACE::fdiml,
&::fdiml, data, size);
- SingleInputSingleOutputDiff<float>(&__llvm_libc::sqrtf, &::sqrtf, data, size);
- SingleInputSingleOutputDiff<double>(&__llvm_libc::sqrt, &::sqrt, data, size);
- SingleInputSingleOutputDiff<long double>(&__llvm_libc::sqrtl, &::sqrtl, data,
- size);
+ SingleInputSingleOutputDiff<float>(&LIBC_NAMESPACE::sqrtf, &::sqrtf, data,
+ size);
+ SingleInputSingleOutputDiff<double>(&LIBC_NAMESPACE::sqrt, &::sqrt, data,
+ size);
+ SingleInputSingleOutputDiff<long double>(&LIBC_NAMESPACE::sqrtl, &::sqrtl,
+ data, size);
- SingleInputSingleOutputWithSideEffectDiff<float, int>(&__llvm_libc::frexpf,
+ SingleInputSingleOutputWithSideEffectDiff<float, int>(&LIBC_NAMESPACE::frexpf,
&::frexpf, data, size);
- SingleInputSingleOutputWithSideEffectDiff<double, int>(&__llvm_libc::frexp,
+ SingleInputSingleOutputWithSideEffectDiff<double, int>(&LIBC_NAMESPACE::frexp,
&::frexp, data, size);
SingleInputSingleOutputWithSideEffectDiff<long double, int>(
- &__llvm_libc::frexpl, &::frexpl, data, size);
+ &LIBC_NAMESPACE::frexpl, &::frexpl, data, size);
- SingleInputSingleOutputWithSideEffectDiff<float, float>(&__llvm_libc::modff,
- &::modff, data, size);
+ SingleInputSingleOutputWithSideEffectDiff<float, float>(
+ &LIBC_NAMESPACE::modff, &::modff, data, size);
SingleInputSingleOutputWithSideEffectDiff<double, double>(
- &__llvm_libc::modf, &::modf, data, size);
+ &LIBC_NAMESPACE::modf, &::modf, data, size);
SingleInputSingleOutputWithSideEffectDiff<long double, long double>(
- &__llvm_libc::modfl, &::modfl, data, size);
+ &LIBC_NAMESPACE::modfl, &::modfl, data, size);
- TwoInputSingleOutputDiff<float, int>(&__llvm_libc::ldexpf, &::ldexpf, data,
+ TwoInputSingleOutputDiff<float, int>(&LIBC_NAMESPACE::ldexpf, &::ldexpf, data,
size);
- TwoInputSingleOutputDiff<double, int>(&__llvm_libc::ldexp, &::ldexp, data,
+ TwoInputSingleOutputDiff<double, int>(&LIBC_NAMESPACE::ldexp, &::ldexp, data,
size);
- TwoInputSingleOutputDiff<long double, int>(&__llvm_libc::ldexpl, &::ldexpl,
+ TwoInputSingleOutputDiff<long double, int>(&LIBC_NAMESPACE::ldexpl, &::ldexpl,
data, size);
- RemQuoDiff<float>(&__llvm_libc::remquof, &::remquof, data, size);
- RemQuoDiff<double>(&__llvm_libc::remquo, &::remquo, data, size);
- RemQuoDiff<long double>(&__llvm_libc::remquol, &::remquol, data, size);
+ RemQuoDiff<float>(&LIBC_NAMESPACE::remquof, &::remquof, data, size);
+ RemQuoDiff<double>(&LIBC_NAMESPACE::remquo, &::remquo, data, size);
+ RemQuoDiff<long double>(&LIBC_NAMESPACE::remquol, &::remquol, data, size);
return 0;
}
diff --git a/libc/fuzzing/math/nextafter_differential_fuzz.cpp b/libc/fuzzing/math/nextafter_differential_fuzz.cpp
index f4a7891df2aabe9..2e6d58995a31fa2 100644
--- a/libc/fuzzing/math/nextafter_differential_fuzz.cpp
+++ b/libc/fuzzing/math/nextafter_differential_fuzz.cpp
@@ -18,9 +18,9 @@
#include "src/math/nextafterl.h"
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
- TwoInputSingleOutputDiff<float, float>(&__llvm_libc::nextafterf,
+ TwoInputSingleOutputDiff<float, float>(&LIBC_NAMESPACE::nextafterf,
&::nextafterf, data, size);
- TwoInputSingleOutputDiff<double, double>(&__llvm_libc::nextafter,
+ TwoInputSingleOutputDiff<double, double>(&LIBC_NAMESPACE::nextafter,
&::nextafter, data, size);
return 0;
}
diff --git a/libc/fuzzing/stdio/printf_float_conv_fuzz.cpp b/libc/fuzzing/stdio/printf_float_conv_fuzz.cpp
index 7d8335b817085ee..dd3902eebda6171 100644
--- a/libc/fuzzing/stdio/printf_float_conv_fuzz.cpp
+++ b/libc/fuzzing/stdio/printf_float_conv_fuzz.cpp
@@ -38,7 +38,7 @@ enum class TestResult {
inline TestResult test_vals(const char *fmt, double num, int prec, int width) {
// Call snprintf on a nullptr to get the buffer size.
- int buffer_size = __llvm_libc::snprintf(nullptr, 0, fmt, width, prec, num);
+ int buffer_size = LIBC_NAMESPACE::snprintf(nullptr, 0, fmt, width, prec, num);
if (buffer_size < 0) {
return TestResult::BufferSizeFailed;
@@ -50,8 +50,8 @@ inline TestResult test_vals(const char *fmt, double num, int prec, int width) {
int test_result = 0;
int reference_result = 0;
- test_result =
- __llvm_libc::snprintf(test_buff, buffer_size + 1, fmt, width, prec, num);
+ test_result = LIBC_NAMESPACE::snprintf(test_buff, buffer_size + 1, fmt, width,
+ prec, num);
reference_result =
mpfr_snprintf(reference_buff, buffer_size + 1, fmt, width, prec, num);
@@ -84,7 +84,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
int prec = 0;
int width = 0;
- __llvm_libc::fputil::FPBits<double>::UIntType raw_num = 0;
+ LIBC_NAMESPACE::fputil::FPBits<double>::UIntType raw_num = 0;
// Copy as many bytes of data as will fit into num, prec, and with. Any extras
// are ignored.
@@ -98,7 +98,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
}
}
- num = __llvm_libc::fputil::FPBits<double>(raw_num).get_val();
+ num = LIBC_NAMESPACE::fputil::FPBits<double>(raw_num).get_val();
if (width > MAX_SIZE) {
width = MAX_SIZE;
diff --git a/libc/fuzzing/stdio/printf_parser_fuzz.cpp b/libc/fuzzing/stdio/printf_parser_fuzz.cpp
index 05cd616ca48b0e4..67da230ab1f0d98 100644
--- a/libc/fuzzing/stdio/printf_parser_fuzz.cpp
+++ b/libc/fuzzing/stdio/printf_parser_fuzz.cpp
@@ -20,7 +20,7 @@
#include <stdarg.h>
#include <stdint.h>
-using namespace __llvm_libc;
+using namespace LIBC_NAMESPACE;
// The design for the printf parser fuzzer is fairly simple. The parser uses a
// mock arg list that will never fail, and is passed a randomized string. The
diff --git a/libc/fuzzing/stdlib/atof_differential_fuzz.cpp b/libc/fuzzing/stdlib/atof_differential_fuzz.cpp
index b368129960d3b59..eeb96aef9abe520 100644
--- a/libc/fuzzing/stdlib/atof_differential_fuzz.cpp
+++ b/libc/fuzzing/stdlib/atof_differential_fuzz.cpp
@@ -26,7 +26,8 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
container[i] = data[i];
container[size] = '\0'; // Add null terminator to container.
- StringParserOutputDiff<double>(&__llvm_libc::atof, &::atof, container, size);
+ StringParserOutputDiff<double>(&LIBC_NAMESPACE::atof, &::atof, container,
+ size);
delete[] container;
return 0;
}
diff --git a/libc/fuzzing/stdlib/qsort_fuzz.cpp b/libc/fuzzing/stdlib/qsort_fuzz.cpp
index dbbc8e96f924336..5d5053cff5c58ce 100644
--- a/libc/fuzzing/stdlib/qsort_fuzz.cpp
+++ b/libc/fuzzing/stdlib/qsort_fuzz.cpp
@@ -34,7 +34,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
for (size_t i = 0; i < array_size; ++i)
array[i] = data_as_int[i];
- __llvm_libc::qsort(array, array_size, sizeof(int), int_compare);
+ LIBC_NAMESPACE::qsort(array, array_size, sizeof(int), int_compare);
for (size_t i = 0; i < array_size - 1; ++i) {
if (array[i] > array[i + 1])
diff --git a/libc/fuzzing/stdlib/strtofloat_fuzz.cpp b/libc/fuzzing/stdlib/strtofloat_fuzz.cpp
index 5ef506a08e4c6ab..f6cc8abedf46452 100644
--- a/libc/fuzzing/stdlib/strtofloat_fuzz.cpp
+++ b/libc/fuzzing/stdlib/strtofloat_fuzz.cpp
@@ -22,7 +22,7 @@
#include "utils/MPFRWrapper/mpfr_inc.h"
-using __llvm_libc::fputil::FloatProperties;
+using LIBC_NAMESPACE::fputil::FloatProperties;
// This function calculates the effective precision for a given float type and
// exponent. Subnormals have a lower effective precision since they don't
@@ -113,7 +113,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
mpfr_init2(mpfr_float, float_precision);
mpfr_strtofr(mpfr_float, str_ptr, &out_ptr, base, MPFR_RNDN);
float volatile float_result = mpfr_get_flt(mpfr_float, MPFR_RNDN);
- auto volatile strtof_result = __llvm_libc::strtof(str_ptr, &out_ptr);
+ auto volatile strtof_result = LIBC_NAMESPACE::strtof(str_ptr, &out_ptr);
ptrdiff_t strtof_strlen = out_ptr - str_ptr;
if (result_strlen != strtof_strlen)
__builtin_trap();
@@ -132,8 +132,8 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
mpfr_init2(mpfr_double, double_precision);
mpfr_strtofr(mpfr_double, str_ptr, &out_ptr, base, MPFR_RNDN);
double volatile double_result = mpfr_get_d(mpfr_double, MPFR_RNDN);
- auto volatile strtod_result = __llvm_libc::strtod(str_ptr, &out_ptr);
- auto volatile atof_result = __llvm_libc::atof(str_ptr);
+ auto volatile strtod_result = LIBC_NAMESPACE::strtod(str_ptr, &out_ptr);
+ auto volatile atof_result = LIBC_NAMESPACE::atof(str_ptr);
ptrdiff_t strtod_strlen = out_ptr - str_ptr;
if (result_strlen != strtod_strlen)
__builtin_trap();
@@ -153,7 +153,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
mpfr_strtofr(mpfr_long_double, str_ptr, &out_ptr, base, MPFR_RNDN);
long double volatile long_double_result =
mpfr_get_ld(mpfr_long_double, MPFR_RNDN);
- auto volatile strtold_result = __llvm_libc::strtold(str_ptr, &out_ptr);
+ auto volatile strtold_result = LIBC_NAMESPACE::strtold(str_ptr, &out_ptr);
ptrdiff_t strtold_strlen = out_ptr - str_ptr;
if (result_strlen != strtold_strlen)
__builtin_trap();
diff --git a/libc/fuzzing/stdlib/strtointeger_differential_fuzz.cpp b/libc/fuzzing/stdlib/strtointeger_differential_fuzz.cpp
index 612be4271b2384f..097e6193ee6ef0a 100644
--- a/libc/fuzzing/stdlib/strtointeger_differential_fuzz.cpp
+++ b/libc/fuzzing/stdlib/strtointeger_differential_fuzz.cpp
@@ -61,19 +61,19 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
// random even when the input is cleaned.
container[0] = data[0];
- StringParserOutputDiff<int>(&__llvm_libc::atoi, &::atoi, container, size);
- StringParserOutputDiff<long>(&__llvm_libc::atol, &::atol, container, size);
- StringParserOutputDiff<long long>(&__llvm_libc::atoll, &::atoll, container,
+ StringParserOutputDiff<int>(&LIBC_NAMESPACE::atoi, &::atoi, container, size);
+ StringParserOutputDiff<long>(&LIBC_NAMESPACE::atol, &::atol, container, size);
+ StringParserOutputDiff<long long>(&LIBC_NAMESPACE::atoll, &::atoll, container,
size);
- StringToNumberOutputDiff<long>(&__llvm_libc::strtol, &::strtol, container,
+ StringToNumberOutputDiff<long>(&LIBC_NAMESPACE::strtol, &::strtol, container,
size);
- StringToNumberOutputDiff<long long>(&__llvm_libc::strtoll, &::strtoll,
+ StringToNumberOutputDiff<long long>(&LIBC_NAMESPACE::strtoll, &::strtoll,
container, size);
- StringToNumberOutputDiff<unsigned long>(&__llvm_libc::strtoul, &::strtoul,
+ StringToNumberOutputDiff<unsigned long>(&LIBC_NAMESPACE::strtoul, &::strtoul,
container, size);
- StringToNumberOutputDiff<unsigned long long>(&__llvm_libc::strtoull,
+ StringToNumberOutputDiff<unsigned long long>(&LIBC_NAMESPACE::strtoull,
&::strtoull, container, size);
delete[] container;
diff --git a/libc/fuzzing/stdlib/strtointeger_fuzz.cpp b/libc/fuzzing/stdlib/strtointeger_fuzz.cpp
index 197bee01d3a3ae5..3ffe5c261d09c0f 100644
--- a/libc/fuzzing/stdlib/strtointeger_fuzz.cpp
+++ b/libc/fuzzing/stdlib/strtointeger_fuzz.cpp
@@ -48,20 +48,22 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
char *out_ptr = nullptr;
- auto volatile atoi_output = __llvm_libc::atoi(str_ptr);
- auto volatile atol_output = __llvm_libc::atol(str_ptr);
- auto volatile atoll_output = __llvm_libc::atoll(str_ptr);
- auto volatile strtol_output = __llvm_libc::strtol(str_ptr, &out_ptr, base);
+ auto volatile atoi_output = LIBC_NAMESPACE::atoi(str_ptr);
+ auto volatile atol_output = LIBC_NAMESPACE::atol(str_ptr);
+ auto volatile atoll_output = LIBC_NAMESPACE::atoll(str_ptr);
+ auto volatile strtol_output = LIBC_NAMESPACE::strtol(str_ptr, &out_ptr, base);
if (str_ptr + container_size - 1 < out_ptr)
__builtin_trap();
- auto volatile strtoll_output = __llvm_libc::strtoll(str_ptr, &out_ptr, base);
+ auto volatile strtoll_output =
+ LIBC_NAMESPACE::strtoll(str_ptr, &out_ptr, base);
if (str_ptr + container_size - 1 < out_ptr)
__builtin_trap();
- auto volatile strtoul_output = __llvm_libc::strtoul(str_ptr, &out_ptr, base);
+ auto volatile strtoul_output =
+ LIBC_NAMESPACE::strtoul(str_ptr, &out_ptr, base);
if (str_ptr + container_size - 1 < out_ptr)
__builtin_trap();
auto volatile strtoull_output =
- __llvm_libc::strtoull(str_ptr, &out_ptr, base);
+ LIBC_NAMESPACE::strtoull(str_ptr, &out_ptr, base);
if (str_ptr + container_size - 1 < out_ptr)
__builtin_trap();
diff --git a/libc/fuzzing/string/strcmp_fuzz.cpp b/libc/fuzzing/string/strcmp_fuzz.cpp
index c1b497dfb2065e2..50587bf3778b5f2 100644
--- a/libc/fuzzing/string/strcmp_fuzz.cpp
+++ b/libc/fuzzing/string/strcmp_fuzz.cpp
@@ -64,12 +64,12 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
// The expected result should be the difference between the first non-equal
// characters of s1 and s2. If all characters are equal, the expected result
// should be '\0' - '\0' = 0.
- if (__llvm_libc::strcmp(s1, s2) != ch1 - ch2)
+ if (LIBC_NAMESPACE::strcmp(s1, s2) != ch1 - ch2)
__builtin_trap();
// Verify reversed operands. This should be the negated value of the previous
// result, except of course if the previous result was zero.
- if (__llvm_libc::strcmp(s2, s1) != ch2 - ch1)
+ if (LIBC_NAMESPACE::strcmp(s2, s1) != ch2 - ch1)
__builtin_trap();
delete[] data1;
diff --git a/libc/fuzzing/string/strcpy_fuzz.cpp b/libc/fuzzing/string/strcpy_fuzz.cpp
index 10e0c03bb18fbb4..c15649aa07ecd8e 100644
--- a/libc/fuzzing/string/strcpy_fuzz.cpp
+++ b/libc/fuzzing/string/strcpy_fuzz.cpp
@@ -21,7 +21,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
char *dest = new char[size];
if (!dest) __builtin_trap();
- __llvm_libc::strcpy(dest, src);
+ LIBC_NAMESPACE::strcpy(dest, src);
size_t i;
for (i = 0; src[i] != '\0'; i++) {
diff --git a/libc/fuzzing/string/strstr_fuzz.cpp b/libc/fuzzing/string/strstr_fuzz.cpp
index 5ccf85c7dc0fcd0..34ee8914890751a 100644
--- a/libc/fuzzing/string/strstr_fuzz.cpp
+++ b/libc/fuzzing/string/strstr_fuzz.cpp
@@ -54,11 +54,11 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
const char *needle = reinterpret_cast<const char *>(container);
const char *haystack = reinterpret_cast<const char *>(data + i);
- const char *result = __llvm_libc::strstr(haystack, needle);
+ const char *result = LIBC_NAMESPACE::strstr(haystack, needle);
// A null terminator may exist earlier in each, so this needs to be recorded.
- const size_t haystack_size = __llvm_libc::strlen(haystack);
- const size_t needle_size = __llvm_libc::strlen(needle);
+ const size_t haystack_size = LIBC_NAMESPACE::strlen(haystack);
+ const size_t needle_size = LIBC_NAMESPACE::strlen(needle);
if (result) {
// The needle is in the haystack.
diff --git a/libc/include/llvm-libc-macros/linux/unistd-macros.h b/libc/include/llvm-libc-macros/linux/unistd-macros.h
index cfdfb9a93ee9b0b..e30d8a4df6f3b39 100644
--- a/libc/include/llvm-libc-macros/linux/unistd-macros.h
+++ b/libc/include/llvm-libc-macros/linux/unistd-macros.h
@@ -18,13 +18,14 @@
#define _SC_PAGESIZE 1
#define _SC_PAGE_SIZE _SC_PAGESIZE
-// Macro to set up the call to the __llvm_libc_syscall function
+// Macro to set up the call to the LIBC_NAMESPACE_syscall function
// This is to prevent the call from having fewer than 6 arguments, since six
// arguments are always passed to the syscall. Unnecessary arguments are
// ignored.
#define __syscall_helper(sysno, arg1, arg2, arg3, arg4, arg5, arg6, ...) \
- __llvm_libc_syscall((long)(sysno), (long)(arg1), (long)(arg2), (long)(arg3), \
- (long)(arg4), (long)(arg5), (long)(arg6))
+ LIBC_NAMESPACE_syscall((long)(sysno), (long)(arg1), (long)(arg2), \
+ (long)(arg3), (long)(arg4), (long)(arg5), \
+ (long)(arg6))
#define syscall(...) __syscall_helper(__VA_ARGS__, 0, 1, 2, 3, 4, 5, 6)
#endif // __LLVM_LIBC_MACROS_LINUX_UNISTD_MACROS_H
diff --git a/libc/src/__support/CPP/README.md b/libc/src/__support/CPP/README.md
index 472a630110fd4e0..b470c3f1dc343c3 100644
--- a/libc/src/__support/CPP/README.md
+++ b/libc/src/__support/CPP/README.md
@@ -8,6 +8,6 @@ be followed for future changes and additions:
and free standing C headers.
2. Free standing C headers are to be included as C headers and not as C++
headers. That is, use `#include <stddef.h>` and not `#include <cstddef>`.
-3. The utilities should be defined in the namespace `__llvm_libc::cpp`. The
+3. The utilities should be defined in the namespace `LIBC_NAMESPACE::cpp`. The
higher level namespace should have a `__` prefix to avoid symbol name pollution
when the utilities are used in implementation of public functions.
diff --git a/libc/src/__support/CPP/algorithm.h b/libc/src/__support/CPP/algorithm.h
index 6ce56a9f3565976..fef3c18dc50bc87 100644
--- a/libc/src/__support/CPP/algorithm.h
+++ b/libc/src/__support/CPP/algorithm.h
@@ -14,7 +14,7 @@
#include "src/__support/macros/attributes.h" // LIBC_INLINE
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
namespace cpp {
template <class T> LIBC_INLINE constexpr const T &max(const T &a, const T &b) {
@@ -26,6 +26,6 @@ template <class T> LIBC_INLINE constexpr const T &min(const T &a, const T &b) {
}
} // namespace cpp
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_ALGORITHM_H
diff --git a/libc/src/__support/CPP/array.h b/libc/src/__support/CPP/array.h
index 1cdc8b7d7e79ba1..12e574899988060 100644
--- a/libc/src/__support/CPP/array.h
+++ b/libc/src/__support/CPP/array.h
@@ -12,11 +12,12 @@
#include "src/__support/macros/attributes.h"
#include <stddef.h> // For size_t.
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
namespace cpp {
template <class T, size_t N> struct array {
- static_assert(N != 0, "Cannot create a __llvm_libc::cpp::array of size 0.");
+ static_assert(N != 0,
+ "Cannot create a LIBC_NAMESPACE::cpp::array of size 0.");
T Data[N];
using value_type = T;
@@ -50,6 +51,6 @@ template <class T, size_t N> struct array {
};
} // namespace cpp
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_ARRAY_H
diff --git a/libc/src/__support/CPP/atomic.h b/libc/src/__support/CPP/atomic.h
index 609aac31252e09f..78dc8d2da3c191d 100644
--- a/libc/src/__support/CPP/atomic.h
+++ b/libc/src/__support/CPP/atomic.h
@@ -14,7 +14,7 @@
#include "type_traits.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
namespace cpp {
enum class MemoryOrder : int {
@@ -116,6 +116,6 @@ LIBC_INLINE void atomic_thread_fence(MemoryOrder mem_ord) {
}
} // namespace cpp
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_ATOMIC_H
diff --git a/libc/src/__support/CPP/bit.h b/libc/src/__support/CPP/bit.h
index 4e4205db9128b30..456266626ae9b20 100644
--- a/libc/src/__support/CPP/bit.h
+++ b/libc/src/__support/CPP/bit.h
@@ -13,7 +13,7 @@
#include "src/__support/macros/attributes.h"
#include "src/__support/macros/config.h" // LIBC_HAS_BUILTIN
-namespace __llvm_libc::cpp {
+namespace LIBC_NAMESPACE::cpp {
#if LIBC_HAS_BUILTIN(__builtin_bit_cast)
#define LLVM_LIBC_HAS_BUILTIN_BIT_CAST
@@ -59,6 +59,6 @@ LIBC_INLINE constexpr To bit_or_static_cast(const From &from) {
}
}
-} // namespace __llvm_libc::cpp
+} // namespace LIBC_NAMESPACE::cpp
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_BIT_H
diff --git a/libc/src/__support/CPP/bitset.h b/libc/src/__support/CPP/bitset.h
index bae71d84314e6bd..cfac749e0d84e3a 100644
--- a/libc/src/__support/CPP/bitset.h
+++ b/libc/src/__support/CPP/bitset.h
@@ -12,11 +12,11 @@
#include "src/__support/macros/attributes.h"
#include <stddef.h> // For size_t.
-namespace __llvm_libc::cpp {
+namespace LIBC_NAMESPACE::cpp {
template <size_t NumberOfBits> struct bitset {
static_assert(NumberOfBits != 0,
- "Cannot create a __llvm_libc::cpp::bitset of size 0.");
+ "Cannot create a LIBC_NAMESPACE::cpp::bitset of size 0.");
LIBC_INLINE constexpr void set(size_t Index) {
Data[Index / BITS_PER_UNIT] |= mask(Index);
@@ -85,6 +85,6 @@ template <size_t NumberOfBits> struct bitset {
size_t Data[NUMBER_OF_UNITS] = {0};
};
-} // namespace __llvm_libc::cpp
+} // namespace LIBC_NAMESPACE::cpp
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_BITSET_H
diff --git a/libc/src/__support/CPP/cstddef.h b/libc/src/__support/CPP/cstddef.h
index 4c5c4a492ba425c..1da51fd253fb55d 100644
--- a/libc/src/__support/CPP/cstddef.h
+++ b/libc/src/__support/CPP/cstddef.h
@@ -12,7 +12,7 @@
#include "src/__support/macros/attributes.h"
#include "type_traits.h" // For enable_if_t, is_integral_v.
-namespace __llvm_libc::cpp {
+namespace LIBC_NAMESPACE::cpp {
enum class byte : unsigned char {};
@@ -66,6 +66,6 @@ to_integer(byte b) noexcept {
return static_cast<IntegerType>(b);
}
-} // namespace __llvm_libc::cpp
+} // namespace LIBC_NAMESPACE::cpp
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_CSTDDEF_H
diff --git a/libc/src/__support/CPP/expected.h b/libc/src/__support/CPP/expected.h
index c20d100f8cf82af..52174a054f8749c 100644
--- a/libc/src/__support/CPP/expected.h
+++ b/libc/src/__support/CPP/expected.h
@@ -9,7 +9,7 @@
#ifndef LLVM_LIBC_SRC___SUPPORT_CPP_EXPECTED_H
#define LLVM_LIBC_SRC___SUPPORT_CPP_EXPECTED_H
-namespace __llvm_libc::cpp {
+namespace LIBC_NAMESPACE::cpp {
// This is used to hold an unexpected value so that a different constructor is
// selected.
@@ -46,6 +46,6 @@ template <class T, class E> class expected {
constexpr const T *operator->() const { return &exp; }
};
-} // namespace __llvm_libc::cpp
+} // namespace LIBC_NAMESPACE::cpp
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_EXPECTED_H
diff --git a/libc/src/__support/CPP/functional.h b/libc/src/__support/CPP/functional.h
index 6c33b55db3700c4..16283a264e6571c 100644
--- a/libc/src/__support/CPP/functional.h
+++ b/libc/src/__support/CPP/functional.h
@@ -20,7 +20,7 @@
#include <stdint.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
namespace cpp {
/// A function type adapted from LLVM's function_ref.
@@ -65,6 +65,6 @@ template <typename Ret, typename... Params> class function<Ret(Params...)> {
};
} // namespace cpp
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_FUNCTIONAL_H
diff --git a/libc/src/__support/CPP/limits.h b/libc/src/__support/CPP/limits.h
index 4e76337a2445e06..e163f00c7320911 100644
--- a/libc/src/__support/CPP/limits.h
+++ b/libc/src/__support/CPP/limits.h
@@ -11,7 +11,7 @@
#include <limits.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
namespace cpp {
// Some older gcc distributions don't define these for 32 bit targets.
@@ -96,6 +96,6 @@ template <> class numeric_limits<__uint128_t> {
#endif
} // namespace cpp
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_LIMITS_H
diff --git a/libc/src/__support/CPP/new.h b/libc/src/__support/CPP/new.h
index 14ee0ab2bbc0d13..16353d57e3a6cb0 100644
--- a/libc/src/__support/CPP/new.h
+++ b/libc/src/__support/CPP/new.h
@@ -23,7 +23,7 @@ enum class align_val_t : size_t {};
} // namespace std
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
class AllocChecker {
bool success = false;
@@ -52,26 +52,26 @@ class AllocChecker {
}
};
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
LIBC_INLINE void *operator new(size_t size,
- __llvm_libc::AllocChecker &ac) noexcept {
- return __llvm_libc::AllocChecker::alloc(size, ac);
+ LIBC_NAMESPACE::AllocChecker &ac) noexcept {
+ return LIBC_NAMESPACE::AllocChecker::alloc(size, ac);
}
LIBC_INLINE void *operator new(size_t size, std::align_val_t align,
- __llvm_libc::AllocChecker &ac) noexcept {
- return __llvm_libc::AllocChecker::aligned_alloc(size, align, ac);
+ LIBC_NAMESPACE::AllocChecker &ac) noexcept {
+ return LIBC_NAMESPACE::AllocChecker::aligned_alloc(size, align, ac);
}
LIBC_INLINE void *operator new[](size_t size,
- __llvm_libc::AllocChecker &ac) noexcept {
- return __llvm_libc::AllocChecker::alloc(size, ac);
+ LIBC_NAMESPACE::AllocChecker &ac) noexcept {
+ return LIBC_NAMESPACE::AllocChecker::alloc(size, ac);
}
LIBC_INLINE void *operator new[](size_t size, std::align_val_t align,
- __llvm_libc::AllocChecker &ac) noexcept {
- return __llvm_libc::AllocChecker::aligned_alloc(size, align, ac);
+ LIBC_NAMESPACE::AllocChecker &ac) noexcept {
+ return LIBC_NAMESPACE::AllocChecker::aligned_alloc(size, align, ac);
}
// The ideal situation would be to define the various flavors of operator delete
@@ -84,19 +84,19 @@ LIBC_INLINE void *operator new[](size_t size, std::align_val_t align,
// they will replace operator delete for the entire application. Including this
// header file in all libc source files where operator delete is called ensures
// that only libc call sites use these replacement operator delete functions.
-void operator delete(void *) noexcept __asm__("__llvm_libc_delete");
+void operator delete(void *) noexcept __asm__("LIBC_NAMESPACE_delete");
void operator delete(void *, std::align_val_t) noexcept
- __asm__("__llvm_libc_delete_aligned");
+ __asm__("LIBC_NAMESPACE_delete_aligned");
void operator delete(void *, size_t) noexcept
- __asm__("__llvm_libc_delete_sized");
+ __asm__("LIBC_NAMESPACE_delete_sized");
void operator delete(void *, size_t, std::align_val_t) noexcept
- __asm__("__llvm_libc_delete_sized_aligned");
-void operator delete[](void *) noexcept __asm__("__llvm_libc_delete_array");
+ __asm__("LIBC_NAMESPACE_delete_sized_aligned");
+void operator delete[](void *) noexcept __asm__("LIBC_NAMESPACE_delete_array");
void operator delete[](void *, std::align_val_t) noexcept
- __asm__("__llvm_libc_delete_array_aligned");
+ __asm__("LIBC_NAMESPACE_delete_array_aligned");
void operator delete[](void *, size_t) noexcept
- __asm__("__llvm_libc_delete_array_sized");
+ __asm__("LIBC_NAMESPACE_delete_array_sized");
void operator delete[](void *, size_t, std::align_val_t) noexcept
- __asm__("__llvm_libc_delete_array_sized_aligned");
+ __asm__("LIBC_NAMESPACE_delete_array_sized_aligned");
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_NEW_H
diff --git a/libc/src/__support/CPP/optional.h b/libc/src/__support/CPP/optional.h
index b5e2ef7c8bc2f20..02e8395b871ba29 100644
--- a/libc/src/__support/CPP/optional.h
+++ b/libc/src/__support/CPP/optional.h
@@ -13,7 +13,7 @@
#include "src/__support/CPP/utility.h"
#include "src/__support/macros/attributes.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
namespace cpp {
// Trivial nullopt_t struct.
@@ -118,6 +118,6 @@ template <typename T> class optional {
};
} // namespace cpp
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_OPTIONAL_H
diff --git a/libc/src/__support/CPP/span.h b/libc/src/__support/CPP/span.h
index ebf637c5d26679c..a8c1353581ba0e1 100644
--- a/libc/src/__support/CPP/span.h
+++ b/libc/src/__support/CPP/span.h
@@ -15,7 +15,7 @@
#include "src/__support/macros/attributes.h"
-namespace __llvm_libc::cpp {
+namespace LIBC_NAMESPACE::cpp {
// A trimmed down implementation of std::span.
// Missing features:
@@ -119,6 +119,6 @@ template <typename T> class span {
size_t span_size;
};
-} // namespace __llvm_libc::cpp
+} // namespace LIBC_NAMESPACE::cpp
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_SPAN_H
diff --git a/libc/src/__support/CPP/string.h b/libc/src/__support/CPP/string.h
index 2f60720e9345008..cb794e081970dd1 100644
--- a/libc/src/__support/CPP/string.h
+++ b/libc/src/__support/CPP/string.h
@@ -18,7 +18,7 @@
#include <stddef.h> // size_t
#include <stdlib.h> // malloc, free
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
namespace cpp {
// This class mimics std::string but does not intend to be a full fledged
@@ -61,7 +61,7 @@ class string {
LIBC_INLINE string(const string_view &view)
: string(view.data(), view.size()) {}
LIBC_INLINE string(const char *cstr)
- : string(cstr, ::__llvm_libc::internal::string_length(cstr)) {}
+ : string(cstr, ::LIBC_NAMESPACE::internal::string_length(cstr)) {}
LIBC_INLINE string(size_t size_, char value) {
resize(size_);
inline_memset((void *)buffer_, value, size_);
@@ -225,6 +225,6 @@ LIBC_INLINE string to_string(unsigned long long value) {
// LIBC_INLINE string to_string(long double value);
} // namespace cpp
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_STRING_H
diff --git a/libc/src/__support/CPP/string_view.h b/libc/src/__support/CPP/string_view.h
index d494325def3bfa7..d23aa261ca06146 100644
--- a/libc/src/__support/CPP/string_view.h
+++ b/libc/src/__support/CPP/string_view.h
@@ -13,7 +13,7 @@
#include <stddef.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
namespace cpp {
// This is very simple alternate of the std::string_view class. There is no
@@ -197,6 +197,6 @@ class string_view {
};
} // namespace cpp
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_STRING_VIEW_H
diff --git a/libc/src/__support/CPP/stringstream.h b/libc/src/__support/CPP/stringstream.h
index 0a92ddae66c64a1..c8eb59cf65cbb35 100644
--- a/libc/src/__support/CPP/stringstream.h
+++ b/libc/src/__support/CPP/stringstream.h
@@ -15,7 +15,7 @@
#include "src/__support/integer_to_string.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
namespace cpp {
// This class is to be used to write simple strings into a user provided buffer
@@ -90,6 +90,6 @@ class StringStream {
};
} // namespace cpp
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_STRINGSTREAM_H
diff --git a/libc/src/__support/CPP/type_traits/add_lvalue_reference.h b/libc/src/__support/CPP/type_traits/add_lvalue_reference.h
index 69d75018fcf2e9e..2bca6267914d587 100644
--- a/libc/src/__support/CPP/type_traits/add_lvalue_reference.h
+++ b/libc/src/__support/CPP/type_traits/add_lvalue_reference.h
@@ -10,7 +10,7 @@
#include "src/__support/CPP/type_traits/type_identity.h"
-namespace __llvm_libc::cpp {
+namespace LIBC_NAMESPACE::cpp {
// add_lvalue_reference
namespace detail {
@@ -25,6 +25,6 @@ struct add_lvalue_reference : decltype(detail::try_add_lvalue_reference<T>(0)) {
template <class T>
using add_lvalue_reference_t = typename add_lvalue_reference<T>::type;
-} // namespace __llvm_libc::cpp
+} // namespace LIBC_NAMESPACE::cpp
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_ADD_LVALUE_REFERENCE_H
diff --git a/libc/src/__support/CPP/type_traits/add_pointer.h b/libc/src/__support/CPP/type_traits/add_pointer.h
index 1ea55b7137feec4..72a764bb8ba60c1 100644
--- a/libc/src/__support/CPP/type_traits/add_pointer.h
+++ b/libc/src/__support/CPP/type_traits/add_pointer.h
@@ -12,7 +12,7 @@
#include "src/__support/CPP/type_traits/type_identity.h"
#include "src/__support/macros/config.h"
-namespace __llvm_libc::cpp {
+namespace LIBC_NAMESPACE::cpp {
// add_pointer
namespace detail {
@@ -23,6 +23,6 @@ template <class T> auto try_add_pointer(...) -> cpp::type_identity<T>;
template <class T>
struct add_pointer : decltype(detail::try_add_pointer<T>(0)) {};
template <class T> using add_pointer_t = typename add_pointer<T>::type;
-} // namespace __llvm_libc::cpp
+} // namespace LIBC_NAMESPACE::cpp
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_ADD_POINTER_H
diff --git a/libc/src/__support/CPP/type_traits/add_rvalue_reference.h b/libc/src/__support/CPP/type_traits/add_rvalue_reference.h
index e2a135b3893d8f5..76db6712e53645d 100644
--- a/libc/src/__support/CPP/type_traits/add_rvalue_reference.h
+++ b/libc/src/__support/CPP/type_traits/add_rvalue_reference.h
@@ -10,7 +10,7 @@
#include "src/__support/CPP/type_traits/type_identity.h"
-namespace __llvm_libc::cpp {
+namespace LIBC_NAMESPACE::cpp {
// add_rvalue_reference
namespace detail {
@@ -24,6 +24,6 @@ struct add_rvalue_reference : decltype(detail::try_add_rvalue_reference<T>(0)) {
template <class T>
using add_rvalue_reference_t = typename add_rvalue_reference<T>::type;
-} // namespace __llvm_libc::cpp
+} // namespace LIBC_NAMESPACE::cpp
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_ADD_RVALUE_REFERENCE_H
diff --git a/libc/src/__support/CPP/type_traits/always_false.h b/libc/src/__support/CPP/type_traits/always_false.h
index 0a633d41598df95..a86e926569fe673 100644
--- a/libc/src/__support/CPP/type_traits/always_false.h
+++ b/libc/src/__support/CPP/type_traits/always_false.h
@@ -11,7 +11,7 @@
#include "src/__support/macros/attributes.h"
-namespace __llvm_libc::cpp {
+namespace LIBC_NAMESPACE::cpp {
// This is technically not part of the standard but it come often enough that
// it's convenient to have around.
@@ -24,6 +24,6 @@ namespace __llvm_libc::cpp {
// Usage `static_assert(cpp::always_false<T>, "error message");`
template <typename...> LIBC_INLINE_VAR constexpr bool always_false = false;
-} // namespace __llvm_libc::cpp
+} // namespace LIBC_NAMESPACE::cpp
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_ALWAYS_FALSE_H
diff --git a/libc/src/__support/CPP/type_traits/bool_constant.h b/libc/src/__support/CPP/type_traits/bool_constant.h
index 84a5c76fcde9b57..72eeaf29bc0940b 100644
--- a/libc/src/__support/CPP/type_traits/bool_constant.h
+++ b/libc/src/__support/CPP/type_traits/bool_constant.h
@@ -10,11 +10,11 @@
#include "src/__support/CPP/type_traits/integral_constant.h"
-namespace __llvm_libc::cpp {
+namespace LIBC_NAMESPACE::cpp {
// bool_constant
template <bool V> using bool_constant = cpp::integral_constant<bool, V>;
-} // namespace __llvm_libc::cpp
+} // namespace LIBC_NAMESPACE::cpp
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_BOOL_CONSTANT_H
diff --git a/libc/src/__support/CPP/type_traits/conditional.h b/libc/src/__support/CPP/type_traits/conditional.h
index 431ccb2a483fc55..4fa65a08e555264 100644
--- a/libc/src/__support/CPP/type_traits/conditional.h
+++ b/libc/src/__support/CPP/type_traits/conditional.h
@@ -10,7 +10,7 @@
#include "src/__support/CPP/type_traits/type_identity.h"
-namespace __llvm_libc::cpp {
+namespace LIBC_NAMESPACE::cpp {
// conditional
template <bool B, typename T, typename F>
@@ -20,6 +20,6 @@ struct conditional<false, T, F> : type_identity<F> {};
template <bool B, typename T, typename F>
using conditional_t = typename conditional<B, T, F>::type;
-} // namespace __llvm_libc::cpp
+} // namespace LIBC_NAMESPACE::cpp
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_CONDITIONAL_H
diff --git a/libc/src/__support/CPP/type_traits/decay.h b/libc/src/__support/CPP/type_traits/decay.h
index 0961fd1c3689b46..a018286fddd8abb 100644
--- a/libc/src/__support/CPP/type_traits/decay.h
+++ b/libc/src/__support/CPP/type_traits/decay.h
@@ -19,7 +19,7 @@
#include "src/__support/CPP/type_traits/remove_extent.h"
#include "src/__support/CPP/type_traits/remove_reference.h"
-namespace __llvm_libc::cpp {
+namespace LIBC_NAMESPACE::cpp {
// decay
template <class T> class decay {
@@ -33,6 +33,6 @@ template <class T> class decay {
};
template <class T> using decay_t = typename decay<T>::type;
-} // namespace __llvm_libc::cpp
+} // namespace LIBC_NAMESPACE::cpp
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_DECAY_H
diff --git a/libc/src/__support/CPP/type_traits/enable_if.h b/libc/src/__support/CPP/type_traits/enable_if.h
index 1a83c2ca732f9ef..cda9189b29eca79 100644
--- a/libc/src/__support/CPP/type_traits/enable_if.h
+++ b/libc/src/__support/CPP/type_traits/enable_if.h
@@ -10,7 +10,7 @@
#include "src/__support/CPP/type_traits/type_identity.h"
-namespace __llvm_libc::cpp {
+namespace LIBC_NAMESPACE::cpp {
// enable_if
template <bool B, typename T = void> struct enable_if;
@@ -18,6 +18,6 @@ template <typename T> struct enable_if<true, T> : type_identity<T> {};
template <bool B, typename T = void>
using enable_if_t = typename enable_if<B, T>::type;
-} // namespace __llvm_libc::cpp
+} // namespace LIBC_NAMESPACE::cpp
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_ENABLE_IF_H
diff --git a/libc/src/__support/CPP/type_traits/false_type.h b/libc/src/__support/CPP/type_traits/false_type.h
index 98c6d1c8412ac7a..97c041ccd1624af 100644
--- a/libc/src/__support/CPP/type_traits/false_type.h
+++ b/libc/src/__support/CPP/type_traits/false_type.h
@@ -10,11 +10,11 @@
#include "src/__support/CPP/type_traits/bool_constant.h"
-namespace __llvm_libc::cpp {
+namespace LIBC_NAMESPACE::cpp {
// false_type
using false_type = cpp::bool_constant<false>;
-} // namespace __llvm_libc::cpp
+} // namespace LIBC_NAMESPACE::cpp
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_FALSE_TYPE_H
diff --git a/libc/src/__support/CPP/type_traits/integral_constant.h b/libc/src/__support/CPP/type_traits/integral_constant.h
index 958910ca9c5e6fd..7b5b6c2150c71c3 100644
--- a/libc/src/__support/CPP/type_traits/integral_constant.h
+++ b/libc/src/__support/CPP/type_traits/integral_constant.h
@@ -10,7 +10,7 @@
#include "src/__support/macros/attributes.h" // LIBC_INLINE_VAR
-namespace __llvm_libc::cpp {
+namespace LIBC_NAMESPACE::cpp {
// integral_constant
template <typename T, T v> struct integral_constant {
@@ -18,6 +18,6 @@ template <typename T, T v> struct integral_constant {
LIBC_INLINE_VAR static constexpr T value = v;
};
-} // namespace __llvm_libc::cpp
+} // namespace LIBC_NAMESPACE::cpp
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_INTEGRAL_CONSTANT_H
diff --git a/libc/src/__support/CPP/type_traits/invoke.h b/libc/src/__support/CPP/type_traits/invoke.h
index 348abe92db4900e..edf6a570c433e09 100644
--- a/libc/src/__support/CPP/type_traits/invoke.h
+++ b/libc/src/__support/CPP/type_traits/invoke.h
@@ -17,7 +17,7 @@
#include "src/__support/CPP/type_traits/is_same.h"
#include "src/__support/CPP/utility/forward.h"
-namespace __llvm_libc::cpp {
+namespace LIBC_NAMESPACE::cpp {
namespace detail {
@@ -57,6 +57,6 @@ decltype(auto) invoke(Function &&fun, Args &&...args) {
cpp::forward<Function>(fun), cpp::forward<Args>(args)...);
}
-} // namespace __llvm_libc::cpp
+} // namespace LIBC_NAMESPACE::cpp
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_INVOKE_H
diff --git a/libc/src/__support/CPP/type_traits/invoke_result.h b/libc/src/__support/CPP/type_traits/invoke_result.h
index edcefd28e47e259..a6e522fbd1a0fb4 100644
--- a/libc/src/__support/CPP/type_traits/invoke_result.h
+++ b/libc/src/__support/CPP/type_traits/invoke_result.h
@@ -12,7 +12,7 @@
#include "src/__support/CPP/type_traits/type_identity.h"
#include "src/__support/CPP/utility/declval.h"
-namespace __llvm_libc::cpp {
+namespace LIBC_NAMESPACE::cpp {
template <class F, class... Args>
struct invoke_result : cpp::type_identity<decltype(cpp::invoke(
@@ -21,6 +21,6 @@ struct invoke_result : cpp::type_identity<decltype(cpp::invoke(
template <class F, class... Args>
using invoke_result_t = typename invoke_result<F, Args...>::type;
-} // namespace __llvm_libc::cpp
+} // namespace LIBC_NAMESPACE::cpp
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_INVOKE_RESULT_H
diff --git a/libc/src/__support/CPP/type_traits/is_arithmetic.h b/libc/src/__support/CPP/type_traits/is_arithmetic.h
index 9317874b36abf06..53bb21203f593fc 100644
--- a/libc/src/__support/CPP/type_traits/is_arithmetic.h
+++ b/libc/src/__support/CPP/type_traits/is_arithmetic.h
@@ -13,7 +13,7 @@
#include "src/__support/CPP/type_traits/is_integral.h"
#include "src/__support/macros/attributes.h"
-namespace __llvm_libc::cpp {
+namespace LIBC_NAMESPACE::cpp {
// is_arithmetic
template <typename T>
@@ -22,6 +22,6 @@ struct is_arithmetic : cpp::bool_constant<(cpp::is_integral_v<T> ||
template <typename T>
LIBC_INLINE_VAR constexpr bool is_arithmetic_v = is_arithmetic<T>::value;
-} // namespace __llvm_libc::cpp
+} // namespace LIBC_NAMESPACE::cpp
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_ARITHMETIC_H
diff --git a/libc/src/__support/CPP/type_traits/is_array.h b/libc/src/__support/CPP/type_traits/is_array.h
index 2d66ff11f707c79..14360b130b2b107 100644
--- a/libc/src/__support/CPP/type_traits/is_array.h
+++ b/libc/src/__support/CPP/type_traits/is_array.h
@@ -14,7 +14,7 @@
#include <stddef.h> // For size_t
-namespace __llvm_libc::cpp {
+namespace LIBC_NAMESPACE::cpp {
// is_array
template <class T> struct is_array : false_type {};
@@ -23,6 +23,6 @@ template <class T, size_t N> struct is_array<T[N]> : true_type {};
template <class T>
LIBC_INLINE_VAR constexpr bool is_array_v = is_array<T>::value;
-} // namespace __llvm_libc::cpp
+} // namespace LIBC_NAMESPACE::cpp
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_ARRAY_H
diff --git a/libc/src/__support/CPP/type_traits/is_base_of.h b/libc/src/__support/CPP/type_traits/is_base_of.h
index 46435f2c7612c06..47fb56876cd7fff 100644
--- a/libc/src/__support/CPP/type_traits/is_base_of.h
+++ b/libc/src/__support/CPP/type_traits/is_base_of.h
@@ -15,7 +15,7 @@
#include "src/__support/CPP/type_traits/true_type.h"
#include "src/__support/macros/attributes.h"
-namespace __llvm_libc::cpp {
+namespace LIBC_NAMESPACE::cpp {
// is_base_of
namespace detail {
@@ -39,6 +39,6 @@ struct is_base_of
template <typename Base, typename Derived>
LIBC_INLINE_VAR constexpr bool is_base_of_v = is_base_of<Base, Derived>::value;
-} // namespace __llvm_libc::cpp
+} // namespace LIBC_NAMESPACE::cpp
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_BASE_OF_H
diff --git a/libc/src/__support/CPP/type_traits/is_class.h b/libc/src/__support/CPP/type_traits/is_class.h
index bf9c5469f0420a2..83ebaea544c755b 100644
--- a/libc/src/__support/CPP/type_traits/is_class.h
+++ b/libc/src/__support/CPP/type_traits/is_class.h
@@ -13,7 +13,7 @@
#include "src/__support/CPP/type_traits/is_union.h"
#include "src/__support/macros/attributes.h"
-namespace __llvm_libc::cpp {
+namespace LIBC_NAMESPACE::cpp {
// is_class
namespace detail {
@@ -24,6 +24,6 @@ template <class T> struct is_class : decltype(detail::test<T>(nullptr)) {};
template <typename T>
LIBC_INLINE_VAR constexpr bool is_class_v = is_class<T>::value;
-} // namespace __llvm_libc::cpp
+} // namespace LIBC_NAMESPACE::cpp
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_CLASS_H
diff --git a/libc/src/__support/CPP/type_traits/is_const.h b/libc/src/__support/CPP/type_traits/is_const.h
index 83e7b83f60f3d33..8e56a9afd229170 100644
--- a/libc/src/__support/CPP/type_traits/is_const.h
+++ b/libc/src/__support/CPP/type_traits/is_const.h
@@ -12,7 +12,7 @@
#include "src/__support/CPP/type_traits/true_type.h"
#include "src/__support/macros/attributes.h"
-namespace __llvm_libc::cpp {
+namespace LIBC_NAMESPACE::cpp {
// is_const
template <class T> struct is_const : cpp::false_type {};
@@ -20,6 +20,6 @@ template <class T> struct is_const<const T> : cpp::true_type {};
template <class T>
LIBC_INLINE_VAR constexpr bool is_const_v = is_const<T>::value;
-} // namespace __llvm_libc::cpp
+} // namespace LIBC_NAMESPACE::cpp
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_CONST_H
diff --git a/libc/src/__support/CPP/type_traits/is_convertible.h b/libc/src/__support/CPP/type_traits/is_convertible.h
index cfc82ca71680284..d419443493f7d2a 100644
--- a/libc/src/__support/CPP/type_traits/is_convertible.h
+++ b/libc/src/__support/CPP/type_traits/is_convertible.h
@@ -12,7 +12,7 @@
#include "src/__support/CPP/utility/declval.h"
#include "src/__support/macros/attributes.h"
-namespace __llvm_libc::cpp {
+namespace LIBC_NAMESPACE::cpp {
// is_convertible
namespace detail {
@@ -40,6 +40,6 @@ template <class From, class To>
LIBC_INLINE_VAR constexpr bool is_convertible_v =
is_convertible<From, To>::value;
-} // namespace __llvm_libc::cpp
+} // namespace LIBC_NAMESPACE::cpp
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_CONVERTIBLE_H
diff --git a/libc/src/__support/CPP/type_traits/is_destructible.h b/libc/src/__support/CPP/type_traits/is_destructible.h
index 2d69fa95a07da27..d47de1cc797b291 100644
--- a/libc/src/__support/CPP/type_traits/is_destructible.h
+++ b/libc/src/__support/CPP/type_traits/is_destructible.h
@@ -18,7 +18,7 @@
#include "src/__support/macros/attributes.h"
#include "src/__support/macros/config.h"
-namespace __llvm_libc::cpp {
+namespace LIBC_NAMESPACE::cpp {
// is_destructible
#if LIBC_HAS_BUILTIN(__is_destructible)
@@ -61,6 +61,6 @@ template <> struct is_destructible<void> : public false_type {};
template <class T>
LIBC_INLINE_VAR constexpr bool is_destructible_v = is_destructible<T>::value;
-} // namespace __llvm_libc::cpp
+} // namespace LIBC_NAMESPACE::cpp
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_DESTRUCTIBLE_H
diff --git a/libc/src/__support/CPP/type_traits/is_enum.h b/libc/src/__support/CPP/type_traits/is_enum.h
index 14cea71e0fe4f3f..8d55a1ca8a9f7fe 100644
--- a/libc/src/__support/CPP/type_traits/is_enum.h
+++ b/libc/src/__support/CPP/type_traits/is_enum.h
@@ -11,13 +11,13 @@
#include "src/__support/CPP/type_traits/bool_constant.h"
#include "src/__support/macros/attributes.h"
-namespace __llvm_libc::cpp {
+namespace LIBC_NAMESPACE::cpp {
// is_enum
template <typename T> struct is_enum : bool_constant<__is_enum(T)> {};
template <typename T>
LIBC_INLINE_VAR constexpr bool is_enum_v = is_enum<T>::value;
-} // namespace __llvm_libc::cpp
+} // namespace LIBC_NAMESPACE::cpp
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_ENUM_H
diff --git a/libc/src/__support/CPP/type_traits/is_floating_point.h b/libc/src/__support/CPP/type_traits/is_floating_point.h
index ccb004d4cf1581a..2df75a072c3606c 100644
--- a/libc/src/__support/CPP/type_traits/is_floating_point.h
+++ b/libc/src/__support/CPP/type_traits/is_floating_point.h
@@ -12,7 +12,7 @@
#include "src/__support/CPP/type_traits/remove_cv.h"
#include "src/__support/macros/attributes.h"
-namespace __llvm_libc::cpp {
+namespace LIBC_NAMESPACE::cpp {
// is_floating_point
template <typename T> struct is_floating_point {
@@ -30,6 +30,6 @@ template <typename T>
LIBC_INLINE_VAR constexpr bool is_floating_point_v =
is_floating_point<T>::value;
-} // namespace __llvm_libc::cpp
+} // namespace LIBC_NAMESPACE::cpp
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_FLOATING_POINT_H
diff --git a/libc/src/__support/CPP/type_traits/is_function.h b/libc/src/__support/CPP/type_traits/is_function.h
index d8a9166ee99c4f1..557b3224484bcad 100644
--- a/libc/src/__support/CPP/type_traits/is_function.h
+++ b/libc/src/__support/CPP/type_traits/is_function.h
@@ -14,7 +14,7 @@
#include "src/__support/macros/attributes.h"
#include "src/__support/macros/config.h"
-namespace __llvm_libc::cpp {
+namespace LIBC_NAMESPACE::cpp {
// is_function
#if LIBC_HAS_BUILTIN(__is_function)
@@ -28,6 +28,6 @@ struct is_function
template <class T>
LIBC_INLINE_VAR constexpr bool is_function_v = is_function<T>::value;
-} // namespace __llvm_libc::cpp
+} // namespace LIBC_NAMESPACE::cpp
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_FUNCTION_H
diff --git a/libc/src/__support/CPP/type_traits/is_integral.h b/libc/src/__support/CPP/type_traits/is_integral.h
index 511101c278a9440..2808be594b20edd 100644
--- a/libc/src/__support/CPP/type_traits/is_integral.h
+++ b/libc/src/__support/CPP/type_traits/is_integral.h
@@ -12,7 +12,7 @@
#include "src/__support/CPP/type_traits/remove_cv.h"
#include "src/__support/macros/attributes.h"
-namespace __llvm_libc::cpp {
+namespace LIBC_NAMESPACE::cpp {
// is_integral
template <typename T> struct is_integral {
@@ -34,6 +34,6 @@ template <typename T> struct is_integral {
template <typename T>
LIBC_INLINE_VAR constexpr bool is_integral_v = is_integral<T>::value;
-} // namespace __llvm_libc::cpp
+} // namespace LIBC_NAMESPACE::cpp
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_INTEGRAL_H
diff --git a/libc/src/__support/CPP/type_traits/is_lvalue_reference.h b/libc/src/__support/CPP/type_traits/is_lvalue_reference.h
index ca3b7d9fc2dd7a6..f52e303afad2a5f 100644
--- a/libc/src/__support/CPP/type_traits/is_lvalue_reference.h
+++ b/libc/src/__support/CPP/type_traits/is_lvalue_reference.h
@@ -14,7 +14,7 @@
#include "src/__support/macros/attributes.h"
#include "src/__support/macros/config.h"
-namespace __llvm_libc::cpp {
+namespace LIBC_NAMESPACE::cpp {
// is_lvalue_reference
#if LIBC_HAS_BUILTIN(__is_lvalue_reference)
@@ -28,6 +28,6 @@ template <class T>
LIBC_INLINE_VAR constexpr bool is_lvalue_reference_v =
is_lvalue_reference<T>::value;
-} // namespace __llvm_libc::cpp
+} // namespace LIBC_NAMESPACE::cpp
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_LVALUE_REFERENCE_H
diff --git a/libc/src/__support/CPP/type_traits/is_member_pointer.h b/libc/src/__support/CPP/type_traits/is_member_pointer.h
index c885e773de84e0e..f1f362f8dfd5446 100644
--- a/libc/src/__support/CPP/type_traits/is_member_pointer.h
+++ b/libc/src/__support/CPP/type_traits/is_member_pointer.h
@@ -13,7 +13,7 @@
#include "src/__support/CPP/type_traits/true_type.h"
#include "src/__support/macros/attributes.h"
-namespace __llvm_libc::cpp {
+namespace LIBC_NAMESPACE::cpp {
// is_member_pointer
template <class T> struct is_member_pointer_helper : cpp::false_type {};
@@ -25,6 +25,6 @@ template <class T>
LIBC_INLINE_VAR constexpr bool is_member_pointer_v =
is_member_pointer<T>::value;
-} // namespace __llvm_libc::cpp
+} // namespace LIBC_NAMESPACE::cpp
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_MEMBER_POINTER_H
diff --git a/libc/src/__support/CPP/type_traits/is_null_pointer.h b/libc/src/__support/CPP/type_traits/is_null_pointer.h
index bc661e32075abfb..14452433862ae73 100644
--- a/libc/src/__support/CPP/type_traits/is_null_pointer.h
+++ b/libc/src/__support/CPP/type_traits/is_null_pointer.h
@@ -12,7 +12,7 @@
#include "src/__support/CPP/type_traits/remove_cv.h"
#include "src/__support/macros/attributes.h"
-namespace __llvm_libc::cpp {
+namespace LIBC_NAMESPACE::cpp {
// is_null_pointer
using nullptr_t = decltype(nullptr);
@@ -21,6 +21,6 @@ struct is_null_pointer : cpp::is_same<cpp::nullptr_t, cpp::remove_cv_t<T>> {};
template <class T>
LIBC_INLINE_VAR constexpr bool is_null_pointer_v = is_null_pointer<T>::value;
-} // namespace __llvm_libc::cpp
+} // namespace LIBC_NAMESPACE::cpp
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_NULL_POINTER_H
diff --git a/libc/src/__support/CPP/type_traits/is_object.h b/libc/src/__support/CPP/type_traits/is_object.h
index a9dafee7b49a72f..a23bebca572bec5 100644
--- a/libc/src/__support/CPP/type_traits/is_object.h
+++ b/libc/src/__support/CPP/type_traits/is_object.h
@@ -15,7 +15,7 @@
#include "src/__support/CPP/type_traits/is_union.h"
#include "src/__support/macros/attributes.h"
-namespace __llvm_libc::cpp {
+namespace LIBC_NAMESPACE::cpp {
// is_object
template <class T>
@@ -25,6 +25,6 @@ struct is_object
template <class T>
LIBC_INLINE_VAR constexpr bool is_object_v = is_object<T>::value;
-} // namespace __llvm_libc::cpp
+} // namespace LIBC_NAMESPACE::cpp
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_OBJECT_H
diff --git a/libc/src/__support/CPP/type_traits/is_pointer.h b/libc/src/__support/CPP/type_traits/is_pointer.h
index 0903c586c806de1..177f8e5b64e7ab5 100644
--- a/libc/src/__support/CPP/type_traits/is_pointer.h
+++ b/libc/src/__support/CPP/type_traits/is_pointer.h
@@ -12,7 +12,7 @@
#include "src/__support/CPP/type_traits/true_type.h"
#include "src/__support/macros/attributes.h"
-namespace __llvm_libc::cpp {
+namespace LIBC_NAMESPACE::cpp {
// is_pointer
template <typename T> struct is_pointer : cpp::false_type {};
@@ -23,6 +23,6 @@ template <typename T> struct is_pointer<T *const volatile> : cpp::true_type {};
template <typename T>
LIBC_INLINE_VAR constexpr bool is_pointer_v = is_pointer<T>::value;
-} // namespace __llvm_libc::cpp
+} // namespace LIBC_NAMESPACE::cpp
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_POINTER_H
diff --git a/libc/src/__support/CPP/type_traits/is_reference.h b/libc/src/__support/CPP/type_traits/is_reference.h
index ff3b26c769aa169..c017028edf411f6 100644
--- a/libc/src/__support/CPP/type_traits/is_reference.h
+++ b/libc/src/__support/CPP/type_traits/is_reference.h
@@ -14,7 +14,7 @@
#include "src/__support/macros/attributes.h"
#include "src/__support/macros/config.h"
-namespace __llvm_libc::cpp {
+namespace LIBC_NAMESPACE::cpp {
// is_reference
#if LIBC_HAS_BUILTIN(__is_reference)
@@ -27,6 +27,6 @@ template <typename T> struct is_reference<T &&> : public true_type {};
template <class T>
LIBC_INLINE_VAR constexpr bool is_reference_v = is_reference<T>::value;
-} // namespace __llvm_libc::cpp
+} // namespace LIBC_NAMESPACE::cpp
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_REFERENCE_H
diff --git a/libc/src/__support/CPP/type_traits/is_rvalue_reference.h b/libc/src/__support/CPP/type_traits/is_rvalue_reference.h
index eb8412a1d82ea71..f0487e41c998fef 100644
--- a/libc/src/__support/CPP/type_traits/is_rvalue_reference.h
+++ b/libc/src/__support/CPP/type_traits/is_rvalue_reference.h
@@ -14,7 +14,7 @@
#include "src/__support/macros/attributes.h"
#include "src/__support/macros/config.h"
-namespace __llvm_libc::cpp {
+namespace LIBC_NAMESPACE::cpp {
// is_rvalue_reference
#if LIBC_HAS_BUILTIN(__is_rvalue_reference)
@@ -28,6 +28,6 @@ template <class T>
LIBC_INLINE_VAR constexpr bool is_rvalue_reference_v =
is_rvalue_reference<T>::value;
-} // namespace __llvm_libc::cpp
+} // namespace LIBC_NAMESPACE::cpp
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_RVALUE_REFERENCE_H
diff --git a/libc/src/__support/CPP/type_traits/is_same.h b/libc/src/__support/CPP/type_traits/is_same.h
index bd1c7362b64cd7c..eb73952f9f971f1 100644
--- a/libc/src/__support/CPP/type_traits/is_same.h
+++ b/libc/src/__support/CPP/type_traits/is_same.h
@@ -12,7 +12,7 @@
#include "src/__support/CPP/type_traits/true_type.h"
#include "src/__support/macros/attributes.h"
-namespace __llvm_libc::cpp {
+namespace LIBC_NAMESPACE::cpp {
// is_same
template <typename T, typename U> struct is_same : cpp::false_type {};
@@ -20,6 +20,6 @@ template <typename T> struct is_same<T, T> : cpp::true_type {};
template <typename T, typename U>
LIBC_INLINE_VAR constexpr bool is_same_v = is_same<T, U>::value;
-} // namespace __llvm_libc::cpp
+} // namespace LIBC_NAMESPACE::cpp
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_SAME_H
diff --git a/libc/src/__support/CPP/type_traits/is_scalar.h b/libc/src/__support/CPP/type_traits/is_scalar.h
index ed7e34e508d0383..1f71cde36ca27af 100644
--- a/libc/src/__support/CPP/type_traits/is_scalar.h
+++ b/libc/src/__support/CPP/type_traits/is_scalar.h
@@ -16,7 +16,7 @@
#include "src/__support/CPP/type_traits/is_pointer.h"
#include "src/__support/macros/attributes.h"
-namespace __llvm_libc::cpp {
+namespace LIBC_NAMESPACE::cpp {
// is_scalar
template <class T>
@@ -27,6 +27,6 @@ struct is_scalar
template <class T>
LIBC_INLINE_VAR constexpr bool is_scalar_v = is_scalar<T>::value;
-} // namespace __llvm_libc::cpp
+} // namespace LIBC_NAMESPACE::cpp
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_SCALAR_H
diff --git a/libc/src/__support/CPP/type_traits/is_signed.h b/libc/src/__support/CPP/type_traits/is_signed.h
index 71151307129bf99..971fe692679f93a 100644
--- a/libc/src/__support/CPP/type_traits/is_signed.h
+++ b/libc/src/__support/CPP/type_traits/is_signed.h
@@ -12,7 +12,7 @@
#include "src/__support/CPP/type_traits/is_arithmetic.h"
#include "src/__support/macros/attributes.h"
-namespace __llvm_libc::cpp {
+namespace LIBC_NAMESPACE::cpp {
// is_signed
template <typename T>
@@ -23,6 +23,6 @@ struct is_signed : bool_constant<(is_arithmetic_v<T> && (T(-1) < T(0)))> {
template <typename T>
LIBC_INLINE_VAR constexpr bool is_signed_v = is_signed<T>::value;
-} // namespace __llvm_libc::cpp
+} // namespace LIBC_NAMESPACE::cpp
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_SIGNED_H
diff --git a/libc/src/__support/CPP/type_traits/is_trivially_constructible.h b/libc/src/__support/CPP/type_traits/is_trivially_constructible.h
index daa9c7add2c0a93..be97b2289cf0abc 100644
--- a/libc/src/__support/CPP/type_traits/is_trivially_constructible.h
+++ b/libc/src/__support/CPP/type_traits/is_trivially_constructible.h
@@ -10,13 +10,13 @@
#include "src/__support/CPP/type_traits/integral_constant.h"
-namespace __llvm_libc::cpp {
+namespace LIBC_NAMESPACE::cpp {
// is_trivially_constructible
template <class T, class... Args>
struct is_trivially_constructible
: integral_constant<bool, __is_trivially_constructible(T, Args...)> {};
-} // namespace __llvm_libc::cpp
+} // namespace LIBC_NAMESPACE::cpp
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_TRIVIALLY_CONSTRUCTIBLE_H
diff --git a/libc/src/__support/CPP/type_traits/is_trivially_copyable.h b/libc/src/__support/CPP/type_traits/is_trivially_copyable.h
index 9e7d05e2ecc74f5..0c3fdcc711d57f6 100644
--- a/libc/src/__support/CPP/type_traits/is_trivially_copyable.h
+++ b/libc/src/__support/CPP/type_traits/is_trivially_copyable.h
@@ -11,13 +11,13 @@
#include "src/__support/CPP/type_traits/integral_constant.h"
#include "src/__support/macros/config.h"
-namespace __llvm_libc::cpp {
+namespace LIBC_NAMESPACE::cpp {
// is_trivially_copyable
template <class T>
struct is_trivially_copyable
: public integral_constant<bool, __is_trivially_copyable(T)> {};
-} // namespace __llvm_libc::cpp
+} // namespace LIBC_NAMESPACE::cpp
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_TRIVIALLY_COPYABLE_H
diff --git a/libc/src/__support/CPP/type_traits/is_trivially_destructible.h b/libc/src/__support/CPP/type_traits/is_trivially_destructible.h
index ce32309b3bf7a8a..3345149433afc47 100644
--- a/libc/src/__support/CPP/type_traits/is_trivially_destructible.h
+++ b/libc/src/__support/CPP/type_traits/is_trivially_destructible.h
@@ -13,7 +13,7 @@
#include "src/__support/macros/attributes.h"
#include "src/__support/macros/config.h"
-namespace __llvm_libc::cpp {
+namespace LIBC_NAMESPACE::cpp {
// is_trivially_destructible
#if LIBC_HAS_BUILTIN(__is_trivially_destructible)
@@ -30,6 +30,6 @@ template <typename T>
LIBC_INLINE_VAR constexpr bool is_trivially_destructible_v =
is_trivially_destructible<T>::value;
-} // namespace __llvm_libc::cpp
+} // namespace LIBC_NAMESPACE::cpp
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_TRIVIALLY_DESTRUCTIBLE_H
diff --git a/libc/src/__support/CPP/type_traits/is_union.h b/libc/src/__support/CPP/type_traits/is_union.h
index 807d8f13c2b1c76..04e78a89fc0c10f 100644
--- a/libc/src/__support/CPP/type_traits/is_union.h
+++ b/libc/src/__support/CPP/type_traits/is_union.h
@@ -11,13 +11,13 @@
#include "src/__support/CPP/type_traits/bool_constant.h"
#include "src/__support/macros/attributes.h"
-namespace __llvm_libc::cpp {
+namespace LIBC_NAMESPACE::cpp {
// is_union
template <class T> struct is_union : bool_constant<__is_union(T)> {};
template <typename T>
LIBC_INLINE_VAR constexpr bool is_union_v = is_union<T>::value;
-} // namespace __llvm_libc::cpp
+} // namespace LIBC_NAMESPACE::cpp
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_UNION_H
diff --git a/libc/src/__support/CPP/type_traits/is_unsigned.h b/libc/src/__support/CPP/type_traits/is_unsigned.h
index c4dc777441e29ce..f089c2b61632f1d 100644
--- a/libc/src/__support/CPP/type_traits/is_unsigned.h
+++ b/libc/src/__support/CPP/type_traits/is_unsigned.h
@@ -12,7 +12,7 @@
#include "src/__support/CPP/type_traits/is_arithmetic.h"
#include "src/__support/macros/attributes.h"
-namespace __llvm_libc::cpp {
+namespace LIBC_NAMESPACE::cpp {
// is_unsigned
template <typename T>
@@ -23,6 +23,6 @@ struct is_unsigned : bool_constant<(is_arithmetic_v<T> && (T(-1) > T(0)))> {
template <typename T>
LIBC_INLINE_VAR constexpr bool is_unsigned_v = is_unsigned<T>::value;
-} // namespace __llvm_libc::cpp
+} // namespace LIBC_NAMESPACE::cpp
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_UNSIGNED_H
diff --git a/libc/src/__support/CPP/type_traits/is_void.h b/libc/src/__support/CPP/type_traits/is_void.h
index 54cda12def095cd..040dc831fd64e16 100644
--- a/libc/src/__support/CPP/type_traits/is_void.h
+++ b/libc/src/__support/CPP/type_traits/is_void.h
@@ -12,13 +12,13 @@
#include "src/__support/CPP/type_traits/remove_cv.h"
#include "src/__support/macros/attributes.h"
-namespace __llvm_libc::cpp {
+namespace LIBC_NAMESPACE::cpp {
// is_void
template <typename T> struct is_void : is_same<void, remove_cv_t<T>> {};
template <typename T>
LIBC_INLINE_VAR constexpr bool is_void_v = is_void<T>::value;
-} // namespace __llvm_libc::cpp
+} // namespace LIBC_NAMESPACE::cpp
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_VOID_H
diff --git a/libc/src/__support/CPP/type_traits/make_signed.h b/libc/src/__support/CPP/type_traits/make_signed.h
index 0e8bff68ddb75d9..21302850bfd4abd 100644
--- a/libc/src/__support/CPP/type_traits/make_signed.h
+++ b/libc/src/__support/CPP/type_traits/make_signed.h
@@ -10,7 +10,7 @@
#include "src/__support/CPP/type_traits/type_identity.h"
-namespace __llvm_libc::cpp {
+namespace LIBC_NAMESPACE::cpp {
// make_signed
template <typename T> struct make_signed;
@@ -32,6 +32,6 @@ template <> struct make_signed<__uint128_t> : type_identity<__int128_t> {};
#endif
template <typename T> using make_signed_t = typename make_signed<T>::type;
-} // namespace __llvm_libc::cpp
+} // namespace LIBC_NAMESPACE::cpp
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_MAKE_SIGNED_H
diff --git a/libc/src/__support/CPP/type_traits/make_unsigned.h b/libc/src/__support/CPP/type_traits/make_unsigned.h
index 75fc8188b870bf3..20948014a66574f 100644
--- a/libc/src/__support/CPP/type_traits/make_unsigned.h
+++ b/libc/src/__support/CPP/type_traits/make_unsigned.h
@@ -10,7 +10,7 @@
#include "src/__support/CPP/type_traits/type_identity.h"
-namespace __llvm_libc::cpp {
+namespace LIBC_NAMESPACE::cpp {
// make_unsigned
@@ -37,6 +37,6 @@ template <> struct make_unsigned<__uint128_t> : type_identity<__uint128_t> {};
#endif
template <typename T> using make_unsigned_t = typename make_unsigned<T>::type;
-} // namespace __llvm_libc::cpp
+} // namespace LIBC_NAMESPACE::cpp
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_MAKE_UNSIGNED_H
diff --git a/libc/src/__support/CPP/type_traits/remove_all_extents.h b/libc/src/__support/CPP/type_traits/remove_all_extents.h
index da66043c58c1261..bff6341d3e45601 100644
--- a/libc/src/__support/CPP/type_traits/remove_all_extents.h
+++ b/libc/src/__support/CPP/type_traits/remove_all_extents.h
@@ -13,7 +13,7 @@
#include <stddef.h> // size_t
-namespace __llvm_libc::cpp {
+namespace LIBC_NAMESPACE::cpp {
// remove_all_extents
#if LIBC_HAS_BUILTIN(__remove_all_extents)
@@ -34,6 +34,6 @@ template <typename T>
using remove_all_extents_t = typename remove_all_extents<T>::type;
#endif
-} // namespace __llvm_libc::cpp
+} // namespace LIBC_NAMESPACE::cpp
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_REMOVE_ALL_EXTENTS_H
diff --git a/libc/src/__support/CPP/type_traits/remove_cv.h b/libc/src/__support/CPP/type_traits/remove_cv.h
index 972e0fc2fdb01a8..3cd7e5914119cc2 100644
--- a/libc/src/__support/CPP/type_traits/remove_cv.h
+++ b/libc/src/__support/CPP/type_traits/remove_cv.h
@@ -10,7 +10,7 @@
#include "src/__support/CPP/type_traits/type_identity.h"
-namespace __llvm_libc::cpp {
+namespace LIBC_NAMESPACE::cpp {
// remove_cv
template <class T> struct remove_cv : cpp::type_identity<T> {};
@@ -20,6 +20,6 @@ template <class T>
struct remove_cv<const volatile T> : cpp::type_identity<T> {};
template <class T> using remove_cv_t = typename remove_cv<T>::type;
-} // namespace __llvm_libc::cpp
+} // namespace LIBC_NAMESPACE::cpp
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_REMOVE_CV_H
diff --git a/libc/src/__support/CPP/type_traits/remove_cvref.h b/libc/src/__support/CPP/type_traits/remove_cvref.h
index 73831486d01161a..6b410bb5841bc3a 100644
--- a/libc/src/__support/CPP/type_traits/remove_cvref.h
+++ b/libc/src/__support/CPP/type_traits/remove_cvref.h
@@ -11,7 +11,7 @@
#include "src/__support/CPP/type_traits/remove_cv.h"
#include "src/__support/CPP/type_traits/remove_reference.h"
-namespace __llvm_libc::cpp {
+namespace LIBC_NAMESPACE::cpp {
// remove_cvref
template <typename T> struct remove_cvref {
@@ -19,6 +19,6 @@ template <typename T> struct remove_cvref {
};
template <typename T> using remove_cvref_t = typename remove_cvref<T>::type;
-} // namespace __llvm_libc::cpp
+} // namespace LIBC_NAMESPACE::cpp
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_REMOVE_CVREF_H
diff --git a/libc/src/__support/CPP/type_traits/remove_extent.h b/libc/src/__support/CPP/type_traits/remove_extent.h
index 72d8d984427fb20..3c0759dc1a522a7 100644
--- a/libc/src/__support/CPP/type_traits/remove_extent.h
+++ b/libc/src/__support/CPP/type_traits/remove_extent.h
@@ -11,7 +11,7 @@
#include "src/__support/CPP/type_traits/type_identity.h"
#include "stddef.h" // size_t
-namespace __llvm_libc::cpp {
+namespace LIBC_NAMESPACE::cpp {
// remove_extent
template <class T> struct remove_extent : cpp::type_identity<T> {};
@@ -20,6 +20,6 @@ template <class T, size_t N>
struct remove_extent<T[N]> : cpp::type_identity<T> {};
template <class T> using remove_extent_t = typename remove_extent<T>::type;
-} // namespace __llvm_libc::cpp
+} // namespace LIBC_NAMESPACE::cpp
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_REMOVE_EXTENT_H
diff --git a/libc/src/__support/CPP/type_traits/remove_reference.h b/libc/src/__support/CPP/type_traits/remove_reference.h
index 34f0ae9ff3e3ba9..02a0bd6373d3ab4 100644
--- a/libc/src/__support/CPP/type_traits/remove_reference.h
+++ b/libc/src/__support/CPP/type_traits/remove_reference.h
@@ -10,7 +10,7 @@
#include "src/__support/CPP/type_traits/type_identity.h"
-namespace __llvm_libc::cpp {
+namespace LIBC_NAMESPACE::cpp {
// remove_reference
template <class T> struct remove_reference : cpp::type_identity<T> {};
@@ -19,6 +19,6 @@ template <class T> struct remove_reference<T &&> : cpp::type_identity<T> {};
template <class T>
using remove_reference_t = typename remove_reference<T>::type;
-} // namespace __llvm_libc::cpp
+} // namespace LIBC_NAMESPACE::cpp
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_REMOVE_REFERENCE_H
diff --git a/libc/src/__support/CPP/type_traits/true_type.h b/libc/src/__support/CPP/type_traits/true_type.h
index 8551cef874f7ce3..60ffc8acd9dad14 100644
--- a/libc/src/__support/CPP/type_traits/true_type.h
+++ b/libc/src/__support/CPP/type_traits/true_type.h
@@ -10,11 +10,11 @@
#include "src/__support/CPP/type_traits/bool_constant.h"
-namespace __llvm_libc::cpp {
+namespace LIBC_NAMESPACE::cpp {
// true_type
using true_type = cpp::bool_constant<true>;
-} // namespace __llvm_libc::cpp
+} // namespace LIBC_NAMESPACE::cpp
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_TRUE_TYPE_H
diff --git a/libc/src/__support/CPP/type_traits/type_identity.h b/libc/src/__support/CPP/type_traits/type_identity.h
index 0804276a5424d86..f33a43ac7ea10b7 100644
--- a/libc/src/__support/CPP/type_traits/type_identity.h
+++ b/libc/src/__support/CPP/type_traits/type_identity.h
@@ -8,13 +8,13 @@
#ifndef LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_TYPE_IDENTITY_H
#define LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_TYPE_IDENTITY_H
-namespace __llvm_libc::cpp {
+namespace LIBC_NAMESPACE::cpp {
// type_identity
template <typename T> struct type_identity {
using type = T;
};
-} // namespace __llvm_libc::cpp
+} // namespace LIBC_NAMESPACE::cpp
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_TYPE_IDENTITY_H
diff --git a/libc/src/__support/CPP/type_traits/void_t.h b/libc/src/__support/CPP/type_traits/void_t.h
index 03fe6b957e71226..babdaccfbc53703 100644
--- a/libc/src/__support/CPP/type_traits/void_t.h
+++ b/libc/src/__support/CPP/type_traits/void_t.h
@@ -10,7 +10,7 @@
#include "src/__support/CPP/type_traits/type_identity.h"
-namespace __llvm_libc::cpp {
+namespace LIBC_NAMESPACE::cpp {
// void_t
@@ -21,6 +21,6 @@ template <typename... Ts> struct make_void : cpp::type_identity<void> {};
template <typename... Ts>
using void_t = typename detail::make_void<Ts...>::type;
-} // namespace __llvm_libc::cpp
+} // namespace LIBC_NAMESPACE::cpp
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_VOID_T_H
diff --git a/libc/src/__support/CPP/utility/declval.h b/libc/src/__support/CPP/utility/declval.h
index 2522baf0e1b1504..0d00aa6d38199b4 100644
--- a/libc/src/__support/CPP/utility/declval.h
+++ b/libc/src/__support/CPP/utility/declval.h
@@ -11,7 +11,7 @@
#include "src/__support/CPP/type_traits/add_rvalue_reference.h"
#include "src/__support/CPP/type_traits/always_false.h"
-namespace __llvm_libc::cpp {
+namespace LIBC_NAMESPACE::cpp {
// declval
template <typename T> cpp::add_rvalue_reference_t<T> declval() {
@@ -19,6 +19,6 @@ template <typename T> cpp::add_rvalue_reference_t<T> declval() {
"declval not allowed in an evaluated context");
}
-} // namespace __llvm_libc::cpp
+} // namespace LIBC_NAMESPACE::cpp
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_UTILITY_DECLVAL_H
diff --git a/libc/src/__support/CPP/utility/forward.h b/libc/src/__support/CPP/utility/forward.h
index 78ffb736ceb3de8..891097ec96d545d 100644
--- a/libc/src/__support/CPP/utility/forward.h
+++ b/libc/src/__support/CPP/utility/forward.h
@@ -12,7 +12,7 @@
#include "src/__support/CPP/type_traits/remove_reference.h"
#include "src/__support/macros/attributes.h"
-namespace __llvm_libc::cpp {
+namespace LIBC_NAMESPACE::cpp {
// forward
template <typename T>
@@ -27,6 +27,6 @@ LIBC_INLINE constexpr T &&forward(remove_reference_t<T> &&value) {
return static_cast<T &&>(value);
}
-} // namespace __llvm_libc::cpp
+} // namespace LIBC_NAMESPACE::cpp
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_UTILITY_FORWARD_H
diff --git a/libc/src/__support/CPP/utility/in_place.h b/libc/src/__support/CPP/utility/in_place.h
index dfb7486c4eba0bf..f15703fad63b3ac 100644
--- a/libc/src/__support/CPP/utility/in_place.h
+++ b/libc/src/__support/CPP/utility/in_place.h
@@ -12,7 +12,7 @@
#include <stddef.h> // size_t
-namespace __llvm_libc::cpp {
+namespace LIBC_NAMESPACE::cpp {
// in_place
struct in_place_t {
@@ -31,6 +31,6 @@ template <size_t I> struct in_place_index_t {
template <size_t I>
LIBC_INLINE_VAR constexpr in_place_index_t<I> in_place_index{};
-} // namespace __llvm_libc::cpp
+} // namespace LIBC_NAMESPACE::cpp
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_UTILITY_IN_PLACE_H
diff --git a/libc/src/__support/CPP/utility/integer_sequence.h b/libc/src/__support/CPP/utility/integer_sequence.h
index 3d2e001e87799b7..2ed26df3d238eee 100644
--- a/libc/src/__support/CPP/utility/integer_sequence.h
+++ b/libc/src/__support/CPP/utility/integer_sequence.h
@@ -10,7 +10,7 @@
#include "src/__support/CPP/type_traits/is_integral.h"
-namespace __llvm_libc::cpp {
+namespace LIBC_NAMESPACE::cpp {
// integer_sequence
template <typename T, T... Ints> struct integer_sequence {
@@ -32,6 +32,6 @@ template <typename T, int N>
using make_integer_sequence =
typename detail::make_integer_sequence<T, N - 1>::type;
-} // namespace __llvm_libc::cpp
+} // namespace LIBC_NAMESPACE::cpp
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_UTILITY_INTEGER_SEQUENCE_H
diff --git a/libc/src/__support/CPP/utility/move.h b/libc/src/__support/CPP/utility/move.h
index bc0b63e3687c80d..2b4cdf0c4a160b1 100644
--- a/libc/src/__support/CPP/utility/move.h
+++ b/libc/src/__support/CPP/utility/move.h
@@ -10,13 +10,13 @@
#include "src/__support/CPP/type_traits/remove_reference.h"
-namespace __llvm_libc::cpp {
+namespace LIBC_NAMESPACE::cpp {
// move
template <class T> constexpr cpp::remove_reference_t<T> &&move(T &&t) {
return static_cast<typename cpp::remove_reference_t<T> &&>(t);
}
-} // namespace __llvm_libc::cpp
+} // namespace LIBC_NAMESPACE::cpp
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_UTILITY_MOVE_H
diff --git a/libc/src/__support/FPUtil/BasicOperations.h b/libc/src/__support/FPUtil/BasicOperations.h
index 67b8e666479f2d9..2ec61517b0b8086 100644
--- a/libc/src/__support/FPUtil/BasicOperations.h
+++ b/libc/src/__support/FPUtil/BasicOperations.h
@@ -14,7 +14,7 @@
#include "src/__support/CPP/type_traits.h"
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
namespace fputil {
template <typename T, cpp::enable_if_t<cpp::is_floating_point_v<T>, int> = 0>
@@ -76,6 +76,6 @@ LIBC_INLINE T fdim(T x, T y) {
}
} // namespace fputil
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC___SUPPORT_FPUTIL_BASICOPERATIONS_H
diff --git a/libc/src/__support/FPUtil/DivisionAndRemainderOperations.h b/libc/src/__support/FPUtil/DivisionAndRemainderOperations.h
index f0b5ba98e43ab76..60252fe9cb877ab 100644
--- a/libc/src/__support/FPUtil/DivisionAndRemainderOperations.h
+++ b/libc/src/__support/FPUtil/DivisionAndRemainderOperations.h
@@ -16,7 +16,7 @@
#include "src/__support/CPP/type_traits.h"
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
namespace fputil {
static constexpr int QUOTIENT_LSB_BITS = 3;
@@ -35,7 +35,7 @@ LIBC_INLINE T remquo(T x, T y, int &q) {
if (xbits.is_zero()) {
q = 0;
- return __llvm_libc::fputil::copysign(T(0.0), x);
+ return LIBC_NAMESPACE::fputil::copysign(T(0.0), x);
}
if (ybits.is_inf()) {
@@ -73,7 +73,7 @@ LIBC_INLINE T remquo(T x, T y, int &q) {
mx = n - my;
if (mx == 0) {
q = result_sign ? -q : q;
- return __llvm_libc::fputil::copysign(T(0.0), x);
+ return LIBC_NAMESPACE::fputil::copysign(T(0.0), x);
}
}
@@ -109,11 +109,11 @@ LIBC_INLINE T remquo(T x, T y, int &q) {
q = result_sign ? -q : q;
if (native_remainder == T(0.0))
- return __llvm_libc::fputil::copysign(T(0.0), x);
+ return LIBC_NAMESPACE::fputil::copysign(T(0.0), x);
return native_remainder;
}
} // namespace fputil
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC___SUPPORT_FPUTIL_DIVISIONANDREMAINDEROPERATIONS_H
diff --git a/libc/src/__support/FPUtil/FEnvImpl.h b/libc/src/__support/FPUtil/FEnvImpl.h
index 29ae4a37f8823f5..8801760d887fc2e 100644
--- a/libc/src/__support/FPUtil/FEnvImpl.h
+++ b/libc/src/__support/FPUtil/FEnvImpl.h
@@ -36,7 +36,7 @@
#include "riscv64/FEnvImpl.h"
#else
-namespace __llvm_libc::fputil {
+namespace LIBC_NAMESPACE::fputil {
// All dummy functions silently succeed.
@@ -64,10 +64,10 @@ LIBC_INLINE int get_env(fenv_t *) { return 0; }
LIBC_INLINE int set_env(const fenv_t *) { return 0; }
-} // namespace __llvm_libc::fputil
+} // namespace LIBC_NAMESPACE::fputil
#endif
-namespace __llvm_libc::fputil {
+namespace LIBC_NAMESPACE::fputil {
LIBC_INLINE int set_except_if_required(int excepts) {
if (math_errhandling & MATH_ERREXCEPT)
@@ -86,6 +86,6 @@ LIBC_INLINE void set_errno_if_required(int err) {
libc_errno = err;
}
-} // namespace __llvm_libc::fputil
+} // namespace LIBC_NAMESPACE::fputil
#endif // LLVM_LIBC_SRC___SUPPORT_FPUTIL_FENVIMPL_H
diff --git a/libc/src/__support/FPUtil/FMA.h b/libc/src/__support/FPUtil/FMA.h
index eb95bf0f2ee108f..32e562ab1d5e48d 100644
--- a/libc/src/__support/FPUtil/FMA.h
+++ b/libc/src/__support/FPUtil/FMA.h
@@ -29,7 +29,7 @@
#include "generic/FMA.h"
#include "src/__support/CPP/type_traits.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
namespace fputil {
template <typename T> LIBC_INLINE T fma(T x, T y, T z) {
@@ -37,7 +37,7 @@ template <typename T> LIBC_INLINE T fma(T x, T y, T z) {
}
} // namespace fputil
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif
diff --git a/libc/src/__support/FPUtil/FPBits.h b/libc/src/__support/FPUtil/FPBits.h
index d7ab076130840f5..226dd9b85515d61 100644
--- a/libc/src/__support/FPUtil/FPBits.h
+++ b/libc/src/__support/FPUtil/FPBits.h
@@ -19,7 +19,7 @@
#include "FloatProperties.h"
#include <stdint.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
namespace fputil {
template <typename T> struct MantissaWidth {
@@ -233,7 +233,7 @@ template <typename T> struct FPBits {
};
} // namespace fputil
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#ifdef SPECIAL_X86_LONG_DOUBLE
#include "x86_64/LongDoubleBits.h"
diff --git a/libc/src/__support/FPUtil/FloatProperties.h b/libc/src/__support/FPUtil/FloatProperties.h
index 3df961a9380e5e5..c1d58a87101afc1 100644
--- a/libc/src/__support/FPUtil/FloatProperties.h
+++ b/libc/src/__support/FPUtil/FloatProperties.h
@@ -15,7 +15,7 @@
#include <stdint.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
namespace fputil {
template <typename T> struct FloatProperties {};
@@ -194,6 +194,6 @@ template <typename BitsType>
using FloatTypeT = typename FloatType<BitsType>::Type;
} // namespace fputil
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC___SUPPORT_FPUTIL_FLOATPROPERTIES_H
diff --git a/libc/src/__support/FPUtil/Hypot.h b/libc/src/__support/FPUtil/Hypot.h
index 5bf6db72bdc130e..357d9a6e99c7457 100644
--- a/libc/src/__support/FPUtil/Hypot.h
+++ b/libc/src/__support/FPUtil/Hypot.h
@@ -19,7 +19,7 @@
#include "src/__support/builtin_wrappers.h"
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
namespace fputil {
namespace internal {
@@ -260,6 +260,6 @@ LIBC_INLINE T hypot(T x, T y) {
}
} // namespace fputil
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC___SUPPORT_FPUTIL_HYPOT_H
diff --git a/libc/src/__support/FPUtil/ManipulationFunctions.h b/libc/src/__support/FPUtil/ManipulationFunctions.h
index 676dafa27c96312..6d62a2d0fcdf2be 100644
--- a/libc/src/__support/FPUtil/ManipulationFunctions.h
+++ b/libc/src/__support/FPUtil/ManipulationFunctions.h
@@ -22,7 +22,7 @@
#include <limits.h>
#include <math.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
namespace fputil {
template <typename T, cpp::enable_if_t<cpp::is_floating_point_v<T>, int> = 0>
@@ -174,7 +174,7 @@ LIBC_INLINE T nextafter(T from, T to) {
}
} // namespace fputil
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#ifdef SPECIAL_X86_LONG_DOUBLE
#include "x86_64/NextAfterLongDouble.h"
diff --git a/libc/src/__support/FPUtil/NearestIntegerOperations.h b/libc/src/__support/FPUtil/NearestIntegerOperations.h
index 9f151f24f3b8a9b..8c4b24803bec1d3 100644
--- a/libc/src/__support/FPUtil/NearestIntegerOperations.h
+++ b/libc/src/__support/FPUtil/NearestIntegerOperations.h
@@ -18,7 +18,7 @@
#include <math.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
namespace fputil {
template <typename T, cpp::enable_if_t<cpp::is_floating_point_v<T>, int> = 0>
@@ -286,6 +286,6 @@ LIBC_INLINE I round_to_signed_integer_using_current_rounding_mode(F x) {
}
} // namespace fputil
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC___SUPPORT_FPUTIL_NEARESTINTEGEROPERATIONS_H
diff --git a/libc/src/__support/FPUtil/NormalFloat.h b/libc/src/__support/FPUtil/NormalFloat.h
index 0b2eb628ee1960b..afbf97cc2b6386d 100644
--- a/libc/src/__support/FPUtil/NormalFloat.h
+++ b/libc/src/__support/FPUtil/NormalFloat.h
@@ -16,7 +16,7 @@
#include <stdint.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
namespace fputil {
// A class which stores the normalized form of a floating point value.
@@ -262,6 +262,6 @@ template <> LIBC_INLINE NormalFloat<long double>::operator long double() const {
#endif // SPECIAL_X86_LONG_DOUBLE
} // namespace fputil
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC___SUPPORT_FPUTIL_NORMALFLOAT_H
diff --git a/libc/src/__support/FPUtil/PolyEval.h b/libc/src/__support/FPUtil/PolyEval.h
index 12027289bde9e3f..7a6384541a74744 100644
--- a/libc/src/__support/FPUtil/PolyEval.h
+++ b/libc/src/__support/FPUtil/PolyEval.h
@@ -20,7 +20,7 @@
// Example: to evaluate x^3 + 2*x^2 + 3*x + 4, call
// polyeval( x, 4.0, 3.0, 2.0, 1.0 )
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
namespace fputil {
template <typename T>
@@ -48,6 +48,6 @@ polyeval(T x, T a0, Ts... a) {
}
} // namespace fputil
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC___SUPPORT_FPUTIL_POLYEVAL_H
diff --git a/libc/src/__support/FPUtil/XFloat.h b/libc/src/__support/FPUtil/XFloat.h
index b3f8f44badd3325..fe334f8a33011d3 100644
--- a/libc/src/__support/FPUtil/XFloat.h
+++ b/libc/src/__support/FPUtil/XFloat.h
@@ -12,7 +12,7 @@
#include <stdint.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
namespace fputil {
// Store and manipulate positive double precision numbers at |Precision| bits.
@@ -177,4 +177,4 @@ template <size_t Precision> class XFloat {
};
} // namespace fputil
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/__support/FPUtil/aarch64/FEnvImpl.h b/libc/src/__support/FPUtil/aarch64/FEnvImpl.h
index 4cc4920bb39c16d..47c65af452809b5 100644
--- a/libc/src/__support/FPUtil/aarch64/FEnvImpl.h
+++ b/libc/src/__support/FPUtil/aarch64/FEnvImpl.h
@@ -22,7 +22,7 @@
#include "src/__support/FPUtil/FPBits.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
namespace fputil {
struct FEnv {
@@ -278,6 +278,6 @@ LIBC_INLINE int set_env(const fenv_t *envp) {
}
} // namespace fputil
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC___SUPPORT_FPUTIL_AARCH64_FENVIMPL_H
diff --git a/libc/src/__support/FPUtil/aarch64/FMA.h b/libc/src/__support/FPUtil/aarch64/FMA.h
index eaa3b2c11bb2a47..6254a0673ff4277 100644
--- a/libc/src/__support/FPUtil/aarch64/FMA.h
+++ b/libc/src/__support/FPUtil/aarch64/FMA.h
@@ -23,7 +23,7 @@
#include "src/__support/CPP/type_traits.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
namespace fputil {
template <typename T>
@@ -45,6 +45,6 @@ LIBC_INLINE cpp::enable_if_t<cpp::is_same_v<T, double>, T> fma(T x, T y, T z) {
}
} // namespace fputil
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC___SUPPORT_FPUTIL_AARCH64_FMA_H
diff --git a/libc/src/__support/FPUtil/aarch64/fenv_darwin_impl.h b/libc/src/__support/FPUtil/aarch64/fenv_darwin_impl.h
index 9243df1e3603563..6a0ac5fef0cac53 100644
--- a/libc/src/__support/FPUtil/aarch64/fenv_darwin_impl.h
+++ b/libc/src/__support/FPUtil/aarch64/fenv_darwin_impl.h
@@ -22,7 +22,7 @@
#include "src/__support/FPUtil/FPBits.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
namespace fputil {
struct FEnv {
@@ -283,6 +283,6 @@ LIBC_INLINE int set_env(const fenv_t *envp) {
}
} // namespace fputil
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC___SUPPORT_FPUTIL_AARCH64_FENV_DARWIN_IMPL_H
diff --git a/libc/src/__support/FPUtil/aarch64/nearest_integer.h b/libc/src/__support/FPUtil/aarch64/nearest_integer.h
index 2ee4e3363a11bf5..ca0763078ff0d40 100644
--- a/libc/src/__support/FPUtil/aarch64/nearest_integer.h
+++ b/libc/src/__support/FPUtil/aarch64/nearest_integer.h
@@ -16,7 +16,7 @@
#error "Invalid include"
#endif
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
namespace fputil {
LIBC_INLINE float nearest_integer(float x) {
@@ -32,6 +32,6 @@ LIBC_INLINE double nearest_integer(double x) {
}
} // namespace fputil
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC___SUPPORT_FPUTIL_AARCH64_NEAREST_INTEGER_H
diff --git a/libc/src/__support/FPUtil/aarch64/sqrt.h b/libc/src/__support/FPUtil/aarch64/sqrt.h
index 6edf2a489064f4f..bad7e316bf370c1 100644
--- a/libc/src/__support/FPUtil/aarch64/sqrt.h
+++ b/libc/src/__support/FPUtil/aarch64/sqrt.h
@@ -18,7 +18,7 @@
#include "src/__support/FPUtil/generic/sqrt.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
namespace fputil {
template <> LIBC_INLINE float sqrt<float>(float x) {
@@ -34,6 +34,6 @@ template <> LIBC_INLINE double sqrt<double>(double x) {
}
} // namespace fputil
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC___SUPPORT_FPUTIL_AARCH64_SQRT_H
diff --git a/libc/src/__support/FPUtil/arm/FEnvImpl.h b/libc/src/__support/FPUtil/arm/FEnvImpl.h
index 5e856075b1d76f8..e2669d13bc2a7c2 100644
--- a/libc/src/__support/FPUtil/arm/FEnvImpl.h
+++ b/libc/src/__support/FPUtil/arm/FEnvImpl.h
@@ -15,7 +15,7 @@
#include <fenv.h>
#include <stdint.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
namespace fputil {
struct FEnv {
@@ -260,6 +260,6 @@ LIBC_INLINE int set_env(const fenv_t *envp) {
}
} // namespace fputil
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC___SUPPORT_FPUTIL_ARM_FENVIMPL_H
diff --git a/libc/src/__support/FPUtil/double_double.h b/libc/src/__support/FPUtil/double_double.h
index fd44d5e95268f60..b9490b52f6b41e0 100644
--- a/libc/src/__support/FPUtil/double_double.h
+++ b/libc/src/__support/FPUtil/double_double.h
@@ -14,9 +14,9 @@
#include "src/__support/macros/properties/cpu_features.h" // LIBC_TARGET_CPU_HAS_FMA
#include "src/__support/number_pair.h"
-namespace __llvm_libc::fputil {
+namespace LIBC_NAMESPACE::fputil {
-using DoubleDouble = __llvm_libc::NumberPair<double>;
+using DoubleDouble = LIBC_NAMESPACE::NumberPair<double>;
// The output of Dekker's FastTwoSum algorithm is correct, i.e.:
// r.hi + r.lo = a + b exactly
@@ -99,6 +99,6 @@ LIBC_INLINE DoubleDouble multiply_add<DoubleDouble>(const DoubleDouble &a,
return add(c, quick_mult(a, b));
}
-} // namespace __llvm_libc::fputil
+} // namespace LIBC_NAMESPACE::fputil
#endif // LLVM_LIBC_SRC___SUPPORT_FPUTIL_DOUBLE_DOUBLE_H
diff --git a/libc/src/__support/FPUtil/dyadic_float.h b/libc/src/__support/FPUtil/dyadic_float.h
index ec000d592b9fecc..2ee97b4ac7f7836 100644
--- a/libc/src/__support/FPUtil/dyadic_float.h
+++ b/libc/src/__support/FPUtil/dyadic_float.h
@@ -18,7 +18,7 @@
#include <stddef.h>
-namespace __llvm_libc::fputil {
+namespace LIBC_NAMESPACE::fputil {
// A generic class to perform comuptations of high precision floating points.
// We store the value in dyadic format, including 3 fields:
@@ -32,7 +32,7 @@ namespace __llvm_libc::fputil {
// To simplify and improve the efficiency, many functions will assume that the
// inputs are normal.
template <size_t Bits> struct DyadicFloat {
- using MantissaType = __llvm_libc::cpp::UInt<Bits>;
+ using MantissaType = LIBC_NAMESPACE::cpp::UInt<Bits>;
bool sign = false;
int exponent = 0;
@@ -306,6 +306,6 @@ constexpr DyadicFloat<Bits> mul_pow_2(DyadicFloat<Bits> a, int32_t pow_2) {
return result;
}
-} // namespace __llvm_libc::fputil
+} // namespace LIBC_NAMESPACE::fputil
#endif // LLVM_LIBC_SRC___SUPPORT_FPUTIL_DYADIC_FLOAT_H
diff --git a/libc/src/__support/FPUtil/except_value_utils.h b/libc/src/__support/FPUtil/except_value_utils.h
index 0229c961f05364f..b51025096e36f62 100644
--- a/libc/src/__support/FPUtil/except_value_utils.h
+++ b/libc/src/__support/FPUtil/except_value_utils.h
@@ -15,7 +15,7 @@
#include "src/__support/CPP/optional.h"
#include "src/__support/macros/optimization.h" // LIBC_UNLIKELY
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
namespace fputil {
@@ -114,6 +114,6 @@ LIBC_INLINE float round_result_slightly_up(float value_rn) {
} // namespace fputil
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC___SUPPORT_FPUTIL_EXCEPT_VALUE_UTILS_H
diff --git a/libc/src/__support/FPUtil/fpbits_str.h b/libc/src/__support/FPUtil/fpbits_str.h
index 46cd102d83f6409..4dec85ac2cc8624 100644
--- a/libc/src/__support/FPUtil/fpbits_str.h
+++ b/libc/src/__support/FPUtil/fpbits_str.h
@@ -16,7 +16,7 @@
#include "src/__support/integer_to_string.h"
#include "src/__support/macros/attributes.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
namespace details {
@@ -70,6 +70,6 @@ template <typename T> LIBC_INLINE cpp::string str(fputil::FPBits<T> x) {
return s;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC___SUPPORT_FPUTIL_FP_BITS_STR_H
diff --git a/libc/src/__support/FPUtil/generic/FMA.h b/libc/src/__support/FPUtil/generic/FMA.h
index ee6659346de4e92..b90b134926bb649 100644
--- a/libc/src/__support/FPUtil/generic/FMA.h
+++ b/libc/src/__support/FPUtil/generic/FMA.h
@@ -19,7 +19,7 @@
#include "src/__support/macros/attributes.h" // LIBC_INLINE
#include "src/__support/macros/optimization.h" // LIBC_UNLIKELY
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
namespace fputil {
namespace generic {
@@ -290,6 +290,6 @@ template <> LIBC_INLINE double fma<double>(double x, double y, double z) {
} // namespace generic
} // namespace fputil
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC___SUPPORT_FPUTIL_GENERIC_FMA_H
diff --git a/libc/src/__support/FPUtil/generic/FMod.h b/libc/src/__support/FPUtil/generic/FMod.h
index 10998443d854b96..48906e545a89ba3 100644
--- a/libc/src/__support/FPUtil/generic/FMod.h
+++ b/libc/src/__support/FPUtil/generic/FMod.h
@@ -17,7 +17,7 @@
#include "src/__support/macros/optimization.h" // LIBC_UNLIKELY
#include "src/math/generic/math_utils.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
namespace fputil {
namespace generic {
@@ -317,6 +317,6 @@ class FMod {
} // namespace generic
} // namespace fputil
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC___SUPPORT_FPUTIL_GENERIC_FMOD_H
diff --git a/libc/src/__support/FPUtil/generic/README.md b/libc/src/__support/FPUtil/generic/README.md
index 9b29e8480e80f28..61278aca949cd61 100644
--- a/libc/src/__support/FPUtil/generic/README.md
+++ b/libc/src/__support/FPUtil/generic/README.md
@@ -1,6 +1,6 @@
This directory contains machine independent implementations of floating point
operations. The implementations are nested in the namespace
-`__llvm_libc::fputil::generic`. This is to facilitate calling these generic
+`LIBC_NAMESPACE::fputil::generic`. This is to facilitate calling these generic
implementations from machine dependent implementations. Consider the example of
the fuse-multiply-add operation (FMA). The C standard library requires three
different flavors, `fma` which operates double precision numbers, `fmaf` which
@@ -12,7 +12,7 @@ we want to be able to call the generic `long double` implementation from the
nested namespace, we will be to call them as follows:
```
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
namespace fputil {
long double fmal(long double x, long double y, long double z) {
@@ -20,7 +20,7 @@ long double fmal(long double x, long double y, long double z) {
}
} // namespace fputil
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
```
Note that actual code might not be as straightforward as above (for example,
diff --git a/libc/src/__support/FPUtil/generic/sqrt.h b/libc/src/__support/FPUtil/generic/sqrt.h
index 35ace1365c442c6..7d446d3a5ffb135 100644
--- a/libc/src/__support/FPUtil/generic/sqrt.h
+++ b/libc/src/__support/FPUtil/generic/sqrt.h
@@ -20,7 +20,7 @@
#include "src/__support/builtin_wrappers.h"
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
namespace fputil {
namespace internal {
@@ -169,6 +169,6 @@ LIBC_INLINE cpp::enable_if_t<cpp::is_floating_point_v<T>, T> sqrt(T x) {
}
} // namespace fputil
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC___SUPPORT_FPUTIL_GENERIC_SQRT_H
diff --git a/libc/src/__support/FPUtil/generic/sqrt_80_bit_long_double.h b/libc/src/__support/FPUtil/generic/sqrt_80_bit_long_double.h
index 2b03273f29c4080..685a90dba7c704b 100644
--- a/libc/src/__support/FPUtil/generic/sqrt_80_bit_long_double.h
+++ b/libc/src/__support/FPUtil/generic/sqrt_80_bit_long_double.h
@@ -17,7 +17,7 @@
#include "src/__support/builtin_wrappers.h"
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
namespace fputil {
namespace x86 {
@@ -140,6 +140,6 @@ LIBC_INLINE long double sqrt(long double x) {
} // namespace x86
} // namespace fputil
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC___SUPPORT_FPUTIL_GENERIC_SQRT_80_BIT_LONG_DOUBLE_H
diff --git a/libc/src/__support/FPUtil/gpu/FMA.h b/libc/src/__support/FPUtil/gpu/FMA.h
index 7990ec01c7e8a31..86bc86031496112 100644
--- a/libc/src/__support/FPUtil/gpu/FMA.h
+++ b/libc/src/__support/FPUtil/gpu/FMA.h
@@ -17,7 +17,7 @@
static_assert(LIBC_HAS_BUILTIN(__builtin_fma), "FMA builtins must be defined");
static_assert(LIBC_HAS_BUILTIN(__builtin_fmaf), "FMA builtins must be defined");
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
namespace fputil {
template <typename T>
@@ -31,6 +31,6 @@ LIBC_INLINE cpp::enable_if_t<cpp::is_same_v<T, double>, T> fma(T x, T y, T z) {
}
} // namespace fputil
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC___SUPPORT_FPUTIL_GPU_FMA_H
diff --git a/libc/src/__support/FPUtil/multiply_add.h b/libc/src/__support/FPUtil/multiply_add.h
index 6670a15eb3357a2..82932da5417c8d9 100644
--- a/libc/src/__support/FPUtil/multiply_add.h
+++ b/libc/src/__support/FPUtil/multiply_add.h
@@ -14,7 +14,7 @@
#include "src/__support/macros/properties/architectures.h"
#include "src/__support/macros/properties/cpu_features.h" // LIBC_TARGET_CPU_HAS_FMA
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
namespace fputil {
// Implement a simple wrapper for multiply-add operation:
@@ -34,14 +34,14 @@ multiply_add(T x, T y, T z) {
}
} // namespace fputil
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#if defined(LIBC_TARGET_CPU_HAS_FMA)
// FMA instructions are available.
#include "FMA.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
namespace fputil {
LIBC_INLINE float multiply_add(float x, float y, float z) {
@@ -53,7 +53,7 @@ LIBC_INLINE double multiply_add(double x, double y, double z) {
}
} // namespace fputil
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LIBC_TARGET_CPU_HAS_FMA
diff --git a/libc/src/__support/FPUtil/nearest_integer.h b/libc/src/__support/FPUtil/nearest_integer.h
index 9ccaf55f25312fa..bc98667c8a3b3a5 100644
--- a/libc/src/__support/FPUtil/nearest_integer.h
+++ b/libc/src/__support/FPUtil/nearest_integer.h
@@ -19,7 +19,7 @@
#include "aarch64/nearest_integer.h"
#else
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
namespace fputil {
// This is a fast implementation for rounding to a nearest integer that.
@@ -60,7 +60,7 @@ LIBC_INLINE double nearest_integer(double x) {
}
} // namespace fputil
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif
#endif // LLVM_LIBC_SRC___SUPPORT_FPUTIL_NEAREST_INTEGER_H
diff --git a/libc/src/__support/FPUtil/riscv32/FEnvImpl.h b/libc/src/__support/FPUtil/riscv32/FEnvImpl.h
index 05b62dd9580c726..4b2d0ea9e6990cd 100644
--- a/libc/src/__support/FPUtil/riscv32/FEnvImpl.h
+++ b/libc/src/__support/FPUtil/riscv32/FEnvImpl.h
@@ -16,7 +16,7 @@
#include <fenv.h>
#include <stdint.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
namespace fputil {
struct FEnv {
@@ -175,6 +175,6 @@ LIBC_INLINE int set_env(const fenv_t *envp) {
}
} // namespace fputil
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC___SUPPORT_FPUTIL_RISCV32_FENVIMPL_H
diff --git a/libc/src/__support/FPUtil/riscv64/FEnvImpl.h b/libc/src/__support/FPUtil/riscv64/FEnvImpl.h
index 2e3c3c76a8d9cf9..db244fc0906c52d 100644
--- a/libc/src/__support/FPUtil/riscv64/FEnvImpl.h
+++ b/libc/src/__support/FPUtil/riscv64/FEnvImpl.h
@@ -16,7 +16,7 @@
#include <fenv.h>
#include <stdint.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
namespace fputil {
struct FEnv {
@@ -175,6 +175,6 @@ LIBC_INLINE int set_env(const fenv_t *envp) {
}
} // namespace fputil
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC___SUPPORT_FPUTIL_RISCV64_FENVIMPL_H
diff --git a/libc/src/__support/FPUtil/riscv64/FMA.h b/libc/src/__support/FPUtil/riscv64/FMA.h
index 88623a6e8601985..770a2342c441e7d 100644
--- a/libc/src/__support/FPUtil/riscv64/FMA.h
+++ b/libc/src/__support/FPUtil/riscv64/FMA.h
@@ -23,7 +23,7 @@
#include "src/__support/CPP/type_traits.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
namespace fputil {
template <typename T>
@@ -45,6 +45,6 @@ LIBC_INLINE cpp::enable_if_t<cpp::is_same_v<T, double>, T> fma(T x, T y, T z) {
}
} // namespace fputil
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC___SUPPORT_FPUTIL_RISCV64_FMA_H
diff --git a/libc/src/__support/FPUtil/riscv64/sqrt.h b/libc/src/__support/FPUtil/riscv64/sqrt.h
index 12c9acdc1669c4b..b34a099486bfc29 100644
--- a/libc/src/__support/FPUtil/riscv64/sqrt.h
+++ b/libc/src/__support/FPUtil/riscv64/sqrt.h
@@ -18,7 +18,7 @@
#include "src/__support/FPUtil/generic/sqrt.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
namespace fputil {
template <> LIBC_INLINE float sqrt<float>(float x) {
@@ -34,6 +34,6 @@ template <> LIBC_INLINE double sqrt<double>(double x) {
}
} // namespace fputil
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC___SUPPORT_FPUTIL_RISCV64_SQRT_H
diff --git a/libc/src/__support/FPUtil/rounding_mode.h b/libc/src/__support/FPUtil/rounding_mode.h
index a11b6b427506009..91a5b9c50e7c2bc 100644
--- a/libc/src/__support/FPUtil/rounding_mode.h
+++ b/libc/src/__support/FPUtil/rounding_mode.h
@@ -13,7 +13,7 @@
#include <fenv.h>
-namespace __llvm_libc::fputil {
+namespace LIBC_NAMESPACE::fputil {
// Quick free-standing test whether fegetround() == FE_UPWARD.
// Using the following observation:
@@ -74,6 +74,6 @@ LIBC_INLINE int quick_get_round() {
return (2.0f + y == 2.0f) ? FE_TONEAREST : FE_UPWARD;
}
-} // namespace __llvm_libc::fputil
+} // namespace LIBC_NAMESPACE::fputil
#endif // LLVM_LIBC_SRC___SUPPORT_FPUTIL_ROUNDING_MODE_H
diff --git a/libc/src/__support/FPUtil/triple_double.h b/libc/src/__support/FPUtil/triple_double.h
index 1f85382cc928d8c..eafa77787865180 100644
--- a/libc/src/__support/FPUtil/triple_double.h
+++ b/libc/src/__support/FPUtil/triple_double.h
@@ -9,7 +9,7 @@
#ifndef LLVM_LIBC_SRC___SUPPORT_FPUTIL_TRIPLE_DOUBLE_H
#define LLVM_LIBC_SRC___SUPPORT_FPUTIL_TRIPLE_DOUBLE_H
-namespace __llvm_libc::fputil {
+namespace LIBC_NAMESPACE::fputil {
struct TripleDouble {
double lo = 0.0;
@@ -17,6 +17,6 @@ struct TripleDouble {
double hi = 0.0;
};
-} // namespace __llvm_libc::fputil
+} // namespace LIBC_NAMESPACE::fputil
#endif // LLVM_LIBC_SRC___SUPPORT_FPUTIL_TRIPLE_DOUBLE_H
diff --git a/libc/src/__support/FPUtil/x86_64/FEnvImpl.h b/libc/src/__support/FPUtil/x86_64/FEnvImpl.h
index 4380efab778c4da..b73b70e907790ff 100644
--- a/libc/src/__support/FPUtil/x86_64/FEnvImpl.h
+++ b/libc/src/__support/FPUtil/x86_64/FEnvImpl.h
@@ -21,7 +21,7 @@
#include "src/__support/macros/sanitizer.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
namespace fputil {
namespace internal {
@@ -642,6 +642,6 @@ LIBC_INLINE int set_env(const fenv_t *envp) {
#endif
} // namespace fputil
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC___SUPPORT_FPUTIL_X86_64_FENVIMPL_H
diff --git a/libc/src/__support/FPUtil/x86_64/FMA.h b/libc/src/__support/FPUtil/x86_64/FMA.h
index b54613a67f4389d..91ef7f96ff4d3e2 100644
--- a/libc/src/__support/FPUtil/x86_64/FMA.h
+++ b/libc/src/__support/FPUtil/x86_64/FMA.h
@@ -24,7 +24,7 @@
#include "src/__support/CPP/type_traits.h"
#include <immintrin.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
namespace fputil {
template <typename T>
@@ -50,6 +50,6 @@ LIBC_INLINE cpp::enable_if_t<cpp::is_same_v<T, double>, T> fma(T x, T y, T z) {
}
} // namespace fputil
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC___SUPPORT_FPUTIL_X86_64_FMA_H
diff --git a/libc/src/__support/FPUtil/x86_64/LongDoubleBits.h b/libc/src/__support/FPUtil/x86_64/LongDoubleBits.h
index 43273ee8864aa02..085c19638122b55 100644
--- a/libc/src/__support/FPUtil/x86_64/LongDoubleBits.h
+++ b/libc/src/__support/FPUtil/x86_64/LongDoubleBits.h
@@ -22,7 +22,7 @@
#include <stdint.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
namespace fputil {
template <unsigned Width> struct Padding;
@@ -233,6 +233,6 @@ static_assert(
"Internal long double representation does not match the machine format.");
} // namespace fputil
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC___SUPPORT_FPUTIL_X86_64_LONGDOUBLEBITS_H
diff --git a/libc/src/__support/FPUtil/x86_64/NextAfterLongDouble.h b/libc/src/__support/FPUtil/x86_64/NextAfterLongDouble.h
index 98e90e044509d3a..52ef2568c1dce06 100644
--- a/libc/src/__support/FPUtil/x86_64/NextAfterLongDouble.h
+++ b/libc/src/__support/FPUtil/x86_64/NextAfterLongDouble.h
@@ -20,7 +20,7 @@
#include <stdint.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
namespace fputil {
LIBC_INLINE long double nextafter(long double from, long double to) {
@@ -117,6 +117,6 @@ LIBC_INLINE long double nextafter(long double from, long double to) {
}
} // namespace fputil
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC___SUPPORT_FPUTIL_X86_64_NEXTAFTERLONGDOUBLE_H
diff --git a/libc/src/__support/FPUtil/x86_64/PolyEval.h b/libc/src/__support/FPUtil/x86_64/PolyEval.h
index 81cf965feedf66e..69fd776320799c7 100644
--- a/libc/src/__support/FPUtil/x86_64/PolyEval.h
+++ b/libc/src/__support/FPUtil/x86_64/PolyEval.h
@@ -18,7 +18,7 @@
#include <immintrin.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
namespace fputil {
// Cubic polynomials:
@@ -80,6 +80,6 @@ LIBC_INLINE double polyeval(double x, double a0, double a1, double a2,
}
} // namespace fputil
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC___SUPPORT_FPUTIL_X86_64_POLYEVAL_H
diff --git a/libc/src/__support/FPUtil/x86_64/nearest_integer.h b/libc/src/__support/FPUtil/x86_64/nearest_integer.h
index a62035433362900..ee31aeefd8489a5 100644
--- a/libc/src/__support/FPUtil/x86_64/nearest_integer.h
+++ b/libc/src/__support/FPUtil/x86_64/nearest_integer.h
@@ -22,7 +22,7 @@
#include <immintrin.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
namespace fputil {
LIBC_INLINE float nearest_integer(float x) {
@@ -40,6 +40,6 @@ LIBC_INLINE double nearest_integer(double x) {
}
} // namespace fputil
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC___SUPPORT_FPUTIL_X86_64_NEAREST_INTEGER_H
diff --git a/libc/src/__support/FPUtil/x86_64/sqrt.h b/libc/src/__support/FPUtil/x86_64/sqrt.h
index 324f5907f9aca97..7edba5528d6a91e 100644
--- a/libc/src/__support/FPUtil/x86_64/sqrt.h
+++ b/libc/src/__support/FPUtil/x86_64/sqrt.h
@@ -18,7 +18,7 @@
#include "src/__support/FPUtil/generic/sqrt.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
namespace fputil {
template <> LIBC_INLINE float sqrt<float>(float x) {
@@ -47,6 +47,6 @@ template <> LIBC_INLINE long double sqrt<long double>(long double x) {
#endif
} // namespace fputil
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC___SUPPORT_FPUTIL_X86_64_SQRT_H
diff --git a/libc/src/__support/File/dir.cpp b/libc/src/__support/File/dir.cpp
index 93b609dc7b755f0..9ff639a777e2347 100644
--- a/libc/src/__support/File/dir.cpp
+++ b/libc/src/__support/File/dir.cpp
@@ -12,17 +12,17 @@
#include "src/__support/error_or.h"
#include "src/errno/libc_errno.h" // For error macros
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
ErrorOr<Dir *> Dir::open(const char *path) {
auto fd = platform_opendir(path);
if (!fd)
- return __llvm_libc::Error(fd.error());
+ return LIBC_NAMESPACE::Error(fd.error());
- __llvm_libc::AllocChecker ac;
+ LIBC_NAMESPACE::AllocChecker ac;
Dir *dir = new (ac) Dir(fd.value());
if (!ac)
- return __llvm_libc::Error(ENOMEM);
+ return LIBC_NAMESPACE::Error(ENOMEM);
return dir;
}
@@ -31,7 +31,7 @@ ErrorOr<struct ::dirent *> Dir::read() {
if (readptr >= fillsize) {
auto readsize = platform_fetch_dirents(fd, buffer);
if (!readsize)
- return __llvm_libc::Error(readsize.error());
+ return LIBC_NAMESPACE::Error(readsize.error());
fillsize = readsize.value();
readptr = 0;
}
@@ -60,4 +60,4 @@ int Dir::close() {
return 0;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/__support/File/dir.h b/libc/src/__support/File/dir.h
index baf57cb52c68c5c..a2f50f88e0e8bef 100644
--- a/libc/src/__support/File/dir.h
+++ b/libc/src/__support/File/dir.h
@@ -16,7 +16,7 @@
#include <dirent.h>
#include <stdlib.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
// Platform specific function which will open the directory |name|
// and return its file descriptor. Upon failure, the error value is returned.
@@ -72,6 +72,6 @@ class Dir {
int getfd() { return fd; }
};
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC___SUPPORT_FILE_DIR_H
diff --git a/libc/src/__support/File/file.cpp b/libc/src/__support/File/file.cpp
index f106d51f897ac40..58097d017a23f3b 100644
--- a/libc/src/__support/File/file.cpp
+++ b/libc/src/__support/File/file.cpp
@@ -15,7 +15,7 @@
#include <stdio.h>
#include <stdlib.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
FileIOResult File::write_unlocked(const void *data, size_t len) {
if (!write_allowed()) {
@@ -433,4 +433,4 @@ File::ModeFlags File::mode_flags(const char *mode) {
return flags;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/__support/File/file.h b/libc/src/__support/File/file.h
index 9e65e2a8ecf6309..2ea3843749ffe43 100644
--- a/libc/src/__support/File/file.h
+++ b/libc/src/__support/File/file.h
@@ -17,7 +17,7 @@
#include <stddef.h>
#include <stdint.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
struct FileIOResult {
size_t value;
@@ -311,6 +311,6 @@ extern File *stdin;
extern File *stdout;
extern File *stderr;
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC___SUPPORT_FILE_FILE_H
diff --git a/libc/src/__support/File/linux/dir.cpp b/libc/src/__support/File/linux/dir.cpp
index b4871031c4d21b3..cae545a9fb8e93e 100644
--- a/libc/src/__support/File/linux/dir.cpp
+++ b/libc/src/__support/File/linux/dir.cpp
@@ -14,46 +14,46 @@
#include <fcntl.h> // For open flags
#include <sys/syscall.h> // For syscall numbers
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
ErrorOr<int> platform_opendir(const char *name) {
int open_flags = O_RDONLY | O_DIRECTORY | O_CLOEXEC;
#ifdef SYS_open
- int fd = __llvm_libc::syscall_impl<int>(SYS_open, name, open_flags);
+ int fd = LIBC_NAMESPACE::syscall_impl<int>(SYS_open, name, open_flags);
#elif defined(SYS_openat)
int fd =
- __llvm_libc::syscall_impl<int>(SYS_openat, AT_FDCWD, name, open_flags);
+ LIBC_NAMESPACE::syscall_impl<int>(SYS_openat, AT_FDCWD, name, open_flags);
#else
#error \
"SYS_open and SYS_openat syscalls not available to perform an open operation."
#endif
if (fd < 0) {
- return __llvm_libc::Error(-fd);
+ return LIBC_NAMESPACE::Error(-fd);
}
return fd;
}
ErrorOr<size_t> platform_fetch_dirents(int fd, cpp::span<uint8_t> buffer) {
#ifdef SYS_getdents64
- long size = __llvm_libc::syscall_impl<long>(SYS_getdents64, fd, buffer.data(),
- buffer.size());
+ long size = LIBC_NAMESPACE::syscall_impl<long>(SYS_getdents64, fd,
+ buffer.data(), buffer.size());
#else
#error "getdents64 syscalls not available to perform a fetch dirents operation."
#endif
if (size < 0) {
- return __llvm_libc::Error(static_cast<int>(-size));
+ return LIBC_NAMESPACE::Error(static_cast<int>(-size));
}
return size;
}
int platform_closedir(int fd) {
- int ret = __llvm_libc::syscall_impl<int>(SYS_close, fd);
+ int ret = LIBC_NAMESPACE::syscall_impl<int>(SYS_close, fd);
if (ret < 0) {
return static_cast<int>(-ret);
}
return 0;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/__support/File/linux/file.cpp b/libc/src/__support/File/linux/file.cpp
index 2d4481bc4b56370..2d4cea5b53c5815 100644
--- a/libc/src/__support/File/linux/file.cpp
+++ b/libc/src/__support/File/linux/file.cpp
@@ -19,11 +19,12 @@
#include <stdio.h>
#include <sys/syscall.h> // For syscall numbers
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
FileIOResult linux_file_write(File *f, const void *data, size_t size) {
auto *lf = reinterpret_cast<LinuxFile *>(f);
- int ret = __llvm_libc::syscall_impl<int>(SYS_write, lf->get_fd(), data, size);
+ int ret =
+ LIBC_NAMESPACE::syscall_impl<int>(SYS_write, lf->get_fd(), data, size);
if (ret < 0) {
return {0, -ret};
}
@@ -32,7 +33,8 @@ FileIOResult linux_file_write(File *f, const void *data, size_t size) {
FileIOResult linux_file_read(File *f, void *buf, size_t size) {
auto *lf = reinterpret_cast<LinuxFile *>(f);
- int ret = __llvm_libc::syscall_impl<int>(SYS_read, lf->get_fd(), buf, size);
+ int ret =
+ LIBC_NAMESPACE::syscall_impl<int>(SYS_read, lf->get_fd(), buf, size);
if (ret < 0) {
return {0, -ret};
}
@@ -49,7 +51,7 @@ ErrorOr<long> linux_file_seek(File *f, long offset, int whence) {
int linux_file_close(File *f) {
auto *lf = reinterpret_cast<LinuxFile *>(f);
- int ret = __llvm_libc::syscall_impl<int>(SYS_close, lf->get_fd());
+ int ret = LIBC_NAMESPACE::syscall_impl<int>(SYS_close, lf->get_fd());
if (ret < 0) {
return -ret;
}
@@ -90,10 +92,10 @@ ErrorOr<File *> openfile(const char *path, const char *mode) {
#ifdef SYS_open
int fd =
- __llvm_libc::syscall_impl<int>(SYS_open, path, open_flags, OPEN_MODE);
+ LIBC_NAMESPACE::syscall_impl<int>(SYS_open, path, open_flags, OPEN_MODE);
#elif defined(SYS_openat)
- int fd = __llvm_libc::syscall_impl<int>(SYS_openat, AT_FDCWD, path,
- open_flags, OPEN_MODE);
+ int fd = LIBC_NAMESPACE::syscall_impl<int>(SYS_openat, AT_FDCWD, path,
+ open_flags, OPEN_MODE);
#else
#error "open and openat syscalls not available."
#endif
@@ -121,4 +123,4 @@ int get_fileno(File *f) {
return lf->get_fd();
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/__support/File/linux/file.h b/libc/src/__support/File/linux/file.h
index 85a941b5d71e263..24e71b133c48130 100644
--- a/libc/src/__support/File/linux/file.h
+++ b/libc/src/__support/File/linux/file.h
@@ -8,7 +8,7 @@
#include "src/__support/File/file.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
FileIOResult linux_file_write(File *, const void *, size_t);
FileIOResult linux_file_read(File *, void *, size_t);
@@ -29,4 +29,4 @@ class LinuxFile : public File {
int get_fd() const { return fd; }
};
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/__support/File/linux/lseekImpl.h b/libc/src/__support/File/linux/lseekImpl.h
index 859faf479e4865a..d1632b703d3bc30 100644
--- a/libc/src/__support/File/linux/lseekImpl.h
+++ b/libc/src/__support/File/linux/lseekImpl.h
@@ -18,13 +18,13 @@
#include <sys/syscall.h> // For syscall numbers.
#include <unistd.h> // For off_t.
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
namespace internal {
LIBC_INLINE ErrorOr<off_t> lseekimpl(int fd, off_t offset, int whence) {
off_t result;
#ifdef SYS_lseek
- int ret = __llvm_libc::syscall_impl<int>(SYS_lseek, fd, offset, whence);
+ int ret = LIBC_NAMESPACE::syscall_impl<int>(SYS_lseek, fd, offset, whence);
result = ret;
#elif defined(SYS_llseek) || defined(SYS__llseek)
static_assert(sizeof(size_t) == 4, "size_t must be 32 bits.");
@@ -34,7 +34,7 @@ LIBC_INLINE ErrorOr<off_t> lseekimpl(int fd, off_t offset, int whence) {
constexpr long LLSEEK_SYSCALL_NO = SYS__llseek;
#endif
off_t offset_64 = offset;
- int ret = __llvm_libc::syscall_impl<int>(
+ int ret = LIBC_NAMESPACE::syscall_impl<int>(
LLSEEK_SYSCALL_NO, fd, offset_64 >> 32, offset_64, &result, whence);
#else
#error "lseek, llseek and _llseek syscalls not available."
@@ -45,6 +45,6 @@ LIBC_INLINE ErrorOr<off_t> lseekimpl(int fd, off_t offset, int whence) {
}
} // namespace internal
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC___SUPPORT_FILE_LINUX_LSEEKIMPL_H
diff --git a/libc/src/__support/File/linux/stderr.cpp b/libc/src/__support/File/linux/stderr.cpp
index a2ab37a51bd2927..65d7865720ffe16 100644
--- a/libc/src/__support/File/linux/stderr.cpp
+++ b/libc/src/__support/File/linux/stderr.cpp
@@ -9,15 +9,15 @@
#include "file.h"
#include <stdio.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
constexpr size_t STDERR_BUFFER_SIZE = 0;
static LinuxFile StdErr(2, nullptr, STDERR_BUFFER_SIZE, _IONBF, false,
File::ModeFlags(File::OpenMode::APPEND));
File *stderr = &StdErr;
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
extern "C" {
-FILE *stderr = reinterpret_cast<FILE *>(&__llvm_libc::StdErr);
+FILE *stderr = reinterpret_cast<FILE *>(&LIBC_NAMESPACE::StdErr);
}
diff --git a/libc/src/__support/File/linux/stdin.cpp b/libc/src/__support/File/linux/stdin.cpp
index e40081cd2a1ed55..c9a363bb7c65ae4 100644
--- a/libc/src/__support/File/linux/stdin.cpp
+++ b/libc/src/__support/File/linux/stdin.cpp
@@ -9,7 +9,7 @@
#include "file.h"
#include <stdio.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
constexpr size_t STDIN_BUFFER_SIZE = 512;
uint8_t stdin_buffer[STDIN_BUFFER_SIZE];
@@ -17,8 +17,8 @@ static LinuxFile StdIn(0, stdin_buffer, STDIN_BUFFER_SIZE, _IOFBF, false,
File::ModeFlags(File::OpenMode::READ));
File *stdin = &StdIn;
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
extern "C" {
-FILE *stdin = reinterpret_cast<FILE *>(&__llvm_libc::StdIn);
+FILE *stdin = reinterpret_cast<FILE *>(&LIBC_NAMESPACE::StdIn);
} // extern "C"
diff --git a/libc/src/__support/File/linux/stdout.cpp b/libc/src/__support/File/linux/stdout.cpp
index cfb6aa4105baafa..314692ecbfe1e4c 100644
--- a/libc/src/__support/File/linux/stdout.cpp
+++ b/libc/src/__support/File/linux/stdout.cpp
@@ -9,7 +9,7 @@
#include "file.h"
#include <stdio.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
constexpr size_t STDOUT_BUFFER_SIZE = 1024;
uint8_t stdout_buffer[STDOUT_BUFFER_SIZE];
@@ -17,8 +17,8 @@ static LinuxFile StdOut(1, stdout_buffer, STDOUT_BUFFER_SIZE, _IOLBF, false,
File::ModeFlags(File::OpenMode::APPEND));
File *stdout = &StdOut;
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
extern "C" {
-FILE *stdout = reinterpret_cast<FILE *>(&__llvm_libc::StdOut);
+FILE *stdout = reinterpret_cast<FILE *>(&LIBC_NAMESPACE::StdOut);
} // extern "C"
diff --git a/libc/src/__support/GPU/amdgpu/utils.h b/libc/src/__support/GPU/amdgpu/utils.h
index f64ed796dc17796..9f0ff0c717a6c9b 100644
--- a/libc/src/__support/GPU/amdgpu/utils.h
+++ b/libc/src/__support/GPU/amdgpu/utils.h
@@ -14,7 +14,7 @@
#include <stdint.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
namespace gpu {
/// The number of threads that execute in lock-step in a lane.
@@ -180,6 +180,6 @@ LIBC_INLINE uint64_t fixed_frequency_clock() {
[[noreturn]] LIBC_INLINE void end_program() { __builtin_amdgcn_endpgm(); }
} // namespace gpu
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif
diff --git a/libc/src/__support/GPU/generic/utils.h b/libc/src/__support/GPU/generic/utils.h
index af347580cca99f6..b701db482bbe98d 100644
--- a/libc/src/__support/GPU/generic/utils.h
+++ b/libc/src/__support/GPU/generic/utils.h
@@ -13,7 +13,7 @@
#include <stdint.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
namespace gpu {
constexpr const uint64_t LANE_SIZE = 1;
@@ -76,6 +76,6 @@ LIBC_INLINE uint64_t fixed_frequency_clock() { return 0; }
[[noreturn]] LIBC_INLINE void end_program() { __builtin_unreachable(); }
} // namespace gpu
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif
diff --git a/libc/src/__support/GPU/nvptx/utils.h b/libc/src/__support/GPU/nvptx/utils.h
index 375af6ef10acc9f..1519f36850a63c5 100644
--- a/libc/src/__support/GPU/nvptx/utils.h
+++ b/libc/src/__support/GPU/nvptx/utils.h
@@ -13,7 +13,7 @@
#include <stdint.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
namespace gpu {
/// The number of threads that execute in lock-step in a warp.
@@ -160,6 +160,6 @@ LIBC_INLINE uint64_t fixed_frequency_clock() {
}
} // namespace gpu
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif
diff --git a/libc/src/__support/GPU/utils.h b/libc/src/__support/GPU/utils.h
index d598996e0aa2512..6505b18dbd331e3 100644
--- a/libc/src/__support/GPU/utils.h
+++ b/libc/src/__support/GPU/utils.h
@@ -19,7 +19,7 @@
#include "generic/utils.h"
#endif
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
namespace gpu {
/// Get the first active thread inside the lane.
LIBC_INLINE uint64_t get_first_lane_id(uint64_t lane_mask) {
@@ -32,6 +32,6 @@ LIBC_INLINE bool is_first_lane(uint64_t lane_mask) {
}
} // namespace gpu
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC___SUPPORT_OSUTIL_IO_H
diff --git a/libc/src/__support/OSUtil/darwin/arm/syscall.h b/libc/src/__support/OSUtil/darwin/arm/syscall.h
index 807ede0e6f98256..ce10c2a7a307937 100644
--- a/libc/src/__support/OSUtil/darwin/arm/syscall.h
+++ b/libc/src/__support/OSUtil/darwin/arm/syscall.h
@@ -44,7 +44,7 @@
#define SYSCALL_INSTR(input_constraint) \
LIBC_INLINE_ASM("svc 0x80" : "=r"(x0) : input_constraint : "memory", "cc")
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LIBC_INLINE long syscall_impl(long number) {
REGISTER_DECL_0;
@@ -91,7 +91,7 @@ LIBC_INLINE long syscall_impl(long number, long arg1, long arg2, long arg3,
return x0;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#undef REGISTER_DECL_0
#undef REGISTER_DECL_1
diff --git a/libc/src/__support/OSUtil/darwin/io.h b/libc/src/__support/OSUtil/darwin/io.h
index d29c539048a40e6..9bbc8e1ded00002 100644
--- a/libc/src/__support/OSUtil/darwin/io.h
+++ b/libc/src/__support/OSUtil/darwin/io.h
@@ -12,13 +12,13 @@
#include "src/__support/CPP/string_view.h"
#include "syscall.h" // For internal syscall function.
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LIBC_INLINE void write_to_stderr(cpp::string_view msg) {
- __llvm_libc::syscall_impl(4 /*SYS_write*/, 2 /* stderr */,
- reinterpret_cast<long>(msg.data()), msg.size());
+ LIBC_NAMESPACE::syscall_impl(4 /*SYS_write*/, 2 /* stderr */,
+ reinterpret_cast<long>(msg.data()), msg.size());
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC___SUPPORT_OSUTIL_DARWIN_IO_H
diff --git a/libc/src/__support/OSUtil/darwin/quick_exit.h b/libc/src/__support/OSUtil/darwin/quick_exit.h
index 51b82d945372c71..71647f50def5e29 100644
--- a/libc/src/__support/OSUtil/darwin/quick_exit.h
+++ b/libc/src/__support/OSUtil/darwin/quick_exit.h
@@ -13,14 +13,14 @@
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LIBC_INLINE void quick_exit(int status) {
for (;;) {
- __llvm_libc::syscall_impl<long>(1 /* SYS_exit */, status);
+ LIBC_NAMESPACE::syscall_impl<long>(1 /* SYS_exit */, status);
}
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC___SUPPORT_OSUTIL_DARWIN_QUICK_EXIT_H
diff --git a/libc/src/__support/OSUtil/darwin/syscall.h b/libc/src/__support/OSUtil/darwin/syscall.h
index b051745a1e3719b..93b492e14ddfce3 100644
--- a/libc/src/__support/OSUtil/darwin/syscall.h
+++ b/libc/src/__support/OSUtil/darwin/syscall.h
@@ -19,7 +19,7 @@
#error "Unsupported architecture"
#endif
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
template <typename R, typename... Ts>
LIBC_INLINE R syscall_impl(long __number, Ts... ts) {
@@ -27,6 +27,6 @@ LIBC_INLINE R syscall_impl(long __number, Ts... ts) {
return cpp::bit_or_static_cast<R>(syscall_impl(__number, (long)ts...));
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC___SUPPORT_OSUTIL_DARWIN_SYSCALL_H
diff --git a/libc/src/__support/OSUtil/fuchsia/io.h b/libc/src/__support/OSUtil/fuchsia/io.h
index fc794b859316296..9a5e00beaa316ca 100644
--- a/libc/src/__support/OSUtil/fuchsia/io.h
+++ b/libc/src/__support/OSUtil/fuchsia/io.h
@@ -17,12 +17,12 @@
#include <zircon/sanitizer.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LIBC_INLINE void write_to_stderr(cpp::string_view msg) {
__sanitizer_log_write(msg.data(), msg.size());
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC___SUPPORT_OSUTIL_FUCHSIA_IO_H
diff --git a/libc/src/__support/OSUtil/gpu/io.cpp b/libc/src/__support/OSUtil/gpu/io.cpp
index 09b54526ab95dfe..fec4d9f7b35d27e 100644
--- a/libc/src/__support/OSUtil/gpu/io.cpp
+++ b/libc/src/__support/OSUtil/gpu/io.cpp
@@ -11,7 +11,7 @@
#include "src/__support/CPP/string_view.h"
#include "src/__support/RPC/rpc_client.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
void write_to_stderr(cpp::string_view msg) {
rpc::Client::Port port = rpc::client.open<RPC_WRITE_TO_STDERR>();
@@ -20,4 +20,4 @@ void write_to_stderr(cpp::string_view msg) {
port.close();
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/__support/OSUtil/gpu/io.h b/libc/src/__support/OSUtil/gpu/io.h
index be5daaec55c6bb1..d6c89cf45e3a55f 100644
--- a/libc/src/__support/OSUtil/gpu/io.h
+++ b/libc/src/__support/OSUtil/gpu/io.h
@@ -12,10 +12,10 @@
#include "src/__support/CPP/string_view.h"
#include "src/__support/macros/attributes.h" // LIBC_INLINE
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
void write_to_stderr(cpp::string_view msg);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC___SUPPORT_OSUTIL_LINUX_IO_H
diff --git a/libc/src/__support/OSUtil/gpu/quick_exit.cpp b/libc/src/__support/OSUtil/gpu/quick_exit.cpp
index a316e2731a01f0c..1a03be0ace6728e 100644
--- a/libc/src/__support/OSUtil/gpu/quick_exit.cpp
+++ b/libc/src/__support/OSUtil/gpu/quick_exit.cpp
@@ -14,7 +14,7 @@
#include "src/__support/RPC/rpc_client.h"
#include "src/__support/macros/properties/architectures.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
void quick_exit(int status) {
// We want to first make sure the server is listening before we exit.
@@ -28,6 +28,6 @@ void quick_exit(int status) {
gpu::end_program();
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC___SUPPORT_OSUTIL_GPU_QUICK_EXIT_H
diff --git a/libc/src/__support/OSUtil/gpu/quick_exit.h b/libc/src/__support/OSUtil/gpu/quick_exit.h
index c4d67e56f32bb2b..b51385defbc0dee 100644
--- a/libc/src/__support/OSUtil/gpu/quick_exit.h
+++ b/libc/src/__support/OSUtil/gpu/quick_exit.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC___SUPPORT_OSUTIL_GPU_QUICK_EXIT_H
#define LLVM_LIBC_SRC___SUPPORT_OSUTIL_GPU_QUICK_EXIT_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
void quick_exit(int status);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC___SUPPORT_OSUTIL_GPU_QUICK_EXIT_H
diff --git a/libc/src/__support/OSUtil/linux/aarch64/syscall.h b/libc/src/__support/OSUtil/linux/aarch64/syscall.h
index 1d0ed9acedea02f..f6c9a741de3ac12 100644
--- a/libc/src/__support/OSUtil/linux/aarch64/syscall.h
+++ b/libc/src/__support/OSUtil/linux/aarch64/syscall.h
@@ -42,7 +42,7 @@
#define SYSCALL_INSTR(input_constraint) \
LIBC_INLINE_ASM("svc 0" : "=r"(x0) : input_constraint : "memory", "cc")
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LIBC_INLINE long syscall_impl(long number) {
REGISTER_DECL_0;
@@ -89,7 +89,7 @@ LIBC_INLINE long syscall_impl(long number, long arg1, long arg2, long arg3,
return x0;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#undef REGISTER_DECL_0
#undef REGISTER_DECL_1
diff --git a/libc/src/__support/OSUtil/linux/arm/syscall.h b/libc/src/__support/OSUtil/linux/arm/syscall.h
index 351a1c05aae1901..af100747832750c 100644
--- a/libc/src/__support/OSUtil/linux/arm/syscall.h
+++ b/libc/src/__support/OSUtil/linux/arm/syscall.h
@@ -48,7 +48,7 @@
#define SYSCALL_INSTR(input_constraint) \
LIBC_INLINE_ASM("svc 0" : "=r"(r0) : input_constraint : "memory", "cc")
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LIBC_INLINE long syscall_impl(long number) {
REGISTER_DECL_0;
@@ -95,7 +95,7 @@ LIBC_INLINE long syscall_impl(long number, long arg1, long arg2, long arg3,
return r0;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#undef REGISTER_DECL_0
#undef REGISTER_DECL_1
diff --git a/libc/src/__support/OSUtil/linux/io.h b/libc/src/__support/OSUtil/linux/io.h
index b20be4511378674..fd5d2e1b898b249 100644
--- a/libc/src/__support/OSUtil/linux/io.h
+++ b/libc/src/__support/OSUtil/linux/io.h
@@ -14,13 +14,13 @@
#include <sys/syscall.h> // For syscall numbers.
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LIBC_INLINE void write_to_stderr(cpp::string_view msg) {
- __llvm_libc::syscall_impl<long>(SYS_write, 2 /* stderr */, msg.data(),
- msg.size());
+ LIBC_NAMESPACE::syscall_impl<long>(SYS_write, 2 /* stderr */, msg.data(),
+ msg.size());
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC___SUPPORT_OSUTIL_LINUX_IO_H
diff --git a/libc/src/__support/OSUtil/linux/quick_exit.h b/libc/src/__support/OSUtil/linux/quick_exit.h
index 2e2d86d634d064d..c461d5f8b8fcb6c 100644
--- a/libc/src/__support/OSUtil/linux/quick_exit.h
+++ b/libc/src/__support/OSUtil/linux/quick_exit.h
@@ -15,15 +15,15 @@
#include <sys/syscall.h> // For syscall numbers.
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LIBC_INLINE void quick_exit(int status) {
for (;;) {
- __llvm_libc::syscall_impl<long>(SYS_exit_group, status);
- __llvm_libc::syscall_impl<long>(SYS_exit, status);
+ LIBC_NAMESPACE::syscall_impl<long>(SYS_exit_group, status);
+ LIBC_NAMESPACE::syscall_impl<long>(SYS_exit, status);
}
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC___SUPPORT_OSUTIL_LINUX_QUICK_EXIT_H
diff --git a/libc/src/__support/OSUtil/linux/riscv64/syscall.h b/libc/src/__support/OSUtil/linux/riscv64/syscall.h
index e307bcb8f1dbd64..53ee21d5cbdf103 100644
--- a/libc/src/__support/OSUtil/linux/riscv64/syscall.h
+++ b/libc/src/__support/OSUtil/linux/riscv64/syscall.h
@@ -42,7 +42,7 @@
#define SYSCALL_INSTR(input_constraint) \
LIBC_INLINE_ASM("ecall\n\t" : "=r"(a0) : input_constraint : "memory")
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LIBC_INLINE long syscall_impl(long number) {
REGISTER_DECL_0;
@@ -89,7 +89,7 @@ LIBC_INLINE long syscall_impl(long number, long arg1, long arg2, long arg3,
return a0;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#undef REGISTER_DECL_0
#undef REGISTER_DECL_1
diff --git a/libc/src/__support/OSUtil/linux/syscall.h b/libc/src/__support/OSUtil/linux/syscall.h
index 8a1fbb34189b8f7..6c9559bb12ee4ea 100644
--- a/libc/src/__support/OSUtil/linux/syscall.h
+++ b/libc/src/__support/OSUtil/linux/syscall.h
@@ -23,7 +23,7 @@
#include "riscv64/syscall.h"
#endif
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
template <typename R, typename... Ts>
LIBC_INLINE R syscall_impl(long __number, Ts... ts) {
@@ -31,6 +31,6 @@ LIBC_INLINE R syscall_impl(long __number, Ts... ts) {
return cpp::bit_or_static_cast<R>(syscall_impl(__number, (long)ts...));
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC___SUPPORT_OSUTIL_LINUX_SYSCALL_H
diff --git a/libc/src/__support/OSUtil/linux/x86_64/syscall.h b/libc/src/__support/OSUtil/linux/x86_64/syscall.h
index bf2d2cd7351dd0b..986db9372ad394c 100644
--- a/libc/src/__support/OSUtil/linux/x86_64/syscall.h
+++ b/libc/src/__support/OSUtil/linux/x86_64/syscall.h
@@ -13,7 +13,7 @@
#define SYSCALL_CLOBBER_LIST "rcx", "r11", "memory"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LIBC_INLINE long syscall_impl(long __number) {
long retcode;
@@ -93,6 +93,6 @@ LIBC_INLINE long syscall_impl(long __number, long __arg1, long __arg2,
}
#undef SYSCALL_CLOBBER_LIST
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC___SUPPORT_OSUTIL_LINUX_X86_64_SYSCALL_H
diff --git a/libc/src/__support/RPC/rpc.h b/libc/src/__support/RPC/rpc.h
index 7cece9615f607a8..7f227493b87b213 100644
--- a/libc/src/__support/RPC/rpc.h
+++ b/libc/src/__support/RPC/rpc.h
@@ -28,7 +28,7 @@
#include <stdint.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
namespace rpc {
/// A fixed size channel used to communicate between the RPC client and server.
@@ -599,6 +599,6 @@ LIBC_INLINE typename Server<lane_size>::Port Server<lane_size>::open() {
}
} // namespace rpc
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif
diff --git a/libc/src/__support/RPC/rpc_client.cpp b/libc/src/__support/RPC/rpc_client.cpp
index b25ff56410d7f5b..e223caf2a16a8e4 100644
--- a/libc/src/__support/RPC/rpc_client.cpp
+++ b/libc/src/__support/RPC/rpc_client.cpp
@@ -9,7 +9,7 @@
#include "rpc_client.h"
#include "rpc.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
namespace rpc {
/// The libc client instance used to communicate with the server.
@@ -18,8 +18,8 @@ Client client;
/// Externally visible symbol to signify the usage of an RPC client to
/// whomever needs to run the server as well as provide a way to initialize
/// the client with a copy..
-extern "C" [[gnu::visibility("protected")]] void *__llvm_libc_rpc_client =
+extern "C" [[gnu::visibility("protected")]] void *LIBC_NAMESPACE_rpc_client =
&client;
} // namespace rpc
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/__support/RPC/rpc_client.h b/libc/src/__support/RPC/rpc_client.h
index 3b36c4fffc9e849..571d7cce2a80398 100644
--- a/libc/src/__support/RPC/rpc_client.h
+++ b/libc/src/__support/RPC/rpc_client.h
@@ -13,13 +13,13 @@
#include "llvm-libc-types/rpc_opcodes_t.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
namespace rpc {
/// The libc client instance used to communicate with the server.
extern Client client;
} // namespace rpc
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif
diff --git a/libc/src/__support/RPC/rpc_util.h b/libc/src/__support/RPC/rpc_util.h
index 999fd902adf622e..46ca841c49199bc 100644
--- a/libc/src/__support/RPC/rpc_util.h
+++ b/libc/src/__support/RPC/rpc_util.h
@@ -14,7 +14,7 @@
#include "src/__support/macros/attributes.h" // LIBC_INLINE
#include "src/__support/macros/properties/architectures.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
namespace rpc {
/// Suspend the thread briefly to assist the thread scheduler during busy loops.
@@ -65,6 +65,6 @@ template <typename T, typename U> LIBC_INLINE T *advance(T *ptr, U bytes) {
}
} // namespace rpc
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif
diff --git a/libc/src/__support/StringUtil/error_to_string.cpp b/libc/src/__support/StringUtil/error_to_string.cpp
index 692f88455582709..3ea60a6740b30a6 100644
--- a/libc/src/__support/StringUtil/error_to_string.cpp
+++ b/libc/src/__support/StringUtil/error_to_string.cpp
@@ -18,7 +18,7 @@
#include <stddef.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
namespace internal {
constexpr size_t max_buff_size() {
@@ -74,4 +74,4 @@ cpp::string_view get_error_string(int err_num, cpp::span<char> buffer) {
return internal::build_error_string(err_num, buffer);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/__support/StringUtil/error_to_string.h b/libc/src/__support/StringUtil/error_to_string.h
index 7981aa9b9a96ec4..43cf785c30b036f 100644
--- a/libc/src/__support/StringUtil/error_to_string.h
+++ b/libc/src/__support/StringUtil/error_to_string.h
@@ -12,12 +12,12 @@
#include "src/__support/CPP/span.h"
#include "src/__support/CPP/string_view.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
cpp::string_view get_error_string(int err_num);
cpp::string_view get_error_string(int err_num, cpp::span<char> buffer);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC___SUPPORT_STRINGUTIL_ERROR_TO_STRING_H
diff --git a/libc/src/__support/StringUtil/message_mapper.h b/libc/src/__support/StringUtil/message_mapper.h
index a190037462f1190..c93a57c6256784d 100644
--- a/libc/src/__support/StringUtil/message_mapper.h
+++ b/libc/src/__support/StringUtil/message_mapper.h
@@ -14,7 +14,7 @@
#include "src/__support/CPP/string_view.h"
#include <stddef.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
struct MsgMapping {
int num;
@@ -98,6 +98,6 @@ constexpr MsgTable<N1 + N2> operator+(const MsgTable<N1> &t1,
return res;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC___SUPPORT_STRING_UTIL_MESSAGE_MAPPER_H
diff --git a/libc/src/__support/StringUtil/signal_to_string.cpp b/libc/src/__support/StringUtil/signal_to_string.cpp
index 78b4d4dd853682d..1fea53a32aa2188 100644
--- a/libc/src/__support/StringUtil/signal_to_string.cpp
+++ b/libc/src/__support/StringUtil/signal_to_string.cpp
@@ -19,7 +19,7 @@
#include <signal.h>
#include <stddef.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
namespace internal {
constexpr size_t max_buff_size() {
@@ -77,4 +77,4 @@ cpp::string_view get_signal_string(int sig_num, cpp::span<char> buffer) {
return internal::build_signal_string(sig_num, buffer);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/__support/StringUtil/signal_to_string.h b/libc/src/__support/StringUtil/signal_to_string.h
index 11ec33a0a07c642..e27324e970c0667 100644
--- a/libc/src/__support/StringUtil/signal_to_string.h
+++ b/libc/src/__support/StringUtil/signal_to_string.h
@@ -13,12 +13,12 @@
#include "src/__support/CPP/span.h"
#include "src/__support/CPP/string_view.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
cpp::string_view get_signal_string(int err_num);
cpp::string_view get_signal_string(int err_num, cpp::span<char> buffer);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC___SUPPORT_STRINGUTIL_SIGNAL_TO_STRING_H
diff --git a/libc/src/__support/StringUtil/tables/linux_extension_errors.h b/libc/src/__support/StringUtil/tables/linux_extension_errors.h
index 5440c8e37154014..4964fa47efd531e 100644
--- a/libc/src/__support/StringUtil/tables/linux_extension_errors.h
+++ b/libc/src/__support/StringUtil/tables/linux_extension_errors.h
@@ -13,7 +13,7 @@
#include <errno.h> // For error macros
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
constexpr MsgTable<52> LINUX_ERRORS = {
MsgMapping(ENOTBLK, "Block device required"),
@@ -70,6 +70,6 @@ constexpr MsgTable<52> LINUX_ERRORS = {
MsgMapping(EHWPOISON, "Memory page has hardware error"),
};
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC___SUPPORT_STRING_UTIL_TABLES_LINUX_EXTENSION_ERRORS_H
diff --git a/libc/src/__support/StringUtil/tables/linux_extension_signals.h b/libc/src/__support/StringUtil/tables/linux_extension_signals.h
index fd17881d4f780c9..633d0e2ed53827e 100644
--- a/libc/src/__support/StringUtil/tables/linux_extension_signals.h
+++ b/libc/src/__support/StringUtil/tables/linux_extension_signals.h
@@ -13,7 +13,7 @@
#include <signal.h> // For signal numbers
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
// The array being larger than necessary isn't a problem. The MsgMappings will
// be set to their default state which maps 0 to an empty string. This will get
@@ -28,6 +28,6 @@ LIBC_INLINE_VAR constexpr const MsgTable<3> LINUX_SIGNALS = {
#endif
};
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC___SUPPORT_STRING_UTIL_TABLES_LINUX_EXTENSION_SIGNALS_H
diff --git a/libc/src/__support/StringUtil/tables/linux_platform_errors.h b/libc/src/__support/StringUtil/tables/linux_platform_errors.h
index 3139a1f1c5b38ae..a9ae2e8100a1b38 100644
--- a/libc/src/__support/StringUtil/tables/linux_platform_errors.h
+++ b/libc/src/__support/StringUtil/tables/linux_platform_errors.h
@@ -13,11 +13,11 @@
#include "posix_errors.h"
#include "stdc_errors.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LIBC_INLINE_VAR constexpr auto PLATFORM_ERRORS =
STDC_ERRORS + POSIX_ERRORS + LINUX_ERRORS;
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC___SUPPORT_STRING_UTIL_TABLES_LINUX_PLATFORM_ERRORS_H
diff --git a/libc/src/__support/StringUtil/tables/linux_platform_signals.h b/libc/src/__support/StringUtil/tables/linux_platform_signals.h
index b08517426445ad9..1daaa9cc62852e7 100644
--- a/libc/src/__support/StringUtil/tables/linux_platform_signals.h
+++ b/libc/src/__support/StringUtil/tables/linux_platform_signals.h
@@ -13,11 +13,11 @@
#include "posix_signals.h"
#include "stdc_signals.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LIBC_INLINE_VAR constexpr auto PLATFORM_SIGNALS =
STDC_SIGNALS + POSIX_SIGNALS + LINUX_SIGNALS;
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC___SUPPORT_STRING_UTIL_TABLES_LINUX_PLATFORM_SIGNALS_H
diff --git a/libc/src/__support/StringUtil/tables/minimal_platform_errors.h b/libc/src/__support/StringUtil/tables/minimal_platform_errors.h
index fa164db91ceed06..1cfd9e2e944d467 100644
--- a/libc/src/__support/StringUtil/tables/minimal_platform_errors.h
+++ b/libc/src/__support/StringUtil/tables/minimal_platform_errors.h
@@ -11,10 +11,10 @@
#include "stdc_errors.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LIBC_INLINE_VAR constexpr auto PLATFORM_ERRORS = STDC_ERRORS;
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC___SUPPORT_STRING_UTIL_TABLES_MINIMAL_PLATFORM_ERRORS_H
diff --git a/libc/src/__support/StringUtil/tables/minimal_platform_signals.h b/libc/src/__support/StringUtil/tables/minimal_platform_signals.h
index a6d59e5de45f1d6..7fcf91bfee85257 100644
--- a/libc/src/__support/StringUtil/tables/minimal_platform_signals.h
+++ b/libc/src/__support/StringUtil/tables/minimal_platform_signals.h
@@ -11,10 +11,10 @@
#include "stdc_signals.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LIBC_INLINE_VAR constexpr auto PLATFORM_SIGNALS = STDC_SIGNALS;
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC___SUPPORT_STRING_UTIL_TABLES_MINIMAL_PLATFORM_SIGNALS_H
diff --git a/libc/src/__support/StringUtil/tables/posix_errors.h b/libc/src/__support/StringUtil/tables/posix_errors.h
index 59ed279c47810a2..3ade7aaab4f0def 100644
--- a/libc/src/__support/StringUtil/tables/posix_errors.h
+++ b/libc/src/__support/StringUtil/tables/posix_errors.h
@@ -13,7 +13,7 @@
#include <errno.h> // For error macros
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LIBC_INLINE_VAR constexpr MsgTable<76> POSIX_ERRORS = {
MsgMapping(EPERM, "Operation not permitted"),
@@ -94,6 +94,6 @@ LIBC_INLINE_VAR constexpr MsgTable<76> POSIX_ERRORS = {
MsgMapping(ENOTRECOVERABLE, "State not recoverable"),
};
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC___SUPPORT_STRING_UTIL_TABLES_POSIX_ERRORS_H
diff --git a/libc/src/__support/StringUtil/tables/posix_signals.h b/libc/src/__support/StringUtil/tables/posix_signals.h
index beaa18bff87f368..2fba2d963f4b9b4 100644
--- a/libc/src/__support/StringUtil/tables/posix_signals.h
+++ b/libc/src/__support/StringUtil/tables/posix_signals.h
@@ -14,7 +14,7 @@
#include <signal.h> // For signal numbers
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LIBC_INLINE_VAR constexpr MsgTable<22> POSIX_SIGNALS = {
MsgMapping(SIGHUP, "Hangup"),
@@ -41,6 +41,6 @@ LIBC_INLINE_VAR constexpr MsgTable<22> POSIX_SIGNALS = {
MsgMapping(SIGSYS, "Bad system call"),
};
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC___SUPPORT_STRING_UTIL_TABLES_POSIX_SIGNALS_H
diff --git a/libc/src/__support/StringUtil/tables/signal_table.h b/libc/src/__support/StringUtil/tables/signal_table.h
index 87b5abf5e097731..5035c54770c5c79 100644
--- a/libc/src/__support/StringUtil/tables/signal_table.h
+++ b/libc/src/__support/StringUtil/tables/signal_table.h
@@ -24,7 +24,7 @@
#include "linux_extension_signals.h"
#endif
-namespace __llvm_libc::internal {
+namespace LIBC_NAMESPACE::internal {
LIBC_INLINE_VAR constexpr auto PLATFORM_SIGNALS = []() {
if constexpr (USE_LINUX_PLATFORM_SIGNALS) {
@@ -34,6 +34,6 @@ LIBC_INLINE_VAR constexpr auto PLATFORM_SIGNALS = []() {
}
}();
-} // namespace __llvm_libc::internal
+} // namespace LIBC_NAMESPACE::internal
#endif // LLVM_LIBC_SRC___SUPPORT_STRING_UTIL_TABLES_SIGNAL_TABLE_H
diff --git a/libc/src/__support/StringUtil/tables/stdc_errors.h b/libc/src/__support/StringUtil/tables/stdc_errors.h
index 054c4ffdc7addea..f0fc78710b18a6b 100644
--- a/libc/src/__support/StringUtil/tables/stdc_errors.h
+++ b/libc/src/__support/StringUtil/tables/stdc_errors.h
@@ -13,7 +13,7 @@
#include <errno.h> // For error macros
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LIBC_INLINE_VAR constexpr const MsgTable<4> STDC_ERRORS = {
MsgMapping(0, "Success"),
@@ -22,6 +22,6 @@ LIBC_INLINE_VAR constexpr const MsgTable<4> STDC_ERRORS = {
MsgMapping(EILSEQ, "Invalid or incomplete multibyte or wide character"),
};
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC___SUPPORT_STRING_UTIL_TABLES_LINUX_ERRORS_H
diff --git a/libc/src/__support/StringUtil/tables/stdc_signals.h b/libc/src/__support/StringUtil/tables/stdc_signals.h
index 0bc288db3c449a7..773f182140ef933 100644
--- a/libc/src/__support/StringUtil/tables/stdc_signals.h
+++ b/libc/src/__support/StringUtil/tables/stdc_signals.h
@@ -13,7 +13,7 @@
#include "src/__support/StringUtil/message_mapper.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LIBC_INLINE_VAR constexpr const MsgTable<6> STDC_SIGNALS = {
MsgMapping(SIGINT, "Interrupt"),
@@ -24,6 +24,6 @@ LIBC_INLINE_VAR constexpr const MsgTable<6> STDC_SIGNALS = {
MsgMapping(SIGTERM, "Terminated"),
};
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC___SUPPORT_STRING_UTIL_TABLES_LINUX_SIGNALS_H
diff --git a/libc/src/__support/UInt.h b/libc/src/__support/UInt.h
index 6310c8925c40d09..9aeb239b8328bea 100644
--- a/libc/src/__support/UInt.h
+++ b/libc/src/__support/UInt.h
@@ -21,7 +21,7 @@
#include <stddef.h> // For size_t
#include <stdint.h>
-namespace __llvm_libc::cpp {
+namespace LIBC_NAMESPACE::cpp {
template <size_t Bits, bool Signed> struct BigInt {
@@ -927,6 +927,6 @@ struct make_signed<UInt<Bits>> : type_identity<Int<Bits>> {
"Number of bits in Int should be a multiple of 64.");
};
-} // namespace __llvm_libc::cpp
+} // namespace LIBC_NAMESPACE::cpp
#endif // LLVM_LIBC_SRC___SUPPORT_UINT_H
diff --git a/libc/src/__support/UInt128.h b/libc/src/__support/UInt128.h
index 2df4e5263bc1637..2f688f1f31cb56f 100644
--- a/libc/src/__support/UInt128.h
+++ b/libc/src/__support/UInt128.h
@@ -12,8 +12,8 @@
#include "UInt.h"
#if !defined(__SIZEOF_INT128__)
-using UInt128 = __llvm_libc::cpp::UInt<128>;
-using Int128 = __llvm_libc::cpp::Int<128>;
+using UInt128 = LIBC_NAMESPACE::cpp::UInt<128>;
+using Int128 = LIBC_NAMESPACE::cpp::Int<128>;
#else
using UInt128 = __uint128_t;
using Int128 = __int128_t;
diff --git a/libc/src/__support/arg_list.h b/libc/src/__support/arg_list.h
index e4154154924166e..9de17651142f492 100644
--- a/libc/src/__support/arg_list.h
+++ b/libc/src/__support/arg_list.h
@@ -14,7 +14,7 @@
#include <stdarg.h>
#include <stddef.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
namespace internal {
class ArgList {
@@ -61,6 +61,6 @@ class MockArgList {
};
} // namespace internal
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC___SUPPORT_ARG_LIST_H
diff --git a/libc/src/__support/blockstore.h b/libc/src/__support/blockstore.h
index cdef80b1675b86e..d78e4be5fa9ca42 100644
--- a/libc/src/__support/blockstore.h
+++ b/libc/src/__support/blockstore.h
@@ -15,7 +15,7 @@
#include <stddef.h>
#include <stdint.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
namespace cpp {
// The difference between BlockStore a traditional vector types is that,
@@ -204,6 +204,6 @@ template <typename T, size_t BLOCK_SIZE>
using ReverseOrderBlockStore = BlockStore<T, BLOCK_SIZE, true>;
} // namespace cpp
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC___SUPPORT_BLOCKSTORE_H
diff --git a/libc/src/__support/builtin_wrappers.h b/libc/src/__support/builtin_wrappers.h
index 1da9cee4ad9f19c..bd307a3544cd930 100644
--- a/libc/src/__support/builtin_wrappers.h
+++ b/libc/src/__support/builtin_wrappers.h
@@ -15,7 +15,7 @@
#include "src/__support/macros/attributes.h" // LIBC_INLINE
#include "src/__support/macros/config.h" // LIBC_HAS_BUILTIN
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
// The following overloads are matched based on what is accepted by
// __builtin_clz/ctz* rather than using the exactly-sized aliases from stdint.h.
@@ -221,6 +221,6 @@ sub_with_borrow<unsigned long long>(unsigned long long a, unsigned long long b,
#endif // LIBC_HAS_BUILTIN(__builtin_subc)
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC___SUPPORT_BUILTIN_WRAPPERS_H
diff --git a/libc/src/__support/c_string.h b/libc/src/__support/c_string.h
index 580a685849a6dc6..9049311a5778930 100644
--- a/libc/src/__support/c_string.h
+++ b/libc/src/__support/c_string.h
@@ -12,7 +12,7 @@
#include "src/__support/CPP/string.h"
#include "src/__support/macros/attributes.h" // for LIBC_INLINE
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
// The CString class is a companion to the cpp::string class. Its use case is as
// a return value for a function that in C would return a char* and a flag for
@@ -31,6 +31,6 @@ class CString {
LIBC_INLINE operator const char *() const { return str.c_str(); }
};
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC___SUPPORT_C_STRING_H
diff --git a/libc/src/__support/char_vector.h b/libc/src/__support/char_vector.h
index 49609fd6a2b4a0f..ed55c48cc94cc9b 100644
--- a/libc/src/__support/char_vector.h
+++ b/libc/src/__support/char_vector.h
@@ -14,7 +14,7 @@
#include <stddef.h>
#include <stdlib.h> // For allocation.
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
// This is very simple alternate of the std::string class. There is no
// bounds check performed in any of the methods. The callers are expected to
@@ -73,6 +73,6 @@ class CharVector {
LIBC_INLINE size_t length() { return index; }
};
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC___SUPPORT_CHARVECTOR_H
diff --git a/libc/src/__support/common.h b/libc/src/__support/common.h
index 2b253fd567c19dd..fe7b7c8b7624c90 100644
--- a/libc/src/__support/common.h
+++ b/libc/src/__support/common.h
@@ -23,9 +23,9 @@
// MacOS needs to be excluded because it does not support aliasing.
#if defined(LIBC_COPT_PUBLIC_PACKAGING) && (!defined(__APPLE__))
#define LLVM_LIBC_FUNCTION_IMPL(type, name, arglist) \
- LLVM_LIBC_FUNCTION_ATTR decltype(__llvm_libc::name) \
+ LLVM_LIBC_FUNCTION_ATTR decltype(LIBC_NAMESPACE::name) \
__##name##_impl__ __asm__(#name); \
- decltype(__llvm_libc::name) name [[gnu::alias(#name)]]; \
+ decltype(LIBC_NAMESPACE::name) name [[gnu::alias(#name)]]; \
type __##name##_impl__ arglist
#else
#define LLVM_LIBC_FUNCTION_IMPL(type, name, arglist) type name arglist
@@ -35,7 +35,7 @@
#define LLVM_LIBC_FUNCTION(type, name, arglist) \
LLVM_LIBC_FUNCTION_IMPL(type, name, arglist)
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
namespace internal {
LIBC_INLINE constexpr bool same_string(char const *lhs, char const *rhs) {
for (; *lhs || *rhs; ++lhs, ++rhs)
@@ -44,7 +44,7 @@ LIBC_INLINE constexpr bool same_string(char const *lhs, char const *rhs) {
return true;
}
} // namespace internal
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
// LLVM_LIBC_IS_DEFINED checks whether a particular macro is defined.
// Usage: constexpr bool kUseAvx = LLVM_LIBC_IS_DEFINED(__AVX__);
@@ -54,7 +54,7 @@ LIBC_INLINE constexpr bool same_string(char const *lhs, char const *rhs) {
// is defined, one stringification yields "FOO" while the other yields its
// stringified value "1".
#define LLVM_LIBC_IS_DEFINED(macro) \
- !__llvm_libc::internal::same_string( \
+ !LIBC_NAMESPACE::internal::same_string( \
LLVM_LIBC_IS_DEFINED__EVAL_AND_STRINGIZE(macro), #macro)
#define LLVM_LIBC_IS_DEFINED__EVAL_AND_STRINGIZE(s) #s
diff --git a/libc/src/__support/ctype_utils.h b/libc/src/__support/ctype_utils.h
index 61a5fe654319445..5fa4777ffd65fc8 100644
--- a/libc/src/__support/ctype_utils.h
+++ b/libc/src/__support/ctype_utils.h
@@ -11,7 +11,7 @@
#include "src/__support/macros/attributes.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
namespace internal {
// ------------------------------------------------------
@@ -55,6 +55,6 @@ LIBC_INLINE static constexpr int tolower(int ch) {
}
} // namespace internal
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC___SUPPORT_CTYPE_UTILS_H
diff --git a/libc/src/__support/detailed_powers_of_ten.h b/libc/src/__support/detailed_powers_of_ten.h
index 5335f0dba416437..f9628484bbe6095 100644
--- a/libc/src/__support/detailed_powers_of_ten.h
+++ b/libc/src/__support/detailed_powers_of_ten.h
@@ -13,7 +13,7 @@
#include <stdint.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
namespace internal {
// TODO(michaelrj): write a script that will generate this table.
@@ -733,6 +733,6 @@ static constexpr uint64_t DETAILED_POWERS_OF_TEN[696][2] = {
};
} // namespace internal
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC___SUPPORT_DETAILED_POWERS_OF_TEN_H
diff --git a/libc/src/__support/endian.h b/libc/src/__support/endian.h
index 43ddbb685066666..cd083aad09c3ca9 100644
--- a/libc/src/__support/endian.h
+++ b/libc/src/__support/endian.h
@@ -13,7 +13,7 @@
#include <stdint.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
// We rely on compiler preprocessor defines to allow for cross compilation.
#if !defined(__BYTE_ORDER__) || !defined(__ORDER_LITTLE_ENDIAN__) || \
@@ -140,6 +140,6 @@ Endian<__ORDER_BIG_ENDIAN__>::to_little_endian<uint64_t>(uint64_t v) {
using Endian = internal::Endian<__BYTE_ORDER__>;
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC___SUPPORT_ENDIAN_H
diff --git a/libc/src/__support/error_or.h b/libc/src/__support/error_or.h
index 33bb942d9d0d0f8..34c652dd878c287 100644
--- a/libc/src/__support/error_or.h
+++ b/libc/src/__support/error_or.h
@@ -11,7 +11,7 @@
#include "src/__support/CPP/expected.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
template <class T> using ErrorOr = cpp::expected<T, int>;
@@ -34,6 +34,6 @@ using Error = cpp::unexpected<int>;
// constexpr operator T() { return value; }
// };
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC___SUPPORT_ERROR_OR_H
diff --git a/libc/src/__support/fixedvector.h b/libc/src/__support/fixedvector.h
index 5dfda1e629623ec..fff905d8c6c4181 100644
--- a/libc/src/__support/fixedvector.h
+++ b/libc/src/__support/fixedvector.h
@@ -11,7 +11,7 @@
#include "src/__support/CPP/array.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
// A fixed size data store backed by an underlying cpp::array data structure. It
// supports vector like API but is not resizable like a vector.
@@ -57,6 +57,6 @@ template <typename T, size_t CAPACITY> class FixedVector {
static void destroy(FixedVector<T, CAPACITY> *store) { store->reset(); }
};
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC___SUPPORT_FIXEDVECTOR_H
diff --git a/libc/src/__support/float_to_string.h b/libc/src/__support/float_to_string.h
index 1e78bcb200b8c80..4e11c4c3432ceb1 100644
--- a/libc/src/__support/float_to_string.h
+++ b/libc/src/__support/float_to_string.h
@@ -100,7 +100,7 @@ constexpr size_t MID_INT_SIZE = 192;
// Any block that is all 9s adds one to the max block counter and doesn't clear
// the buffer because they can cause the block above them to be rounded up.
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
using BlockInt = uint32_t;
constexpr size_t BLOCK_SIZE = 9;
@@ -754,6 +754,6 @@ FloatToString<long double>::get_negative_block(int block_index) {
#endif // LONG_DOUBLE_IS_DOUBLE
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC___SUPPORT_FLOAT_TO_STRING_H
diff --git a/libc/src/__support/high_precision_decimal.h b/libc/src/__support/high_precision_decimal.h
index 9ee7c1fb8653fbf..bf33658982c362c 100644
--- a/libc/src/__support/high_precision_decimal.h
+++ b/libc/src/__support/high_precision_decimal.h
@@ -13,7 +13,7 @@
#include "src/__support/str_to_integer.h"
#include <stdint.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
namespace internal {
struct LShiftTableEntry {
@@ -411,6 +411,6 @@ class HighPrecisionDecimal {
};
} // namespace internal
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC___SUPPORT_HIGH_PRECISION_DECIMAL_H
diff --git a/libc/src/__support/integer_operations.h b/libc/src/__support/integer_operations.h
index 396ebc7cbb9db13..6253afed06b757a 100644
--- a/libc/src/__support/integer_operations.h
+++ b/libc/src/__support/integer_operations.h
@@ -11,7 +11,7 @@
#include "src/__support/CPP/type_traits.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
template <typename T>
static constexpr cpp::enable_if_t<cpp::is_integral_v<T>, T> integer_abs(T n) {
@@ -25,6 +25,6 @@ integer_rem_quo(T x, T y, T ", T &rem) {
rem = x % y;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC___SUPPORT_INTEGER_OPERATIONS_H
diff --git a/libc/src/__support/integer_to_string.h b/libc/src/__support/integer_to_string.h
index 2c11d834a8f34e3..29f712461259444 100644
--- a/libc/src/__support/integer_to_string.h
+++ b/libc/src/__support/integer_to_string.h
@@ -69,7 +69,7 @@
#include "src/__support/CPP/type_traits.h"
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
namespace details {
@@ -316,6 +316,6 @@ template <typename T, typename Fmt = radix::Dec> class IntegerToString {
}
};
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC___SUPPORT_INTEGER_TO_STRING_H
diff --git a/libc/src/__support/integer_utils.h b/libc/src/__support/integer_utils.h
index 9a734da3e117b3d..7b62cb0d9f50593 100644
--- a/libc/src/__support/integer_utils.h
+++ b/libc/src/__support/integer_utils.h
@@ -17,7 +17,7 @@
#include <stdint.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
template <typename T> NumberPair<T> full_mul(T a, T b);
@@ -60,6 +60,6 @@ LIBC_INLINE NumberPair<uint64_t> full_mul<uint64_t>(uint64_t a, uint64_t b) {
#endif // __SIZEOF_INT128__
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC___SUPPORT_INTEGER_UTILS_H
diff --git a/libc/src/__support/libc_assert.h b/libc/src/__support/libc_assert.h
index 4190cfe04a759e7..61f075435b552d1 100644
--- a/libc/src/__support/libc_assert.h
+++ b/libc/src/__support/libc_assert.h
@@ -25,7 +25,7 @@
#include "src/__support/integer_to_string.h"
#include "src/__support/macros/attributes.h" // For LIBC_INLINE
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
// This is intended to be removed in a future patch to use a similar design to
// below, but it's necessary for the external assert.
@@ -43,7 +43,7 @@ LIBC_INLINE void report_assertion_failure(const char *assertion,
write_to_stderr("'\n");
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#ifdef LIBC_ASSERT
#error "Unexpected: LIBC_ASSERT macro already defined"
@@ -71,12 +71,12 @@ LIBC_INLINE void report_assertion_failure(const char *assertion,
#define LIBC_ASSERT(COND) \
do { \
if (!(COND)) { \
- __llvm_libc::write_to_stderr(__FILE__ ":" __LIBC_LINE_STR__ \
- ": Assertion failed: '" #COND \
- "' in function: '"); \
- __llvm_libc::write_to_stderr(__PRETTY_FUNCTION__); \
- __llvm_libc::write_to_stderr("'\n"); \
- __llvm_libc::quick_exit(0xFF); \
+ LIBC_NAMESPACE::write_to_stderr(__FILE__ ":" __LIBC_LINE_STR__ \
+ ": Assertion failed: '" #COND \
+ "' in function: '"); \
+ LIBC_NAMESPACE::write_to_stderr(__PRETTY_FUNCTION__); \
+ LIBC_NAMESPACE::write_to_stderr("'\n"); \
+ LIBC_NAMESPACE::quick_exit(0xFF); \
} \
} while (false)
#endif // NDEBUG
diff --git a/libc/src/__support/macros/optimization.h b/libc/src/__support/macros/optimization.h
index 1d221ff6aff45a6..ae97efcaa41706d 100644
--- a/libc/src/__support/macros/optimization.h
+++ b/libc/src/__support/macros/optimization.h
@@ -16,14 +16,15 @@
// We use a template to implement likely/unlikely to make sure that we don't
// accidentally pass an integer.
-namespace __llvm_libc::details {
+namespace LIBC_NAMESPACE::details {
template <typename T>
LIBC_INLINE constexpr bool expects_bool_condition(T value, T expected) {
return __builtin_expect(value, expected);
}
-} // namespace __llvm_libc::details
-#define LIBC_LIKELY(x) __llvm_libc::details::expects_bool_condition(x, true)
-#define LIBC_UNLIKELY(x) __llvm_libc::details::expects_bool_condition(x, false)
+} // namespace LIBC_NAMESPACE::details
+#define LIBC_LIKELY(x) LIBC_NAMESPACE::details::expects_bool_condition(x, true)
+#define LIBC_UNLIKELY(x) \
+ LIBC_NAMESPACE::details::expects_bool_condition(x, false)
#if defined(LIBC_COMPILER_IS_CLANG)
#define LIBC_LOOP_NOUNROLL _Pragma("nounroll")
diff --git a/libc/src/__support/number_pair.h b/libc/src/__support/number_pair.h
index 3f23394ee4cc206..5e553d817994b4b 100644
--- a/libc/src/__support/number_pair.h
+++ b/libc/src/__support/number_pair.h
@@ -14,7 +14,7 @@
#include <stddef.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
DEFINE_NAMED_PAIR_TEMPLATE(NumberPair, lo, hi);
@@ -29,6 +29,6 @@ split(T a) {
return result;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC___SUPPORT_NUMBER_PAIR_H
diff --git a/libc/src/__support/str_to_float.h b/libc/src/__support/str_to_float.h
index 58bdee2c573b507..db50090ec4e1296 100644
--- a/libc/src/__support/str_to_float.h
+++ b/libc/src/__support/str_to_float.h
@@ -25,7 +25,7 @@
#include "src/__support/str_to_num_result.h"
#include "src/errno/libc_errno.h" // For ERANGE
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
namespace internal {
template <class T> struct ExpandedFloat {
@@ -1247,6 +1247,6 @@ LIBC_INLINE StrToNumResult<T> strtofloatingpoint(const char *__restrict src) {
}
} // namespace internal
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC___SUPPORT_STR_TO_FLOAT_H
diff --git a/libc/src/__support/str_to_integer.h b/libc/src/__support/str_to_integer.h
index f9608928430a8c2..4ee336ec9e2bbd8 100644
--- a/libc/src/__support/str_to_integer.h
+++ b/libc/src/__support/str_to_integer.h
@@ -17,7 +17,7 @@
#include "src/errno/libc_errno.h" // For ERANGE
#include <limits.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
namespace internal {
// Returns a pointer to the first character in src that is not a whitespace
@@ -150,6 +150,6 @@ LIBC_INLINE StrToNumResult<T> strtointeger(const char *__restrict src,
}
} // namespace internal
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC___SUPPORT_STR_TO_INTEGER_H
diff --git a/libc/src/__support/str_to_num_result.h b/libc/src/__support/str_to_num_result.h
index ea96f950cfb99af..9ba704c690655ee 100644
--- a/libc/src/__support/str_to_num_result.h
+++ b/libc/src/__support/str_to_num_result.h
@@ -11,7 +11,7 @@
#include <stddef.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
template <typename T> struct StrToNumResult {
T value;
@@ -28,6 +28,6 @@ template <typename T> struct StrToNumResult {
constexpr operator T() { return value; }
};
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC___SUPPORT_STR_TO_NUM_RESULT_H
diff --git a/libc/src/__support/threads/callonce.h b/libc/src/__support/threads/callonce.h
index 12e5c82a89d4855..b3d6813f7dda9e3 100644
--- a/libc/src/__support/threads/callonce.h
+++ b/libc/src/__support/threads/callonce.h
@@ -9,13 +9,13 @@
#ifndef LLVM_LIBC_SRC___SUPPORT_THREADS_CALLONCE_H
#define LLVM_LIBC_SRC___SUPPORT_THREADS_CALLONCE_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
struct CallOnceFlag;
using CallOnceCallback = void(void);
int callonce(CallOnceFlag *flag, CallOnceCallback *callback);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC___SUPPORT_THREADS_CALLONCE_H
diff --git a/libc/src/__support/threads/fork_callbacks.cpp b/libc/src/__support/threads/fork_callbacks.cpp
index 7ac4c485b1f07a7..54fda676f281ed9 100644
--- a/libc/src/__support/threads/fork_callbacks.cpp
+++ b/libc/src/__support/threads/fork_callbacks.cpp
@@ -12,7 +12,7 @@
#include <stddef.h> // For size_t
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
namespace {
@@ -87,4 +87,4 @@ void invoke_prepare_callbacks() { cb_manager.invoke_prepare(); }
void invoke_parent_callbacks() { cb_manager.invoke_parent(); }
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/__support/threads/fork_callbacks.h b/libc/src/__support/threads/fork_callbacks.h
index 5e77c35f6b5a840..57a4f8228c5fbd8 100644
--- a/libc/src/__support/threads/fork_callbacks.h
+++ b/libc/src/__support/threads/fork_callbacks.h
@@ -9,7 +9,7 @@
#ifndef LLVM_LIBC_SRC___SUPPORT_THREADS_FORK_CALLBACKS_H
#define LLVM_LIBC_SRC___SUPPORT_THREADS_FORK_CALLBACKS_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
using ForkCallback = void(void);
@@ -19,6 +19,6 @@ void invoke_prepare_callbacks();
void invoke_parent_callbacks();
void invoke_child_callbacks();
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC___SUPPORT_THREADS_FORK_CALLBACKS_H
diff --git a/libc/src/__support/threads/gpu/mutex.h b/libc/src/__support/threads/gpu/mutex.h
index 5a5dc73e2515aa8..7a23604b5b986a0 100644
--- a/libc/src/__support/threads/gpu/mutex.h
+++ b/libc/src/__support/threads/gpu/mutex.h
@@ -12,7 +12,7 @@
#include "src/__support/macros/attributes.h"
#include "src/__support/threads/mutex_common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
/// Implementation of a simple passthrough mutex which guards nothing. A
/// complete Mutex locks in general cannot be implemented on the GPU. We simply
@@ -26,6 +26,6 @@ struct Mutex {
LIBC_INLINE MutexError reset() { return MutexError::NONE; }
};
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif
diff --git a/libc/src/__support/threads/linux/callonce.cpp b/libc/src/__support/threads/linux/callonce.cpp
index 1e43037d3fe2f36..de1e1008784f604 100644
--- a/libc/src/__support/threads/linux/callonce.cpp
+++ b/libc/src/__support/threads/linux/callonce.cpp
@@ -16,7 +16,7 @@
#include <linux/futex.h>
#include <sys/syscall.h> // For syscall numbers.
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
static constexpr FutexWordType NOT_CALLED = 0x0;
static constexpr FutexWordType START = 0x11;
@@ -34,10 +34,10 @@ int callonce(CallOnceFlag *flag, CallOnceCallback *func) {
func();
auto status = futex_word->exchange(FINISH);
if (status == WAITING) {
- __llvm_libc::syscall_impl<long>(FUTEX_SYSCALL_ID, &futex_word->val,
- FUTEX_WAKE_PRIVATE,
- INT_MAX, // Wake all waiters.
- 0, 0, 0);
+ LIBC_NAMESPACE::syscall_impl<long>(FUTEX_SYSCALL_ID, &futex_word->val,
+ FUTEX_WAKE_PRIVATE,
+ INT_MAX, // Wake all waiters.
+ 0, 0, 0);
}
return 0;
}
@@ -45,7 +45,7 @@ int callonce(CallOnceFlag *flag, CallOnceCallback *func) {
FutexWordType status = START;
if (futex_word->compare_exchange_strong(status, WAITING) ||
status == WAITING) {
- __llvm_libc::syscall_impl<long>(
+ LIBC_NAMESPACE::syscall_impl<long>(
FUTEX_SYSCALL_ID, &futex_word->val, FUTEX_WAIT_PRIVATE,
WAITING, // Block only if status is still |WAITING|.
0, 0, 0);
@@ -54,4 +54,4 @@ int callonce(CallOnceFlag *flag, CallOnceCallback *func) {
return 0;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/__support/threads/linux/futex_word.h b/libc/src/__support/threads/linux/futex_word.h
index 4585aacf4623a5a..67159b81b561323 100644
--- a/libc/src/__support/threads/linux/futex_word.h
+++ b/libc/src/__support/threads/linux/futex_word.h
@@ -12,7 +12,7 @@
#include <stdint.h>
#include <sys/syscall.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
// Futexes are 32 bits in size on all platforms, including 64-bit platforms.
using FutexWordType = uint32_t;
@@ -25,6 +25,6 @@ constexpr auto FUTEX_SYSCALL_ID = SYS_futex_time64;
#error "futex and futex_time64 syscalls not available."
#endif
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC___SUPPORT_THREADS_LINUX_FUTEX_WORD_H
diff --git a/libc/src/__support/threads/linux/mutex.h b/libc/src/__support/threads/linux/mutex.h
index 9b22fbab7c4c3c6..618698db0d25b3d 100644
--- a/libc/src/__support/threads/linux/mutex.h
+++ b/libc/src/__support/threads/linux/mutex.h
@@ -18,7 +18,7 @@
#include <stdint.h>
#include <sys/syscall.h> // For syscall numbers.
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
struct Mutex {
unsigned char timed;
@@ -76,7 +76,7 @@ struct Mutex {
// futex syscall will block if the futex data is still
// `LockState::Waiting` (the 4th argument to the syscall function
// below.)
- __llvm_libc::syscall_impl<long>(
+ LIBC_NAMESPACE::syscall_impl<long>(
FUTEX_SYSCALL_ID, &futex_word.val, FUTEX_WAIT_PRIVATE,
FutexWordType(LockState::Waiting), 0, 0, 0);
was_waiting = true;
@@ -91,7 +91,7 @@ struct Mutex {
// we will wait for the futex to be woken up. Note again that the
// following syscall will block only if the futex data is still
// `LockState::Waiting`.
- __llvm_libc::syscall_impl<long>(
+ LIBC_NAMESPACE::syscall_impl<long>(
FUTEX_SYSCALL_ID, &futex_word, FUTEX_WAIT_PRIVATE,
FutexWordType(LockState::Waiting), 0, 0, 0);
was_waiting = true;
@@ -110,8 +110,8 @@ struct Mutex {
if (futex_word.compare_exchange_strong(mutex_status,
FutexWordType(LockState::Free))) {
// If any thread is waiting to be woken up, then do it.
- __llvm_libc::syscall_impl<long>(FUTEX_SYSCALL_ID, &futex_word,
- FUTEX_WAKE_PRIVATE, 1, 0, 0, 0);
+ LIBC_NAMESPACE::syscall_impl<long>(FUTEX_SYSCALL_ID, &futex_word,
+ FUTEX_WAKE_PRIVATE, 1, 0, 0, 0);
return MutexError::NONE;
}
@@ -131,6 +131,6 @@ struct Mutex {
MutexError trylock();
};
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC___SUPPORT_THREADS_LINUX_MUTEX_H
diff --git a/libc/src/__support/threads/linux/thread.cpp b/libc/src/__support/threads/linux/thread.cpp
index 88efaece182a379..05fa0433ed86463 100644
--- a/libc/src/__support/threads/linux/thread.cpp
+++ b/libc/src/__support/threads/linux/thread.cpp
@@ -30,7 +30,7 @@
#include <sys/mman.h> // For PROT_* and MAP_* definitions.
#include <sys/syscall.h> // For syscall numbers.
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
#ifdef SYS_mmap2
static constexpr long MMAP_SYSCALL_NUMBER = SYS_mmap2;
@@ -92,7 +92,7 @@ LIBC_INLINE ErrorOr<void *> alloc_stack(size_t stacksize, size_t guardsize) {
// TODO: Maybe add MAP_STACK? Currently unimplemented on linux but helps
// future-proof.
- long mmap_result = __llvm_libc::syscall_impl<long>(
+ long mmap_result = LIBC_NAMESPACE::syscall_impl<long>(
MMAP_SYSCALL_NUMBER,
0, // No special address
size, prot,
@@ -106,9 +106,9 @@ LIBC_INLINE ErrorOr<void *> alloc_stack(size_t stacksize, size_t guardsize) {
if (guardsize) {
// Give read/write permissions to actual stack.
// TODO: We are assuming stack growsdown here.
- long result =
- __llvm_libc::syscall_impl<long>(SYS_mprotect, mmap_result + guardsize,
- stacksize, PROT_READ | PROT_WRITE);
+ long result = LIBC_NAMESPACE::syscall_impl<long>(
+ SYS_mprotect, mmap_result + guardsize, stacksize,
+ PROT_READ | PROT_WRITE);
if (result != 0)
return Error{int(-result)};
@@ -125,7 +125,7 @@ free_stack(void *stack, size_t stacksize, size_t guardsize) {
uintptr_t stackaddr = reinterpret_cast<uintptr_t>(stack);
stackaddr -= guardsize;
stack = reinterpret_cast<void *>(stackaddr);
- __llvm_libc::syscall_impl<long>(SYS_munmap, stack, stacksize + guardsize);
+ LIBC_NAMESPACE::syscall_impl<long>(SYS_munmap, stack, stacksize + guardsize);
}
struct Thread;
@@ -299,7 +299,7 @@ int Thread::run(ThreadStyle style, ThreadRunner runner, void *arg, void *stack,
// variables from this function will not be availalbe to the child thread.
#if defined(LIBC_TARGET_ARCH_IS_X86_64)
long register clone_result asm(CLONE_RESULT_REGISTER);
- clone_result = __llvm_libc::syscall_impl<long>(
+ clone_result = LIBC_NAMESPACE::syscall_impl<long>(
SYS_clone, CLONE_SYSCALL_FLAGS, adjusted_stack,
&attrib->tid, // The address where the child tid is written
&clear_tid->val, // The futex where the child thread status is signalled
@@ -308,7 +308,7 @@ int Thread::run(ThreadStyle style, ThreadRunner runner, void *arg, void *stack,
#elif defined(LIBC_TARGET_ARCH_IS_AARCH64) || \
defined(LIBC_TARGET_ARCH_IS_RISCV64)
long register clone_result asm(CLONE_RESULT_REGISTER);
- clone_result = __llvm_libc::syscall_impl<long>(
+ clone_result = LIBC_NAMESPACE::syscall_impl<long>(
SYS_clone, CLONE_SYSCALL_FLAGS, adjusted_stack,
&attrib->tid, // The address where the child tid is written
tls.tp, // The thread pointer value for the new thread.
@@ -379,8 +379,8 @@ void Thread::wait() {
while (clear_tid->load() != 0) {
// We cannot do a FUTEX_WAIT_PRIVATE here as the kernel does a
// FUTEX_WAKE and not a FUTEX_WAKE_PRIVATE.
- __llvm_libc::syscall_impl<long>(FUTEX_SYSCALL_ID, &clear_tid->val,
- FUTEX_WAIT, CLEAR_TID_VALUE, nullptr);
+ LIBC_NAMESPACE::syscall_impl<long>(FUTEX_SYSCALL_ID, &clear_tid->val,
+ FUTEX_WAIT, CLEAR_TID_VALUE, nullptr);
}
}
@@ -409,7 +409,7 @@ int Thread::set_name(const cpp::string_view &name) {
// If we are setting the name of the current thread, then we can
// use the syscall to set the name.
int retval =
- __llvm_libc::syscall_impl<int>(SYS_prctl, PR_SET_NAME, name.data());
+ LIBC_NAMESPACE::syscall_impl<int>(SYS_prctl, PR_SET_NAME, name.data());
if (retval < 0)
return -retval;
else
@@ -420,17 +420,18 @@ int Thread::set_name(const cpp::string_view &name) {
cpp::StringStream path_stream(path_name_buffer);
construct_thread_name_file_path(path_stream, attrib->tid);
#ifdef SYS_open
- int fd = __llvm_libc::syscall_impl<int>(SYS_open, path_name_buffer, O_RDWR);
+ int fd =
+ LIBC_NAMESPACE::syscall_impl<int>(SYS_open, path_name_buffer, O_RDWR);
#else
- int fd = __llvm_libc::syscall_impl<int>(SYS_openat, AT_FDCWD,
- path_name_buffer, O_RDWR);
+ int fd = LIBC_NAMESPACE::syscall_impl<int>(SYS_openat, AT_FDCWD,
+ path_name_buffer, O_RDWR);
#endif
if (fd < 0)
return -fd;
- int retval =
- __llvm_libc::syscall_impl<int>(SYS_write, fd, name.data(), name.size());
- __llvm_libc::syscall_impl<long>(SYS_close, fd);
+ int retval = LIBC_NAMESPACE::syscall_impl<int>(SYS_write, fd, name.data(),
+ name.size());
+ LIBC_NAMESPACE::syscall_impl<long>(SYS_close, fd);
if (retval < 0)
return -retval;
@@ -450,7 +451,7 @@ int Thread::get_name(cpp::StringStream &name) const {
// If we are getting the name of the current thread, then we can
// use the syscall to get the name.
int retval =
- __llvm_libc::syscall_impl<int>(SYS_prctl, PR_GET_NAME, name_buffer);
+ LIBC_NAMESPACE::syscall_impl<int>(SYS_prctl, PR_GET_NAME, name_buffer);
if (retval < 0)
return -retval;
name << name_buffer << cpp::StringStream::ENDS;
@@ -461,17 +462,18 @@ int Thread::get_name(cpp::StringStream &name) const {
cpp::StringStream path_stream(path_name_buffer);
construct_thread_name_file_path(path_stream, attrib->tid);
#ifdef SYS_open
- int fd = __llvm_libc::syscall_impl<int>(SYS_open, path_name_buffer, O_RDONLY);
+ int fd =
+ LIBC_NAMESPACE::syscall_impl<int>(SYS_open, path_name_buffer, O_RDONLY);
#else
- int fd = __llvm_libc::syscall_impl<int>(SYS_openat, AT_FDCWD,
- path_name_buffer, O_RDONLY);
+ int fd = LIBC_NAMESPACE::syscall_impl<int>(SYS_openat, AT_FDCWD,
+ path_name_buffer, O_RDONLY);
#endif
if (fd < 0)
return -fd;
- int retval =
- __llvm_libc::syscall_impl<int>(SYS_read, fd, name_buffer, NAME_SIZE_MAX);
- __llvm_libc::syscall_impl<long>(SYS_close, fd);
+ int retval = LIBC_NAMESPACE::syscall_impl<int>(SYS_read, fd, name_buffer,
+ NAME_SIZE_MAX);
+ LIBC_NAMESPACE::syscall_impl<long>(SYS_close, fd);
if (retval < 0)
return -retval;
if (retval == NAME_SIZE_MAX)
@@ -505,19 +507,19 @@ void thread_exit(ThreadReturnValue retval, ThreadStyle style) {
// Set the CLEAR_TID address to nullptr to prevent the kernel
// from signalling at a non-existent futex location.
- __llvm_libc::syscall_impl<long>(SYS_set_tid_address, 0);
+ LIBC_NAMESPACE::syscall_impl<long>(SYS_set_tid_address, 0);
// Return value for detached thread should be unused. We need to avoid
// referencing `style` or `retval.*` because they may be stored on the stack
// and we have deallocated our stack!
- __llvm_libc::syscall_impl<long>(SYS_exit, 0);
+ LIBC_NAMESPACE::syscall_impl<long>(SYS_exit, 0);
__builtin_unreachable();
}
if (style == ThreadStyle::POSIX)
- __llvm_libc::syscall_impl<long>(SYS_exit, retval.posix_retval);
+ LIBC_NAMESPACE::syscall_impl<long>(SYS_exit, retval.posix_retval);
else
- __llvm_libc::syscall_impl<long>(SYS_exit, retval.stdc_retval);
+ LIBC_NAMESPACE::syscall_impl<long>(SYS_exit, retval.stdc_retval);
__builtin_unreachable();
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/__support/threads/mutex.h b/libc/src/__support/threads/mutex.h
index 7b27514c748b94b..fa2bd64b6b51cf4 100644
--- a/libc/src/__support/threads/mutex.h
+++ b/libc/src/__support/threads/mutex.h
@@ -43,7 +43,7 @@
#include "gpu/mutex.h"
#endif // __linux__
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
// An RAII class for easy locking and unlocking of mutexes.
class MutexLock {
@@ -55,6 +55,6 @@ class MutexLock {
~MutexLock() { mutex->unlock(); }
};
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC___SUPPORT_THREADS_MUTEX_H
diff --git a/libc/src/__support/threads/mutex_common.h b/libc/src/__support/threads/mutex_common.h
index ec275eb2b1c4e6d..ad8d0025eba6981 100644
--- a/libc/src/__support/threads/mutex_common.h
+++ b/libc/src/__support/threads/mutex_common.h
@@ -9,7 +9,7 @@
#ifndef LLVM_LIBC_SRC___SUPPORT_THREADS_MUTEX_COMMON_H
#define LLVM_LIBC_SRC___SUPPORT_THREADS_MUTEX_COMMON_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
enum class MutexError : int {
NONE,
@@ -19,6 +19,6 @@ enum class MutexError : int {
BAD_LOCK_STATE,
};
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC___SUPPORT_THREADS_MUTEX_COMMON_H
diff --git a/libc/src/__support/threads/thread.cpp b/libc/src/__support/threads/thread.cpp
index bedaa7c6efaf176..62aa86b7aef7084 100644
--- a/libc/src/__support/threads/thread.cpp
+++ b/libc/src/__support/threads/thread.cpp
@@ -14,7 +14,7 @@
#include "src/__support/fixedvector.h"
#include "src/__support/macros/attributes.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LIBC_THREAD_LOCAL Thread self;
@@ -183,4 +183,4 @@ void *get_tss_value(unsigned int key) {
return u.payload;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/__support/threads/thread.h b/libc/src/__support/threads/thread.h
index 6fbacef483d35d0..3fc3aef462a5b6f 100644
--- a/libc/src/__support/threads/thread.h
+++ b/libc/src/__support/threads/thread.h
@@ -21,7 +21,7 @@
#include <stddef.h> // For size_t
#include <stdint.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
using ThreadRunnerPosix = void *(void *);
using ThreadRunnerStdc = int(void *);
@@ -247,6 +247,6 @@ void call_atexit_callbacks(ThreadAttributes *attrib);
} // namespace internal
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC___SUPPORT_THREADS_THREAD_H
diff --git a/libc/src/__support/wctype_utils.h b/libc/src/__support/wctype_utils.h
index d8de9fd806087b2..2c8eef8a5c0b70c 100644
--- a/libc/src/__support/wctype_utils.h
+++ b/libc/src/__support/wctype_utils.h
@@ -16,7 +16,7 @@
#define __need_wchar_t
#include <stddef.h> // needed for wint_t and wchar_t
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
namespace internal {
// ------------------------------------------------------
@@ -40,6 +40,6 @@ LIBC_INLINE cpp::optional<wint_t> btowc(int c) {
}
} // namespace internal
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC___SUPPORT_WCTYPE_UTILS_H
diff --git a/libc/src/assert/__assert_fail.h b/libc/src/assert/__assert_fail.h
index ba8db9d47ba3503..6b9dee2a4bf66d4 100644
--- a/libc/src/assert/__assert_fail.h
+++ b/libc/src/assert/__assert_fail.h
@@ -11,11 +11,11 @@
#include <stddef.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
[[noreturn]] void __assert_fail(const char *assertion, const char *file,
unsigned line, const char *function);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_ASSERT___ASSERT_FAIL_H
diff --git a/libc/src/assert/assert.h b/libc/src/assert/assert.h
index c1f325d8593bce6..0318a934acca490 100644
--- a/libc/src/assert/assert.h
+++ b/libc/src/assert/assert.h
@@ -19,6 +19,6 @@
#else
#define assert(e) \
((e) ? (void)0 \
- : __llvm_libc::__assert_fail(#e, __FILE__, __LINE__, \
- __PRETTY_FUNCTION__))
+ : LIBC_NAMESPACE::__assert_fail(#e, __FILE__, __LINE__, \
+ __PRETTY_FUNCTION__))
#endif
diff --git a/libc/src/assert/generic/__assert_fail.cpp b/libc/src/assert/generic/__assert_fail.cpp
index 10de66fed53fbc7..4cf914bbe257f57 100644
--- a/libc/src/assert/generic/__assert_fail.cpp
+++ b/libc/src/assert/generic/__assert_fail.cpp
@@ -11,13 +11,13 @@
#include "src/__support/libc_assert.h"
#include "src/stdlib/abort.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(void, __assert_fail,
(const char *assertion, const char *file, unsigned line,
const char *function)) {
- __llvm_libc::report_assertion_failure(assertion, file, line, function);
- __llvm_libc::abort();
+ LIBC_NAMESPACE::report_assertion_failure(assertion, file, line, function);
+ LIBC_NAMESPACE::abort();
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/assert/gpu/__assert_fail.cpp b/libc/src/assert/gpu/__assert_fail.cpp
index 30c5f7fff602c1b..b239088df69b01f 100644
--- a/libc/src/assert/gpu/__assert_fail.cpp
+++ b/libc/src/assert/gpu/__assert_fail.cpp
@@ -13,7 +13,7 @@
#include "src/__support/libc_assert.h"
#include "src/stdlib/abort.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
// A single-use lock to allow only a single thread to print the assertion.
static cpp::Atomic<uint32_t> lock = 0;
@@ -32,8 +32,8 @@ LLVM_LIBC_FUNCTION(void, __assert_fail,
// Only a single line should be printed if an assertion is hit.
if (gpu::is_first_lane(mask))
- __llvm_libc::report_assertion_failure(assertion, file, line, function);
- __llvm_libc::abort();
+ LIBC_NAMESPACE::report_assertion_failure(assertion, file, line, function);
+ LIBC_NAMESPACE::abort();
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/ctype/isalnum.cpp b/libc/src/ctype/isalnum.cpp
index ce3608fceae3634..42ed8ea475f109f 100644
--- a/libc/src/ctype/isalnum.cpp
+++ b/libc/src/ctype/isalnum.cpp
@@ -11,7 +11,7 @@
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
// TODO: Currently restricted to default locale.
// These should be extended using locale information.
@@ -19,4 +19,4 @@ LLVM_LIBC_FUNCTION(int, isalnum, (int c)) {
return static_cast<int>(internal::isalnum(static_cast<unsigned>(c)));
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/ctype/isalnum.h b/libc/src/ctype/isalnum.h
index beb202a7529dafe..71830c95cb2fffc 100644
--- a/libc/src/ctype/isalnum.h
+++ b/libc/src/ctype/isalnum.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_CTYPE_ISALNUM_H
#define LLVM_LIBC_SRC_CTYPE_ISALNUM_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int isalnum(int c);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_CTYPE_ISALNUM_H
diff --git a/libc/src/ctype/isalpha.cpp b/libc/src/ctype/isalpha.cpp
index 37f80f90cd2c841..2b1bd0efc3b3abf 100644
--- a/libc/src/ctype/isalpha.cpp
+++ b/libc/src/ctype/isalpha.cpp
@@ -11,7 +11,7 @@
#include "src/__support/common.h"
#include "src/__support/ctype_utils.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
// TODO: Currently restricted to default locale.
// These should be extended using locale information.
@@ -19,4 +19,4 @@ LLVM_LIBC_FUNCTION(int, isalpha, (int c)) {
return static_cast<int>(internal::isalpha(static_cast<unsigned>(c)));
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/ctype/isalpha.h b/libc/src/ctype/isalpha.h
index d5697a39e9aa561..b5b07eecd6798ec 100644
--- a/libc/src/ctype/isalpha.h
+++ b/libc/src/ctype/isalpha.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_CTYPE_ISALPHA_H
#define LLVM_LIBC_SRC_CTYPE_ISALPHA_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int isalpha(int c);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_CTYPE_ISALPHA_H
diff --git a/libc/src/ctype/isascii.cpp b/libc/src/ctype/isascii.cpp
index 8357563c7f3cc68..8be3d7e205afe31 100644
--- a/libc/src/ctype/isascii.cpp
+++ b/libc/src/ctype/isascii.cpp
@@ -10,10 +10,10 @@
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, isascii, (int c)) {
return static_cast<int>((c & (~0x7f)) == 0);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/ctype/isascii.h b/libc/src/ctype/isascii.h
index 7e31b3c6ca4dd15..5a734a21bd1e5ff 100644
--- a/libc/src/ctype/isascii.h
+++ b/libc/src/ctype/isascii.h
@@ -11,10 +11,10 @@
#undef isascii
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int isascii(int c);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_CTYPE_ISASCII_H
diff --git a/libc/src/ctype/isblank.cpp b/libc/src/ctype/isblank.cpp
index 438eff7f0a62d60..9ac9d36580c7b20 100644
--- a/libc/src/ctype/isblank.cpp
+++ b/libc/src/ctype/isblank.cpp
@@ -10,7 +10,7 @@
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
// TODO: Currently restricted to default locale.
// These should be extended using locale information.
@@ -18,4 +18,4 @@ LLVM_LIBC_FUNCTION(int, isblank, (int c)) {
return static_cast<int>(c == ' ' || c == '\t');
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/ctype/isblank.h b/libc/src/ctype/isblank.h
index 0554322d0825153..4cacdb3d2a8d726 100644
--- a/libc/src/ctype/isblank.h
+++ b/libc/src/ctype/isblank.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_CTYPE_ISBLANK_H
#define LLVM_LIBC_SRC_CTYPE_ISBLANK_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int isblank(int c);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_CTYPE_ISBLANK_H
diff --git a/libc/src/ctype/iscntrl.cpp b/libc/src/ctype/iscntrl.cpp
index b203e4e35f4e23a..b52b86f1df2910a 100644
--- a/libc/src/ctype/iscntrl.cpp
+++ b/libc/src/ctype/iscntrl.cpp
@@ -10,7 +10,7 @@
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
// TODO: Currently restricted to default locale.
// These should be extended using locale information.
@@ -19,4 +19,4 @@ LLVM_LIBC_FUNCTION(int, iscntrl, (int c)) {
return static_cast<int>(ch < 0x20 || ch == 0x7f);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/ctype/iscntrl.h b/libc/src/ctype/iscntrl.h
index 26f094053a28a04..e0cae0caa6b8d5b 100644
--- a/libc/src/ctype/iscntrl.h
+++ b/libc/src/ctype/iscntrl.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_CTYPE_ISCNTRL_H
#define LLVM_LIBC_SRC_CTYPE_ISCNTRL_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int iscntrl(int c);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_CTYPE_ISCNTRL_H
diff --git a/libc/src/ctype/isdigit.cpp b/libc/src/ctype/isdigit.cpp
index b478384916d1b52..d4d5d1f20f3fbd6 100644
--- a/libc/src/ctype/isdigit.cpp
+++ b/libc/src/ctype/isdigit.cpp
@@ -10,7 +10,7 @@
#include "src/__support/common.h"
#include "src/__support/ctype_utils.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
// TODO: Currently restricted to default locale.
// These should be extended using locale information.
@@ -18,4 +18,4 @@ LLVM_LIBC_FUNCTION(int, isdigit, (int c)) {
return static_cast<int>(internal::isdigit(static_cast<unsigned>(c)));
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/ctype/isdigit.h b/libc/src/ctype/isdigit.h
index 32a76235e0592ba..a024cf464b52ade 100644
--- a/libc/src/ctype/isdigit.h
+++ b/libc/src/ctype/isdigit.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_CTYPE_ISDIGIT_H
#define LLVM_LIBC_SRC_CTYPE_ISDIGIT_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int isdigit(int c);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_CTYPE_ISDIGIT_H
diff --git a/libc/src/ctype/isgraph.cpp b/libc/src/ctype/isgraph.cpp
index 6a1f55e85eea9c4..e195f9fcbf48cf5 100644
--- a/libc/src/ctype/isgraph.cpp
+++ b/libc/src/ctype/isgraph.cpp
@@ -11,7 +11,7 @@
#include "src/__support/common.h"
#include "src/__support/ctype_utils.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
// TODO: Currently restricted to default locale.
// These should be extended using locale information.
@@ -19,4 +19,4 @@ LLVM_LIBC_FUNCTION(int, isgraph, (int c)) {
return static_cast<int>(internal::isgraph(static_cast<unsigned>(c)));
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/ctype/isgraph.h b/libc/src/ctype/isgraph.h
index 421d0ffc4488b6e..486c32d10a11a31 100644
--- a/libc/src/ctype/isgraph.h
+++ b/libc/src/ctype/isgraph.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_CTYPE_ISGRAPH_H
#define LLVM_LIBC_SRC_CTYPE_ISGRAPH_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int isgraph(int c);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_CTYPE_ISGRAPH_H
diff --git a/libc/src/ctype/islower.cpp b/libc/src/ctype/islower.cpp
index b21ccd491ebcf9b..bd252e5e6efd17a 100644
--- a/libc/src/ctype/islower.cpp
+++ b/libc/src/ctype/islower.cpp
@@ -11,7 +11,7 @@
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
// TODO: Currently restricted to default locale.
// These should be extended using locale information.
@@ -19,4 +19,4 @@ LLVM_LIBC_FUNCTION(int, islower, (int c)) {
return static_cast<int>(internal::islower(static_cast<unsigned>(c)));
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/ctype/islower.h b/libc/src/ctype/islower.h
index 7643542fb7a990c..dc59ce9cea43805 100644
--- a/libc/src/ctype/islower.h
+++ b/libc/src/ctype/islower.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_CTYPE_ISLOWER_H
#define LLVM_LIBC_SRC_CTYPE_ISLOWER_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int islower(int c);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_CTYPE_ISLOWER_H
diff --git a/libc/src/ctype/isprint.cpp b/libc/src/ctype/isprint.cpp
index dd9a085e17cbce4..bdf9d083b621b4d 100644
--- a/libc/src/ctype/isprint.cpp
+++ b/libc/src/ctype/isprint.cpp
@@ -10,7 +10,7 @@
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
// TODO: Currently restricted to default locale.
// These should be extended using locale information.
@@ -19,4 +19,4 @@ LLVM_LIBC_FUNCTION(int, isprint, (int c)) {
return static_cast<int>((ch - ' ') < 95);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/ctype/isprint.h b/libc/src/ctype/isprint.h
index 17ed56ef253400c..22c835b7987c0e0 100644
--- a/libc/src/ctype/isprint.h
+++ b/libc/src/ctype/isprint.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_CTYPE_ISPRINT_H
#define LLVM_LIBC_SRC_CTYPE_ISPRINT_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int isprint(int c);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_CTYPE_ISPRINT_H
diff --git a/libc/src/ctype/ispunct.cpp b/libc/src/ctype/ispunct.cpp
index 7ccad4b0ecdc0d3..d355c19c426c69a 100644
--- a/libc/src/ctype/ispunct.cpp
+++ b/libc/src/ctype/ispunct.cpp
@@ -11,7 +11,7 @@
#include "src/__support/common.h"
#include "src/__support/ctype_utils.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
// TODO: Currently restricted to default locale.
// These should be extended using locale information.
@@ -20,4 +20,4 @@ LLVM_LIBC_FUNCTION(int, ispunct, (int c)) {
return static_cast<int>(!internal::isalnum(ch) && internal::isgraph(ch));
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/ctype/ispunct.h b/libc/src/ctype/ispunct.h
index 23cc08a0bac9c89..7eaa83ac8ae5e91 100644
--- a/libc/src/ctype/ispunct.h
+++ b/libc/src/ctype/ispunct.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_CTYPE_ISPUNCT_H
#define LLVM_LIBC_SRC_CTYPE_ISPUNCT_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int ispunct(int c);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_CTYPE_ISPUNCT_H
diff --git a/libc/src/ctype/isspace.cpp b/libc/src/ctype/isspace.cpp
index 8cd76c4ea6d2abd..8c09eda00bc4333 100644
--- a/libc/src/ctype/isspace.cpp
+++ b/libc/src/ctype/isspace.cpp
@@ -11,7 +11,7 @@
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
// TODO: Currently restricted to default locale.
// These should be extended using locale information.
@@ -19,4 +19,4 @@ LLVM_LIBC_FUNCTION(int, isspace, (int c)) {
return static_cast<int>(internal::isspace(static_cast<unsigned>(c)));
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/ctype/isspace.h b/libc/src/ctype/isspace.h
index d919e9e7d972bd1..56b70579fad9430 100644
--- a/libc/src/ctype/isspace.h
+++ b/libc/src/ctype/isspace.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_CTYPE_ISSPACE_H
#define LLVM_LIBC_SRC_CTYPE_ISSPACE_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int isspace(int c);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_CTYPE_ISSPACE_H
diff --git a/libc/src/ctype/isupper.cpp b/libc/src/ctype/isupper.cpp
index dcb4cf1b4db535d..b527e3ee53279bb 100644
--- a/libc/src/ctype/isupper.cpp
+++ b/libc/src/ctype/isupper.cpp
@@ -11,7 +11,7 @@
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
// TODO: Currently restricted to default locale.
// These should be extended using locale information.
@@ -19,4 +19,4 @@ LLVM_LIBC_FUNCTION(int, isupper, (int c)) {
return static_cast<int>(internal::isupper(static_cast<unsigned>(c)));
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/ctype/isupper.h b/libc/src/ctype/isupper.h
index 7a1f2270943a941..8f5ce849f7961bd 100644
--- a/libc/src/ctype/isupper.h
+++ b/libc/src/ctype/isupper.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_CTYPE_ISUPPER_H
#define LLVM_LIBC_SRC_CTYPE_ISUPPER_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int isupper(int c);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_CTYPE_ISUPPER_H
diff --git a/libc/src/ctype/isxdigit.cpp b/libc/src/ctype/isxdigit.cpp
index 96efc8f1d930078..79152c95986c3df 100644
--- a/libc/src/ctype/isxdigit.cpp
+++ b/libc/src/ctype/isxdigit.cpp
@@ -11,7 +11,7 @@
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
// TODO: Currently restricted to default locale.
// These should be extended using locale information.
@@ -20,4 +20,4 @@ LLVM_LIBC_FUNCTION(int, isxdigit, (int c)) {
return static_cast<int>(internal::isdigit(ch) || (ch | 32) - 'a' < 6);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/ctype/isxdigit.h b/libc/src/ctype/isxdigit.h
index a332ecc1018ff70..4966c320341e03e 100644
--- a/libc/src/ctype/isxdigit.h
+++ b/libc/src/ctype/isxdigit.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_CTYPE_ISXDIGIT_H
#define LLVM_LIBC_SRC_CTYPE_ISXDIGIT_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int isxdigit(int c);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_CTYPE_ISXDIGIT_H
diff --git a/libc/src/ctype/toascii.cpp b/libc/src/ctype/toascii.cpp
index 19a97ae91791f05..06bf91b1719068c 100644
--- a/libc/src/ctype/toascii.cpp
+++ b/libc/src/ctype/toascii.cpp
@@ -10,8 +10,8 @@
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, toascii, (int c)) { return (c & 0x7f); }
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/ctype/toascii.h b/libc/src/ctype/toascii.h
index c3f48a38d84c914..246580e23d5f642 100644
--- a/libc/src/ctype/toascii.h
+++ b/libc/src/ctype/toascii.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_CTYPE_TOASCII_H
#define LLVM_LIBC_SRC_CTYPE_TOASCII_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int toascii(int c);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_CTYPE_TOASCII_H
diff --git a/libc/src/ctype/tolower.cpp b/libc/src/ctype/tolower.cpp
index 2c4b851a615e0f6..4e8b96dca078f08 100644
--- a/libc/src/ctype/tolower.cpp
+++ b/libc/src/ctype/tolower.cpp
@@ -11,10 +11,10 @@
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
// TODO: Currently restricted to default locale.
// These should be extended using locale information.
LLVM_LIBC_FUNCTION(int, tolower, (int c)) { return internal::tolower(c); }
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/ctype/tolower.h b/libc/src/ctype/tolower.h
index 97e675c5582520f..8213da9319af184 100644
--- a/libc/src/ctype/tolower.h
+++ b/libc/src/ctype/tolower.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_CTYPE_TOLOWER_H
#define LLVM_LIBC_SRC_CTYPE_TOLOWER_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int tolower(int c);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_CTYPE_TOLOWER_H
diff --git a/libc/src/ctype/toupper.cpp b/libc/src/ctype/toupper.cpp
index b216cc277b8c212..7b0db3544103592 100644
--- a/libc/src/ctype/toupper.cpp
+++ b/libc/src/ctype/toupper.cpp
@@ -11,7 +11,7 @@
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
// TODO: Currently restricted to default locale.
// These should be extended using locale information.
@@ -21,4 +21,4 @@ LLVM_LIBC_FUNCTION(int, toupper, (int c)) {
return c;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/ctype/toupper.h b/libc/src/ctype/toupper.h
index a21b0cf79d9557c..b5d8890b2090dad 100644
--- a/libc/src/ctype/toupper.h
+++ b/libc/src/ctype/toupper.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_CTYPE_TOUPPER_H
#define LLVM_LIBC_SRC_CTYPE_TOUPPER_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int toupper(int c);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_CTYPE_TOUPPER_H
diff --git a/libc/src/dirent/closedir.cpp b/libc/src/dirent/closedir.cpp
index 2863106b4ce89eb..22c27c4c0f06115 100644
--- a/libc/src/dirent/closedir.cpp
+++ b/libc/src/dirent/closedir.cpp
@@ -14,10 +14,10 @@
#include <dirent.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, closedir, (::DIR * dir)) {
- auto *d = reinterpret_cast<__llvm_libc::Dir *>(dir);
+ auto *d = reinterpret_cast<LIBC_NAMESPACE::Dir *>(dir);
int retval = d->close();
if (retval != 0) {
libc_errno = retval;
@@ -26,4 +26,4 @@ LLVM_LIBC_FUNCTION(int, closedir, (::DIR * dir)) {
return 0;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/dirent/closedir.h b/libc/src/dirent/closedir.h
index c5ee7ae59f1edd6..6d6b898cfe1a988 100644
--- a/libc/src/dirent/closedir.h
+++ b/libc/src/dirent/closedir.h
@@ -11,10 +11,10 @@
#include <dirent.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int closedir(::DIR *dir);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_DIRENT_CLOSEDIR_H
diff --git a/libc/src/dirent/dirfd.cpp b/libc/src/dirent/dirfd.cpp
index 214c5c5852033da..27995f6ef3c64d5 100644
--- a/libc/src/dirent/dirfd.cpp
+++ b/libc/src/dirent/dirfd.cpp
@@ -13,11 +13,11 @@
#include <dirent.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, dirfd, (::DIR * dir)) {
- auto *d = reinterpret_cast<__llvm_libc::Dir *>(dir);
+ auto *d = reinterpret_cast<LIBC_NAMESPACE::Dir *>(dir);
return d->getfd();
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/dirent/dirfd.h b/libc/src/dirent/dirfd.h
index 8590e3e159d364a..34acb01dd61181b 100644
--- a/libc/src/dirent/dirfd.h
+++ b/libc/src/dirent/dirfd.h
@@ -11,10 +11,10 @@
#include <dirent.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int dirfd(::DIR *dir);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_DIRENT_DIRFD_H
diff --git a/libc/src/dirent/opendir.cpp b/libc/src/dirent/opendir.cpp
index 06749e82c75f101..56f7bc8b574f0f3 100644
--- a/libc/src/dirent/opendir.cpp
+++ b/libc/src/dirent/opendir.cpp
@@ -14,7 +14,7 @@
#include <dirent.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(::DIR *, opendir, (const char *name)) {
auto dir = Dir::open(name);
@@ -25,4 +25,4 @@ LLVM_LIBC_FUNCTION(::DIR *, opendir, (const char *name)) {
return reinterpret_cast<DIR *>(dir.value());
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/dirent/opendir.h b/libc/src/dirent/opendir.h
index e183587999a9cf0..635cb9083d068bd 100644
--- a/libc/src/dirent/opendir.h
+++ b/libc/src/dirent/opendir.h
@@ -11,10 +11,10 @@
#include <dirent.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
::DIR *opendir(const char *name);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_DIRENT_OPENDIR_H
diff --git a/libc/src/dirent/readdir.cpp b/libc/src/dirent/readdir.cpp
index a9f9491d47e5948..448935e3a4ab216 100644
--- a/libc/src/dirent/readdir.cpp
+++ b/libc/src/dirent/readdir.cpp
@@ -14,10 +14,10 @@
#include <dirent.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(struct ::dirent *, readdir, (::DIR * dir)) {
- auto *d = reinterpret_cast<__llvm_libc::Dir *>(dir);
+ auto *d = reinterpret_cast<LIBC_NAMESPACE::Dir *>(dir);
auto dirent_val = d->read();
if (!dirent_val) {
libc_errno = dirent_val.error();
@@ -26,4 +26,4 @@ LLVM_LIBC_FUNCTION(struct ::dirent *, readdir, (::DIR * dir)) {
return dirent_val.value();
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/dirent/readdir.h b/libc/src/dirent/readdir.h
index b78150bf6489045..83c8c56e3f53b06 100644
--- a/libc/src/dirent/readdir.h
+++ b/libc/src/dirent/readdir.h
@@ -11,10 +11,10 @@
#include <dirent.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
struct ::dirent *readdir(DIR *dir);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_DIRENT_READDIR_H
diff --git a/libc/src/errno/libc_errno.cpp b/libc/src/errno/libc_errno.cpp
index 0489e11a1e8947f..c8f0bffd0962e9b 100644
--- a/libc/src/errno/libc_errno.cpp
+++ b/libc/src/errno/libc_errno.cpp
@@ -9,7 +9,7 @@
#include "src/__support/macros/attributes.h"
#include "src/__support/macros/properties/architectures.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
#ifdef LIBC_TARGET_ARCH_IS_GPU
struct ErrnoConsumer {
@@ -37,4 +37,4 @@ LIBC_THREAD_LOCAL int __llvmlibc_internal_errno;
#endif
} // extern "C"
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/errno/libc_errno.h b/libc/src/errno/libc_errno.h
index c81ea3129333ac3..fbcd1c3395cd1fd 100644
--- a/libc/src/errno/libc_errno.h
+++ b/libc/src/errno/libc_errno.h
@@ -17,18 +17,18 @@
// If we are targeting the GPU we currently don't support 'errno'. We simply
// consume it.
#ifdef LIBC_TARGET_ARCH_IS_GPU
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
struct ErrnoConsumer {
void operator=(int) {}
};
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif
// All of the libc runtime and test code should use the "libc_errno" macro. They
// should not refer to the "errno" macro directly.
#ifdef LIBC_COPT_PUBLIC_PACKAGING
#ifdef LIBC_TARGET_ARCH_IS_GPU
-extern "C" __llvm_libc::ErrnoConsumer __llvmlibc_errno;
+extern "C" LIBC_NAMESPACE::ErrnoConsumer __llvmlibc_errno;
#define libc_errno __llvmlibc_errno
#else
// This macro will resolve to errno from the errno.h file included above. Under
@@ -37,7 +37,7 @@ extern "C" __llvm_libc::ErrnoConsumer __llvmlibc_errno;
#define libc_errno errno
#endif
#else
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
// TODO: On the GPU build this will be mapped to a single global value. We need
// to ensure that tests are not run with multiple threads that depend on errno
@@ -48,9 +48,9 @@ extern "C" LIBC_THREAD_LOCAL int __llvmlibc_internal_errno;
// libc_errno, this header file will be "shipped" via an add_entrypoint_object
// target. At which point libc_errno, should point to __llvmlibc_internal_errno
// if LIBC_COPT_PUBLIC_PACKAGING is not defined.
-#define libc_errno __llvm_libc::__llvmlibc_internal_errno
+#define libc_errno LIBC_NAMESPACE::__llvmlibc_internal_errno
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif
#endif // LLVM_LIBC_SRC_ERRNO_LIBC_ERRNO_H
diff --git a/libc/src/fcntl/creat.h b/libc/src/fcntl/creat.h
index 0c1abda2870c79d..fc91a3cc8f677a7 100644
--- a/libc/src/fcntl/creat.h
+++ b/libc/src/fcntl/creat.h
@@ -11,10 +11,10 @@
#include <fcntl.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int creat(const char *path, int mode);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_FCNTL_CREAT_H
diff --git a/libc/src/fcntl/linux/creat.cpp b/libc/src/fcntl/linux/creat.cpp
index 0b449bb8e0616c0..0710fab23fe1b8a 100644
--- a/libc/src/fcntl/linux/creat.cpp
+++ b/libc/src/fcntl/linux/creat.cpp
@@ -15,14 +15,14 @@
#include <fcntl.h>
#include <sys/syscall.h> // For syscall numbers.
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, creat, (const char *path, int mode_flags)) {
#ifdef SYS_open
- int fd = __llvm_libc::syscall_impl<int>(
+ int fd = LIBC_NAMESPACE::syscall_impl<int>(
SYS_open, path, O_CREAT | O_WRONLY | O_TRUNC, mode_flags);
#else
- int fd = __llvm_libc::syscall_impl<int>(
+ int fd = LIBC_NAMESPACE::syscall_impl<int>(
SYS_openat, AT_FDCWD, path, O_CREAT | O_WRONLY | O_TRUNC, mode_flags);
#endif
@@ -33,4 +33,4 @@ LLVM_LIBC_FUNCTION(int, creat, (const char *path, int mode_flags)) {
return -1;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/fcntl/linux/open.cpp b/libc/src/fcntl/linux/open.cpp
index 9558a2b030b9e58..7394069a7e73697 100644
--- a/libc/src/fcntl/linux/open.cpp
+++ b/libc/src/fcntl/linux/open.cpp
@@ -16,7 +16,7 @@
#include <stdarg.h>
#include <sys/syscall.h> // For syscall numbers.
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, open, (const char *path, int flags, ...)) {
mode_t mode_flags = 0;
@@ -30,10 +30,10 @@ LLVM_LIBC_FUNCTION(int, open, (const char *path, int flags, ...)) {
}
#ifdef SYS_open
- int fd = __llvm_libc::syscall_impl<int>(SYS_open, path, flags, mode_flags);
+ int fd = LIBC_NAMESPACE::syscall_impl<int>(SYS_open, path, flags, mode_flags);
#else
- int fd = __llvm_libc::syscall_impl<int>(SYS_openat, AT_FDCWD, path, flags,
- mode_flags);
+ int fd = LIBC_NAMESPACE::syscall_impl<int>(SYS_openat, AT_FDCWD, path, flags,
+ mode_flags);
#endif
if (fd > 0)
return fd;
@@ -42,4 +42,4 @@ LLVM_LIBC_FUNCTION(int, open, (const char *path, int flags, ...)) {
return -1;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/fcntl/linux/openat.cpp b/libc/src/fcntl/linux/openat.cpp
index c6a47bfa2b47563..a2f7413ff87bf82 100644
--- a/libc/src/fcntl/linux/openat.cpp
+++ b/libc/src/fcntl/linux/openat.cpp
@@ -16,7 +16,7 @@
#include <stdarg.h>
#include <sys/syscall.h> // For syscall numbers.
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, openat, (int dfd, const char *path, int flags, ...)) {
mode_t mode_flags = 0;
@@ -29,8 +29,8 @@ LLVM_LIBC_FUNCTION(int, openat, (int dfd, const char *path, int flags, ...)) {
va_end(varargs);
}
- int fd =
- __llvm_libc::syscall_impl<int>(SYS_openat, dfd, path, flags, mode_flags);
+ int fd = LIBC_NAMESPACE::syscall_impl<int>(SYS_openat, dfd, path, flags,
+ mode_flags);
if (fd > 0)
return fd;
@@ -38,4 +38,4 @@ LLVM_LIBC_FUNCTION(int, openat, (int dfd, const char *path, int flags, ...)) {
return -1;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/fcntl/open.h b/libc/src/fcntl/open.h
index 49cfb50126594bd..30950dd828ae3e6 100644
--- a/libc/src/fcntl/open.h
+++ b/libc/src/fcntl/open.h
@@ -11,10 +11,10 @@
#include <fcntl.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int open(const char *path, int flags, ...);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_FCNTL_OPEN_H
diff --git a/libc/src/fcntl/openat.h b/libc/src/fcntl/openat.h
index 96a96de14049631..5ea5d7f0b65ac30 100644
--- a/libc/src/fcntl/openat.h
+++ b/libc/src/fcntl/openat.h
@@ -11,10 +11,10 @@
#include <fcntl.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int openat(int dfd, const char *path, int flags, ...);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_FCNTL_OPENAT_H
diff --git a/libc/src/fenv/feclearexcept.cpp b/libc/src/fenv/feclearexcept.cpp
index 2bdea887e1df62c..5eb1b0438b9af10 100644
--- a/libc/src/fenv/feclearexcept.cpp
+++ b/libc/src/fenv/feclearexcept.cpp
@@ -10,10 +10,10 @@
#include "src/__support/FPUtil/FEnvImpl.h"
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, feclearexcept, (int e)) {
return fputil::clear_except(e);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/fenv/feclearexcept.h b/libc/src/fenv/feclearexcept.h
index fa771cee32a1804..e7df86d0e20d819 100644
--- a/libc/src/fenv/feclearexcept.h
+++ b/libc/src/fenv/feclearexcept.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_FENV_FECLEAREXCEPT_H
#define LLVM_LIBC_SRC_FENV_FECLEAREXCEPT_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int feclearexcept(int);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_FENV_FECLEAREXCEPT_H
diff --git a/libc/src/fenv/fedisableexcept.cpp b/libc/src/fenv/fedisableexcept.cpp
index 855d7077f7d99fa..c715627c395b90f 100644
--- a/libc/src/fenv/fedisableexcept.cpp
+++ b/libc/src/fenv/fedisableexcept.cpp
@@ -10,10 +10,10 @@
#include "src/__support/FPUtil/FEnvImpl.h"
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, fedisableexcept, (int e)) {
return fputil::disable_except(e);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/fenv/fedisableexcept.h b/libc/src/fenv/fedisableexcept.h
index 44a545edb7a9225..977fd83262c1e51 100644
--- a/libc/src/fenv/fedisableexcept.h
+++ b/libc/src/fenv/fedisableexcept.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_FENV_FEDISABLEEXCEPT_H
#define LLVM_LIBC_SRC_FENV_FEDISABLEEXCEPT_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int fedisableexcept(int);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_FENV_FEDISABLEEXCEPT_H
diff --git a/libc/src/fenv/feenableexcept.cpp b/libc/src/fenv/feenableexcept.cpp
index 0b63a7fc5d123d0..cf45b7f1b5f7350 100644
--- a/libc/src/fenv/feenableexcept.cpp
+++ b/libc/src/fenv/feenableexcept.cpp
@@ -10,10 +10,10 @@
#include "src/__support/FPUtil/FEnvImpl.h"
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, feenableexcept, (int e)) {
return fputil::enable_except(e);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/fenv/feenableexcept.h b/libc/src/fenv/feenableexcept.h
index 58c1e0a9a4a4610..a07716247995220 100644
--- a/libc/src/fenv/feenableexcept.h
+++ b/libc/src/fenv/feenableexcept.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_FENV_FEENABLEEXCEPT_H
#define LLVM_LIBC_SRC_FENV_FEENABLEEXCEPT_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int feenableexcept(int);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_FENV_FEENABLEEXCEPT_H
diff --git a/libc/src/fenv/fegetenv.cpp b/libc/src/fenv/fegetenv.cpp
index cc98031b1252e5b..fbdb7d577b5a5e0 100644
--- a/libc/src/fenv/fegetenv.cpp
+++ b/libc/src/fenv/fegetenv.cpp
@@ -10,10 +10,10 @@
#include "src/__support/FPUtil/FEnvImpl.h"
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, fegetenv, (fenv_t * envp)) {
return fputil::get_env(envp);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/fenv/fegetenv.h b/libc/src/fenv/fegetenv.h
index e1001682a42bba6..658316482984e14 100644
--- a/libc/src/fenv/fegetenv.h
+++ b/libc/src/fenv/fegetenv.h
@@ -11,10 +11,10 @@
#include <fenv.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int fegetenv(fenv_t *);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_FENV_FEGETENV_H
diff --git a/libc/src/fenv/fegetexcept.cpp b/libc/src/fenv/fegetexcept.cpp
index 7cf1294fc6dfe74..edc4faff052827c 100644
--- a/libc/src/fenv/fegetexcept.cpp
+++ b/libc/src/fenv/fegetexcept.cpp
@@ -10,8 +10,8 @@
#include "src/__support/FPUtil/FEnvImpl.h"
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, fegetexcept, ()) { return fputil::get_except(); }
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/fenv/fegetexcept.h b/libc/src/fenv/fegetexcept.h
index ed6579f8f4671f5..53ce64872eaf0ad 100644
--- a/libc/src/fenv/fegetexcept.h
+++ b/libc/src/fenv/fegetexcept.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_FENV_FEGETEXCEPT_H
#define LLVM_LIBC_SRC_FENV_FEGETEXCEPT_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int fegetexcept();
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_FENV_FEGETEXCEPT_H
diff --git a/libc/src/fenv/fegetexceptflag.cpp b/libc/src/fenv/fegetexceptflag.cpp
index 15c2468a1eb26bb..71b87ce7315d1a3 100644
--- a/libc/src/fenv/fegetexceptflag.cpp
+++ b/libc/src/fenv/fegetexceptflag.cpp
@@ -12,7 +12,7 @@
#include <fenv.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, fegetexceptflag, (fexcept_t * flagp, int excepts)) {
// TODO: Add a compile time check to see if the excepts actually fit in flagp.
@@ -20,4 +20,4 @@ LLVM_LIBC_FUNCTION(int, fegetexceptflag, (fexcept_t * flagp, int excepts)) {
return 0;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/fenv/fegetexceptflag.h b/libc/src/fenv/fegetexceptflag.h
index 20913cb7a22f84b..ad72161e536f839 100644
--- a/libc/src/fenv/fegetexceptflag.h
+++ b/libc/src/fenv/fegetexceptflag.h
@@ -11,10 +11,10 @@
#include <fenv.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int fegetexceptflag(fexcept_t *, int excepts);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_FENV_FEGETEXCEPTFLAG_H
diff --git a/libc/src/fenv/fegetround.cpp b/libc/src/fenv/fegetround.cpp
index c01ea2c0ec417a1..edf6eac0a5b03a1 100644
--- a/libc/src/fenv/fegetround.cpp
+++ b/libc/src/fenv/fegetround.cpp
@@ -10,8 +10,8 @@
#include "src/__support/FPUtil/FEnvImpl.h"
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, fegetround, ()) { return fputil::get_round(); }
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/fenv/fegetround.h b/libc/src/fenv/fegetround.h
index 1bc79cbf5a6c40c..40be879a66d05d6 100644
--- a/libc/src/fenv/fegetround.h
+++ b/libc/src/fenv/fegetround.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_FENV_FEGETROUND_H
#define LLVM_LIBC_SRC_FENV_FEGETROUND_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int fegetround();
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_FENV_FEGETROUND_H
diff --git a/libc/src/fenv/feholdexcept.cpp b/libc/src/fenv/feholdexcept.cpp
index fe0f10245b8754b..3c73b1f42177986 100644
--- a/libc/src/fenv/feholdexcept.cpp
+++ b/libc/src/fenv/feholdexcept.cpp
@@ -12,7 +12,7 @@
#include <fenv.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, feholdexcept, (fenv_t * envp)) {
if (fputil::get_env(envp) != 0)
@@ -22,4 +22,4 @@ LLVM_LIBC_FUNCTION(int, feholdexcept, (fenv_t * envp)) {
return 0;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/fenv/feholdexcept.h b/libc/src/fenv/feholdexcept.h
index cfb86b54ff49e98..bbefc4ecbd41b21 100644
--- a/libc/src/fenv/feholdexcept.h
+++ b/libc/src/fenv/feholdexcept.h
@@ -11,10 +11,10 @@
#include <fenv.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int feholdexcept(fenv_t *);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_FENV_FEHOLDEXCEPT_H
diff --git a/libc/src/fenv/feraiseexcept.cpp b/libc/src/fenv/feraiseexcept.cpp
index 4c2a467ccf653b1..0bee7f5f5b9232d 100644
--- a/libc/src/fenv/feraiseexcept.cpp
+++ b/libc/src/fenv/feraiseexcept.cpp
@@ -10,10 +10,10 @@
#include "src/__support/FPUtil/FEnvImpl.h"
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, feraiseexcept, (int e)) {
return fputil::raise_except(e);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/fenv/feraiseexcept.h b/libc/src/fenv/feraiseexcept.h
index 5c9eacf462d49fd..a5ab3b93720ef48 100644
--- a/libc/src/fenv/feraiseexcept.h
+++ b/libc/src/fenv/feraiseexcept.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_FENV_FERAISEEXCEPT_H
#define LLVM_LIBC_SRC_FENV_FERAISEEXCEPT_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int feraiseexcept(int);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_FENV_FERAISEEXCEPT_H
diff --git a/libc/src/fenv/fesetenv.cpp b/libc/src/fenv/fesetenv.cpp
index 628da315feda345..25ac78958cf9306 100644
--- a/libc/src/fenv/fesetenv.cpp
+++ b/libc/src/fenv/fesetenv.cpp
@@ -10,10 +10,10 @@
#include "src/__support/FPUtil/FEnvImpl.h"
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, fesetenv, (const fenv_t *envp)) {
return fputil::set_env(envp);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/fenv/fesetenv.h b/libc/src/fenv/fesetenv.h
index 316ecee41996e18..8b56bebc2e36d4b 100644
--- a/libc/src/fenv/fesetenv.h
+++ b/libc/src/fenv/fesetenv.h
@@ -11,10 +11,10 @@
#include <fenv.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int fesetenv(const fenv_t *);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_FENV_FESETENV_H
diff --git a/libc/src/fenv/fesetexceptflag.cpp b/libc/src/fenv/fesetexceptflag.cpp
index 3e134aba7fcf744..2fe7cb571a8ddd2 100644
--- a/libc/src/fenv/fesetexceptflag.cpp
+++ b/libc/src/fenv/fesetexceptflag.cpp
@@ -12,7 +12,7 @@
#include <fenv.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, fesetexceptflag,
(const fexcept_t *flagp, int excepts)) {
@@ -25,4 +25,4 @@ LLVM_LIBC_FUNCTION(int, fesetexceptflag,
return fputil::set_except(excepts_to_set);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/fenv/fesetexceptflag.h b/libc/src/fenv/fesetexceptflag.h
index 0e6497abafaed4f..15e62eda1b840cd 100644
--- a/libc/src/fenv/fesetexceptflag.h
+++ b/libc/src/fenv/fesetexceptflag.h
@@ -11,10 +11,10 @@
#include <fenv.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int fesetexceptflag(const fexcept_t *, int excepts);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_FENV_FESETEXCEPTFLAG_H
diff --git a/libc/src/fenv/fesetround.cpp b/libc/src/fenv/fesetround.cpp
index 4af8a77e6e9e434..22f2b9d1e087ef3 100644
--- a/libc/src/fenv/fesetround.cpp
+++ b/libc/src/fenv/fesetround.cpp
@@ -10,8 +10,8 @@
#include "src/__support/FPUtil/FEnvImpl.h"
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, fesetround, (int m)) { return fputil::set_round(m); }
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/fenv/fesetround.h b/libc/src/fenv/fesetround.h
index 148a5eabcf3d587..75023bdb691c473 100644
--- a/libc/src/fenv/fesetround.h
+++ b/libc/src/fenv/fesetround.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_FENV_FESETROUND_H
#define LLVM_LIBC_SRC_FENV_FESETROUND_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int fesetround(int);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_FENV_FESETROUND_H
diff --git a/libc/src/fenv/fetestexcept.cpp b/libc/src/fenv/fetestexcept.cpp
index c70301fd248e2e4..c284a2c2a9528a9 100644
--- a/libc/src/fenv/fetestexcept.cpp
+++ b/libc/src/fenv/fetestexcept.cpp
@@ -10,10 +10,10 @@
#include "src/__support/FPUtil/FEnvImpl.h"
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, fetestexcept, (int e)) {
return fputil::test_except(e);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/fenv/fetestexcept.h b/libc/src/fenv/fetestexcept.h
index fb3e4045dd6b0ae..dec1ac20cc08bf8 100644
--- a/libc/src/fenv/fetestexcept.h
+++ b/libc/src/fenv/fetestexcept.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_FENV_FETESTEXCEPT_H
#define LLVM_LIBC_SRC_FENV_FETESTEXCEPT_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int fetestexcept(int);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_FENV_FETESTEXCEPT_H
diff --git a/libc/src/fenv/feupdateenv.cpp b/libc/src/fenv/feupdateenv.cpp
index 5cecf0fae19e89b..7e81b9476da91b2 100644
--- a/libc/src/fenv/feupdateenv.cpp
+++ b/libc/src/fenv/feupdateenv.cpp
@@ -12,7 +12,7 @@
#include <fenv.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, feupdateenv, (const fenv_t *envp)) {
int current_excepts = fputil::test_except(FE_ALL_EXCEPT);
@@ -21,4 +21,4 @@ LLVM_LIBC_FUNCTION(int, feupdateenv, (const fenv_t *envp)) {
return fputil::raise_except(current_excepts);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/fenv/feupdateenv.h b/libc/src/fenv/feupdateenv.h
index 1599c01ebddffa2..294c041ddeae790 100644
--- a/libc/src/fenv/feupdateenv.h
+++ b/libc/src/fenv/feupdateenv.h
@@ -11,10 +11,10 @@
#include <fenv.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int feupdateenv(const fenv_t *);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_FENV_FEUPDATEENV_H
diff --git a/libc/src/gpu/rpc_host_call.cpp b/libc/src/gpu/rpc_host_call.cpp
index b39bef65fc1a22a..7b9b9f2adfd536a 100644
--- a/libc/src/gpu/rpc_host_call.cpp
+++ b/libc/src/gpu/rpc_host_call.cpp
@@ -12,7 +12,7 @@
#include "src/__support/RPC/rpc_client.h"
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
// This calls the associated function pointer on the RPC server with the given
// arguments. We expect that the pointer here is a valid pointer on the server.
@@ -26,4 +26,4 @@ LLVM_LIBC_FUNCTION(void, rpc_host_call, (void *fn, void *data, size_t size)) {
port.close();
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/gpu/rpc_host_call.h b/libc/src/gpu/rpc_host_call.h
index f8e2cdd31902a2f..14393ab95dc13a4 100644
--- a/libc/src/gpu/rpc_host_call.h
+++ b/libc/src/gpu/rpc_host_call.h
@@ -11,10 +11,10 @@
#include <stddef.h> // size_t
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
void rpc_host_call(void *fn, void *buffer, size_t size);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_GPU_RPC_H_HOST_CALL
diff --git a/libc/src/gpu/rpc_reset.cpp b/libc/src/gpu/rpc_reset.cpp
index ba5a097d1a1bc13..824414f5181e7b3 100644
--- a/libc/src/gpu/rpc_reset.cpp
+++ b/libc/src/gpu/rpc_reset.cpp
@@ -12,13 +12,13 @@
#include "src/__support/RPC/rpc_client.h"
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
// This is the external interface to initialize the RPC client with the
// shared buffer.
LLVM_LIBC_FUNCTION(void, rpc_reset,
(unsigned int num_ports, void *rpc_shared_buffer)) {
- __llvm_libc::rpc::client.reset(num_ports, rpc_shared_buffer);
+ LIBC_NAMESPACE::rpc::client.reset(num_ports, rpc_shared_buffer);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/gpu/rpc_reset.h b/libc/src/gpu/rpc_reset.h
index 5d6a6632760f81b..dad34b458910cd6 100644
--- a/libc/src/gpu/rpc_reset.h
+++ b/libc/src/gpu/rpc_reset.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_GPU_RPC_H
#define LLVM_LIBC_SRC_GPU_RPC_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
void rpc_reset(unsigned int num_ports, void *buffer);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_GPU_RPC_H
diff --git a/libc/src/inttypes/imaxabs.cpp b/libc/src/inttypes/imaxabs.cpp
index 6c29ea2354e46b5..b390676f9dde287 100644
--- a/libc/src/inttypes/imaxabs.cpp
+++ b/libc/src/inttypes/imaxabs.cpp
@@ -10,8 +10,8 @@
#include "src/__support/common.h"
#include "src/__support/integer_operations.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(intmax_t, imaxabs, (intmax_t j)) { return integer_abs(j); }
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/inttypes/imaxabs.h b/libc/src/inttypes/imaxabs.h
index 0add10d38071cb9..cd30011b9e57a7e 100644
--- a/libc/src/inttypes/imaxabs.h
+++ b/libc/src/inttypes/imaxabs.h
@@ -11,10 +11,10 @@
#include <inttypes.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
intmax_t imaxabs(intmax_t j);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_INTTYPES_IMAXABS_H
diff --git a/libc/src/inttypes/imaxdiv.cpp b/libc/src/inttypes/imaxdiv.cpp
index 9ed6a1b46e5add4..77f0cc58a897cb4 100644
--- a/libc/src/inttypes/imaxdiv.cpp
+++ b/libc/src/inttypes/imaxdiv.cpp
@@ -10,7 +10,7 @@
#include "src/__support/common.h"
#include "src/__support/integer_operations.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(imaxdiv_t, imaxdiv, (intmax_t x, intmax_t y)) {
imaxdiv_t res;
@@ -18,4 +18,4 @@ LLVM_LIBC_FUNCTION(imaxdiv_t, imaxdiv, (intmax_t x, intmax_t y)) {
return res;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/inttypes/imaxdiv.h b/libc/src/inttypes/imaxdiv.h
index c8af35272fcc23a..749122782347c39 100644
--- a/libc/src/inttypes/imaxdiv.h
+++ b/libc/src/inttypes/imaxdiv.h
@@ -11,10 +11,10 @@
#include <inttypes.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
imaxdiv_t imaxdiv(intmax_t x, intmax_t y);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_INTTYPES_IMAXDIV_H
diff --git a/libc/src/inttypes/strtoimax.cpp b/libc/src/inttypes/strtoimax.cpp
index 5a2562380aa6a4c..459877eeff472dc 100644
--- a/libc/src/inttypes/strtoimax.cpp
+++ b/libc/src/inttypes/strtoimax.cpp
@@ -11,7 +11,7 @@
#include "src/__support/str_to_integer.h"
#include "src/errno/libc_errno.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(intmax_t, strtoimax,
(const char *__restrict str, char **__restrict str_end,
@@ -26,4 +26,4 @@ LLVM_LIBC_FUNCTION(intmax_t, strtoimax,
return result;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/inttypes/strtoimax.h b/libc/src/inttypes/strtoimax.h
index c2097e33616b434..b72547f3d22f622 100644
--- a/libc/src/inttypes/strtoimax.h
+++ b/libc/src/inttypes/strtoimax.h
@@ -11,11 +11,11 @@
#include <stdint.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
intmax_t strtoimax(const char *__restrict str, char **__restrict str_end,
int base);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_INTTYPES_STRTOIMAX_H
diff --git a/libc/src/inttypes/strtoumax.cpp b/libc/src/inttypes/strtoumax.cpp
index 0e33c55ec3e2d81..4011a177b81fe1d 100644
--- a/libc/src/inttypes/strtoumax.cpp
+++ b/libc/src/inttypes/strtoumax.cpp
@@ -11,7 +11,7 @@
#include "src/__support/str_to_integer.h"
#include "src/errno/libc_errno.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(uintmax_t, strtoumax,
(const char *__restrict str, char **__restrict str_end,
@@ -26,4 +26,4 @@ LLVM_LIBC_FUNCTION(uintmax_t, strtoumax,
return result;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/inttypes/strtoumax.h b/libc/src/inttypes/strtoumax.h
index e3ec13a53b89ccd..d59e9932da519e8 100644
--- a/libc/src/inttypes/strtoumax.h
+++ b/libc/src/inttypes/strtoumax.h
@@ -11,11 +11,11 @@
#include <stdint.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
uintmax_t strtoumax(const char *__restrict str, char **__restrict str_end,
int base);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_INTTYPES_STRTOUMAX_H
diff --git a/libc/src/math/aarch64/ceil.cpp b/libc/src/math/aarch64/ceil.cpp
index 73c3cc02839d0d4..81cd95078efee4e 100644
--- a/libc/src/math/aarch64/ceil.cpp
+++ b/libc/src/math/aarch64/ceil.cpp
@@ -9,7 +9,7 @@
#include "src/math/ceil.h"
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(double, ceil, (double x)) {
double y;
@@ -17,4 +17,4 @@ LLVM_LIBC_FUNCTION(double, ceil, (double x)) {
return y;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/aarch64/ceilf.cpp b/libc/src/math/aarch64/ceilf.cpp
index 2268989d131aa94..3cbcc1f0e90d812 100644
--- a/libc/src/math/aarch64/ceilf.cpp
+++ b/libc/src/math/aarch64/ceilf.cpp
@@ -9,7 +9,7 @@
#include "src/math/ceilf.h"
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(float, ceilf, (float x)) {
float y;
@@ -17,4 +17,4 @@ LLVM_LIBC_FUNCTION(float, ceilf, (float x)) {
return y;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/aarch64/floor.cpp b/libc/src/math/aarch64/floor.cpp
index 8de1f67bd93c865..0e3d13a13a95c7c 100644
--- a/libc/src/math/aarch64/floor.cpp
+++ b/libc/src/math/aarch64/floor.cpp
@@ -9,7 +9,7 @@
#include "src/math/floor.h"
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(double, floor, (double x)) {
double y;
@@ -17,4 +17,4 @@ LLVM_LIBC_FUNCTION(double, floor, (double x)) {
return y;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/aarch64/floorf.cpp b/libc/src/math/aarch64/floorf.cpp
index 6bb99ebeff28b0b..8942a9e7c576edd 100644
--- a/libc/src/math/aarch64/floorf.cpp
+++ b/libc/src/math/aarch64/floorf.cpp
@@ -9,7 +9,7 @@
#include "src/math/floorf.h"
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(float, floorf, (float x)) {
float y;
@@ -17,4 +17,4 @@ LLVM_LIBC_FUNCTION(float, floorf, (float x)) {
return y;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/aarch64/round.cpp b/libc/src/math/aarch64/round.cpp
index 6659060fbd700a9..8972c16c571677c 100644
--- a/libc/src/math/aarch64/round.cpp
+++ b/libc/src/math/aarch64/round.cpp
@@ -9,7 +9,7 @@
#include "src/math/round.h"
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(double, round, (double x)) {
double y;
@@ -17,4 +17,4 @@ LLVM_LIBC_FUNCTION(double, round, (double x)) {
return y;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/aarch64/roundf.cpp b/libc/src/math/aarch64/roundf.cpp
index 6044c8b75136b87..8b3a9cf50e601f1 100644
--- a/libc/src/math/aarch64/roundf.cpp
+++ b/libc/src/math/aarch64/roundf.cpp
@@ -9,7 +9,7 @@
#include "src/math/roundf.h"
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(float, roundf, (float x)) {
float y;
@@ -17,4 +17,4 @@ LLVM_LIBC_FUNCTION(float, roundf, (float x)) {
return y;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/aarch64/trunc.cpp b/libc/src/math/aarch64/trunc.cpp
index 280d919bda9fb48..34ffd1702f5a639 100644
--- a/libc/src/math/aarch64/trunc.cpp
+++ b/libc/src/math/aarch64/trunc.cpp
@@ -9,7 +9,7 @@
#include "src/math/trunc.h"
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(double, trunc, (double x)) {
double y;
@@ -17,4 +17,4 @@ LLVM_LIBC_FUNCTION(double, trunc, (double x)) {
return y;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/aarch64/truncf.cpp b/libc/src/math/aarch64/truncf.cpp
index a325ce3687f4af8..fc2426f26df2421 100644
--- a/libc/src/math/aarch64/truncf.cpp
+++ b/libc/src/math/aarch64/truncf.cpp
@@ -9,7 +9,7 @@
#include "src/math/truncf.h"
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(float, truncf, (float x)) {
float y;
@@ -17,4 +17,4 @@ LLVM_LIBC_FUNCTION(float, truncf, (float x)) {
return y;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/acosf.h b/libc/src/math/acosf.h
index 9604fbfa51aeb9c..3221efa340a9dcb 100644
--- a/libc/src/math/acosf.h
+++ b/libc/src/math/acosf.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_MATH_ACOSF_H
#define LLVM_LIBC_SRC_MATH_ACOSF_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
float acosf(float x);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_MATH_ACOSF_H
diff --git a/libc/src/math/acoshf.h b/libc/src/math/acoshf.h
index 66df87874a05da8..aac43b4ccca8dde 100644
--- a/libc/src/math/acoshf.h
+++ b/libc/src/math/acoshf.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_MATH_ACOSHF_H
#define LLVM_LIBC_SRC_MATH_ACOSHF_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
float acoshf(float x);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_MATH_ACOSHF_H
diff --git a/libc/src/math/asinf.h b/libc/src/math/asinf.h
index 71821277ef76117..227f10b0a507291 100644
--- a/libc/src/math/asinf.h
+++ b/libc/src/math/asinf.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_MATH_ASINF_H
#define LLVM_LIBC_SRC_MATH_ASINF_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
float asinf(float x);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_MATH_ASINF_H
diff --git a/libc/src/math/asinhf.h b/libc/src/math/asinhf.h
index ff4b32552c1e269..32a697cbfad097d 100644
--- a/libc/src/math/asinhf.h
+++ b/libc/src/math/asinhf.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_MATH_ASINHF_H
#define LLVM_LIBC_SRC_MATH_ASINHF_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
float asinhf(float x);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_MATH_ASINHF_H
diff --git a/libc/src/math/atanf.h b/libc/src/math/atanf.h
index 9b264e84a3a2f97..bb4c5a8bd963ce4 100644
--- a/libc/src/math/atanf.h
+++ b/libc/src/math/atanf.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_MATH_ATANF_H
#define LLVM_LIBC_SRC_MATH_ATANF_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
float atanf(float x);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_MATH_ATANF_H
diff --git a/libc/src/math/atanhf.h b/libc/src/math/atanhf.h
index 8e8b4ebf0bfdbd9..589ffd022366ac4 100644
--- a/libc/src/math/atanhf.h
+++ b/libc/src/math/atanhf.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_MATH_ATANHF_H
#define LLVM_LIBC_SRC_MATH_ATANHF_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
float atanhf(float x);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_MATH_ATANHF_H
diff --git a/libc/src/math/ceil.h b/libc/src/math/ceil.h
index 98188de20e40549..c424deec34ca802 100644
--- a/libc/src/math/ceil.h
+++ b/libc/src/math/ceil.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_MATH_CEIL_H
#define LLVM_LIBC_SRC_MATH_CEIL_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
double ceil(double x);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_MATH_CEIL_H
diff --git a/libc/src/math/ceilf.h b/libc/src/math/ceilf.h
index e8e64565052a631..0fa3aa8bc048e6c 100644
--- a/libc/src/math/ceilf.h
+++ b/libc/src/math/ceilf.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_MATH_CEILF_H
#define LLVM_LIBC_SRC_MATH_CEILF_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
float ceilf(float x);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_MATH_CEILF_H
diff --git a/libc/src/math/ceill.h b/libc/src/math/ceill.h
index 8bf4c565c7d3b13..fbe6563d219232f 100644
--- a/libc/src/math/ceill.h
+++ b/libc/src/math/ceill.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_MATH_CEILL_H
#define LLVM_LIBC_SRC_MATH_CEILL_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
long double ceill(long double x);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_MATH_CEILL_H
diff --git a/libc/src/math/copysign.h b/libc/src/math/copysign.h
index edffe1b082fe047..004240f412bf16e 100644
--- a/libc/src/math/copysign.h
+++ b/libc/src/math/copysign.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_MATH_COPYSIGN_H
#define LLVM_LIBC_SRC_MATH_COPYSIGN_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
double copysign(double x, double y);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_MATH_COPYSIGN_H
diff --git a/libc/src/math/copysignf.h b/libc/src/math/copysignf.h
index 5b7f1132252d679..503e7cbfeda6ed1 100644
--- a/libc/src/math/copysignf.h
+++ b/libc/src/math/copysignf.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_MATH_COPYSIGNF_H
#define LLVM_LIBC_SRC_MATH_COPYSIGNF_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
float copysignf(float x, float y);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_MATH_COPYSIGNF_H
diff --git a/libc/src/math/copysignl.h b/libc/src/math/copysignl.h
index 4f48323c701417c..8b8b37bd85d95b7 100644
--- a/libc/src/math/copysignl.h
+++ b/libc/src/math/copysignl.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_MATH_COPYSIGNL_H
#define LLVM_LIBC_SRC_MATH_COPYSIGNL_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
long double copysignl(long double x, long double y);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_MATH_COPYSIGNL_H
diff --git a/libc/src/math/cos.h b/libc/src/math/cos.h
index aca1d6d1e2281e9..aa97ccf66e6c77d 100644
--- a/libc/src/math/cos.h
+++ b/libc/src/math/cos.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_MATH_COS_H
#define LLVM_LIBC_SRC_MATH_COS_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
double cos(double x);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_MATH_COS_H
diff --git a/libc/src/math/cosf.h b/libc/src/math/cosf.h
index 1aaabe900ba884f..158f31191081238 100644
--- a/libc/src/math/cosf.h
+++ b/libc/src/math/cosf.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_MATH_COSF_H
#define LLVM_LIBC_SRC_MATH_COSF_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
float cosf(float x);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_MATH_COSF_H
diff --git a/libc/src/math/cosh.h b/libc/src/math/cosh.h
index c7a911b79ac2dc5..f0c8b6bced45462 100644
--- a/libc/src/math/cosh.h
+++ b/libc/src/math/cosh.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_MATH_COSH_H
#define LLVM_LIBC_SRC_MATH_COSH_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
double cosh(double x);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_MATH_COSH_H
diff --git a/libc/src/math/coshf.h b/libc/src/math/coshf.h
index 558dc220a0380ec..c470a8c943b5050 100644
--- a/libc/src/math/coshf.h
+++ b/libc/src/math/coshf.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_MATH_COSHF_H
#define LLVM_LIBC_SRC_MATH_COSHF_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
float coshf(float x);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_MATH_COSHF_H
diff --git a/libc/src/math/docs/add_math_function.md b/libc/src/math/docs/add_math_function.md
index 9efe0620f5d7d94..6f08bf037c578e2 100644
--- a/libc/src/math/docs/add_math_function.md
+++ b/libc/src/math/docs/add_math_function.md
@@ -30,7 +30,7 @@ added to the following locations:
```
libc/src/math/CMakeLists.txt
```
-- Add function declaration (under `__llvm_libc` namespace) to:
+- Add function declaration (under `LIBC_NAMESPACE` namespace) to:
```
libc/src/math/<func>.h
```
@@ -56,7 +56,7 @@ located at:
```
- These are preferred to be included as header-only.
- To manipulate bits of floating point numbers, use the template class
-`__llvm_libc::fputil::FPBits<>` in the header file:
+`LIBC_NAMESPACE::fputil::FPBits<>` in the header file:
```
libc/src/__support/FPUtils/FPBits.h
```
@@ -71,7 +71,7 @@ compare your outputs with the corresponding MPFR function. In
order for your new function to be supported by these two macros,
the following files will need to be updated:
-- Add the function enum to `__llvm_libc::testing::mpfr::Operation` in the
+- Add the function enum to `LIBC_NAMESPACE::testing::mpfr::Operation` in the
header file:
```
libc/utils/MPFRWrapper/MPFRUtils.h
diff --git a/libc/src/math/erff.h b/libc/src/math/erff.h
index 1f7dcb5352f74e3..f6c56c7dddab614 100644
--- a/libc/src/math/erff.h
+++ b/libc/src/math/erff.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_MATH_ERFF_H
#define LLVM_LIBC_SRC_MATH_ERFF_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
float erff(float x);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_MATH_ERFF_H
diff --git a/libc/src/math/exp.h b/libc/src/math/exp.h
index 6fed17185ccc213..6d60a3bc4802f4a 100644
--- a/libc/src/math/exp.h
+++ b/libc/src/math/exp.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_MATH_EXP_H
#define LLVM_LIBC_SRC_MATH_EXP_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
double exp(double x);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_MATH_EXP_H
diff --git a/libc/src/math/exp10.h b/libc/src/math/exp10.h
index 5afc95db2ce9c37..081b419275a33c0 100644
--- a/libc/src/math/exp10.h
+++ b/libc/src/math/exp10.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_MATH_EXP10_H
#define LLVM_LIBC_SRC_MATH_EXP10_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
double exp10(double x);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_MATH_EXP10_H
diff --git a/libc/src/math/exp10f.h b/libc/src/math/exp10f.h
index 7f0ef25efa48f58..4df5c461c1f56b6 100644
--- a/libc/src/math/exp10f.h
+++ b/libc/src/math/exp10f.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_MATH_EXP10F_H
#define LLVM_LIBC_SRC_MATH_EXP10F_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
float exp10f(float x);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_MATH_EXP10F_H
diff --git a/libc/src/math/exp2.h b/libc/src/math/exp2.h
index ee70722ca3858c7..2feccf6128e76d2 100644
--- a/libc/src/math/exp2.h
+++ b/libc/src/math/exp2.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_MATH_EXP2_H
#define LLVM_LIBC_SRC_MATH_EXP2_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
double exp2(double x);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_MATH_EXP2_H
diff --git a/libc/src/math/exp2f.h b/libc/src/math/exp2f.h
index c1f72b1b80fa8dd..13af54c02468f56 100644
--- a/libc/src/math/exp2f.h
+++ b/libc/src/math/exp2f.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_MATH_EXP2F_H
#define LLVM_LIBC_SRC_MATH_EXP2F_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
float exp2f(float x);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_MATH_EXP2F_H
diff --git a/libc/src/math/expf.h b/libc/src/math/expf.h
index c61ce98e9ddcf55..38837cba41d5351 100644
--- a/libc/src/math/expf.h
+++ b/libc/src/math/expf.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_MATH_EXPF_H
#define LLVM_LIBC_SRC_MATH_EXPF_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
float expf(float x);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_MATH_EXPF_H
diff --git a/libc/src/math/expm1f.h b/libc/src/math/expm1f.h
index 2577e4a49298092..359cbeec72f6c30 100644
--- a/libc/src/math/expm1f.h
+++ b/libc/src/math/expm1f.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_MATH_EXPM1F_H
#define LLVM_LIBC_SRC_MATH_EXPM1F_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
float expm1f(float x);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_MATH_EXPM1F_H
diff --git a/libc/src/math/fabs.h b/libc/src/math/fabs.h
index 424d2e01646b003..0aad5ea1f69f987 100644
--- a/libc/src/math/fabs.h
+++ b/libc/src/math/fabs.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_MATH_FABS_H
#define LLVM_LIBC_SRC_MATH_FABS_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
double fabs(double x);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_MATH_FABS_H
diff --git a/libc/src/math/fabsf.h b/libc/src/math/fabsf.h
index 0ad97a027c6c878..ca2cc106a08b2c7 100644
--- a/libc/src/math/fabsf.h
+++ b/libc/src/math/fabsf.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_MATH_FABSF_H
#define LLVM_LIBC_SRC_MATH_FABSF_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
float fabsf(float x);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_MATH_FABSF_H
diff --git a/libc/src/math/fabsl.h b/libc/src/math/fabsl.h
index fa25b1ab564d7d0..b3df8bffed105ed 100644
--- a/libc/src/math/fabsl.h
+++ b/libc/src/math/fabsl.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_MATH_FABSL_H
#define LLVM_LIBC_SRC_MATH_FABSL_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
long double fabsl(long double x);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_MATH_FABSL_H
diff --git a/libc/src/math/fdim.h b/libc/src/math/fdim.h
index f838c121e291cd1..457cb470a4e2b03 100644
--- a/libc/src/math/fdim.h
+++ b/libc/src/math/fdim.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_MATH_FDIM_H
#define LLVM_LIBC_SRC_MATH_FDIM_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
double fdim(double x, double y);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_MATH_FDIM_H
diff --git a/libc/src/math/fdimf.h b/libc/src/math/fdimf.h
index 50c586c49cc39c8..01d5a530b8cca8d 100644
--- a/libc/src/math/fdimf.h
+++ b/libc/src/math/fdimf.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_MATH_FDIMF_H
#define LLVM_LIBC_SRC_MATH_FDIMF_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
float fdimf(float x, float y);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_MATH_FDIMF_H
diff --git a/libc/src/math/fdiml.h b/libc/src/math/fdiml.h
index 6de261fe861a0ac..4b18d9a2590a4b2 100644
--- a/libc/src/math/fdiml.h
+++ b/libc/src/math/fdiml.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_MATH_FDIML_H
#define LLVM_LIBC_SRC_MATH_FDIML_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
long double fdiml(long double x, long double y);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_MATH_FDIML_H
diff --git a/libc/src/math/floor.h b/libc/src/math/floor.h
index 88a76ebf7d8058f..2920c7a7ee45d67 100644
--- a/libc/src/math/floor.h
+++ b/libc/src/math/floor.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_MATH_FLOOR_H
#define LLVM_LIBC_SRC_MATH_FLOOR_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
double floor(double x);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_MATH_FLOOR_H
diff --git a/libc/src/math/floorf.h b/libc/src/math/floorf.h
index 029df3ac5c9fe57..52d6dd701fa9b93 100644
--- a/libc/src/math/floorf.h
+++ b/libc/src/math/floorf.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_MATH_FLOORF_H
#define LLVM_LIBC_SRC_MATH_FLOORF_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
float floorf(float x);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_MATH_FLOORF_H
diff --git a/libc/src/math/floorl.h b/libc/src/math/floorl.h
index 224cc13ec6fa66a..ef53b29e735882b 100644
--- a/libc/src/math/floorl.h
+++ b/libc/src/math/floorl.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_MATH_FLOORL_H
#define LLVM_LIBC_SRC_MATH_FLOORL_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
long double floorl(long double x);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_MATH_FLOORL_H
diff --git a/libc/src/math/fma.h b/libc/src/math/fma.h
index fbc7f09ee2c7467..7f0608ea4aaa69d 100644
--- a/libc/src/math/fma.h
+++ b/libc/src/math/fma.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_MATH_FMA_H
#define LLVM_LIBC_SRC_MATH_FMA_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
double fma(double x, double y, double z);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_MATH_FMA_H
diff --git a/libc/src/math/fmaf.h b/libc/src/math/fmaf.h
index 48fbb65d66506f5..29e5bdc3e233595 100644
--- a/libc/src/math/fmaf.h
+++ b/libc/src/math/fmaf.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_MATH_FMAF_H
#define LLVM_LIBC_SRC_MATH_FMAF_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
float fmaf(float x, float y, float z);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_MATH_FMAF_H
diff --git a/libc/src/math/fmax.h b/libc/src/math/fmax.h
index 9f057983d28bb7f..64baa4d261dba57 100644
--- a/libc/src/math/fmax.h
+++ b/libc/src/math/fmax.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_MATH_FMAX_H
#define LLVM_LIBC_SRC_MATH_FMAX_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
double fmax(double x, double y);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_MATH_FMAX_H
diff --git a/libc/src/math/fmaxf.h b/libc/src/math/fmaxf.h
index e37df5cf9565d4a..1126323e2a4b24d 100644
--- a/libc/src/math/fmaxf.h
+++ b/libc/src/math/fmaxf.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_MATH_FMAXF_H
#define LLVM_LIBC_SRC_MATH_FMAXF_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
float fmaxf(float x, float y);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_MATH_FMAXF_H
diff --git a/libc/src/math/fmaxl.h b/libc/src/math/fmaxl.h
index 41d80ba4aa52ca5..a0673001fe0e6ac 100644
--- a/libc/src/math/fmaxl.h
+++ b/libc/src/math/fmaxl.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_MATH_FMAXL_H
#define LLVM_LIBC_SRC_MATH_FMAXL_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
long double fmaxl(long double x, long double y);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_MATH_FMAXL_H
diff --git a/libc/src/math/fmin.h b/libc/src/math/fmin.h
index 52334ee8e456054..bf011bb7c313cce 100644
--- a/libc/src/math/fmin.h
+++ b/libc/src/math/fmin.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_MATH_FMIN_H
#define LLVM_LIBC_SRC_MATH_FMIN_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
double fmin(double x, double y);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_MATH_FMIN_H
diff --git a/libc/src/math/fminf.h b/libc/src/math/fminf.h
index 62dad57d852aad0..b9c159a68b88e25 100644
--- a/libc/src/math/fminf.h
+++ b/libc/src/math/fminf.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_MATH_FMINF_H
#define LLVM_LIBC_SRC_MATH_FMINF_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
float fminf(float x, float y);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_MATH_FMINF_H
diff --git a/libc/src/math/fminl.h b/libc/src/math/fminl.h
index c19505c018283e4..e111e26fc3f077f 100644
--- a/libc/src/math/fminl.h
+++ b/libc/src/math/fminl.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_MATH_FMINL_H
#define LLVM_LIBC_SRC_MATH_FMINL_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
long double fminl(long double x, long double y);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_MATH_FMINL_H
diff --git a/libc/src/math/fmod.h b/libc/src/math/fmod.h
index a79ff018ec641c2..01b9aa7d2441e1a 100644
--- a/libc/src/math/fmod.h
+++ b/libc/src/math/fmod.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_MATH_FMOD_H
#define LLVM_LIBC_SRC_MATH_FMOD_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
double fmod(double x, double y);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_MATH_FMOD_H
diff --git a/libc/src/math/fmodf.h b/libc/src/math/fmodf.h
index ab9c4aee611782b..90d97e6cf1e052e 100644
--- a/libc/src/math/fmodf.h
+++ b/libc/src/math/fmodf.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_MATH_FMODF_H
#define LLVM_LIBC_SRC_MATH_FMODF_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
float fmodf(float x, float y);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_MATH_FMODF_H
diff --git a/libc/src/math/frexp.h b/libc/src/math/frexp.h
index 9258243188360b2..963ea7ba5fd072f 100644
--- a/libc/src/math/frexp.h
+++ b/libc/src/math/frexp.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_MATH_FREXP_H
#define LLVM_LIBC_SRC_MATH_FREXP_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
double frexp(double x, int *exp);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_MATH_FREXP_H
diff --git a/libc/src/math/frexpf.h b/libc/src/math/frexpf.h
index ed303d2c76dd549..74eeac24bef8e53 100644
--- a/libc/src/math/frexpf.h
+++ b/libc/src/math/frexpf.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_MATH_FREXPF_H
#define LLVM_LIBC_SRC_MATH_FREXPF_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
float frexpf(float x, int *exp);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_MATH_FREXPF_H
diff --git a/libc/src/math/frexpl.h b/libc/src/math/frexpl.h
index 9f75c82b9034ade..818266ed9f5fa54 100644
--- a/libc/src/math/frexpl.h
+++ b/libc/src/math/frexpl.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_MATH_FREXPL_H
#define LLVM_LIBC_SRC_MATH_FREXPL_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
long double frexpl(long double x, int *exp);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_MATH_FREXPL_H
diff --git a/libc/src/math/generic/acosf.cpp b/libc/src/math/generic/acosf.cpp
index ab13467b4a0a5f5..2a9b2a6852fe9e9 100644
--- a/libc/src/math/generic/acosf.cpp
+++ b/libc/src/math/generic/acosf.cpp
@@ -19,7 +19,7 @@
#include "inv_trigf_utils.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
static constexpr size_t N_EXCEPTS = 4;
@@ -119,4 +119,4 @@ LLVM_LIBC_FUNCTION(float, acosf, (float x)) {
return static_cast<float>(x_sign ? M_MATH_PI - r : r);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/generic/acoshf.cpp b/libc/src/math/generic/acoshf.cpp
index ce352764fbbc192..9438be1bee74eb4 100644
--- a/libc/src/math/generic/acoshf.cpp
+++ b/libc/src/math/generic/acoshf.cpp
@@ -16,7 +16,7 @@
#include "src/math/generic/common_constants.h"
#include "src/math/generic/explogxf.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(float, acoshf, (float x)) {
using FPBits_t = typename fputil::FPBits<float>;
@@ -74,4 +74,4 @@ LLVM_LIBC_FUNCTION(float, acoshf, (float x)) {
log_eval(x_d + fputil::sqrt(fputil::multiply_add(x_d, x_d, -1.0))));
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/generic/asinf.cpp b/libc/src/math/generic/asinf.cpp
index 9b724d3296c84e9..f40a08e752ed398 100644
--- a/libc/src/math/generic/asinf.cpp
+++ b/libc/src/math/generic/asinf.cpp
@@ -20,7 +20,7 @@
#include "inv_trigf_utils.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
static constexpr size_t N_EXCEPTS = 2;
@@ -152,4 +152,4 @@ LLVM_LIBC_FUNCTION(float, asinf, (float x)) {
return static_cast<float>(fputil::multiply_add(c3, r, c2));
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/generic/asinhf.cpp b/libc/src/math/generic/asinhf.cpp
index 91ecf45667bfc7b..6bde08d42a429cd 100644
--- a/libc/src/math/generic/asinhf.cpp
+++ b/libc/src/math/generic/asinhf.cpp
@@ -15,7 +15,7 @@
#include "src/math/generic/common_constants.h"
#include "src/math/generic/explogxf.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(float, asinhf, (float x)) {
using FPBits_t = typename fputil::FPBits<float>;
@@ -104,4 +104,4 @@ LLVM_LIBC_FUNCTION(float, asinhf, (float x)) {
x_d, x_sign, fputil::sqrt(fputil::multiply_add(x_d, x_d, 1.0)))));
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/generic/atanf.cpp b/libc/src/math/generic/atanf.cpp
index 5037806d37a1b1a..f2e4f8bb93b6f9e 100644
--- a/libc/src/math/generic/atanf.cpp
+++ b/libc/src/math/generic/atanf.cpp
@@ -13,7 +13,7 @@
#include "src/__support/macros/optimization.h" // LIBC_UNLIKELY
#include "src/math/generic/inv_trigf_utils.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(float, atanf, (float x)) {
using FPBits = typename fputil::FPBits<float>;
@@ -61,4 +61,4 @@ LLVM_LIBC_FUNCTION(float, atanf, (float x)) {
return static_cast<float>(atan_eval(x));
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/generic/atanhf.cpp b/libc/src/math/generic/atanhf.cpp
index 0a4512f7622da62..58e7f234b2c55b7 100644
--- a/libc/src/math/generic/atanhf.cpp
+++ b/libc/src/math/generic/atanhf.cpp
@@ -11,7 +11,7 @@
#include "src/__support/macros/optimization.h" // LIBC_UNLIKELY
#include "src/math/generic/explogxf.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(float, atanhf, (float x)) {
using FPBits = typename fputil::FPBits<float>;
@@ -57,4 +57,4 @@ LLVM_LIBC_FUNCTION(float, atanhf, (float x)) {
return static_cast<float>(0.5 * log_eval((xdbl + 1.0) / (xdbl - 1.0)));
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/generic/ceil.cpp b/libc/src/math/generic/ceil.cpp
index 372a0356e6a2a27..efd0f246a9b9003 100644
--- a/libc/src/math/generic/ceil.cpp
+++ b/libc/src/math/generic/ceil.cpp
@@ -10,8 +10,8 @@
#include "src/__support/FPUtil/NearestIntegerOperations.h"
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(double, ceil, (double x)) { return fputil::ceil(x); }
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/generic/ceilf.cpp b/libc/src/math/generic/ceilf.cpp
index 9a510483f7a4aa0..d49b34242da4f8a 100644
--- a/libc/src/math/generic/ceilf.cpp
+++ b/libc/src/math/generic/ceilf.cpp
@@ -10,8 +10,8 @@
#include "src/__support/FPUtil/NearestIntegerOperations.h"
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(float, ceilf, (float x)) { return fputil::ceil(x); }
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/generic/ceill.cpp b/libc/src/math/generic/ceill.cpp
index b055d90761b2ff9..7c3b680ce644289 100644
--- a/libc/src/math/generic/ceill.cpp
+++ b/libc/src/math/generic/ceill.cpp
@@ -10,10 +10,10 @@
#include "src/__support/FPUtil/NearestIntegerOperations.h"
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(long double, ceill, (long double x)) {
return fputil::ceil(x);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/generic/common_constants.cpp b/libc/src/math/generic/common_constants.cpp
index 78f9df9547ab445..737d2ab77121adb 100644
--- a/libc/src/math/generic/common_constants.cpp
+++ b/libc/src/math/generic/common_constants.cpp
@@ -10,7 +10,7 @@
#include "src/__support/FPUtil/triple_double.h"
#include "src/__support/number_pair.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
// Lookup table for (1/f) where f = 1 + n*2^(-7), n = 0..127.
const double ONE_OVER_F[128] = {
@@ -718,4 +718,4 @@ const fputil::TripleDouble EXP2_MID2[64] = {
{0x1.6ae7d36d7c1f7p-109, 0x1.e47120223467fp-54, 0x1.02be6e199c811p0},
};
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/generic/common_constants.h b/libc/src/math/generic/common_constants.h
index 8cb86b615e35a8a..df9d7828bf1609d 100644
--- a/libc/src/math/generic/common_constants.h
+++ b/libc/src/math/generic/common_constants.h
@@ -12,7 +12,7 @@
#include "src/__support/FPUtil/triple_double.h"
#include "src/__support/number_pair.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
// Lookup table for (1/f) where f = 1 + n*2^(-7), n = 0..127.
extern const double ONE_OVER_F[128];
@@ -72,6 +72,6 @@ extern const fputil::TripleDouble EXP2_MID1[64];
// Lookup table for 2^(k * 2^-12) with k = 0..63.
extern const fputil::TripleDouble EXP2_MID2[64];
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_MATH_GENERIC_COMMON_CONSTANTS_H
diff --git a/libc/src/math/generic/copysign.cpp b/libc/src/math/generic/copysign.cpp
index 51e63f1019b82c0..c5ad414bd648260 100644
--- a/libc/src/math/generic/copysign.cpp
+++ b/libc/src/math/generic/copysign.cpp
@@ -10,10 +10,10 @@
#include "src/__support/FPUtil/ManipulationFunctions.h"
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(double, copysign, (double x, double y)) {
return fputil::copysign(x, y);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/generic/copysignf.cpp b/libc/src/math/generic/copysignf.cpp
index 4773a25d12b4f9b..077e1ce60ec18f1 100644
--- a/libc/src/math/generic/copysignf.cpp
+++ b/libc/src/math/generic/copysignf.cpp
@@ -10,10 +10,10 @@
#include "src/__support/FPUtil/ManipulationFunctions.h"
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(float, copysignf, (float x, float y)) {
return fputil::copysign(x, y);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/generic/copysignl.cpp b/libc/src/math/generic/copysignl.cpp
index 5622378755d7e40..b74393cee5d6a65 100644
--- a/libc/src/math/generic/copysignl.cpp
+++ b/libc/src/math/generic/copysignl.cpp
@@ -10,10 +10,10 @@
#include "src/__support/FPUtil/ManipulationFunctions.h"
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(long double, copysignl, (long double x, long double y)) {
return fputil::copysign(x, y);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/generic/cosf.cpp b/libc/src/math/generic/cosf.cpp
index 2e4ca3c4133ff38..67b60de03024fb0 100644
--- a/libc/src/math/generic/cosf.cpp
+++ b/libc/src/math/generic/cosf.cpp
@@ -19,7 +19,7 @@
#include <errno.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
// Exceptional cases for cosf.
static constexpr size_t N_EXCEPTS = 6;
@@ -133,4 +133,4 @@ LLVM_LIBC_FUNCTION(float, cosf, (float x)) {
sin_y, -sin_k, fputil::multiply_add(cosm1_y, cos_k, cos_k)));
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/generic/coshf.cpp b/libc/src/math/generic/coshf.cpp
index 67d2667711de94a..62d77867f26f19c 100644
--- a/libc/src/math/generic/coshf.cpp
+++ b/libc/src/math/generic/coshf.cpp
@@ -13,7 +13,7 @@
#include "src/__support/macros/optimization.h" // LIBC_UNLIKELY
#include "src/math/generic/explogxf.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(float, coshf, (float x)) {
using FPBits = typename fputil::FPBits<float>;
@@ -51,4 +51,4 @@ LLVM_LIBC_FUNCTION(float, coshf, (float x)) {
return static_cast<float>(exp_pm_eval</*is_sinh*/ false>(x));
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/generic/erff.cpp b/libc/src/math/generic/erff.cpp
index a2cc8bf860fc957..a7b0897c3b58cb7 100644
--- a/libc/src/math/generic/erff.cpp
+++ b/libc/src/math/generic/erff.cpp
@@ -14,7 +14,7 @@
#include "src/__support/common.h"
#include "src/__support/macros/optimization.h" // LIBC_UNLIKELY
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
// Polynomials approximating erf(x)/x on ( k/8, (k + 1)/8 ) generated by Sollya
// with:
@@ -170,4 +170,4 @@ LLVM_LIBC_FUNCTION(float, erff, (float x)) {
return static_cast<float>(xd * fputil::multiply_add(x8, p1, p0));
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/generic/exp.cpp b/libc/src/math/generic/exp.cpp
index c16b461c14ed870..110ab9666e52aee 100644
--- a/libc/src/math/generic/exp.cpp
+++ b/libc/src/math/generic/exp.cpp
@@ -25,7 +25,7 @@
#include <errno.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
using fputil::DoubleDouble;
using fputil::TripleDouble;
@@ -413,4 +413,4 @@ LLVM_LIBC_FUNCTION(double, exp, (double x)) {
return static_cast<double>(r_f128);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/generic/exp10.cpp b/libc/src/math/generic/exp10.cpp
index 4a43259b3307d31..b152425b14b597b 100644
--- a/libc/src/math/generic/exp10.cpp
+++ b/libc/src/math/generic/exp10.cpp
@@ -25,7 +25,7 @@
#include <errno.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
using fputil::DoubleDouble;
using fputil::TripleDouble;
@@ -473,4 +473,4 @@ LLVM_LIBC_FUNCTION(double, exp10, (double x)) {
return static_cast<double>(r_f128);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/generic/exp10f.cpp b/libc/src/math/generic/exp10f.cpp
index b0e93dd6fbca4d4..52190fb92405e7b 100644
--- a/libc/src/math/generic/exp10f.cpp
+++ b/libc/src/math/generic/exp10f.cpp
@@ -20,7 +20,7 @@
#include <errno.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(float, exp10f, (float x)) {
using FPBits = typename fputil::FPBits<float>;
@@ -133,4 +133,4 @@ LLVM_LIBC_FUNCTION(float, exp10f, (float x)) {
return static_cast<float>(multiply_add(p, lo2 * rr.mh, c0 * rr.mh));
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/generic/exp2.cpp b/libc/src/math/generic/exp2.cpp
index 96710c7d5370697..b4b9960ccb2fb65 100644
--- a/libc/src/math/generic/exp2.cpp
+++ b/libc/src/math/generic/exp2.cpp
@@ -25,7 +25,7 @@
#include <errno.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
using fputil::DoubleDouble;
using fputil::TripleDouble;
@@ -387,4 +387,4 @@ LLVM_LIBC_FUNCTION(double, exp2, (double x)) {
return static_cast<double>(r_f128);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/generic/exp2f.cpp b/libc/src/math/generic/exp2f.cpp
index 2a5776ad6ca712e..fc91dfdfe95afa0 100644
--- a/libc/src/math/generic/exp2f.cpp
+++ b/libc/src/math/generic/exp2f.cpp
@@ -22,7 +22,7 @@
#include "explogxf.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
constexpr uint32_t EXVAL1 = 0x3b42'9d37U;
constexpr uint32_t EXVAL2 = 0xbcf3'a937U;
@@ -158,4 +158,4 @@ LLVM_LIBC_FUNCTION(float, exp2f, (float x)) {
return static_cast<float>(fputil::multiply_add(p, dx_sq * mh, c1 * mh));
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/generic/exp_utils.cpp b/libc/src/math/generic/exp_utils.cpp
index 9555dd61fb4388d..afdaea347478d4d 100644
--- a/libc/src/math/generic/exp_utils.cpp
+++ b/libc/src/math/generic/exp_utils.cpp
@@ -9,7 +9,7 @@
#include "exp_utils.h"
#include "math_utils.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
const Exp2fDataTable exp2f_data = {
// :tab[i] = uint(2^(i/N)) - (i << 52-BITS)
@@ -125,4 +125,4 @@ const Exp2fDataTable exp2f_data = {
},
};
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/generic/exp_utils.h b/libc/src/math/generic/exp_utils.h
index edbd60a2d568196..49d9a8192d344ac 100644
--- a/libc/src/math/generic/exp_utils.h
+++ b/libc/src/math/generic/exp_utils.h
@@ -15,7 +15,7 @@
#define EXP2F_POLY_ORDER 3
#define N (1 << EXP2F_TABLE_BITS)
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
struct Exp2fDataTable {
uint64_t tab[1 << EXP2F_TABLE_BITS];
@@ -28,6 +28,6 @@ struct Exp2fDataTable {
extern const Exp2fDataTable exp2f_data;
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_MATH_EXP_UTILS_H
diff --git a/libc/src/math/generic/expf.cpp b/libc/src/math/generic/expf.cpp
index 2cc8406c095aefb..5a938a7a1c22e5e 100644
--- a/libc/src/math/generic/expf.cpp
+++ b/libc/src/math/generic/expf.cpp
@@ -20,7 +20,7 @@
#include <errno.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(float, expf, (float x)) {
using FPBits = typename fputil::FPBits<float>;
@@ -105,4 +105,4 @@ LLVM_LIBC_FUNCTION(float, expf, (float x)) {
return static_cast<float>(exp_hi * exp_mid * exp_lo);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/generic/explogxf.cpp b/libc/src/math/generic/explogxf.cpp
index 3e12e8a0ce4bb5b..87ee57850c4734c 100644
--- a/libc/src/math/generic/explogxf.cpp
+++ b/libc/src/math/generic/explogxf.cpp
@@ -8,7 +8,7 @@
#include "explogxf.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
// N[Table[Log[2, 1 + x], {x, 0/64, 63/64, 1/64}], 40]
alignas(64) const double LOG_P1_LOG2[LOG_P1_SIZE] = {
@@ -71,4 +71,4 @@ alignas(64) const
double K_LOG2_EVEN[4] = {-0x1.71547652b82fep-1, -0x1.71547652b82fep-2,
-0x1.ec709dc3a03fdp-3, -0x1.2776c50ef9bfep-3};
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/generic/explogxf.h b/libc/src/math/generic/explogxf.h
index 97b5854c581b2b6..512785be2cb858b 100644
--- a/libc/src/math/generic/explogxf.h
+++ b/libc/src/math/generic/explogxf.h
@@ -22,7 +22,7 @@
#include <errno.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
struct ExpBase {
// Base = e
@@ -296,7 +296,7 @@ LIBC_INLINE static double log2_eval(double x) {
// c0 = dx * (1.0 / ln(2)) + LOG_P1_LOG2[p1]
double c0 = fputil::multiply_add(dx, 0x1.71547652b82fep+0, LOG_P1_LOG2[p1]);
- result += __llvm_libc::fputil::polyeval(dx * dx, c0, c1, c2, c3, c4);
+ result += LIBC_NAMESPACE::fputil::polyeval(dx * dx, c0, c1, c2, c3, c4);
return result;
}
@@ -381,6 +381,6 @@ LIBC_INLINE cpp::optional<double> ziv_test_denorm(int hi, double mid, double lo,
return cpp::nullopt;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_MATH_GENERIC_EXPLOGXF_H
diff --git a/libc/src/math/generic/expm1f.cpp b/libc/src/math/generic/expm1f.cpp
index 811baec0e91038f..edd0183c935e445 100644
--- a/libc/src/math/generic/expm1f.cpp
+++ b/libc/src/math/generic/expm1f.cpp
@@ -22,7 +22,7 @@
#include <errno.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(float, expm1f, (float x)) {
using FPBits = typename fputil::FPBits<float>;
@@ -160,4 +160,4 @@ LLVM_LIBC_FUNCTION(float, expm1f, (float x)) {
return static_cast<float>(fputil::multiply_add(exp_hi_mid, exp_lo, -1.0));
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/generic/fabs.cpp b/libc/src/math/generic/fabs.cpp
index 13872ac6e3ae2ff..0c0b7748b1f35ff 100644
--- a/libc/src/math/generic/fabs.cpp
+++ b/libc/src/math/generic/fabs.cpp
@@ -10,8 +10,8 @@
#include "src/__support/FPUtil/BasicOperations.h"
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(double, fabs, (double x)) { return fputil::abs(x); }
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/generic/fabsf.cpp b/libc/src/math/generic/fabsf.cpp
index da4c67e588890d7..a57f6bf914eb262 100644
--- a/libc/src/math/generic/fabsf.cpp
+++ b/libc/src/math/generic/fabsf.cpp
@@ -10,8 +10,8 @@
#include "src/__support/FPUtil/BasicOperations.h"
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(float, fabsf, (float x)) { return fputil::abs(x); }
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/generic/fabsl.cpp b/libc/src/math/generic/fabsl.cpp
index 9dd3665b5f5be5c..6b912c92eca867e 100644
--- a/libc/src/math/generic/fabsl.cpp
+++ b/libc/src/math/generic/fabsl.cpp
@@ -10,10 +10,10 @@
#include "src/__support/FPUtil/BasicOperations.h"
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(long double, fabsl, (long double x)) {
return fputil::abs(x);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/generic/fdim.cpp b/libc/src/math/generic/fdim.cpp
index 1fcd09be52e4db4..22d99867b423dce 100644
--- a/libc/src/math/generic/fdim.cpp
+++ b/libc/src/math/generic/fdim.cpp
@@ -10,10 +10,10 @@
#include "src/__support/FPUtil/BasicOperations.h"
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(double, fdim, (double x, double y)) {
return fputil::fdim(x, y);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/generic/fdimf.cpp b/libc/src/math/generic/fdimf.cpp
index db36f50a8dfb5e2..789a0c57eb1eeed 100644
--- a/libc/src/math/generic/fdimf.cpp
+++ b/libc/src/math/generic/fdimf.cpp
@@ -10,10 +10,10 @@
#include "src/__support/FPUtil/BasicOperations.h"
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(float, fdimf, (float x, float y)) {
return fputil::fdim(x, y);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/generic/fdiml.cpp b/libc/src/math/generic/fdiml.cpp
index 97c46e542b05aca..c1091cc66b7a877 100644
--- a/libc/src/math/generic/fdiml.cpp
+++ b/libc/src/math/generic/fdiml.cpp
@@ -10,10 +10,10 @@
#include "src/__support/FPUtil/BasicOperations.h"
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(long double, fdiml, (long double x, long double y)) {
return fputil::fdim(x, y);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/generic/floor.cpp b/libc/src/math/generic/floor.cpp
index 982464c4f88f3d7..60386f0c9cf812c 100644
--- a/libc/src/math/generic/floor.cpp
+++ b/libc/src/math/generic/floor.cpp
@@ -10,8 +10,8 @@
#include "src/__support/FPUtil/NearestIntegerOperations.h"
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(double, floor, (double x)) { return fputil::floor(x); }
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/generic/floorf.cpp b/libc/src/math/generic/floorf.cpp
index af66be776aff94e..85666688685dc04 100644
--- a/libc/src/math/generic/floorf.cpp
+++ b/libc/src/math/generic/floorf.cpp
@@ -10,8 +10,8 @@
#include "src/__support/FPUtil/NearestIntegerOperations.h"
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(float, floorf, (float x)) { return fputil::floor(x); }
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/generic/floorl.cpp b/libc/src/math/generic/floorl.cpp
index a56bc054e794091..280312797fe0ad4 100644
--- a/libc/src/math/generic/floorl.cpp
+++ b/libc/src/math/generic/floorl.cpp
@@ -10,10 +10,10 @@
#include "src/__support/FPUtil/NearestIntegerOperations.h"
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(long double, floorl, (long double x)) {
return fputil::floor(x);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/generic/fma.cpp b/libc/src/math/generic/fma.cpp
index 22aa20e78396e9b..e27e5baeddf5883 100644
--- a/libc/src/math/generic/fma.cpp
+++ b/libc/src/math/generic/fma.cpp
@@ -11,10 +11,10 @@
#include "src/__support/FPUtil/FMA.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(double, fma, (double x, double y, double z)) {
return fputil::fma(x, y, z);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/generic/fmaf.cpp b/libc/src/math/generic/fmaf.cpp
index 30074b8ca4a0bf5..7512b82005d0f56 100644
--- a/libc/src/math/generic/fmaf.cpp
+++ b/libc/src/math/generic/fmaf.cpp
@@ -11,10 +11,10 @@
#include "src/__support/FPUtil/FMA.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(float, fmaf, (float x, float y, float z)) {
return fputil::fma(x, y, z);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/generic/fmax.cpp b/libc/src/math/generic/fmax.cpp
index e96794ba17a9578..7feeee9dcd94618 100644
--- a/libc/src/math/generic/fmax.cpp
+++ b/libc/src/math/generic/fmax.cpp
@@ -10,10 +10,10 @@
#include "src/__support/FPUtil/BasicOperations.h"
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(double, fmax, (double x, double y)) {
return fputil::fmax(x, y);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/generic/fmaxf.cpp b/libc/src/math/generic/fmaxf.cpp
index 6ad319f5cb5b9f9..32410926c89a015 100644
--- a/libc/src/math/generic/fmaxf.cpp
+++ b/libc/src/math/generic/fmaxf.cpp
@@ -10,10 +10,10 @@
#include "src/__support/FPUtil/BasicOperations.h"
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(float, fmaxf, (float x, float y)) {
return fputil::fmax(x, y);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/generic/fmaxl.cpp b/libc/src/math/generic/fmaxl.cpp
index 2a95c983de9393a..6c6250736f4f185 100644
--- a/libc/src/math/generic/fmaxl.cpp
+++ b/libc/src/math/generic/fmaxl.cpp
@@ -10,10 +10,10 @@
#include "src/__support/FPUtil/BasicOperations.h"
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(long double, fmaxl, (long double x, long double y)) {
return fputil::fmax(x, y);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/generic/fmin.cpp b/libc/src/math/generic/fmin.cpp
index d06c8a649516e61..b9f313d5716358b 100644
--- a/libc/src/math/generic/fmin.cpp
+++ b/libc/src/math/generic/fmin.cpp
@@ -10,10 +10,10 @@
#include "src/__support/FPUtil/BasicOperations.h"
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(double, fmin, (double x, double y)) {
return fputil::fmin(x, y);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/generic/fminf.cpp b/libc/src/math/generic/fminf.cpp
index 658f1474919aa7a..539fedbdd2fa255 100644
--- a/libc/src/math/generic/fminf.cpp
+++ b/libc/src/math/generic/fminf.cpp
@@ -10,10 +10,10 @@
#include "src/__support/FPUtil/BasicOperations.h"
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(float, fminf, (float x, float y)) {
return fputil::fmin(x, y);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/generic/fminl.cpp b/libc/src/math/generic/fminl.cpp
index 2f10c8472d6af96..147f6c562c52c71 100644
--- a/libc/src/math/generic/fminl.cpp
+++ b/libc/src/math/generic/fminl.cpp
@@ -10,10 +10,10 @@
#include "src/__support/FPUtil/BasicOperations.h"
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(long double, fminl, (long double x, long double y)) {
return fputil::fmin(x, y);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/generic/fmod.cpp b/libc/src/math/generic/fmod.cpp
index 563a1644aa75d07..69e0c8dd99169c4 100644
--- a/libc/src/math/generic/fmod.cpp
+++ b/libc/src/math/generic/fmod.cpp
@@ -10,10 +10,10 @@
#include "src/__support/FPUtil/generic/FMod.h"
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(double, fmod, (double x, double y)) {
return fputil::generic::FMod<double>::eval(x, y);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/generic/fmodf.cpp b/libc/src/math/generic/fmodf.cpp
index dca476c183b0c4e..7a29ff1f18d319d 100644
--- a/libc/src/math/generic/fmodf.cpp
+++ b/libc/src/math/generic/fmodf.cpp
@@ -10,10 +10,10 @@
#include "src/__support/FPUtil/generic/FMod.h"
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(float, fmodf, (float x, float y)) {
return fputil::generic::FMod<float>::eval(x, y);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/generic/frexp.cpp b/libc/src/math/generic/frexp.cpp
index c31526b78d45f31..a183ba70cfc3e71 100644
--- a/libc/src/math/generic/frexp.cpp
+++ b/libc/src/math/generic/frexp.cpp
@@ -10,10 +10,10 @@
#include "src/__support/FPUtil/ManipulationFunctions.h"
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(double, frexp, (double x, int *exp)) {
return fputil::frexp(x, *exp);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/generic/frexpf.cpp b/libc/src/math/generic/frexpf.cpp
index 2185e479fd656e3..4fdc869907ca098 100644
--- a/libc/src/math/generic/frexpf.cpp
+++ b/libc/src/math/generic/frexpf.cpp
@@ -10,10 +10,10 @@
#include "src/__support/FPUtil/ManipulationFunctions.h"
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(float, frexpf, (float x, int *exp)) {
return fputil::frexp(x, *exp);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/generic/frexpl.cpp b/libc/src/math/generic/frexpl.cpp
index 4573065ad5b1efe..0be4e744b2d34b4 100644
--- a/libc/src/math/generic/frexpl.cpp
+++ b/libc/src/math/generic/frexpl.cpp
@@ -10,10 +10,10 @@
#include "src/__support/FPUtil/ManipulationFunctions.h"
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(long double, frexpl, (long double x, int *exp)) {
return fputil::frexp(x, *exp);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/generic/hypot.cpp b/libc/src/math/generic/hypot.cpp
index 9bd27559320c3f4..a1914d0e823c838 100644
--- a/libc/src/math/generic/hypot.cpp
+++ b/libc/src/math/generic/hypot.cpp
@@ -10,10 +10,10 @@
#include "src/__support/FPUtil/Hypot.h"
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(double, hypot, (double x, double y)) {
- return __llvm_libc::fputil::hypot(x, y);
+ return LIBC_NAMESPACE::fputil::hypot(x, y);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/generic/hypotf.cpp b/libc/src/math/generic/hypotf.cpp
index ffc892ee566f4ec..3fedeed4ed26b4e 100644
--- a/libc/src/math/generic/hypotf.cpp
+++ b/libc/src/math/generic/hypotf.cpp
@@ -11,7 +11,7 @@
#include "src/__support/FPUtil/sqrt.h"
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(float, hypotf, (float x, float y)) {
using DoubleBits = fputil::FPBits<double>;
@@ -70,4 +70,4 @@ LLVM_LIBC_FUNCTION(float, hypotf, (float x, float y)) {
return static_cast<float>(static_cast<double>(result));
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/generic/ilogb.cpp b/libc/src/math/generic/ilogb.cpp
index 296e3027992b4d5..4e5f7d9642b4aa4 100644
--- a/libc/src/math/generic/ilogb.cpp
+++ b/libc/src/math/generic/ilogb.cpp
@@ -10,8 +10,8 @@
#include "src/__support/FPUtil/ManipulationFunctions.h"
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, ilogb, (double x)) { return fputil::ilogb(x); }
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/generic/ilogbf.cpp b/libc/src/math/generic/ilogbf.cpp
index 476fc3e4883c595..ca15879bc25fe55 100644
--- a/libc/src/math/generic/ilogbf.cpp
+++ b/libc/src/math/generic/ilogbf.cpp
@@ -10,8 +10,8 @@
#include "src/__support/FPUtil/ManipulationFunctions.h"
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, ilogbf, (float x)) { return fputil::ilogb(x); }
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/generic/ilogbl.cpp b/libc/src/math/generic/ilogbl.cpp
index b08ee91eeb3b973..4c18daab1a53583 100644
--- a/libc/src/math/generic/ilogbl.cpp
+++ b/libc/src/math/generic/ilogbl.cpp
@@ -10,8 +10,8 @@
#include "src/__support/FPUtil/ManipulationFunctions.h"
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, ilogbl, (long double x)) { return fputil::ilogb(x); }
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/generic/inv_trigf_utils.cpp b/libc/src/math/generic/inv_trigf_utils.cpp
index d88fe6097a6f57c..8013c0470affb16 100644
--- a/libc/src/math/generic/inv_trigf_utils.cpp
+++ b/libc/src/math/generic/inv_trigf_utils.cpp
@@ -8,7 +8,7 @@
#include "inv_trigf_utils.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
// N[Table[ArcTan[x], {x, 1/16, 16/16, 1/16}], 40]
alignas(64) const double ATAN_T[ATAN_T_SIZE] = {
@@ -25,4 +25,4 @@ alignas(64) const double ATAN_K[5] = {
0x1.0000000000000p+0, -0x1.5555555555555p-2, 0x1.999999999999ap-3,
-0x1.2492492492492p-3, 0x1.c71c71c71c71cp-4};
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/generic/inv_trigf_utils.h b/libc/src/math/generic/inv_trigf_utils.h
index 53763d484b8537f..c88ded20b5bf24f 100644
--- a/libc/src/math/generic/inv_trigf_utils.h
+++ b/libc/src/math/generic/inv_trigf_utils.h
@@ -18,7 +18,7 @@
#include <errno.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
// PI and PI / 2
constexpr double M_MATH_PI = 0x1.921fb54442d18p+1;
@@ -54,16 +54,16 @@ LIBC_INLINE double atan_eval(double x) {
auto x_abs = bs.uintval() & FPB::FloatProp::EXP_MANT_MASK;
if (x_abs <= umin) {
- double pe = __llvm_libc::fputil::polyeval(x * x, 0.0, ATAN_K[1], ATAN_K[2],
- ATAN_K[3], ATAN_K[4]);
+ double pe = LIBC_NAMESPACE::fputil::polyeval(
+ x * x, 0.0, ATAN_K[1], ATAN_K[2], ATAN_K[3], ATAN_K[4]);
return fputil::multiply_add(pe, x, x);
}
if (x_abs >= umax) {
double one_over_x_m = -1.0 / x;
double one_over_x2 = one_over_x_m * one_over_x_m;
- double pe = __llvm_libc::fputil::polyeval(one_over_x2, ATAN_K[0], ATAN_K[1],
- ATAN_K[2], ATAN_K[3]);
+ double pe = LIBC_NAMESPACE::fputil::polyeval(
+ one_over_x2, ATAN_K[0], ATAN_K[1], ATAN_K[2], ATAN_K[3]);
return fputil::multiply_add(pe, one_over_x_m, sign ? (-M_MATH_PI_2) : (M_MATH_PI_2));
}
@@ -79,8 +79,8 @@ LIBC_INLINE double atan_eval(double x) {
double v = (pos_x - near_x) / fputil::multiply_add(near_x, pos_x, 1.0);
double v2 = v * v;
- double pe = __llvm_libc::fputil::polyeval(v2, ATAN_K[0], ATAN_K[1], ATAN_K[2],
- ATAN_K[3], ATAN_K[4]);
+ double pe = LIBC_NAMESPACE::fputil::polyeval(v2, ATAN_K[0], ATAN_K[1],
+ ATAN_K[2], ATAN_K[3], ATAN_K[4]);
double result;
if (one_over_x)
result = M_MATH_PI_2 - fputil::multiply_add(pe, v, ATAN_T[val - 1]);
@@ -107,6 +107,6 @@ LIBC_INLINE double asin_eval(double xsq) {
return fputil::multiply_add(xsq, r2, r1);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_MATH_GENERIC_INV_TRIGF_UTILS_H
diff --git a/libc/src/math/generic/ldexp.cpp b/libc/src/math/generic/ldexp.cpp
index 775aa7be9404ea5..18aae09036409f0 100644
--- a/libc/src/math/generic/ldexp.cpp
+++ b/libc/src/math/generic/ldexp.cpp
@@ -10,10 +10,10 @@
#include "src/__support/FPUtil/ManipulationFunctions.h"
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(double, ldexp, (double x, int exp)) {
return fputil::ldexp(x, exp);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/generic/ldexpf.cpp b/libc/src/math/generic/ldexpf.cpp
index 24450cc0ce51a25..37f88ab2da00c38 100644
--- a/libc/src/math/generic/ldexpf.cpp
+++ b/libc/src/math/generic/ldexpf.cpp
@@ -10,10 +10,10 @@
#include "src/__support/FPUtil/ManipulationFunctions.h"
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(float, ldexpf, (float x, int exp)) {
return fputil::ldexp(x, exp);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/generic/ldexpl.cpp b/libc/src/math/generic/ldexpl.cpp
index df146cb51a23ccb..8b29009fa1aa499 100644
--- a/libc/src/math/generic/ldexpl.cpp
+++ b/libc/src/math/generic/ldexpl.cpp
@@ -10,10 +10,10 @@
#include "src/__support/FPUtil/ManipulationFunctions.h"
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(long double, ldexpl, (long double x, int exp)) {
return fputil::ldexp(x, exp);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/generic/llrint.cpp b/libc/src/math/generic/llrint.cpp
index 66097f88e5abc83..87755e83fececd4 100644
--- a/libc/src/math/generic/llrint.cpp
+++ b/libc/src/math/generic/llrint.cpp
@@ -10,7 +10,7 @@
#include "src/__support/FPUtil/NearestIntegerOperations.h"
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(long long, llrint, (double x)) {
return fputil::round_to_signed_integer_using_current_rounding_mode<double,
@@ -18,4 +18,4 @@ LLVM_LIBC_FUNCTION(long long, llrint, (double x)) {
x);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/generic/llrintf.cpp b/libc/src/math/generic/llrintf.cpp
index a4ae5721b77bb45..836e7cb6cdfb0bb 100644
--- a/libc/src/math/generic/llrintf.cpp
+++ b/libc/src/math/generic/llrintf.cpp
@@ -10,7 +10,7 @@
#include "src/__support/FPUtil/NearestIntegerOperations.h"
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(long long, llrintf, (float x)) {
return fputil::round_to_signed_integer_using_current_rounding_mode<float,
@@ -18,4 +18,4 @@ LLVM_LIBC_FUNCTION(long long, llrintf, (float x)) {
x);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/generic/llrintl.cpp b/libc/src/math/generic/llrintl.cpp
index 9d02b7411b89372..104e3d4ce9204ba 100644
--- a/libc/src/math/generic/llrintl.cpp
+++ b/libc/src/math/generic/llrintl.cpp
@@ -10,11 +10,11 @@
#include "src/__support/FPUtil/NearestIntegerOperations.h"
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(long long, llrintl, (long double x)) {
return fputil::round_to_signed_integer_using_current_rounding_mode<
long double, long long>(x);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/generic/llround.cpp b/libc/src/math/generic/llround.cpp
index b3dfd2f8783e07a..41bee8520ac2e1b 100644
--- a/libc/src/math/generic/llround.cpp
+++ b/libc/src/math/generic/llround.cpp
@@ -10,10 +10,10 @@
#include "src/__support/FPUtil/NearestIntegerOperations.h"
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(long long, llround, (double x)) {
return fputil::round_to_signed_integer<double, long long>(x);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/generic/llroundf.cpp b/libc/src/math/generic/llroundf.cpp
index 8784b0c0d69327f..67105e8d1f6bc27 100644
--- a/libc/src/math/generic/llroundf.cpp
+++ b/libc/src/math/generic/llroundf.cpp
@@ -10,10 +10,10 @@
#include "src/__support/FPUtil/NearestIntegerOperations.h"
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(long long, llroundf, (float x)) {
return fputil::round_to_signed_integer<float, long long>(x);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/generic/llroundl.cpp b/libc/src/math/generic/llroundl.cpp
index 30dec140e15598c..98cfb3690659c83 100644
--- a/libc/src/math/generic/llroundl.cpp
+++ b/libc/src/math/generic/llroundl.cpp
@@ -10,10 +10,10 @@
#include "src/__support/FPUtil/NearestIntegerOperations.h"
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(long long, llroundl, (long double x)) {
return fputil::round_to_signed_integer<long double, long long>(x);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/generic/log.cpp b/libc/src/math/generic/log.cpp
index 54fe9704f1cf125..46b64df689086d5 100644
--- a/libc/src/math/generic/log.cpp
+++ b/libc/src/math/generic/log.cpp
@@ -19,7 +19,7 @@
#include "common_constants.h"
#include "log_range_reduction.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
// 128-bit precision dyadic floating point numbers.
using Float128 = typename fputil::DyadicFloat<128>;
@@ -832,4 +832,4 @@ LLVM_LIBC_FUNCTION(double, log, (double x)) {
return log_accurate(x_e, index, u);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/generic/log10.cpp b/libc/src/math/generic/log10.cpp
index b68ed5c6bc32eb0..38789acc441e5b5 100644
--- a/libc/src/math/generic/log10.cpp
+++ b/libc/src/math/generic/log10.cpp
@@ -19,7 +19,7 @@
#include "common_constants.h"
#include "log_range_reduction.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
// 128-bit precision dyadic floating point numbers.
using Float128 = typename fputil::DyadicFloat<128>;
@@ -892,4 +892,4 @@ LLVM_LIBC_FUNCTION(double, log10, (double x)) {
return log10_accurate(x_e, index, u);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/generic/log10f.cpp b/libc/src/math/generic/log10f.cpp
index 812850aff1235fa..bc9af75169b14b4 100644
--- a/libc/src/math/generic/log10f.cpp
+++ b/libc/src/math/generic/log10f.cpp
@@ -54,7 +54,7 @@
// Dept. of Comp. Sci., Rutgets U., Technical Report DCS-TR-758, Nov. 2021.
// https://arxiv.org/pdf/2111.12852.pdf.
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
// Lookup table for -log10(r) where r is defined in common_constants.cpp.
static constexpr double LOG10_R[128] = {
@@ -213,4 +213,4 @@ LLVM_LIBC_FUNCTION(float, log10f, (float x)) {
return static_cast<float>(r);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/generic/log1p.cpp b/libc/src/math/generic/log1p.cpp
index 26e314c0a98f04d..c6ee8d8f9bbfbb8 100644
--- a/libc/src/math/generic/log1p.cpp
+++ b/libc/src/math/generic/log1p.cpp
@@ -18,7 +18,7 @@
#include "common_constants.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
// 128-bit precision dyadic floating point numbers.
using Float128 = typename fputil::DyadicFloat<128>;
@@ -1034,4 +1034,4 @@ LLVM_LIBC_FUNCTION(double, log1p, (double x)) {
return log1p_accurate(x_e, idx, v_dd);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/generic/log1pf.cpp b/libc/src/math/generic/log1pf.cpp
index a7ca54887d59af6..d479130c5681aad 100644
--- a/libc/src/math/generic/log1pf.cpp
+++ b/libc/src/math/generic/log1pf.cpp
@@ -30,7 +30,7 @@
// generated with Sollya using the following command:
// fpminimax(log(1 + x)/x, 7, [|D...|], [-2^-6; 2^-6]);
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
namespace internal {
@@ -153,4 +153,4 @@ LLVM_LIBC_FUNCTION(float, log1pf, (float x)) {
return static_cast<float>(r);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/generic/log2.cpp b/libc/src/math/generic/log2.cpp
index 7ba239b00e3f839..d72b0931c14b81b 100644
--- a/libc/src/math/generic/log2.cpp
+++ b/libc/src/math/generic/log2.cpp
@@ -19,7 +19,7 @@
#include "common_constants.h"
#include "log_range_reduction.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
// 128-bit precision dyadic floating point numbers.
using Float128 = typename fputil::DyadicFloat<128>;
@@ -954,4 +954,4 @@ LLVM_LIBC_FUNCTION(double, log2, (double x)) {
return log2_accurate(x_e, index, u);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/generic/log2f.cpp b/libc/src/math/generic/log2f.cpp
index c48b8c99bc70be1..cbb71fb91b10705 100644
--- a/libc/src/math/generic/log2f.cpp
+++ b/libc/src/math/generic/log2f.cpp
@@ -51,7 +51,7 @@
// Dept. of Comp. Sci., Rutgets U., Technical Report DCS-TR-758, Nov. 2021.
// https://arxiv.org/pdf/2111.12852.pdf.
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
// Lookup table for log2(f) = log2(1 + n*2^(-7)) where n = 0..127.
static constexpr double LOG2_R[128] = {
@@ -164,4 +164,4 @@ LLVM_LIBC_FUNCTION(float, log2f, (float x)) {
return static_cast<float>(r);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/generic/log_range_reduction.h b/libc/src/math/generic/log_range_reduction.h
index c4dd649cc57375d..f04012c1d583767 100644
--- a/libc/src/math/generic/log_range_reduction.h
+++ b/libc/src/math/generic/log_range_reduction.h
@@ -13,7 +13,7 @@
#include "src/__support/FPUtil/dyadic_float.h"
#include "src/__support/UInt128.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
// Struct to store -log*(r) for 4 range reduction steps.
struct LogRR {
@@ -87,6 +87,6 @@ log_range_reduction(double m_x, const LogRR &log_table,
static_cast<uint64_t>(vv4 >> 64)}));
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_MATH_GENERIC_LOG_RANGE_REDUCTION_H
diff --git a/libc/src/math/generic/logb.cpp b/libc/src/math/generic/logb.cpp
index eef428aba8aba48..8cd6edce05c23f1 100644
--- a/libc/src/math/generic/logb.cpp
+++ b/libc/src/math/generic/logb.cpp
@@ -10,8 +10,8 @@
#include "src/__support/FPUtil/ManipulationFunctions.h"
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(double, logb, (double x)) { return fputil::logb(x); }
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/generic/logbf.cpp b/libc/src/math/generic/logbf.cpp
index 1b1241b2982dec4..78aa33ebbf4a955 100644
--- a/libc/src/math/generic/logbf.cpp
+++ b/libc/src/math/generic/logbf.cpp
@@ -10,8 +10,8 @@
#include "src/__support/FPUtil/ManipulationFunctions.h"
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(float, logbf, (float x)) { return fputil::logb(x); }
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/generic/logbl.cpp b/libc/src/math/generic/logbl.cpp
index 7f4dc08ed536e00..f18c3727a3168a8 100644
--- a/libc/src/math/generic/logbl.cpp
+++ b/libc/src/math/generic/logbl.cpp
@@ -10,10 +10,10 @@
#include "src/__support/FPUtil/ManipulationFunctions.h"
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(long double, logbl, (long double x)) {
return fputil::logb(x);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/generic/logf.cpp b/libc/src/math/generic/logf.cpp
index 73634e009c74e96..1f689f25931d4e8 100644
--- a/libc/src/math/generic/logf.cpp
+++ b/libc/src/math/generic/logf.cpp
@@ -49,7 +49,7 @@
// USA, January 16-22, 2022.
// https://people.cs.rutgers.edu/~sn349/papers/rlibmall-popl-2022.pdf
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(float, logf, (float x)) {
constexpr double LOG_2 = 0x1.62e42fefa39efp-1;
@@ -169,4 +169,4 @@ LLVM_LIBC_FUNCTION(float, logf, (float x)) {
return static_cast<float>(r);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/generic/lrint.cpp b/libc/src/math/generic/lrint.cpp
index 162fa03e419efb3..59fde7b5018d32e 100644
--- a/libc/src/math/generic/lrint.cpp
+++ b/libc/src/math/generic/lrint.cpp
@@ -10,11 +10,11 @@
#include "src/__support/FPUtil/NearestIntegerOperations.h"
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(long, lrint, (double x)) {
return fputil::round_to_signed_integer_using_current_rounding_mode<double,
long>(x);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/generic/lrintf.cpp b/libc/src/math/generic/lrintf.cpp
index 6444ecc2c346930..e92014c79bdc441 100644
--- a/libc/src/math/generic/lrintf.cpp
+++ b/libc/src/math/generic/lrintf.cpp
@@ -10,11 +10,11 @@
#include "src/__support/FPUtil/NearestIntegerOperations.h"
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(long, lrintf, (float x)) {
return fputil::round_to_signed_integer_using_current_rounding_mode<float,
long>(x);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/generic/lrintl.cpp b/libc/src/math/generic/lrintl.cpp
index 3fcd97cc6d19ffd..b363aacb39bb329 100644
--- a/libc/src/math/generic/lrintl.cpp
+++ b/libc/src/math/generic/lrintl.cpp
@@ -10,11 +10,11 @@
#include "src/__support/FPUtil/NearestIntegerOperations.h"
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(long, lrintl, (long double x)) {
return fputil::round_to_signed_integer_using_current_rounding_mode<
long double, long>(x);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/generic/lround.cpp b/libc/src/math/generic/lround.cpp
index 413c06ff736fa2b..a22d8723bdbac29 100644
--- a/libc/src/math/generic/lround.cpp
+++ b/libc/src/math/generic/lround.cpp
@@ -10,10 +10,10 @@
#include "src/__support/FPUtil/NearestIntegerOperations.h"
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(long, lround, (double x)) {
return fputil::round_to_signed_integer<double, long>(x);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/generic/lroundf.cpp b/libc/src/math/generic/lroundf.cpp
index 919ae35aa0065b6..40c1323fafd6233 100644
--- a/libc/src/math/generic/lroundf.cpp
+++ b/libc/src/math/generic/lroundf.cpp
@@ -10,10 +10,10 @@
#include "src/__support/FPUtil/NearestIntegerOperations.h"
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(long, lroundf, (float x)) {
return fputil::round_to_signed_integer<float, long>(x);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/generic/lroundl.cpp b/libc/src/math/generic/lroundl.cpp
index 9ffa36e0c7a0b32..c0c3bde4e285ab5 100644
--- a/libc/src/math/generic/lroundl.cpp
+++ b/libc/src/math/generic/lroundl.cpp
@@ -10,10 +10,10 @@
#include "src/__support/FPUtil/NearestIntegerOperations.h"
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(long, lroundl, (long double x)) {
return fputil::round_to_signed_integer<long double, long>(x);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/generic/math_utils.cpp b/libc/src/math/generic/math_utils.cpp
index cc922f73fbb45a8..14bbb2babc60a7c 100644
--- a/libc/src/math/generic/math_utils.cpp
+++ b/libc/src/math/generic/math_utils.cpp
@@ -8,7 +8,7 @@
#include "math_utils.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
constexpr float XFlowValues<float>::OVERFLOW_VALUE = 0x1p97f;
constexpr float XFlowValues<float>::UNDERFLOW_VALUE = 0x1p-95f;
@@ -18,4 +18,4 @@ constexpr double XFlowValues<double>::OVERFLOW_VALUE = 0x1p769;
constexpr double XFlowValues<double>::UNDERFLOW_VALUE = 0x1p-767;
constexpr double XFlowValues<double>::MAY_UNDERFLOW_VALUE = 0x1.8p-538;
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/generic/math_utils.h b/libc/src/math/generic/math_utils.h
index f286c9ce9faedd5..38a14a47e88fa53 100644
--- a/libc/src/math/generic/math_utils.h
+++ b/libc/src/math/generic/math_utils.h
@@ -18,7 +18,7 @@
#include <stdint.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LIBC_INLINE uint32_t as_uint32_bits(float x) {
return cpp::bit_cast<uint32_t>(x);
@@ -102,6 +102,6 @@ LIBC_INLINE constexpr float invalid(T x) {
return isnan(x) ? y : with_errno(y, EDOM);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_MATH_GENERIC_MATH_UTILS_H
diff --git a/libc/src/math/generic/modf.cpp b/libc/src/math/generic/modf.cpp
index 2c4f051234c14ca..d465d194cc64c4f 100644
--- a/libc/src/math/generic/modf.cpp
+++ b/libc/src/math/generic/modf.cpp
@@ -10,10 +10,10 @@
#include "src/__support/FPUtil/ManipulationFunctions.h"
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(double, modf, (double x, double *iptr)) {
return fputil::modf(x, *iptr);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/generic/modff.cpp b/libc/src/math/generic/modff.cpp
index a979cffeb96901e..daa6697cb62da47 100644
--- a/libc/src/math/generic/modff.cpp
+++ b/libc/src/math/generic/modff.cpp
@@ -10,10 +10,10 @@
#include "src/__support/FPUtil/ManipulationFunctions.h"
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(float, modff, (float x, float *iptr)) {
return fputil::modf(x, *iptr);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/generic/modfl.cpp b/libc/src/math/generic/modfl.cpp
index 535c31981f17a37..3271da2953dbdc0 100644
--- a/libc/src/math/generic/modfl.cpp
+++ b/libc/src/math/generic/modfl.cpp
@@ -10,10 +10,10 @@
#include "src/__support/FPUtil/ManipulationFunctions.h"
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(long double, modfl, (long double x, long double *iptr)) {
return fputil::modf(x, *iptr);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/generic/nearbyint.cpp b/libc/src/math/generic/nearbyint.cpp
index b1becee4dd094c1..20cbf6c0e701aa4 100644
--- a/libc/src/math/generic/nearbyint.cpp
+++ b/libc/src/math/generic/nearbyint.cpp
@@ -10,10 +10,10 @@
#include "src/__support/FPUtil/NearestIntegerOperations.h"
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(double, nearbyint, (double x)) {
return fputil::round_using_current_rounding_mode(x);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/generic/nearbyintf.cpp b/libc/src/math/generic/nearbyintf.cpp
index 1b0c2cc0aa62933..5fb103388d262e7 100644
--- a/libc/src/math/generic/nearbyintf.cpp
+++ b/libc/src/math/generic/nearbyintf.cpp
@@ -10,10 +10,10 @@
#include "src/__support/FPUtil/NearestIntegerOperations.h"
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(float, nearbyintf, (float x)) {
return fputil::round_using_current_rounding_mode(x);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/generic/nearbyintl.cpp b/libc/src/math/generic/nearbyintl.cpp
index 75eb49e5692b027..9cbff0169b9b184 100644
--- a/libc/src/math/generic/nearbyintl.cpp
+++ b/libc/src/math/generic/nearbyintl.cpp
@@ -10,10 +10,10 @@
#include "src/__support/FPUtil/NearestIntegerOperations.h"
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(long double, nearbyintl, (long double x)) {
return fputil::round_using_current_rounding_mode(x);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/generic/nextafter.cpp b/libc/src/math/generic/nextafter.cpp
index 3566cd6b4518452..57a58b10be9116c 100644
--- a/libc/src/math/generic/nextafter.cpp
+++ b/libc/src/math/generic/nextafter.cpp
@@ -10,10 +10,10 @@
#include "src/__support/FPUtil/ManipulationFunctions.h"
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(double, nextafter, (double x, double y)) {
return fputil::nextafter(x, y);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/generic/nextafterf.cpp b/libc/src/math/generic/nextafterf.cpp
index 07dabdcd0807fe7..dd09fb7f900cf74 100644
--- a/libc/src/math/generic/nextafterf.cpp
+++ b/libc/src/math/generic/nextafterf.cpp
@@ -10,10 +10,10 @@
#include "src/__support/FPUtil/ManipulationFunctions.h"
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(float, nextafterf, (float x, float y)) {
return fputil::nextafter(x, y);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/generic/nextafterl.cpp b/libc/src/math/generic/nextafterl.cpp
index 6e5c3698a24d133..e12ad040b5659db 100644
--- a/libc/src/math/generic/nextafterl.cpp
+++ b/libc/src/math/generic/nextafterl.cpp
@@ -10,10 +10,10 @@
#include "src/__support/FPUtil/ManipulationFunctions.h"
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(long double, nextafterl, (long double x, long double y)) {
return fputil::nextafter(x, y);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/generic/range_reduction.h b/libc/src/math/generic/range_reduction.h
index f620bcda0948f8f..551f2457ecb8e33 100644
--- a/libc/src/math/generic/range_reduction.h
+++ b/libc/src/math/generic/range_reduction.h
@@ -14,7 +14,7 @@
#include "src/__support/FPUtil/nearest_integer.h"
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
namespace generic {
@@ -84,6 +84,6 @@ LIBC_INLINE int64_t large_range_reduction(double x, int x_exp, double &y) {
} // namespace generic
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_MATH_GENERIC_RANGE_REDUCTION_H
diff --git a/libc/src/math/generic/range_reduction_fma.h b/libc/src/math/generic/range_reduction_fma.h
index 79c076d265c6710..13a7360b4233289 100644
--- a/libc/src/math/generic/range_reduction_fma.h
+++ b/libc/src/math/generic/range_reduction_fma.h
@@ -14,7 +14,7 @@
#include "src/__support/FPUtil/nearest_integer.h"
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
namespace fma {
@@ -84,6 +84,6 @@ LIBC_INLINE int64_t large_range_reduction(double x, int x_exp, double &y) {
} // namespace fma
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_MATH_GENERIC_RANGE_REDUCTION_FMA_H
diff --git a/libc/src/math/generic/remainder.cpp b/libc/src/math/generic/remainder.cpp
index 149f45874978d1c..3703a32057751aa 100644
--- a/libc/src/math/generic/remainder.cpp
+++ b/libc/src/math/generic/remainder.cpp
@@ -10,11 +10,11 @@
#include "src/__support/FPUtil/DivisionAndRemainderOperations.h"
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(double, remainder, (double x, double y)) {
int quotient;
return fputil::remquo(x, y, quotient);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/generic/remainderf.cpp b/libc/src/math/generic/remainderf.cpp
index 9de40b23dce4cde..5e8c5e9996b690a 100644
--- a/libc/src/math/generic/remainderf.cpp
+++ b/libc/src/math/generic/remainderf.cpp
@@ -10,11 +10,11 @@
#include "src/__support/FPUtil/DivisionAndRemainderOperations.h"
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(float, remainderf, (float x, float y)) {
int quotient;
return fputil::remquo(x, y, quotient);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/generic/remainderl.cpp b/libc/src/math/generic/remainderl.cpp
index 1360ae70137aae6..def5d4b6fdb98a6 100644
--- a/libc/src/math/generic/remainderl.cpp
+++ b/libc/src/math/generic/remainderl.cpp
@@ -10,11 +10,11 @@
#include "src/__support/FPUtil/DivisionAndRemainderOperations.h"
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(long double, remainderl, (long double x, long double y)) {
int quotient;
return fputil::remquo(x, y, quotient);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/generic/remquo.cpp b/libc/src/math/generic/remquo.cpp
index 905547cca0e1d6a..bd88742e5a5c29e 100644
--- a/libc/src/math/generic/remquo.cpp
+++ b/libc/src/math/generic/remquo.cpp
@@ -10,10 +10,10 @@
#include "src/__support/FPUtil/DivisionAndRemainderOperations.h"
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(double, remquo, (double x, double y, int *exp)) {
return fputil::remquo(x, y, *exp);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/generic/remquof.cpp b/libc/src/math/generic/remquof.cpp
index d4232db52b7ee19..b59606f6266fa4c 100644
--- a/libc/src/math/generic/remquof.cpp
+++ b/libc/src/math/generic/remquof.cpp
@@ -10,10 +10,10 @@
#include "src/__support/FPUtil/DivisionAndRemainderOperations.h"
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(float, remquof, (float x, float y, int *exp)) {
return fputil::remquo(x, y, *exp);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/generic/remquol.cpp b/libc/src/math/generic/remquol.cpp
index 3756a05a9ac036f..7a08af36a475332 100644
--- a/libc/src/math/generic/remquol.cpp
+++ b/libc/src/math/generic/remquol.cpp
@@ -10,11 +10,11 @@
#include "src/__support/FPUtil/DivisionAndRemainderOperations.h"
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(long double, remquol,
(long double x, long double y, int *exp)) {
return fputil::remquo(x, y, *exp);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/generic/rint.cpp b/libc/src/math/generic/rint.cpp
index 9427b6ffce47807..e3189ea48b56986 100644
--- a/libc/src/math/generic/rint.cpp
+++ b/libc/src/math/generic/rint.cpp
@@ -10,10 +10,10 @@
#include "src/__support/FPUtil/NearestIntegerOperations.h"
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(double, rint, (double x)) {
return fputil::round_using_current_rounding_mode(x);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/generic/rintf.cpp b/libc/src/math/generic/rintf.cpp
index 8c2e9c9ba700c5d..259a46f3765372e 100644
--- a/libc/src/math/generic/rintf.cpp
+++ b/libc/src/math/generic/rintf.cpp
@@ -10,10 +10,10 @@
#include "src/__support/FPUtil/NearestIntegerOperations.h"
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(float, rintf, (float x)) {
return fputil::round_using_current_rounding_mode(x);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/generic/rintl.cpp b/libc/src/math/generic/rintl.cpp
index 493d825e0468ac9..5110f238cb05ffb 100644
--- a/libc/src/math/generic/rintl.cpp
+++ b/libc/src/math/generic/rintl.cpp
@@ -10,10 +10,10 @@
#include "src/__support/FPUtil/NearestIntegerOperations.h"
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(long double, rintl, (long double x)) {
return fputil::round_using_current_rounding_mode(x);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/generic/round.cpp b/libc/src/math/generic/round.cpp
index b7366f723236cf3..ca8f19f35f7fe3d 100644
--- a/libc/src/math/generic/round.cpp
+++ b/libc/src/math/generic/round.cpp
@@ -10,8 +10,8 @@
#include "src/__support/FPUtil/NearestIntegerOperations.h"
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(double, round, (double x)) { return fputil::round(x); }
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/generic/roundf.cpp b/libc/src/math/generic/roundf.cpp
index bcdd61ea304d6d4..9627390ea8b8d83 100644
--- a/libc/src/math/generic/roundf.cpp
+++ b/libc/src/math/generic/roundf.cpp
@@ -10,8 +10,8 @@
#include "src/__support/FPUtil/NearestIntegerOperations.h"
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(float, roundf, (float x)) { return fputil::round(x); }
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/generic/roundl.cpp b/libc/src/math/generic/roundl.cpp
index 6c59c271c5addb6..c734225844079b3 100644
--- a/libc/src/math/generic/roundl.cpp
+++ b/libc/src/math/generic/roundl.cpp
@@ -10,10 +10,10 @@
#include "src/__support/FPUtil/NearestIntegerOperations.h"
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(long double, roundl, (long double x)) {
return fputil::round(x);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/generic/scalbn.cpp b/libc/src/math/generic/scalbn.cpp
index faccf6c378d618f..3908f5892f144fc 100644
--- a/libc/src/math/generic/scalbn.cpp
+++ b/libc/src/math/generic/scalbn.cpp
@@ -10,7 +10,7 @@
#include "src/__support/FPUtil/ManipulationFunctions.h"
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(double, scalbn, (double x, int n)) {
#if !defined(__FLT_RADIX__)
@@ -22,4 +22,4 @@ LLVM_LIBC_FUNCTION(double, scalbn, (double x, int n)) {
#endif
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/generic/scalbnf.cpp b/libc/src/math/generic/scalbnf.cpp
index 391da1f01cce244..4a4fa86dcfd895f 100644
--- a/libc/src/math/generic/scalbnf.cpp
+++ b/libc/src/math/generic/scalbnf.cpp
@@ -10,7 +10,7 @@
#include "src/__support/FPUtil/ManipulationFunctions.h"
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(float, scalbnf, (float x, int n)) {
#if !defined(__FLT_RADIX__)
@@ -22,4 +22,4 @@ LLVM_LIBC_FUNCTION(float, scalbnf, (float x, int n)) {
#endif
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/generic/scalbnl.cpp b/libc/src/math/generic/scalbnl.cpp
index 9ef6f230f410118..681338ec01f078e 100644
--- a/libc/src/math/generic/scalbnl.cpp
+++ b/libc/src/math/generic/scalbnl.cpp
@@ -10,7 +10,7 @@
#include "src/__support/FPUtil/ManipulationFunctions.h"
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(long double, scalbnl, (long double x, int n)) {
#if !defined(__FLT_RADIX__)
@@ -22,4 +22,4 @@ LLVM_LIBC_FUNCTION(long double, scalbnl, (long double x, int n)) {
#endif
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/generic/sincosf.cpp b/libc/src/math/generic/sincosf.cpp
index 1611567eef9779e..7ed1c4381078b1f 100644
--- a/libc/src/math/generic/sincosf.cpp
+++ b/libc/src/math/generic/sincosf.cpp
@@ -18,7 +18,7 @@
#include <errno.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
// Exceptional values
static constexpr int N_EXCEPTS = 6;
@@ -200,4 +200,4 @@ LLVM_LIBC_FUNCTION(void, sincosf, (float x, float *sinp, float *cosp)) {
sin_y, -sin_k, fputil::multiply_add(cosm1_y, cos_k, cos_k)));
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/generic/sincosf_utils.h b/libc/src/math/generic/sincosf_utils.h
index 2488f50720896ca..904df4f4ed08e17 100644
--- a/libc/src/math/generic/sincosf_utils.h
+++ b/libc/src/math/generic/sincosf_utils.h
@@ -15,19 +15,19 @@
#if defined(LIBC_TARGET_CPU_HAS_FMA)
#include "range_reduction_fma.h"
-// using namespace __llvm_libc::fma;
-using __llvm_libc::fma::FAST_PASS_BOUND;
-using __llvm_libc::fma::large_range_reduction;
-using __llvm_libc::fma::small_range_reduction;
+// using namespace LIBC_NAMESPACE::fma;
+using LIBC_NAMESPACE::fma::FAST_PASS_BOUND;
+using LIBC_NAMESPACE::fma::large_range_reduction;
+using LIBC_NAMESPACE::fma::small_range_reduction;
#else
#include "range_reduction.h"
-// using namespace __llvm_libc::generic;
-using __llvm_libc::generic::FAST_PASS_BOUND;
-using __llvm_libc::generic::large_range_reduction;
-using __llvm_libc::generic::small_range_reduction;
+// using namespace LIBC_NAMESPACE::generic;
+using LIBC_NAMESPACE::generic::FAST_PASS_BOUND;
+using LIBC_NAMESPACE::generic::large_range_reduction;
+using LIBC_NAMESPACE::generic::small_range_reduction;
#endif // LIBC_TARGET_CPU_HAS_FMA
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
// Lookup table for sin(k * pi / 32) with k = 0, ..., 63.
// Table is generated with Sollya as follow:
@@ -95,6 +95,6 @@ LIBC_INLINE void sincosf_eval(double xd, uint32_t x_abs, double &sin_k,
0x1.03c1f070c2e27p-18, -0x1.55cc84bd942p-30);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_MATH_GENERIC_SINCOSF_UTILS_H
diff --git a/libc/src/math/generic/sinf.cpp b/libc/src/math/generic/sinf.cpp
index 01d2f70e73568bb..6fc1abb83e2e7b9 100644
--- a/libc/src/math/generic/sinf.cpp
+++ b/libc/src/math/generic/sinf.cpp
@@ -26,7 +26,7 @@
#include "range_reduction.h"
#endif
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(float, sinf, (float x)) {
using FPBits = typename fputil::FPBits<float>;
@@ -155,4 +155,4 @@ LLVM_LIBC_FUNCTION(float, sinf, (float x)) {
sin_y, cos_k, fputil::multiply_add(cosm1_y, sin_k, sin_k)));
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/generic/sinhf.cpp b/libc/src/math/generic/sinhf.cpp
index 3ebfe6ba07009ea..4917b9980bc6618 100644
--- a/libc/src/math/generic/sinhf.cpp
+++ b/libc/src/math/generic/sinhf.cpp
@@ -12,7 +12,7 @@
#include "src/__support/macros/optimization.h" // LIBC_UNLIKELY
#include "src/math/generic/explogxf.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(float, sinhf, (float x)) {
using FPBits = typename fputil::FPBits<float>;
@@ -74,4 +74,4 @@ LLVM_LIBC_FUNCTION(float, sinhf, (float x)) {
return static_cast<float>(exp_pm_eval</*is_sinh*/ true>(x));
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/generic/sqrt.cpp b/libc/src/math/generic/sqrt.cpp
index de21f329e15abb5..b4d02785dcb43f8 100644
--- a/libc/src/math/generic/sqrt.cpp
+++ b/libc/src/math/generic/sqrt.cpp
@@ -10,8 +10,8 @@
#include "src/__support/FPUtil/sqrt.h"
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(double, sqrt, (double x)) { return fputil::sqrt(x); }
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/generic/sqrtf.cpp b/libc/src/math/generic/sqrtf.cpp
index 3ca8d381898bbc2..bc74252295b3a58 100644
--- a/libc/src/math/generic/sqrtf.cpp
+++ b/libc/src/math/generic/sqrtf.cpp
@@ -10,8 +10,8 @@
#include "src/__support/FPUtil/sqrt.h"
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(float, sqrtf, (float x)) { return fputil::sqrt(x); }
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/generic/sqrtl.cpp b/libc/src/math/generic/sqrtl.cpp
index 970646a2e4d1a9b..b2aaa279f9c2a16 100644
--- a/libc/src/math/generic/sqrtl.cpp
+++ b/libc/src/math/generic/sqrtl.cpp
@@ -10,10 +10,10 @@
#include "src/__support/FPUtil/sqrt.h"
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(long double, sqrtl, (long double x)) {
return fputil::sqrt(x);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/generic/tanf.cpp b/libc/src/math/generic/tanf.cpp
index 681f16177fde519..7909e9e5d5568a3 100644
--- a/libc/src/math/generic/tanf.cpp
+++ b/libc/src/math/generic/tanf.cpp
@@ -20,7 +20,7 @@
#include <errno.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
// Exceptional cases for tanf.
constexpr size_t N_EXCEPTS = 6;
@@ -139,4 +139,4 @@ LLVM_LIBC_FUNCTION(float, tanf, (float x)) {
multiply_add(sin_y, -sin_k, multiply_add(cosm1_y, cos_k, cos_k)));
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/generic/tanhf.cpp b/libc/src/math/generic/tanhf.cpp
index 1620e3704021677..7d9f86cf9044b23 100644
--- a/libc/src/math/generic/tanhf.cpp
+++ b/libc/src/math/generic/tanhf.cpp
@@ -15,7 +15,7 @@
#include "src/__support/macros/properties/cpu_features.h"
#include "src/math/generic/explogxf.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
// 2^6 * log2(e)
constexpr double LOG2_E_EXP2_6 = ExpBase::LOG2_B * 2.0;
@@ -118,4 +118,4 @@ LLVM_LIBC_FUNCTION(float, tanhf, (float x)) {
return static_cast<float>((r - mh) / (r + mh));
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/generic/trunc.cpp b/libc/src/math/generic/trunc.cpp
index 50220d9ebaf027a..d171ab1f092fd59 100644
--- a/libc/src/math/generic/trunc.cpp
+++ b/libc/src/math/generic/trunc.cpp
@@ -10,8 +10,8 @@
#include "src/__support/FPUtil/NearestIntegerOperations.h"
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(double, trunc, (double x)) { return fputil::trunc(x); }
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/generic/truncf.cpp b/libc/src/math/generic/truncf.cpp
index dc11d5eebf27cd7..93bfb7f2882a5e0 100644
--- a/libc/src/math/generic/truncf.cpp
+++ b/libc/src/math/generic/truncf.cpp
@@ -10,8 +10,8 @@
#include "src/__support/FPUtil/NearestIntegerOperations.h"
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(float, truncf, (float x)) { return fputil::trunc(x); }
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/generic/truncl.cpp b/libc/src/math/generic/truncl.cpp
index df5fc03af7e8935..3429129183100be 100644
--- a/libc/src/math/generic/truncl.cpp
+++ b/libc/src/math/generic/truncl.cpp
@@ -10,10 +10,10 @@
#include "src/__support/FPUtil/NearestIntegerOperations.h"
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(long double, truncl, (long double x)) {
return fputil::trunc(x);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/gpu/ceil.cpp b/libc/src/math/gpu/ceil.cpp
index 1e84f7acd6a31b9..ad1407d61f620a5 100644
--- a/libc/src/math/gpu/ceil.cpp
+++ b/libc/src/math/gpu/ceil.cpp
@@ -9,8 +9,8 @@
#include "src/math/ceil.h"
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(double, ceil, (double x)) { return __builtin_ceil(x); }
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/gpu/ceilf.cpp b/libc/src/math/gpu/ceilf.cpp
index 4979116d47f81b2..c4fc58d9360385f 100644
--- a/libc/src/math/gpu/ceilf.cpp
+++ b/libc/src/math/gpu/ceilf.cpp
@@ -9,8 +9,8 @@
#include "src/math/ceilf.h"
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(float, ceilf, (float x)) { return __builtin_ceilf(x); }
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/gpu/copysign.cpp b/libc/src/math/gpu/copysign.cpp
index b09c3e64cb5f14b..6f804bdb90a1f09 100644
--- a/libc/src/math/gpu/copysign.cpp
+++ b/libc/src/math/gpu/copysign.cpp
@@ -9,10 +9,10 @@
#include "src/math/copysign.h"
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(double, copysign, (double x, double y)) {
return __builtin_copysign(x, y);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/gpu/copysignf.cpp b/libc/src/math/gpu/copysignf.cpp
index fe3f451c47a5901..4d7e132462ac902 100644
--- a/libc/src/math/gpu/copysignf.cpp
+++ b/libc/src/math/gpu/copysignf.cpp
@@ -9,10 +9,10 @@
#include "src/math/copysignf.h"
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(float, copysignf, (float x, float y)) {
return __builtin_copysignf(x, y);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/gpu/fabs.cpp b/libc/src/math/gpu/fabs.cpp
index d8b0a54867bf3f0..c0d063d50ae53d6 100644
--- a/libc/src/math/gpu/fabs.cpp
+++ b/libc/src/math/gpu/fabs.cpp
@@ -9,8 +9,8 @@
#include "src/math/fabs.h"
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(double, fabs, (double x)) { return __builtin_fabs(x); }
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/gpu/fabsf.cpp b/libc/src/math/gpu/fabsf.cpp
index 64d7058eaa485e0..398ffd0c74c074c 100644
--- a/libc/src/math/gpu/fabsf.cpp
+++ b/libc/src/math/gpu/fabsf.cpp
@@ -9,8 +9,8 @@
#include "src/math/fabsf.h"
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(float, fabsf, (float x)) { return __builtin_fabsf(x); }
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/gpu/floor.cpp b/libc/src/math/gpu/floor.cpp
index 850c4ee6592ceb6..eada89c178d75c1 100644
--- a/libc/src/math/gpu/floor.cpp
+++ b/libc/src/math/gpu/floor.cpp
@@ -9,8 +9,8 @@
#include "src/math/floor.h"
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(double, floor, (double x)) { return __builtin_floor(x); }
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/gpu/floorf.cpp b/libc/src/math/gpu/floorf.cpp
index 22c8b731068d9d0..a5611c515a88d42 100644
--- a/libc/src/math/gpu/floorf.cpp
+++ b/libc/src/math/gpu/floorf.cpp
@@ -9,8 +9,8 @@
#include "src/math/floorf.h"
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(float, floorf, (float x)) { return __builtin_floorf(x); }
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/gpu/fma.cpp b/libc/src/math/gpu/fma.cpp
index f3803af1ceb0bec..41a6ddf60dbc359 100644
--- a/libc/src/math/gpu/fma.cpp
+++ b/libc/src/math/gpu/fma.cpp
@@ -9,10 +9,10 @@
#include "src/math/fma.h"
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(double, fma, (double x, double y, double z)) {
return __builtin_fma(x, y, z);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/gpu/fmaf.cpp b/libc/src/math/gpu/fmaf.cpp
index 48b52a84537e230..c948e32f77eb92a 100644
--- a/libc/src/math/gpu/fmaf.cpp
+++ b/libc/src/math/gpu/fmaf.cpp
@@ -9,10 +9,10 @@
#include "src/math/fmaf.h"
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(float, fmaf, (float x, float y, float z)) {
return __builtin_fmaf(x, y, z);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/gpu/fmax.cpp b/libc/src/math/gpu/fmax.cpp
index f3c255f61c09ee4..a2c35371d12b6ab 100644
--- a/libc/src/math/gpu/fmax.cpp
+++ b/libc/src/math/gpu/fmax.cpp
@@ -9,10 +9,10 @@
#include "src/math/fmax.h"
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(double, fmax, (double x, double y)) {
return __builtin_fmax(x, y);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/gpu/fmaxf.cpp b/libc/src/math/gpu/fmaxf.cpp
index f540b4c8a11c15c..67178b3e2735750 100644
--- a/libc/src/math/gpu/fmaxf.cpp
+++ b/libc/src/math/gpu/fmaxf.cpp
@@ -9,10 +9,10 @@
#include "src/math/fmaxf.h"
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(float, fmaxf, (float x, float y)) {
return __builtin_fmaxf(x, y);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/gpu/fmin.cpp b/libc/src/math/gpu/fmin.cpp
index d6e9859d7810efa..7303adcd347ee91 100644
--- a/libc/src/math/gpu/fmin.cpp
+++ b/libc/src/math/gpu/fmin.cpp
@@ -9,10 +9,10 @@
#include "src/math/fmin.h"
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(double, fmin, (double x, double y)) {
return __builtin_fmin(x, y);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/gpu/fminf.cpp b/libc/src/math/gpu/fminf.cpp
index 67b1862cdd4fd92..bbf0c677b5e3ae4 100644
--- a/libc/src/math/gpu/fminf.cpp
+++ b/libc/src/math/gpu/fminf.cpp
@@ -9,10 +9,10 @@
#include "src/math/fminf.h"
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(float, fminf, (float x, float y)) {
return __builtin_fminf(x, y);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/gpu/fmod.cpp b/libc/src/math/gpu/fmod.cpp
index 2ae5142722671ae..0654cdd2abe0816 100644
--- a/libc/src/math/gpu/fmod.cpp
+++ b/libc/src/math/gpu/fmod.cpp
@@ -9,10 +9,10 @@
#include "src/math/fmod.h"
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(double, fmod, (double x, double y)) {
return __builtin_fmod(x, y);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/gpu/fmodf.cpp b/libc/src/math/gpu/fmodf.cpp
index ad1db4906e3bc82..b689046468fbe50 100644
--- a/libc/src/math/gpu/fmodf.cpp
+++ b/libc/src/math/gpu/fmodf.cpp
@@ -9,10 +9,10 @@
#include "src/math/fmodf.h"
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(float, fmodf, (float x, float y)) {
return __builtin_fmodf(x, y);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/gpu/modf.cpp b/libc/src/math/gpu/modf.cpp
index b6b06da2dac0bb4..07dbbd6059c35f3 100644
--- a/libc/src/math/gpu/modf.cpp
+++ b/libc/src/math/gpu/modf.cpp
@@ -9,10 +9,10 @@
#include "src/math/modf.h"
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(double, modf, (double x, double *iptr)) {
return __builtin_modf(x, iptr);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/gpu/modff.cpp b/libc/src/math/gpu/modff.cpp
index b89c9c3b1c7d44e..ad35f9006b51224 100644
--- a/libc/src/math/gpu/modff.cpp
+++ b/libc/src/math/gpu/modff.cpp
@@ -9,10 +9,10 @@
#include "src/math/modff.h"
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(float, modff, (float x, float *iptr)) {
return __builtin_modff(x, iptr);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/gpu/nearbyint.cpp b/libc/src/math/gpu/nearbyint.cpp
index 35a4a8d5d7e9885..9c7b600df7082e6 100644
--- a/libc/src/math/gpu/nearbyint.cpp
+++ b/libc/src/math/gpu/nearbyint.cpp
@@ -9,10 +9,10 @@
#include "src/math/nearbyint.h"
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(double, nearbyint, (double x)) {
return __builtin_nearbyint(x);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/gpu/nearbyintf.cpp b/libc/src/math/gpu/nearbyintf.cpp
index e732b7c198f224c..7fbe9f4f0e0bee8 100644
--- a/libc/src/math/gpu/nearbyintf.cpp
+++ b/libc/src/math/gpu/nearbyintf.cpp
@@ -9,10 +9,10 @@
#include "src/math/nearbyintf.h"
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(float, nearbyintf, (float x)) {
return __builtin_nearbyintf(x);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/gpu/remainder.cpp b/libc/src/math/gpu/remainder.cpp
index af06432d3b911b4..89b235f9c22af32 100644
--- a/libc/src/math/gpu/remainder.cpp
+++ b/libc/src/math/gpu/remainder.cpp
@@ -9,10 +9,10 @@
#include "src/math/remainder.h"
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(double, remainder, (double x, double y)) {
return __builtin_remainder(x, y);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/gpu/remainderf.cpp b/libc/src/math/gpu/remainderf.cpp
index b0f9c8f88416378..9fee6f856dc8b7e 100644
--- a/libc/src/math/gpu/remainderf.cpp
+++ b/libc/src/math/gpu/remainderf.cpp
@@ -9,10 +9,10 @@
#include "src/math/remainderf.h"
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(float, remainderf, (float x, float y)) {
return __builtin_remainderf(x, y);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/gpu/rint.cpp b/libc/src/math/gpu/rint.cpp
index e21b469c4ee2b68..44d494a8ed57afb 100644
--- a/libc/src/math/gpu/rint.cpp
+++ b/libc/src/math/gpu/rint.cpp
@@ -9,8 +9,8 @@
#include "src/math/rint.h"
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(double, rint, (double x)) { return __builtin_rint(x); }
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/gpu/rintf.cpp b/libc/src/math/gpu/rintf.cpp
index 5e828372a503619..daf98d94360511f 100644
--- a/libc/src/math/gpu/rintf.cpp
+++ b/libc/src/math/gpu/rintf.cpp
@@ -9,8 +9,8 @@
#include "src/math/rintf.h"
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(float, rintf, (float x)) { return __builtin_rintf(x); }
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/gpu/round.cpp b/libc/src/math/gpu/round.cpp
index ab840ba605a2839..9d8b5582f0407a3 100644
--- a/libc/src/math/gpu/round.cpp
+++ b/libc/src/math/gpu/round.cpp
@@ -9,8 +9,8 @@
#include "src/math/round.h"
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(double, round, (double x)) { return __builtin_round(x); }
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/gpu/roundf.cpp b/libc/src/math/gpu/roundf.cpp
index 32d54b83746c129..8743e4eb7fb8d79 100644
--- a/libc/src/math/gpu/roundf.cpp
+++ b/libc/src/math/gpu/roundf.cpp
@@ -9,8 +9,8 @@
#include "src/math/roundf.h"
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(float, roundf, (float x)) { return __builtin_roundf(x); }
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/gpu/sinh.cpp b/libc/src/math/gpu/sinh.cpp
index 2946e4781ae6c70..054e046f2abd3b8 100644
--- a/libc/src/math/gpu/sinh.cpp
+++ b/libc/src/math/gpu/sinh.cpp
@@ -9,8 +9,8 @@
#include "src/math/sinh.h"
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(double, sinh, (double x)) { return __builtin_sinh(x); }
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/gpu/sinhf.cpp b/libc/src/math/gpu/sinhf.cpp
index 729f3bb49d3fccc..ed69dffe3ea831d 100644
--- a/libc/src/math/gpu/sinhf.cpp
+++ b/libc/src/math/gpu/sinhf.cpp
@@ -9,8 +9,8 @@
#include "src/math/sinhf.h"
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(float, sinhf, (float x)) { return __builtin_sinhf(x); }
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/gpu/sqrt.cpp b/libc/src/math/gpu/sqrt.cpp
index fe814c764b878cd..60ca5af4987b6c4 100644
--- a/libc/src/math/gpu/sqrt.cpp
+++ b/libc/src/math/gpu/sqrt.cpp
@@ -9,8 +9,8 @@
#include "src/math/sqrt.h"
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(double, sqrt, (double x)) { return __builtin_sqrt(x); }
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/gpu/sqrtf.cpp b/libc/src/math/gpu/sqrtf.cpp
index a712e455443471b..e17f942a4d5fcf6 100644
--- a/libc/src/math/gpu/sqrtf.cpp
+++ b/libc/src/math/gpu/sqrtf.cpp
@@ -9,8 +9,8 @@
#include "src/math/sqrtf.h"
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(float, sqrtf, (float x)) { return __builtin_sqrtf(x); }
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/gpu/tan.cpp b/libc/src/math/gpu/tan.cpp
index 81f04a2b857b627..d02b1063561246d 100644
--- a/libc/src/math/gpu/tan.cpp
+++ b/libc/src/math/gpu/tan.cpp
@@ -9,8 +9,8 @@
#include "src/math/tan.h"
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(double, tan, (double x)) { return __builtin_tan(x); }
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/gpu/tanf.cpp b/libc/src/math/gpu/tanf.cpp
index 32af444959a06f4..da7bd54ab08ae30 100644
--- a/libc/src/math/gpu/tanf.cpp
+++ b/libc/src/math/gpu/tanf.cpp
@@ -9,8 +9,8 @@
#include "src/math/tanf.h"
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(float, tanf, (float x)) { return __builtin_tanf(x); }
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/gpu/tanh.cpp b/libc/src/math/gpu/tanh.cpp
index c5872580988621e..778e883acba0448 100644
--- a/libc/src/math/gpu/tanh.cpp
+++ b/libc/src/math/gpu/tanh.cpp
@@ -9,8 +9,8 @@
#include "src/math/tanh.h"
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(double, tanh, (double x)) { return __builtin_tanh(x); }
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/gpu/tanhf.cpp b/libc/src/math/gpu/tanhf.cpp
index dd97af97213328e..be666fd9f8740c3 100644
--- a/libc/src/math/gpu/tanhf.cpp
+++ b/libc/src/math/gpu/tanhf.cpp
@@ -9,8 +9,8 @@
#include "src/math/tanhf.h"
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(float, tanhf, (float x)) { return __builtin_tanhf(x); }
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/gpu/trunc.cpp b/libc/src/math/gpu/trunc.cpp
index b4708245d495971..773600f0f250115 100644
--- a/libc/src/math/gpu/trunc.cpp
+++ b/libc/src/math/gpu/trunc.cpp
@@ -9,8 +9,8 @@
#include "src/math/trunc.h"
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(double, trunc, (double x)) { return __builtin_trunc(x); }
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/gpu/truncf.cpp b/libc/src/math/gpu/truncf.cpp
index 352733d50a70995..534797a3e5860ca 100644
--- a/libc/src/math/gpu/truncf.cpp
+++ b/libc/src/math/gpu/truncf.cpp
@@ -9,8 +9,8 @@
#include "src/math/truncf.h"
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(float, truncf, (float x)) { return __builtin_truncf(x); }
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/gpu/vendor/acosf.cpp b/libc/src/math/gpu/vendor/acosf.cpp
index 7ae0811a3c3b5f6..ac629761a4398ad 100644
--- a/libc/src/math/gpu/vendor/acosf.cpp
+++ b/libc/src/math/gpu/vendor/acosf.cpp
@@ -11,8 +11,8 @@
#include "common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(float, acosf, (float x)) { return internal::acosf(x); }
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/gpu/vendor/acoshf.cpp b/libc/src/math/gpu/vendor/acoshf.cpp
index fa0dd58cde51de5..a0384f89eed3a65 100644
--- a/libc/src/math/gpu/vendor/acoshf.cpp
+++ b/libc/src/math/gpu/vendor/acoshf.cpp
@@ -11,8 +11,8 @@
#include "common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(float, acoshf, (float x)) { return internal::acoshf(x); }
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/gpu/vendor/amdgpu/amdgpu.h b/libc/src/math/gpu/vendor/amdgpu/amdgpu.h
index 7755174e445b222..280ae49989f9446 100644
--- a/libc/src/math/gpu/vendor/amdgpu/amdgpu.h
+++ b/libc/src/math/gpu/vendor/amdgpu/amdgpu.h
@@ -14,7 +14,7 @@
#include "src/__support/macros/attributes.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
namespace internal {
LIBC_INLINE float acosf(float x) { return __ocml_acos_f32(x); }
LIBC_INLINE float acoshf(float x) { return __ocml_acosh_f32(x); }
@@ -98,6 +98,6 @@ LIBC_INLINE float remquof(float x, float y, int *q) {
}
} // namespace internal
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_MATH_GPU_AMDGPU_H
diff --git a/libc/src/math/gpu/vendor/amdgpu/declarations.h b/libc/src/math/gpu/vendor/amdgpu/declarations.h
index 7219d5a7dfa6d73..b07c079682580a4 100644
--- a/libc/src/math/gpu/vendor/amdgpu/declarations.h
+++ b/libc/src/math/gpu/vendor/amdgpu/declarations.h
@@ -11,7 +11,7 @@
#include "src/__support/GPU/utils.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
extern "C" {
float __ocml_acos_f32(float);
@@ -58,6 +58,6 @@ float __ocml_remquo_f32(float, float, gpu::Private<int> *);
double __ocml_remquo_f64(double, double, gpu::Private<int> *);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_MATH_GPU_AMDGPU_DECLARATIONS_H
diff --git a/libc/src/math/gpu/vendor/amdgpu/platform.h b/libc/src/math/gpu/vendor/amdgpu/platform.h
index 6ec47c24a93a2d7..480a46bf14dfd88 100644
--- a/libc/src/math/gpu/vendor/amdgpu/platform.h
+++ b/libc/src/math/gpu/vendor/amdgpu/platform.h
@@ -11,7 +11,7 @@
#include <stdint.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
// The ROCm device library uses control globals to alter codegen for the
// different targets. To avoid needing to link them in manually we simply
@@ -109,6 +109,6 @@ extern const uint32_t __oclc_ISA_version = 11501;
#endif
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_MATH_GPU_AMDGPU_PLATFORM_H
diff --git a/libc/src/math/gpu/vendor/asinf.cpp b/libc/src/math/gpu/vendor/asinf.cpp
index 9a9ffb23a7cbee3..595a48f82744d57 100644
--- a/libc/src/math/gpu/vendor/asinf.cpp
+++ b/libc/src/math/gpu/vendor/asinf.cpp
@@ -11,8 +11,8 @@
#include "common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(float, asinf, (float x)) { return internal::asinf(x); }
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/gpu/vendor/asinhf.cpp b/libc/src/math/gpu/vendor/asinhf.cpp
index 7d1d7e8709e1107..78e5543cf36656b 100644
--- a/libc/src/math/gpu/vendor/asinhf.cpp
+++ b/libc/src/math/gpu/vendor/asinhf.cpp
@@ -11,8 +11,8 @@
#include "common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(float, asinhf, (float x)) { return internal::asinhf(x); }
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/gpu/vendor/atanf.cpp b/libc/src/math/gpu/vendor/atanf.cpp
index 7193d8cb2a37349..132c43d9e3af7ca 100644
--- a/libc/src/math/gpu/vendor/atanf.cpp
+++ b/libc/src/math/gpu/vendor/atanf.cpp
@@ -11,8 +11,8 @@
#include "common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(float, atanf, (float x)) { return internal::atanf(x); }
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/gpu/vendor/atanhf.cpp b/libc/src/math/gpu/vendor/atanhf.cpp
index b044a735f8777d3..521c4133243d981 100644
--- a/libc/src/math/gpu/vendor/atanhf.cpp
+++ b/libc/src/math/gpu/vendor/atanhf.cpp
@@ -11,8 +11,8 @@
#include "common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(float, atanhf, (float x)) { return internal::atanhf(x); }
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/gpu/vendor/cos.cpp b/libc/src/math/gpu/vendor/cos.cpp
index a3e2d65b8f98c46..37c7507911ec2e3 100644
--- a/libc/src/math/gpu/vendor/cos.cpp
+++ b/libc/src/math/gpu/vendor/cos.cpp
@@ -11,8 +11,8 @@
#include "common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(double, cos, (double x)) { return internal::cos(x); }
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/gpu/vendor/cosf.cpp b/libc/src/math/gpu/vendor/cosf.cpp
index 3ce8fa6361d6eb8..1bd42ba37e92d9b 100644
--- a/libc/src/math/gpu/vendor/cosf.cpp
+++ b/libc/src/math/gpu/vendor/cosf.cpp
@@ -11,8 +11,8 @@
#include "common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(float, cosf, (float x)) { return internal::cosf(x); }
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/gpu/vendor/cosh.cpp b/libc/src/math/gpu/vendor/cosh.cpp
index 3dc5c2b10cbcadb..3be05e58b51d96f 100644
--- a/libc/src/math/gpu/vendor/cosh.cpp
+++ b/libc/src/math/gpu/vendor/cosh.cpp
@@ -11,8 +11,8 @@
#include "common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(double, cosh, (double x)) { return internal::cosh(x); }
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/gpu/vendor/coshf.cpp b/libc/src/math/gpu/vendor/coshf.cpp
index c2933ecff94257c..1b945bbd7c47e49 100644
--- a/libc/src/math/gpu/vendor/coshf.cpp
+++ b/libc/src/math/gpu/vendor/coshf.cpp
@@ -11,8 +11,8 @@
#include "common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(float, coshf, (float x)) { return internal::coshf(x); }
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/gpu/vendor/exp10f.cpp b/libc/src/math/gpu/vendor/exp10f.cpp
index 05b753583cd7da0..844809355087b4d 100644
--- a/libc/src/math/gpu/vendor/exp10f.cpp
+++ b/libc/src/math/gpu/vendor/exp10f.cpp
@@ -11,8 +11,8 @@
#include "common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(float, exp10f, (float x)) { return internal::exp10f(x); }
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/gpu/vendor/exp2f.cpp b/libc/src/math/gpu/vendor/exp2f.cpp
index 818c3801b9f11bc..cb61557383dfa7c 100644
--- a/libc/src/math/gpu/vendor/exp2f.cpp
+++ b/libc/src/math/gpu/vendor/exp2f.cpp
@@ -11,8 +11,8 @@
#include "common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(float, exp2f, (float x)) { return internal::exp2f(x); }
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/gpu/vendor/expf.cpp b/libc/src/math/gpu/vendor/expf.cpp
index e243385e43fd8e2..89c194e4bc291ea 100644
--- a/libc/src/math/gpu/vendor/expf.cpp
+++ b/libc/src/math/gpu/vendor/expf.cpp
@@ -11,8 +11,8 @@
#include "common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(float, expf, (float x)) { return internal::expf(x); }
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/gpu/vendor/expm1f.cpp b/libc/src/math/gpu/vendor/expm1f.cpp
index 062e4a760c7c3a4..c5497797dbe1b3e 100644
--- a/libc/src/math/gpu/vendor/expm1f.cpp
+++ b/libc/src/math/gpu/vendor/expm1f.cpp
@@ -11,8 +11,8 @@
#include "common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(float, expm1f, (float x)) { return internal::expm1f(x); }
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/gpu/vendor/fdim.cpp b/libc/src/math/gpu/vendor/fdim.cpp
index b06787cb0865c18..f30dafb46e54883 100644
--- a/libc/src/math/gpu/vendor/fdim.cpp
+++ b/libc/src/math/gpu/vendor/fdim.cpp
@@ -11,10 +11,10 @@
#include "common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(double, fdim, (double x, double y)) {
return internal::fdim(x, y);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/gpu/vendor/fdimf.cpp b/libc/src/math/gpu/vendor/fdimf.cpp
index a675d484238c569..e30736206a9a929 100644
--- a/libc/src/math/gpu/vendor/fdimf.cpp
+++ b/libc/src/math/gpu/vendor/fdimf.cpp
@@ -11,10 +11,10 @@
#include "common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(float, fdimf, (float x, float y)) {
return internal::fdimf(x, y);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/gpu/vendor/frexp.cpp b/libc/src/math/gpu/vendor/frexp.cpp
index 4bd47fa2810232a..5fc2c1409c6e933 100644
--- a/libc/src/math/gpu/vendor/frexp.cpp
+++ b/libc/src/math/gpu/vendor/frexp.cpp
@@ -11,10 +11,10 @@
#include "common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(double, frexp, (double x, int *p)) {
return internal::frexp(x, p);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/gpu/vendor/frexpf.cpp b/libc/src/math/gpu/vendor/frexpf.cpp
index c6d398007cad4b7..e928d375e03db33 100644
--- a/libc/src/math/gpu/vendor/frexpf.cpp
+++ b/libc/src/math/gpu/vendor/frexpf.cpp
@@ -11,10 +11,10 @@
#include "common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(float, frexpf, (float x, int *p)) {
return internal::frexpf(x, p);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/gpu/vendor/hypot.cpp b/libc/src/math/gpu/vendor/hypot.cpp
index 5bac6fc76f8ddfc..45b629e3e285858 100644
--- a/libc/src/math/gpu/vendor/hypot.cpp
+++ b/libc/src/math/gpu/vendor/hypot.cpp
@@ -11,10 +11,10 @@
#include "common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(double, hypot, (double x, double y)) {
return internal::hypot(x, y);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/gpu/vendor/hypotf.cpp b/libc/src/math/gpu/vendor/hypotf.cpp
index 34ce290e37fd9a4..533e9dcb8dbfb0f 100644
--- a/libc/src/math/gpu/vendor/hypotf.cpp
+++ b/libc/src/math/gpu/vendor/hypotf.cpp
@@ -11,10 +11,10 @@
#include "common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(float, hypotf, (float x, float y)) {
return internal::hypotf(x, y);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/gpu/vendor/ilogb.cpp b/libc/src/math/gpu/vendor/ilogb.cpp
index ea41099c35c0e01..1d075027b41c057 100644
--- a/libc/src/math/gpu/vendor/ilogb.cpp
+++ b/libc/src/math/gpu/vendor/ilogb.cpp
@@ -11,8 +11,8 @@
#include "common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, ilogb, (double x)) { return internal::ilogb(x); }
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/gpu/vendor/ilogbf.cpp b/libc/src/math/gpu/vendor/ilogbf.cpp
index e15f4e198c8d7f9..8dc2ff0a374af22 100644
--- a/libc/src/math/gpu/vendor/ilogbf.cpp
+++ b/libc/src/math/gpu/vendor/ilogbf.cpp
@@ -11,8 +11,8 @@
#include "common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, ilogbf, (float x)) { return internal::ilogbf(x); }
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/gpu/vendor/ldexp.cpp b/libc/src/math/gpu/vendor/ldexp.cpp
index d9988fac0a45dc9..f760a42563305bf 100644
--- a/libc/src/math/gpu/vendor/ldexp.cpp
+++ b/libc/src/math/gpu/vendor/ldexp.cpp
@@ -11,10 +11,10 @@
#include "common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(double, ldexp, (double x, int y)) {
return internal::ldexp(x, y);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/gpu/vendor/ldexpf.cpp b/libc/src/math/gpu/vendor/ldexpf.cpp
index bdd40a6a217c348..d00d39115ffc334 100644
--- a/libc/src/math/gpu/vendor/ldexpf.cpp
+++ b/libc/src/math/gpu/vendor/ldexpf.cpp
@@ -11,10 +11,10 @@
#include "common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(float, ldexpf, (float x, int y)) {
return internal::ldexpf(x, y);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/gpu/vendor/llrint.cpp b/libc/src/math/gpu/vendor/llrint.cpp
index 064d2775460edc1..aafd1609002b2b9 100644
--- a/libc/src/math/gpu/vendor/llrint.cpp
+++ b/libc/src/math/gpu/vendor/llrint.cpp
@@ -11,10 +11,10 @@
#include "common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(long long, llrint, (double x)) {
return internal::llrint(x);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/gpu/vendor/llrintf.cpp b/libc/src/math/gpu/vendor/llrintf.cpp
index d1befb67c9788b0..39cd3ad0c021a55 100644
--- a/libc/src/math/gpu/vendor/llrintf.cpp
+++ b/libc/src/math/gpu/vendor/llrintf.cpp
@@ -11,10 +11,10 @@
#include "common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(long long, llrintf, (float x)) {
return internal::llrintf(x);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/gpu/vendor/llround.cpp b/libc/src/math/gpu/vendor/llround.cpp
index 51b8370759e9805..e53701bda75cf45 100644
--- a/libc/src/math/gpu/vendor/llround.cpp
+++ b/libc/src/math/gpu/vendor/llround.cpp
@@ -11,10 +11,10 @@
#include "common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(long long, llround, (double x)) {
return internal::llround(x);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/gpu/vendor/llroundf.cpp b/libc/src/math/gpu/vendor/llroundf.cpp
index 0131d278020029a..ddb5ec00a036f55 100644
--- a/libc/src/math/gpu/vendor/llroundf.cpp
+++ b/libc/src/math/gpu/vendor/llroundf.cpp
@@ -11,10 +11,10 @@
#include "common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(long long, llroundf, (float x)) {
return internal::llroundf(x);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/gpu/vendor/nextafter.cpp b/libc/src/math/gpu/vendor/nextafter.cpp
index 9e8e57e8a26f37f..f88e17f10908426 100644
--- a/libc/src/math/gpu/vendor/nextafter.cpp
+++ b/libc/src/math/gpu/vendor/nextafter.cpp
@@ -11,10 +11,10 @@
#include "common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(double, nextafter, (double x, double y)) {
return internal::nextafter(x, y);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/gpu/vendor/nextafterf.cpp b/libc/src/math/gpu/vendor/nextafterf.cpp
index 9780471e071c6bd..7a39dc8fc814eae 100644
--- a/libc/src/math/gpu/vendor/nextafterf.cpp
+++ b/libc/src/math/gpu/vendor/nextafterf.cpp
@@ -11,10 +11,10 @@
#include "common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(float, nextafterf, (float x, float y)) {
return internal::nextafterf(x, y);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/gpu/vendor/nvptx/declarations.h b/libc/src/math/gpu/vendor/nvptx/declarations.h
index 8b6702834a04cf4..003a9a8a5dfa55d 100644
--- a/libc/src/math/gpu/vendor/nvptx/declarations.h
+++ b/libc/src/math/gpu/vendor/nvptx/declarations.h
@@ -9,7 +9,7 @@
#ifndef LLVM_LIBC_SRC_MATH_GPU_NVPTX_DECLARATIONS_H
#define LLVM_LIBC_SRC_MATH_GPU_NVPTX_DECLARATIONS_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
extern "C" {
float __nv_acosf(float);
@@ -60,6 +60,6 @@ double __nv_remquo(double, double, int *);
float __nv_remquof(float, float, int *);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_MATH_GPU_NVPTX_DECLARATIONS_H
diff --git a/libc/src/math/gpu/vendor/nvptx/nvptx.h b/libc/src/math/gpu/vendor/nvptx/nvptx.h
index 6ea1743cf7a6f3e..4298d56db6a027c 100644
--- a/libc/src/math/gpu/vendor/nvptx/nvptx.h
+++ b/libc/src/math/gpu/vendor/nvptx/nvptx.h
@@ -13,7 +13,7 @@
#include "src/__support/macros/attributes.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
namespace internal {
LIBC_INLINE float acosf(float x) { return __nv_acosf(x); }
LIBC_INLINE float acoshf(float x) { return __nv_acoshf(x); }
@@ -73,6 +73,6 @@ LIBC_INLINE float remquof(float x, float y, int *i) {
}
} // namespace internal
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_MATH_GPU_NVPTX_H
diff --git a/libc/src/math/gpu/vendor/pow.cpp b/libc/src/math/gpu/vendor/pow.cpp
index 7945bc096e6656a..d49f2610a6919db 100644
--- a/libc/src/math/gpu/vendor/pow.cpp
+++ b/libc/src/math/gpu/vendor/pow.cpp
@@ -11,10 +11,10 @@
#include "common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(double, pow, (double x, double y)) {
return internal::pow(x, y);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/gpu/vendor/powf.cpp b/libc/src/math/gpu/vendor/powf.cpp
index 2fd2dcda6e465e7..37e02d252b74fd7 100644
--- a/libc/src/math/gpu/vendor/powf.cpp
+++ b/libc/src/math/gpu/vendor/powf.cpp
@@ -11,10 +11,10 @@
#include "common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(float, powf, (float x, float y)) {
return internal::powf(x, y);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/gpu/vendor/remquo.cpp b/libc/src/math/gpu/vendor/remquo.cpp
index 755efeaba530ba0..e92c9b3c2a6e3b6 100644
--- a/libc/src/math/gpu/vendor/remquo.cpp
+++ b/libc/src/math/gpu/vendor/remquo.cpp
@@ -11,10 +11,10 @@
#include "common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(double, remquo, (double x, double y, int *quo)) {
return internal::remquo(x, y, quo);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/gpu/vendor/remquof.cpp b/libc/src/math/gpu/vendor/remquof.cpp
index c2be2cd87aad6c6..b234885aa88c03a 100644
--- a/libc/src/math/gpu/vendor/remquof.cpp
+++ b/libc/src/math/gpu/vendor/remquof.cpp
@@ -11,10 +11,10 @@
#include "common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(float, remquof, (float x, float y, int *quo)) {
return internal::remquof(x, y, quo);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/gpu/vendor/scalbn.cpp b/libc/src/math/gpu/vendor/scalbn.cpp
index 44aa286166cbf58..435533a90501b7c 100644
--- a/libc/src/math/gpu/vendor/scalbn.cpp
+++ b/libc/src/math/gpu/vendor/scalbn.cpp
@@ -11,10 +11,10 @@
#include "common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(double, scalbn, (double x, int y)) {
return internal::scalbn(x, y);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/gpu/vendor/scalbnf.cpp b/libc/src/math/gpu/vendor/scalbnf.cpp
index 6d02f8617201ac6..0a4844c8a433efe 100644
--- a/libc/src/math/gpu/vendor/scalbnf.cpp
+++ b/libc/src/math/gpu/vendor/scalbnf.cpp
@@ -11,10 +11,10 @@
#include "common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(float, scalbnf, (float x, int y)) {
return internal::scalbnf(x, y);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/gpu/vendor/sin.cpp b/libc/src/math/gpu/vendor/sin.cpp
index 4eda066b60f53ca..96e07c99b71a334 100644
--- a/libc/src/math/gpu/vendor/sin.cpp
+++ b/libc/src/math/gpu/vendor/sin.cpp
@@ -11,8 +11,8 @@
#include "common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(double, sin, (double x)) { return internal::sin(x); }
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/gpu/vendor/sincos.cpp b/libc/src/math/gpu/vendor/sincos.cpp
index 589d65fdc61d269..d882157b0bc8d7f 100644
--- a/libc/src/math/gpu/vendor/sincos.cpp
+++ b/libc/src/math/gpu/vendor/sincos.cpp
@@ -11,10 +11,10 @@
#include "common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(void, sincos, (double x, double *sinptr, double *cosptr)) {
return internal::sincos(x, sinptr, cosptr);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/gpu/vendor/sincosf.cpp b/libc/src/math/gpu/vendor/sincosf.cpp
index bf3593bef7e5012..17892ceb107da57 100644
--- a/libc/src/math/gpu/vendor/sincosf.cpp
+++ b/libc/src/math/gpu/vendor/sincosf.cpp
@@ -11,10 +11,10 @@
#include "common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(void, sincosf, (float x, float *sinptr, float *cosptr)) {
return internal::sincosf(x, sinptr, cosptr);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/gpu/vendor/sinf.cpp b/libc/src/math/gpu/vendor/sinf.cpp
index 4be642cbd0bc4e8..af93227ab63bb94 100644
--- a/libc/src/math/gpu/vendor/sinf.cpp
+++ b/libc/src/math/gpu/vendor/sinf.cpp
@@ -11,8 +11,8 @@
#include "common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(float, sinf, (float x)) { return internal::sinf(x); }
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/gpu/vendor/sinh.cpp b/libc/src/math/gpu/vendor/sinh.cpp
index c65cb5536f125a6..be6b3ae2e2fa0bd 100644
--- a/libc/src/math/gpu/vendor/sinh.cpp
+++ b/libc/src/math/gpu/vendor/sinh.cpp
@@ -11,8 +11,8 @@
#include "common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(double, sinh, (double x)) { return internal::sinh(x); }
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/gpu/vendor/sinhf.cpp b/libc/src/math/gpu/vendor/sinhf.cpp
index 4d1fcbb530a9033..99c399b62b7f6d2 100644
--- a/libc/src/math/gpu/vendor/sinhf.cpp
+++ b/libc/src/math/gpu/vendor/sinhf.cpp
@@ -11,8 +11,8 @@
#include "common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(float, sinhf, (float x)) { return internal::sinhf(x); }
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/gpu/vendor/tan.cpp b/libc/src/math/gpu/vendor/tan.cpp
index 16587dc26c0c0ce..9a1bd9c89fcf0a3 100644
--- a/libc/src/math/gpu/vendor/tan.cpp
+++ b/libc/src/math/gpu/vendor/tan.cpp
@@ -11,8 +11,8 @@
#include "common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(double, tan, (double x)) { return internal::tan(x); }
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/gpu/vendor/tanf.cpp b/libc/src/math/gpu/vendor/tanf.cpp
index 99b336390293039..a5266a8c154c5b5 100644
--- a/libc/src/math/gpu/vendor/tanf.cpp
+++ b/libc/src/math/gpu/vendor/tanf.cpp
@@ -11,8 +11,8 @@
#include "common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(float, tanf, (float x)) { return internal::tanf(x); }
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/gpu/vendor/tanh.cpp b/libc/src/math/gpu/vendor/tanh.cpp
index de38d1584923937..57d764f1f2a0ddf 100644
--- a/libc/src/math/gpu/vendor/tanh.cpp
+++ b/libc/src/math/gpu/vendor/tanh.cpp
@@ -11,8 +11,8 @@
#include "common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(double, tanh, (double x)) { return internal::tanh(x); }
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/gpu/vendor/tanhf.cpp b/libc/src/math/gpu/vendor/tanhf.cpp
index a673a49de528649..1c9c2f3843a9536 100644
--- a/libc/src/math/gpu/vendor/tanhf.cpp
+++ b/libc/src/math/gpu/vendor/tanhf.cpp
@@ -11,8 +11,8 @@
#include "common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(float, tanhf, (float x)) { return internal::tanhf(x); }
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/hypot.h b/libc/src/math/hypot.h
index 6c901ee8f4c0c22..981473f9e8d5b0a 100644
--- a/libc/src/math/hypot.h
+++ b/libc/src/math/hypot.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_MATH_HYPOT_H
#define LLVM_LIBC_SRC_MATH_HYPOT_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
double hypot(double x, double y);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_MATH_HYPOT_H
diff --git a/libc/src/math/hypotf.h b/libc/src/math/hypotf.h
index 084fd7f3ef81437..1d290b421f1515a 100644
--- a/libc/src/math/hypotf.h
+++ b/libc/src/math/hypotf.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_MATH_HYPOTF_H
#define LLVM_LIBC_SRC_MATH_HYPOTF_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
float hypotf(float x, float y);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_MATH_HYPOTF_H
diff --git a/libc/src/math/ilogb.h b/libc/src/math/ilogb.h
index 96672077865a9a8..e851a6a4c4d5587 100644
--- a/libc/src/math/ilogb.h
+++ b/libc/src/math/ilogb.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_MATH_ILOGB_H
#define LLVM_LIBC_SRC_MATH_ILOGB_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int ilogb(double x);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_MATH_ILOGB_H
diff --git a/libc/src/math/ilogbf.h b/libc/src/math/ilogbf.h
index 1afb76a107c1cda..edea34618ac0252 100644
--- a/libc/src/math/ilogbf.h
+++ b/libc/src/math/ilogbf.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_MATH_ILOGBF_H
#define LLVM_LIBC_SRC_MATH_ILOGBF_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int ilogbf(float x);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_MATH_ILOGBF_H
diff --git a/libc/src/math/ilogbl.h b/libc/src/math/ilogbl.h
index 4d1cc1995341b8f..1b4782f3445cad6 100644
--- a/libc/src/math/ilogbl.h
+++ b/libc/src/math/ilogbl.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_MATH_ILOGBL_H
#define LLVM_LIBC_SRC_MATH_ILOGBL_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int ilogbl(long double x);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_MATH_ILOGBL_H
diff --git a/libc/src/math/ldexp.h b/libc/src/math/ldexp.h
index 74f9a600666faf4..7a8bcc34bf5815e 100644
--- a/libc/src/math/ldexp.h
+++ b/libc/src/math/ldexp.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_MATH_LDEXP_H
#define LLVM_LIBC_SRC_MATH_LDEXP_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
double ldexp(double x, int exp);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_MATH_LDEXP_H
diff --git a/libc/src/math/ldexpf.h b/libc/src/math/ldexpf.h
index f30d60155f1fd94..c06b487171cd299 100644
--- a/libc/src/math/ldexpf.h
+++ b/libc/src/math/ldexpf.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_MATH_LDEXPF_H
#define LLVM_LIBC_SRC_MATH_LDEXPF_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
float ldexpf(float x, int exp);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_MATH_LDEXPF_H
diff --git a/libc/src/math/ldexpl.h b/libc/src/math/ldexpl.h
index 3ee9c045e171395..f2df0c86cad2234 100644
--- a/libc/src/math/ldexpl.h
+++ b/libc/src/math/ldexpl.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_MATH_LDEXPL_H
#define LLVM_LIBC_SRC_MATH_LDEXPL_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
long double ldexpl(long double x, int exp);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_MATH_LDEXPL_H
diff --git a/libc/src/math/llrint.h b/libc/src/math/llrint.h
index 96bd7b8cc9e1c97..69c881ea844f9f9 100644
--- a/libc/src/math/llrint.h
+++ b/libc/src/math/llrint.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_MATH_LLRINT_H
#define LLVM_LIBC_SRC_MATH_LLRINT_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
long long llrint(double x);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_MATH_LLRINT_H
diff --git a/libc/src/math/llrintf.h b/libc/src/math/llrintf.h
index eecf380f5e94dc0..023e84aa0509207 100644
--- a/libc/src/math/llrintf.h
+++ b/libc/src/math/llrintf.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_MATH_LLRINTF_H
#define LLVM_LIBC_SRC_MATH_LLRINTF_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
long long llrintf(float x);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_MATH_LLRINTF_H
diff --git a/libc/src/math/llrintl.h b/libc/src/math/llrintl.h
index 94dfba7080aa99e..4dbcc60589812d0 100644
--- a/libc/src/math/llrintl.h
+++ b/libc/src/math/llrintl.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_MATH_LLRINTL_H
#define LLVM_LIBC_SRC_MATH_LLRINTL_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
long long llrintl(long double x);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_MATH_LLRINTL_H
diff --git a/libc/src/math/llround.h b/libc/src/math/llround.h
index 5b2b7fc96df8715..265b4fd92e0e8f9 100644
--- a/libc/src/math/llround.h
+++ b/libc/src/math/llround.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_MATH_LLROUND_H
#define LLVM_LIBC_SRC_MATH_LLROUND_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
long long llround(double x);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_MATH_LLROUND_H
diff --git a/libc/src/math/llroundf.h b/libc/src/math/llroundf.h
index 65faad1e07a6147..2141ca91da46bb7 100644
--- a/libc/src/math/llroundf.h
+++ b/libc/src/math/llroundf.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_MATH_LLROUNDF_H
#define LLVM_LIBC_SRC_MATH_LLROUNDF_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
long long llroundf(float x);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_MATH_LLROUNDF_H
diff --git a/libc/src/math/llroundl.h b/libc/src/math/llroundl.h
index f859485a730bd90..9cb4251f72fe559 100644
--- a/libc/src/math/llroundl.h
+++ b/libc/src/math/llroundl.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_MATH_LLROUNDL_H
#define LLVM_LIBC_SRC_MATH_LLROUNDL_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
long long llroundl(long double x);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_MATH_LLROUNDL_H
diff --git a/libc/src/math/log.h b/libc/src/math/log.h
index eff98b42ff5b8bd..67f5d7f89279b74 100644
--- a/libc/src/math/log.h
+++ b/libc/src/math/log.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_MATH_LOG_H
#define LLVM_LIBC_SRC_MATH_LOG_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
double log(double x);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_MATH_LOG_H
diff --git a/libc/src/math/log10.h b/libc/src/math/log10.h
index d86694136aff85f..3d8249aaee2d66e 100644
--- a/libc/src/math/log10.h
+++ b/libc/src/math/log10.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_MATH_LOG10_H
#define LLVM_LIBC_SRC_MATH_LOG10_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
double log10(double x);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_MATH_LOG10_H
diff --git a/libc/src/math/log10f.h b/libc/src/math/log10f.h
index d544ab5a55daad4..ca3eadc8866b105 100644
--- a/libc/src/math/log10f.h
+++ b/libc/src/math/log10f.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_MATH_LOG10F_H
#define LLVM_LIBC_SRC_MATH_LOG10F_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
float log10f(float x);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_MATH_LOG10F_H
diff --git a/libc/src/math/log1p.h b/libc/src/math/log1p.h
index 0f25ce6167545af..48eb9ca885265b4 100644
--- a/libc/src/math/log1p.h
+++ b/libc/src/math/log1p.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_MATH_LOG1P_H
#define LLVM_LIBC_SRC_MATH_LOG1P_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
double log1p(double x);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_MATH_LOG1P_H
diff --git a/libc/src/math/log1pf.h b/libc/src/math/log1pf.h
index ea00377f8e2adcc..854f76fce9f758a 100644
--- a/libc/src/math/log1pf.h
+++ b/libc/src/math/log1pf.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_MATH_LOG1PF_H
#define LLVM_LIBC_SRC_MATH_LOG1PF_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
float log1pf(float x);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_MATH_LOG1PF_H
diff --git a/libc/src/math/log2.h b/libc/src/math/log2.h
index f55ffedd1540752..49f05493cf166be 100644
--- a/libc/src/math/log2.h
+++ b/libc/src/math/log2.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_MATH_LOG2_H
#define LLVM_LIBC_SRC_MATH_LOG2_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
double log2(double x);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_MATH_LOG2_H
diff --git a/libc/src/math/log2f.h b/libc/src/math/log2f.h
index 94d2c543c908664..04b7743edc0aabc 100644
--- a/libc/src/math/log2f.h
+++ b/libc/src/math/log2f.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_MATH_LOG2F_H
#define LLVM_LIBC_SRC_MATH_LOG2F_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
float log2f(float x);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_MATH_LOG2F_H
diff --git a/libc/src/math/logb.h b/libc/src/math/logb.h
index b875dcd702babe3..e24dd4320de659b 100644
--- a/libc/src/math/logb.h
+++ b/libc/src/math/logb.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_MATH_LOGB_H
#define LLVM_LIBC_SRC_MATH_LOGB_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
double logb(double x);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_MATH_LOGB_H
diff --git a/libc/src/math/logbf.h b/libc/src/math/logbf.h
index 46dcd3c91d628cd..e8d50180562864b 100644
--- a/libc/src/math/logbf.h
+++ b/libc/src/math/logbf.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_MATH_LOGBF_H
#define LLVM_LIBC_SRC_MATH_LOGBF_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
float logbf(float x);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_MATH_LOGBF_H
diff --git a/libc/src/math/logbl.h b/libc/src/math/logbl.h
index 3630e52c92d298c..bc32993a4bdc2a2 100644
--- a/libc/src/math/logbl.h
+++ b/libc/src/math/logbl.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_MATH_LOGBL_H
#define LLVM_LIBC_SRC_MATH_LOGBL_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
long double logbl(long double x);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_MATH_LOGBL_H
diff --git a/libc/src/math/logf.h b/libc/src/math/logf.h
index 195580190ba319d..b69be468ab45529 100644
--- a/libc/src/math/logf.h
+++ b/libc/src/math/logf.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_MATH_LOGF_H
#define LLVM_LIBC_SRC_MATH_LOGF_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
float logf(float x);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_MATH_LOGF_H
diff --git a/libc/src/math/lrint.h b/libc/src/math/lrint.h
index 62df79a1de2302b..e40f860f1a35e48 100644
--- a/libc/src/math/lrint.h
+++ b/libc/src/math/lrint.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_MATH_LRINT_H
#define LLVM_LIBC_SRC_MATH_LRINT_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
long lrint(double x);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_MATH_LRINT_H
diff --git a/libc/src/math/lrintf.h b/libc/src/math/lrintf.h
index af5159437532b2d..93b2c8cd265dfe6 100644
--- a/libc/src/math/lrintf.h
+++ b/libc/src/math/lrintf.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_MATH_LRINTF_H
#define LLVM_LIBC_SRC_MATH_LRINTF_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
long lrintf(float x);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_MATH_LRINTF_H
diff --git a/libc/src/math/lrintl.h b/libc/src/math/lrintl.h
index 812acecadafadf4..c17901d220d189c 100644
--- a/libc/src/math/lrintl.h
+++ b/libc/src/math/lrintl.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_MATH_LRINTL_H
#define LLVM_LIBC_SRC_MATH_LRINTL_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
long lrintl(long double x);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_MATH_LRINTL_H
diff --git a/libc/src/math/lround.h b/libc/src/math/lround.h
index 8c555e816c8ba17..4a67cc9693ba7c2 100644
--- a/libc/src/math/lround.h
+++ b/libc/src/math/lround.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_MATH_LROUND_H
#define LLVM_LIBC_SRC_MATH_LROUND_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
long lround(double x);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_MATH_LROUND_H
diff --git a/libc/src/math/lroundf.h b/libc/src/math/lroundf.h
index 3d318a7a2faba33..9d4f4e82b789468 100644
--- a/libc/src/math/lroundf.h
+++ b/libc/src/math/lroundf.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_MATH_LROUNDF_H
#define LLVM_LIBC_SRC_MATH_LROUNDF_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
long lroundf(float x);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_MATH_LROUNDF_H
diff --git a/libc/src/math/lroundl.h b/libc/src/math/lroundl.h
index a8b5aff0fcf386f..86673dc597fd303 100644
--- a/libc/src/math/lroundl.h
+++ b/libc/src/math/lroundl.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_MATH_LROUNDL_H
#define LLVM_LIBC_SRC_MATH_LROUNDL_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
long lroundl(long double x);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_MATH_LROUNDL_H
diff --git a/libc/src/math/modf.h b/libc/src/math/modf.h
index 1dc732f6e89abad..91453a01f02fc5d 100644
--- a/libc/src/math/modf.h
+++ b/libc/src/math/modf.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_MATH_MODF_H
#define LLVM_LIBC_SRC_MATH_MODF_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
double modf(double x, double *iptr);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_MATH_MODF_H
diff --git a/libc/src/math/modff.h b/libc/src/math/modff.h
index 21457e0d2e81aa8..85bf2aacbc17c27 100644
--- a/libc/src/math/modff.h
+++ b/libc/src/math/modff.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_MATH_MODFF_H
#define LLVM_LIBC_SRC_MATH_MODFF_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
float modff(float x, float *iptr);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_MATH_MODFF_H
diff --git a/libc/src/math/modfl.h b/libc/src/math/modfl.h
index ff89239c4bfde55..5ea2c6d98c0afbd 100644
--- a/libc/src/math/modfl.h
+++ b/libc/src/math/modfl.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_MATH_MODFL_H
#define LLVM_LIBC_SRC_MATH_MODFL_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
long double modfl(long double x, long double *iptr);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_MATH_MODFL_H
diff --git a/libc/src/math/nearbyint.h b/libc/src/math/nearbyint.h
index 957a06b9792144e..df292a252583f3e 100644
--- a/libc/src/math/nearbyint.h
+++ b/libc/src/math/nearbyint.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_MATH_NEARBYINT_H
#define LLVM_LIBC_SRC_MATH_NEARBYINT_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
double nearbyint(double x);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_MATH_NEARBYINT_H
diff --git a/libc/src/math/nearbyintf.h b/libc/src/math/nearbyintf.h
index 3793f6bc1b881bb..3860dc03bcf58f8 100644
--- a/libc/src/math/nearbyintf.h
+++ b/libc/src/math/nearbyintf.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_MATH_NEARBYINTF_H
#define LLVM_LIBC_SRC_MATH_NEARBYINTF_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
float nearbyintf(float x);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_MATH_NEARBYINTF_H
diff --git a/libc/src/math/nearbyintl.h b/libc/src/math/nearbyintl.h
index 7029e86a52114c4..e22cae6386e690c 100644
--- a/libc/src/math/nearbyintl.h
+++ b/libc/src/math/nearbyintl.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_MATH_NEARBYINTL_H
#define LLVM_LIBC_SRC_MATH_NEARBYINTL_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
long double nearbyintl(long double x);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_MATH_NEARBYINTL_H
diff --git a/libc/src/math/nextafter.h b/libc/src/math/nextafter.h
index 1f6d24de5f2e0b2..fc4c9eb182aa4c1 100644
--- a/libc/src/math/nextafter.h
+++ b/libc/src/math/nextafter.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_MATH_NEXTAFTER_H
#define LLVM_LIBC_SRC_MATH_NEXTAFTER_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
double nextafter(double x, double y);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_MATH_NEXTAFTER_H
diff --git a/libc/src/math/nextafterf.h b/libc/src/math/nextafterf.h
index 8afac0e5f6a0338..de7870df5d7669f 100644
--- a/libc/src/math/nextafterf.h
+++ b/libc/src/math/nextafterf.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_MATH_NEXTAFTERF_H
#define LLVM_LIBC_SRC_MATH_NEXTAFTERF_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
float nextafterf(float x, float y);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_MATH_NEXTAFTERF_H
diff --git a/libc/src/math/nextafterl.h b/libc/src/math/nextafterl.h
index 912877867dc2159..1b94e242c776e55 100644
--- a/libc/src/math/nextafterl.h
+++ b/libc/src/math/nextafterl.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_MATH_NEXTAFTERL_H
#define LLVM_LIBC_SRC_MATH_NEXTAFTERL_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
long double nextafterl(long double x, long double y);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_MATH_NEXTAFTERL_H
diff --git a/libc/src/math/pow.h b/libc/src/math/pow.h
index 26fed175787a92e..dd9b4a6556837cc 100644
--- a/libc/src/math/pow.h
+++ b/libc/src/math/pow.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_MATH_POW_H
#define LLVM_LIBC_SRC_MATH_POW_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
double pow(double x, double y);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_MATH_POW_H
diff --git a/libc/src/math/powf.h b/libc/src/math/powf.h
index ec2d67b8fd639b2..6582dc335d61304 100644
--- a/libc/src/math/powf.h
+++ b/libc/src/math/powf.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_MATH_POWF_H
#define LLVM_LIBC_SRC_MATH_POWF_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
float powf(float x, float y);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_MATH_POWF_H
diff --git a/libc/src/math/remainder.h b/libc/src/math/remainder.h
index 8a720fc23b6be7e..f1f89542013d704 100644
--- a/libc/src/math/remainder.h
+++ b/libc/src/math/remainder.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_MATH_REMAINDER_H
#define LLVM_LIBC_SRC_MATH_REMAINDER_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
double remainder(double x, double y);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_MATH_REMAINDER_H
diff --git a/libc/src/math/remainderf.h b/libc/src/math/remainderf.h
index 19a16d08a94d39f..31a9bbe86b56c35 100644
--- a/libc/src/math/remainderf.h
+++ b/libc/src/math/remainderf.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_MATH_REMAINDERF_H
#define LLVM_LIBC_SRC_MATH_REMAINDERF_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
float remainderf(float x, float y);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_MATH_REMAINDERF_H
diff --git a/libc/src/math/remainderl.h b/libc/src/math/remainderl.h
index f2837635ab77c73..584af37f5f37c6b 100644
--- a/libc/src/math/remainderl.h
+++ b/libc/src/math/remainderl.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_MATH_REMAINDERL_H
#define LLVM_LIBC_SRC_MATH_REMAINDERL_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
long double remainderl(long double x, long double y);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_MATH_REMAINDERL_H
diff --git a/libc/src/math/remquo.h b/libc/src/math/remquo.h
index cb753fee6ea0d20..7590e7df5ddb8b6 100644
--- a/libc/src/math/remquo.h
+++ b/libc/src/math/remquo.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_MATH_REMQUO_H
#define LLVM_LIBC_SRC_MATH_REMQUO_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
double remquo(double x, double y, int *exp);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_MATH_REMQUO_H
diff --git a/libc/src/math/remquof.h b/libc/src/math/remquof.h
index feb2e4f5e0dd550..8b8e8772706fdbb 100644
--- a/libc/src/math/remquof.h
+++ b/libc/src/math/remquof.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_MATH_REMQUOF_H
#define LLVM_LIBC_SRC_MATH_REMQUOF_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
float remquof(float x, float y, int *exp);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_MATH_REMQUOF_H
diff --git a/libc/src/math/remquol.h b/libc/src/math/remquol.h
index d1b0e20fcc86595..ba9b09929cc2f79 100644
--- a/libc/src/math/remquol.h
+++ b/libc/src/math/remquol.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_MATH_REMQUOL_H
#define LLVM_LIBC_SRC_MATH_REMQUOL_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
long double remquol(long double x, long double y, int *exp);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_MATH_REMQUOL_H
diff --git a/libc/src/math/rint.h b/libc/src/math/rint.h
index e4910ad95a81c2e..3cd676bfb724e3e 100644
--- a/libc/src/math/rint.h
+++ b/libc/src/math/rint.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_MATH_RINT_H
#define LLVM_LIBC_SRC_MATH_RINT_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
double rint(double x);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_MATH_RINT_H
diff --git a/libc/src/math/rintf.h b/libc/src/math/rintf.h
index 0091ba3a8cd006b..d0246a32cdd30fc 100644
--- a/libc/src/math/rintf.h
+++ b/libc/src/math/rintf.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_MATH_RINTF_H
#define LLVM_LIBC_SRC_MATH_RINTF_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
float rintf(float x);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_MATH_RINTF_H
diff --git a/libc/src/math/rintl.h b/libc/src/math/rintl.h
index 2bf095de76f88d6..bddfa183f7ae70d 100644
--- a/libc/src/math/rintl.h
+++ b/libc/src/math/rintl.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_MATH_RINTL_H
#define LLVM_LIBC_SRC_MATH_RINTL_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
long double rintl(long double x);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_MATH_RINTL_H
diff --git a/libc/src/math/round.h b/libc/src/math/round.h
index bb09ea4a77c53ac..3e6a3b34c9a46ea 100644
--- a/libc/src/math/round.h
+++ b/libc/src/math/round.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_MATH_ROUND_H
#define LLVM_LIBC_SRC_MATH_ROUND_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
double round(double x);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_MATH_ROUND_H
diff --git a/libc/src/math/roundf.h b/libc/src/math/roundf.h
index 6bab35adf781a0a..d6ca186ed16e1b9 100644
--- a/libc/src/math/roundf.h
+++ b/libc/src/math/roundf.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_MATH_ROUNDF_H
#define LLVM_LIBC_SRC_MATH_ROUNDF_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
float roundf(float x);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_MATH_ROUNDF_H
diff --git a/libc/src/math/roundl.h b/libc/src/math/roundl.h
index 43fb63e231de45a..0abe87a055061ca 100644
--- a/libc/src/math/roundl.h
+++ b/libc/src/math/roundl.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_MATH_ROUNDL_H
#define LLVM_LIBC_SRC_MATH_ROUNDL_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
long double roundl(long double x);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_MATH_ROUNDL_H
diff --git a/libc/src/math/scalbn.h b/libc/src/math/scalbn.h
index e24f29e4d466e93..9fc1dc4d93fbd26 100644
--- a/libc/src/math/scalbn.h
+++ b/libc/src/math/scalbn.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_MATH_SCALBN_H
#define LLVM_LIBC_SRC_MATH_SCALBN_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
double scalbn(double x, int n);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_MATH_SCALBN_H
diff --git a/libc/src/math/scalbnf.h b/libc/src/math/scalbnf.h
index f5316eed2926190..6b5a5f9cab7f06a 100644
--- a/libc/src/math/scalbnf.h
+++ b/libc/src/math/scalbnf.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_MATH_SCALBNF_H
#define LLVM_LIBC_SRC_MATH_SCALBNF_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
float scalbnf(float x, int n);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_MATH_SCALBNF_H
diff --git a/libc/src/math/scalbnl.h b/libc/src/math/scalbnl.h
index 6839a75072cd604..876f147dde4f3c9 100644
--- a/libc/src/math/scalbnl.h
+++ b/libc/src/math/scalbnl.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_MATH_SCALBNL_H
#define LLVM_LIBC_SRC_MATH_SCALBNL_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
long double scalbnl(long double x, int n);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_MATH_SCALBNL_H
diff --git a/libc/src/math/sin.h b/libc/src/math/sin.h
index f3919c46df603ab..50ecdc74fb2d942 100644
--- a/libc/src/math/sin.h
+++ b/libc/src/math/sin.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_MATH_SIN_H
#define LLVM_LIBC_SRC_MATH_SIN_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
double sin(double x);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_MATH_SIN_H
diff --git a/libc/src/math/sincosf.h b/libc/src/math/sincosf.h
index 47ef983f4385ff5..56539f52ce0e6c0 100644
--- a/libc/src/math/sincosf.h
+++ b/libc/src/math/sincosf.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_MATH_SINCOSF_H
#define LLVM_LIBC_SRC_MATH_SINCOSF_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
void sincosf(float x, float *sinx, float *cosx);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_MATH_SINCOSF_H
diff --git a/libc/src/math/sinf.h b/libc/src/math/sinf.h
index e63db04c51b5dfc..aa0b753e74ae338 100644
--- a/libc/src/math/sinf.h
+++ b/libc/src/math/sinf.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_MATH_SINF_H
#define LLVM_LIBC_SRC_MATH_SINF_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
float sinf(float x);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_MATH_SINF_H
diff --git a/libc/src/math/sinh.h b/libc/src/math/sinh.h
index 2784ca261e4aa19..bf1b1f1d815c171 100644
--- a/libc/src/math/sinh.h
+++ b/libc/src/math/sinh.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_MATH_SINH_H
#define LLVM_LIBC_SRC_MATH_SINH_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
double sinh(double x);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_MATH_SINH_H
diff --git a/libc/src/math/sinhf.h b/libc/src/math/sinhf.h
index 843ecec9fbfc9d1..65cb39f9e392648 100644
--- a/libc/src/math/sinhf.h
+++ b/libc/src/math/sinhf.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_MATH_SINHF_H
#define LLVM_LIBC_SRC_MATH_SINHF_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
float sinhf(float x);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_MATH_SINHF_H
diff --git a/libc/src/math/sqrt.h b/libc/src/math/sqrt.h
index 2390e07b5dce57f..d003e3f0964de20 100644
--- a/libc/src/math/sqrt.h
+++ b/libc/src/math/sqrt.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_MATH_SQRT_H
#define LLVM_LIBC_SRC_MATH_SQRT_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
double sqrt(double x);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_MATH_SQRT_H
diff --git a/libc/src/math/sqrtf.h b/libc/src/math/sqrtf.h
index d1d06f3adfa8e64..fe4192a55038684 100644
--- a/libc/src/math/sqrtf.h
+++ b/libc/src/math/sqrtf.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_MATH_SQRTF_H
#define LLVM_LIBC_SRC_MATH_SQRTF_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
float sqrtf(float x);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_MATH_SQRTF_H
diff --git a/libc/src/math/sqrtl.h b/libc/src/math/sqrtl.h
index 5fbfa14507147a0..e632c1925ddc2bc 100644
--- a/libc/src/math/sqrtl.h
+++ b/libc/src/math/sqrtl.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_MATH_SQRTL_H
#define LLVM_LIBC_SRC_MATH_SQRTL_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
long double sqrtl(long double x);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_MATH_SQRTL_H
diff --git a/libc/src/math/tan.h b/libc/src/math/tan.h
index 05366db52ff8771..5d0121f158f11b9 100644
--- a/libc/src/math/tan.h
+++ b/libc/src/math/tan.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_MATH_TAN_H
#define LLVM_LIBC_SRC_MATH_TAN_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
double tan(double x);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_MATH_TAN_H
diff --git a/libc/src/math/tanf.h b/libc/src/math/tanf.h
index 7a9fa01f4c2962b..e0f06a8ba64cf4b 100644
--- a/libc/src/math/tanf.h
+++ b/libc/src/math/tanf.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_MATH_TANF_H
#define LLVM_LIBC_SRC_MATH_TANF_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
float tanf(float x);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_MATH_TANF_H
diff --git a/libc/src/math/tanh.h b/libc/src/math/tanh.h
index 5400c3d2328ebb3..66561eef403dd8a 100644
--- a/libc/src/math/tanh.h
+++ b/libc/src/math/tanh.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_MATH_TANH_H
#define LLVM_LIBC_SRC_MATH_TANH_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
double tanh(double x);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_MATH_TANH_H
diff --git a/libc/src/math/tanhf.h b/libc/src/math/tanhf.h
index ec5ba8001094d9d..ff9d02efaffb722 100644
--- a/libc/src/math/tanhf.h
+++ b/libc/src/math/tanhf.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_MATH_TANHF_H
#define LLVM_LIBC_SRC_MATH_TANHF_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
float tanhf(float x);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_MATH_TANHF_H
diff --git a/libc/src/math/trunc.h b/libc/src/math/trunc.h
index f7fed01f30d25bc..d766aff923dc9e0 100644
--- a/libc/src/math/trunc.h
+++ b/libc/src/math/trunc.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_MATH_TRUNC_H
#define LLVM_LIBC_SRC_MATH_TRUNC_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
double trunc(double x);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_MATH_TRUNC_H
diff --git a/libc/src/math/truncf.h b/libc/src/math/truncf.h
index b4f1cd7ea72f623..e666d778154a3d8 100644
--- a/libc/src/math/truncf.h
+++ b/libc/src/math/truncf.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_MATH_TRUNCF_H
#define LLVM_LIBC_SRC_MATH_TRUNCF_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
float truncf(float x);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_MATH_TRUNCF_H
diff --git a/libc/src/math/truncl.h b/libc/src/math/truncl.h
index 2a78ffaa3c5ef70..38f414f65fcc092 100644
--- a/libc/src/math/truncl.h
+++ b/libc/src/math/truncl.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_MATH_TRUNCL_H
#define LLVM_LIBC_SRC_MATH_TRUNCL_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
long double truncl(long double x);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_MATH_TRUNCL_H
diff --git a/libc/src/math/x86_64/cos.cpp b/libc/src/math/x86_64/cos.cpp
index 1d2480e3df147e8..2cb8db4b7a859d2 100644
--- a/libc/src/math/x86_64/cos.cpp
+++ b/libc/src/math/x86_64/cos.cpp
@@ -9,11 +9,11 @@
#include "src/math/cos.h"
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(double, cos, (double x)) {
__asm__ __volatile__("fcos" : "+t"(x));
return x;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/x86_64/sin.cpp b/libc/src/math/x86_64/sin.cpp
index bda4acbe4122381..2c7b8aa6e8c836b 100644
--- a/libc/src/math/x86_64/sin.cpp
+++ b/libc/src/math/x86_64/sin.cpp
@@ -9,11 +9,11 @@
#include "src/math/sin.h"
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(double, sin, (double x)) {
__asm__ __volatile__("fsin" : "+t"(x));
return x;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/x86_64/tan.cpp b/libc/src/math/x86_64/tan.cpp
index f25ff77095c88b1..bc0e0fc7d1ffa35 100644
--- a/libc/src/math/x86_64/tan.cpp
+++ b/libc/src/math/x86_64/tan.cpp
@@ -9,7 +9,7 @@
#include "src/math/tan.h"
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(double, tan, (double x)) {
double result;
@@ -20,4 +20,4 @@ LLVM_LIBC_FUNCTION(double, tan, (double x)) {
return result;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/network/htonl.cpp b/libc/src/network/htonl.cpp
index 983fcadd7dae304..862d5e3a0bc41d6 100644
--- a/libc/src/network/htonl.cpp
+++ b/libc/src/network/htonl.cpp
@@ -10,10 +10,10 @@
#include "src/__support/common.h"
#include "src/__support/endian.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(uint32_t, htonl, (uint32_t hostlong)) {
return Endian::to_big_endian(hostlong);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/network/htonl.h b/libc/src/network/htonl.h
index eab56482150e4a5..c7743dfad7ba38a 100644
--- a/libc/src/network/htonl.h
+++ b/libc/src/network/htonl.h
@@ -11,10 +11,10 @@
#include <stdint.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
uint32_t htonl(uint32_t hostlong);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_NETWORK_HTONL_H
diff --git a/libc/src/network/htons.cpp b/libc/src/network/htons.cpp
index 1d2c6bf2f8836e3..e844454d5687f15 100644
--- a/libc/src/network/htons.cpp
+++ b/libc/src/network/htons.cpp
@@ -10,10 +10,10 @@
#include "src/__support/common.h"
#include "src/__support/endian.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(uint16_t, htons, (uint16_t hostshort)) {
return Endian::to_big_endian(hostshort);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/network/htons.h b/libc/src/network/htons.h
index a3abaf6ec6df7f6..e0a379f94e5267a 100644
--- a/libc/src/network/htons.h
+++ b/libc/src/network/htons.h
@@ -11,10 +11,10 @@
#include <stdint.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
uint16_t htons(uint16_t hostshort);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_NETWORK_HTONS_H
diff --git a/libc/src/network/ntohl.cpp b/libc/src/network/ntohl.cpp
index c525f722ec5b381..c00f4a5ae09c9d8 100644
--- a/libc/src/network/ntohl.cpp
+++ b/libc/src/network/ntohl.cpp
@@ -10,7 +10,7 @@
#include "src/__support/common.h"
#include "src/__support/endian.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(uint32_t, ntohl, (uint32_t netlong)) {
if constexpr (Endian::IS_LITTLE)
@@ -19,4 +19,4 @@ LLVM_LIBC_FUNCTION(uint32_t, ntohl, (uint32_t netlong)) {
return netlong;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/network/ntohl.h b/libc/src/network/ntohl.h
index bec626f5e4cec0c..2fc4ef059c58782 100644
--- a/libc/src/network/ntohl.h
+++ b/libc/src/network/ntohl.h
@@ -11,10 +11,10 @@
#include <stdint.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
uint32_t ntohl(uint32_t netlong);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_NETWORK_NTOHL_H
diff --git a/libc/src/network/ntohs.cpp b/libc/src/network/ntohs.cpp
index 8556b3e28cdc35c..572b6860fa6b9f4 100644
--- a/libc/src/network/ntohs.cpp
+++ b/libc/src/network/ntohs.cpp
@@ -10,7 +10,7 @@
#include "src/__support/common.h"
#include "src/__support/endian.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(uint16_t, ntohs, (uint16_t netshort)) {
if constexpr (Endian::IS_LITTLE)
@@ -19,4 +19,4 @@ LLVM_LIBC_FUNCTION(uint16_t, ntohs, (uint16_t netshort)) {
return netshort;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/network/ntohs.h b/libc/src/network/ntohs.h
index b10aaa9c8891b06..a84c52eeb9c2fad 100644
--- a/libc/src/network/ntohs.h
+++ b/libc/src/network/ntohs.h
@@ -11,10 +11,10 @@
#include <stdint.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
uint16_t ntohs(uint16_t netshort);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_NETWORK_NTOHS_H
diff --git a/libc/src/pthread/pthread_atfork.cpp b/libc/src/pthread/pthread_atfork.cpp
index 7136bf35816cbff..57191b8534771f1 100644
--- a/libc/src/pthread/pthread_atfork.cpp
+++ b/libc/src/pthread/pthread_atfork.cpp
@@ -14,7 +14,7 @@
#include <errno.h>
#include <pthread.h> // For pthread_* type definitions.
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, pthread_atfork,
(__atfork_callback_t prepare, __atfork_callback_t parent,
@@ -22,4 +22,4 @@ LLVM_LIBC_FUNCTION(int, pthread_atfork,
return register_atfork_callbacks(prepare, parent, child) ? 0 : ENOMEM;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/pthread/pthread_atfork.h b/libc/src/pthread/pthread_atfork.h
index bd8bc8a35ef035e..8b89d6895647b10 100644
--- a/libc/src/pthread/pthread_atfork.h
+++ b/libc/src/pthread/pthread_atfork.h
@@ -11,11 +11,11 @@
#include <pthread.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int pthread_atfork(__atfork_callback_t prepare, __atfork_callback_t parent,
__atfork_callback_t child);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_PTHREAD_PTHREAD_ATFORK_H
diff --git a/libc/src/pthread/pthread_attr_destroy.cpp b/libc/src/pthread/pthread_attr_destroy.cpp
index f51b056ad030d0a..a5bde84256fc63f 100644
--- a/libc/src/pthread/pthread_attr_destroy.cpp
+++ b/libc/src/pthread/pthread_attr_destroy.cpp
@@ -12,11 +12,11 @@
#include <pthread.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, pthread_attr_destroy, (pthread_attr_t *)) {
// There is nothing to cleanup.
return 0;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/pthread/pthread_attr_destroy.h b/libc/src/pthread/pthread_attr_destroy.h
index 5d01bc8d782d674..532a0f45f7cd591 100644
--- a/libc/src/pthread/pthread_attr_destroy.h
+++ b/libc/src/pthread/pthread_attr_destroy.h
@@ -11,10 +11,10 @@
#include <pthread.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int pthread_attr_destroy(pthread_attr_t *attr);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_PTHREAD_PTHREAD_ATTR_DESTROY_H
diff --git a/libc/src/pthread/pthread_attr_getdetachstate.cpp b/libc/src/pthread/pthread_attr_getdetachstate.cpp
index 18f4637e1c8fec2..4bff85d45c17cc4 100644
--- a/libc/src/pthread/pthread_attr_getdetachstate.cpp
+++ b/libc/src/pthread/pthread_attr_getdetachstate.cpp
@@ -12,7 +12,7 @@
#include <pthread.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, pthread_attr_getdetachstate,
(const pthread_attr_t *attr, int *detachstate)) {
@@ -20,4 +20,4 @@ LLVM_LIBC_FUNCTION(int, pthread_attr_getdetachstate,
return 0;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/pthread/pthread_attr_getdetachstate.h b/libc/src/pthread/pthread_attr_getdetachstate.h
index fd5ee886daebde1..57a47b73bd50be8 100644
--- a/libc/src/pthread/pthread_attr_getdetachstate.h
+++ b/libc/src/pthread/pthread_attr_getdetachstate.h
@@ -11,10 +11,10 @@
#include <pthread.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int pthread_attr_getdetachstate(const pthread_attr_t *attr, int *detach_state);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_PTHREAD_PTHREAD_ATTR_GETDETACHSTATE_H
diff --git a/libc/src/pthread/pthread_attr_getguardsize.cpp b/libc/src/pthread/pthread_attr_getguardsize.cpp
index 79d80feed713ee0..8f28db8d9c96c32 100644
--- a/libc/src/pthread/pthread_attr_getguardsize.cpp
+++ b/libc/src/pthread/pthread_attr_getguardsize.cpp
@@ -12,7 +12,7 @@
#include <pthread.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, pthread_attr_getguardsize,
(const pthread_attr_t *__restrict attr,
@@ -21,4 +21,4 @@ LLVM_LIBC_FUNCTION(int, pthread_attr_getguardsize,
return 0;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/pthread/pthread_attr_getguardsize.h b/libc/src/pthread/pthread_attr_getguardsize.h
index 61072b9350fe9a9..ef2e75828f9e2c0 100644
--- a/libc/src/pthread/pthread_attr_getguardsize.h
+++ b/libc/src/pthread/pthread_attr_getguardsize.h
@@ -11,11 +11,11 @@
#include <pthread.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int pthread_attr_getguardsize(const pthread_attr_t *__restrict attr,
size_t *__restrict guardsize);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_PTHREAD_PTHREAD_ATTR_GETGUARDSIZE_H
diff --git a/libc/src/pthread/pthread_attr_getstack.cpp b/libc/src/pthread/pthread_attr_getstack.cpp
index 564b8fde52f84c5..8788fbc1ffdd33b 100644
--- a/libc/src/pthread/pthread_attr_getstack.cpp
+++ b/libc/src/pthread/pthread_attr_getstack.cpp
@@ -14,17 +14,17 @@
#include <pthread.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, pthread_attr_getstack,
(const pthread_attr_t *__restrict attr,
void **__restrict stack, size_t *__restrict stacksize)) {
// As of writing this `pthread_attr_getstacksize` can never fail.
- int result = __llvm_libc::pthread_attr_getstacksize(attr, stacksize);
+ int result = LIBC_NAMESPACE::pthread_attr_getstacksize(attr, stacksize);
if (LIBC_UNLIKELY(result != 0))
return result;
*stack = attr->__stack;
return 0;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/pthread/pthread_attr_getstack.h b/libc/src/pthread/pthread_attr_getstack.h
index d0164738349b53f..22ac24a89e42243 100644
--- a/libc/src/pthread/pthread_attr_getstack.h
+++ b/libc/src/pthread/pthread_attr_getstack.h
@@ -11,12 +11,12 @@
#include <pthread.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int pthread_attr_getstack(const pthread_attr_t *__restrict attr,
void **__restrict stack,
size_t *__restrict stacksize);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_PTHREAD_PTHREAD_ATTR_GETSTACK_H
diff --git a/libc/src/pthread/pthread_attr_getstacksize.cpp b/libc/src/pthread/pthread_attr_getstacksize.cpp
index 2b33d6fc8a447e2..ecc4787951dfa1c 100644
--- a/libc/src/pthread/pthread_attr_getstacksize.cpp
+++ b/libc/src/pthread/pthread_attr_getstacksize.cpp
@@ -12,7 +12,7 @@
#include <pthread.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, pthread_attr_getstacksize,
(const pthread_attr_t *__restrict attr,
@@ -21,4 +21,4 @@ LLVM_LIBC_FUNCTION(int, pthread_attr_getstacksize,
return 0;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/pthread/pthread_attr_getstacksize.h b/libc/src/pthread/pthread_attr_getstacksize.h
index cb27a5e1927ecb9..3136f08ffb71163 100644
--- a/libc/src/pthread/pthread_attr_getstacksize.h
+++ b/libc/src/pthread/pthread_attr_getstacksize.h
@@ -11,11 +11,11 @@
#include <pthread.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int pthread_attr_getstacksize(const pthread_attr_t *__restrict attr,
size_t *__restrict stacksize);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_PTHREAD_PTHREAD_ATTR_GETSTACKSIZE_H
diff --git a/libc/src/pthread/pthread_attr_init.cpp b/libc/src/pthread/pthread_attr_init.cpp
index 32e54efce34ab2c..13d302c18f98a71 100644
--- a/libc/src/pthread/pthread_attr_init.cpp
+++ b/libc/src/pthread/pthread_attr_init.cpp
@@ -13,7 +13,7 @@
#include <pthread.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, pthread_attr_init, (pthread_attr_t * attr)) {
*attr = pthread_attr_t{
@@ -25,4 +25,4 @@ LLVM_LIBC_FUNCTION(int, pthread_attr_init, (pthread_attr_t * attr)) {
return 0;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/pthread/pthread_attr_init.h b/libc/src/pthread/pthread_attr_init.h
index 609e65381db7d8c..3a2ad3d2b8b8112 100644
--- a/libc/src/pthread/pthread_attr_init.h
+++ b/libc/src/pthread/pthread_attr_init.h
@@ -11,10 +11,10 @@
#include <pthread.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int pthread_attr_init(pthread_attr_t *attr);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_PTHREAD_PTHREAD_ATTR_INIT_H
diff --git a/libc/src/pthread/pthread_attr_setdetachstate.cpp b/libc/src/pthread/pthread_attr_setdetachstate.cpp
index e136538e054fc3c..029b4d514ef43dc 100644
--- a/libc/src/pthread/pthread_attr_setdetachstate.cpp
+++ b/libc/src/pthread/pthread_attr_setdetachstate.cpp
@@ -13,7 +13,7 @@
#include <errno.h>
#include <pthread.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, pthread_attr_setdetachstate,
(pthread_attr_t * attr, int detachstate)) {
@@ -24,4 +24,4 @@ LLVM_LIBC_FUNCTION(int, pthread_attr_setdetachstate,
return 0;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/pthread/pthread_attr_setdetachstate.h b/libc/src/pthread/pthread_attr_setdetachstate.h
index a8f586619f53e6b..2b994d9e99d3074 100644
--- a/libc/src/pthread/pthread_attr_setdetachstate.h
+++ b/libc/src/pthread/pthread_attr_setdetachstate.h
@@ -11,10 +11,10 @@
#include <pthread.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int pthread_attr_setdetachstate(pthread_attr_t *attr, int detach_state);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_PTHREAD_PTHREAD_ATTR_SETDETACHSTATE_H
diff --git a/libc/src/pthread/pthread_attr_setguardsize.cpp b/libc/src/pthread/pthread_attr_setguardsize.cpp
index dd2584a552920c7..98855b20cb0fb32 100644
--- a/libc/src/pthread/pthread_attr_setguardsize.cpp
+++ b/libc/src/pthread/pthread_attr_setguardsize.cpp
@@ -14,7 +14,7 @@
#include <linux/param.h> // For EXEC_PAGESIZE.
#include <pthread.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, pthread_attr_setguardsize,
(pthread_attr_t *__restrict attr, size_t guardsize)) {
@@ -24,4 +24,4 @@ LLVM_LIBC_FUNCTION(int, pthread_attr_setguardsize,
return 0;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/pthread/pthread_attr_setguardsize.h b/libc/src/pthread/pthread_attr_setguardsize.h
index d9e159874f262ed..64d896af0266688 100644
--- a/libc/src/pthread/pthread_attr_setguardsize.h
+++ b/libc/src/pthread/pthread_attr_setguardsize.h
@@ -11,10 +11,10 @@
#include <pthread.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int pthread_attr_setguardsize(pthread_attr_t *attr, size_t guardsize);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_PTHREAD_PTHREAD_ATTR_SETGUARDSIZE_H
diff --git a/libc/src/pthread/pthread_attr_setstack.cpp b/libc/src/pthread/pthread_attr_setstack.cpp
index a16196acf23b07d..dde4e3fd70ed232 100644
--- a/libc/src/pthread/pthread_attr_setstack.cpp
+++ b/libc/src/pthread/pthread_attr_setstack.cpp
@@ -16,7 +16,7 @@
#include <pthread.h>
#include <stdint.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, pthread_attr_setstack,
(pthread_attr_t *__restrict attr, void *stack,
@@ -35,4 +35,4 @@ LLVM_LIBC_FUNCTION(int, pthread_attr_setstack,
return 0;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/pthread/pthread_attr_setstack.h b/libc/src/pthread/pthread_attr_setstack.h
index 44ee2c9e35de162..fe2a7f4fbd061ad 100644
--- a/libc/src/pthread/pthread_attr_setstack.h
+++ b/libc/src/pthread/pthread_attr_setstack.h
@@ -11,10 +11,10 @@
#include <pthread.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int pthread_attr_setstack(pthread_attr_t *attr, void *stack, size_t stacksize);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_PTHREAD_PTHREAD_ATTR_SETSTACK_H
diff --git a/libc/src/pthread/pthread_attr_setstacksize.cpp b/libc/src/pthread/pthread_attr_setstacksize.cpp
index b23a7ced09aa3f1..642a888aba706d2 100644
--- a/libc/src/pthread/pthread_attr_setstacksize.cpp
+++ b/libc/src/pthread/pthread_attr_setstacksize.cpp
@@ -13,7 +13,7 @@
#include <errno.h>
#include <pthread.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, pthread_attr_setstacksize,
(pthread_attr_t *__restrict attr, size_t stacksize)) {
@@ -25,4 +25,4 @@ LLVM_LIBC_FUNCTION(int, pthread_attr_setstacksize,
return 0;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/pthread/pthread_attr_setstacksize.h b/libc/src/pthread/pthread_attr_setstacksize.h
index 40ee5c07d44eacb..f5940948949b834 100644
--- a/libc/src/pthread/pthread_attr_setstacksize.h
+++ b/libc/src/pthread/pthread_attr_setstacksize.h
@@ -11,10 +11,10 @@
#include <pthread.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int pthread_attr_setstacksize(pthread_attr_t *attr, size_t stacksize);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_PTHREAD_PTHREAD_ATTR_SETSTACKSIZE_H
diff --git a/libc/src/pthread/pthread_create.cpp b/libc/src/pthread/pthread_create.cpp
index 9eebb80001a895d..8b406cd09326ad5 100644
--- a/libc/src/pthread/pthread_create.cpp
+++ b/libc/src/pthread/pthread_create.cpp
@@ -22,9 +22,9 @@
#include <errno.h>
#include <pthread.h> // For pthread_* type definitions.
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
-static_assert(sizeof(pthread_t) == sizeof(__llvm_libc::Thread),
+static_assert(sizeof(pthread_t) == sizeof(LIBC_NAMESPACE::Thread),
"Mismatch between pthread_t and internal Thread.");
LLVM_LIBC_FUNCTION(int, pthread_create,
@@ -34,7 +34,7 @@ LLVM_LIBC_FUNCTION(int, pthread_create,
pthread_attr_t default_attr;
if (attr == nullptr) {
// We failed to initialize attributes (should be impossible)
- if (LIBC_UNLIKELY(__llvm_libc::pthread_attr_init(&default_attr) != 0))
+ if (LIBC_UNLIKELY(LIBC_NAMESPACE::pthread_attr_init(&default_attr) != 0))
return EINVAL;
attr = &default_attr;
@@ -46,21 +46,21 @@ LLVM_LIBC_FUNCTION(int, pthread_create,
// As of writing this all the `pthread_attr_get*` functions always succeed.
if (LIBC_UNLIKELY(
- __llvm_libc::pthread_attr_getstack(attr, &stack, &stacksize) != 0))
+ LIBC_NAMESPACE::pthread_attr_getstack(attr, &stack, &stacksize) != 0))
return EINVAL;
- if (LIBC_UNLIKELY(__llvm_libc::pthread_attr_getguardsize(attr, &guardsize) !=
- 0))
+ if (LIBC_UNLIKELY(
+ LIBC_NAMESPACE::pthread_attr_getguardsize(attr, &guardsize) != 0))
return EINVAL;
if (LIBC_UNLIKELY(
- __llvm_libc::pthread_attr_getdetachstate(attr, &detachstate) != 0))
+ LIBC_NAMESPACE::pthread_attr_getdetachstate(attr, &detachstate) != 0))
return EINVAL;
if (attr == &default_attr)
// Should we fail here? Its non-issue as the moment as pthread_attr_destroy
// can only succeed.
- if (LIBC_UNLIKELY(__llvm_libc::pthread_attr_destroy(&default_attr) != 0))
+ if (LIBC_UNLIKELY(LIBC_NAMESPACE::pthread_attr_destroy(&default_attr) != 0))
return EINVAL;
if (stacksize && stacksize < PTHREAD_STACK_MIN)
@@ -76,7 +76,7 @@ LLVM_LIBC_FUNCTION(int, pthread_create,
// Thread::run will check validity of the `stack` argument (stack alignment is
// universal, not sure a pthread requirement).
- auto *thread = reinterpret_cast<__llvm_libc::Thread *>(th);
+ auto *thread = reinterpret_cast<LIBC_NAMESPACE::Thread *>(th);
int result = thread->run(func, arg, stack, stacksize, guardsize,
detachstate == PTHREAD_CREATE_DETACHED);
if (result != 0 && result != EPERM && result != EINVAL)
@@ -84,4 +84,4 @@ LLVM_LIBC_FUNCTION(int, pthread_create,
return result;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/pthread/pthread_create.h b/libc/src/pthread/pthread_create.h
index 6df6c9559ea9440..75466e39df7e17c 100644
--- a/libc/src/pthread/pthread_create.h
+++ b/libc/src/pthread/pthread_create.h
@@ -11,12 +11,12 @@
#include <pthread.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int pthread_create(pthread_t *__restrict thread,
const pthread_attr_t *__restrict attr,
__pthread_start_t func, void *arg);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_PTHREAD_PTHREAD_CREATE_H
diff --git a/libc/src/pthread/pthread_detach.cpp b/libc/src/pthread/pthread_detach.cpp
index 009438e16c4c3d3..e8b69b6576265cd 100644
--- a/libc/src/pthread/pthread_detach.cpp
+++ b/libc/src/pthread/pthread_detach.cpp
@@ -13,9 +13,9 @@
#include <pthread.h> // For pthread_* type definitions.
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
-static_assert(sizeof(pthread_t) == sizeof(__llvm_libc::Thread),
+static_assert(sizeof(pthread_t) == sizeof(LIBC_NAMESPACE::Thread),
"Mismatch between pthread_t and internal Thread.");
LLVM_LIBC_FUNCTION(int, pthread_detach, (pthread_t th)) {
@@ -24,4 +24,4 @@ LLVM_LIBC_FUNCTION(int, pthread_detach, (pthread_t th)) {
return 0;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/pthread/pthread_detach.h b/libc/src/pthread/pthread_detach.h
index 5beab40b3061af4..d54fdf854de391a 100644
--- a/libc/src/pthread/pthread_detach.h
+++ b/libc/src/pthread/pthread_detach.h
@@ -11,10 +11,10 @@
#include <pthread.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int pthread_detach(pthread_t thread);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_PTHREAD_PTHREAD_DETACH_H
diff --git a/libc/src/pthread/pthread_equal.cpp b/libc/src/pthread/pthread_equal.cpp
index 29460204ae1d91f..f154e9ba9a42127 100644
--- a/libc/src/pthread/pthread_equal.cpp
+++ b/libc/src/pthread/pthread_equal.cpp
@@ -13,9 +13,9 @@
#include <pthread.h> // For pthread_* type definitions.
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
-static_assert(sizeof(pthread_t) == sizeof(__llvm_libc::Thread),
+static_assert(sizeof(pthread_t) == sizeof(LIBC_NAMESPACE::Thread),
"Mismatch between pthread_t and internal Thread.");
LLVM_LIBC_FUNCTION(int, pthread_equal, (pthread_t lhs, pthread_t rhs)) {
@@ -24,4 +24,4 @@ LLVM_LIBC_FUNCTION(int, pthread_equal, (pthread_t lhs, pthread_t rhs)) {
return *lhs_internal == *rhs_internal;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/pthread/pthread_equal.h b/libc/src/pthread/pthread_equal.h
index aa5dfed54a5e01c..448fb8fc07d1d42 100644
--- a/libc/src/pthread/pthread_equal.h
+++ b/libc/src/pthread/pthread_equal.h
@@ -11,10 +11,10 @@
#include <pthread.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int pthread_equal(pthread_t lhs, pthread_t rhs);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_PTHREAD_PTHREAD_EQUAL_H
diff --git a/libc/src/pthread/pthread_exit.cpp b/libc/src/pthread/pthread_exit.cpp
index 1d1a7377f8326a1..acba665d0fa4f8a 100644
--- a/libc/src/pthread/pthread_exit.cpp
+++ b/libc/src/pthread/pthread_exit.cpp
@@ -13,13 +13,13 @@
#include <pthread.h> // For pthread_* type definitions.
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
-static_assert(sizeof(pthread_t) == sizeof(__llvm_libc::Thread),
+static_assert(sizeof(pthread_t) == sizeof(LIBC_NAMESPACE::Thread),
"Mismatch between pthread_t and internal Thread.");
LLVM_LIBC_FUNCTION(void, pthread_exit, (void *retval)) {
- __llvm_libc::thread_exit(ThreadReturnValue(retval), ThreadStyle::POSIX);
+ LIBC_NAMESPACE::thread_exit(ThreadReturnValue(retval), ThreadStyle::POSIX);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/pthread/pthread_exit.h b/libc/src/pthread/pthread_exit.h
index 40051d70e0e00c2..6617dab84c69e60 100644
--- a/libc/src/pthread/pthread_exit.h
+++ b/libc/src/pthread/pthread_exit.h
@@ -11,10 +11,10 @@
#include <pthread.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
[[noreturn]] void pthread_exit(void *retval);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_PTHREAD_PTHREAD_EXIT_H
diff --git a/libc/src/pthread/pthread_getname_np.cpp b/libc/src/pthread/pthread_getname_np.cpp
index e1c3549974b6b69..3de8c2e92f7a04e 100644
--- a/libc/src/pthread/pthread_getname_np.cpp
+++ b/libc/src/pthread/pthread_getname_np.cpp
@@ -16,17 +16,17 @@
#include <pthread.h>
#include <stddef.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
-static_assert(sizeof(pthread_t) == sizeof(__llvm_libc::Thread),
+static_assert(sizeof(pthread_t) == sizeof(LIBC_NAMESPACE::Thread),
"Mismatch between pthread_t and internal Thread.");
LLVM_LIBC_FUNCTION(int, pthread_getname_np,
(pthread_t th, char *buf, size_t len)) {
- auto *thread = reinterpret_cast<__llvm_libc::Thread *>(&th);
+ auto *thread = reinterpret_cast<LIBC_NAMESPACE::Thread *>(&th);
cpp::span<char> name_buf(buf, len);
cpp::StringStream name_stream(name_buf);
return thread->get_name(name_stream);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/pthread/pthread_getname_np.h b/libc/src/pthread/pthread_getname_np.h
index da9c77150e0af3c..a51573749ba877f 100644
--- a/libc/src/pthread/pthread_getname_np.h
+++ b/libc/src/pthread/pthread_getname_np.h
@@ -12,10 +12,10 @@
#include <pthread.h>
#include <stddef.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int pthread_getname_np(pthread_t, char *, size_t);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_PTHREAD_PTHREAD_GETNAME_NP_H
diff --git a/libc/src/pthread/pthread_getspecific.cpp b/libc/src/pthread/pthread_getspecific.cpp
index 02545564a8cccfd..3893b52efd6e9a9 100644
--- a/libc/src/pthread/pthread_getspecific.cpp
+++ b/libc/src/pthread/pthread_getspecific.cpp
@@ -14,10 +14,10 @@
#include <pthread.h>
#include <stddef.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(void *, pthread_getspecific, (pthread_key_t key)) {
return get_tss_value(key);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/pthread/pthread_getspecific.h b/libc/src/pthread/pthread_getspecific.h
index c7da0137d545054..28439838bd65b2a 100644
--- a/libc/src/pthread/pthread_getspecific.h
+++ b/libc/src/pthread/pthread_getspecific.h
@@ -12,10 +12,10 @@
#include <pthread.h>
#include <stddef.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
void *pthread_getspecific(pthread_key_t);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_PTHREAD_PTHREAD_GETSPECIFIC_H
diff --git a/libc/src/pthread/pthread_join.cpp b/libc/src/pthread/pthread_join.cpp
index b888260247cd855..8d4c2dd46c474ca 100644
--- a/libc/src/pthread/pthread_join.cpp
+++ b/libc/src/pthread/pthread_join.cpp
@@ -13,9 +13,9 @@
#include <pthread.h> // For pthread_* type definitions.
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
-static_assert(sizeof(pthread_t) == sizeof(__llvm_libc::Thread),
+static_assert(sizeof(pthread_t) == sizeof(LIBC_NAMESPACE::Thread),
"Mismatch between pthread_t and internal Thread.");
LLVM_LIBC_FUNCTION(int, pthread_join, (pthread_t th, void **retval)) {
@@ -24,4 +24,4 @@ LLVM_LIBC_FUNCTION(int, pthread_join, (pthread_t th, void **retval)) {
return result;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/pthread/pthread_join.h b/libc/src/pthread/pthread_join.h
index 1200fba3b20d8ee..506efaead40fffa 100644
--- a/libc/src/pthread/pthread_join.h
+++ b/libc/src/pthread/pthread_join.h
@@ -11,10 +11,10 @@
#include <pthread.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int pthread_join(pthread_t thread, void **retval);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_PTHREAD_PTHREAD_JOIN_H
diff --git a/libc/src/pthread/pthread_key_create.cpp b/libc/src/pthread/pthread_key_create.cpp
index 1dc8eecfa5a2187..81c1f39954a5b2c 100644
--- a/libc/src/pthread/pthread_key_create.cpp
+++ b/libc/src/pthread/pthread_key_create.cpp
@@ -14,15 +14,15 @@
#include <errno.h>
#include <pthread.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, pthread_key_create,
(pthread_key_t * key, __pthread_tss_dtor_t dtor)) {
- auto k = __llvm_libc::new_tss_key(dtor);
+ auto k = LIBC_NAMESPACE::new_tss_key(dtor);
if (!k)
return EINVAL;
*key = *k;
return 0;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/pthread/pthread_key_create.h b/libc/src/pthread/pthread_key_create.h
index cd5916ab01fbecf..f12c9088e7c86d9 100644
--- a/libc/src/pthread/pthread_key_create.h
+++ b/libc/src/pthread/pthread_key_create.h
@@ -11,10 +11,10 @@
#include <pthread.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int pthread_key_create(pthread_key_t *key, __pthread_tss_dtor_t dtor);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_PTHREAD_PTHREAD_KEY_CREATE_H
diff --git a/libc/src/pthread/pthread_key_delete.cpp b/libc/src/pthread/pthread_key_delete.cpp
index d45424cf6013578..18a4cc7e18665dd 100644
--- a/libc/src/pthread/pthread_key_delete.cpp
+++ b/libc/src/pthread/pthread_key_delete.cpp
@@ -14,13 +14,13 @@
#include <errno.h>
#include <pthread.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, pthread_key_delete, (pthread_key_t key)) {
- if (__llvm_libc::tss_key_delete(key))
+ if (LIBC_NAMESPACE::tss_key_delete(key))
return 0;
else
return EINVAL;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/pthread/pthread_key_delete.h b/libc/src/pthread/pthread_key_delete.h
index 3ec528dde71970b..5b7e40bb373a6e7 100644
--- a/libc/src/pthread/pthread_key_delete.h
+++ b/libc/src/pthread/pthread_key_delete.h
@@ -11,10 +11,10 @@
#include <pthread.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int pthread_key_delete(pthread_key_t key);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_PTHREAD_PTHREAD_KEY_DELETE_H
diff --git a/libc/src/pthread/pthread_mutex_destroy.cpp b/libc/src/pthread/pthread_mutex_destroy.cpp
index acb344bbea52f38..65f4b7901f4f19b 100644
--- a/libc/src/pthread/pthread_mutex_destroy.cpp
+++ b/libc/src/pthread/pthread_mutex_destroy.cpp
@@ -13,7 +13,7 @@
#include <pthread.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, pthread_mutex_destroy, (pthread_mutex_t * mutex)) {
auto *m = reinterpret_cast<Mutex *>(mutex);
@@ -23,4 +23,4 @@ LLVM_LIBC_FUNCTION(int, pthread_mutex_destroy, (pthread_mutex_t * mutex)) {
return 0;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/pthread/pthread_mutex_destroy.h b/libc/src/pthread/pthread_mutex_destroy.h
index b6461a0da9f39f3..2df303eb2d6ca59 100644
--- a/libc/src/pthread/pthread_mutex_destroy.h
+++ b/libc/src/pthread/pthread_mutex_destroy.h
@@ -11,10 +11,10 @@
#include <pthread.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int pthread_mutex_destroy(pthread_mutex_t *mutex);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_PTHREAD_PTHREAD_MUTEX_DESTROY_H
diff --git a/libc/src/pthread/pthread_mutex_init.cpp b/libc/src/pthread/pthread_mutex_init.cpp
index 5038ee08875939b..f64d1fe68ad2021 100644
--- a/libc/src/pthread/pthread_mutex_init.cpp
+++ b/libc/src/pthread/pthread_mutex_init.cpp
@@ -15,7 +15,7 @@
#include <errno.h>
#include <pthread.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
static_assert(sizeof(Mutex) <= sizeof(pthread_mutex_t),
"The public pthread_mutex_t type cannot accommodate the internal "
@@ -32,4 +32,4 @@ LLVM_LIBC_FUNCTION(int, pthread_mutex_init,
return err == MutexError::NONE ? 0 : EAGAIN;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/pthread/pthread_mutex_init.h b/libc/src/pthread/pthread_mutex_init.h
index 678cac32d900d48..e6b5a0ac7eef960 100644
--- a/libc/src/pthread/pthread_mutex_init.h
+++ b/libc/src/pthread/pthread_mutex_init.h
@@ -11,11 +11,11 @@
#include <pthread.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int pthread_mutex_init(pthread_mutex_t *mutex,
const pthread_mutexattr_t *__restrict attr);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_PTHREAD_PTHREAD_MUTEX_INIT_H
diff --git a/libc/src/pthread/pthread_mutex_lock.cpp b/libc/src/pthread/pthread_mutex_lock.cpp
index 9daffafff942fea..efc6f75e43429a3 100644
--- a/libc/src/pthread/pthread_mutex_lock.cpp
+++ b/libc/src/pthread/pthread_mutex_lock.cpp
@@ -13,7 +13,7 @@
#include <pthread.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
// The implementation currently handles only plain mutexes.
LLVM_LIBC_FUNCTION(int, pthread_mutex_lock, (pthread_mutex_t * mutex)) {
@@ -23,4 +23,4 @@ LLVM_LIBC_FUNCTION(int, pthread_mutex_lock, (pthread_mutex_t * mutex)) {
return 0;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/pthread/pthread_mutex_lock.h b/libc/src/pthread/pthread_mutex_lock.h
index bb47e5980969820..c5a835e4fc87060 100644
--- a/libc/src/pthread/pthread_mutex_lock.h
+++ b/libc/src/pthread/pthread_mutex_lock.h
@@ -11,10 +11,10 @@
#include <pthread.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int pthread_mutex_lock(pthread_mutex_t *mutex);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_PTHREAD_PTHREAD_MUTEX_LOCK_H
diff --git a/libc/src/pthread/pthread_mutex_unlock.cpp b/libc/src/pthread/pthread_mutex_unlock.cpp
index 3cc8c7cdac09b90..b0819bd5fcd8945 100644
--- a/libc/src/pthread/pthread_mutex_unlock.cpp
+++ b/libc/src/pthread/pthread_mutex_unlock.cpp
@@ -13,7 +13,7 @@
#include <pthread.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
// The implementation currently handles only plain mutexes.
LLVM_LIBC_FUNCTION(int, pthread_mutex_unlock, (pthread_mutex_t * mutex)) {
@@ -23,4 +23,4 @@ LLVM_LIBC_FUNCTION(int, pthread_mutex_unlock, (pthread_mutex_t * mutex)) {
return 0;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/pthread/pthread_mutex_unlock.h b/libc/src/pthread/pthread_mutex_unlock.h
index 4653841244eb791..303ec001d23787b 100644
--- a/libc/src/pthread/pthread_mutex_unlock.h
+++ b/libc/src/pthread/pthread_mutex_unlock.h
@@ -11,10 +11,10 @@
#include <pthread.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int pthread_mutex_unlock(pthread_mutex_t *mutex);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_PTHREAD_PTHREAD_MUTEX_UNLOCK_H
diff --git a/libc/src/pthread/pthread_mutexattr.h b/libc/src/pthread/pthread_mutexattr.h
index b65c672d34ce41a..8b435854416a781 100644
--- a/libc/src/pthread/pthread_mutexattr.h
+++ b/libc/src/pthread/pthread_mutexattr.h
@@ -13,7 +13,7 @@
#include <pthread.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
enum class PThreadMutexAttrPos : unsigned int {
TYPE_SHIFT = 0,
@@ -43,6 +43,6 @@ LIBC_INLINE int get_mutexattr_robust(pthread_mutexattr_t attr) {
unsigned(PThreadMutexAttrPos::ROBUST_SHIFT);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_PTHREAD_PTHREAD_MUTEXATTR_H
diff --git a/libc/src/pthread/pthread_mutexattr_destroy.cpp b/libc/src/pthread/pthread_mutexattr_destroy.cpp
index cedfbe31c2ba59e..9722d2b551cd72b 100644
--- a/libc/src/pthread/pthread_mutexattr_destroy.cpp
+++ b/libc/src/pthread/pthread_mutexattr_destroy.cpp
@@ -13,10 +13,10 @@
#include <errno.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, pthread_mutexattr_destroy, (pthread_mutexattr_t *)) {
return 0;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/pthread/pthread_mutexattr_destroy.h b/libc/src/pthread/pthread_mutexattr_destroy.h
index 2d7a5ed24e75bea..32a8b949fad8e1d 100644
--- a/libc/src/pthread/pthread_mutexattr_destroy.h
+++ b/libc/src/pthread/pthread_mutexattr_destroy.h
@@ -11,10 +11,10 @@
#include <pthread.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int pthread_mutexattr_destroy(pthread_mutexattr_t *attr);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_PTHREAD_PTHREAD_MUTEXATTR_DESTROY_H
diff --git a/libc/src/pthread/pthread_mutexattr_getpshared.cpp b/libc/src/pthread/pthread_mutexattr_getpshared.cpp
index 636bc1ae05edf27..a89af08464e2f1d 100644
--- a/libc/src/pthread/pthread_mutexattr_getpshared.cpp
+++ b/libc/src/pthread/pthread_mutexattr_getpshared.cpp
@@ -13,7 +13,7 @@
#include <errno.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, pthread_mutexattr_getpshared,
(const pthread_mutexattr_t *__restrict attr,
@@ -23,4 +23,4 @@ LLVM_LIBC_FUNCTION(int, pthread_mutexattr_getpshared,
return 0;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/pthread/pthread_mutexattr_getpshared.h b/libc/src/pthread/pthread_mutexattr_getpshared.h
index 12c60ea00b6852f..843fa36583d67d3 100644
--- a/libc/src/pthread/pthread_mutexattr_getpshared.h
+++ b/libc/src/pthread/pthread_mutexattr_getpshared.h
@@ -11,11 +11,11 @@
#include <pthread.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int pthread_mutexattr_getpshared(const pthread_mutexattr_t *__restrict attr,
int *__restrict pshared);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_PTHREAD_PTHREAD_MUTEXATTR_GETPSHARED_H
diff --git a/libc/src/pthread/pthread_mutexattr_getrobust.cpp b/libc/src/pthread/pthread_mutexattr_getrobust.cpp
index e3677ee415bf13f..9c54b075dd94448 100644
--- a/libc/src/pthread/pthread_mutexattr_getrobust.cpp
+++ b/libc/src/pthread/pthread_mutexattr_getrobust.cpp
@@ -13,7 +13,7 @@
#include <errno.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, pthread_mutexattr_getrobust,
(const pthread_mutexattr_t *__restrict attr,
@@ -23,4 +23,4 @@ LLVM_LIBC_FUNCTION(int, pthread_mutexattr_getrobust,
return 0;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/pthread/pthread_mutexattr_getrobust.h b/libc/src/pthread/pthread_mutexattr_getrobust.h
index 762cde0317fb91d..5ef2b929d704998 100644
--- a/libc/src/pthread/pthread_mutexattr_getrobust.h
+++ b/libc/src/pthread/pthread_mutexattr_getrobust.h
@@ -11,11 +11,11 @@
#include <pthread.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int pthread_mutexattr_getrobust(const pthread_mutexattr_t *__restrict attr,
int *__restrict robust);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_PTHREAD_PTHREAD_MUTEXATTR_GETROBUST_H
diff --git a/libc/src/pthread/pthread_mutexattr_gettype.cpp b/libc/src/pthread/pthread_mutexattr_gettype.cpp
index 6a17e889fcf2443..c54396eff6fd85f 100644
--- a/libc/src/pthread/pthread_mutexattr_gettype.cpp
+++ b/libc/src/pthread/pthread_mutexattr_gettype.cpp
@@ -13,7 +13,7 @@
#include <errno.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, pthread_mutexattr_gettype,
(const pthread_mutexattr_t *__restrict attr,
@@ -23,4 +23,4 @@ LLVM_LIBC_FUNCTION(int, pthread_mutexattr_gettype,
return 0;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/pthread/pthread_mutexattr_gettype.h b/libc/src/pthread/pthread_mutexattr_gettype.h
index b0a7ea82e161240..b0e7c6e8e6a0c80 100644
--- a/libc/src/pthread/pthread_mutexattr_gettype.h
+++ b/libc/src/pthread/pthread_mutexattr_gettype.h
@@ -11,11 +11,11 @@
#include <pthread.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int pthread_mutexattr_gettype(const pthread_mutexattr_t *__restrict attr,
int *__restrict type);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_PTHREAD_PTHREAD_MUTEXATTR_GETTYPE_H
diff --git a/libc/src/pthread/pthread_mutexattr_init.cpp b/libc/src/pthread/pthread_mutexattr_init.cpp
index 818aea1d388c0fe..439d198249a1ee2 100644
--- a/libc/src/pthread/pthread_mutexattr_init.cpp
+++ b/libc/src/pthread/pthread_mutexattr_init.cpp
@@ -11,7 +11,7 @@
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, pthread_mutexattr_init, (pthread_mutexattr_t * attr)) {
// Set the default attributes and mark the attribute object as initiliazed
@@ -20,4 +20,4 @@ LLVM_LIBC_FUNCTION(int, pthread_mutexattr_init, (pthread_mutexattr_t * attr)) {
return 0;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/pthread/pthread_mutexattr_init.h b/libc/src/pthread/pthread_mutexattr_init.h
index af6cf29d9be686d..13de2e5925102cd 100644
--- a/libc/src/pthread/pthread_mutexattr_init.h
+++ b/libc/src/pthread/pthread_mutexattr_init.h
@@ -11,10 +11,10 @@
#include <pthread.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int pthread_mutexattr_init(pthread_mutexattr_t *attr);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_PTHREAD_PTHREAD_MUTEXATTR_INIT_H
diff --git a/libc/src/pthread/pthread_mutexattr_setpshared.cpp b/libc/src/pthread/pthread_mutexattr_setpshared.cpp
index 1554031865a49e9..f654d337bac253a 100644
--- a/libc/src/pthread/pthread_mutexattr_setpshared.cpp
+++ b/libc/src/pthread/pthread_mutexattr_setpshared.cpp
@@ -14,7 +14,7 @@
#include <errno.h>
#include <pthread.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, pthread_mutexattr_setpshared,
(pthread_mutexattr_t *__restrict attr, int pshared)) {
@@ -26,4 +26,4 @@ LLVM_LIBC_FUNCTION(int, pthread_mutexattr_setpshared,
return 0;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/pthread/pthread_mutexattr_setpshared.h b/libc/src/pthread/pthread_mutexattr_setpshared.h
index 21c7734e1fe1b56..0726b7792fedba3 100644
--- a/libc/src/pthread/pthread_mutexattr_setpshared.h
+++ b/libc/src/pthread/pthread_mutexattr_setpshared.h
@@ -11,11 +11,11 @@
#include <pthread.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int pthread_mutexattr_setpshared(pthread_mutexattr_t *__restrict attr,
int pshared);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_PTHREAD_PTHREAD_MUTEXATTR_SETPSHARED_H
diff --git a/libc/src/pthread/pthread_mutexattr_setrobust.cpp b/libc/src/pthread/pthread_mutexattr_setrobust.cpp
index b09e3971d44000d..15fdac61e438dfd 100644
--- a/libc/src/pthread/pthread_mutexattr_setrobust.cpp
+++ b/libc/src/pthread/pthread_mutexattr_setrobust.cpp
@@ -14,7 +14,7 @@
#include <errno.h>
#include <pthread.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, pthread_mutexattr_setrobust,
(pthread_mutexattr_t *__restrict attr, int robust)) {
@@ -26,4 +26,4 @@ LLVM_LIBC_FUNCTION(int, pthread_mutexattr_setrobust,
return 0;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/pthread/pthread_mutexattr_setrobust.h b/libc/src/pthread/pthread_mutexattr_setrobust.h
index 253a319e6e50839..8361a14e38f6825 100644
--- a/libc/src/pthread/pthread_mutexattr_setrobust.h
+++ b/libc/src/pthread/pthread_mutexattr_setrobust.h
@@ -11,11 +11,11 @@
#include <pthread.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int pthread_mutexattr_setrobust(pthread_mutexattr_t *__restrict attr,
int robust);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_PTHREAD_PTHREAD_MUTEXATTR_SETROBUST_H
diff --git a/libc/src/pthread/pthread_mutexattr_settype.cpp b/libc/src/pthread/pthread_mutexattr_settype.cpp
index e8134654e5e1b3e..d5514a1cbf8322a 100644
--- a/libc/src/pthread/pthread_mutexattr_settype.cpp
+++ b/libc/src/pthread/pthread_mutexattr_settype.cpp
@@ -14,7 +14,7 @@
#include <errno.h>
#include <pthread.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, pthread_mutexattr_settype,
(pthread_mutexattr_t *__restrict attr, int type)) {
@@ -28,4 +28,4 @@ LLVM_LIBC_FUNCTION(int, pthread_mutexattr_settype,
return 0;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/pthread/pthread_mutexattr_settype.h b/libc/src/pthread/pthread_mutexattr_settype.h
index 2411558ae217f29..8ad3285bacf3043 100644
--- a/libc/src/pthread/pthread_mutexattr_settype.h
+++ b/libc/src/pthread/pthread_mutexattr_settype.h
@@ -11,10 +11,10 @@
#include <pthread.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int pthread_mutexattr_settype(pthread_mutexattr_t *__restrict attr, int type);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_PTHREAD_PTHREAD_MUTEXATTR_SETTYPE_H
diff --git a/libc/src/pthread/pthread_once.cpp b/libc/src/pthread/pthread_once.cpp
index 4d141a672036844..0e0045e9c540701 100644
--- a/libc/src/pthread/pthread_once.cpp
+++ b/libc/src/pthread/pthread_once.cpp
@@ -12,7 +12,7 @@
#include <pthread.h> // For pthread_once_t and __pthread_once_func_t definitions.
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, pthread_once,
(pthread_once_t * flag, __pthread_once_func_t func)) {
@@ -20,4 +20,4 @@ LLVM_LIBC_FUNCTION(int, pthread_once,
reinterpret_cast<CallOnceCallback *>(func));
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/pthread/pthread_once.h b/libc/src/pthread/pthread_once.h
index b9b7212f72af688..25ee70a99c4d4c5 100644
--- a/libc/src/pthread/pthread_once.h
+++ b/libc/src/pthread/pthread_once.h
@@ -11,10 +11,10 @@
#include <pthread.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int pthread_once(pthread_once_t *flag, __pthread_once_func_t func);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_PTHREAD_PTHREAD_ONCE_H
diff --git a/libc/src/pthread/pthread_self.cpp b/libc/src/pthread/pthread_self.cpp
index 5b3145f34930ce0..3e74f964c9af286 100644
--- a/libc/src/pthread/pthread_self.cpp
+++ b/libc/src/pthread/pthread_self.cpp
@@ -13,9 +13,9 @@
#include <pthread.h> // For pthread_* type definitions.
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
-static_assert(sizeof(pthread_t) == sizeof(__llvm_libc::Thread),
+static_assert(sizeof(pthread_t) == sizeof(LIBC_NAMESPACE::Thread),
"Mismatch between pthread_t and internal Thread.");
LLVM_LIBC_FUNCTION(pthread_t, pthread_self, ()) {
@@ -24,4 +24,4 @@ LLVM_LIBC_FUNCTION(pthread_t, pthread_self, ()) {
return th;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/pthread/pthread_self.h b/libc/src/pthread/pthread_self.h
index 1c4080bb9f63276..058072e45ed2881 100644
--- a/libc/src/pthread/pthread_self.h
+++ b/libc/src/pthread/pthread_self.h
@@ -11,10 +11,10 @@
#include <pthread.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
pthread_t pthread_self();
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_PTHREAD_PTHREAD_SELF_H
diff --git a/libc/src/pthread/pthread_setname_np.cpp b/libc/src/pthread/pthread_setname_np.cpp
index 425c25bd3a5f7dc..e211d7e082740b8 100644
--- a/libc/src/pthread/pthread_setname_np.cpp
+++ b/libc/src/pthread/pthread_setname_np.cpp
@@ -14,14 +14,14 @@
#include <pthread.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
-static_assert(sizeof(pthread_t) == sizeof(__llvm_libc::Thread),
+static_assert(sizeof(pthread_t) == sizeof(LIBC_NAMESPACE::Thread),
"Mismatch between pthread_t and internal Thread.");
LLVM_LIBC_FUNCTION(int, pthread_setname_np, (pthread_t th, const char *name)) {
- auto *thread = reinterpret_cast<__llvm_libc::Thread *>(&th);
+ auto *thread = reinterpret_cast<LIBC_NAMESPACE::Thread *>(&th);
return thread->set_name(cpp::string_view(name));
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/pthread/pthread_setname_np.h b/libc/src/pthread/pthread_setname_np.h
index 25b8c1f4f5e0f0c..e240425ae2b46bf 100644
--- a/libc/src/pthread/pthread_setname_np.h
+++ b/libc/src/pthread/pthread_setname_np.h
@@ -11,10 +11,10 @@
#include <pthread.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int pthread_setname_np(pthread_t, const char *name);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_PTHREAD_PTHREAD_SETNAME_NP_H
diff --git a/libc/src/pthread/pthread_setspecific.cpp b/libc/src/pthread/pthread_setspecific.cpp
index 15504f7f536304e..e9b23d8483a8ff5 100644
--- a/libc/src/pthread/pthread_setspecific.cpp
+++ b/libc/src/pthread/pthread_setspecific.cpp
@@ -14,7 +14,7 @@
#include <errno.h>
#include <pthread.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, pthread_setspecific,
(pthread_key_t key, const void *data)) {
@@ -24,4 +24,4 @@ LLVM_LIBC_FUNCTION(int, pthread_setspecific,
return EINVAL;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/pthread/pthread_setspecific.h b/libc/src/pthread/pthread_setspecific.h
index 4211a8e79e87636..af9a890fd0aebdc 100644
--- a/libc/src/pthread/pthread_setspecific.h
+++ b/libc/src/pthread/pthread_setspecific.h
@@ -11,10 +11,10 @@
#include <pthread.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int pthread_setspecific(pthread_key_t, const void *);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_PTHREAD_PTHREAD_SETSPECIFIC_H
diff --git a/libc/src/sched/linux/sched_get_priority_max.cpp b/libc/src/sched/linux/sched_get_priority_max.cpp
index c2954e3e8fbc437..0b6537ecd84c6ff 100644
--- a/libc/src/sched/linux/sched_get_priority_max.cpp
+++ b/libc/src/sched/linux/sched_get_priority_max.cpp
@@ -14,10 +14,11 @@
#include <sys/syscall.h> // For syscall numbers.
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, sched_get_priority_max, (int policy)) {
- int ret = __llvm_libc::syscall_impl<int>(SYS_sched_get_priority_max, policy);
+ int ret =
+ LIBC_NAMESPACE::syscall_impl<int>(SYS_sched_get_priority_max, policy);
if (ret < 0) {
libc_errno = -ret;
return -1;
@@ -25,4 +26,4 @@ LLVM_LIBC_FUNCTION(int, sched_get_priority_max, (int policy)) {
return ret;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/sched/linux/sched_get_priority_min.cpp b/libc/src/sched/linux/sched_get_priority_min.cpp
index 442b8572ab413e2..1240a500887eeb6 100644
--- a/libc/src/sched/linux/sched_get_priority_min.cpp
+++ b/libc/src/sched/linux/sched_get_priority_min.cpp
@@ -14,10 +14,11 @@
#include <sys/syscall.h> // For syscall numbers.
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, sched_get_priority_min, (int policy)) {
- int ret = __llvm_libc::syscall_impl<int>(SYS_sched_get_priority_min, policy);
+ int ret =
+ LIBC_NAMESPACE::syscall_impl<int>(SYS_sched_get_priority_min, policy);
if (ret < 0) {
libc_errno = -ret;
return -1;
@@ -25,4 +26,4 @@ LLVM_LIBC_FUNCTION(int, sched_get_priority_min, (int policy)) {
return ret;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/sched/linux/sched_getaffinity.cpp b/libc/src/sched/linux/sched_getaffinity.cpp
index fcdd8c32e156e3c..476576178fa48f0 100644
--- a/libc/src/sched/linux/sched_getaffinity.cpp
+++ b/libc/src/sched/linux/sched_getaffinity.cpp
@@ -16,12 +16,12 @@
#include <stdint.h>
#include <sys/syscall.h> // For syscall numbers.
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, sched_getaffinity,
(pid_t tid, size_t cpuset_size, cpu_set_t *mask)) {
- int ret = __llvm_libc::syscall_impl<int>(SYS_sched_getaffinity, tid,
- cpuset_size, mask);
+ int ret = LIBC_NAMESPACE::syscall_impl<int>(SYS_sched_getaffinity, tid,
+ cpuset_size, mask);
if (ret < 0) {
libc_errno = -ret;
return -1;
@@ -36,4 +36,4 @@ LLVM_LIBC_FUNCTION(int, sched_getaffinity,
return 0;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/sched/linux/sched_getcpucount.cpp b/libc/src/sched/linux/sched_getcpucount.cpp
index bcb5e8222145a67..a816d92e4c0b5bf 100644
--- a/libc/src/sched/linux/sched_getcpucount.cpp
+++ b/libc/src/sched/linux/sched_getcpucount.cpp
@@ -13,7 +13,7 @@
#include <sched.h>
#include <stddef.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, __sched_getcpucount,
(size_t cpuset_size, const cpu_set_t *mask)) {
@@ -24,4 +24,4 @@ LLVM_LIBC_FUNCTION(int, __sched_getcpucount,
return result;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/sched/linux/sched_getparam.cpp b/libc/src/sched/linux/sched_getparam.cpp
index 3b19c2e1f802c22..64a62c5fd5e84ad 100644
--- a/libc/src/sched/linux/sched_getparam.cpp
+++ b/libc/src/sched/linux/sched_getparam.cpp
@@ -14,11 +14,11 @@
#include <sys/syscall.h> // For syscall numbers.
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, sched_getparam,
(pid_t tid, struct sched_param *param)) {
- int ret = __llvm_libc::syscall_impl<int>(SYS_sched_getparam, tid, param);
+ int ret = LIBC_NAMESPACE::syscall_impl<int>(SYS_sched_getparam, tid, param);
if (ret < 0) {
libc_errno = -ret;
return -1;
@@ -26,4 +26,4 @@ LLVM_LIBC_FUNCTION(int, sched_getparam,
return 0;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/sched/linux/sched_getscheduler.cpp b/libc/src/sched/linux/sched_getscheduler.cpp
index 1f9affb00ed4584..992a11d29259160 100644
--- a/libc/src/sched/linux/sched_getscheduler.cpp
+++ b/libc/src/sched/linux/sched_getscheduler.cpp
@@ -14,10 +14,10 @@
#include <sys/syscall.h> // For syscall numbers.
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, sched_getscheduler, (pid_t tid)) {
- int ret = __llvm_libc::syscall_impl<int>(SYS_sched_getscheduler, tid);
+ int ret = LIBC_NAMESPACE::syscall_impl<int>(SYS_sched_getscheduler, tid);
if (ret < 0) {
libc_errno = -ret;
return -1;
@@ -25,4 +25,4 @@ LLVM_LIBC_FUNCTION(int, sched_getscheduler, (pid_t tid)) {
return ret;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/sched/linux/sched_rr_get_interval.cpp b/libc/src/sched/linux/sched_rr_get_interval.cpp
index c50dc711620b1d1..9d7d0e9d1ef6a15 100644
--- a/libc/src/sched/linux/sched_rr_get_interval.cpp
+++ b/libc/src/sched/linux/sched_rr_get_interval.cpp
@@ -18,12 +18,13 @@
#include <linux/time_types.h> // For __kernel_timespec.
#endif
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, sched_rr_get_interval,
(pid_t tid, struct timespec *tp)) {
#ifdef SYS_sched_rr_get_interval
- int ret = __llvm_libc::syscall_impl<int>(SYS_sched_rr_get_interval, tid, tp);
+ int ret =
+ LIBC_NAMESPACE::syscall_impl<int>(SYS_sched_rr_get_interval, tid, tp);
#elif defined(SYS_sched_rr_get_interval_time64)
// The difference between the and SYS_sched_rr_get_interval
// SYS_sched_rr_get_interval_time64 syscalls is the data type used for the
@@ -31,16 +32,16 @@ LLVM_LIBC_FUNCTION(int, sched_rr_get_interval,
int ret;
if (tp) {
struct __kernel_timespec ts32;
- ret = __llvm_libc::syscall_impl<int>(SYS_sched_rr_get_interval_time64, tid,
- &ts32);
+ ret = LIBC_NAMESPACE::syscall_impl<int>(SYS_sched_rr_get_interval_time64,
+ tid, &ts32);
if (ret == 0) {
tp->tv_sec = ts32.tv_sec;
tp->tv_nsec = ts32.tv_nsec;
}
} else
// When tp is a nullptr, we still do the syscall to set ret and errno
- ret = __llvm_libc::syscall_impl<int>(SYS_sched_rr_get_interval_time64, tid,
- nullptr);
+ ret = LIBC_NAMESPACE::syscall_impl<int>(SYS_sched_rr_get_interval_time64,
+ tid, nullptr);
#else
#error \
"sched_rr_get_interval and sched_rr_get_interval_time64 syscalls not available."
@@ -52,4 +53,4 @@ LLVM_LIBC_FUNCTION(int, sched_rr_get_interval,
return 0;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/sched/linux/sched_setaffinity.cpp b/libc/src/sched/linux/sched_setaffinity.cpp
index 1c9925419172169..509894258e126cc 100644
--- a/libc/src/sched/linux/sched_setaffinity.cpp
+++ b/libc/src/sched/linux/sched_setaffinity.cpp
@@ -15,12 +15,12 @@
#include <sched.h>
#include <sys/syscall.h> // For syscall numbers.
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, sched_setaffinity,
(pid_t tid, size_t cpuset_size, const cpu_set_t *mask)) {
- int ret = __llvm_libc::syscall_impl<int>(SYS_sched_setaffinity, tid,
- cpuset_size, mask);
+ int ret = LIBC_NAMESPACE::syscall_impl<int>(SYS_sched_setaffinity, tid,
+ cpuset_size, mask);
if (ret < 0) {
libc_errno = -ret;
return -1;
@@ -28,4 +28,4 @@ LLVM_LIBC_FUNCTION(int, sched_setaffinity,
return 0;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/sched/linux/sched_setparam.cpp b/libc/src/sched/linux/sched_setparam.cpp
index 28698003b14826d..79acf78ef887ef9 100644
--- a/libc/src/sched/linux/sched_setparam.cpp
+++ b/libc/src/sched/linux/sched_setparam.cpp
@@ -14,11 +14,11 @@
#include <sys/syscall.h> // For syscall numbers.
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, sched_setparam,
(pid_t tid, const struct sched_param *param)) {
- int ret = __llvm_libc::syscall_impl<int>(SYS_sched_setparam, tid, param);
+ int ret = LIBC_NAMESPACE::syscall_impl<int>(SYS_sched_setparam, tid, param);
if (ret < 0) {
libc_errno = -ret;
return -1;
@@ -26,4 +26,4 @@ LLVM_LIBC_FUNCTION(int, sched_setparam,
return 0;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/sched/linux/sched_setscheduler.cpp b/libc/src/sched/linux/sched_setscheduler.cpp
index c0b6205a47d003c..1c18526a3c8146c 100644
--- a/libc/src/sched/linux/sched_setscheduler.cpp
+++ b/libc/src/sched/linux/sched_setscheduler.cpp
@@ -14,12 +14,12 @@
#include <sys/syscall.h> // For syscall numbers.
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, sched_setscheduler,
(pid_t tid, int policy, const struct sched_param *param)) {
- int ret = __llvm_libc::syscall_impl<int>(SYS_sched_setscheduler, tid, policy,
- param);
+ int ret = LIBC_NAMESPACE::syscall_impl<int>(SYS_sched_setscheduler, tid,
+ policy, param);
if (ret < 0) {
libc_errno = -ret;
return -1;
@@ -27,4 +27,4 @@ LLVM_LIBC_FUNCTION(int, sched_setscheduler,
return ret;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/sched/linux/sched_yield.cpp b/libc/src/sched/linux/sched_yield.cpp
index 27a6f372b04722e..6878a375aa092b1 100644
--- a/libc/src/sched/linux/sched_yield.cpp
+++ b/libc/src/sched/linux/sched_yield.cpp
@@ -14,10 +14,10 @@
#include <sys/syscall.h> // For syscall numbers.
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, sched_yield, ()) {
- int ret = __llvm_libc::syscall_impl<int>(SYS_sched_yield);
+ int ret = LIBC_NAMESPACE::syscall_impl<int>(SYS_sched_yield);
// As of writing this, yield() cannot fail
if (ret < 0) {
libc_errno = -ret;
@@ -26,4 +26,4 @@ LLVM_LIBC_FUNCTION(int, sched_yield, ()) {
return 0;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/sched/sched_get_priority_max.h b/libc/src/sched/sched_get_priority_max.h
index 3ddcb086278364c..01611dae7bd1268 100644
--- a/libc/src/sched/sched_get_priority_max.h
+++ b/libc/src/sched/sched_get_priority_max.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_SCHED_SCHED_GET_PRIORITY_MAX_H
#define LLVM_LIBC_SRC_SCHED_SCHED_GET_PRIORITY_MAX_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int sched_get_priority_max(int policy);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_SCHED_SCHED_GET_PRIORITY_MAX_H
diff --git a/libc/src/sched/sched_get_priority_min.h b/libc/src/sched/sched_get_priority_min.h
index 10bca87beadcb92..f4b5d5487887cab 100644
--- a/libc/src/sched/sched_get_priority_min.h
+++ b/libc/src/sched/sched_get_priority_min.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_SCHED_SCHED_GET_PRIORITY_MIN_H
#define LLVM_LIBC_SRC_SCHED_SCHED_GET_PRIORITY_MIN_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int sched_get_priority_min(int policy);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_SCHED_SCHED_GET_PRIORITY_MIN_H
diff --git a/libc/src/sched/sched_getaffinity.h b/libc/src/sched/sched_getaffinity.h
index 12317729b02ba0e..2f29b7e2a0b9e8b 100644
--- a/libc/src/sched/sched_getaffinity.h
+++ b/libc/src/sched/sched_getaffinity.h
@@ -11,10 +11,10 @@
#include <sched.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int sched_getaffinity(pid_t tid, size_t cpuset_size, cpu_set_t *mask);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_SCHED_SCHED_GETAFFINITY_H
diff --git a/libc/src/sched/sched_getcpucount.h b/libc/src/sched/sched_getcpucount.h
index f55ec147d5825a9..a0c696fd1f4ae06 100644
--- a/libc/src/sched/sched_getcpucount.h
+++ b/libc/src/sched/sched_getcpucount.h
@@ -12,12 +12,12 @@
#include <sched.h>
#include <stddef.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
// This function is for internal use in the CPU_COUNT macro, but since that's a
// macro and will be applied to client files, this must be a public entrypoint.
int __sched_getcpucount(size_t cpuset_size, const cpu_set_t *mask);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_SCHED_SCHED_GETCPUCOUNT_H
diff --git a/libc/src/sched/sched_getparam.h b/libc/src/sched/sched_getparam.h
index fcae11b71f8b536..09bed7012e3fddb 100644
--- a/libc/src/sched/sched_getparam.h
+++ b/libc/src/sched/sched_getparam.h
@@ -11,10 +11,10 @@
#include <sched.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int sched_getparam(pid_t tid, struct sched_param *param);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_SCHED_SCHED_GETPARAM_H
diff --git a/libc/src/sched/sched_getscheduler.h b/libc/src/sched/sched_getscheduler.h
index 543b72d5a66fc3a..6e4fe060a6c4ef3 100644
--- a/libc/src/sched/sched_getscheduler.h
+++ b/libc/src/sched/sched_getscheduler.h
@@ -11,10 +11,10 @@
#include <sched.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int sched_getscheduler(pid_t tid);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_SCHED_SCHED_GETSCHEDULER_H
diff --git a/libc/src/sched/sched_rr_get_interval.h b/libc/src/sched/sched_rr_get_interval.h
index b90e4c3c26accd4..f9eb2d9a2220d5c 100644
--- a/libc/src/sched/sched_rr_get_interval.h
+++ b/libc/src/sched/sched_rr_get_interval.h
@@ -11,10 +11,10 @@
#include <sched.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int sched_rr_get_interval(pid_t tid, struct timespec *tp);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_SCHED_SCHED_RR_GET_INTERVAL_H
diff --git a/libc/src/sched/sched_setaffinity.h b/libc/src/sched/sched_setaffinity.h
index 9f3f8fe3b174845..5da6dd43e7d5d7a 100644
--- a/libc/src/sched/sched_setaffinity.h
+++ b/libc/src/sched/sched_setaffinity.h
@@ -11,10 +11,10 @@
#include <sched.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int sched_setaffinity(pid_t pid, size_t cpuset_size, const cpu_set_t *mask);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_SCHED_SCHED_SETAFFINITY_H
diff --git a/libc/src/sched/sched_setparam.h b/libc/src/sched/sched_setparam.h
index 1707597045fd757..c371bc0bc753165 100644
--- a/libc/src/sched/sched_setparam.h
+++ b/libc/src/sched/sched_setparam.h
@@ -11,10 +11,10 @@
#include <sched.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int sched_setparam(pid_t tid, const struct sched_param *param);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_SCHED_SCHED_SETPARAM_H
diff --git a/libc/src/sched/sched_setscheduler.h b/libc/src/sched/sched_setscheduler.h
index 2a56e27cdf138f2..8e0cb0d0629aee7 100644
--- a/libc/src/sched/sched_setscheduler.h
+++ b/libc/src/sched/sched_setscheduler.h
@@ -11,10 +11,10 @@
#include <sched.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int sched_setscheduler(pid_t tid, int policy, const struct sched_param *param);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_SCHED_SCHED_SETSCHEDULER_H
diff --git a/libc/src/sched/sched_yield.h b/libc/src/sched/sched_yield.h
index a64950039cdc872..493646a84edbbfd 100644
--- a/libc/src/sched/sched_yield.h
+++ b/libc/src/sched/sched_yield.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_SCHED_SCHED_YIELD_H
#define LLVM_LIBC_SRC_SCHED_SCHED_YIELD_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int sched_yield(void);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_SCHED_SCHED_YIELD_H
diff --git a/libc/src/setjmp/longjmp.h b/libc/src/setjmp/longjmp.h
index 5937504cf7e0810..3697d62968c27c9 100644
--- a/libc/src/setjmp/longjmp.h
+++ b/libc/src/setjmp/longjmp.h
@@ -11,10 +11,10 @@
#include <setjmp.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
void longjmp(__jmp_buf *buf, int val);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_SETJMP_LONGJMP_H
diff --git a/libc/src/setjmp/riscv64/longjmp.cpp b/libc/src/setjmp/riscv64/longjmp.cpp
index 7d8acd316845bc6..0aed25e8125adce 100644
--- a/libc/src/setjmp/riscv64/longjmp.cpp
+++ b/libc/src/setjmp/riscv64/longjmp.cpp
@@ -27,7 +27,7 @@
#define LOAD_FP(reg, val) LOAD_IMPL(fld, reg, val)
#endif
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(void, longjmp, (__jmp_buf * buf, int val)) {
LOAD(ra, buf->__pc);
@@ -66,4 +66,4 @@ LLVM_LIBC_FUNCTION(void, longjmp, (__jmp_buf * buf, int val)) {
LIBC_INLINE_ASM("add a0, %0, zero\n\t" : : "r"(val) :);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/setjmp/riscv64/setjmp.cpp b/libc/src/setjmp/riscv64/setjmp.cpp
index 1ffc8d404f3c9df..826aa4021d3f4f6 100644
--- a/libc/src/setjmp/riscv64/setjmp.cpp
+++ b/libc/src/setjmp/riscv64/setjmp.cpp
@@ -26,7 +26,7 @@
#define STORE_FP(reg, val) STORE_IMPL(fsd, reg, val)
#endif
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, setjmp, (__jmp_buf * buf)) {
STORE(ra, buf->__pc);
@@ -64,4 +64,4 @@ LLVM_LIBC_FUNCTION(int, setjmp, (__jmp_buf * buf)) {
return 0;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/setjmp/setjmp_impl.h b/libc/src/setjmp/setjmp_impl.h
index 9dc5396d58b4664..52c835c7414c72a 100644
--- a/libc/src/setjmp/setjmp_impl.h
+++ b/libc/src/setjmp/setjmp_impl.h
@@ -13,10 +13,10 @@
// public header setjmp.h which is also included. here.
#include <setjmp.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int setjmp(__jmp_buf *buf);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_SETJMP_SETJMP_IMPL_H
diff --git a/libc/src/setjmp/x86_64/longjmp.cpp b/libc/src/setjmp/x86_64/longjmp.cpp
index d509b25b1d52501..32340463e9f37ba 100644
--- a/libc/src/setjmp/x86_64/longjmp.cpp
+++ b/libc/src/setjmp/x86_64/longjmp.cpp
@@ -13,7 +13,7 @@
#error "Invalid file include"
#endif
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(void, longjmp, (__jmp_buf * buf, int val)) {
register __UINT64_TYPE__ rbx __asm__("rbx");
@@ -41,4 +41,4 @@ LLVM_LIBC_FUNCTION(void, longjmp, (__jmp_buf * buf, int val)) {
LIBC_INLINE_ASM("jmp *%0\n\t" : : "m"(buf->rip));
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/setjmp/x86_64/setjmp.cpp b/libc/src/setjmp/x86_64/setjmp.cpp
index 988db6452571d59..8b6981d4cc34a24 100644
--- a/libc/src/setjmp/x86_64/setjmp.cpp
+++ b/libc/src/setjmp/x86_64/setjmp.cpp
@@ -13,7 +13,7 @@
#error "Invalid file include"
#endif
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, setjmp, (__jmp_buf * buf)) {
register __UINT64_TYPE__ rbx __asm__("rbx");
@@ -53,4 +53,4 @@ LLVM_LIBC_FUNCTION(int, setjmp, (__jmp_buf * buf)) {
return 0;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/signal/kill.h b/libc/src/signal/kill.h
index 52d5b0da6cc14e1..a6d18935459ca27 100644
--- a/libc/src/signal/kill.h
+++ b/libc/src/signal/kill.h
@@ -11,10 +11,10 @@
#include <signal.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int kill(pid_t pid, int sig);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_SIGNAL_KILL_H
diff --git a/libc/src/signal/linux/__restore.cpp b/libc/src/signal/linux/__restore.cpp
index 947373031f15780..36fa375d672e18c 100644
--- a/libc/src/signal/linux/__restore.cpp
+++ b/libc/src/signal/linux/__restore.cpp
@@ -14,14 +14,14 @@
#include <sys/syscall.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
extern "C" void __restore_rt()
__attribute__((no_sanitize("all"),
hidden));
extern "C" void __restore_rt() {
- __llvm_libc::syscall_impl<long>(SYS_rt_sigreturn);
+ LIBC_NAMESPACE::syscall_impl<long>(SYS_rt_sigreturn);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/signal/linux/kill.cpp b/libc/src/signal/linux/kill.cpp
index 10d50761edf3ad1..a02b3b1d140035d 100644
--- a/libc/src/signal/linux/kill.cpp
+++ b/libc/src/signal/linux/kill.cpp
@@ -16,10 +16,10 @@
#include <signal.h>
#include <sys/syscall.h> // For syscall numbers.
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, kill, (pid_t pid, int sig)) {
- int ret = __llvm_libc::syscall_impl<int>(SYS_kill, pid, sig);
+ int ret = LIBC_NAMESPACE::syscall_impl<int>(SYS_kill, pid, sig);
// A negative return value indicates an error with the magnitude of the
// value being the error code.
@@ -31,4 +31,4 @@ LLVM_LIBC_FUNCTION(int, kill, (pid_t pid, int sig)) {
return ret; // always 0
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/signal/linux/raise.cpp b/libc/src/signal/linux/raise.cpp
index 0a9bf295b016eae..dd6f5eb4b357542 100644
--- a/libc/src/signal/linux/raise.cpp
+++ b/libc/src/signal/linux/raise.cpp
@@ -11,16 +11,16 @@
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, raise, (int sig)) {
::sigset_t sigset;
block_all_signals(sigset);
- long pid = __llvm_libc::syscall_impl<long>(SYS_getpid);
- long tid = __llvm_libc::syscall_impl<long>(SYS_gettid);
- int ret = __llvm_libc::syscall_impl<int>(SYS_tgkill, pid, tid, sig);
+ long pid = LIBC_NAMESPACE::syscall_impl<long>(SYS_getpid);
+ long tid = LIBC_NAMESPACE::syscall_impl<long>(SYS_gettid);
+ int ret = LIBC_NAMESPACE::syscall_impl<int>(SYS_tgkill, pid, tid, sig);
restore_signals(sigset);
return ret;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/signal/linux/sigaction.cpp b/libc/src/signal/linux/sigaction.cpp
index 08f4d0a8f575f45..7ddc2dc5cbcc700 100644
--- a/libc/src/signal/linux/sigaction.cpp
+++ b/libc/src/signal/linux/sigaction.cpp
@@ -14,7 +14,7 @@
#include <signal.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
// TOOD: Some architectures will have their signal trampoline functions in the
// vdso, use those when available.
@@ -34,7 +34,7 @@ LLVM_LIBC_FUNCTION(int, sigaction,
}
KernelSigaction kernel_old;
- int ret = __llvm_libc::syscall_impl<int>(
+ int ret = LIBC_NAMESPACE::syscall_impl<int>(
SYS_rt_sigaction, signal, libc_new ? &kernel_new : nullptr,
libc_old ? &kernel_old : nullptr, sizeof(sigset_t));
if (ret) {
@@ -47,4 +47,4 @@ LLVM_LIBC_FUNCTION(int, sigaction,
return 0;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/signal/linux/sigaddset.cpp b/libc/src/signal/linux/sigaddset.cpp
index ff65c04e3e95276..536391734e05875 100644
--- a/libc/src/signal/linux/sigaddset.cpp
+++ b/libc/src/signal/linux/sigaddset.cpp
@@ -13,7 +13,7 @@
#include <signal.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, sigaddset, (sigset_t * set, int signum)) {
if (set != nullptr && add_signal(*set, signum))
@@ -22,4 +22,4 @@ LLVM_LIBC_FUNCTION(int, sigaddset, (sigset_t * set, int signum)) {
return -1;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/signal/linux/sigaltstack.cpp b/libc/src/signal/linux/sigaltstack.cpp
index 1e58dc725e4b4e3..47e0b23f4bad5c2 100644
--- a/libc/src/signal/linux/sigaltstack.cpp
+++ b/libc/src/signal/linux/sigaltstack.cpp
@@ -15,7 +15,7 @@
#include <signal.h>
#include <sys/syscall.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, sigaltstack,
(const stack_t *__restrict ss, stack_t *__restrict oss)) {
@@ -34,7 +34,7 @@ LLVM_LIBC_FUNCTION(int, sigaltstack,
}
}
- int ret = __llvm_libc::syscall_impl<int>(SYS_sigaltstack, ss, oss);
+ int ret = LIBC_NAMESPACE::syscall_impl<int>(SYS_sigaltstack, ss, oss);
if (ret < 0) {
libc_errno = -ret;
return -1;
@@ -42,4 +42,4 @@ LLVM_LIBC_FUNCTION(int, sigaltstack,
return 0;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/signal/linux/sigdelset.cpp b/libc/src/signal/linux/sigdelset.cpp
index ebaa4122c067e37..5cb645e461cf8e4 100644
--- a/libc/src/signal/linux/sigdelset.cpp
+++ b/libc/src/signal/linux/sigdelset.cpp
@@ -13,7 +13,7 @@
#include <signal.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, sigdelset, (sigset_t * set, int signum)) {
if (set != nullptr && delete_signal(*set, signum))
@@ -22,4 +22,4 @@ LLVM_LIBC_FUNCTION(int, sigdelset, (sigset_t * set, int signum)) {
return -1;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/signal/linux/sigemptyset.cpp b/libc/src/signal/linux/sigemptyset.cpp
index 6f4c731b0831acf..d08191e8ce4e0ba 100644
--- a/libc/src/signal/linux/sigemptyset.cpp
+++ b/libc/src/signal/linux/sigemptyset.cpp
@@ -14,7 +14,7 @@
#include <signal.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, sigemptyset, (sigset_t * set)) {
if (!set) {
@@ -25,4 +25,4 @@ LLVM_LIBC_FUNCTION(int, sigemptyset, (sigset_t * set)) {
return 0;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/signal/linux/sigfillset.cpp b/libc/src/signal/linux/sigfillset.cpp
index 9c3796dbee47f9d..e17c85a897ce746 100644
--- a/libc/src/signal/linux/sigfillset.cpp
+++ b/libc/src/signal/linux/sigfillset.cpp
@@ -13,7 +13,7 @@
#include <signal.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, sigfillset, (sigset_t * set)) {
if (!set) {
@@ -24,4 +24,4 @@ LLVM_LIBC_FUNCTION(int, sigfillset, (sigset_t * set)) {
return 0;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/signal/linux/signal.cpp b/libc/src/signal/linux/signal.cpp
index 464a23c2977540a..a517fa73ba8a2ce 100644
--- a/libc/src/signal/linux/signal.cpp
+++ b/libc/src/signal/linux/signal.cpp
@@ -13,15 +13,16 @@
#include <signal.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(sighandler_t, signal, (int signum, sighandler_t handler)) {
struct sigaction action, old;
action.sa_handler = handler;
action.sa_flags = SA_RESTART;
// Errno will already be set so no need to worry about changing errno here.
- return __llvm_libc::sigaction(signum, &action, &old) == -1 ? SIG_ERR
- : old.sa_handler;
+ return LIBC_NAMESPACE::sigaction(signum, &action, &old) == -1
+ ? SIG_ERR
+ : old.sa_handler;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/signal/linux/signal_utils.h b/libc/src/signal/linux/signal_utils.h
index 7b976fcafc86991..ca6fd3aeb1a6ed6 100644
--- a/libc/src/signal/linux/signal_utils.h
+++ b/libc/src/signal/linux/signal_utils.h
@@ -16,7 +16,7 @@
#include <stddef.h>
#include <sys/syscall.h> // For syscall numbers.
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
// The POSIX definition of struct sigaction and the sigaction data structure
// expected by the rt_sigaction syscall differ in their definition. So, we
@@ -96,15 +96,15 @@ LIBC_INLINE constexpr bool delete_signal(sigset_t &set, int signal) {
LIBC_INLINE int block_all_signals(sigset_t &set) {
sigset_t full = full_set();
- return __llvm_libc::syscall_impl<int>(SYS_rt_sigprocmask, SIG_BLOCK, &full,
- &set, sizeof(sigset_t));
+ return LIBC_NAMESPACE::syscall_impl<int>(SYS_rt_sigprocmask, SIG_BLOCK, &full,
+ &set, sizeof(sigset_t));
}
LIBC_INLINE int restore_signals(const sigset_t &set) {
- return __llvm_libc::syscall_impl<int>(SYS_rt_sigprocmask, SIG_SETMASK, &set,
- nullptr, sizeof(sigset_t));
+ return LIBC_NAMESPACE::syscall_impl<int>(SYS_rt_sigprocmask, SIG_SETMASK,
+ &set, nullptr, sizeof(sigset_t));
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_SIGNAL_LINUX_SIGNAL_UTILS_H
diff --git a/libc/src/signal/linux/sigprocmask.cpp b/libc/src/signal/linux/sigprocmask.cpp
index f47cbd89ab2bb3f..79a35dd59d75c8a 100644
--- a/libc/src/signal/linux/sigprocmask.cpp
+++ b/libc/src/signal/linux/sigprocmask.cpp
@@ -16,13 +16,13 @@
#include <signal.h>
#include <sys/syscall.h> // For syscall numbers.
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, sigprocmask,
(int how, const sigset_t *__restrict set,
sigset_t *__restrict oldset)) {
- int ret = __llvm_libc::syscall_impl<int>(SYS_rt_sigprocmask, how, set, oldset,
- sizeof(sigset_t));
+ int ret = LIBC_NAMESPACE::syscall_impl<int>(SYS_rt_sigprocmask, how, set,
+ oldset, sizeof(sigset_t));
if (!ret)
return 0;
@@ -30,4 +30,4 @@ LLVM_LIBC_FUNCTION(int, sigprocmask,
return -1;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/signal/raise.h b/libc/src/signal/raise.h
index 624b93c97b61097..ee4f3c9f826a9b0 100644
--- a/libc/src/signal/raise.h
+++ b/libc/src/signal/raise.h
@@ -11,10 +11,10 @@
#include <signal.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int raise(int sig);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_SIGNAL_RAISE_H
diff --git a/libc/src/signal/sigaction.h b/libc/src/signal/sigaction.h
index 8315a56bb01666c..c36a3ec9fedfaa3 100644
--- a/libc/src/signal/sigaction.h
+++ b/libc/src/signal/sigaction.h
@@ -11,11 +11,11 @@
#include <signal.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int sigaction(int signal, const struct sigaction *__restrict libc_new,
struct sigaction *__restrict libc_old);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_SIGNAL_SIGACTION_H
diff --git a/libc/src/signal/sigaddset.h b/libc/src/signal/sigaddset.h
index 7d4613e32c03663..626eb20a295c839 100644
--- a/libc/src/signal/sigaddset.h
+++ b/libc/src/signal/sigaddset.h
@@ -11,10 +11,10 @@
#include <signal.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int sigaddset(sigset_t *set, int signum);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_SIGNAL_SIGADDSET_H
diff --git a/libc/src/signal/sigaltstack.h b/libc/src/signal/sigaltstack.h
index 7cc77aad883aa12..705bd368ce47b59 100644
--- a/libc/src/signal/sigaltstack.h
+++ b/libc/src/signal/sigaltstack.h
@@ -11,10 +11,10 @@
#include <signal.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int sigaltstack(const stack_t *__restrict ss, stack_t *__restrict oss);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_SIGNAL_SIGALTSTACK_H
diff --git a/libc/src/signal/sigdelset.h b/libc/src/signal/sigdelset.h
index 2283bb5fa701c29..c4fdb9975fa3d0f 100644
--- a/libc/src/signal/sigdelset.h
+++ b/libc/src/signal/sigdelset.h
@@ -11,10 +11,10 @@
#include <signal.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int sigdelset(sigset_t *set, int signum);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_SIGNAL_SIGDELSET_H
diff --git a/libc/src/signal/sigemptyset.h b/libc/src/signal/sigemptyset.h
index bcb9c1a994e0a0f..f3763d1f4f3d44d 100644
--- a/libc/src/signal/sigemptyset.h
+++ b/libc/src/signal/sigemptyset.h
@@ -11,10 +11,10 @@
#include <signal.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int sigemptyset(sigset_t *set);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_SIGNAL_SIGEMPTYSET_H
diff --git a/libc/src/signal/sigfillset.h b/libc/src/signal/sigfillset.h
index 08a70a40afc7677..d8e3168871ea8a4 100644
--- a/libc/src/signal/sigfillset.h
+++ b/libc/src/signal/sigfillset.h
@@ -11,10 +11,10 @@
#include <signal.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int sigfillset(sigset_t *set);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_SIGNAL_SIGFILLSET_H
diff --git a/libc/src/signal/signal.h b/libc/src/signal/signal.h
index c45564cf9e4662b..15bb5f01232eee8 100644
--- a/libc/src/signal/signal.h
+++ b/libc/src/signal/signal.h
@@ -11,12 +11,12 @@
#include <signal.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
using sighandler_t = __sighandler_t;
sighandler_t signal(int signum, sighandler_t handler);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_SIGNAL_SIGNAL_H
diff --git a/libc/src/signal/sigprocmask.h b/libc/src/signal/sigprocmask.h
index 490a16df7d6ff51..e0658860579e4ef 100644
--- a/libc/src/signal/sigprocmask.h
+++ b/libc/src/signal/sigprocmask.h
@@ -11,11 +11,11 @@
#include <signal.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int sigprocmask(int how, const sigset_t *__restrict set,
sigset_t *__restrict oldset);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_SIGNAL_SIGPROCMASK_H
diff --git a/libc/src/spawn/file_actions.h b/libc/src/spawn/file_actions.h
index ee509a1e0ad9c88..7113256bf49cb74 100644
--- a/libc/src/spawn/file_actions.h
+++ b/libc/src/spawn/file_actions.h
@@ -12,7 +12,7 @@
#include <spawn.h> // For mode_t
#include <stdint.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
struct BaseSpawnFileAction {
enum ActionType {
@@ -67,6 +67,6 @@ struct SpawnFileDup2Action : public BaseSpawnFileAction {
newfd(new_fdesc) {}
};
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_SPAWN_FILE_ACTIONS_H
diff --git a/libc/src/spawn/linux/posix_spawn.cpp b/libc/src/spawn/linux/posix_spawn.cpp
index 44c79f9400a8f1a..0a0467df4959e95 100644
--- a/libc/src/spawn/linux/posix_spawn.cpp
+++ b/libc/src/spawn/linux/posix_spawn.cpp
@@ -18,7 +18,7 @@
#include <spawn.h>
#include <sys/syscall.h> // For syscall numbers.
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
namespace {
@@ -27,9 +27,9 @@ pid_t fork() {
// to avoid duplicating the complete stack from the parent. A new stack will
// be created on exec anyway so duplicating the full stack is unnecessary.
#ifdef SYS_fork
- return __llvm_libc::syscall_impl<pid_t>(SYS_fork);
+ return LIBC_NAMESPACE::syscall_impl<pid_t>(SYS_fork);
#elif defined(SYS_clone)
- return __llvm_libc::syscall_impl<pid_t>(SYS_clone, SIGCHLD, 0);
+ return LIBC_NAMESPACE::syscall_impl<pid_t>(SYS_clone, SIGCHLD, 0);
#else
#error "fork or clone syscalls not available."
#endif
@@ -37,10 +37,10 @@ pid_t fork() {
cpp::optional<int> open(const char *path, int oflags, mode_t mode) {
#ifdef SYS_open
- int fd = __llvm_libc::syscall_impl<int>(SYS_open, path, oflags, mode);
+ int fd = LIBC_NAMESPACE::syscall_impl<int>(SYS_open, path, oflags, mode);
#else
- int fd =
- __llvm_libc::syscall_impl<int>(SYS_openat, AT_FDCWD, path, oflags, mode);
+ int fd = LIBC_NAMESPACE::syscall_impl<int>(SYS_openat, AT_FDCWD, path, oflags,
+ mode);
#endif
if (fd > 0)
return fd;
@@ -50,14 +50,14 @@ cpp::optional<int> open(const char *path, int oflags, mode_t mode) {
return cpp::nullopt;
}
-void close(int fd) { __llvm_libc::syscall_impl<long>(SYS_close, fd); }
+void close(int fd) { LIBC_NAMESPACE::syscall_impl<long>(SYS_close, fd); }
// We use dup3 if dup2 is not available, similar to our implementation of dup2
bool dup2(int fd, int newfd) {
#ifdef SYS_dup2
- int ret = __llvm_libc::syscall_impl<int>(SYS_dup2, fd, newfd);
+ int ret = LIBC_NAMESPACE::syscall_impl<int>(SYS_dup2, fd, newfd);
#elif defined(SYS_dup3)
- int ret = __llvm_libc::syscall_impl<int>(SYS_dup3, fd, newfd, 0);
+ int ret = LIBC_NAMESPACE::syscall_impl<int>(SYS_dup3, fd, newfd, 0);
#else
#error "dup2 and dup3 syscalls not available."
#endif
@@ -68,8 +68,8 @@ bool dup2(int fd, int newfd) {
// exit implementation which exits with code 127.
void exit() {
for (;;) {
- __llvm_libc::syscall_impl<long>(SYS_exit_group, 127);
- __llvm_libc::syscall_impl<long>(SYS_exit, 127);
+ LIBC_NAMESPACE::syscall_impl<long>(SYS_exit_group, 127);
+ LIBC_NAMESPACE::syscall_impl<long>(SYS_exit, 127);
}
}
@@ -117,7 +117,7 @@ void child_process(const char *__restrict path,
}
}
- if (__llvm_libc::syscall_impl<long>(SYS_execve, path, argv, envp) < 0)
+ if (LIBC_NAMESPACE::syscall_impl<long>(SYS_execve, path, argv, envp) < 0)
exit();
}
@@ -145,4 +145,4 @@ LLVM_LIBC_FUNCTION(int, posix_spawn,
return 0;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/spawn/posix_spawn.h b/libc/src/spawn/posix_spawn.h
index 721462701b25ffa..354b94c2d2d73d8 100644
--- a/libc/src/spawn/posix_spawn.h
+++ b/libc/src/spawn/posix_spawn.h
@@ -11,13 +11,13 @@
#include <spawn.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int posix_spawn(pid_t *__restrict pid, const char *__restrict path,
const posix_spawn_file_actions_t *file_actions,
const posix_spawnattr_t *__restrict attr,
char *const *__restrict argv, char *const *__restrict envp);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_SPAWN_POSIX_SPAWN_H
diff --git a/libc/src/spawn/posix_spawn_file_actions_addclose.cpp b/libc/src/spawn/posix_spawn_file_actions_addclose.cpp
index 492c3e0b8bc112a..9b3c4885dfd7702 100644
--- a/libc/src/spawn/posix_spawn_file_actions_addclose.cpp
+++ b/libc/src/spawn/posix_spawn_file_actions_addclose.cpp
@@ -15,7 +15,7 @@
#include <errno.h>
#include <spawn.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, posix_spawn_file_actions_addclose,
(posix_spawn_file_actions_t *__restrict actions, int fd)) {
@@ -33,4 +33,4 @@ LLVM_LIBC_FUNCTION(int, posix_spawn_file_actions_addclose,
return 0;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/spawn/posix_spawn_file_actions_addclose.h b/libc/src/spawn/posix_spawn_file_actions_addclose.h
index 5eda292760daf74..c84965180fa7ab6 100644
--- a/libc/src/spawn/posix_spawn_file_actions_addclose.h
+++ b/libc/src/spawn/posix_spawn_file_actions_addclose.h
@@ -11,11 +11,11 @@
#include <spawn.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int posix_spawn_file_actions_addclose(
posix_spawn_file_actions_t *__restrict actions, int fd);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_SPAWN_POSIX_SPAWN_FILE_ACTIONS_ADDCLOSE_H
diff --git a/libc/src/spawn/posix_spawn_file_actions_adddup2.cpp b/libc/src/spawn/posix_spawn_file_actions_adddup2.cpp
index ca18629ba6832f7..caa558e2a9a5f2a 100644
--- a/libc/src/spawn/posix_spawn_file_actions_adddup2.cpp
+++ b/libc/src/spawn/posix_spawn_file_actions_adddup2.cpp
@@ -15,7 +15,7 @@
#include <errno.h>
#include <spawn.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, posix_spawn_file_actions_adddup2,
(posix_spawn_file_actions_t * actions, int fd, int newfd)) {
@@ -33,4 +33,4 @@ LLVM_LIBC_FUNCTION(int, posix_spawn_file_actions_adddup2,
return 0;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/spawn/posix_spawn_file_actions_adddup2.h b/libc/src/spawn/posix_spawn_file_actions_adddup2.h
index 33444184f973628..7a7f3a5fb5bfdaf 100644
--- a/libc/src/spawn/posix_spawn_file_actions_adddup2.h
+++ b/libc/src/spawn/posix_spawn_file_actions_adddup2.h
@@ -11,11 +11,11 @@
#include <spawn.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int posix_spawn_file_actions_adddup2(posix_spawn_file_actions_t *actions,
int fd, int newfd);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_SPAWN_POSIX_SPAWN_FILE_ACTIONS_ADDDUP2_H
diff --git a/libc/src/spawn/posix_spawn_file_actions_addopen.cpp b/libc/src/spawn/posix_spawn_file_actions_addopen.cpp
index 3b12c8bbc17ce5a..c544f04bd54ae7f 100644
--- a/libc/src/spawn/posix_spawn_file_actions_addopen.cpp
+++ b/libc/src/spawn/posix_spawn_file_actions_addopen.cpp
@@ -15,7 +15,7 @@
#include <errno.h>
#include <spawn.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, posix_spawn_file_actions_addopen,
(posix_spawn_file_actions_t *__restrict actions, int fd,
@@ -34,4 +34,4 @@ LLVM_LIBC_FUNCTION(int, posix_spawn_file_actions_addopen,
return 0;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/spawn/posix_spawn_file_actions_addopen.h b/libc/src/spawn/posix_spawn_file_actions_addopen.h
index ff757d42e5142f5..121213abe50f8c6 100644
--- a/libc/src/spawn/posix_spawn_file_actions_addopen.h
+++ b/libc/src/spawn/posix_spawn_file_actions_addopen.h
@@ -11,12 +11,12 @@
#include <spawn.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int posix_spawn_file_actions_addopen(
posix_spawn_file_actions_t *__restrict actions, int fd,
const char *__restrict path, int oflag, mode_t mode);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_SPAWN_POSIX_SPAWN_FILE_ACTIONS_ADDOPEN_H
diff --git a/libc/src/spawn/posix_spawn_file_actions_destroy.cpp b/libc/src/spawn/posix_spawn_file_actions_destroy.cpp
index 7be531c67322c36..73e0ac828cd6997 100644
--- a/libc/src/spawn/posix_spawn_file_actions_destroy.cpp
+++ b/libc/src/spawn/posix_spawn_file_actions_destroy.cpp
@@ -15,7 +15,7 @@
#include <errno.h>
#include <spawn.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, posix_spawn_file_actions_destroy,
(posix_spawn_file_actions_t * actions)) {
@@ -49,4 +49,4 @@ LLVM_LIBC_FUNCTION(int, posix_spawn_file_actions_destroy,
return 0;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/spawn/posix_spawn_file_actions_destroy.h b/libc/src/spawn/posix_spawn_file_actions_destroy.h
index 89f3c55dd99b5f9..28b9b05b9e79a9d 100644
--- a/libc/src/spawn/posix_spawn_file_actions_destroy.h
+++ b/libc/src/spawn/posix_spawn_file_actions_destroy.h
@@ -11,10 +11,10 @@
#include <spawn.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int posix_spawn_file_actions_destroy(posix_spawn_file_actions_t *actions);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_SPAWN_POSIX_SPAWN_FILE_ACTIONS_DESTROY_H
diff --git a/libc/src/spawn/posix_spawn_file_actions_init.cpp b/libc/src/spawn/posix_spawn_file_actions_init.cpp
index 99502ff44962bad..04e5610c717c697 100644
--- a/libc/src/spawn/posix_spawn_file_actions_init.cpp
+++ b/libc/src/spawn/posix_spawn_file_actions_init.cpp
@@ -12,7 +12,7 @@
#include <spawn.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, posix_spawn_file_actions_init,
(posix_spawn_file_actions_t * actions)) {
@@ -21,4 +21,4 @@ LLVM_LIBC_FUNCTION(int, posix_spawn_file_actions_init,
return 0;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/spawn/posix_spawn_file_actions_init.h b/libc/src/spawn/posix_spawn_file_actions_init.h
index da354e1b0ebae80..d7b228fff08d0be 100644
--- a/libc/src/spawn/posix_spawn_file_actions_init.h
+++ b/libc/src/spawn/posix_spawn_file_actions_init.h
@@ -11,10 +11,10 @@
#include <spawn.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int posix_spawn_file_actions_init(posix_spawn_file_actions_t *actions);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_SPAWN_POSIX_SPAWN_FILE_ACTIONS_INIT_H
diff --git a/libc/src/stdio/clearerr.h b/libc/src/stdio/clearerr.h
index 446e0fd40f87fcb..b8e8d7c5cab82cf 100644
--- a/libc/src/stdio/clearerr.h
+++ b/libc/src/stdio/clearerr.h
@@ -11,10 +11,10 @@
#include <stdio.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
void clearerr(::FILE *stream);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_STDIO_CLEARERR_H
diff --git a/libc/src/stdio/clearerr_unlocked.h b/libc/src/stdio/clearerr_unlocked.h
index 8c14fd230a06f4e..ff447cea61370cd 100644
--- a/libc/src/stdio/clearerr_unlocked.h
+++ b/libc/src/stdio/clearerr_unlocked.h
@@ -11,10 +11,10 @@
#include <stdio.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
void clearerr_unlocked(::FILE *stream);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_STDIO_CLEARERR_UNLOCKED_H
diff --git a/libc/src/stdio/fclose.h b/libc/src/stdio/fclose.h
index 21ffa4350391e3d..7fe6951a080dcae 100644
--- a/libc/src/stdio/fclose.h
+++ b/libc/src/stdio/fclose.h
@@ -11,10 +11,10 @@
#include <stdio.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int fclose(::FILE *stream);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_STDIO_FCLOSE_H
diff --git a/libc/src/stdio/feof.h b/libc/src/stdio/feof.h
index eab056ea2fdeb0f..66a49bdd257015c 100644
--- a/libc/src/stdio/feof.h
+++ b/libc/src/stdio/feof.h
@@ -11,10 +11,10 @@
#include <stdio.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int feof(::FILE *stream);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_STDIO_FEOF_H
diff --git a/libc/src/stdio/feof_unlocked.h b/libc/src/stdio/feof_unlocked.h
index 8e20f964ba31327..359609c597900b2 100644
--- a/libc/src/stdio/feof_unlocked.h
+++ b/libc/src/stdio/feof_unlocked.h
@@ -11,10 +11,10 @@
#include <stdio.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int feof_unlocked(::FILE *stream);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_STDIO_FEOF_UNLOCKED_H
diff --git a/libc/src/stdio/ferror.h b/libc/src/stdio/ferror.h
index 3971cff6cac0cca..194dff6320c8384 100644
--- a/libc/src/stdio/ferror.h
+++ b/libc/src/stdio/ferror.h
@@ -11,10 +11,10 @@
#include <stdio.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int ferror(::FILE *stream);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_STDIO_FERROR_H
diff --git a/libc/src/stdio/ferror_unlocked.h b/libc/src/stdio/ferror_unlocked.h
index 9b0f12c7852c106..86281025368c36a 100644
--- a/libc/src/stdio/ferror_unlocked.h
+++ b/libc/src/stdio/ferror_unlocked.h
@@ -11,10 +11,10 @@
#include <stdio.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int ferror_unlocked(::FILE *stream);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_STDIO_FERROR_UNLOCKED_H
diff --git a/libc/src/stdio/fflush.cpp b/libc/src/stdio/fflush.cpp
index d7a565214fc3cd5..dc5275b1cd08e17 100644
--- a/libc/src/stdio/fflush.cpp
+++ b/libc/src/stdio/fflush.cpp
@@ -12,10 +12,10 @@
#include "src/errno/libc_errno.h"
#include <stdio.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, fflush, (::FILE * stream)) {
- int result = reinterpret_cast<__llvm_libc::File *>(stream)->flush();
+ int result = reinterpret_cast<LIBC_NAMESPACE::File *>(stream)->flush();
if (result != 0) {
libc_errno = result;
return EOF;
@@ -23,4 +23,4 @@ LLVM_LIBC_FUNCTION(int, fflush, (::FILE * stream)) {
return 0;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/stdio/fflush.h b/libc/src/stdio/fflush.h
index f2adbe17e8ef288..839fd986f15b543 100644
--- a/libc/src/stdio/fflush.h
+++ b/libc/src/stdio/fflush.h
@@ -11,10 +11,10 @@
#include <stdio.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int fflush(::FILE *stream);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_STDIO_FFLUSH_H
diff --git a/libc/src/stdio/fgetc.h b/libc/src/stdio/fgetc.h
index 13d22ded7f3f88c..26a32482a3ba78f 100644
--- a/libc/src/stdio/fgetc.h
+++ b/libc/src/stdio/fgetc.h
@@ -11,10 +11,10 @@
#include <stdio.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int fgetc(::FILE *f);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_STDIO_FGETC_H
diff --git a/libc/src/stdio/fgetc_unlocked.h b/libc/src/stdio/fgetc_unlocked.h
index e374a6d0f6ce188..f765e8d502be791 100644
--- a/libc/src/stdio/fgetc_unlocked.h
+++ b/libc/src/stdio/fgetc_unlocked.h
@@ -11,10 +11,10 @@
#include <stdio.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int fgetc_unlocked(::FILE *f);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_STDIO_FGETC_UNLOCKED_H
diff --git a/libc/src/stdio/fgets.h b/libc/src/stdio/fgets.h
index 6f4ed93ff03dcd1..426455786247939 100644
--- a/libc/src/stdio/fgets.h
+++ b/libc/src/stdio/fgets.h
@@ -11,10 +11,10 @@
#include <stdio.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
char *fgets(char *__restrict str, int count, ::FILE *__restrict raw_stream);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_STDIO_FGETS_H
diff --git a/libc/src/stdio/flockfile.cpp b/libc/src/stdio/flockfile.cpp
index 3b13a6f4d813da5..62606c92b9ea937 100644
--- a/libc/src/stdio/flockfile.cpp
+++ b/libc/src/stdio/flockfile.cpp
@@ -11,10 +11,10 @@
#include <stdio.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(void, flockfile, (::FILE * stream)) {
- reinterpret_cast<__llvm_libc::File *>(stream)->lock();
+ reinterpret_cast<LIBC_NAMESPACE::File *>(stream)->lock();
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/stdio/flockfile.h b/libc/src/stdio/flockfile.h
index 961ad8f941cdfac..1509c140c5e711f 100644
--- a/libc/src/stdio/flockfile.h
+++ b/libc/src/stdio/flockfile.h
@@ -11,10 +11,10 @@
#include <stdio.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
void flockfile(::FILE *stream);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_STDIO_FLOCKFILE_H
diff --git a/libc/src/stdio/fopen.h b/libc/src/stdio/fopen.h
index f8ab0542d2a6ff4..68f93f5168f0792 100644
--- a/libc/src/stdio/fopen.h
+++ b/libc/src/stdio/fopen.h
@@ -11,10 +11,10 @@
#include <stdio.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
::FILE *fopen(const char *__restrict name, const char *__restrict mode);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_STDIO_FOPEN_H
diff --git a/libc/src/stdio/fopencookie.cpp b/libc/src/stdio/fopencookie.cpp
index 7a4479ccae02567..2cb7ad2f46ebf6c 100644
--- a/libc/src/stdio/fopencookie.cpp
+++ b/libc/src/stdio/fopencookie.cpp
@@ -14,11 +14,11 @@
#include <stdio.h>
#include <stdlib.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
namespace {
-class CookieFile : public __llvm_libc::File {
+class CookieFile : public LIBC_NAMESPACE::File {
void *cookie;
cookie_io_functions_t ops;
@@ -96,4 +96,4 @@ LLVM_LIBC_FUNCTION(::FILE *, fopencookie,
return reinterpret_cast<::FILE *>(file);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/stdio/fopencookie.h b/libc/src/stdio/fopencookie.h
index d78e5ac3317da17..3dff8949dd4351b 100644
--- a/libc/src/stdio/fopencookie.h
+++ b/libc/src/stdio/fopencookie.h
@@ -11,11 +11,11 @@
#include <stdio.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
::FILE *fopencookie(void *cookie, const char *__restrict mode,
cookie_io_functions_t desc);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_STDIO_FOPENCOOKIE_H
diff --git a/libc/src/stdio/fprintf.cpp b/libc/src/stdio/fprintf.cpp
index e13ed4d075ac856..87b0e74ae09bfb8 100644
--- a/libc/src/stdio/fprintf.cpp
+++ b/libc/src/stdio/fprintf.cpp
@@ -15,7 +15,7 @@
#include <stdarg.h>
#include <stdio.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, fprintf,
(::FILE *__restrict stream, const char *__restrict format,
@@ -30,4 +30,4 @@ LLVM_LIBC_FUNCTION(int, fprintf,
return ret_val;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/stdio/fprintf.h b/libc/src/stdio/fprintf.h
index caac3e88ee4fed0..41cd8a858b430c7 100644
--- a/libc/src/stdio/fprintf.h
+++ b/libc/src/stdio/fprintf.h
@@ -11,10 +11,10 @@
#include <stdio.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int fprintf(::FILE *__restrict stream, const char *__restrict format, ...);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_STDIO_FPRINTF_H
diff --git a/libc/src/stdio/fputc.h b/libc/src/stdio/fputc.h
index 24732ecb74e87ea..578e569072a1f27 100644
--- a/libc/src/stdio/fputc.h
+++ b/libc/src/stdio/fputc.h
@@ -11,10 +11,10 @@
#include <stdio.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int fputc(int c, ::FILE *stream);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_STDIO_FPUTC_H
diff --git a/libc/src/stdio/fputs.h b/libc/src/stdio/fputs.h
index 2419fe8eeac7065..0238e46e628a611 100644
--- a/libc/src/stdio/fputs.h
+++ b/libc/src/stdio/fputs.h
@@ -11,10 +11,10 @@
#include <stdio.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int fputs(const char *__restrict str, ::FILE *__restrict stream);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_STDIO_FPUTS_H
diff --git a/libc/src/stdio/fread.h b/libc/src/stdio/fread.h
index 995367cda4560d8..ae2295095b9cf50 100644
--- a/libc/src/stdio/fread.h
+++ b/libc/src/stdio/fread.h
@@ -11,11 +11,11 @@
#include <stdio.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
size_t fread(void *__restrict buffer, size_t size, size_t nmemb,
::FILE *stream);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_STDIO_FREAD_H
diff --git a/libc/src/stdio/fread_unlocked.h b/libc/src/stdio/fread_unlocked.h
index 5c965b0f168cd2f..7cd0ed3e35c5770 100644
--- a/libc/src/stdio/fread_unlocked.h
+++ b/libc/src/stdio/fread_unlocked.h
@@ -11,11 +11,11 @@
#include <stdio.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
size_t fread_unlocked(void *__restrict buffer, size_t size, size_t nmemb,
::FILE *stream);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_STDIO_FREAD_UNLOCKED_H
diff --git a/libc/src/stdio/fscanf.cpp b/libc/src/stdio/fscanf.cpp
index 4fe0a3e57dcaa19..188e28e50d0bd7f 100644
--- a/libc/src/stdio/fscanf.cpp
+++ b/libc/src/stdio/fscanf.cpp
@@ -15,7 +15,7 @@
#include <stdarg.h>
#include <stdio.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, fscanf,
(::FILE *__restrict stream, const char *__restrict format,
@@ -32,4 +32,4 @@ LLVM_LIBC_FUNCTION(int, fscanf,
return (ret_val == -1) ? EOF : ret_val;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/stdio/fscanf.h b/libc/src/stdio/fscanf.h
index cc36cd7c9af8e31..0e2247d74f0e574 100644
--- a/libc/src/stdio/fscanf.h
+++ b/libc/src/stdio/fscanf.h
@@ -11,10 +11,10 @@
#include <stdio.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int fscanf(::FILE *__restrict stream, const char *__restrict format, ...);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_STDIO_FSCANF_H
diff --git a/libc/src/stdio/fseek.cpp b/libc/src/stdio/fseek.cpp
index 928ff84db3a309e..7666e71e699d563 100644
--- a/libc/src/stdio/fseek.cpp
+++ b/libc/src/stdio/fseek.cpp
@@ -12,11 +12,11 @@
#include "src/errno/libc_errno.h"
#include <stdio.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, fseek, (::FILE * stream, long offset, int whence)) {
auto result =
- reinterpret_cast<__llvm_libc::File *>(stream)->seek(offset, whence);
+ reinterpret_cast<LIBC_NAMESPACE::File *>(stream)->seek(offset, whence);
if (!result.has_value()) {
libc_errno = result.error();
return -1;
@@ -24,4 +24,4 @@ LLVM_LIBC_FUNCTION(int, fseek, (::FILE * stream, long offset, int whence)) {
return 0;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/stdio/fseek.h b/libc/src/stdio/fseek.h
index f3865c4efd23ff2..6a7f715d2f99890 100644
--- a/libc/src/stdio/fseek.h
+++ b/libc/src/stdio/fseek.h
@@ -11,10 +11,10 @@
#include <stdio.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int fseek(::FILE *stream, long offset, int whence);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_STDIO_FSEEK_H
diff --git a/libc/src/stdio/ftell.cpp b/libc/src/stdio/ftell.cpp
index 697e9bc1b4b32e7..5f7803150534b31 100644
--- a/libc/src/stdio/ftell.cpp
+++ b/libc/src/stdio/ftell.cpp
@@ -12,10 +12,10 @@
#include "src/errno/libc_errno.h"
#include <stdio.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(long, ftell, (::FILE * stream)) {
- auto result = reinterpret_cast<__llvm_libc::File *>(stream)->tell();
+ auto result = reinterpret_cast<LIBC_NAMESPACE::File *>(stream)->tell();
if (!result.has_value()) {
libc_errno = result.error();
return -1;
@@ -23,4 +23,4 @@ LLVM_LIBC_FUNCTION(long, ftell, (::FILE * stream)) {
return result.value();
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/stdio/ftell.h b/libc/src/stdio/ftell.h
index 95d449470918127..e72bb8b32bd947b 100644
--- a/libc/src/stdio/ftell.h
+++ b/libc/src/stdio/ftell.h
@@ -11,10 +11,10 @@
#include <stdio.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
long ftell(::FILE *f);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_STDIO_FTELL_H
diff --git a/libc/src/stdio/funlockfile.cpp b/libc/src/stdio/funlockfile.cpp
index 6c7dbee303cbb38..88e2eaef8ba038e 100644
--- a/libc/src/stdio/funlockfile.cpp
+++ b/libc/src/stdio/funlockfile.cpp
@@ -11,10 +11,10 @@
#include <stdio.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(void, funlockfile, (::FILE * stream)) {
- reinterpret_cast<__llvm_libc::File *>(stream)->unlock();
+ reinterpret_cast<LIBC_NAMESPACE::File *>(stream)->unlock();
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/stdio/funlockfile.h b/libc/src/stdio/funlockfile.h
index cb04b7e9550ec0e..c50f9dd1d700990 100644
--- a/libc/src/stdio/funlockfile.h
+++ b/libc/src/stdio/funlockfile.h
@@ -11,10 +11,10 @@
#include <stdio.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
void funlockfile(::FILE *stream);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_STDIO_FUNLOCKFILE_H
diff --git a/libc/src/stdio/fwrite.h b/libc/src/stdio/fwrite.h
index eb258fcec33b79d..a71f20cff023ac8 100644
--- a/libc/src/stdio/fwrite.h
+++ b/libc/src/stdio/fwrite.h
@@ -11,11 +11,11 @@
#include <stdio.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
size_t fwrite(const void *__restrict ptr, size_t size, size_t nmemb,
::FILE *__restrict stream);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_STDIO_FWRITE_H
diff --git a/libc/src/stdio/fwrite_unlocked.h b/libc/src/stdio/fwrite_unlocked.h
index 33bcc219d2efa3b..7012e0d16737a94 100644
--- a/libc/src/stdio/fwrite_unlocked.h
+++ b/libc/src/stdio/fwrite_unlocked.h
@@ -11,11 +11,11 @@
#include <stdio.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
size_t fwrite_unlocked(const void *__restrict ptr, size_t size, size_t nmemb,
::FILE *__restrict stream);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_STDIO_FWRITE_UNLOCKED_H
diff --git a/libc/src/stdio/generic/clearerr.cpp b/libc/src/stdio/generic/clearerr.cpp
index 95556bfdf73903a..1f1ce38639f50c8 100644
--- a/libc/src/stdio/generic/clearerr.cpp
+++ b/libc/src/stdio/generic/clearerr.cpp
@@ -11,10 +11,10 @@
#include <stdio.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(void, clearerr, (::FILE * stream)) {
- reinterpret_cast<__llvm_libc::File *>(stream)->clearerr();
+ reinterpret_cast<LIBC_NAMESPACE::File *>(stream)->clearerr();
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/stdio/generic/clearerr_unlocked.cpp b/libc/src/stdio/generic/clearerr_unlocked.cpp
index 88f26a82dbbe378..2840e3703ca9392 100644
--- a/libc/src/stdio/generic/clearerr_unlocked.cpp
+++ b/libc/src/stdio/generic/clearerr_unlocked.cpp
@@ -11,10 +11,10 @@
#include <stdio.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(void, clearerr_unlocked, (::FILE * stream)) {
- reinterpret_cast<__llvm_libc::File *>(stream)->clearerr_unlocked();
+ reinterpret_cast<LIBC_NAMESPACE::File *>(stream)->clearerr_unlocked();
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/stdio/generic/fclose.cpp b/libc/src/stdio/generic/fclose.cpp
index da75e9bc1fdf738..cc163ab21e78d0f 100644
--- a/libc/src/stdio/generic/fclose.cpp
+++ b/libc/src/stdio/generic/fclose.cpp
@@ -12,10 +12,10 @@
#include "src/errno/libc_errno.h"
#include <stdio.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, fclose, (::FILE * stream)) {
- int result = reinterpret_cast<__llvm_libc::File *>(stream)->close();
+ int result = reinterpret_cast<LIBC_NAMESPACE::File *>(stream)->close();
if (result != 0) {
libc_errno = result;
return EOF;
@@ -23,4 +23,4 @@ LLVM_LIBC_FUNCTION(int, fclose, (::FILE * stream)) {
return 0;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/stdio/generic/feof.cpp b/libc/src/stdio/generic/feof.cpp
index 3d22a19f05d3adb..311561c4271f015 100644
--- a/libc/src/stdio/generic/feof.cpp
+++ b/libc/src/stdio/generic/feof.cpp
@@ -11,10 +11,10 @@
#include <stdio.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, feof, (::FILE * stream)) {
- return reinterpret_cast<__llvm_libc::File *>(stream)->iseof();
+ return reinterpret_cast<LIBC_NAMESPACE::File *>(stream)->iseof();
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/stdio/generic/feof_unlocked.cpp b/libc/src/stdio/generic/feof_unlocked.cpp
index fdb9e2ca369d711..e8c718c13696136 100644
--- a/libc/src/stdio/generic/feof_unlocked.cpp
+++ b/libc/src/stdio/generic/feof_unlocked.cpp
@@ -11,10 +11,10 @@
#include <stdio.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, feof_unlocked, (::FILE * stream)) {
- return reinterpret_cast<__llvm_libc::File *>(stream)->iseof_unlocked();
+ return reinterpret_cast<LIBC_NAMESPACE::File *>(stream)->iseof_unlocked();
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/stdio/generic/ferror.cpp b/libc/src/stdio/generic/ferror.cpp
index 12bfc2a857a5380..65cf99fe4847301 100644
--- a/libc/src/stdio/generic/ferror.cpp
+++ b/libc/src/stdio/generic/ferror.cpp
@@ -11,10 +11,10 @@
#include <stdio.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, ferror, (::FILE * stream)) {
- return reinterpret_cast<__llvm_libc::File *>(stream)->error();
+ return reinterpret_cast<LIBC_NAMESPACE::File *>(stream)->error();
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/stdio/generic/ferror_unlocked.cpp b/libc/src/stdio/generic/ferror_unlocked.cpp
index 301aa83dac8ad08..089ea4ab36b5766 100644
--- a/libc/src/stdio/generic/ferror_unlocked.cpp
+++ b/libc/src/stdio/generic/ferror_unlocked.cpp
@@ -11,10 +11,10 @@
#include <stdio.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, ferror_unlocked, (::FILE * stream)) {
- return reinterpret_cast<__llvm_libc::File *>(stream)->error_unlocked();
+ return reinterpret_cast<LIBC_NAMESPACE::File *>(stream)->error_unlocked();
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/stdio/generic/fgetc.cpp b/libc/src/stdio/generic/fgetc.cpp
index 9a6109636364a3b..771811382fd5954 100644
--- a/libc/src/stdio/generic/fgetc.cpp
+++ b/libc/src/stdio/generic/fgetc.cpp
@@ -12,11 +12,11 @@
#include "src/errno/libc_errno.h"
#include <stdio.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, fgetc, (::FILE * stream)) {
unsigned char c;
- auto result = reinterpret_cast<__llvm_libc::File *>(stream)->read(&c, 1);
+ auto result = reinterpret_cast<LIBC_NAMESPACE::File *>(stream)->read(&c, 1);
size_t r = result.value;
if (result.has_error())
libc_errno = result.error;
@@ -26,4 +26,4 @@ LLVM_LIBC_FUNCTION(int, fgetc, (::FILE * stream)) {
return c;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/stdio/generic/fgetc_unlocked.cpp b/libc/src/stdio/generic/fgetc_unlocked.cpp
index 032a9fbac019ce2..e7aaf9dc8ea2236 100644
--- a/libc/src/stdio/generic/fgetc_unlocked.cpp
+++ b/libc/src/stdio/generic/fgetc_unlocked.cpp
@@ -12,12 +12,12 @@
#include "src/errno/libc_errno.h"
#include <stdio.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, fgetc_unlocked, (::FILE * stream)) {
unsigned char c;
auto result =
- reinterpret_cast<__llvm_libc::File *>(stream)->read_unlocked(&c, 1);
+ reinterpret_cast<LIBC_NAMESPACE::File *>(stream)->read_unlocked(&c, 1);
size_t r = result.value;
if (result.has_error())
libc_errno = result.error;
@@ -26,4 +26,4 @@ LLVM_LIBC_FUNCTION(int, fgetc_unlocked, (::FILE * stream)) {
return c;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/stdio/generic/fgets.cpp b/libc/src/stdio/generic/fgets.cpp
index dd5051a32cea821..8c9dac8bd3b31f9 100644
--- a/libc/src/stdio/generic/fgets.cpp
+++ b/libc/src/stdio/generic/fgets.cpp
@@ -13,7 +13,7 @@
#include <stddef.h>
#include <stdio.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(char *, fgets,
(char *__restrict str, int count,
@@ -22,7 +22,7 @@ LLVM_LIBC_FUNCTION(char *, fgets,
return nullptr;
unsigned char c = '\0';
- auto stream = reinterpret_cast<__llvm_libc::File *__restrict>(raw_stream);
+ auto stream = reinterpret_cast<LIBC_NAMESPACE::File *__restrict>(raw_stream);
stream->lock();
// i is an int because it's frequently compared to count, which is also int.
@@ -52,4 +52,4 @@ LLVM_LIBC_FUNCTION(char *, fgets,
return str;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/stdio/generic/fopen.cpp b/libc/src/stdio/generic/fopen.cpp
index 3062a059ae16a71..794ef0366dd6693 100644
--- a/libc/src/stdio/generic/fopen.cpp
+++ b/libc/src/stdio/generic/fopen.cpp
@@ -12,11 +12,11 @@
#include "src/errno/libc_errno.h"
#include <stdio.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(::FILE *, fopen,
(const char *__restrict name, const char *__restrict mode)) {
- auto result = __llvm_libc::openfile(name, mode);
+ auto result = LIBC_NAMESPACE::openfile(name, mode);
if (!result.has_value()) {
libc_errno = result.error();
return nullptr;
@@ -24,4 +24,4 @@ LLVM_LIBC_FUNCTION(::FILE *, fopen,
return reinterpret_cast<::FILE *>(result.value());
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/stdio/generic/fputc.cpp b/libc/src/stdio/generic/fputc.cpp
index 5f41e5ca31844b9..ecbe45e97208d48 100644
--- a/libc/src/stdio/generic/fputc.cpp
+++ b/libc/src/stdio/generic/fputc.cpp
@@ -12,12 +12,12 @@
#include "src/errno/libc_errno.h"
#include <stdio.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, fputc, (int c, ::FILE *stream)) {
unsigned char uc = static_cast<unsigned char>(c);
- auto result = reinterpret_cast<__llvm_libc::File *>(stream)->write(&uc, 1);
+ auto result = reinterpret_cast<LIBC_NAMESPACE::File *>(stream)->write(&uc, 1);
if (result.has_error())
libc_errno = result.error;
size_t written = result.value;
@@ -29,4 +29,4 @@ LLVM_LIBC_FUNCTION(int, fputc, (int c, ::FILE *stream)) {
return 0;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/stdio/generic/fputs.cpp b/libc/src/stdio/generic/fputs.cpp
index d8ba18f003cb796..ef77ad43a1b4278 100644
--- a/libc/src/stdio/generic/fputs.cpp
+++ b/libc/src/stdio/generic/fputs.cpp
@@ -13,13 +13,13 @@
#include "src/errno/libc_errno.h"
#include <stdio.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, fputs,
(const char *__restrict str, ::FILE *__restrict stream)) {
cpp::string_view str_view(str);
- auto result = reinterpret_cast<__llvm_libc::File *>(stream)->write(
+ auto result = reinterpret_cast<LIBC_NAMESPACE::File *>(stream)->write(
str, str_view.size());
if (result.has_error())
libc_errno = result.error;
@@ -32,4 +32,4 @@ LLVM_LIBC_FUNCTION(int, fputs,
return 0;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/stdio/generic/fread.cpp b/libc/src/stdio/generic/fread.cpp
index affc6b7e8a0da22..e8bd2517df6f80c 100644
--- a/libc/src/stdio/generic/fread.cpp
+++ b/libc/src/stdio/generic/fread.cpp
@@ -12,18 +12,18 @@
#include "src/errno/libc_errno.h"
#include <stdio.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(size_t, fread,
(void *__restrict buffer, size_t size, size_t nmemb,
::FILE *stream)) {
if (size == 0 || nmemb == 0)
return 0;
- auto result =
- reinterpret_cast<__llvm_libc::File *>(stream)->read(buffer, size * nmemb);
+ auto result = reinterpret_cast<LIBC_NAMESPACE::File *>(stream)->read(
+ buffer, size * nmemb);
if (result.has_error())
libc_errno = result.error;
return result.value / size;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/stdio/generic/fread_unlocked.cpp b/libc/src/stdio/generic/fread_unlocked.cpp
index 3f922c5a5b48f71..9810c9d6519d9c2 100644
--- a/libc/src/stdio/generic/fread_unlocked.cpp
+++ b/libc/src/stdio/generic/fread_unlocked.cpp
@@ -12,18 +12,18 @@
#include "src/errno/libc_errno.h"
#include <stdio.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(size_t, fread_unlocked,
(void *__restrict buffer, size_t size, size_t nmemb,
::FILE *stream)) {
if (size == 0 || nmemb == 0)
return 0;
- auto result = reinterpret_cast<__llvm_libc::File *>(stream)->read_unlocked(
+ auto result = reinterpret_cast<LIBC_NAMESPACE::File *>(stream)->read_unlocked(
buffer, size * nmemb);
if (result.has_error())
libc_errno = result.error;
return result.value / size;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/stdio/generic/fwrite.cpp b/libc/src/stdio/generic/fwrite.cpp
index cc6c45079bb2c0d..bd11f62a7121c5d 100644
--- a/libc/src/stdio/generic/fwrite.cpp
+++ b/libc/src/stdio/generic/fwrite.cpp
@@ -12,14 +12,14 @@
#include "src/errno/libc_errno.h"
#include <stdio.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(size_t, fwrite,
(const void *__restrict buffer, size_t size, size_t nmemb,
::FILE *stream)) {
if (size == 0 || nmemb == 0)
return 0;
- auto result = reinterpret_cast<__llvm_libc::File *>(stream)->write(
+ auto result = reinterpret_cast<LIBC_NAMESPACE::File *>(stream)->write(
buffer, size * nmemb);
if (result.has_error())
libc_errno = result.error;
@@ -27,4 +27,4 @@ LLVM_LIBC_FUNCTION(size_t, fwrite,
return result.value / size;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/stdio/generic/fwrite_unlocked.cpp b/libc/src/stdio/generic/fwrite_unlocked.cpp
index 736dfe0fc761cfd..5ab7c766087b7b5 100644
--- a/libc/src/stdio/generic/fwrite_unlocked.cpp
+++ b/libc/src/stdio/generic/fwrite_unlocked.cpp
@@ -12,7 +12,7 @@
#include "src/errno/libc_errno.h"
#include <stdio.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(size_t, fwrite_unlocked,
(const void *__restrict buffer, size_t size, size_t nmemb,
@@ -20,12 +20,13 @@ LLVM_LIBC_FUNCTION(size_t, fwrite_unlocked,
if (size == 0 || nmemb == 0)
return 0;
- auto result = reinterpret_cast<__llvm_libc::File *>(stream)->write_unlocked(
- buffer, size * nmemb);
+ auto result =
+ reinterpret_cast<LIBC_NAMESPACE::File *>(stream)->write_unlocked(
+ buffer, size * nmemb);
if (result.has_error())
libc_errno = result.error;
return result.value / size;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/stdio/generic/getc.cpp b/libc/src/stdio/generic/getc.cpp
index 730be685c2ce23c..5cea28d506f6bc7 100644
--- a/libc/src/stdio/generic/getc.cpp
+++ b/libc/src/stdio/generic/getc.cpp
@@ -12,11 +12,11 @@
#include "src/errno/libc_errno.h"
#include <stdio.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, getc, (::FILE * stream)) {
unsigned char c;
- auto result = reinterpret_cast<__llvm_libc::File *>(stream)->read(&c, 1);
+ auto result = reinterpret_cast<LIBC_NAMESPACE::File *>(stream)->read(&c, 1);
size_t r = result.value;
if (result.has_error())
libc_errno = result.error;
@@ -26,4 +26,4 @@ LLVM_LIBC_FUNCTION(int, getc, (::FILE * stream)) {
return c;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/stdio/generic/getc_unlocked.cpp b/libc/src/stdio/generic/getc_unlocked.cpp
index 4eae5c13d858847..883405e84bad074 100644
--- a/libc/src/stdio/generic/getc_unlocked.cpp
+++ b/libc/src/stdio/generic/getc_unlocked.cpp
@@ -12,12 +12,12 @@
#include "src/errno/libc_errno.h"
#include <stdio.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, getc_unlocked, (::FILE * stream)) {
unsigned char c;
auto result =
- reinterpret_cast<__llvm_libc::File *>(stream)->read_unlocked(&c, 1);
+ reinterpret_cast<LIBC_NAMESPACE::File *>(stream)->read_unlocked(&c, 1);
size_t r = result.value;
if (result.has_error())
libc_errno = result.error;
@@ -27,4 +27,4 @@ LLVM_LIBC_FUNCTION(int, getc_unlocked, (::FILE * stream)) {
return c;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/stdio/generic/getchar.cpp b/libc/src/stdio/generic/getchar.cpp
index 91e01e37125f2a2..181999fe56c4220 100644
--- a/libc/src/stdio/generic/getchar.cpp
+++ b/libc/src/stdio/generic/getchar.cpp
@@ -12,7 +12,7 @@
#include "src/errno/libc_errno.h"
#include <stdio.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, getchar, ()) {
unsigned char c;
@@ -25,4 +25,4 @@ LLVM_LIBC_FUNCTION(int, getchar, ()) {
return c;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/stdio/generic/getchar_unlocked.cpp b/libc/src/stdio/generic/getchar_unlocked.cpp
index 1a9a44ea4279e86..be98d0333ec87bb 100644
--- a/libc/src/stdio/generic/getchar_unlocked.cpp
+++ b/libc/src/stdio/generic/getchar_unlocked.cpp
@@ -12,7 +12,7 @@
#include "src/errno/libc_errno.h"
#include <stdio.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, getchar_unlocked, ()) {
unsigned char c;
@@ -25,4 +25,4 @@ LLVM_LIBC_FUNCTION(int, getchar_unlocked, ()) {
return c;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/stdio/generic/putc.cpp b/libc/src/stdio/generic/putc.cpp
index 37937dfb7e6077c..58e3b4d1bae4dba 100644
--- a/libc/src/stdio/generic/putc.cpp
+++ b/libc/src/stdio/generic/putc.cpp
@@ -12,12 +12,12 @@
#include "src/errno/libc_errno.h"
#include <stdio.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, putc, (int c, ::FILE *stream)) {
unsigned char uc = static_cast<unsigned char>(c);
- auto result = reinterpret_cast<__llvm_libc::File *>(stream)->write(&uc, 1);
+ auto result = reinterpret_cast<LIBC_NAMESPACE::File *>(stream)->write(&uc, 1);
if (result.has_error())
libc_errno = result.error;
size_t written = result.value;
@@ -29,4 +29,4 @@ LLVM_LIBC_FUNCTION(int, putc, (int c, ::FILE *stream)) {
return 0;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/stdio/generic/putchar.cpp b/libc/src/stdio/generic/putchar.cpp
index 9190b714dd3f8d6..4a4aeb54c9c6f31 100644
--- a/libc/src/stdio/generic/putchar.cpp
+++ b/libc/src/stdio/generic/putchar.cpp
@@ -12,12 +12,12 @@
#include "src/errno/libc_errno.h"
#include <stdio.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, putchar, (int c)) {
unsigned char uc = static_cast<unsigned char>(c);
- auto result = __llvm_libc::stdout->write(&uc, 1);
+ auto result = LIBC_NAMESPACE::stdout->write(&uc, 1);
if (result.has_error())
libc_errno = result.error;
size_t written = result.value;
@@ -29,4 +29,4 @@ LLVM_LIBC_FUNCTION(int, putchar, (int c)) {
return 0;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/stdio/generic/puts.cpp b/libc/src/stdio/generic/puts.cpp
index ffcbf56ce96d66f..d8d69332566cd0f 100644
--- a/libc/src/stdio/generic/puts.cpp
+++ b/libc/src/stdio/generic/puts.cpp
@@ -13,11 +13,11 @@
#include "src/errno/libc_errno.h"
#include <stdio.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, puts, (const char *__restrict str)) {
cpp::string_view str_view(str);
- auto result = __llvm_libc::stdout->write(str, str_view.size());
+ auto result = LIBC_NAMESPACE::stdout->write(str, str_view.size());
if (result.has_error())
libc_errno = result.error;
size_t written = result.value;
@@ -25,7 +25,7 @@ LLVM_LIBC_FUNCTION(int, puts, (const char *__restrict str)) {
// The stream should be in an error state in this case.
return EOF;
}
- result = __llvm_libc::stdout->write("\n", 1);
+ result = LIBC_NAMESPACE::stdout->write("\n", 1);
if (result.has_error())
libc_errno = result.error;
written = result.value;
@@ -36,4 +36,4 @@ LLVM_LIBC_FUNCTION(int, puts, (const char *__restrict str)) {
return 0;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/stdio/getc.h b/libc/src/stdio/getc.h
index b5de6a75858072f..c085d35d7de9c77 100644
--- a/libc/src/stdio/getc.h
+++ b/libc/src/stdio/getc.h
@@ -11,10 +11,10 @@
#include <stdio.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int getc(::FILE *f);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_STDIO_GETC_H
diff --git a/libc/src/stdio/getc_unlocked.h b/libc/src/stdio/getc_unlocked.h
index b318dfc934e90c2..f4e1165dd75dcf9 100644
--- a/libc/src/stdio/getc_unlocked.h
+++ b/libc/src/stdio/getc_unlocked.h
@@ -11,10 +11,10 @@
#include <stdio.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int getc_unlocked(::FILE *f);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_STDIO_GETC_UNLOCKED_H
diff --git a/libc/src/stdio/getchar.h b/libc/src/stdio/getchar.h
index 51f2f7afa194534..4168808d3e32996 100644
--- a/libc/src/stdio/getchar.h
+++ b/libc/src/stdio/getchar.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_STDIO_GETCHAR_H
#define LLVM_LIBC_SRC_STDIO_GETCHAR_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int getchar();
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_STDIO_GETCHAR_H
diff --git a/libc/src/stdio/getchar_unlocked.h b/libc/src/stdio/getchar_unlocked.h
index 6bbd49a76a62b85..24fdb752f5530f2 100644
--- a/libc/src/stdio/getchar_unlocked.h
+++ b/libc/src/stdio/getchar_unlocked.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_STDIO_GETCHAR_UNLOCKED_H
#define LLVM_LIBC_SRC_STDIO_GETCHAR_UNLOCKED_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int getchar_unlocked();
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_STDIO_GETCHAR_UNLOCKED_H
diff --git a/libc/src/stdio/gpu/clearerr.cpp b/libc/src/stdio/gpu/clearerr.cpp
index 01c34ca936b11a1..2267fdf8115eed0 100644
--- a/libc/src/stdio/gpu/clearerr.cpp
+++ b/libc/src/stdio/gpu/clearerr.cpp
@@ -11,7 +11,7 @@
#include <stdio.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(void, clearerr, (::FILE * stream)) {
rpc::Client::Port port = rpc::client.open<RPC_CLEARERR>();
@@ -21,4 +21,4 @@ LLVM_LIBC_FUNCTION(void, clearerr, (::FILE * stream)) {
port.close();
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/stdio/gpu/fclose.cpp b/libc/src/stdio/gpu/fclose.cpp
index a8e36bcb27c8585..bdedbe51ec38eab 100644
--- a/libc/src/stdio/gpu/fclose.cpp
+++ b/libc/src/stdio/gpu/fclose.cpp
@@ -11,7 +11,7 @@
#include <stdio.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, fclose, (::FILE * stream)) {
uint64_t ret = 0;
@@ -26,4 +26,4 @@ LLVM_LIBC_FUNCTION(int, fclose, (::FILE * stream)) {
return static_cast<int>(ret);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/stdio/gpu/feof.cpp b/libc/src/stdio/gpu/feof.cpp
index 27d27a445812c04..ddcef384142c424 100644
--- a/libc/src/stdio/gpu/feof.cpp
+++ b/libc/src/stdio/gpu/feof.cpp
@@ -11,7 +11,7 @@
#include <stdio.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, feof, (::FILE * stream)) {
int ret;
@@ -23,4 +23,4 @@ LLVM_LIBC_FUNCTION(int, feof, (::FILE * stream)) {
return ret;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/stdio/gpu/ferror.cpp b/libc/src/stdio/gpu/ferror.cpp
index e4bd631f392d4ea..9ed598fb67541e9 100644
--- a/libc/src/stdio/gpu/ferror.cpp
+++ b/libc/src/stdio/gpu/ferror.cpp
@@ -11,7 +11,7 @@
#include <stdio.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, ferror, (::FILE * stream)) {
int ret;
@@ -23,4 +23,4 @@ LLVM_LIBC_FUNCTION(int, ferror, (::FILE * stream)) {
return ret;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/stdio/gpu/fgetc.cpp b/libc/src/stdio/gpu/fgetc.cpp
index ff4ef27ccb88e9a..56f42a04857fb28 100644
--- a/libc/src/stdio/gpu/fgetc.cpp
+++ b/libc/src/stdio/gpu/fgetc.cpp
@@ -11,7 +11,7 @@
#include <stdio.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, fgetc, (::FILE * stream)) {
unsigned char c;
@@ -22,4 +22,4 @@ LLVM_LIBC_FUNCTION(int, fgetc, (::FILE * stream)) {
return c;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/stdio/gpu/fgets.cpp b/libc/src/stdio/gpu/fgets.cpp
index df00451e2a97034..4cabd15001a7f54 100644
--- a/libc/src/stdio/gpu/fgets.cpp
+++ b/libc/src/stdio/gpu/fgets.cpp
@@ -14,7 +14,7 @@
#include <stddef.h>
#include <stdio.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(char *, fgets,
(char *__restrict str, int count,
@@ -33,8 +33,8 @@ LLVM_LIBC_FUNCTION(char *, fgets,
str[i] = c;
}
- bool has_error = __llvm_libc::ferror(stream);
- bool has_eof = __llvm_libc::feof(stream);
+ bool has_error = LIBC_NAMESPACE::ferror(stream);
+ bool has_eof = LIBC_NAMESPACE::feof(stream);
if (has_error || (i == 0 && has_eof))
return nullptr;
@@ -43,4 +43,4 @@ LLVM_LIBC_FUNCTION(char *, fgets,
return str;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/stdio/gpu/file.h b/libc/src/stdio/gpu/file.h
index 42395a6d4287ce5..dbe08f3524b6379 100644
--- a/libc/src/stdio/gpu/file.h
+++ b/libc/src/stdio/gpu/file.h
@@ -11,7 +11,7 @@
#include <stdio.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
namespace file {
template <uint16_t opcode>
@@ -99,4 +99,4 @@ LIBC_INLINE ::FILE *to_stream(uintptr_t f) {
}
} // namespace file
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/stdio/gpu/fopen.cpp b/libc/src/stdio/gpu/fopen.cpp
index 5d88b65e9f702d0..41d2c89473168ee 100644
--- a/libc/src/stdio/gpu/fopen.cpp
+++ b/libc/src/stdio/gpu/fopen.cpp
@@ -12,7 +12,7 @@
#include <stdio.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(::FILE *, fopen,
(const char *__restrict path, const char *__restrict mode)) {
@@ -29,4 +29,4 @@ LLVM_LIBC_FUNCTION(::FILE *, fopen,
return reinterpret_cast<FILE *>(file);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/stdio/gpu/fputc.cpp b/libc/src/stdio/gpu/fputc.cpp
index 90d238972972ec0..e6ef12f4b2f804c 100644
--- a/libc/src/stdio/gpu/fputc.cpp
+++ b/libc/src/stdio/gpu/fputc.cpp
@@ -11,7 +11,7 @@
#include <stdio.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, fputc, (int c, ::FILE *stream)) {
unsigned char uc = static_cast<unsigned char>(c);
@@ -23,4 +23,4 @@ LLVM_LIBC_FUNCTION(int, fputc, (int c, ::FILE *stream)) {
return 0;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/stdio/gpu/fputs.cpp b/libc/src/stdio/gpu/fputs.cpp
index c5919e8913746fa..1b6e0732b98cd60 100644
--- a/libc/src/stdio/gpu/fputs.cpp
+++ b/libc/src/stdio/gpu/fputs.cpp
@@ -13,7 +13,7 @@
#include <stdio.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, fputs,
(const char *__restrict str, ::FILE *__restrict stream)) {
@@ -24,4 +24,4 @@ LLVM_LIBC_FUNCTION(int, fputs,
return 0;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/stdio/gpu/fread.cpp b/libc/src/stdio/gpu/fread.cpp
index 2b9112ee50eb39a..fe367ae1aa24993 100644
--- a/libc/src/stdio/gpu/fread.cpp
+++ b/libc/src/stdio/gpu/fread.cpp
@@ -11,7 +11,7 @@
#include <stdio.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(size_t, fread,
(void *__restrict buffer, size_t size, size_t nmemb,
@@ -22,4 +22,4 @@ LLVM_LIBC_FUNCTION(size_t, fread,
return result / size;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/stdio/gpu/fwrite.cpp b/libc/src/stdio/gpu/fwrite.cpp
index fccaabd0673ec5c..a059bd5ea3b7192 100644
--- a/libc/src/stdio/gpu/fwrite.cpp
+++ b/libc/src/stdio/gpu/fwrite.cpp
@@ -11,7 +11,7 @@
#include <stdio.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(size_t, fwrite,
(const void *__restrict buffer, size_t size, size_t nmemb,
@@ -23,4 +23,4 @@ LLVM_LIBC_FUNCTION(size_t, fwrite,
return result / size;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/stdio/gpu/getc.cpp b/libc/src/stdio/gpu/getc.cpp
index a2272221d6b7b92..b50e3963c31a115 100644
--- a/libc/src/stdio/gpu/getc.cpp
+++ b/libc/src/stdio/gpu/getc.cpp
@@ -11,7 +11,7 @@
#include <stdio.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, getc, (::FILE * stream)) {
unsigned char c;
@@ -22,4 +22,4 @@ LLVM_LIBC_FUNCTION(int, getc, (::FILE * stream)) {
return c;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/stdio/gpu/getchar.cpp b/libc/src/stdio/gpu/getchar.cpp
index a7a6e6c55c13e1a..c8a004124a2e570 100644
--- a/libc/src/stdio/gpu/getchar.cpp
+++ b/libc/src/stdio/gpu/getchar.cpp
@@ -11,7 +11,7 @@
#include <stdio.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, getchar, ()) {
unsigned char c;
@@ -22,4 +22,4 @@ LLVM_LIBC_FUNCTION(int, getchar, ()) {
return c;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/stdio/gpu/putc.cpp b/libc/src/stdio/gpu/putc.cpp
index d450edb6596df1c..b5ecbfc65d67794 100644
--- a/libc/src/stdio/gpu/putc.cpp
+++ b/libc/src/stdio/gpu/putc.cpp
@@ -11,7 +11,7 @@
#include <stdio.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, putc, (int c, ::FILE *stream)) {
unsigned char uc = static_cast<unsigned char>(c);
@@ -23,4 +23,4 @@ LLVM_LIBC_FUNCTION(int, putc, (int c, ::FILE *stream)) {
return 0;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/stdio/gpu/putchar.cpp b/libc/src/stdio/gpu/putchar.cpp
index df577544b8ba405..57663eec40f3b7f 100644
--- a/libc/src/stdio/gpu/putchar.cpp
+++ b/libc/src/stdio/gpu/putchar.cpp
@@ -11,7 +11,7 @@
#include <stdio.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, putchar, (int c)) {
unsigned char uc = static_cast<unsigned char>(c);
@@ -23,4 +23,4 @@ LLVM_LIBC_FUNCTION(int, putchar, (int c)) {
return 0;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/stdio/gpu/puts.cpp b/libc/src/stdio/gpu/puts.cpp
index 58a3534c57ef99f..611bfa4927cd7c2 100644
--- a/libc/src/stdio/gpu/puts.cpp
+++ b/libc/src/stdio/gpu/puts.cpp
@@ -13,7 +13,7 @@
#include <stdio.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, puts, (const char *__restrict str)) {
cpp::string_view str_view(str);
@@ -26,4 +26,4 @@ LLVM_LIBC_FUNCTION(int, puts, (const char *__restrict str)) {
return 0;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/stdio/gpu/stderr.cpp b/libc/src/stdio/gpu/stderr.cpp
index 5e7b79e80e8a190..70846827064a38a 100644
--- a/libc/src/stdio/gpu/stderr.cpp
+++ b/libc/src/stdio/gpu/stderr.cpp
@@ -8,9 +8,9 @@
#include <stdio.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
static struct {
} stub;
FILE *stderr = reinterpret_cast<FILE *>(&stub);
-} // namespace __llvm_libc
-extern "C" FILE *stderr = reinterpret_cast<FILE *>(&__llvm_libc::stub);
+} // namespace LIBC_NAMESPACE
+extern "C" FILE *stderr = reinterpret_cast<FILE *>(&LIBC_NAMESPACE::stub);
diff --git a/libc/src/stdio/gpu/stdin.cpp b/libc/src/stdio/gpu/stdin.cpp
index 408852b461de4dd..1a58461c3dec931 100644
--- a/libc/src/stdio/gpu/stdin.cpp
+++ b/libc/src/stdio/gpu/stdin.cpp
@@ -8,9 +8,9 @@
#include <stdio.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
static struct {
} stub;
FILE *stdin = reinterpret_cast<FILE *>(&stub);
-} // namespace __llvm_libc
-extern "C" FILE *stdin = reinterpret_cast<FILE *>(&__llvm_libc::stub);
+} // namespace LIBC_NAMESPACE
+extern "C" FILE *stdin = reinterpret_cast<FILE *>(&LIBC_NAMESPACE::stub);
diff --git a/libc/src/stdio/gpu/stdout.cpp b/libc/src/stdio/gpu/stdout.cpp
index 02425d31e1e2513..abeeff2ce9f53c7 100644
--- a/libc/src/stdio/gpu/stdout.cpp
+++ b/libc/src/stdio/gpu/stdout.cpp
@@ -8,9 +8,9 @@
#include <stdio.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
static struct {
} stub;
FILE *stdout = reinterpret_cast<FILE *>(&stub);
-} // namespace __llvm_libc
-extern "C" FILE *stdout = reinterpret_cast<FILE *>(&__llvm_libc::stub);
+} // namespace LIBC_NAMESPACE
+extern "C" FILE *stdout = reinterpret_cast<FILE *>(&LIBC_NAMESPACE::stub);
diff --git a/libc/src/stdio/linux/remove.cpp b/libc/src/stdio/linux/remove.cpp
index 1f975679e2f9bf6..b2742c29a3e26a1 100644
--- a/libc/src/stdio/linux/remove.cpp
+++ b/libc/src/stdio/linux/remove.cpp
@@ -15,19 +15,19 @@
#include <fcntl.h> // For AT_* macros.
#include <sys/syscall.h> // For syscall numbers.
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, remove, (const char *path)) {
// We first try unlinking it as a file. If it is ia file, it will succeed. If
// it fails with EISDIR, we will try unlinking it as a directory.
- int ret = __llvm_libc::syscall_impl<int>(SYS_unlinkat, AT_FDCWD, path, 0);
+ int ret = LIBC_NAMESPACE::syscall_impl<int>(SYS_unlinkat, AT_FDCWD, path, 0);
if (ret == -EISDIR)
- ret = __llvm_libc::syscall_impl<int>(SYS_unlinkat, AT_FDCWD, path,
- AT_REMOVEDIR);
+ ret = LIBC_NAMESPACE::syscall_impl<int>(SYS_unlinkat, AT_FDCWD, path,
+ AT_REMOVEDIR);
if (ret >= 0)
return 0;
libc_errno = -ret;
return -1;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/stdio/printf.cpp b/libc/src/stdio/printf.cpp
index 3aaab6977934977..7830d8e555c6388 100644
--- a/libc/src/stdio/printf.cpp
+++ b/libc/src/stdio/printf.cpp
@@ -16,12 +16,12 @@
#include <stdio.h>
#ifndef LIBC_COPT_PRINTF_USE_SYSTEM_FILE
-#define PRINTF_STDOUT __llvm_libc::stdout
+#define PRINTF_STDOUT LIBC_NAMESPACE::stdout
#else // LIBC_COPT_PRINTF_USE_SYSTEM_FILE
#define PRINTF_STDOUT ::stdout
#endif // LIBC_COPT_PRINTF_USE_SYSTEM_FILE
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, printf, (const char *__restrict format, ...)) {
va_list vlist;
@@ -35,4 +35,4 @@ LLVM_LIBC_FUNCTION(int, printf, (const char *__restrict format, ...)) {
return ret_val;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/stdio/printf.h b/libc/src/stdio/printf.h
index c568b04adb7c540..c5b4603c589d516 100644
--- a/libc/src/stdio/printf.h
+++ b/libc/src/stdio/printf.h
@@ -11,10 +11,10 @@
#include <stdio.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int printf(const char *__restrict format, ...);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_STDIO_PRINTF_H
diff --git a/libc/src/stdio/printf_core/char_converter.h b/libc/src/stdio/printf_core/char_converter.h
index ffd2422c822f7e6..9b1501ff24b0d84 100644
--- a/libc/src/stdio/printf_core/char_converter.h
+++ b/libc/src/stdio/printf_core/char_converter.h
@@ -15,7 +15,7 @@
#include "src/stdio/printf_core/core_structs.h"
#include "src/stdio/printf_core/writer.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
namespace printf_core {
LIBC_INLINE int convert_char(Writer *writer, const FormatSection &to_conv) {
@@ -44,6 +44,6 @@ LIBC_INLINE int convert_char(Writer *writer, const FormatSection &to_conv) {
}
} // namespace printf_core
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_STDIO_PRINTF_CORE_CHAR_CONVERTER_H
diff --git a/libc/src/stdio/printf_core/converter.cpp b/libc/src/stdio/printf_core/converter.cpp
index e27deb4cbf59953..74a36cbf7432fbe 100644
--- a/libc/src/stdio/printf_core/converter.cpp
+++ b/libc/src/stdio/printf_core/converter.cpp
@@ -21,7 +21,7 @@
#include <stddef.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
namespace printf_core {
int convert(Writer *writer, const FormatSection &to_conv) {
@@ -86,4 +86,4 @@ int convert(Writer *writer, const FormatSection &to_conv) {
}
} // namespace printf_core
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/stdio/printf_core/converter.h b/libc/src/stdio/printf_core/converter.h
index ae281ba99ec070e..d653f1e56dc2805 100644
--- a/libc/src/stdio/printf_core/converter.h
+++ b/libc/src/stdio/printf_core/converter.h
@@ -14,7 +14,7 @@
#include <stddef.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
namespace printf_core {
// convert will call a conversion function to convert the FormatSection into
@@ -23,6 +23,6 @@ namespace printf_core {
int convert(Writer *writer, const FormatSection &to_conv);
} // namespace printf_core
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_STDIO_PRINTF_CORE_CONVERTER_H
diff --git a/libc/src/stdio/printf_core/converter_utils.h b/libc/src/stdio/printf_core/converter_utils.h
index 54948a2a5f1fd15..4540bba6346e2f0 100644
--- a/libc/src/stdio/printf_core/converter_utils.h
+++ b/libc/src/stdio/printf_core/converter_utils.h
@@ -16,7 +16,7 @@
#include <inttypes.h>
#include <stddef.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
namespace printf_core {
LIBC_INLINE uintmax_t apply_length_modifier(uintmax_t num, LengthModifier lm) {
@@ -53,6 +53,6 @@ LIBC_INLINE uintmax_t apply_length_modifier(uintmax_t num, LengthModifier lm) {
}
} // namespace printf_core
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_STDIO_PRINTF_CORE_CONVERTER_UTILS_H
diff --git a/libc/src/stdio/printf_core/core_structs.h b/libc/src/stdio/printf_core/core_structs.h
index 771d5a8cff437e5..e96bc4dc0f8dd3c 100644
--- a/libc/src/stdio/printf_core/core_structs.h
+++ b/libc/src/stdio/printf_core/core_structs.h
@@ -15,7 +15,7 @@
#include <inttypes.h>
#include <stddef.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
namespace printf_core {
// These length modifiers match the length modifiers in the format string, which
@@ -111,6 +111,6 @@ constexpr int NULLPTR_WRITE_ERROR = -3;
constexpr int INT_CONVERSION_ERROR = -4;
} // namespace printf_core
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_STDIO_PRINTF_CORE_CORE_STRUCTS_H
diff --git a/libc/src/stdio/printf_core/float_dec_converter.h b/libc/src/stdio/printf_core/float_dec_converter.h
index 5e6f1d127370ce7..8c5ba0d241eda54 100644
--- a/libc/src/stdio/printf_core/float_dec_converter.h
+++ b/libc/src/stdio/printf_core/float_dec_converter.h
@@ -28,7 +28,7 @@
#include <inttypes.h>
#include <stddef.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
namespace printf_core {
using MantissaInt = fputil::FPBits<long double>::UIntType;
@@ -1176,6 +1176,6 @@ LIBC_INLINE int convert_float_dec_auto(Writer *writer,
}
} // namespace printf_core
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_STDIO_PRINTF_CORE_FLOAT_DEC_CONVERTER_H
diff --git a/libc/src/stdio/printf_core/float_hex_converter.h b/libc/src/stdio/printf_core/float_hex_converter.h
index 4bd0f91b68a7bad..e264af9844bd244 100644
--- a/libc/src/stdio/printf_core/float_hex_converter.h
+++ b/libc/src/stdio/printf_core/float_hex_converter.h
@@ -22,7 +22,7 @@
#include <inttypes.h>
#include <stddef.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
namespace printf_core {
using MantissaInt = fputil::FPBits<long double>::UIntType;
@@ -256,6 +256,6 @@ LIBC_INLINE int convert_float_hex_exp(Writer *writer,
}
} // namespace printf_core
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_STDIO_PRINTF_CORE_FLOAT_HEX_CONVERTER_H
diff --git a/libc/src/stdio/printf_core/float_inf_nan_converter.h b/libc/src/stdio/printf_core/float_inf_nan_converter.h
index 0b7a1c3835523fb..3c24c393b354834 100644
--- a/libc/src/stdio/printf_core/float_inf_nan_converter.h
+++ b/libc/src/stdio/printf_core/float_inf_nan_converter.h
@@ -18,7 +18,7 @@
#include <inttypes.h>
#include <stddef.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
namespace printf_core {
using MantissaInt = fputil::FPBits<long double>::UIntType;
@@ -79,6 +79,6 @@ LIBC_INLINE int convert_inf_nan(Writer *writer, const FormatSection &to_conv) {
}
} // namespace printf_core
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_STDIO_PRINTF_CORE_FLOAT_INF_NAN_CONVERTER_H
diff --git a/libc/src/stdio/printf_core/int_converter.h b/libc/src/stdio/printf_core/int_converter.h
index 044721b5afde00b..348e81a1fa536bf 100644
--- a/libc/src/stdio/printf_core/int_converter.h
+++ b/libc/src/stdio/printf_core/int_converter.h
@@ -20,7 +20,7 @@
#include <inttypes.h>
#include <stddef.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
namespace printf_core {
// These functions only work on characters that are already known to be in the
@@ -189,6 +189,6 @@ LIBC_INLINE int convert_int(Writer *writer, const FormatSection &to_conv) {
}
} // namespace printf_core
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_STDIO_PRINTF_CORE_INT_CONVERTER_H
diff --git a/libc/src/stdio/printf_core/parser.cpp b/libc/src/stdio/printf_core/parser.cpp
index 6b2c174c3f23329..78d39720e56198d 100644
--- a/libc/src/stdio/printf_core/parser.cpp
+++ b/libc/src/stdio/printf_core/parser.cpp
@@ -21,7 +21,7 @@
#include "src/__support/str_to_integer.h"
#include "src/stdio/printf_core/core_structs.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
namespace printf_core {
template <typename T> struct int_type_of {
@@ -463,4 +463,4 @@ bool Parser::args_to_index(size_t index) {
#endif // LIBC_COPT_PRINTF_DISABLE_INDEX_MODE
} // namespace printf_core
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/stdio/printf_core/parser.h b/libc/src/stdio/printf_core/parser.h
index a376af99ad8d7f7..d62f5b1116cdf50 100644
--- a/libc/src/stdio/printf_core/parser.h
+++ b/libc/src/stdio/printf_core/parser.h
@@ -18,7 +18,7 @@
#include <stddef.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
namespace printf_core {
#ifndef LIBC_COPT_MOCK_ARG_LIST
@@ -143,6 +143,6 @@ class Parser {
};
} // namespace printf_core
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_STDIO_PRINTF_CORE_PARSER_H
diff --git a/libc/src/stdio/printf_core/printf_main.cpp b/libc/src/stdio/printf_core/printf_main.cpp
index b7684cdf1e74fc0..69aaf967446f9d4 100644
--- a/libc/src/stdio/printf_core/printf_main.cpp
+++ b/libc/src/stdio/printf_core/printf_main.cpp
@@ -16,7 +16,7 @@
#include <stddef.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
namespace printf_core {
int printf_main(Writer *writer, const char *__restrict str,
@@ -39,4 +39,4 @@ int printf_main(Writer *writer, const char *__restrict str,
}
} // namespace printf_core
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/stdio/printf_core/printf_main.h b/libc/src/stdio/printf_core/printf_main.h
index 341bd4cef8543a7..15c6977622afb3f 100644
--- a/libc/src/stdio/printf_core/printf_main.h
+++ b/libc/src/stdio/printf_core/printf_main.h
@@ -14,13 +14,13 @@
#include <stddef.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
namespace printf_core {
int printf_main(Writer *writer, const char *__restrict str,
internal::ArgList &args);
} // namespace printf_core
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_STDIO_PRINTF_CORE_PRINTF_MAIN_H
diff --git a/libc/src/stdio/printf_core/ptr_converter.h b/libc/src/stdio/printf_core/ptr_converter.h
index 6304abcdb6ddafb..73c6e608a59a784 100644
--- a/libc/src/stdio/printf_core/ptr_converter.h
+++ b/libc/src/stdio/printf_core/ptr_converter.h
@@ -17,7 +17,7 @@
#include "src/stdio/printf_core/string_converter.h"
#include "src/stdio/printf_core/writer.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
namespace printf_core {
LIBC_INLINE int convert_pointer(Writer *writer, const FormatSection &to_conv) {
@@ -38,6 +38,6 @@ LIBC_INLINE int convert_pointer(Writer *writer, const FormatSection &to_conv) {
}
} // namespace printf_core
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_STDIO_PRINTF_CORE_PTR_CONVERTER_H
diff --git a/libc/src/stdio/printf_core/string_converter.h b/libc/src/stdio/printf_core/string_converter.h
index 460f195f5d9032a..158315311e9eade 100644
--- a/libc/src/stdio/printf_core/string_converter.h
+++ b/libc/src/stdio/printf_core/string_converter.h
@@ -17,7 +17,7 @@
#include <stddef.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
namespace printf_core {
LIBC_INLINE int convert_string(Writer *writer, const FormatSection &to_conv) {
@@ -59,6 +59,6 @@ LIBC_INLINE int convert_string(Writer *writer, const FormatSection &to_conv) {
}
} // namespace printf_core
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_STDIO_PRINTF_CORE_STRING_CONVERTER_H
diff --git a/libc/src/stdio/printf_core/vfprintf_internal.h b/libc/src/stdio/printf_core/vfprintf_internal.h
index e00248ff0ad856e..8d25f91e8d8b552 100644
--- a/libc/src/stdio/printf_core/vfprintf_internal.h
+++ b/libc/src/stdio/printf_core/vfprintf_internal.h
@@ -18,26 +18,26 @@
#include <stdio.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
namespace internal {
#ifndef LIBC_COPT_PRINTF_USE_SYSTEM_FILE
LIBC_INLINE int ferror_unlocked(FILE *f) {
- return reinterpret_cast<__llvm_libc::File *>(f)->error_unlocked();
+ return reinterpret_cast<LIBC_NAMESPACE::File *>(f)->error_unlocked();
}
LIBC_INLINE void flockfile(FILE *f) {
- reinterpret_cast<__llvm_libc::File *>(f)->lock();
+ reinterpret_cast<LIBC_NAMESPACE::File *>(f)->lock();
}
LIBC_INLINE void funlockfile(FILE *f) {
- reinterpret_cast<__llvm_libc::File *>(f)->unlock();
+ reinterpret_cast<LIBC_NAMESPACE::File *>(f)->unlock();
}
LIBC_INLINE size_t fwrite_unlocked(const void *ptr, size_t size, size_t nmemb,
FILE *f) {
- return reinterpret_cast<__llvm_libc::File *>(f)->write_unlocked(ptr,
- size * nmemb);
+ return reinterpret_cast<LIBC_NAMESPACE::File *>(f)->write_unlocked(
+ ptr, size * nmemb);
}
#else // defined(LIBC_COPT_PRINTF_USE_SYSTEM_FILE)
LIBC_INLINE int ferror_unlocked(::FILE *f) { return ::ferror_unlocked(f); }
@@ -84,6 +84,6 @@ LIBC_INLINE int vfprintf_internal(::FILE *__restrict stream,
}
} // namespace printf_core
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_STDIO_PRINTF_CORE_VFPRINTF_INTERNAL_H
diff --git a/libc/src/stdio/printf_core/write_int_converter.h b/libc/src/stdio/printf_core/write_int_converter.h
index 82049426f7eff7e..35cafacd5a8c1ea 100644
--- a/libc/src/stdio/printf_core/write_int_converter.h
+++ b/libc/src/stdio/printf_core/write_int_converter.h
@@ -16,7 +16,7 @@
#include <inttypes.h>
#include <stddef.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
namespace printf_core {
LIBC_INLINE int convert_write_int(Writer *writer,
@@ -63,6 +63,6 @@ LIBC_INLINE int convert_write_int(Writer *writer,
}
} // namespace printf_core
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_STDIO_PRINTF_CORE_WRITE_INT_CONVERTER_H
diff --git a/libc/src/stdio/printf_core/writer.cpp b/libc/src/stdio/printf_core/writer.cpp
index 5f8091aec58a289..c831ca14c9d9172 100644
--- a/libc/src/stdio/printf_core/writer.cpp
+++ b/libc/src/stdio/printf_core/writer.cpp
@@ -14,7 +14,7 @@
#include "src/string/memory_utils/inline_memset.h"
#include <stddef.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
namespace printf_core {
int Writer::pad(char new_char, size_t length) {
@@ -44,4 +44,4 @@ int Writer::pad(char new_char, size_t length) {
}
} // namespace printf_core
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/stdio/printf_core/writer.h b/libc/src/stdio/printf_core/writer.h
index 1cf05de5a49d1b7..1d4ff9916ee5f5c 100644
--- a/libc/src/stdio/printf_core/writer.h
+++ b/libc/src/stdio/printf_core/writer.h
@@ -17,7 +17,7 @@
#include <stddef.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
namespace printf_core {
struct WriteBuffer {
@@ -134,6 +134,6 @@ class Writer final {
};
} // namespace printf_core
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_STDIO_PRINTF_CORE_WRITER_H
diff --git a/libc/src/stdio/putc.h b/libc/src/stdio/putc.h
index f21cad0220ecb53..a8fb5b7fa97eb10 100644
--- a/libc/src/stdio/putc.h
+++ b/libc/src/stdio/putc.h
@@ -11,10 +11,10 @@
#include <stdio.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int putc(int c, ::FILE *stream);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_STDIO_PUTC_H
diff --git a/libc/src/stdio/putchar.h b/libc/src/stdio/putchar.h
index e6df8285e8b1f75..99a7453efb11dce 100644
--- a/libc/src/stdio/putchar.h
+++ b/libc/src/stdio/putchar.h
@@ -11,10 +11,10 @@
#include <stdio.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int putchar(int c);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_STDIO_PUTCHAR_H
diff --git a/libc/src/stdio/puts.h b/libc/src/stdio/puts.h
index fa5d6f77356aab9..11fbd0be897cfaf 100644
--- a/libc/src/stdio/puts.h
+++ b/libc/src/stdio/puts.h
@@ -11,10 +11,10 @@
#include <stdio.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int puts(const char *__restrict str);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_STDIO_PUTS_H
diff --git a/libc/src/stdio/remove.h b/libc/src/stdio/remove.h
index 4862799bdc69b7c..8c52fe5eee8e870 100644
--- a/libc/src/stdio/remove.h
+++ b/libc/src/stdio/remove.h
@@ -11,10 +11,10 @@
#include <stdio.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int remove(const char *path);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_STDIO_REMOVE_H
diff --git a/libc/src/stdio/scanf.cpp b/libc/src/stdio/scanf.cpp
index 60e77895edcc3c6..68e683bf3063590 100644
--- a/libc/src/stdio/scanf.cpp
+++ b/libc/src/stdio/scanf.cpp
@@ -15,7 +15,7 @@
#include <stdarg.h>
#include <stdio.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, scanf, (const char *__restrict format, ...)) {
va_list vlist;
@@ -25,10 +25,10 @@ LLVM_LIBC_FUNCTION(int, scanf, (const char *__restrict format, ...)) {
// destruction automatically.
va_end(vlist);
int ret_val = scanf_core::vfscanf_internal(
- reinterpret_cast<::FILE *>(__llvm_libc::stdin), format, args);
+ reinterpret_cast<::FILE *>(LIBC_NAMESPACE::stdin), format, args);
// This is done to avoid including stdio.h in the internals. On most systems
// EOF is -1, so this will be transformed into just "return ret_val".
return (ret_val == -1) ? EOF : ret_val;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/stdio/scanf.h b/libc/src/stdio/scanf.h
index 6b4ece12a37f53a..58e42d1fac185a5 100644
--- a/libc/src/stdio/scanf.h
+++ b/libc/src/stdio/scanf.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_STDIO_SCANF_H
#define LLVM_LIBC_SRC_STDIO_SCANF_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int scanf(const char *__restrict format, ...);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_STDIO_SCANF_H
diff --git a/libc/src/stdio/scanf_core/converter.cpp b/libc/src/stdio/scanf_core/converter.cpp
index 5d7b7aaec3488f9..5334af1be98e18b 100644
--- a/libc/src/stdio/scanf_core/converter.cpp
+++ b/libc/src/stdio/scanf_core/converter.cpp
@@ -22,7 +22,7 @@
#include <stddef.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
namespace scanf_core {
int convert(Reader *reader, const FormatSection &to_conv) {
@@ -99,4 +99,4 @@ int raw_match(Reader *reader, cpp::string_view raw_string) {
}
} // namespace scanf_core
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/stdio/scanf_core/converter.h b/libc/src/stdio/scanf_core/converter.h
index cd91ff66a3aeddd..f741840da304e0b 100644
--- a/libc/src/stdio/scanf_core/converter.h
+++ b/libc/src/stdio/scanf_core/converter.h
@@ -15,7 +15,7 @@
#include <stddef.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
namespace scanf_core {
// convert will call a conversion function to convert the FormatSection into
@@ -28,6 +28,6 @@ int convert(Reader *reader, const FormatSection &to_conv);
int raw_match(Reader *reader, cpp::string_view raw_string);
} // namespace scanf_core
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_STDIO_SCANF_CORE_CONVERTER_H
diff --git a/libc/src/stdio/scanf_core/converter_utils.h b/libc/src/stdio/scanf_core/converter_utils.h
index a2e36e6520bb122..a14f35796d27f2f 100644
--- a/libc/src/stdio/scanf_core/converter_utils.h
+++ b/libc/src/stdio/scanf_core/converter_utils.h
@@ -17,7 +17,7 @@
#include <stddef.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
namespace scanf_core {
LIBC_INLINE constexpr char to_lower(char a) { return a | 32; }
@@ -108,6 +108,6 @@ LIBC_INLINE void write_float_with_length(char *str,
}
} // namespace scanf_core
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_STDIO_SCANF_CORE_CONVERTER_UTILS_H
diff --git a/libc/src/stdio/scanf_core/core_structs.h b/libc/src/stdio/scanf_core/core_structs.h
index 4555595ab3bff6d..246f770e0cabed7 100644
--- a/libc/src/stdio/scanf_core/core_structs.h
+++ b/libc/src/stdio/scanf_core/core_structs.h
@@ -16,7 +16,7 @@
#include <inttypes.h>
#include <stddef.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
namespace scanf_core {
// These length modifiers match the length modifiers in the format string, which
@@ -87,6 +87,6 @@ enum ErrorCodes : int {
ALLOCATION_FAILURE = -4,
};
} // namespace scanf_core
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_STDIO_SCANF_CORE_CORE_STRUCTS_H
diff --git a/libc/src/stdio/scanf_core/current_pos_converter.h b/libc/src/stdio/scanf_core/current_pos_converter.h
index be4b6553b89dc5c..fd62383e394092a 100644
--- a/libc/src/stdio/scanf_core/current_pos_converter.h
+++ b/libc/src/stdio/scanf_core/current_pos_converter.h
@@ -16,7 +16,7 @@
#include <stddef.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
namespace scanf_core {
LIBC_INLINE int convert_current_pos(Reader *reader,
@@ -26,6 +26,6 @@ LIBC_INLINE int convert_current_pos(Reader *reader,
}
} // namespace scanf_core
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_STDIO_SCANF_CORE_CURRENT_POS_CONVERTER_H
diff --git a/libc/src/stdio/scanf_core/file_reader.cpp b/libc/src/stdio/scanf_core/file_reader.cpp
index 51e22299e3dd2c5..658cc25b2cf35c1 100644
--- a/libc/src/stdio/scanf_core/file_reader.cpp
+++ b/libc/src/stdio/scanf_core/file_reader.cpp
@@ -10,7 +10,7 @@
#include "src/__support/File/file.h"
#include <stddef.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
namespace scanf_core {
char FileReader::get_char() {
@@ -24,4 +24,4 @@ char FileReader::get_char() {
void FileReader::unget_char(char c) { file->ungetc_unlocked(c); }
} // namespace scanf_core
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/stdio/scanf_core/file_reader.h b/libc/src/stdio/scanf_core/file_reader.h
index a70e00bc2413963..17f66d139bc091e 100644
--- a/libc/src/stdio/scanf_core/file_reader.h
+++ b/libc/src/stdio/scanf_core/file_reader.h
@@ -14,15 +14,15 @@
#include <stddef.h>
#include <stdio.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
namespace scanf_core {
class FileReader {
- __llvm_libc::File *file;
+ LIBC_NAMESPACE::File *file;
public:
FileReader(::FILE *init_file) {
- file = reinterpret_cast<__llvm_libc::File *>(init_file);
+ file = reinterpret_cast<LIBC_NAMESPACE::File *>(init_file);
file->lock();
}
@@ -34,6 +34,6 @@ class FileReader {
};
} // namespace scanf_core
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_STDIO_SCANF_CORE_FILE_READER_H
diff --git a/libc/src/stdio/scanf_core/float_converter.cpp b/libc/src/stdio/scanf_core/float_converter.cpp
index 5ffb9b09fcfc27c..47a43d58ba7c78a 100644
--- a/libc/src/stdio/scanf_core/float_converter.cpp
+++ b/libc/src/stdio/scanf_core/float_converter.cpp
@@ -17,7 +17,7 @@
#include <stddef.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
namespace scanf_core {
// All of the floating point conversions are the same for scanf, every name will
@@ -223,4 +223,4 @@ int convert_float(Reader *reader, const FormatSection &to_conv) {
}
} // namespace scanf_core
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/stdio/scanf_core/float_converter.h b/libc/src/stdio/scanf_core/float_converter.h
index e8abe8d20bcea5f..a3ea1da86a3f48f 100644
--- a/libc/src/stdio/scanf_core/float_converter.h
+++ b/libc/src/stdio/scanf_core/float_converter.h
@@ -14,12 +14,12 @@
#include <stddef.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
namespace scanf_core {
int convert_float(Reader *reader, const FormatSection &to_conv);
} // namespace scanf_core
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_STDIO_SCANF_CORE_FLOAT_CONVERTER_H
diff --git a/libc/src/stdio/scanf_core/int_converter.cpp b/libc/src/stdio/scanf_core/int_converter.cpp
index 6370c98e0f1603a..05d6ed6e0fd352d 100644
--- a/libc/src/stdio/scanf_core/int_converter.cpp
+++ b/libc/src/stdio/scanf_core/int_converter.cpp
@@ -16,7 +16,7 @@
#include <stddef.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
namespace scanf_core {
// This code is very similar to the code in __support/str_to_integer.h but is
@@ -212,4 +212,4 @@ int convert_int(Reader *reader, const FormatSection &to_conv) {
}
} // namespace scanf_core
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/stdio/scanf_core/int_converter.h b/libc/src/stdio/scanf_core/int_converter.h
index af5ab3e060a7bc0..7c9d8b4fbae3237 100644
--- a/libc/src/stdio/scanf_core/int_converter.h
+++ b/libc/src/stdio/scanf_core/int_converter.h
@@ -14,12 +14,12 @@
#include <stddef.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
namespace scanf_core {
int convert_int(Reader *reader, const FormatSection &to_conv);
} // namespace scanf_core
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_STDIO_SCANF_CORE_INT_CONVERTER_H
diff --git a/libc/src/stdio/scanf_core/parser.cpp b/libc/src/stdio/scanf_core/parser.cpp
index 44e853c8a8de8fe..82fc948fc413c05 100644
--- a/libc/src/stdio/scanf_core/parser.cpp
+++ b/libc/src/stdio/scanf_core/parser.cpp
@@ -19,7 +19,7 @@
#include "src/__support/ctype_utils.h"
#include "src/__support/str_to_integer.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
namespace scanf_core {
#ifndef LIBC_COPT_SCANF_DISABLE_INDEX_MODE
@@ -222,4 +222,4 @@ void Parser::args_to_index(size_t index) {
#endif // LIBC_COPT_SCANF_DISABLE_INDEX_MODE
} // namespace scanf_core
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/stdio/scanf_core/parser.h b/libc/src/stdio/scanf_core/parser.h
index 4b9f0b4dd95b94b..a0aef3f9dd3ff75 100644
--- a/libc/src/stdio/scanf_core/parser.h
+++ b/libc/src/stdio/scanf_core/parser.h
@@ -16,7 +16,7 @@
#include <stddef.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
namespace scanf_core {
class Parser {
@@ -95,6 +95,6 @@ class Parser {
};
} // namespace scanf_core
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_STDIO_SCANF_CORE_PARSER_H
diff --git a/libc/src/stdio/scanf_core/ptr_converter.cpp b/libc/src/stdio/scanf_core/ptr_converter.cpp
index 31d6476a2da1ba5..cc233c365629042 100644
--- a/libc/src/stdio/scanf_core/ptr_converter.cpp
+++ b/libc/src/stdio/scanf_core/ptr_converter.cpp
@@ -15,7 +15,7 @@
#include <stddef.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
namespace scanf_core {
int convert_pointer(Reader *reader, const FormatSection &to_conv) {
static const char nullptr_string[] = "(nullptr)";
@@ -40,4 +40,4 @@ int convert_pointer(Reader *reader, const FormatSection &to_conv) {
return convert_int(reader, to_conv);
}
} // namespace scanf_core
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/stdio/scanf_core/ptr_converter.h b/libc/src/stdio/scanf_core/ptr_converter.h
index 642898c1db18f24..363d9aacde7be82 100644
--- a/libc/src/stdio/scanf_core/ptr_converter.h
+++ b/libc/src/stdio/scanf_core/ptr_converter.h
@@ -14,12 +14,12 @@
#include <stddef.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
namespace scanf_core {
int convert_pointer(Reader *reader, const FormatSection &to_conv);
} // namespace scanf_core
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_STDIO_SCANF_CORE_PTR_CONVERTER_H
diff --git a/libc/src/stdio/scanf_core/reader.cpp b/libc/src/stdio/scanf_core/reader.cpp
index 4834f4d6a6e7955..57cd77ffaffbf86 100644
--- a/libc/src/stdio/scanf_core/reader.cpp
+++ b/libc/src/stdio/scanf_core/reader.cpp
@@ -9,7 +9,7 @@
#include "src/stdio/scanf_core/reader.h"
#include <stddef.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
namespace scanf_core {
char Reader::getc() {
@@ -41,4 +41,4 @@ bool Reader::has_error() {
}
} // namespace scanf_core
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/stdio/scanf_core/reader.h b/libc/src/stdio/scanf_core/reader.h
index 000ab02ad28f21e..d4ac5ce7d423e14 100644
--- a/libc/src/stdio/scanf_core/reader.h
+++ b/libc/src/stdio/scanf_core/reader.h
@@ -13,7 +13,7 @@
#include "src/stdio/scanf_core/string_reader.h"
#include <stddef.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
namespace scanf_core {
enum class ReaderType { String, File };
@@ -50,6 +50,6 @@ class Reader final {
};
} // namespace scanf_core
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_STDIO_SCANF_CORE_READER_H
diff --git a/libc/src/stdio/scanf_core/scanf_main.cpp b/libc/src/stdio/scanf_core/scanf_main.cpp
index 5a79d2e624ab0aa..876b8773295b521 100644
--- a/libc/src/stdio/scanf_core/scanf_main.cpp
+++ b/libc/src/stdio/scanf_core/scanf_main.cpp
@@ -16,7 +16,7 @@
#include <stddef.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
namespace scanf_core {
int scanf_main(Reader *reader, const char *__restrict str,
@@ -47,4 +47,4 @@ int scanf_main(Reader *reader, const char *__restrict str,
}
} // namespace scanf_core
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/stdio/scanf_core/scanf_main.h b/libc/src/stdio/scanf_core/scanf_main.h
index d1db46b7c77dc14..f1688d648ccc888 100644
--- a/libc/src/stdio/scanf_core/scanf_main.h
+++ b/libc/src/stdio/scanf_core/scanf_main.h
@@ -14,13 +14,13 @@
#include <stddef.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
namespace scanf_core {
int scanf_main(Reader *reader, const char *__restrict str,
internal::ArgList &args);
} // namespace scanf_core
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_STDIO_SCANF_CORE_SCANF_MAIN_H
diff --git a/libc/src/stdio/scanf_core/string_converter.cpp b/libc/src/stdio/scanf_core/string_converter.cpp
index bdbb5c87f75e559..94a7fc4e5fe0d3d 100644
--- a/libc/src/stdio/scanf_core/string_converter.cpp
+++ b/libc/src/stdio/scanf_core/string_converter.cpp
@@ -15,7 +15,7 @@
#include <stddef.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
namespace scanf_core {
int convert_string(Reader *reader, const FormatSection &to_conv) {
@@ -73,4 +73,4 @@ int convert_string(Reader *reader, const FormatSection &to_conv) {
}
} // namespace scanf_core
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/stdio/scanf_core/string_converter.h b/libc/src/stdio/scanf_core/string_converter.h
index 4113f5cb9a36932..165fc47e4bdf78e 100644
--- a/libc/src/stdio/scanf_core/string_converter.h
+++ b/libc/src/stdio/scanf_core/string_converter.h
@@ -14,12 +14,12 @@
#include <stddef.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
namespace scanf_core {
int convert_string(Reader *reader, const FormatSection &to_conv);
} // namespace scanf_core
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_STDIO_SCANF_CORE_STRING_CONVERTER_H
diff --git a/libc/src/stdio/scanf_core/string_reader.cpp b/libc/src/stdio/scanf_core/string_reader.cpp
index 1d728d2b9eb35e6..a34d6b55d05dcf7 100644
--- a/libc/src/stdio/scanf_core/string_reader.cpp
+++ b/libc/src/stdio/scanf_core/string_reader.cpp
@@ -9,7 +9,7 @@
#include "src/stdio/scanf_core/string_reader.h"
#include <stddef.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
namespace scanf_core {
char StringReader::get_char() {
@@ -21,4 +21,4 @@ char StringReader::get_char() {
void StringReader::unget_char() { --cur_index; }
} // namespace scanf_core
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/stdio/scanf_core/string_reader.h b/libc/src/stdio/scanf_core/string_reader.h
index 35550b16c32140f..226389dbeff477b 100644
--- a/libc/src/stdio/scanf_core/string_reader.h
+++ b/libc/src/stdio/scanf_core/string_reader.h
@@ -11,7 +11,7 @@
#include <stddef.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
namespace scanf_core {
class StringReader {
@@ -28,6 +28,6 @@ class StringReader {
};
} // namespace scanf_core
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_STDIO_SCANF_CORE_STRING_READER_H
diff --git a/libc/src/stdio/scanf_core/vfscanf_internal.cpp b/libc/src/stdio/scanf_core/vfscanf_internal.cpp
index af2f6fa01ad475d..abc1509216e218d 100644
--- a/libc/src/stdio/scanf_core/vfscanf_internal.cpp
+++ b/libc/src/stdio/scanf_core/vfscanf_internal.cpp
@@ -15,7 +15,7 @@
#include <stdio.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
namespace scanf_core {
int vfscanf_internal(::FILE *__restrict stream, const char *__restrict format,
@@ -26,4 +26,4 @@ int vfscanf_internal(::FILE *__restrict stream, const char *__restrict format,
}
} // namespace scanf_core
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/stdio/scanf_core/vfscanf_internal.h b/libc/src/stdio/scanf_core/vfscanf_internal.h
index 456d1ff92056bed..d1b1333e6ed9c34 100644
--- a/libc/src/stdio/scanf_core/vfscanf_internal.h
+++ b/libc/src/stdio/scanf_core/vfscanf_internal.h
@@ -13,12 +13,12 @@
#include <stdio.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
namespace scanf_core {
int vfscanf_internal(::FILE *__restrict stream, const char *__restrict format,
internal::ArgList &args);
} // namespace scanf_core
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_STDIO_SCANF_CORE_VFSCANF_INTERNAL_H
diff --git a/libc/src/stdio/setbuf.cpp b/libc/src/stdio/setbuf.cpp
index cb30fe3065f0a74..8819901849a08f7 100644
--- a/libc/src/stdio/setbuf.cpp
+++ b/libc/src/stdio/setbuf.cpp
@@ -12,17 +12,17 @@
#include "src/errno/libc_errno.h"
#include <stdio.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(void, setbuf,
(::FILE *__restrict stream, char *__restrict buf)) {
int mode = _IOFBF;
if (buf == nullptr)
mode = _IONBF;
- int err = reinterpret_cast<__llvm_libc::File *>(stream)->set_buffer(
+ int err = reinterpret_cast<LIBC_NAMESPACE::File *>(stream)->set_buffer(
buf, BUFSIZ, mode);
if (err != 0)
libc_errno = err;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/stdio/setbuf.h b/libc/src/stdio/setbuf.h
index 7a158ac0f173e35..9c7aab95d2c9e36 100644
--- a/libc/src/stdio/setbuf.h
+++ b/libc/src/stdio/setbuf.h
@@ -11,10 +11,10 @@
#include <stdio.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
void setbuf(::FILE *__restrict stream, char *__restrict buf);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_STDIO_SETBUF_H
diff --git a/libc/src/stdio/setvbuf.cpp b/libc/src/stdio/setvbuf.cpp
index 9080c55cf9581c8..5fdaebcdb75c2b3 100644
--- a/libc/src/stdio/setvbuf.cpp
+++ b/libc/src/stdio/setvbuf.cpp
@@ -12,16 +12,16 @@
#include "src/errno/libc_errno.h"
#include <stdio.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, setvbuf,
(::FILE *__restrict stream, char *__restrict buf, int type,
size_t size)) {
- int err = reinterpret_cast<__llvm_libc::File *>(stream)->set_buffer(buf, size,
- type);
+ int err = reinterpret_cast<LIBC_NAMESPACE::File *>(stream)->set_buffer(
+ buf, size, type);
if (err != 0)
libc_errno = err;
return err;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/stdio/setvbuf.h b/libc/src/stdio/setvbuf.h
index bceedd8b44113a7..21d9c9918ffa12c 100644
--- a/libc/src/stdio/setvbuf.h
+++ b/libc/src/stdio/setvbuf.h
@@ -11,11 +11,11 @@
#include <stdio.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int setvbuf(::FILE *__restrict stream, char *__restrict buf, int type,
size_t size);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_STDIO_SETVBUF_H
diff --git a/libc/src/stdio/snprintf.cpp b/libc/src/stdio/snprintf.cpp
index 4e1973fe9be3d10..fbfc2b218032630 100644
--- a/libc/src/stdio/snprintf.cpp
+++ b/libc/src/stdio/snprintf.cpp
@@ -15,7 +15,7 @@
#include <stdarg.h>
#include <stddef.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, snprintf,
(char *__restrict buffer, size_t buffsz,
@@ -35,4 +35,4 @@ LLVM_LIBC_FUNCTION(int, snprintf,
return ret_val;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/stdio/snprintf.h b/libc/src/stdio/snprintf.h
index ec223be0e7baa67..0e4e398abc391bd 100644
--- a/libc/src/stdio/snprintf.h
+++ b/libc/src/stdio/snprintf.h
@@ -11,11 +11,11 @@
#include <stddef.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int snprintf(char *__restrict buffer, size_t buffsz,
const char *__restrict format, ...);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_STDIO_SNPRINTF_H
diff --git a/libc/src/stdio/sprintf.cpp b/libc/src/stdio/sprintf.cpp
index 3e4206be0aa6980..11f2f1a8634ff20 100644
--- a/libc/src/stdio/sprintf.cpp
+++ b/libc/src/stdio/sprintf.cpp
@@ -15,7 +15,7 @@
#include <stdarg.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, sprintf,
(char *__restrict buffer, const char *__restrict format,
@@ -35,4 +35,4 @@ LLVM_LIBC_FUNCTION(int, sprintf,
return ret_val;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/stdio/sprintf.h b/libc/src/stdio/sprintf.h
index 234de6e165223da..14bb4fa121f42f8 100644
--- a/libc/src/stdio/sprintf.h
+++ b/libc/src/stdio/sprintf.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_STDIO_SPRINTF_H
#define LLVM_LIBC_SRC_STDIO_SPRINTF_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int sprintf(char *__restrict buffer, const char *__restrict format, ...);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_STDIO_SPRINTF_H
diff --git a/libc/src/stdio/sscanf.cpp b/libc/src/stdio/sscanf.cpp
index 205b58fb3390e95..3b51d3035fe647a 100644
--- a/libc/src/stdio/sscanf.cpp
+++ b/libc/src/stdio/sscanf.cpp
@@ -16,7 +16,7 @@
#include <stdarg.h>
#include <stdio.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, sscanf,
(const char *__restrict buffer,
@@ -35,4 +35,4 @@ LLVM_LIBC_FUNCTION(int, sscanf,
return (ret_val == -1) ? EOF : ret_val;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/stdio/sscanf.h b/libc/src/stdio/sscanf.h
index 7f63638e4c1d903..9e4b28e0033cf99 100644
--- a/libc/src/stdio/sscanf.h
+++ b/libc/src/stdio/sscanf.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_STDIO_SSCANF_H
#define LLVM_LIBC_SRC_STDIO_SSCANF_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int sscanf(const char *__restrict buffer, const char *__restrict format, ...);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_STDIO_SSCANF_H
diff --git a/libc/src/stdio/ungetc.cpp b/libc/src/stdio/ungetc.cpp
index de6ce0ba0683d39..ccfbfb0121c86f3 100644
--- a/libc/src/stdio/ungetc.cpp
+++ b/libc/src/stdio/ungetc.cpp
@@ -11,10 +11,10 @@
#include <stdio.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, ungetc, (int c, ::FILE *stream)) {
- return reinterpret_cast<__llvm_libc::File *>(stream)->ungetc(c);
+ return reinterpret_cast<LIBC_NAMESPACE::File *>(stream)->ungetc(c);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/stdio/ungetc.h b/libc/src/stdio/ungetc.h
index b5b7acb5962c19b..c24d8e5600cadfe 100644
--- a/libc/src/stdio/ungetc.h
+++ b/libc/src/stdio/ungetc.h
@@ -11,10 +11,10 @@
#include <stdio.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int ungetc(int c, ::FILE *stream);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_STDIO_UNGETC_H
diff --git a/libc/src/stdio/vfprintf.cpp b/libc/src/stdio/vfprintf.cpp
index aa56c26b46d6a2d..2504ce8a20bac5c 100644
--- a/libc/src/stdio/vfprintf.cpp
+++ b/libc/src/stdio/vfprintf.cpp
@@ -15,7 +15,7 @@
#include <stdarg.h>
#include <stdio.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, vfprintf,
(::FILE *__restrict stream, const char *__restrict format,
@@ -27,4 +27,4 @@ LLVM_LIBC_FUNCTION(int, vfprintf,
return ret_val;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/stdio/vfprintf.h b/libc/src/stdio/vfprintf.h
index b4a2d5e24042c6c..01827c59d6ce15f 100644
--- a/libc/src/stdio/vfprintf.h
+++ b/libc/src/stdio/vfprintf.h
@@ -12,11 +12,11 @@
#include <stdarg.h>
#include <stdio.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int vfprintf(::FILE *__restrict stream, const char *__restrict format,
va_list vlist);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_STDIO_VFPRINTF_H
diff --git a/libc/src/stdio/vprintf.cpp b/libc/src/stdio/vprintf.cpp
index d38bf4fecfc07d3..3f486e8bab2816d 100644
--- a/libc/src/stdio/vprintf.cpp
+++ b/libc/src/stdio/vprintf.cpp
@@ -16,12 +16,12 @@
#include <stdio.h>
#ifndef LIBC_COPT_PRINTF_USE_SYSTEM_FILE
-#define PRINTF_STDOUT __llvm_libc::stdout
+#define PRINTF_STDOUT LIBC_NAMESPACE::stdout
#else // LIBC_COPT_PRINTF_USE_SYSTEM_FILE
#define PRINTF_STDOUT ::stdout
#endif // LIBC_COPT_PRINTF_USE_SYSTEM_FILE
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, vprintf,
(const char *__restrict format, va_list vlist)) {
@@ -33,4 +33,4 @@ LLVM_LIBC_FUNCTION(int, vprintf,
return ret_val;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/stdio/vprintf.h b/libc/src/stdio/vprintf.h
index ffc5d39eaede897..fe4252bd86203bd 100644
--- a/libc/src/stdio/vprintf.h
+++ b/libc/src/stdio/vprintf.h
@@ -12,10 +12,10 @@
#include <stdarg.h>
#include <stdio.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int vprintf(const char *__restrict format, va_list vlist);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_STDIO_VPRINTF_H
diff --git a/libc/src/stdio/vsnprintf.cpp b/libc/src/stdio/vsnprintf.cpp
index 0dc34a83fd441d7..9446d3b223506bb 100644
--- a/libc/src/stdio/vsnprintf.cpp
+++ b/libc/src/stdio/vsnprintf.cpp
@@ -15,7 +15,7 @@
#include <stdarg.h>
#include <stddef.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, vsnprintf,
(char *__restrict buffer, size_t buffsz,
@@ -32,4 +32,4 @@ LLVM_LIBC_FUNCTION(int, vsnprintf,
return ret_val;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/stdio/vsnprintf.h b/libc/src/stdio/vsnprintf.h
index caa381e8383ad17..6da25fc66f7920e 100644
--- a/libc/src/stdio/vsnprintf.h
+++ b/libc/src/stdio/vsnprintf.h
@@ -12,11 +12,11 @@
#include <stdarg.h>
#include <stddef.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int vsnprintf(char *__restrict buffer, size_t buffsz,
const char *__restrict format, va_list vlist);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_STDIO_VSNPRINTF_H
diff --git a/libc/src/stdio/vsprintf.cpp b/libc/src/stdio/vsprintf.cpp
index cf86f92ced4c317..5ebdf9a2a539fec 100644
--- a/libc/src/stdio/vsprintf.cpp
+++ b/libc/src/stdio/vsprintf.cpp
@@ -15,7 +15,7 @@
#include <stdarg.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, vsprintf,
(char *__restrict buffer, const char *__restrict format,
@@ -32,4 +32,4 @@ LLVM_LIBC_FUNCTION(int, vsprintf,
return ret_val;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/stdio/vsprintf.h b/libc/src/stdio/vsprintf.h
index a129a2a420c2b8c..fe8def5994214a1 100644
--- a/libc/src/stdio/vsprintf.h
+++ b/libc/src/stdio/vsprintf.h
@@ -11,11 +11,11 @@
#include <stdarg.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int vsprintf(char *__restrict buffer, const char *__restrict format,
va_list vlist);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_STDIO_VSPRINTF_H
diff --git a/libc/src/stdlib/_Exit.cpp b/libc/src/stdlib/_Exit.cpp
index 5aec134b1c71c22..85684d1e90879ef 100644
--- a/libc/src/stdlib/_Exit.cpp
+++ b/libc/src/stdlib/_Exit.cpp
@@ -11,11 +11,11 @@
#include "src/stdlib/_Exit.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(void, _Exit, (int status)) {
quick_exit(status);
__builtin_unreachable();
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/stdlib/_Exit.h b/libc/src/stdlib/_Exit.h
index f4ae3266ff30194..bc05fafeb766b25 100644
--- a/libc/src/stdlib/_Exit.h
+++ b/libc/src/stdlib/_Exit.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_STDLIB__EXIT_H
#define LLVM_LIBC_SRC_STDLIB__EXIT_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
[[noreturn]] void _Exit(int status);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_STDLIB__EXIT_H
diff --git a/libc/src/stdlib/abort.h b/libc/src/stdlib/abort.h
index d1e4385b6c6e23e..d3bf1e9e477c2ba 100644
--- a/libc/src/stdlib/abort.h
+++ b/libc/src/stdlib/abort.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_STDLIB_ABORT_H
#define LLVM_LIBC_SRC_STDLIB_ABORT_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
[[noreturn]] void abort();
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_STDLIB_ABORT_H
diff --git a/libc/src/stdlib/abs.cpp b/libc/src/stdlib/abs.cpp
index eef7937067eb888..6be63e0468f527a 100644
--- a/libc/src/stdlib/abs.cpp
+++ b/libc/src/stdlib/abs.cpp
@@ -10,8 +10,8 @@
#include "src/__support/common.h"
#include "src/__support/integer_operations.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, abs, (int n)) { return integer_abs(n); }
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/stdlib/abs.h b/libc/src/stdlib/abs.h
index 42ef7f885ed654a..19cef1446bd36df 100644
--- a/libc/src/stdlib/abs.h
+++ b/libc/src/stdlib/abs.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_STDLIB_ABS_H
#define LLVM_LIBC_SRC_STDLIB_ABS_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int abs(int n);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_STDLIB_ABS_H
diff --git a/libc/src/stdlib/atexit.cpp b/libc/src/stdlib/atexit.cpp
index 118c46a72723c83..10dff42b1be9254 100644
--- a/libc/src/stdlib/atexit.cpp
+++ b/libc/src/stdlib/atexit.cpp
@@ -12,7 +12,7 @@
#include "src/__support/fixedvector.h"
#include "src/__support/threads/mutex.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
namespace {
@@ -83,4 +83,4 @@ LLVM_LIBC_FUNCTION(int, atexit, (StdCAtExitCallback * callback)) {
{&stdc_at_exit_func, reinterpret_cast<void *>(callback)});
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/stdlib/atexit.h b/libc/src/stdlib/atexit.h
index 920d1eb9cf27733..7cf9d7c92191ddf 100644
--- a/libc/src/stdlib/atexit.h
+++ b/libc/src/stdlib/atexit.h
@@ -11,12 +11,12 @@
#include <stddef.h> // For size_t
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
constexpr size_t CALLBACK_LIST_SIZE_FOR_TESTS = 1024;
int atexit(void (*function)());
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_STDLIB_ATEXIT_H
diff --git a/libc/src/stdlib/atof.cpp b/libc/src/stdlib/atof.cpp
index 2359ce7cc8e2a45..61eb7db0056f189 100644
--- a/libc/src/stdlib/atof.cpp
+++ b/libc/src/stdlib/atof.cpp
@@ -11,7 +11,7 @@
#include "src/__support/str_to_float.h"
#include "src/errno/libc_errno.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(double, atof, (const char *str)) {
auto result = internal::strtofloatingpoint<double>(str);
@@ -21,4 +21,4 @@ LLVM_LIBC_FUNCTION(double, atof, (const char *str)) {
return result.value;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/stdlib/atof.h b/libc/src/stdlib/atof.h
index c897a7e410ae5de..cc9ae5157d6a52a 100644
--- a/libc/src/stdlib/atof.h
+++ b/libc/src/stdlib/atof.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_STDLIB_ATOF_H
#define LLVM_LIBC_SRC_STDLIB_ATOF_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
double atof(const char *str);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_STDLIB_ATOF_H
diff --git a/libc/src/stdlib/atoi.cpp b/libc/src/stdlib/atoi.cpp
index eec15aa95671b39..d1dc3203d3c5702 100644
--- a/libc/src/stdlib/atoi.cpp
+++ b/libc/src/stdlib/atoi.cpp
@@ -11,7 +11,7 @@
#include "src/__support/str_to_integer.h"
#include "src/errno/libc_errno.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, atoi, (const char *str)) {
// This is done because the standard specifies that atoi is identical to
@@ -23,4 +23,4 @@ LLVM_LIBC_FUNCTION(int, atoi, (const char *str)) {
return static_cast<int>(result);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/stdlib/atoi.h b/libc/src/stdlib/atoi.h
index bb6c978d42f327d..fb5de31860d02d2 100644
--- a/libc/src/stdlib/atoi.h
+++ b/libc/src/stdlib/atoi.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_STDLIB_ATOI_H
#define LLVM_LIBC_SRC_STDLIB_ATOI_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int atoi(const char *str);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_STDLIB_ATOI_H
diff --git a/libc/src/stdlib/atol.cpp b/libc/src/stdlib/atol.cpp
index 78928e81fa20f67..5586db7838c6b43 100644
--- a/libc/src/stdlib/atol.cpp
+++ b/libc/src/stdlib/atol.cpp
@@ -11,7 +11,7 @@
#include "src/__support/str_to_integer.h"
#include "src/errno/libc_errno.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(long, atol, (const char *str)) {
auto result = internal::strtointeger<long>(str, 10);
@@ -21,4 +21,4 @@ LLVM_LIBC_FUNCTION(long, atol, (const char *str)) {
return result;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/stdlib/atol.h b/libc/src/stdlib/atol.h
index 8ba6337aa6ebafa..690731f8714d89f 100644
--- a/libc/src/stdlib/atol.h
+++ b/libc/src/stdlib/atol.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_STDLIB_ATOL_H
#define LLVM_LIBC_SRC_STDLIB_ATOL_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
long atol(const char *str);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_STDLIB_ATOL_H
diff --git a/libc/src/stdlib/atoll.cpp b/libc/src/stdlib/atoll.cpp
index 50472261dca25db..921459ddc3ac300 100644
--- a/libc/src/stdlib/atoll.cpp
+++ b/libc/src/stdlib/atoll.cpp
@@ -11,7 +11,7 @@
#include "src/__support/str_to_integer.h"
#include "src/errno/libc_errno.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(long long, atoll, (const char *str)) {
auto result = internal::strtointeger<long long>(str, 10);
@@ -21,4 +21,4 @@ LLVM_LIBC_FUNCTION(long long, atoll, (const char *str)) {
return result;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/stdlib/atoll.h b/libc/src/stdlib/atoll.h
index d99184fdd0591a0..4746eb1e5e30754 100644
--- a/libc/src/stdlib/atoll.h
+++ b/libc/src/stdlib/atoll.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_STDLIB_ATOLL_H
#define LLVM_LIBC_SRC_STDLIB_ATOLL_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
long long atoll(const char *str);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_STDLIB_ATOLL_H
diff --git a/libc/src/stdlib/baremetal/abort.cpp b/libc/src/stdlib/baremetal/abort.cpp
index f3164ce5f09fcc7..4dd85367411e64f 100644
--- a/libc/src/stdlib/baremetal/abort.cpp
+++ b/libc/src/stdlib/baremetal/abort.cpp
@@ -10,8 +10,8 @@
#include "src/stdlib/abort.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(void, abort, ()) { __builtin_trap(); }
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/stdlib/bsearch.cpp b/libc/src/stdlib/bsearch.cpp
index a298e516ae70134..4292d6b6fe0465b 100644
--- a/libc/src/stdlib/bsearch.cpp
+++ b/libc/src/stdlib/bsearch.cpp
@@ -11,7 +11,7 @@
#include <stdint.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(void *, bsearch,
(const void *key, const void *array, size_t array_size,
@@ -44,4 +44,4 @@ LLVM_LIBC_FUNCTION(void *, bsearch,
return nullptr;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/stdlib/bsearch.h b/libc/src/stdlib/bsearch.h
index aab86dcd71984a5..1de7e051ff6c41a 100644
--- a/libc/src/stdlib/bsearch.h
+++ b/libc/src/stdlib/bsearch.h
@@ -11,11 +11,11 @@
#include <stdlib.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
void *bsearch(const void *key, const void *array, size_t array_size,
size_t elem_size, int (*compare)(const void *, const void *));
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif //LLVM_LIBC_SRC_STDLIB_BSEARCH_H
diff --git a/libc/src/stdlib/div.cpp b/libc/src/stdlib/div.cpp
index 44f1d9fd1bb9d78..ee7c335bdb7fd2f 100644
--- a/libc/src/stdlib/div.cpp
+++ b/libc/src/stdlib/div.cpp
@@ -10,7 +10,7 @@
#include "src/__support/common.h"
#include "src/__support/integer_operations.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(div_t, div, (int x, int y)) {
div_t res;
@@ -18,4 +18,4 @@ LLVM_LIBC_FUNCTION(div_t, div, (int x, int y)) {
return res;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/stdlib/div.h b/libc/src/stdlib/div.h
index 46d59485bf517bd..3a6853f7c95f537 100644
--- a/libc/src/stdlib/div.h
+++ b/libc/src/stdlib/div.h
@@ -11,10 +11,10 @@
#include <stdlib.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
div_t div(int x, int y);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_STDLIB_DIV_H
diff --git a/libc/src/stdlib/exit.cpp b/libc/src/stdlib/exit.cpp
index 6e2f1042738cfdf..cc5ae6648d11f23 100644
--- a/libc/src/stdlib/exit.cpp
+++ b/libc/src/stdlib/exit.cpp
@@ -10,7 +10,7 @@
#include "src/__support/OSUtil/quick_exit.h"
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
namespace internal {
void call_exit_callbacks();
@@ -22,4 +22,4 @@ LLVM_LIBC_FUNCTION(void, exit, (int status)) {
__builtin_unreachable();
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/stdlib/exit.h b/libc/src/stdlib/exit.h
index cbd9f9720cd39da..b13573547fbf89c 100644
--- a/libc/src/stdlib/exit.h
+++ b/libc/src/stdlib/exit.h
@@ -11,10 +11,10 @@
#include <stdlib.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
[[noreturn]] void exit(int status);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_STDLIB_EXIT_H
diff --git a/libc/src/stdlib/free.h b/libc/src/stdlib/free.h
index 81299376f9735af..f802f1d192d810c 100644
--- a/libc/src/stdlib/free.h
+++ b/libc/src/stdlib/free.h
@@ -11,10 +11,10 @@
#ifndef LLVM_LIBC_SRC_STDLIB_FREE_H
#define LLVM_LIBC_SRC_STDLIB_FREE_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
void free(void *ptr);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_STDLIB_LDIV_H
diff --git a/libc/src/stdlib/getenv.cpp b/libc/src/stdlib/getenv.cpp
index bb29e2c79969d3c..08397e0d8057161 100644
--- a/libc/src/stdlib/getenv.cpp
+++ b/libc/src/stdlib/getenv.cpp
@@ -13,19 +13,19 @@
#include <stddef.h> // For size_t.
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(char *, getenv, (const char *name)) {
- char **env_ptr = reinterpret_cast<char **>(__llvm_libc::app.envPtr);
+ char **env_ptr = reinterpret_cast<char **>(LIBC_NAMESPACE::app.envPtr);
if (name == nullptr || env_ptr == nullptr)
return nullptr;
- __llvm_libc::cpp::string_view env_var_name(name);
+ LIBC_NAMESPACE::cpp::string_view env_var_name(name);
if (env_var_name.size() == 0)
return nullptr;
for (char **env = env_ptr; *env != nullptr; env++) {
- __llvm_libc::cpp::string_view cur(*env);
+ LIBC_NAMESPACE::cpp::string_view cur(*env);
if (!cur.starts_with(env_var_name))
continue;
@@ -41,4 +41,4 @@ LLVM_LIBC_FUNCTION(char *, getenv, (const char *name)) {
return nullptr;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/stdlib/getenv.h b/libc/src/stdlib/getenv.h
index a7eac3172de84f2..adb386b18ca81d1 100644
--- a/libc/src/stdlib/getenv.h
+++ b/libc/src/stdlib/getenv.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_STDLIB_GETENV_H
#define LLVM_LIBC_SRC_STDLIB_GETENV_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
char *getenv(const char *name);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_STDLIB_GETENV_H
diff --git a/libc/src/stdlib/gpu/abort.cpp b/libc/src/stdlib/gpu/abort.cpp
index 441e776efd2349e..f3b052be6d24db8 100644
--- a/libc/src/stdlib/gpu/abort.cpp
+++ b/libc/src/stdlib/gpu/abort.cpp
@@ -11,7 +11,7 @@
#include "src/stdlib/abort.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(void, abort, ()) {
// We want to first make sure the server is listening before we abort.
@@ -23,4 +23,4 @@ LLVM_LIBC_FUNCTION(void, abort, ()) {
gpu::end_program();
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/stdlib/gpu/free.cpp b/libc/src/stdlib/gpu/free.cpp
index 64b60384581f794..3a41e5febad0bba 100644
--- a/libc/src/stdlib/gpu/free.cpp
+++ b/libc/src/stdlib/gpu/free.cpp
@@ -10,7 +10,7 @@
#include "src/__support/RPC/rpc_client.h"
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(void, free, (void *ptr)) {
rpc::Client::Port port = rpc::client.open<RPC_FREE>();
@@ -20,4 +20,4 @@ LLVM_LIBC_FUNCTION(void, free, (void *ptr)) {
port.close();
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/stdlib/gpu/malloc.cpp b/libc/src/stdlib/gpu/malloc.cpp
index c63b8383f6b1631..a21969078305133 100644
--- a/libc/src/stdlib/gpu/malloc.cpp
+++ b/libc/src/stdlib/gpu/malloc.cpp
@@ -10,7 +10,7 @@
#include "src/__support/RPC/rpc_client.h"
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(void *, malloc, (size_t size)) {
void *ptr = nullptr;
@@ -23,4 +23,4 @@ LLVM_LIBC_FUNCTION(void *, malloc, (size_t size)) {
return ptr;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/stdlib/labs.cpp b/libc/src/stdlib/labs.cpp
index a32f3055c333253..d9237fad910c58e 100644
--- a/libc/src/stdlib/labs.cpp
+++ b/libc/src/stdlib/labs.cpp
@@ -10,8 +10,8 @@
#include "src/__support/common.h"
#include "src/__support/integer_operations.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(long, labs, (long n)) { return integer_abs(n); }
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/stdlib/labs.h b/libc/src/stdlib/labs.h
index 0f0ea99dc22a7cc..b7af538cd52c039 100644
--- a/libc/src/stdlib/labs.h
+++ b/libc/src/stdlib/labs.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_STDLIB_LABS_H
#define LLVM_LIBC_SRC_STDLIB_LABS_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
long labs(long n);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_STDLIB_LABS_H
diff --git a/libc/src/stdlib/ldiv.cpp b/libc/src/stdlib/ldiv.cpp
index b08dc65c7c7e23d..57e2250063375b6 100644
--- a/libc/src/stdlib/ldiv.cpp
+++ b/libc/src/stdlib/ldiv.cpp
@@ -10,7 +10,7 @@
#include "src/__support/common.h"
#include "src/__support/integer_operations.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(ldiv_t, ldiv, (long x, long y)) {
ldiv_t res;
@@ -18,4 +18,4 @@ LLVM_LIBC_FUNCTION(ldiv_t, ldiv, (long x, long y)) {
return res;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/stdlib/ldiv.h b/libc/src/stdlib/ldiv.h
index ab2fe0961b32ebf..0f0fafa7498b5ea 100644
--- a/libc/src/stdlib/ldiv.h
+++ b/libc/src/stdlib/ldiv.h
@@ -11,10 +11,10 @@
#include <stdlib.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
ldiv_t ldiv(long x, long y);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_STDLIB_LDIV_H
diff --git a/libc/src/stdlib/linux/abort.cpp b/libc/src/stdlib/linux/abort.cpp
index 1da81611273dea7..59feec3e5a06df3 100644
--- a/libc/src/stdlib/linux/abort.cpp
+++ b/libc/src/stdlib/linux/abort.cpp
@@ -12,7 +12,7 @@
#include "src/stdlib/abort.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(void, abort, ()) {
// TODO: When sigprocmask and sigaction land:
@@ -22,9 +22,9 @@ LLVM_LIBC_FUNCTION(void, abort, ()) {
// Acquire recursive mutex (in case the current signal handler for SIGABRT
// itself calls abort we don't want to deadlock on the same thread trying
// to acquire it's own mutex.)
- __llvm_libc::raise(SIGABRT);
- __llvm_libc::raise(SIGKILL);
- __llvm_libc::_Exit(127);
+ LIBC_NAMESPACE::raise(SIGABRT);
+ LIBC_NAMESPACE::raise(SIGKILL);
+ LIBC_NAMESPACE::_Exit(127);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/stdlib/llabs.cpp b/libc/src/stdlib/llabs.cpp
index a72f3625567d84e..f42c2b8a993dd08 100644
--- a/libc/src/stdlib/llabs.cpp
+++ b/libc/src/stdlib/llabs.cpp
@@ -10,8 +10,8 @@
#include "src/__support/common.h"
#include "src/__support/integer_operations.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(long long, llabs, (long long n)) { return integer_abs(n); }
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/stdlib/llabs.h b/libc/src/stdlib/llabs.h
index f173431a14f15c9..953fe1709c1a700 100644
--- a/libc/src/stdlib/llabs.h
+++ b/libc/src/stdlib/llabs.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_STDLIB_LLABS_H
#define LLVM_LIBC_SRC_STDLIB_LLABS_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
long long llabs(long long n);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_STDLIB_LLABS_H
diff --git a/libc/src/stdlib/lldiv.cpp b/libc/src/stdlib/lldiv.cpp
index ef3d037f1ded21e..ff2fdf8eff33ddd 100644
--- a/libc/src/stdlib/lldiv.cpp
+++ b/libc/src/stdlib/lldiv.cpp
@@ -10,7 +10,7 @@
#include "src/__support/common.h"
#include "src/__support/integer_operations.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(lldiv_t, lldiv, (long long x, long long y)) {
lldiv_t res;
@@ -18,4 +18,4 @@ LLVM_LIBC_FUNCTION(lldiv_t, lldiv, (long long x, long long y)) {
return res;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/stdlib/lldiv.h b/libc/src/stdlib/lldiv.h
index b361e4e1aaa3630..ee7f4d37c746932 100644
--- a/libc/src/stdlib/lldiv.h
+++ b/libc/src/stdlib/lldiv.h
@@ -10,10 +10,10 @@
#include <stdlib.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
lldiv_t lldiv(long long x, long long y);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_STDLIB_LLDIV_H
diff --git a/libc/src/stdlib/malloc.h b/libc/src/stdlib/malloc.h
index ecdf9c0145a9637..514e2b133c7b17a 100644
--- a/libc/src/stdlib/malloc.h
+++ b/libc/src/stdlib/malloc.h
@@ -11,10 +11,10 @@
#ifndef LLVM_LIBC_SRC_STDLIB_MALLOC_H
#define LLVM_LIBC_SRC_STDLIB_MALLOC_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
void *malloc(size_t size);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_STDLIB_MALLOC_H
diff --git a/libc/src/stdlib/qsort.cpp b/libc/src/stdlib/qsort.cpp
index 73cf5f894aacd46..f040f375ea59e73 100644
--- a/libc/src/stdlib/qsort.cpp
+++ b/libc/src/stdlib/qsort.cpp
@@ -12,7 +12,7 @@
#include <stdint.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(void, qsort,
(void *array, size_t array_size, size_t elem_size,
@@ -24,4 +24,4 @@ LLVM_LIBC_FUNCTION(void, qsort,
array_size, elem_size, c));
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/stdlib/qsort.h b/libc/src/stdlib/qsort.h
index d716089e484df25..5c78481ad701316 100644
--- a/libc/src/stdlib/qsort.h
+++ b/libc/src/stdlib/qsort.h
@@ -11,11 +11,11 @@
#include <stdlib.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
void qsort(void *array, size_t array_size, size_t elem_size,
int (*compare)(const void *, const void *));
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_STDLIB_QSORT_H
diff --git a/libc/src/stdlib/qsort_r.cpp b/libc/src/stdlib/qsort_r.cpp
index add030879655a36..758991848eff876 100644
--- a/libc/src/stdlib/qsort_r.cpp
+++ b/libc/src/stdlib/qsort_r.cpp
@@ -12,7 +12,7 @@
#include <stdint.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(void, qsort_r,
(void *array, size_t array_size, size_t elem_size,
@@ -25,4 +25,4 @@ LLVM_LIBC_FUNCTION(void, qsort_r,
array_size, elem_size, c));
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/stdlib/qsort_r.h b/libc/src/stdlib/qsort_r.h
index a998b0533936017..fab0576ed803f01 100644
--- a/libc/src/stdlib/qsort_r.h
+++ b/libc/src/stdlib/qsort_r.h
@@ -11,7 +11,7 @@
#include <stdlib.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
// This qsort_r uses the glibc argument ordering instead of the BSD argument
// ordering (which puts arg before the function pointer). Putting arg after the
@@ -21,6 +21,6 @@ namespace __llvm_libc {
void qsort_r(void *array, size_t array_size, size_t elem_size,
int (*compare)(const void *, const void *, void *), void *arg);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_STDLIB_QSORT_R_H
diff --git a/libc/src/stdlib/qsort_util.h b/libc/src/stdlib/qsort_util.h
index e9aefe448405f96..f4b8094d05a9a71 100644
--- a/libc/src/stdlib/qsort_util.h
+++ b/libc/src/stdlib/qsort_util.h
@@ -13,7 +13,7 @@
#include <stdint.h>
#include <stdlib.h>
-namespace __llvm_libc::internal {
+namespace LIBC_NAMESPACE::internal {
// A simple quicksort implementation using the Hoare partition scheme.
@@ -147,6 +147,6 @@ LIBC_INLINE void quicksort(const Array &array) {
quicksort(array.make_array(split_index, array.size() - split_index));
}
-} // namespace __llvm_libc::internal
+} // namespace LIBC_NAMESPACE::internal
#endif // LLVM_LIBC_SRC_STDLIB_QSORT_UTIL_H
diff --git a/libc/src/stdlib/rand.cpp b/libc/src/stdlib/rand.cpp
index 771944f8b336fb7..c5737a8b8454775 100644
--- a/libc/src/stdlib/rand.cpp
+++ b/libc/src/stdlib/rand.cpp
@@ -10,7 +10,7 @@
#include "src/__support/common.h"
#include "src/stdlib/rand_util.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
// An implementation of the xorshift64star pseudo random number generator. This
// is a good general purpose generator for most non-cryptographics applications.
@@ -21,4 +21,4 @@ LLVM_LIBC_FUNCTION(int, rand, (void)) {
return static_cast<int>((rand_next * 0x2545F4914F6CDD1Dul) >> 32) & RAND_MAX;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/stdlib/rand.h b/libc/src/stdlib/rand.h
index b421161f6388ff1..72bb147849851c3 100644
--- a/libc/src/stdlib/rand.h
+++ b/libc/src/stdlib/rand.h
@@ -11,10 +11,10 @@
#include <stdlib.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int rand(void);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_STDLIB_RAND_H
diff --git a/libc/src/stdlib/rand_util.cpp b/libc/src/stdlib/rand_util.cpp
index dac8dca2804e1c2..fc2cd304e77d297 100644
--- a/libc/src/stdlib/rand_util.cpp
+++ b/libc/src/stdlib/rand_util.cpp
@@ -9,10 +9,10 @@
#include "src/stdlib/rand_util.h"
#include "src/__support/macros/attributes.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
// C standard 7.10p2: If 'rand' is called before 'srand' it is to proceed as if
// the 'srand' function was called with a value of '1'.
LIBC_THREAD_LOCAL unsigned long rand_next = 1;
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/stdlib/rand_util.h b/libc/src/stdlib/rand_util.h
index 4cbfa1478ef7bb2..55c36a45bbc6b94 100644
--- a/libc/src/stdlib/rand_util.h
+++ b/libc/src/stdlib/rand_util.h
@@ -11,10 +11,10 @@
#include "src/__support/macros/attributes.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
extern LIBC_THREAD_LOCAL unsigned long rand_next;
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_STDLIB_RAND_UTIL_H
diff --git a/libc/src/stdlib/srand.cpp b/libc/src/stdlib/srand.cpp
index d93d86712ecd10b..008c7a9e565e41b 100644
--- a/libc/src/stdlib/srand.cpp
+++ b/libc/src/stdlib/srand.cpp
@@ -10,8 +10,8 @@
#include "src/__support/common.h"
#include "src/stdlib/rand_util.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(void, srand, (unsigned int seed)) { rand_next = seed; }
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/stdlib/srand.h b/libc/src/stdlib/srand.h
index ff2f138ea222235..1bcf8de78c0a4f6 100644
--- a/libc/src/stdlib/srand.h
+++ b/libc/src/stdlib/srand.h
@@ -11,10 +11,10 @@
#include <stdlib.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
void srand(unsigned int seed);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_STDLIB_SRAND_H
diff --git a/libc/src/stdlib/strtod.cpp b/libc/src/stdlib/strtod.cpp
index eb3f290487c4ab5..db5e0edefb5b381 100644
--- a/libc/src/stdlib/strtod.cpp
+++ b/libc/src/stdlib/strtod.cpp
@@ -11,7 +11,7 @@
#include "src/__support/str_to_float.h"
#include "src/errno/libc_errno.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(double, strtod,
(const char *__restrict str, char **__restrict str_end)) {
@@ -25,4 +25,4 @@ LLVM_LIBC_FUNCTION(double, strtod,
return result.value;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/stdlib/strtod.h b/libc/src/stdlib/strtod.h
index 1a8b9dcc95b9990..5efad845fdee34b 100644
--- a/libc/src/stdlib/strtod.h
+++ b/libc/src/stdlib/strtod.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_STDLIB_STRTOD_H
#define LLVM_LIBC_SRC_STDLIB_STRTOD_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
double strtod(const char *__restrict str, char **__restrict str_end);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_STDLIB_STRTOD_H
diff --git a/libc/src/stdlib/strtof.cpp b/libc/src/stdlib/strtof.cpp
index f4b90e860c817ba..2cc8829f63d34cc 100644
--- a/libc/src/stdlib/strtof.cpp
+++ b/libc/src/stdlib/strtof.cpp
@@ -11,7 +11,7 @@
#include "src/__support/str_to_float.h"
#include "src/errno/libc_errno.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(float, strtof,
(const char *__restrict str, char **__restrict str_end)) {
@@ -25,4 +25,4 @@ LLVM_LIBC_FUNCTION(float, strtof,
return result.value;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/stdlib/strtof.h b/libc/src/stdlib/strtof.h
index 3ebbd1112483b0e..d800b2233cf8e59 100644
--- a/libc/src/stdlib/strtof.h
+++ b/libc/src/stdlib/strtof.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_STDLIB_STRTOF_H
#define LLVM_LIBC_SRC_STDLIB_STRTOF_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
float strtof(const char *__restrict str, char **__restrict str_end);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_STDLIB_STRTOF_H
diff --git a/libc/src/stdlib/strtol.cpp b/libc/src/stdlib/strtol.cpp
index fb02353d0938918..e9bedf237166823 100644
--- a/libc/src/stdlib/strtol.cpp
+++ b/libc/src/stdlib/strtol.cpp
@@ -11,7 +11,7 @@
#include "src/__support/str_to_integer.h"
#include "src/errno/libc_errno.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(long, strtol,
(const char *__restrict str, char **__restrict str_end,
@@ -26,4 +26,4 @@ LLVM_LIBC_FUNCTION(long, strtol,
return result;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/stdlib/strtol.h b/libc/src/stdlib/strtol.h
index 741c4e802814869..c46c650dc5b3ed9 100644
--- a/libc/src/stdlib/strtol.h
+++ b/libc/src/stdlib/strtol.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_STDLIB_STRTOL_H
#define LLVM_LIBC_SRC_STDLIB_STRTOL_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
long strtol(const char *__restrict str, char **__restrict str_end, int base);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_STDLIB_STRTOL_H
diff --git a/libc/src/stdlib/strtold.cpp b/libc/src/stdlib/strtold.cpp
index 01cbb7fc2147217..7378963f21b2403 100644
--- a/libc/src/stdlib/strtold.cpp
+++ b/libc/src/stdlib/strtold.cpp
@@ -11,7 +11,7 @@
#include "src/__support/str_to_float.h"
#include "src/errno/libc_errno.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(long double, strtold,
(const char *__restrict str, char **__restrict str_end)) {
@@ -25,4 +25,4 @@ LLVM_LIBC_FUNCTION(long double, strtold,
return result.value;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/stdlib/strtold.h b/libc/src/stdlib/strtold.h
index 47e8732068d45fa..6a0b5d450b58bdd 100644
--- a/libc/src/stdlib/strtold.h
+++ b/libc/src/stdlib/strtold.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_STDLIB_STRTOLD_H
#define LLVM_LIBC_SRC_STDLIB_STRTOLD_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
long double strtold(const char *__restrict str, char **__restrict str_end);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_STDLIB_STRTOLD_H
diff --git a/libc/src/stdlib/strtoll.cpp b/libc/src/stdlib/strtoll.cpp
index f4f9754f40df591..99e82056bcb5b7a 100644
--- a/libc/src/stdlib/strtoll.cpp
+++ b/libc/src/stdlib/strtoll.cpp
@@ -11,7 +11,7 @@
#include "src/__support/str_to_integer.h"
#include "src/errno/libc_errno.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(long long, strtoll,
(const char *__restrict str, char **__restrict str_end,
@@ -26,4 +26,4 @@ LLVM_LIBC_FUNCTION(long long, strtoll,
return result;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/stdlib/strtoll.h b/libc/src/stdlib/strtoll.h
index 63d7335b88dbea3..d699785bfd71045 100644
--- a/libc/src/stdlib/strtoll.h
+++ b/libc/src/stdlib/strtoll.h
@@ -9,11 +9,11 @@
#ifndef LLVM_LIBC_SRC_STDLIB_STRTOLL_H
#define LLVM_LIBC_SRC_STDLIB_STRTOLL_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
long long strtoll(const char *__restrict str, char **__restrict str_end,
int base);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_STDLIB_STRTOLL_H
diff --git a/libc/src/stdlib/strtoul.cpp b/libc/src/stdlib/strtoul.cpp
index c3b1b93c2fd5bcf..f50ed7ea2dc36fd 100644
--- a/libc/src/stdlib/strtoul.cpp
+++ b/libc/src/stdlib/strtoul.cpp
@@ -11,7 +11,7 @@
#include "src/__support/str_to_integer.h"
#include "src/errno/libc_errno.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(unsigned long, strtoul,
(const char *__restrict str, char **__restrict str_end,
@@ -26,4 +26,4 @@ LLVM_LIBC_FUNCTION(unsigned long, strtoul,
return result;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/stdlib/strtoul.h b/libc/src/stdlib/strtoul.h
index 6aee32f48f6e19d..af839928d1b0c39 100644
--- a/libc/src/stdlib/strtoul.h
+++ b/libc/src/stdlib/strtoul.h
@@ -9,11 +9,11 @@
#ifndef LLVM_LIBC_SRC_STDLIB_STRTOUL_H
#define LLVM_LIBC_SRC_STDLIB_STRTOUL_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
unsigned long strtoul(const char *__restrict str, char **__restrict str_end,
int base);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_STDLIB_STRTOUL_H
diff --git a/libc/src/stdlib/strtoull.cpp b/libc/src/stdlib/strtoull.cpp
index 9bf3d0b78c112c7..de3a0d04b2cb1c7 100644
--- a/libc/src/stdlib/strtoull.cpp
+++ b/libc/src/stdlib/strtoull.cpp
@@ -11,7 +11,7 @@
#include "src/__support/str_to_integer.h"
#include "src/errno/libc_errno.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(unsigned long long, strtoull,
(const char *__restrict str, char **__restrict str_end,
@@ -26,4 +26,4 @@ LLVM_LIBC_FUNCTION(unsigned long long, strtoull,
return result;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/stdlib/strtoull.h b/libc/src/stdlib/strtoull.h
index b64c7be1eb972ad..47ed1019834ce35 100644
--- a/libc/src/stdlib/strtoull.h
+++ b/libc/src/stdlib/strtoull.h
@@ -9,11 +9,11 @@
#ifndef LLVM_LIBC_SRC_STDLIB_STRTOULL_H
#define LLVM_LIBC_SRC_STDLIB_STRTOULL_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
unsigned long long strtoull(const char *__restrict str,
char **__restrict str_end, int base);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_STDLIB_STRTOULL_H
diff --git a/libc/src/string/allocating_string_utils.h b/libc/src/string/allocating_string_utils.h
index c373868deb42734..4112b7931d103bf 100644
--- a/libc/src/string/allocating_string_utils.h
+++ b/libc/src/string/allocating_string_utils.h
@@ -17,7 +17,7 @@
#include <stddef.h> // For size_t
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
namespace internal {
LIBC_INLINE cpp::optional<char *> strdup(const char *src) {
@@ -33,6 +33,6 @@ LIBC_INLINE cpp::optional<char *> strdup(const char *src) {
}
} // namespace internal
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_STRING_ALLOCATING_STRING_UTILS_H
diff --git a/libc/src/string/bcmp.cpp b/libc/src/string/bcmp.cpp
index 26ae302b10b865d..f18fa0c883eecdd 100644
--- a/libc/src/string/bcmp.cpp
+++ b/libc/src/string/bcmp.cpp
@@ -10,11 +10,11 @@
#include "src/__support/common.h"
#include "src/string/memory_utils/inline_bcmp.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, bcmp,
(const void *lhs, const void *rhs, size_t count)) {
return inline_bcmp(lhs, rhs, count);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/string/bcmp.h b/libc/src/string/bcmp.h
index 6503240319ed287..711aecf083501f4 100644
--- a/libc/src/string/bcmp.h
+++ b/libc/src/string/bcmp.h
@@ -11,10 +11,10 @@
#include <stddef.h> // size_t
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int bcmp(const void *lhs, const void *rhs, size_t count);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_STRING_BCMP_H
diff --git a/libc/src/string/bcopy.cpp b/libc/src/string/bcopy.cpp
index 758f01ae2bf75e4..9399d332dff7f47 100644
--- a/libc/src/string/bcopy.cpp
+++ b/libc/src/string/bcopy.cpp
@@ -10,10 +10,10 @@
#include "src/__support/common.h"
#include "src/string/memory_utils/inline_memmove.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(void, bcopy, (const void *src, void *dst, size_t count)) {
return inline_memmove(dst, src, count);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/string/bcopy.h b/libc/src/string/bcopy.h
index 12de749d4640dbb..ec4d8cde1c6cb97 100644
--- a/libc/src/string/bcopy.h
+++ b/libc/src/string/bcopy.h
@@ -11,10 +11,10 @@
#include <stddef.h> // size_t
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
void bcopy(const void *src, void *dest, size_t count);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_STRING_BCOPY_H
diff --git a/libc/src/string/bzero.cpp b/libc/src/string/bzero.cpp
index cb6da5628ec13c7..c833cd8c2116db0 100644
--- a/libc/src/string/bzero.cpp
+++ b/libc/src/string/bzero.cpp
@@ -10,10 +10,10 @@
#include "src/__support/common.h"
#include "src/string/memory_utils/inline_bzero.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(void, bzero, (void *ptr, size_t count)) {
inline_bzero(reinterpret_cast<char *>(ptr), count);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/string/bzero.h b/libc/src/string/bzero.h
index 064800bad29b55d..3f52fe2128052bc 100644
--- a/libc/src/string/bzero.h
+++ b/libc/src/string/bzero.h
@@ -11,10 +11,10 @@
#include <stddef.h> // size_t
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
void bzero(void *ptr, size_t count);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_STRING_BZERO_H
diff --git a/libc/src/string/index.cpp b/libc/src/string/index.cpp
index 0ea2f752e30c597..4b2a3527d0ad828 100644
--- a/libc/src/string/index.cpp
+++ b/libc/src/string/index.cpp
@@ -11,10 +11,10 @@
#include "src/__support/common.h"
#include "src/string/string_utils.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(char *, index, (const char *src, int c)) {
return internal::strchr_implementation(src, c);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/string/index.h b/libc/src/string/index.h
index 7b246109d46f96f..993f060b6ac86b0 100644
--- a/libc/src/string/index.h
+++ b/libc/src/string/index.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_STRING_INDEX_H
#define LLVM_LIBC_SRC_STRING_INDEX_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
char *index(const char *src, int c);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_STRING_INDEX_H
diff --git a/libc/src/string/memccpy.cpp b/libc/src/string/memccpy.cpp
index 989a24d0852c6c8..200384e9f619027 100644
--- a/libc/src/string/memccpy.cpp
+++ b/libc/src/string/memccpy.cpp
@@ -11,7 +11,7 @@
#include "src/__support/common.h"
#include <stddef.h> // For size_t.
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(void *, memccpy,
(void *__restrict dest, const void *__restrict src, int c,
@@ -32,4 +32,4 @@ LLVM_LIBC_FUNCTION(void *, memccpy,
return nullptr;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/string/memccpy.h b/libc/src/string/memccpy.h
index 38a80b1d6911567..ce12dfbddc28990 100644
--- a/libc/src/string/memccpy.h
+++ b/libc/src/string/memccpy.h
@@ -11,11 +11,11 @@
#include <stddef.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
void *memccpy(void *__restrict dest, const void *__restrict src, int c,
size_t count);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_STRING_MEMCCPY_H
diff --git a/libc/src/string/memchr.cpp b/libc/src/string/memchr.cpp
index a2a537680920d8d..918bdd957b41331 100644
--- a/libc/src/string/memchr.cpp
+++ b/libc/src/string/memchr.cpp
@@ -12,7 +12,7 @@
#include "src/__support/common.h"
#include <stddef.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
// TODO: Look at performance benefits of comparing words.
LLVM_LIBC_FUNCTION(void *, memchr, (const void *src, int c, size_t n)) {
@@ -21,4 +21,4 @@ LLVM_LIBC_FUNCTION(void *, memchr, (const void *src, int c, size_t n)) {
static_cast<unsigned char>(c), n);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/string/memchr.h b/libc/src/string/memchr.h
index 369475305236da4..b84c8317be55e45 100644
--- a/libc/src/string/memchr.h
+++ b/libc/src/string/memchr.h
@@ -11,10 +11,10 @@
#include <stddef.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
void *memchr(const void *src, int c, size_t n);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_STRING_MEMCHR_H
diff --git a/libc/src/string/memcmp.cpp b/libc/src/string/memcmp.cpp
index dca2ee803bd9e56..adfbc1eca326a94 100644
--- a/libc/src/string/memcmp.cpp
+++ b/libc/src/string/memcmp.cpp
@@ -11,11 +11,11 @@
#include <stddef.h> // size_t
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, memcmp,
(const void *lhs, const void *rhs, size_t count)) {
return inline_memcmp(lhs, rhs, count);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/string/memcmp.h b/libc/src/string/memcmp.h
index 1d79df5d459185c..f2c1dd3541cb214 100644
--- a/libc/src/string/memcmp.h
+++ b/libc/src/string/memcmp.h
@@ -11,10 +11,10 @@
#include <stddef.h> // size_t
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int memcmp(const void *lhs, const void *rhs, size_t count);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_STRING_MEMCMP_H
diff --git a/libc/src/string/memcpy.cpp b/libc/src/string/memcpy.cpp
index 5ec6176f7f7fb7d..e6cf978dc3bc6e3 100644
--- a/libc/src/string/memcpy.cpp
+++ b/libc/src/string/memcpy.cpp
@@ -10,7 +10,7 @@
#include "src/__support/common.h"
#include "src/string/memory_utils/inline_memcpy.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(void *, memcpy,
(void *__restrict dst, const void *__restrict src,
@@ -19,4 +19,4 @@ LLVM_LIBC_FUNCTION(void *, memcpy,
return dst;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/string/memcpy.h b/libc/src/string/memcpy.h
index f643f1de6294ef4..ea34a2d3d87548f 100644
--- a/libc/src/string/memcpy.h
+++ b/libc/src/string/memcpy.h
@@ -11,10 +11,10 @@
#include <stddef.h> // size_t
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
void *memcpy(void *__restrict, const void *__restrict, size_t);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_STRING_MEMCPY_H
diff --git a/libc/src/string/memmem.cpp b/libc/src/string/memmem.cpp
index af864985e1026cd..067ea2ef9e7e51d 100644
--- a/libc/src/string/memmem.cpp
+++ b/libc/src/string/memmem.cpp
@@ -10,7 +10,7 @@
#include "src/__support/common.h"
#include "src/string/memory_utils/inline_memmem.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(void *, memmem,
(const void *haystack, size_t haystack_len,
@@ -21,4 +21,4 @@ LLVM_LIBC_FUNCTION(void *, memmem,
return inline_memmem(haystack, haystack_len, needle, needle_len, comp);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/string/memmem.h b/libc/src/string/memmem.h
index 2809fd5c6cdf579..b1f84c8cf323459 100644
--- a/libc/src/string/memmem.h
+++ b/libc/src/string/memmem.h
@@ -11,11 +11,11 @@
#include <stddef.h> // For size_t
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
void *memmem(const void *haystack, size_t haystack_len, const void *needle,
size_t needle_len);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_STRING_MEMMEM_H
diff --git a/libc/src/string/memmove.cpp b/libc/src/string/memmove.cpp
index 9e75ef77eff240f..7d473afc0b42ee7 100644
--- a/libc/src/string/memmove.cpp
+++ b/libc/src/string/memmove.cpp
@@ -11,7 +11,7 @@
#include "src/string/memory_utils/inline_memmove.h"
#include <stddef.h> // size_t
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(void *, memmove,
(void *dst, const void *src, size_t count)) {
@@ -22,4 +22,4 @@ LLVM_LIBC_FUNCTION(void *, memmove,
return dst;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/string/memmove.h b/libc/src/string/memmove.h
index 2f03a127f5a9481..4d78aadbd6620c7 100644
--- a/libc/src/string/memmove.h
+++ b/libc/src/string/memmove.h
@@ -11,10 +11,10 @@
#include <stddef.h> // size_t
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
void *memmove(void *dst, const void *src, size_t count);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_STRING_MEMMOVE_H
diff --git a/libc/src/string/memory_utils/aarch64/inline_bcmp.h b/libc/src/string/memory_utils/aarch64/inline_bcmp.h
index e2e8cb19f66353d..8e0827f1361fe40 100644
--- a/libc/src/string/memory_utils/aarch64/inline_bcmp.h
+++ b/libc/src/string/memory_utils/aarch64/inline_bcmp.h
@@ -16,7 +16,7 @@
#include <stddef.h> // size_t
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
[[maybe_unused]] LIBC_INLINE BcmpReturnType inline_bcmp_aarch64(CPtr p1,
CPtr p2,
@@ -65,6 +65,6 @@ namespace __llvm_libc {
return aarch64::Bcmp<32>::loop_and_tail(p1, p2, count);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LIBC_SRC_STRING_MEMORY_UTILS_AARCH64_INLINE_BCMP_H
diff --git a/libc/src/string/memory_utils/aarch64/inline_memcmp.h b/libc/src/string/memory_utils/aarch64/inline_memcmp.h
index 174e812c64878fa..839c8ec13854f25 100644
--- a/libc/src/string/memory_utils/aarch64/inline_memcmp.h
+++ b/libc/src/string/memory_utils/aarch64/inline_memcmp.h
@@ -14,7 +14,7 @@
#include "src/string/memory_utils/op_generic.h"
#include "src/string/memory_utils/utils.h" // MemcmpReturnType
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
[[maybe_unused]] LIBC_INLINE MemcmpReturnType
inline_memcmp_generic_gt16(CPtr p1, CPtr p2, size_t count) {
@@ -66,6 +66,6 @@ LIBC_INLINE MemcmpReturnType inline_memcmp_aarch64(CPtr p1, CPtr p2,
else
return inline_memcmp_generic_gt16(p1, p2, count);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LIBC_SRC_STRING_MEMORY_UTILS_X86_64_INLINE_MEMCMP_H
diff --git a/libc/src/string/memory_utils/aarch64/inline_memcpy.h b/libc/src/string/memory_utils/aarch64/inline_memcpy.h
index 6ee2c2b20b732ed..0a159f476cd61c2 100644
--- a/libc/src/string/memory_utils/aarch64/inline_memcpy.h
+++ b/libc/src/string/memory_utils/aarch64/inline_memcpy.h
@@ -14,7 +14,7 @@
#include <stddef.h> // size_t
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
[[maybe_unused]] LIBC_INLINE void
inline_memcpy_aarch64(Ptr __restrict dst, CPtr __restrict src, size_t count) {
@@ -43,6 +43,6 @@ inline_memcpy_aarch64(Ptr __restrict dst, CPtr __restrict src, size_t count) {
return builtin::Memcpy<64>::loop_and_tail(dst, src, count);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LIBC_SRC_STRING_MEMORY_UTILS_AARCH64_INLINE_MEMCPY_H
diff --git a/libc/src/string/memory_utils/aarch64/inline_memmove.h b/libc/src/string/memory_utils/aarch64/inline_memmove.h
index 7c9fa41c1db0dea..ca28655c916820c 100644
--- a/libc/src/string/memory_utils/aarch64/inline_memmove.h
+++ b/libc/src/string/memory_utils/aarch64/inline_memmove.h
@@ -16,7 +16,7 @@
#include <stddef.h> // size_t
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LIBC_INLINE void inline_memmove_aarch64(Ptr dst, CPtr src, size_t count) {
static_assert(aarch64::kNeon, "aarch64 supports vector types");
@@ -48,6 +48,6 @@ LIBC_INLINE void inline_memmove_aarch64(Ptr dst, CPtr src, size_t count) {
}
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LIBC_SRC_STRING_MEMORY_UTILS_AARCH64_INLINE_MEMMOVE_H
diff --git a/libc/src/string/memory_utils/aarch64/inline_memset.h b/libc/src/string/memory_utils/aarch64/inline_memset.h
index 6b73e5f4d617fdd..91512acce6fc078 100644
--- a/libc/src/string/memory_utils/aarch64/inline_memset.h
+++ b/libc/src/string/memory_utils/aarch64/inline_memset.h
@@ -15,7 +15,7 @@
#include <stddef.h> // size_t
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
[[maybe_unused]] LIBC_INLINE static void
inline_memset_aarch64(Ptr dst, uint8_t value, size_t count) {
@@ -56,6 +56,6 @@ inline_memset_aarch64(Ptr dst, uint8_t value, size_t count) {
}
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LIBC_SRC_STRING_MEMORY_UTILS_AARCH64_INLINE_MEMSET_H
diff --git a/libc/src/string/memory_utils/generic/aligned_access.h b/libc/src/string/memory_utils/generic/aligned_access.h
index 0a333d1fe866b80..4238167e54d644d 100644
--- a/libc/src/string/memory_utils/generic/aligned_access.h
+++ b/libc/src/string/memory_utils/generic/aligned_access.h
@@ -20,7 +20,7 @@
#include <stddef.h> // size_t
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
[[maybe_unused]] LIBC_INLINE uint32_t load32_aligned(CPtr ptr, size_t offset,
size_t alignment) {
@@ -200,6 +200,6 @@ inline_memcmp_aligned_access_64bit(CPtr p1, CPtr p2, size_t count) {
return inline_memcmp_byte_per_byte(p1, p2, count, offset);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_STRING_MEMORY_UTILS_GENERIC_ALIGNED_ACCESS_H
diff --git a/libc/src/string/memory_utils/generic/byte_per_byte.h b/libc/src/string/memory_utils/generic/byte_per_byte.h
index 023291158464afe..a666c5da3136041 100644
--- a/libc/src/string/memory_utils/generic/byte_per_byte.h
+++ b/libc/src/string/memory_utils/generic/byte_per_byte.h
@@ -18,7 +18,7 @@
#include <stddef.h> // size_t
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
[[maybe_unused]] LIBC_INLINE void
inline_memcpy_byte_per_byte(Ptr dst, CPtr src, size_t count,
@@ -73,6 +73,6 @@ inline_memcmp_byte_per_byte(CPtr p1, CPtr p2, size_t count, size_t offset = 0) {
return MemcmpReturnType::ZERO();
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_STRING_MEMORY_UTILS_GENERIC_BYTE_PER_BYTE_H
diff --git a/libc/src/string/memory_utils/inline_bcmp.h b/libc/src/string/memory_utils/inline_bcmp.h
index d931b4192133d44..b1c981d859e0223 100644
--- a/libc/src/string/memory_utils/inline_bcmp.h
+++ b/libc/src/string/memory_utils/inline_bcmp.h
@@ -30,14 +30,14 @@
#error "Unsupported architecture"
#endif
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LIBC_INLINE int inline_bcmp(const void *p1, const void *p2, size_t count) {
return static_cast<int>(LIBC_SRC_STRING_MEMORY_UTILS_BCMP(
reinterpret_cast<CPtr>(p1), reinterpret_cast<CPtr>(p2), count));
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#undef LIBC_SRC_STRING_MEMORY_UTILS_BCMP
diff --git a/libc/src/string/memory_utils/inline_bzero.h b/libc/src/string/memory_utils/inline_bzero.h
index af90aede1dea58e..ed83cab68b2fd11 100644
--- a/libc/src/string/memory_utils/inline_bzero.h
+++ b/libc/src/string/memory_utils/inline_bzero.h
@@ -14,7 +14,7 @@
#include <stddef.h> // size_t
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LIBC_INLINE static void inline_bzero(Ptr dst, size_t count) {
inline_memset(dst, 0, count);
@@ -24,6 +24,6 @@ LIBC_INLINE static void inline_bzero(void *dst, size_t count) {
inline_bzero(reinterpret_cast<Ptr>(dst), count);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_STRING_MEMORY_UTILS_INLINE_BZERO_H
diff --git a/libc/src/string/memory_utils/inline_memcmp.h b/libc/src/string/memory_utils/inline_memcmp.h
index 4182fbbf72cff47..d88d43691daee83 100644
--- a/libc/src/string/memory_utils/inline_memcmp.h
+++ b/libc/src/string/memory_utils/inline_memcmp.h
@@ -31,14 +31,14 @@
#error "Unsupported architecture"
#endif
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LIBC_INLINE int inline_memcmp(const void *p1, const void *p2, size_t count) {
return static_cast<int>(LIBC_SRC_STRING_MEMORY_UTILS_MEMCMP(
reinterpret_cast<CPtr>(p1), reinterpret_cast<CPtr>(p2), count));
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#undef LIBC_SRC_STRING_MEMORY_UTILS_MEMCMP
diff --git a/libc/src/string/memory_utils/inline_memcpy.h b/libc/src/string/memory_utils/inline_memcpy.h
index 55f861a8047be01..0b8a7848da87b4a 100644
--- a/libc/src/string/memory_utils/inline_memcpy.h
+++ b/libc/src/string/memory_utils/inline_memcpy.h
@@ -35,7 +35,7 @@
#error "Unsupported architecture"
#endif
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LIBC_INLINE void inline_memcpy(void *__restrict dst, const void *__restrict src,
size_t count) {
@@ -43,6 +43,6 @@ LIBC_INLINE void inline_memcpy(void *__restrict dst, const void *__restrict src,
reinterpret_cast<CPtr>(src), count);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_STRING_MEMORY_UTILS_INLINE_MEMCPY_H
diff --git a/libc/src/string/memory_utils/inline_memmem.h b/libc/src/string/memory_utils/inline_memmem.h
index 9c09f945b65530b..eaddee57aef54f6 100644
--- a/libc/src/string/memory_utils/inline_memmem.h
+++ b/libc/src/string/memory_utils/inline_memmem.h
@@ -13,7 +13,7 @@
#include <stddef.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
template <typename Comp>
LIBC_INLINE constexpr static void *
@@ -39,6 +39,6 @@ inline_memmem(const void *haystack, size_t haystack_len, const void *needle,
return nullptr;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_STRING_MEMORY_UTILS_INLINE_MEMMEM_H
diff --git a/libc/src/string/memory_utils/inline_memmove.h b/libc/src/string/memory_utils/inline_memmove.h
index c520b6f4de0cdff..0d31e10eaff28ed 100644
--- a/libc/src/string/memory_utils/inline_memmove.h
+++ b/libc/src/string/memory_utils/inline_memmove.h
@@ -27,13 +27,13 @@
#error "Unsupported architecture"
#endif
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LIBC_INLINE void inline_memmove(void *dst, const void *src, size_t count) {
LIBC_SRC_STRING_MEMORY_UTILS_MEMMOVE(reinterpret_cast<Ptr>(dst),
reinterpret_cast<CPtr>(src), count);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif /* LLVM_LIBC_SRC_STRING_MEMORY_UTILS_INLINE_MEMMOVE_H */
diff --git a/libc/src/string/memory_utils/inline_memset.h b/libc/src/string/memory_utils/inline_memset.h
index 524224c110dd4b3..f20ae45fa753b44 100644
--- a/libc/src/string/memory_utils/inline_memset.h
+++ b/libc/src/string/memory_utils/inline_memset.h
@@ -31,13 +31,13 @@
#error "Unsupported architecture"
#endif
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LIBC_INLINE static void inline_memset(void *dst, uint8_t value, size_t count) {
LIBC_SRC_STRING_MEMORY_UTILS_MEMSET(reinterpret_cast<Ptr>(dst), value, count);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#undef LIBC_SRC_STRING_MEMORY_UTILS_MEMSET
diff --git a/libc/src/string/memory_utils/inline_strcmp.h b/libc/src/string/memory_utils/inline_strcmp.h
index ccb315d744b15bd..2bcd56ad3d6b0b1 100644
--- a/libc/src/string/memory_utils/inline_strcmp.h
+++ b/libc/src/string/memory_utils/inline_strcmp.h
@@ -11,7 +11,7 @@
#include <stddef.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
template <typename Comp>
LIBC_INLINE constexpr int inline_strcmp(const char *left, const char *right,
@@ -39,6 +39,6 @@ LIBC_INLINE constexpr int inline_strncmp(const char *left, const char *right,
*reinterpret_cast<const unsigned char *>(right));
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_STRING_MEMORY_UTILS_INLINE_STRCMP_H
diff --git a/libc/src/string/memory_utils/inline_strstr.h b/libc/src/string/memory_utils/inline_strstr.h
index f9bc6b583ecdf42..f0f8e2bbf896a71 100644
--- a/libc/src/string/memory_utils/inline_strstr.h
+++ b/libc/src/string/memory_utils/inline_strstr.h
@@ -13,7 +13,7 @@
#include "src/string/string_utils.h"
#include <stddef.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
template <typename Comp>
LIBC_INLINE constexpr char *inline_strstr(const char *haystack,
@@ -24,6 +24,6 @@ LIBC_INLINE constexpr char *inline_strstr(const char *haystack,
return static_cast<char *>(result);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_STRING_MEMORY_UTILS_INLINE_STRSTR_H
diff --git a/libc/src/string/memory_utils/op_aarch64.h b/libc/src/string/memory_utils/op_aarch64.h
index 29d3b822a4e2a5f..10de5bcfce85ae2 100644
--- a/libc/src/string/memory_utils/op_aarch64.h
+++ b/libc/src/string/memory_utils/op_aarch64.h
@@ -24,7 +24,7 @@
#include <arm_neon.h>
#endif //__ARM_NEON
-namespace __llvm_libc::aarch64 {
+namespace LIBC_NAMESPACE::aarch64 {
LIBC_INLINE_VAR constexpr bool kNeon = LLVM_LIBC_IS_DEFINED(__ARM_NEON);
@@ -169,9 +169,9 @@ template <size_t Size> struct Bcmp {
}
};
-} // namespace __llvm_libc::aarch64
+} // namespace LIBC_NAMESPACE::aarch64
-namespace __llvm_libc::generic {
+namespace LIBC_NAMESPACE::generic {
///////////////////////////////////////////////////////////////////////////////
// Specializations for uint16_t
@@ -263,7 +263,7 @@ LIBC_INLINE MemcmpReturnType cmp<uint8x16x2_t>(CPtr p1, CPtr p2,
}
return MemcmpReturnType::ZERO();
}
-} // namespace __llvm_libc::generic
+} // namespace LIBC_NAMESPACE::generic
#endif // LIBC_TARGET_ARCH_IS_AARCH64
diff --git a/libc/src/string/memory_utils/op_builtin.h b/libc/src/string/memory_utils/op_builtin.h
index 210ba6019200183..cfa58e43d74550d 100644
--- a/libc/src/string/memory_utils/op_builtin.h
+++ b/libc/src/string/memory_utils/op_builtin.h
@@ -17,7 +17,7 @@
#include "src/string/memory_utils/utils.h"
-namespace __llvm_libc::builtin {
+namespace LIBC_NAMESPACE::builtin {
///////////////////////////////////////////////////////////////////////////////
// Memcpy
@@ -153,6 +153,6 @@ template <size_t Size> struct Memcmp {
}
};
-} // namespace __llvm_libc::builtin
+} // namespace LIBC_NAMESPACE::builtin
#endif // LLVM_LIBC_SRC_STRING_MEMORY_UTILS_OP_BUILTIN_H
diff --git a/libc/src/string/memory_utils/op_generic.h b/libc/src/string/memory_utils/op_generic.h
index 999b7a6b5416783..fd71ca30e24b936 100644
--- a/libc/src/string/memory_utils/op_generic.h
+++ b/libc/src/string/memory_utils/op_generic.h
@@ -41,14 +41,14 @@ static_assert((UINTPTR_MAX == 4294967295U) ||
#define LLVM_LIBC_HAS_UINT64
#endif
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
// Compiler types using the vector attributes.
using generic_v128 = uint8_t __attribute__((__vector_size__(16)));
using generic_v256 = uint8_t __attribute__((__vector_size__(32)));
using generic_v512 = uint8_t __attribute__((__vector_size__(64)));
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
-namespace __llvm_libc::generic {
+namespace LIBC_NAMESPACE::generic {
// We accept three types of values as elements for generic operations:
// - scalar : unsigned integral types,
@@ -92,7 +92,7 @@ template <typename T> constexpr size_t array_size_v = array_size<T>::value;
template <typename T> T load(CPtr src) {
static_assert(is_element_type_v<T>);
if constexpr (is_scalar_v<T> || is_vector_v<T>) {
- return ::__llvm_libc::load<T>(src);
+ return ::LIBC_NAMESPACE::load<T>(src);
} else if constexpr (is_array_v<T>) {
using value_type = typename T::value_type;
T Value;
@@ -105,7 +105,7 @@ template <typename T> T load(CPtr src) {
template <typename T> void store(Ptr dst, T value) {
static_assert(is_element_type_v<T>);
if constexpr (is_scalar_v<T> || is_vector_v<T>) {
- ::__llvm_libc::store<T>(dst, value);
+ ::LIBC_NAMESPACE::store<T>(dst, value);
} else if constexpr (is_array_v<T>) {
using value_type = typename T::value_type;
for (size_t I = 0; I < array_size_v<T>; ++I)
@@ -319,7 +319,7 @@ template <typename T> struct Memmove {
// Making the offset explicit hints the compiler to use relevant addressing mode
// consistently.
template <typename T> LIBC_INLINE T load(CPtr ptr, size_t offset) {
- return ::__llvm_libc::load<T>(ptr + offset);
+ return ::LIBC_NAMESPACE::load<T>(ptr + offset);
}
// Same as above but also makes sure the loaded value is in big endian format.
@@ -564,6 +564,6 @@ LIBC_INLINE MemcmpReturnType cmp<uint8_t>(CPtr p1, CPtr p2, size_t offset) {
template <>
LIBC_INLINE MemcmpReturnType cmp_neq<uint8_t>(CPtr p1, CPtr p2, size_t offset);
-} // namespace __llvm_libc::generic
+} // namespace LIBC_NAMESPACE::generic
#endif // LLVM_LIBC_SRC_STRING_MEMORY_UTILS_OP_GENERIC_H
diff --git a/libc/src/string/memory_utils/op_riscv.h b/libc/src/string/memory_utils/op_riscv.h
index e164dfa35c002f0..313d55e644cb4b1 100644
--- a/libc/src/string/memory_utils/op_riscv.h
+++ b/libc/src/string/memory_utils/op_riscv.h
@@ -19,7 +19,7 @@
#include "src/__support/common.h"
#include "src/string/memory_utils/op_generic.h"
-namespace __llvm_libc::generic {
+namespace LIBC_NAMESPACE::generic {
///////////////////////////////////////////////////////////////////////////////
// Specializations for uint16_t
@@ -78,7 +78,7 @@ LIBC_INLINE MemcmpReturnType cmp_neq<uint64_t>(CPtr p1, CPtr p2,
return cmp_neq_uint64_t(a, b);
}
-} // namespace __llvm_libc::generic
+} // namespace LIBC_NAMESPACE::generic
#endif // LIBC_TARGET_ARCH_IS_ANY_RISCV
#endif // LLVM_LIBC_SRC_STRING_MEMORY_UTILS_OP_RISCV_H
diff --git a/libc/src/string/memory_utils/op_x86.h b/libc/src/string/memory_utils/op_x86.h
index 4c526dabf42ac71..1a20659c178cd1b 100644
--- a/libc/src/string/memory_utils/op_x86.h
+++ b/libc/src/string/memory_utils/op_x86.h
@@ -37,7 +37,7 @@
#define _mm_movemask_epi8(A) 0
#endif
-namespace __llvm_libc::x86 {
+namespace LIBC_NAMESPACE::x86 {
// A set of constants to check compile time features.
LIBC_INLINE_VAR constexpr bool kSse2 = LLVM_LIBC_IS_DEFINED(__SSE2__);
@@ -55,9 +55,9 @@ struct Memcpy {
}
};
-} // namespace __llvm_libc::x86
+} // namespace LIBC_NAMESPACE::x86
-namespace __llvm_libc::generic {
+namespace LIBC_NAMESPACE::generic {
///////////////////////////////////////////////////////////////////////////////
// Specializations for uint16_t
@@ -247,7 +247,7 @@ LIBC_INLINE MemcmpReturnType cmp_neq<__m512i>(CPtr p1, CPtr p2, size_t offset) {
}
#endif // __AVX512BW__
-} // namespace __llvm_libc::generic
+} // namespace LIBC_NAMESPACE::generic
#endif // LIBC_TARGET_ARCH_IS_X86_64
diff --git a/libc/src/string/memory_utils/riscv/inline_bcmp.h b/libc/src/string/memory_utils/riscv/inline_bcmp.h
index 7d14b335ef43aa5..d66f0a7b225e688 100644
--- a/libc/src/string/memory_utils/riscv/inline_bcmp.h
+++ b/libc/src/string/memory_utils/riscv/inline_bcmp.h
@@ -15,7 +15,7 @@
#include <stddef.h> // size_t
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
[[maybe_unused]] LIBC_INLINE BcmpReturnType inline_bcmp_riscv(CPtr p1, CPtr p2,
size_t count) {
@@ -28,6 +28,6 @@ namespace __llvm_libc {
#endif
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LIBC_SRC_STRING_MEMORY_UTILS_RISCV_INLINE_BCMP_H
diff --git a/libc/src/string/memory_utils/riscv/inline_memcmp.h b/libc/src/string/memory_utils/riscv/inline_memcmp.h
index 437a6b43bcf0c86..0b28ad92235c1b5 100644
--- a/libc/src/string/memory_utils/riscv/inline_memcmp.h
+++ b/libc/src/string/memory_utils/riscv/inline_memcmp.h
@@ -15,7 +15,7 @@
#include <stddef.h> // size_t
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
[[maybe_unused]] LIBC_INLINE MemcmpReturnType
inline_memcmp_riscv(CPtr p1, CPtr p2, size_t count) {
@@ -28,6 +28,6 @@ inline_memcmp_riscv(CPtr p1, CPtr p2, size_t count) {
#endif
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LIBC_SRC_STRING_MEMORY_UTILS_RISCV_INLINE_MEMCMP_H
diff --git a/libc/src/string/memory_utils/riscv/inline_memcpy.h b/libc/src/string/memory_utils/riscv/inline_memcpy.h
index c80277acf40a77e..05531c8b75972c3 100644
--- a/libc/src/string/memory_utils/riscv/inline_memcpy.h
+++ b/libc/src/string/memory_utils/riscv/inline_memcpy.h
@@ -15,7 +15,7 @@
#include <stddef.h> // size_t
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
[[maybe_unused]] LIBC_INLINE void
inline_memcpy_riscv(Ptr __restrict dst, CPtr __restrict src, size_t count) {
@@ -28,6 +28,6 @@ inline_memcpy_riscv(Ptr __restrict dst, CPtr __restrict src, size_t count) {
#endif
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LIBC_SRC_STRING_MEMORY_UTILS_RISCV_INLINE_MEMCPY_H
diff --git a/libc/src/string/memory_utils/riscv/inline_memmove.h b/libc/src/string/memory_utils/riscv/inline_memmove.h
index 9704157f4f99f05..1c26917a96d9d18 100644
--- a/libc/src/string/memory_utils/riscv/inline_memmove.h
+++ b/libc/src/string/memory_utils/riscv/inline_memmove.h
@@ -15,13 +15,13 @@
#include <stddef.h> // size_t
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
[[maybe_unused]] LIBC_INLINE void
inline_memmove_riscv(Ptr __restrict dst, CPtr __restrict src, size_t count) {
return inline_memmove_byte_per_byte(dst, src, count);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LIBC_SRC_STRING_MEMORY_UTILS_RISCV_INLINE_MEMMOVE_H
diff --git a/libc/src/string/memory_utils/riscv/inline_memset.h b/libc/src/string/memory_utils/riscv/inline_memset.h
index c64a70a99eb1519..b9b8a188aff670f 100644
--- a/libc/src/string/memory_utils/riscv/inline_memset.h
+++ b/libc/src/string/memory_utils/riscv/inline_memset.h
@@ -15,7 +15,7 @@
#include <stddef.h> // size_t
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LIBC_INLINE static void inline_memset_riscv(Ptr dst, uint8_t value,
size_t count) {
@@ -28,6 +28,6 @@ LIBC_INLINE static void inline_memset_riscv(Ptr dst, uint8_t value,
#endif
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LIBC_SRC_STRING_MEMORY_UTILS_RISCV_INLINE_MEMSET_H
diff --git a/libc/src/string/memory_utils/utils.h b/libc/src/string/memory_utils/utils.h
index 66749465ee2849b..c467ae712b638a2 100644
--- a/libc/src/string/memory_utils/utils.h
+++ b/libc/src/string/memory_utils/utils.h
@@ -20,7 +20,7 @@
#include <stddef.h> // size_t
#include <stdint.h> // intptr_t / uintptr_t / INT32_MAX / INT32_MIN
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
// Allows compile time error reporting in `if constexpr` branches.
template <bool flag = false>
@@ -372,6 +372,6 @@ template <size_t SIZE> struct AlignHelper {
uintptr_t offset_;
};
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_STRING_MEMORY_UTILS_UTILS_H
diff --git a/libc/src/string/memory_utils/x86_64/inline_bcmp.h b/libc/src/string/memory_utils/x86_64/inline_bcmp.h
index 96a22f7740a8c0e..31aff86e60598ec 100644
--- a/libc/src/string/memory_utils/x86_64/inline_bcmp.h
+++ b/libc/src/string/memory_utils/x86_64/inline_bcmp.h
@@ -15,7 +15,7 @@
#include <stddef.h> // size_t
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
[[maybe_unused]] LIBC_INLINE BcmpReturnType
inline_bcmp_generic_gt16(CPtr p1, CPtr p2, size_t count) {
@@ -88,6 +88,6 @@ inline_bcmp_x86_avx512bw_gt16(CPtr p1, CPtr p2, size_t count) {
#endif
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_STRING_MEMORY_UTILS_X86_64_INLINE_BCMP_H
diff --git a/libc/src/string/memory_utils/x86_64/inline_memcmp.h b/libc/src/string/memory_utils/x86_64/inline_memcmp.h
index 2569b4ddd63dd88..d5fa77cdbbcdc04 100644
--- a/libc/src/string/memory_utils/x86_64/inline_memcmp.h
+++ b/libc/src/string/memory_utils/x86_64/inline_memcmp.h
@@ -15,7 +15,7 @@
#include "src/string/memory_utils/op_x86.h"
#include "src/string/memory_utils/utils.h" // MemcmpReturnType
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
[[maybe_unused]] LIBC_INLINE MemcmpReturnType
inline_memcmp_generic_gt16(CPtr p1, CPtr p2, size_t count) {
@@ -89,6 +89,6 @@ LIBC_INLINE MemcmpReturnType inline_memcmp_x86(CPtr p1, CPtr p2, size_t count) {
#endif
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_STRING_MEMORY_UTILS_X86_64_INLINE_MEMCMP_H
diff --git a/libc/src/string/memory_utils/x86_64/inline_memcpy.h b/libc/src/string/memory_utils/x86_64/inline_memcpy.h
index 7d70a552354f463..f43230ffd8ad125 100644
--- a/libc/src/string/memory_utils/x86_64/inline_memcpy.h
+++ b/libc/src/string/memory_utils/x86_64/inline_memcpy.h
@@ -26,7 +26,7 @@
#error LLVM_LIBC_MEMCPY_X86_USE_REPMOVSB_FROM_SIZE is deprecated use LIBC_COPT_MEMCPY_X86_USE_REPMOVSB_FROM_SIZE=0 instead.
#endif // LLVM_LIBC_MEMCPY_X86_USE_REPMOVSB_FROM_SIZE
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
namespace x86 {
@@ -77,7 +77,7 @@ inline_memcpy_x86_avx_ge64(Ptr __restrict dst, CPtr __restrict src,
[[maybe_unused]] LIBC_INLINE void
inline_memcpy_x86_sse2_ge64_sw_prefetching(Ptr __restrict dst,
CPtr __restrict src, size_t count) {
- using namespace __llvm_libc::x86;
+ using namespace LIBC_NAMESPACE::x86;
prefetch_to_local_cache(src + kOneCacheline);
if (count < 128)
return builtin::Memcpy<64>::head_tail(dst, src, count);
@@ -118,7 +118,7 @@ inline_memcpy_x86_sse2_ge64_sw_prefetching(Ptr __restrict dst,
[[maybe_unused]] LIBC_INLINE void
inline_memcpy_x86_avx_ge64_sw_prefetching(Ptr __restrict dst,
CPtr __restrict src, size_t count) {
- using namespace __llvm_libc::x86;
+ using namespace LIBC_NAMESPACE::x86;
prefetch_to_local_cache(src + kOneCacheline);
if (count < 128)
return builtin::Memcpy<64>::head_tail(dst, src, count);
@@ -197,6 +197,6 @@ inline_memcpy_x86_maybe_interpose_repmovsb(Ptr __restrict dst,
}
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_STRING_MEMORY_UTILS_X86_64_INLINE_MEMCPY_H
diff --git a/libc/src/string/memory_utils/x86_64/inline_memmove.h b/libc/src/string/memory_utils/x86_64/inline_memmove.h
index 22a088823f9ce56..95ad07f75219581 100644
--- a/libc/src/string/memory_utils/x86_64/inline_memmove.h
+++ b/libc/src/string/memory_utils/x86_64/inline_memmove.h
@@ -16,7 +16,7 @@
#include <stddef.h> // size_t
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LIBC_INLINE void inline_memmove_x86(Ptr dst, CPtr src, size_t count) {
#if defined(__AVX512F__)
@@ -61,6 +61,6 @@ LIBC_INLINE void inline_memmove_x86(Ptr dst, CPtr src, size_t count) {
}
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_STRING_MEMORY_UTILS_X86_64_INLINE_MEMMOVE_H
diff --git a/libc/src/string/memory_utils/x86_64/inline_memset.h b/libc/src/string/memory_utils/x86_64/inline_memset.h
index 54ef33a0c3ade25..6436594856b0eaf 100644
--- a/libc/src/string/memory_utils/x86_64/inline_memset.h
+++ b/libc/src/string/memory_utils/x86_64/inline_memset.h
@@ -15,7 +15,7 @@
#include <stddef.h> // size_t
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
[[maybe_unused]] LIBC_INLINE static void
inline_memset_x86(Ptr dst, uint8_t value, size_t count) {
@@ -60,6 +60,6 @@ inline_memset_x86(Ptr dst, uint8_t value, size_t count) {
align_to_next_boundary<32>(dst, count);
return generic::Memset<uint256_t>::loop_and_tail(dst, value, count);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_STRING_MEMORY_UTILS_X86_64_INLINE_MEMSET_H
diff --git a/libc/src/string/mempcpy.cpp b/libc/src/string/mempcpy.cpp
index 535e029305f43d2..47cc3d634d44cee 100644
--- a/libc/src/string/mempcpy.cpp
+++ b/libc/src/string/mempcpy.cpp
@@ -12,7 +12,7 @@
#include "src/__support/common.h"
#include <stddef.h> // For size_t.
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(void *, mempcpy,
(void *__restrict dst, const void *__restrict src,
@@ -21,4 +21,4 @@ LLVM_LIBC_FUNCTION(void *, mempcpy,
return reinterpret_cast<char *>(dst) + count;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/string/mempcpy.h b/libc/src/string/mempcpy.h
index 6000761e177a8ad..317e0fc1d1f307c 100644
--- a/libc/src/string/mempcpy.h
+++ b/libc/src/string/mempcpy.h
@@ -11,10 +11,10 @@
#include <stddef.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
void *mempcpy(void *__restrict dest, const void *__restrict src, size_t count);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_STRING_MEMPCPY_H
diff --git a/libc/src/string/memrchr.cpp b/libc/src/string/memrchr.cpp
index 7efac04a63248cd..fad086809635f0f 100644
--- a/libc/src/string/memrchr.cpp
+++ b/libc/src/string/memrchr.cpp
@@ -10,7 +10,7 @@
#include "src/__support/common.h"
#include <stddef.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(void *, memrchr, (const void *src, int c, size_t n)) {
const unsigned char *str = reinterpret_cast<const unsigned char *>(src);
@@ -23,4 +23,4 @@ LLVM_LIBC_FUNCTION(void *, memrchr, (const void *src, int c, size_t n)) {
return nullptr;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/string/memrchr.h b/libc/src/string/memrchr.h
index 8f43577e331fe88..5c32d6a3ad5566b 100644
--- a/libc/src/string/memrchr.h
+++ b/libc/src/string/memrchr.h
@@ -11,10 +11,10 @@
#include <stddef.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
void *memrchr(const void *src, int c, size_t n);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_STRING_MEMRCHR_H
diff --git a/libc/src/string/memset.cpp b/libc/src/string/memset.cpp
index 3a339eca661320e..a94e353421968be 100644
--- a/libc/src/string/memset.cpp
+++ b/libc/src/string/memset.cpp
@@ -10,11 +10,11 @@
#include "src/__support/common.h"
#include "src/string/memory_utils/inline_memset.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(void *, memset, (void *dst, int value, size_t count)) {
inline_memset(dst, static_cast<uint8_t>(value), count);
return dst;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/string/memset.h b/libc/src/string/memset.h
index e38eb7d78a976b6..4c1ef9d91c71aa8 100644
--- a/libc/src/string/memset.h
+++ b/libc/src/string/memset.h
@@ -11,10 +11,10 @@
#include <stddef.h> // size_t
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
void *memset(void *ptr, int value, size_t count);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_STRING_MEMSET_H
diff --git a/libc/src/string/rindex.cpp b/libc/src/string/rindex.cpp
index 520a4dbeda20f43..2c7f8dc29ea8a73 100644
--- a/libc/src/string/rindex.cpp
+++ b/libc/src/string/rindex.cpp
@@ -11,10 +11,10 @@
#include "src/__support/common.h"
#include "src/string/string_utils.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(char *, rindex, (const char *src, int c)) {
return internal::strrchr_implementation(src, c);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/string/rindex.h b/libc/src/string/rindex.h
index 976d6bac93131c4..a2aad85bed913d1 100644
--- a/libc/src/string/rindex.h
+++ b/libc/src/string/rindex.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_STRING_RINDEX_H
#define LLVM_LIBC_SRC_STRING_RINDEX_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
char *rindex(const char *src, int c);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_STRING_RINDEX_H
diff --git a/libc/src/string/stpcpy.cpp b/libc/src/string/stpcpy.cpp
index 22de619ae2ae29a..bdaa6899302c050 100644
--- a/libc/src/string/stpcpy.cpp
+++ b/libc/src/string/stpcpy.cpp
@@ -12,17 +12,17 @@
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(char *, stpcpy,
(char *__restrict dest, const char *__restrict src)) {
size_t size = internal::string_length(src) + 1;
char *result =
- reinterpret_cast<char *>(__llvm_libc::mempcpy(dest, src, size));
+ reinterpret_cast<char *>(LIBC_NAMESPACE::mempcpy(dest, src, size));
if (result != nullptr)
return result - 1;
return nullptr;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/string/stpcpy.h b/libc/src/string/stpcpy.h
index 84d5738f0e2ba6b..4352f5b389a24c1 100644
--- a/libc/src/string/stpcpy.h
+++ b/libc/src/string/stpcpy.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_STRING_STPCPY_H
#define LLVM_LIBC_SRC_STRING_STPCPY_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
char *stpcpy(char *__restrict dest, const char *__restrict src);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_STRING_STPCPY_H
diff --git a/libc/src/string/stpncpy.cpp b/libc/src/string/stpncpy.cpp
index e03d560bf221ae8..436e131d068725e 100644
--- a/libc/src/string/stpncpy.cpp
+++ b/libc/src/string/stpncpy.cpp
@@ -11,7 +11,7 @@
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(char *, stpncpy,
(char *__restrict dest, const char *__restrict src,
@@ -26,4 +26,4 @@ LLVM_LIBC_FUNCTION(char *, stpncpy,
return dest + i;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/string/stpncpy.h b/libc/src/string/stpncpy.h
index 6320a290b1dd26d..5ecf65b027cab06 100644
--- a/libc/src/string/stpncpy.h
+++ b/libc/src/string/stpncpy.h
@@ -11,10 +11,10 @@
#include <stddef.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
char *stpncpy(char *__restrict dest, const char *__restrict src, size_t n);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_STRING_STPNCPY_H
diff --git a/libc/src/string/strcasecmp.cpp b/libc/src/string/strcasecmp.cpp
index ceb81ce2fdc26e3..87636ee369ebd3b 100644
--- a/libc/src/string/strcasecmp.cpp
+++ b/libc/src/string/strcasecmp.cpp
@@ -12,14 +12,14 @@
#include "src/__support/ctype_utils.h"
#include "src/string/memory_utils/inline_strcmp.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, strcasecmp, (const char *left, const char *right)) {
auto case_cmp = [](char a, char b) {
- return __llvm_libc::internal::tolower(a) -
- __llvm_libc::internal::tolower(b);
+ return LIBC_NAMESPACE::internal::tolower(a) -
+ LIBC_NAMESPACE::internal::tolower(b);
};
return inline_strcmp(left, right, case_cmp);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/string/strcasecmp.h b/libc/src/string/strcasecmp.h
index ce0a4e5b613cca9..97b1f930f322724 100644
--- a/libc/src/string/strcasecmp.h
+++ b/libc/src/string/strcasecmp.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_STRING_STRCASECMP_H
#define LLVM_LIBC_SRC_STRING_STRCASECMP_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int strcasecmp(const char *left, const char *right);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_STRING_STRCASECMP_H
diff --git a/libc/src/string/strcasestr.cpp b/libc/src/string/strcasestr.cpp
index 61aca70d1e018eb..3119ed49c56d48b 100644
--- a/libc/src/string/strcasestr.cpp
+++ b/libc/src/string/strcasestr.cpp
@@ -12,17 +12,17 @@
#include "src/__support/ctype_utils.h"
#include "src/string/memory_utils/inline_strstr.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
// TODO: This is a simple brute force implementation. This can be
// improved upon using well known string matching algorithms.
LLVM_LIBC_FUNCTION(char *, strcasestr,
(const char *haystack, const char *needle)) {
auto case_cmp = [](char a, char b) {
- return __llvm_libc::internal::tolower(a) -
- __llvm_libc::internal::tolower(b);
+ return LIBC_NAMESPACE::internal::tolower(a) -
+ LIBC_NAMESPACE::internal::tolower(b);
};
return inline_strstr(haystack, needle, case_cmp);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/string/strcasestr.h b/libc/src/string/strcasestr.h
index b69165471bfdc3c..9c8ad0fb82b2843 100644
--- a/libc/src/string/strcasestr.h
+++ b/libc/src/string/strcasestr.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_STRING_STRCASESTR_H
#define LLVM_LIBC_SRC_STRING_STRCASESTR_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
char *strcasestr(const char *needle, const char *haystack);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_STRING_STRCASESTR_H
diff --git a/libc/src/string/strcat.cpp b/libc/src/string/strcat.cpp
index 6af5e514c407dc3..6e1baa64e66ab20 100644
--- a/libc/src/string/strcat.cpp
+++ b/libc/src/string/strcat.cpp
@@ -12,15 +12,15 @@
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(char *, strcat,
(char *__restrict dest, const char *__restrict src)) {
size_t dest_length = internal::string_length(dest);
size_t src_length = internal::string_length(src);
- __llvm_libc::strcpy(dest + dest_length, src);
+ LIBC_NAMESPACE::strcpy(dest + dest_length, src);
dest[dest_length + src_length] = '\0';
return dest;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/string/strcat.h b/libc/src/string/strcat.h
index 20e966c675df1ce..3cf2e19e24fe900 100644
--- a/libc/src/string/strcat.h
+++ b/libc/src/string/strcat.h
@@ -11,10 +11,10 @@
#include <string.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
char *strcat(char *__restrict dest, const char *__restrict src);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_STRING_STRCAT_H
diff --git a/libc/src/string/strchr.cpp b/libc/src/string/strchr.cpp
index 3b804e94404ecc0..553197b22b2ee21 100644
--- a/libc/src/string/strchr.cpp
+++ b/libc/src/string/strchr.cpp
@@ -11,11 +11,11 @@
#include "src/__support/common.h"
#include "src/string/string_utils.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
// TODO: Look at performance benefits of comparing words.
LLVM_LIBC_FUNCTION(char *, strchr, (const char *src, int c)) {
return internal::strchr_implementation(src, c);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/string/strchr.h b/libc/src/string/strchr.h
index 6f106afaf695c12..bb6a9c07b89e174 100644
--- a/libc/src/string/strchr.h
+++ b/libc/src/string/strchr.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_STRING_STRCHR_H
#define LLVM_LIBC_SRC_STRING_STRCHR_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
char *strchr(const char *src, int c);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_STRING_STRCHR_H
diff --git a/libc/src/string/strchrnul.cpp b/libc/src/string/strchrnul.cpp
index d8dce65dca5277f..9b492a634a8ff63 100644
--- a/libc/src/string/strchrnul.cpp
+++ b/libc/src/string/strchrnul.cpp
@@ -11,10 +11,10 @@
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(char *, strchrnul, (const char *src, int c)) {
return internal::strchr_implementation<false>(src, c);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/string/strchrnul.h b/libc/src/string/strchrnul.h
index 2ba07ac0f2a72e5..b847b0bda103c90 100644
--- a/libc/src/string/strchrnul.h
+++ b/libc/src/string/strchrnul.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_STRING_STRCHRNUL_H
#define LLVM_LIBC_SRC_STRING_STRCHRNUL_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
char *strchrnul(const char *src, int c);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_STRING_STRCHRNUL_H
diff --git a/libc/src/string/strcmp.cpp b/libc/src/string/strcmp.cpp
index aca8874b00c6702..0b515b76fa85c55 100644
--- a/libc/src/string/strcmp.cpp
+++ b/libc/src/string/strcmp.cpp
@@ -11,11 +11,11 @@
#include "src/__support/common.h"
#include "src/string/memory_utils/inline_strcmp.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, strcmp, (const char *left, const char *right)) {
auto comp = [](char l, char r) -> int { return l - r; };
return inline_strcmp(left, right, comp);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/string/strcmp.h b/libc/src/string/strcmp.h
index a45f2d5ba8e5dc2..9fc6fdb9f27ba89 100644
--- a/libc/src/string/strcmp.h
+++ b/libc/src/string/strcmp.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_STRING_STRCMP_H
#define LLVM_LIBC_SRC_STRING_STRCMP_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int strcmp(const char *left, const char *right);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_STRING_STRCMP_H
diff --git a/libc/src/string/strcoll.cpp b/libc/src/string/strcoll.cpp
index d60a7a5d5915ae8..7280688bf3d9dc1 100644
--- a/libc/src/string/strcoll.cpp
+++ b/libc/src/string/strcoll.cpp
@@ -10,7 +10,7 @@
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
// TODO: Add support for locales.
LLVM_LIBC_FUNCTION(int, strcoll, (const char *left, const char *right)) {
@@ -19,4 +19,4 @@ LLVM_LIBC_FUNCTION(int, strcoll, (const char *left, const char *right)) {
return static_cast<int>(*left) - static_cast<int>(*right);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/string/strcoll.h b/libc/src/string/strcoll.h
index 5949ede61bd196f..d69b48a6642c312 100644
--- a/libc/src/string/strcoll.h
+++ b/libc/src/string/strcoll.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_STRING_STRCOLL_H
#define LLVM_LIBC_SRC_STRING_STRCOLL_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int strcoll(const char *left, const char *right);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_STRING_STRCOLL_H
diff --git a/libc/src/string/strcpy.cpp b/libc/src/string/strcpy.cpp
index cac4f6e63037e0b..4fbd1a38f6873e5 100644
--- a/libc/src/string/strcpy.cpp
+++ b/libc/src/string/strcpy.cpp
@@ -12,7 +12,7 @@
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(char *, strcpy,
(char *__restrict dest, const char *__restrict src)) {
@@ -21,4 +21,4 @@ LLVM_LIBC_FUNCTION(char *, strcpy,
return dest;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/string/strcpy.h b/libc/src/string/strcpy.h
index 2d2af21c7044950..11a26a6fa6effad 100644
--- a/libc/src/string/strcpy.h
+++ b/libc/src/string/strcpy.h
@@ -11,10 +11,10 @@
#include <string.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
char *strcpy(char *__restrict dest, const char *__restrict src);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_STRING_STRCPY_H
diff --git a/libc/src/string/strcspn.cpp b/libc/src/string/strcspn.cpp
index d4929c56a9b3aab..ed057c3796066fb 100644
--- a/libc/src/string/strcspn.cpp
+++ b/libc/src/string/strcspn.cpp
@@ -11,10 +11,10 @@
#include "src/__support/common.h"
#include "src/string/string_utils.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(size_t, strcspn, (const char *src, const char *segment)) {
return internal::complementary_span(src, segment);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/string/strcspn.h b/libc/src/string/strcspn.h
index 9674f4b6359b061..21098feb288b8ac 100644
--- a/libc/src/string/strcspn.h
+++ b/libc/src/string/strcspn.h
@@ -11,10 +11,10 @@
#include <stddef.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
size_t strcspn(const char *src, const char *segment);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_STRING_STRCSPN_H
diff --git a/libc/src/string/strdup.cpp b/libc/src/string/strdup.cpp
index cafa0cb69941326..3530a708c131bcd 100644
--- a/libc/src/string/strdup.cpp
+++ b/libc/src/string/strdup.cpp
@@ -15,7 +15,7 @@
#include <stdlib.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(char *, strdup, (const char *src)) {
auto dup = internal::strdup(src);
@@ -26,4 +26,4 @@ LLVM_LIBC_FUNCTION(char *, strdup, (const char *src)) {
return nullptr;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/string/strdup.h b/libc/src/string/strdup.h
index 8f83558db919f21..e33a24694bf17c7 100644
--- a/libc/src/string/strdup.h
+++ b/libc/src/string/strdup.h
@@ -11,10 +11,10 @@
#include <string.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
char *strdup(const char *src);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_STRING_STRDUP_H
diff --git a/libc/src/string/strerror.cpp b/libc/src/string/strerror.cpp
index 014a51a622fdea0..01cbbeb4d18f20d 100644
--- a/libc/src/string/strerror.cpp
+++ b/libc/src/string/strerror.cpp
@@ -10,10 +10,10 @@
#include "src/__support/StringUtil/error_to_string.h"
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(char *, strerror, (int err_num)) {
return const_cast<char *>(get_error_string(err_num).data());
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/string/strerror.h b/libc/src/string/strerror.h
index ce3366db529d3dc..36a1348a5c737ed 100644
--- a/libc/src/string/strerror.h
+++ b/libc/src/string/strerror.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_STRING_STRERROR_H
#define LLVM_LIBC_SRC_STRING_STRERROR_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
char *strerror(int err_num);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_STRING_STRERROR_H
diff --git a/libc/src/string/strerror_r.cpp b/libc/src/string/strerror_r.cpp
index efdc8d3723c4084..c514dbd740906f7 100644
--- a/libc/src/string/strerror_r.cpp
+++ b/libc/src/string/strerror_r.cpp
@@ -12,7 +12,7 @@
#include <stddef.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
// This is the gnu version of strerror_r. The XSI version may be added later.
LLVM_LIBC_FUNCTION(char *, strerror_r,
@@ -20,4 +20,4 @@ LLVM_LIBC_FUNCTION(char *, strerror_r,
return const_cast<char *>(get_error_string(err_num, {buf, buflen}).data());
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/string/strerror_r.h b/libc/src/string/strerror_r.h
index 18b361773be4502..63f595866b3b63e 100644
--- a/libc/src/string/strerror_r.h
+++ b/libc/src/string/strerror_r.h
@@ -11,10 +11,10 @@
#include <stddef.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
char *strerror_r(int err_num, char *buf, size_t buflen);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_STRING_STRERROR_R_H
diff --git a/libc/src/string/string_utils.h b/libc/src/string/string_utils.h
index e874e5f5f0a69ca..17efc125ea63a79 100644
--- a/libc/src/string/string_utils.h
+++ b/libc/src/string/string_utils.h
@@ -20,7 +20,7 @@
#include "src/string/memory_utils/inline_memcpy.h"
#include <stddef.h> // For size_t
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
namespace internal {
template <typename Word> LIBC_INLINE constexpr Word repeat_byte(Word byte) {
@@ -246,6 +246,6 @@ LIBC_INLINE constexpr static char *strrchr_implementation(const char *src,
}
} // namespace internal
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_STRING_STRING_UTILS_H
diff --git a/libc/src/string/strlcat.cpp b/libc/src/string/strlcat.cpp
index a718de7698838ef..2943f4f67b4f90a 100644
--- a/libc/src/string/strlcat.cpp
+++ b/libc/src/string/strlcat.cpp
@@ -11,7 +11,7 @@
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(size_t, strlcat,
(char *__restrict dst, const char *__restrict src,
@@ -24,4 +24,4 @@ LLVM_LIBC_FUNCTION(size_t, strlcat,
return first_len + internal::strlcpy(new_dst, src, size - first_len);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/string/strlcat.h b/libc/src/string/strlcat.h
index 7b073c67068266e..47f27e3ba5ac3ed 100644
--- a/libc/src/string/strlcat.h
+++ b/libc/src/string/strlcat.h
@@ -11,10 +11,10 @@
#include <string.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
size_t strlcat(char *__restrict dst, const char *__restrict src, size_t size);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_STRING_STRLCAT_H
diff --git a/libc/src/string/strlcpy.cpp b/libc/src/string/strlcpy.cpp
index fa1f10290e8ec06..9b296f2cdbb054a 100644
--- a/libc/src/string/strlcpy.cpp
+++ b/libc/src/string/strlcpy.cpp
@@ -11,7 +11,7 @@
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(size_t, strlcpy,
(char *__restrict dst, const char *__restrict src,
@@ -19,4 +19,4 @@ LLVM_LIBC_FUNCTION(size_t, strlcpy,
return internal::strlcpy(dst, src, size);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/string/strlcpy.h b/libc/src/string/strlcpy.h
index f1c8e917e9864af..0c18d856e53f0aa 100644
--- a/libc/src/string/strlcpy.h
+++ b/libc/src/string/strlcpy.h
@@ -11,10 +11,10 @@
#include <string.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
size_t strlcpy(char *__restrict dst, const char *__restrict src, size_t size);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_STRING_STRLCPY_H
diff --git a/libc/src/string/strlen.cpp b/libc/src/string/strlen.cpp
index c7b192bff2504e9..b903928f067f950 100644
--- a/libc/src/string/strlen.cpp
+++ b/libc/src/string/strlen.cpp
@@ -11,7 +11,7 @@
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
// TODO: investigate the performance of this function.
// There might be potential for compiler optimization.
@@ -19,4 +19,4 @@ LLVM_LIBC_FUNCTION(size_t, strlen, (const char *src)) {
return internal::string_length(src);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/string/strlen.h b/libc/src/string/strlen.h
index b3ad03f612d0aa9..4dfaf8e98cdd2c0 100644
--- a/libc/src/string/strlen.h
+++ b/libc/src/string/strlen.h
@@ -11,10 +11,10 @@
#include <string.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
size_t strlen(const char *src);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_STRING_STRLEN_H
diff --git a/libc/src/string/strncasecmp.cpp b/libc/src/string/strncasecmp.cpp
index 48445ccd317ba64..994fb258746a2f2 100644
--- a/libc/src/string/strncasecmp.cpp
+++ b/libc/src/string/strncasecmp.cpp
@@ -12,15 +12,15 @@
#include "src/__support/ctype_utils.h"
#include "src/string/memory_utils/inline_strcmp.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, strncasecmp,
(const char *left, const char *right, size_t n)) {
auto case_cmp = [](char a, char b) {
- return __llvm_libc::internal::tolower(a) -
- __llvm_libc::internal::tolower(b);
+ return LIBC_NAMESPACE::internal::tolower(a) -
+ LIBC_NAMESPACE::internal::tolower(b);
};
return inline_strncmp(left, right, n, case_cmp);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/string/strncasecmp.h b/libc/src/string/strncasecmp.h
index c596a7afa6242cd..eb1155070c6baaf 100644
--- a/libc/src/string/strncasecmp.h
+++ b/libc/src/string/strncasecmp.h
@@ -11,10 +11,10 @@
#include <stddef.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int strncasecmp(const char *left, const char *right, size_t n);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_STRING_STRNCASECMP_H
diff --git a/libc/src/string/strncat.cpp b/libc/src/string/strncat.cpp
index 06e69eacd355b0a..ca86d9c0a2e4115 100644
--- a/libc/src/string/strncat.cpp
+++ b/libc/src/string/strncat.cpp
@@ -12,7 +12,7 @@
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(char *, strncat,
(char *__restrict dest, const char *__restrict src,
@@ -20,9 +20,9 @@ LLVM_LIBC_FUNCTION(char *, strncat,
size_t src_length = internal::string_length(src);
size_t copy_amount = src_length > count ? count : src_length;
size_t dest_length = internal::string_length(dest);
- __llvm_libc::strncpy(dest + dest_length, src, copy_amount);
+ LIBC_NAMESPACE::strncpy(dest + dest_length, src, copy_amount);
dest[dest_length + copy_amount] = '\0';
return dest;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/string/strncat.h b/libc/src/string/strncat.h
index 9b2c70fca5788ab..f3d9706dc23e922 100644
--- a/libc/src/string/strncat.h
+++ b/libc/src/string/strncat.h
@@ -11,10 +11,10 @@
#include <string.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
char *strncat(char *__restrict dest, const char *__restrict src, size_t count);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_STRING_STRNCAT_H
diff --git a/libc/src/string/strncmp.cpp b/libc/src/string/strncmp.cpp
index 098f9e121568fbe..0d2a66879704c06 100644
--- a/libc/src/string/strncmp.cpp
+++ b/libc/src/string/strncmp.cpp
@@ -13,7 +13,7 @@
#include <stddef.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, strncmp,
(const char *left, const char *right, size_t n)) {
@@ -21,4 +21,4 @@ LLVM_LIBC_FUNCTION(int, strncmp,
return inline_strncmp(left, right, n, comp);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/string/strncmp.h b/libc/src/string/strncmp.h
index 056fe78e6c85c9e..adb270f5cd40c3e 100644
--- a/libc/src/string/strncmp.h
+++ b/libc/src/string/strncmp.h
@@ -11,10 +11,10 @@
#include <stddef.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int strncmp(const char *left, const char *right, size_t n);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_STRING_STRNCMP_H
diff --git a/libc/src/string/strncpy.cpp b/libc/src/string/strncpy.cpp
index 274950230f51515..1408e7f0902d442 100644
--- a/libc/src/string/strncpy.cpp
+++ b/libc/src/string/strncpy.cpp
@@ -11,7 +11,7 @@
#include "src/__support/common.h"
#include <stddef.h> // For size_t.
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(char *, strncpy,
(char *__restrict dest, const char *__restrict src,
@@ -26,4 +26,4 @@ LLVM_LIBC_FUNCTION(char *, strncpy,
return dest;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/string/strncpy.h b/libc/src/string/strncpy.h
index c419df990cd7810..3152fef0758c721 100644
--- a/libc/src/string/strncpy.h
+++ b/libc/src/string/strncpy.h
@@ -11,10 +11,10 @@
#include <stddef.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
char *strncpy(char *__restrict dest, const char *__restrict src, size_t n);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_STRING_STRNCPY_H
diff --git a/libc/src/string/strndup.cpp b/libc/src/string/strndup.cpp
index ca1c6ec406b3743..6648e22ab50e000 100644
--- a/libc/src/string/strndup.cpp
+++ b/libc/src/string/strndup.cpp
@@ -15,7 +15,7 @@
#include <stddef.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(char *, strndup, (const char *src, size_t size)) {
if (src == nullptr)
@@ -32,4 +32,4 @@ LLVM_LIBC_FUNCTION(char *, strndup, (const char *src, size_t size)) {
return dest;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/string/strndup.h b/libc/src/string/strndup.h
index 0a593a709aa972d..3e5c951f6c87a57 100644
--- a/libc/src/string/strndup.h
+++ b/libc/src/string/strndup.h
@@ -11,10 +11,10 @@
#include <string.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
char *strndup(const char *src, size_t size);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_STRING_STRNDUP_H
diff --git a/libc/src/string/strnlen.cpp b/libc/src/string/strnlen.cpp
index dc208b0ac66b550..8849fa0fdd9fad6 100644
--- a/libc/src/string/strnlen.cpp
+++ b/libc/src/string/strnlen.cpp
@@ -12,7 +12,7 @@
#include "src/__support/common.h"
#include <stddef.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(size_t, strnlen, (const char *src, size_t n)) {
const void *temp = internal::find_first_character(
@@ -20,4 +20,4 @@ LLVM_LIBC_FUNCTION(size_t, strnlen, (const char *src, size_t n)) {
return temp ? reinterpret_cast<const char *>(temp) - src : n;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/string/strnlen.h b/libc/src/string/strnlen.h
index 2d2ee9703d83da5..e18d21779d94c7d 100644
--- a/libc/src/string/strnlen.h
+++ b/libc/src/string/strnlen.h
@@ -11,10 +11,10 @@
#include <stddef.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
size_t strnlen(const char *src, size_t n);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_STRING_STRNLEN_H
diff --git a/libc/src/string/strpbrk.cpp b/libc/src/string/strpbrk.cpp
index fc2cadc275237ae..8bccda02418bc7b 100644
--- a/libc/src/string/strpbrk.cpp
+++ b/libc/src/string/strpbrk.cpp
@@ -11,11 +11,11 @@
#include "src/__support/common.h"
#include "src/string/string_utils.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(char *, strpbrk, (const char *src, const char *breakset)) {
src += internal::complementary_span(src, breakset);
return *src ? const_cast<char *>(src) : nullptr;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/string/strpbrk.h b/libc/src/string/strpbrk.h
index 823cd35e9e30e94..c744d09365ff4a3 100644
--- a/libc/src/string/strpbrk.h
+++ b/libc/src/string/strpbrk.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_STRING_STRPBRK_H
#define LLVM_LIBC_SRC_STRING_STRPBRK_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
char *strpbrk(const char *src, const char *breakset);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_STRING_STRPBRK_H
diff --git a/libc/src/string/strrchr.cpp b/libc/src/string/strrchr.cpp
index d821327a998d3c0..d51808b6dd83551 100644
--- a/libc/src/string/strrchr.cpp
+++ b/libc/src/string/strrchr.cpp
@@ -11,10 +11,10 @@
#include "src/__support/common.h"
#include "src/string/string_utils.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(char *, strrchr, (const char *src, int c)) {
return internal::strrchr_implementation(src, c);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/string/strrchr.h b/libc/src/string/strrchr.h
index 7b85929b290b7ef..d4280d85ae9b8fa 100644
--- a/libc/src/string/strrchr.h
+++ b/libc/src/string/strrchr.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_STRING_STRRCHR_H
#define LLVM_LIBC_SRC_STRING_STRRCHR_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
char *strrchr(const char *src, int c);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_STRING_STRRCHR_H
diff --git a/libc/src/string/strsep.cpp b/libc/src/string/strsep.cpp
index 5e6aef7ac008e0d..edd2cf07e20a450 100644
--- a/libc/src/string/strsep.cpp
+++ b/libc/src/string/strsep.cpp
@@ -10,7 +10,7 @@
#include "src/string/string_utils.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(char *, strsep, (char **stringp, const char *delim)) {
if (!*stringp)
@@ -18,4 +18,4 @@ LLVM_LIBC_FUNCTION(char *, strsep, (char **stringp, const char *delim)) {
return internal::string_token<false>(*stringp, delim, stringp);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/string/strsep.h b/libc/src/string/strsep.h
index 1b1f28ff9c87c38..48f55a899d7f336 100644
--- a/libc/src/string/strsep.h
+++ b/libc/src/string/strsep.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_STRING_STRSEP_H
#define LLVM_LIBC_SRC_STRING_STRSEP_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
char *strsep(char **stringp, const char *delim);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_STRING_STRSEP_H
diff --git a/libc/src/string/strsignal.cpp b/libc/src/string/strsignal.cpp
index bad69b6f5415e08..f6ca0bcdad8d2ba 100644
--- a/libc/src/string/strsignal.cpp
+++ b/libc/src/string/strsignal.cpp
@@ -11,10 +11,10 @@
#include "src/__support/StringUtil/signal_to_string.h"
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(char *, strsignal, (int sig_num)) {
return const_cast<char *>(get_signal_string(sig_num).data());
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/string/strsignal.h b/libc/src/string/strsignal.h
index 346f3960d3aa31d..bd3f87a201734cc 100644
--- a/libc/src/string/strsignal.h
+++ b/libc/src/string/strsignal.h
@@ -10,10 +10,10 @@
#ifndef LLVM_LIBC_SRC_STRING_STRSIGNAL_H
#define LLVM_LIBC_SRC_STRING_STRSIGNAL_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
char *strsignal(int sig_num);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_STRING_STRSIGNAL_H
diff --git a/libc/src/string/strspn.cpp b/libc/src/string/strspn.cpp
index 9580d1bc403e8df..b957f8ed7f1bda5 100644
--- a/libc/src/string/strspn.cpp
+++ b/libc/src/string/strspn.cpp
@@ -12,7 +12,7 @@
#include "src/__support/common.h"
#include <stddef.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(size_t, strspn, (const char *src, const char *segment)) {
const char *initial = src;
@@ -26,4 +26,4 @@ LLVM_LIBC_FUNCTION(size_t, strspn, (const char *src, const char *segment)) {
return src - initial;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/string/strspn.h b/libc/src/string/strspn.h
index 92321d10df93e6d..ddb6f388e95a22f 100644
--- a/libc/src/string/strspn.h
+++ b/libc/src/string/strspn.h
@@ -11,10 +11,10 @@
#include <stddef.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
size_t strspn(const char *src, const char *segment);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_STRING_STRSPN_H
diff --git a/libc/src/string/strstr.cpp b/libc/src/string/strstr.cpp
index 3a8267845244331..bfda75b2e591293 100644
--- a/libc/src/string/strstr.cpp
+++ b/libc/src/string/strstr.cpp
@@ -11,7 +11,7 @@
#include "src/__support/common.h"
#include "src/string/memory_utils/inline_strstr.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
// TODO: This is a simple brute force implementation. This can be
// improved upon using well known string matching algorithms.
@@ -20,4 +20,4 @@ LLVM_LIBC_FUNCTION(char *, strstr, (const char *haystack, const char *needle)) {
return inline_strstr(haystack, needle, comp);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/string/strstr.h b/libc/src/string/strstr.h
index 463ffb7494c9e5e..2501b005cf9faa3 100644
--- a/libc/src/string/strstr.h
+++ b/libc/src/string/strstr.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_STRING_STRSTR_H
#define LLVM_LIBC_SRC_STRING_STRSTR_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
char *strstr(const char *haystack, const char *needle);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_STRING_STRSTR_H
diff --git a/libc/src/string/strtok.cpp b/libc/src/string/strtok.cpp
index 281197e07971d51..e7d30349d3a9c9a 100644
--- a/libc/src/string/strtok.cpp
+++ b/libc/src/string/strtok.cpp
@@ -11,7 +11,7 @@
#include "src/__support/common.h"
#include "src/string/string_utils.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
static char *strtok_str = nullptr;
@@ -21,4 +21,4 @@ LLVM_LIBC_FUNCTION(char *, strtok,
return internal::string_token(src, delimiter_string, &strtok_str);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/string/strtok.h b/libc/src/string/strtok.h
index 33ac68184a3317a..8788f333c130651 100644
--- a/libc/src/string/strtok.h
+++ b/libc/src/string/strtok.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_STRING_STRTOK_H
#define LLVM_LIBC_SRC_STRING_STRTOK_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
char *strtok(char *__restrict src, const char *__restrict delimiter_string);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_STRING_STRTOK_H
diff --git a/libc/src/string/strtok_r.cpp b/libc/src/string/strtok_r.cpp
index d1cc675ead32b3f..e8847b617330e09 100644
--- a/libc/src/string/strtok_r.cpp
+++ b/libc/src/string/strtok_r.cpp
@@ -11,7 +11,7 @@
#include "src/__support/common.h"
#include "src/string/string_utils.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(char *, strtok_r,
(char *__restrict src,
@@ -20,4 +20,4 @@ LLVM_LIBC_FUNCTION(char *, strtok_r,
return internal::string_token(src, delimiter_string, saveptr);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/string/strtok_r.h b/libc/src/string/strtok_r.h
index f1aff3e3176a083..b3c7b3dec162a9e 100644
--- a/libc/src/string/strtok_r.h
+++ b/libc/src/string/strtok_r.h
@@ -9,11 +9,11 @@
#ifndef LLVM_LIBC_SRC_STRING_STRTOK_R_H
#define LLVM_LIBC_SRC_STRING_STRTOK_R_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
char *strtok_r(char *__restrict src, const char *__restrict delimiter_string,
char **__restrict saveptr);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_STRING_STRTOK_R_H
diff --git a/libc/src/string/strxfrm.cpp b/libc/src/string/strxfrm.cpp
index a37c220b3603848..b5eb76457f8586e 100644
--- a/libc/src/string/strxfrm.cpp
+++ b/libc/src/string/strxfrm.cpp
@@ -12,7 +12,7 @@
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
// TODO: Add support for locales.
LLVM_LIBC_FUNCTION(size_t, strxfrm,
@@ -24,4 +24,4 @@ LLVM_LIBC_FUNCTION(size_t, strxfrm,
return len;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/string/strxfrm.h b/libc/src/string/strxfrm.h
index 1ca1e731e9df187..8178931f42dc925 100644
--- a/libc/src/string/strxfrm.h
+++ b/libc/src/string/strxfrm.h
@@ -10,10 +10,10 @@
#define LLVM_LIBC_SRC_STRING_STRXFRM_H
#include <stddef.h> // For size_t
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
size_t strxfrm(char *__restrict dest, const char *__restrict src, size_t n);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_STRING_STRXFRM_H
diff --git a/libc/src/sys/mman/linux/madvise.cpp b/libc/src/sys/mman/linux/madvise.cpp
index af98e0bc86bf652..ff461c1d4cb48bb 100644
--- a/libc/src/sys/mman/linux/madvise.cpp
+++ b/libc/src/sys/mman/linux/madvise.cpp
@@ -14,12 +14,12 @@
#include "src/errno/libc_errno.h"
#include <sys/syscall.h> // For syscall numbers.
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
// This function is currently linux only. It has to be refactored suitably if
// madvise is to be supported on non-linux operating systems also.
LLVM_LIBC_FUNCTION(int, madvise, (void *addr, size_t size, int advice)) {
- int ret = __llvm_libc::syscall_impl<int>(
+ int ret = LIBC_NAMESPACE::syscall_impl<int>(
SYS_madvise, reinterpret_cast<long>(addr), size, advice);
// A negative return value indicates an error with the magnitude of the
@@ -32,4 +32,4 @@ LLVM_LIBC_FUNCTION(int, madvise, (void *addr, size_t size, int advice)) {
return 0;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/sys/mman/linux/mmap.cpp b/libc/src/sys/mman/linux/mmap.cpp
index dde11055ccbbe88..16111c66859f5e7 100644
--- a/libc/src/sys/mman/linux/mmap.cpp
+++ b/libc/src/sys/mman/linux/mmap.cpp
@@ -15,7 +15,7 @@
#include <linux/param.h> // For EXEC_PAGESIZE.
#include <sys/syscall.h> // For syscall numbers.
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
// This function is currently linux only. It has to be refactored suitably if
// mmap is to be supported on non-linux operating systems also.
@@ -40,8 +40,8 @@ LLVM_LIBC_FUNCTION(void *, mmap,
#endif
long ret =
- __llvm_libc::syscall_impl(syscall_number, reinterpret_cast<long>(addr),
- size, prot, flags, fd, offset);
+ LIBC_NAMESPACE::syscall_impl(syscall_number, reinterpret_cast<long>(addr),
+ size, prot, flags, fd, offset);
// The mmap/mmap2 syscalls return negative values on error. These negative
// values are actually the negative values of the error codes. So, fix them
@@ -60,4 +60,4 @@ LLVM_LIBC_FUNCTION(void *, mmap,
return reinterpret_cast<void *>(ret);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/sys/mman/linux/mprotect.cpp b/libc/src/sys/mman/linux/mprotect.cpp
index 360c19337b0e893..2e6f2a369c1d89c 100644
--- a/libc/src/sys/mman/linux/mprotect.cpp
+++ b/libc/src/sys/mman/linux/mprotect.cpp
@@ -14,12 +14,12 @@
#include "src/errno/libc_errno.h"
#include <sys/syscall.h> // For syscall numbers.
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
// This function is currently linux only. It has to be refactored suitably if
// mprotect is to be supported on non-linux operating systems also.
LLVM_LIBC_FUNCTION(int, mprotect, (void *addr, size_t size, int prot)) {
- int ret = __llvm_libc::syscall_impl<int>(
+ int ret = LIBC_NAMESPACE::syscall_impl<int>(
SYS_mprotect, reinterpret_cast<long>(addr), size, prot);
// A negative return value indicates an error with the magnitude of the
@@ -32,4 +32,4 @@ LLVM_LIBC_FUNCTION(int, mprotect, (void *addr, size_t size, int prot)) {
return 0;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/sys/mman/linux/munmap.cpp b/libc/src/sys/mman/linux/munmap.cpp
index cbc48688a5038cd..6412b4136c49e8c 100644
--- a/libc/src/sys/mman/linux/munmap.cpp
+++ b/libc/src/sys/mman/linux/munmap.cpp
@@ -14,13 +14,13 @@
#include "src/errno/libc_errno.h"
#include <sys/syscall.h> // For syscall numbers.
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
// This function is currently linux only. It has to be refactored suitably if
// mmap is to be supported on non-linux operating systems also.
LLVM_LIBC_FUNCTION(int, munmap, (void *addr, size_t size)) {
- int ret = __llvm_libc::syscall_impl<int>(SYS_munmap,
- reinterpret_cast<long>(addr), size);
+ int ret = LIBC_NAMESPACE::syscall_impl<int>(
+ SYS_munmap, reinterpret_cast<long>(addr), size);
// A negative return value indicates an error with the magnitude of the
// value being the error code.
@@ -32,4 +32,4 @@ LLVM_LIBC_FUNCTION(int, munmap, (void *addr, size_t size)) {
return 0;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/sys/mman/linux/posix_madvise.cpp b/libc/src/sys/mman/linux/posix_madvise.cpp
index 2f6a555779ed4a2..b7b4d352c1f8a33 100644
--- a/libc/src/sys/mman/linux/posix_madvise.cpp
+++ b/libc/src/sys/mman/linux/posix_madvise.cpp
@@ -13,7 +13,7 @@
#include <sys/syscall.h> // For syscall numbers.
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
// This function is currently linux only. It has to be refactored suitably if
// posix_madvise is to be supported on non-linux operating systems also.
@@ -23,9 +23,9 @@ LLVM_LIBC_FUNCTION(int, posix_madvise, (void *addr, size_t size, int advice)) {
if (advice == POSIX_MADV_DONTNEED) {
return 0;
}
- int ret = __llvm_libc::syscall_impl<int>(
+ int ret = LIBC_NAMESPACE::syscall_impl<int>(
SYS_madvise, reinterpret_cast<long>(addr), size, advice);
return ret < 0 ? -ret : 0;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/sys/mman/madvise.h b/libc/src/sys/mman/madvise.h
index 01470c53ee3ba26..59a03af79b5873b 100644
--- a/libc/src/sys/mman/madvise.h
+++ b/libc/src/sys/mman/madvise.h
@@ -11,10 +11,10 @@
#include <sys/mman.h> // For size_t and off_t
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int madvise(void *addr, size_t size, int advice);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_SYS_MMAN_MADVISE_H
diff --git a/libc/src/sys/mman/mmap.h b/libc/src/sys/mman/mmap.h
index 9f7fd8b9196b447..4425019c4ee1a10 100644
--- a/libc/src/sys/mman/mmap.h
+++ b/libc/src/sys/mman/mmap.h
@@ -11,10 +11,10 @@
#include <sys/mman.h> // For size_t and off_t
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
void *mmap(void *addr, size_t size, int prot, int flags, int fd, off_t offset);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_SYS_MMAN_MMAP_H
diff --git a/libc/src/sys/mman/mprotect.h b/libc/src/sys/mman/mprotect.h
index a8bca8433ca919a..2e59c7526b750b0 100644
--- a/libc/src/sys/mman/mprotect.h
+++ b/libc/src/sys/mman/mprotect.h
@@ -11,10 +11,10 @@
#include <sys/mman.h> // For size_t and off_t
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int mprotect(void *addr, size_t size, int prot);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_SYS_MMAN_MPROTECT_H
diff --git a/libc/src/sys/mman/munmap.h b/libc/src/sys/mman/munmap.h
index fa11d67823f620e..5d7c569043d1ad0 100644
--- a/libc/src/sys/mman/munmap.h
+++ b/libc/src/sys/mman/munmap.h
@@ -11,10 +11,10 @@
#include <sys/mman.h> // For size_t.
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int munmap(void *addr, size_t size);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_SYS_MMAN_MUNMAP_H
diff --git a/libc/src/sys/mman/posix_madvise.h b/libc/src/sys/mman/posix_madvise.h
index c13937be16907ac..b8a423bfa91914e 100644
--- a/libc/src/sys/mman/posix_madvise.h
+++ b/libc/src/sys/mman/posix_madvise.h
@@ -11,10 +11,10 @@
#include <sys/mman.h> // For size_t and off_t
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int posix_madvise(void *addr, size_t size, int advice);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_SYS_MMAN_POSIX_MADVISE_H
diff --git a/libc/src/sys/random/getrandom.h b/libc/src/sys/random/getrandom.h
index 32a2a64d6e510da..e1577d9bf1eaafa 100644
--- a/libc/src/sys/random/getrandom.h
+++ b/libc/src/sys/random/getrandom.h
@@ -11,10 +11,10 @@
#include <sys/random.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
ssize_t getrandom(void *buf, size_t buflen, unsigned int flags);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_SYS_RANDOM_GETRANDOM_H
diff --git a/libc/src/sys/random/linux/getrandom.cpp b/libc/src/sys/random/linux/getrandom.cpp
index 54fbc2880a5c41c..63038ad628a1044 100644
--- a/libc/src/sys/random/linux/getrandom.cpp
+++ b/libc/src/sys/random/linux/getrandom.cpp
@@ -14,12 +14,12 @@
#include "src/errno/libc_errno.h"
#include <sys/syscall.h> // For syscall numbers.
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(ssize_t, getrandom,
(void *buf, size_t buflen, unsigned int flags)) {
ssize_t ret =
- __llvm_libc::syscall_impl<ssize_t>(SYS_getrandom, buf, buflen, flags);
+ LIBC_NAMESPACE::syscall_impl<ssize_t>(SYS_getrandom, buf, buflen, flags);
if (ret < 0) {
libc_errno = static_cast<int>(-ret);
return -1;
@@ -27,4 +27,4 @@ LLVM_LIBC_FUNCTION(ssize_t, getrandom,
return ret;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/sys/resource/getrlimit.h b/libc/src/sys/resource/getrlimit.h
index 84c056efe467297..f473e82f933be57 100644
--- a/libc/src/sys/resource/getrlimit.h
+++ b/libc/src/sys/resource/getrlimit.h
@@ -11,10 +11,10 @@
#include <sys/resource.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int getrlimit(int resource, struct rlimit *lim);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_SYS_RESOURCE_GETRLIMIT_H
diff --git a/libc/src/sys/resource/linux/getrlimit.cpp b/libc/src/sys/resource/linux/getrlimit.cpp
index 62b154b18e8d792..4067beba6cd3039 100644
--- a/libc/src/sys/resource/linux/getrlimit.cpp
+++ b/libc/src/sys/resource/linux/getrlimit.cpp
@@ -15,11 +15,11 @@
#include <sys/resource.h> // For struct rlimit
#include <sys/syscall.h> // For syscall numbers.
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, getrlimit, (int res, struct rlimit *limits)) {
int ret =
- __llvm_libc::syscall_impl<int>(SYS_prlimit64, 0, res, nullptr, limits);
+ LIBC_NAMESPACE::syscall_impl<int>(SYS_prlimit64, 0, res, nullptr, limits);
if (ret < 0) {
libc_errno = -ret;
return -1;
@@ -27,4 +27,4 @@ LLVM_LIBC_FUNCTION(int, getrlimit, (int res, struct rlimit *limits)) {
return 0;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/sys/resource/linux/setrlimit.cpp b/libc/src/sys/resource/linux/setrlimit.cpp
index 6bbe50a49b3dd88..069276386234286 100644
--- a/libc/src/sys/resource/linux/setrlimit.cpp
+++ b/libc/src/sys/resource/linux/setrlimit.cpp
@@ -15,11 +15,11 @@
#include <sys/resource.h> // For struct rlimit
#include <sys/syscall.h> // For syscall numbers.
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, setrlimit, (int res, const struct rlimit *limits)) {
int ret =
- __llvm_libc::syscall_impl<int>(SYS_prlimit64, 0, res, limits, nullptr);
+ LIBC_NAMESPACE::syscall_impl<int>(SYS_prlimit64, 0, res, limits, nullptr);
if (ret < 0) {
libc_errno = -ret;
return -1;
@@ -27,4 +27,4 @@ LLVM_LIBC_FUNCTION(int, setrlimit, (int res, const struct rlimit *limits)) {
return 0;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/sys/resource/setrlimit.h b/libc/src/sys/resource/setrlimit.h
index e6dc00e35714b55..d881b599833d21c 100644
--- a/libc/src/sys/resource/setrlimit.h
+++ b/libc/src/sys/resource/setrlimit.h
@@ -11,10 +11,10 @@
#include <sys/resource.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int setrlimit(int resource, const struct rlimit *lim);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_SYS_RESOURCE_SETRLIMIT_H
diff --git a/libc/src/sys/select/linux/select.cpp b/libc/src/sys/select/linux/select.cpp
index 5850c9418d822a0..3f387c14ec5601e 100644
--- a/libc/src/sys/select/linux/select.cpp
+++ b/libc/src/sys/select/linux/select.cpp
@@ -18,7 +18,7 @@
#include <sys/select.h>
#include <sys/syscall.h> // For syscall numbers.
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
struct pselect6_sigset_t {
sigset_t *ss;
@@ -54,11 +54,11 @@ LLVM_LIBC_FUNCTION(int, select,
}
pselect6_sigset_t pss{nullptr, sizeof(sigset_t)};
#if SYS_pselect6
- int ret = __llvm_libc::syscall_impl<int>(SYS_pselect6, nfds, read_set,
- write_set, error_set, &ts, &pss);
+ int ret = LIBC_NAMESPACE::syscall_impl<int>(SYS_pselect6, nfds, read_set,
+ write_set, error_set, &ts, &pss);
#elif defined(SYS_pselect6_time64)
- int ret = __llvm_libc::syscall_impl<int>(SYS_pselect6_time64, nfds, read_set,
- write_set, error_set, &ts, &pss);
+ int ret = LIBC_NAMESPACE::syscall_impl<int>(
+ SYS_pselect6_time64, nfds, read_set, write_set, error_set, &ts, &pss);
#else
#error "SYS_pselect6 and SYS_pselect6_time64 syscalls not available."
#endif
@@ -69,4 +69,4 @@ LLVM_LIBC_FUNCTION(int, select,
return ret;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/sys/select/select.h b/libc/src/sys/select/select.h
index ca81c0bbd5d7465..65cd15cd365c42c 100644
--- a/libc/src/sys/select/select.h
+++ b/libc/src/sys/select/select.h
@@ -11,11 +11,11 @@
#include <sys/select.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int select(int nfds, fd_set *__restrict read_set, fd_set *__restrict write_set,
fd_set *__restrict error_set, struct timeval *__restrict timeout);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_SYS_SELECT_SELECT_H
diff --git a/libc/src/sys/sendfile/linux/sendfile.cpp b/libc/src/sys/sendfile/linux/sendfile.cpp
index 43ddf813e157fee..5a7c012fe997d8b 100644
--- a/libc/src/sys/sendfile/linux/sendfile.cpp
+++ b/libc/src/sys/sendfile/linux/sendfile.cpp
@@ -15,18 +15,18 @@
#include <sys/sendfile.h>
#include <sys/syscall.h> // For syscall numbers.
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(ssize_t, sendfile,
(int out_fd, int in_fd, off_t *offset, size_t count)) {
#ifdef SYS_sendfile
- ssize_t ret = __llvm_libc::syscall_impl<ssize_t>(SYS_sendfile, in_fd, out_fd,
- offset, count);
+ ssize_t ret = LIBC_NAMESPACE::syscall_impl<ssize_t>(SYS_sendfile, in_fd,
+ out_fd, offset, count);
#elif defined(SYS_sendfile64)
// Same as sendfile but can handle large offsets
static_assert(sizeof(off_t) == 8);
- ssize_t ret = __llvm_libc::syscall_impl<ssize_t>(SYS_sendfile64, in_fd,
- out_fd, offset, count);
+ ssize_t ret = LIBC_NAMESPACE::syscall_impl<ssize_t>(SYS_sendfile64, in_fd,
+ out_fd, offset, count);
#else
#error "sendfile and sendfile64 syscalls not available."
#endif
@@ -37,4 +37,4 @@ LLVM_LIBC_FUNCTION(ssize_t, sendfile,
return ret;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/sys/sendfile/sendfile.h b/libc/src/sys/sendfile/sendfile.h
index ba9bf97e3af0a29..14673bba3fbdfa9 100644
--- a/libc/src/sys/sendfile/sendfile.h
+++ b/libc/src/sys/sendfile/sendfile.h
@@ -11,10 +11,10 @@
#include <sys/sendfile.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
ssize_t sendfile(int, int, off_t *, size_t);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_SYS_SENDFILE_SENDFILE_H
diff --git a/libc/src/sys/socket/linux/socket.cpp b/libc/src/sys/socket/linux/socket.cpp
index 7f87450f152fc71..6429fd12013ea04 100644
--- a/libc/src/sys/socket/linux/socket.cpp
+++ b/libc/src/sys/socket/linux/socket.cpp
@@ -16,15 +16,16 @@
#include <linux/net.h> // For SYS_SOCKET socketcall number.
#include <sys/syscall.h> // For syscall numbers.
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, socket, (int domain, int type, int protocol)) {
#ifdef SYS_socket
- int ret = __llvm_libc::syscall_impl<int>(SYS_socket, domain, type, protocol);
+ int ret =
+ LIBC_NAMESPACE::syscall_impl<int>(SYS_socket, domain, type, protocol);
#elif defined(SYS_socketcall)
unsigned long sockcall_args[3] = {domain, type, protocol};
- int ret =
- __llvm_libc::syscall_impl<int>(SYS_socketcall, SYS_SOCKET, sockcall_args);
+ int ret = LIBC_NAMESPACE::syscall_impl<int>(SYS_socketcall, SYS_SOCKET,
+ sockcall_args);
#else
#error "socket and socketcall syscalls unavailable for this platform."
#endif
@@ -35,4 +36,4 @@ LLVM_LIBC_FUNCTION(int, socket, (int domain, int type, int protocol)) {
return ret;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/sys/socket/socket.h b/libc/src/sys/socket/socket.h
index b18aa7f388d83f3..a6578989d2af8d2 100644
--- a/libc/src/sys/socket/socket.h
+++ b/libc/src/sys/socket/socket.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_SYS_SOCKET_SOCKET_H
#define LLVM_LIBC_SRC_SYS_SOCKET_SOCKET_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int socket(int domain, int type, int protocol);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_SYS_SOCKET_SOCKET_H
diff --git a/libc/src/sys/stat/chmod.h b/libc/src/sys/stat/chmod.h
index bfeaa9dbd721eb8..decb44222177b0b 100644
--- a/libc/src/sys/stat/chmod.h
+++ b/libc/src/sys/stat/chmod.h
@@ -11,10 +11,10 @@
#include <sys/stat.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int chmod(const char *path, mode_t mode);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_SYS_STAT_CHMOD_H
diff --git a/libc/src/sys/stat/fchmod.h b/libc/src/sys/stat/fchmod.h
index 34c167067c08a97..611bba16fad6cc8 100644
--- a/libc/src/sys/stat/fchmod.h
+++ b/libc/src/sys/stat/fchmod.h
@@ -11,10 +11,10 @@
#include <sys/stat.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int fchmod(int fd, mode_t mode);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_SYS_STAT_FCHMOD_H
diff --git a/libc/src/sys/stat/fchmodat.h b/libc/src/sys/stat/fchmodat.h
index 3ad9af1b185adb1..e7b12693558d438 100644
--- a/libc/src/sys/stat/fchmodat.h
+++ b/libc/src/sys/stat/fchmodat.h
@@ -11,10 +11,10 @@
#include <sys/stat.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int fchmodat(int dirfd, const char *path, mode_t mode, int flags);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_SYS_STAT_FCHMODAT_H
diff --git a/libc/src/sys/stat/fstat.h b/libc/src/sys/stat/fstat.h
index ec559a6bf225bd2..7633ee60a374e3b 100644
--- a/libc/src/sys/stat/fstat.h
+++ b/libc/src/sys/stat/fstat.h
@@ -11,10 +11,10 @@
#include <sys/stat.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int fstat(int fd, struct stat *statbuf);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_SYS_STAT_FSTAT_H
diff --git a/libc/src/sys/stat/linux/chmod.cpp b/libc/src/sys/stat/linux/chmod.cpp
index 9123ea549a8e339..085b91691d89f47 100644
--- a/libc/src/sys/stat/linux/chmod.cpp
+++ b/libc/src/sys/stat/linux/chmod.cpp
@@ -16,13 +16,14 @@
#include <sys/stat.h>
#include <sys/syscall.h> // For syscall numbers.
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, chmod, (const char *path, mode_t mode)) {
#ifdef SYS_chmod
- int ret = __llvm_libc::syscall_impl<int>(SYS_chmod, path, mode);
+ int ret = LIBC_NAMESPACE::syscall_impl<int>(SYS_chmod, path, mode);
#elif defined(SYS_fchmodat)
- int ret = __llvm_libc::syscall_impl<int>(SYS_fchmodat, AT_FDCWD, path, mode);
+ int ret =
+ LIBC_NAMESPACE::syscall_impl<int>(SYS_fchmodat, AT_FDCWD, path, mode);
#else
#error "chmod and fchmodat syscalls not available."
#endif
@@ -34,4 +35,4 @@ LLVM_LIBC_FUNCTION(int, chmod, (const char *path, mode_t mode)) {
return 0;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/sys/stat/linux/fchmod.cpp b/libc/src/sys/stat/linux/fchmod.cpp
index fa9d857c4e00ee4..cdc9cbf37ba5449 100644
--- a/libc/src/sys/stat/linux/fchmod.cpp
+++ b/libc/src/sys/stat/linux/fchmod.cpp
@@ -16,10 +16,10 @@
#include <sys/stat.h>
#include <sys/syscall.h> // For syscall numbers.
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, fchmod, (int fd, mode_t mode)) {
- int ret = __llvm_libc::syscall_impl<int>(SYS_fchmod, fd, mode);
+ int ret = LIBC_NAMESPACE::syscall_impl<int>(SYS_fchmod, fd, mode);
if (ret < 0) {
libc_errno = -ret;
return -1;
@@ -27,4 +27,4 @@ LLVM_LIBC_FUNCTION(int, fchmod, (int fd, mode_t mode)) {
return 0;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/sys/stat/linux/fchmodat.cpp b/libc/src/sys/stat/linux/fchmodat.cpp
index 9abb3de14a96255..43b4cf00111bab1 100644
--- a/libc/src/sys/stat/linux/fchmodat.cpp
+++ b/libc/src/sys/stat/linux/fchmodat.cpp
@@ -15,12 +15,12 @@
#include <sys/stat.h>
#include <sys/syscall.h> // For syscall numbers.
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, fchmodat,
(int dirfd, const char *path, mode_t mode, int flags)) {
int ret =
- __llvm_libc::syscall_impl<int>(SYS_fchmodat, dirfd, path, mode, flags);
+ LIBC_NAMESPACE::syscall_impl<int>(SYS_fchmodat, dirfd, path, mode, flags);
if (ret < 0) {
libc_errno = -ret;
return -1;
@@ -28,4 +28,4 @@ LLVM_LIBC_FUNCTION(int, fchmodat,
return 0;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/sys/stat/linux/fstat.cpp b/libc/src/sys/stat/linux/fstat.cpp
index e187e5cd48eb67e..516417858569c45 100644
--- a/libc/src/sys/stat/linux/fstat.cpp
+++ b/libc/src/sys/stat/linux/fstat.cpp
@@ -15,7 +15,7 @@
#include <fcntl.h>
#include <sys/stat.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, fstat, (int fd, struct stat *statbuf)) {
int err = statx(fd, "", AT_EMPTY_PATH, statbuf);
@@ -26,4 +26,4 @@ LLVM_LIBC_FUNCTION(int, fstat, (int fd, struct stat *statbuf)) {
return 0;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/sys/stat/linux/kernel_statx.h b/libc/src/sys/stat/linux/kernel_statx.h
index 48b23065d800fea..60969160b9ba4f8 100644
--- a/libc/src/sys/stat/linux/kernel_statx.h
+++ b/libc/src/sys/stat/linux/kernel_statx.h
@@ -67,14 +67,14 @@ constexpr unsigned int STATX_BASIC_STATS_MASK = 0x7FF;
} // Anonymous namespace
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LIBC_INLINE int statx(int dirfd, const char *__restrict path, int flags,
struct stat *__restrict statbuf) {
// We make a statx syscall and copy out the result into the |statbuf|.
::statx_buf xbuf;
- int ret = __llvm_libc::syscall_impl<int>(SYS_statx, dirfd, path, flags,
- ::STATX_BASIC_STATS_MASK, &xbuf);
+ int ret = LIBC_NAMESPACE::syscall_impl<int>(SYS_statx, dirfd, path, flags,
+ ::STATX_BASIC_STATS_MASK, &xbuf);
if (ret < 0)
return -ret;
@@ -98,6 +98,6 @@ LIBC_INLINE int statx(int dirfd, const char *__restrict path, int flags,
return 0;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_SYS_STAT_LINUX_KERNEL_STATX_H
diff --git a/libc/src/sys/stat/linux/lstat.cpp b/libc/src/sys/stat/linux/lstat.cpp
index 15a721ba784bc6a..b2698148973a5f9 100644
--- a/libc/src/sys/stat/linux/lstat.cpp
+++ b/libc/src/sys/stat/linux/lstat.cpp
@@ -16,7 +16,7 @@
#include <fcntl.h>
#include <sys/stat.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, lstat,
(const char *__restrict path,
@@ -29,4 +29,4 @@ LLVM_LIBC_FUNCTION(int, lstat,
return 0;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/sys/stat/linux/mkdir.cpp b/libc/src/sys/stat/linux/mkdir.cpp
index 1f5974c23c58c0e..63b64ac091a876b 100644
--- a/libc/src/sys/stat/linux/mkdir.cpp
+++ b/libc/src/sys/stat/linux/mkdir.cpp
@@ -16,13 +16,14 @@
#include <sys/stat.h>
#include <sys/syscall.h> // For syscall numbers.
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, mkdir, (const char *path, mode_t mode)) {
#ifdef SYS_mkdir
- int ret = __llvm_libc::syscall_impl<int>(SYS_mkdir, path, mode);
+ int ret = LIBC_NAMESPACE::syscall_impl<int>(SYS_mkdir, path, mode);
#elif defined(SYS_mkdirat)
- int ret = __llvm_libc::syscall_impl<int>(SYS_mkdirat, AT_FDCWD, path, mode);
+ int ret =
+ LIBC_NAMESPACE::syscall_impl<int>(SYS_mkdirat, AT_FDCWD, path, mode);
#else
#error "mkdir and mkdirat syscalls not available."
#endif
@@ -34,4 +35,4 @@ LLVM_LIBC_FUNCTION(int, mkdir, (const char *path, mode_t mode)) {
return 0;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/sys/stat/linux/mkdirat.cpp b/libc/src/sys/stat/linux/mkdirat.cpp
index ff266b18182cc60..0128d7c081cfd2a 100644
--- a/libc/src/sys/stat/linux/mkdirat.cpp
+++ b/libc/src/sys/stat/linux/mkdirat.cpp
@@ -15,11 +15,11 @@
#include <sys/stat.h>
#include <sys/syscall.h> // For syscall numbers.
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, mkdirat, (int dfd, const char *path, mode_t mode)) {
#ifdef SYS_mkdirat
- int ret = __llvm_libc::syscall_impl<int>(SYS_mkdirat, dfd, path, mode);
+ int ret = LIBC_NAMESPACE::syscall_impl<int>(SYS_mkdirat, dfd, path, mode);
#else
#error "mkdirat syscall not available."
#endif
@@ -31,4 +31,4 @@ LLVM_LIBC_FUNCTION(int, mkdirat, (int dfd, const char *path, mode_t mode)) {
return 0;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/sys/stat/linux/stat.cpp b/libc/src/sys/stat/linux/stat.cpp
index 9c3b56bff47466d..c30c8b65da1e8ae 100644
--- a/libc/src/sys/stat/linux/stat.cpp
+++ b/libc/src/sys/stat/linux/stat.cpp
@@ -15,7 +15,7 @@
#include <fcntl.h>
#include <sys/stat.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, stat,
(const char *__restrict path,
@@ -28,4 +28,4 @@ LLVM_LIBC_FUNCTION(int, stat,
return 0;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/sys/stat/lstat.h b/libc/src/sys/stat/lstat.h
index 7d5ffa23eece6d7..42bd8e932da755a 100644
--- a/libc/src/sys/stat/lstat.h
+++ b/libc/src/sys/stat/lstat.h
@@ -11,10 +11,10 @@
#include <sys/stat.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int lstat(const char *__restrict path, struct stat *__restrict statbuf);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_SYS_STAT_LSTAT_H
diff --git a/libc/src/sys/stat/mkdir.h b/libc/src/sys/stat/mkdir.h
index 535423acff78825..9f2991d850cbc97 100644
--- a/libc/src/sys/stat/mkdir.h
+++ b/libc/src/sys/stat/mkdir.h
@@ -11,10 +11,10 @@
#include <sys/stat.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int mkdir(const char *path, mode_t mode);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_SYS_STAT_MKDIR_H
diff --git a/libc/src/sys/stat/mkdirat.h b/libc/src/sys/stat/mkdirat.h
index 883709cb2158554..322209754fc0b76 100644
--- a/libc/src/sys/stat/mkdirat.h
+++ b/libc/src/sys/stat/mkdirat.h
@@ -11,10 +11,10 @@
#include <sys/stat.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int mkdirat(int dfd, const char *path, mode_t mode);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_SYS_STAT_MKDIRAT_H
diff --git a/libc/src/sys/stat/stat.h b/libc/src/sys/stat/stat.h
index a272aa422439fa2..5d2eba5bd74c448 100644
--- a/libc/src/sys/stat/stat.h
+++ b/libc/src/sys/stat/stat.h
@@ -11,10 +11,10 @@
#include <sys/stat.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int stat(const char *__restrict path, struct stat *__restrict statbuf);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_SYS_STAT_STAT_H
diff --git a/libc/src/sys/utsname/linux/uname.cpp b/libc/src/sys/utsname/linux/uname.cpp
index a73e477e0bff258..f0796b63f62e95b 100644
--- a/libc/src/sys/utsname/linux/uname.cpp
+++ b/libc/src/sys/utsname/linux/uname.cpp
@@ -15,10 +15,10 @@
#include <sys/syscall.h> // For syscall numbers.
#include <sys/utsname.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, uname, (struct utsname * name)) {
- int ret = __llvm_libc::syscall_impl<int>(SYS_uname, name);
+ int ret = LIBC_NAMESPACE::syscall_impl<int>(SYS_uname, name);
if (ret >= 0)
return 1;
@@ -26,4 +26,4 @@ LLVM_LIBC_FUNCTION(int, uname, (struct utsname * name)) {
return -1;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/sys/utsname/uname.h b/libc/src/sys/utsname/uname.h
index 80c748aefe5c076..b347cf00f33b9f5 100644
--- a/libc/src/sys/utsname/uname.h
+++ b/libc/src/sys/utsname/uname.h
@@ -11,10 +11,10 @@
#include <sys/utsname.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int uname(struct utsname *name);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_SYS_UTSNAME_UNAME_H
diff --git a/libc/src/sys/wait/linux/wait.cpp b/libc/src/sys/wait/linux/wait.cpp
index 855d45242741cc7..02e6a34c1e8b13a 100644
--- a/libc/src/sys/wait/linux/wait.cpp
+++ b/libc/src/sys/wait/linux/wait.cpp
@@ -12,7 +12,7 @@
#include "src/sys/wait/wait.h"
#include "src/sys/wait/wait4Impl.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(pid_t, wait, (int *wait_status)) {
auto result = internal::wait4impl(-1, wait_status, 0, 0);
@@ -23,4 +23,4 @@ LLVM_LIBC_FUNCTION(pid_t, wait, (int *wait_status)) {
return result.value();
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/sys/wait/linux/wait4.cpp b/libc/src/sys/wait/linux/wait4.cpp
index f73f57be7b18e7d..84036caf0a7b3f1 100644
--- a/libc/src/sys/wait/linux/wait4.cpp
+++ b/libc/src/sys/wait/linux/wait4.cpp
@@ -12,7 +12,7 @@
#include "src/sys/wait/wait4.h"
#include "src/sys/wait/wait4Impl.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(pid_t, wait4,
(pid_t pid, int *wait_status, int options,
@@ -25,4 +25,4 @@ LLVM_LIBC_FUNCTION(pid_t, wait4,
return result.value();
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/sys/wait/linux/waitpid.cpp b/libc/src/sys/wait/linux/waitpid.cpp
index 0ad83ae0d72ea71..b2e8229a525832d 100644
--- a/libc/src/sys/wait/linux/waitpid.cpp
+++ b/libc/src/sys/wait/linux/waitpid.cpp
@@ -12,7 +12,7 @@
#include "src/sys/wait/wait4Impl.h"
#include "src/sys/wait/waitpid.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(pid_t, waitpid, (pid_t pid, int *wait_status, int options)) {
auto result = internal::wait4impl(pid, wait_status, options, 0);
@@ -23,4 +23,4 @@ LLVM_LIBC_FUNCTION(pid_t, waitpid, (pid_t pid, int *wait_status, int options)) {
return result.value();
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/sys/wait/wait.h b/libc/src/sys/wait/wait.h
index d49fb21d9b728fd..abe5249b83c819f 100644
--- a/libc/src/sys/wait/wait.h
+++ b/libc/src/sys/wait/wait.h
@@ -11,10 +11,10 @@
#include <sys/wait.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
pid_t wait(int *waitstatus);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_SYS_WAIT_WAIT_H
diff --git a/libc/src/sys/wait/wait4.h b/libc/src/sys/wait/wait4.h
index 91c01747ecbb5b7..3205b28e968ef09 100644
--- a/libc/src/sys/wait/wait4.h
+++ b/libc/src/sys/wait/wait4.h
@@ -11,10 +11,10 @@
#include <sys/wait.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
pid_t wait4(pid_t pid, int *waitstatus, int options, struct rusage *usage);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_SYS_WAIT_WAIT4_H
diff --git a/libc/src/sys/wait/wait4Impl.h b/libc/src/sys/wait/wait4Impl.h
index 059b2cae4304724..956ad0f8c9c4113 100644
--- a/libc/src/sys/wait/wait4Impl.h
+++ b/libc/src/sys/wait/wait4Impl.h
@@ -18,7 +18,7 @@
#include <sys/syscall.h> // For syscall numbers.
#include <sys/wait.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
namespace internal {
// The implementation of wait here is very minimal. We will add more
@@ -27,8 +27,8 @@ namespace internal {
LIBC_INLINE ErrorOr<pid_t> wait4impl(pid_t pid, int *wait_status, int options,
struct rusage *usage) {
#if SYS_wait4
- pid = __llvm_libc::syscall_impl<pid_t>(SYS_wait4, pid, wait_status, options,
- usage);
+ pid = LIBC_NAMESPACE::syscall_impl<pid_t>(SYS_wait4, pid, wait_status,
+ options, usage);
#elif defined(SYS_waitid)
int idtype = P_PID;
if (pid == -1) {
@@ -43,8 +43,8 @@ LIBC_INLINE ErrorOr<pid_t> wait4impl(pid_t pid, int *wait_status, int options,
options |= WEXITED;
siginfo_t info;
- pid = __llvm_libc::syscall_impl<pid_t>(SYS_waitid, idtype, pid, &info,
- options, usage);
+ pid = LIBC_NAMESPACE::syscall_impl<pid_t>(SYS_waitid, idtype, pid, &info,
+ options, usage);
if (pid >= 0)
pid = info.si_pid;
@@ -80,6 +80,6 @@ LIBC_INLINE ErrorOr<pid_t> wait4impl(pid_t pid, int *wait_status, int options,
}
} // namespace internal
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_SYS_WAIT_WAIT4IMPL_H
diff --git a/libc/src/sys/wait/waitpid.h b/libc/src/sys/wait/waitpid.h
index 1407c7f9b0ed549..37ebf289ff072a1 100644
--- a/libc/src/sys/wait/waitpid.h
+++ b/libc/src/sys/wait/waitpid.h
@@ -11,10 +11,10 @@
#include <sys/wait.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
pid_t waitpid(pid_t pid, int *waitstatus, int options);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_SYS_WAIT_WAITPID_H
diff --git a/libc/src/termios/cfgetispeed.h b/libc/src/termios/cfgetispeed.h
index 9cd3a4bac88f892..7ea280f69da4446 100644
--- a/libc/src/termios/cfgetispeed.h
+++ b/libc/src/termios/cfgetispeed.h
@@ -11,10 +11,10 @@
#include <termios.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
speed_t cfgetispeed(const struct termios *t);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_TERMIOS_CFGETISPEED_H
diff --git a/libc/src/termios/cfgetospeed.h b/libc/src/termios/cfgetospeed.h
index 14ff9d018bcb4a7..95e3edb51b382e7 100644
--- a/libc/src/termios/cfgetospeed.h
+++ b/libc/src/termios/cfgetospeed.h
@@ -11,10 +11,10 @@
#include <termios.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
speed_t cfgetospeed(const struct termios *t);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_TERMIOS_CFGETOSPEED_H
diff --git a/libc/src/termios/cfsetispeed.h b/libc/src/termios/cfsetispeed.h
index 8d1648f10cd32c0..e03a2d1ef0cf55e 100644
--- a/libc/src/termios/cfsetispeed.h
+++ b/libc/src/termios/cfsetispeed.h
@@ -11,10 +11,10 @@
#include <termios.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int cfsetispeed(struct termios *t, speed_t speed);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_TERMIOS_CFSETISPEED_H
diff --git a/libc/src/termios/cfsetospeed.h b/libc/src/termios/cfsetospeed.h
index e7bb21b38a88061..74d41abc5326df3 100644
--- a/libc/src/termios/cfsetospeed.h
+++ b/libc/src/termios/cfsetospeed.h
@@ -11,10 +11,10 @@
#include <termios.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int cfsetospeed(struct termios *t, speed_t speed);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_TERMIOS_CFSETOSPEED_H
diff --git a/libc/src/termios/linux/cfgetispeed.cpp b/libc/src/termios/linux/cfgetispeed.cpp
index d4877e8cbc6bf05..18e34b2dcb07c9e 100644
--- a/libc/src/termios/linux/cfgetispeed.cpp
+++ b/libc/src/termios/linux/cfgetispeed.cpp
@@ -12,10 +12,10 @@
#include <termios.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(speed_t, cfgetispeed, (const struct termios *t)) {
return t->c_cflag & CBAUD;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/termios/linux/cfgetospeed.cpp b/libc/src/termios/linux/cfgetospeed.cpp
index 5fbe73de29e3693..1989b3feabe975b 100644
--- a/libc/src/termios/linux/cfgetospeed.cpp
+++ b/libc/src/termios/linux/cfgetospeed.cpp
@@ -12,10 +12,10 @@
#include <termios.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(speed_t, cfgetospeed, (const struct termios *t)) {
return t->c_cflag & CBAUD;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/termios/linux/cfsetispeed.cpp b/libc/src/termios/linux/cfsetispeed.cpp
index 7beb1171b8ee4b3..0e8ac55fe700e53 100644
--- a/libc/src/termios/linux/cfsetispeed.cpp
+++ b/libc/src/termios/linux/cfsetispeed.cpp
@@ -13,7 +13,7 @@
#include <termios.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, cfsetispeed, (struct termios * t, speed_t speed)) {
constexpr speed_t NOT_SPEED_MASK = ~speed_t(CBAUD);
@@ -28,4 +28,4 @@ LLVM_LIBC_FUNCTION(int, cfsetispeed, (struct termios * t, speed_t speed)) {
return 0;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/termios/linux/cfsetospeed.cpp b/libc/src/termios/linux/cfsetospeed.cpp
index 327cc56428f3ccd..d21f629cb74b6eb 100644
--- a/libc/src/termios/linux/cfsetospeed.cpp
+++ b/libc/src/termios/linux/cfsetospeed.cpp
@@ -13,7 +13,7 @@
#include <termios.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, cfsetospeed, (struct termios * t, speed_t speed)) {
constexpr speed_t NOT_SPEED_MASK = ~speed_t(CBAUD);
@@ -28,4 +28,4 @@ LLVM_LIBC_FUNCTION(int, cfsetospeed, (struct termios * t, speed_t speed)) {
return 0;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/termios/linux/kernel_termios.h b/libc/src/termios/linux/kernel_termios.h
index 252f63db3aa6a8e..d96de72029f761d 100644
--- a/libc/src/termios/linux/kernel_termios.h
+++ b/libc/src/termios/linux/kernel_termios.h
@@ -12,7 +12,7 @@
#include <stddef.h>
#include <termios.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
// The kernel's struct termios is different from the libc's struct termios. The
// kernel's syscalls expect the size and layout of its definition of struct
@@ -36,6 +36,6 @@ struct kernel_termios {
cc_t c_cc[KERNEL_NCCS];
};
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_TERMIOS_LINUX_KERNEL_TERMIOS_H
diff --git a/libc/src/termios/linux/tcdrain.cpp b/libc/src/termios/linux/tcdrain.cpp
index a45a00a8909ddad..c3826ff9a101c20 100644
--- a/libc/src/termios/linux/tcdrain.cpp
+++ b/libc/src/termios/linux/tcdrain.cpp
@@ -16,10 +16,10 @@
#include <sys/syscall.h> // For syscall numbers
#include <termios.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, tcdrain, (int fd)) {
- int ret = __llvm_libc::syscall_impl<int>(SYS_ioctl, fd, TCSBRK, 1);
+ int ret = LIBC_NAMESPACE::syscall_impl<int>(SYS_ioctl, fd, TCSBRK, 1);
if (ret < 0) {
libc_errno = -ret;
return -1;
@@ -27,4 +27,4 @@ LLVM_LIBC_FUNCTION(int, tcdrain, (int fd)) {
return 0;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/termios/linux/tcflow.cpp b/libc/src/termios/linux/tcflow.cpp
index a959cf7e9f7bf26..9753ef767e92790 100644
--- a/libc/src/termios/linux/tcflow.cpp
+++ b/libc/src/termios/linux/tcflow.cpp
@@ -16,10 +16,10 @@
#include <sys/syscall.h> // For syscall numbers
#include <termios.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, tcflow, (int fd, int action)) {
- int ret = __llvm_libc::syscall_impl<int>(SYS_ioctl, fd, TCXONC, action);
+ int ret = LIBC_NAMESPACE::syscall_impl<int>(SYS_ioctl, fd, TCXONC, action);
if (ret < 0) {
libc_errno = -ret;
return -1;
@@ -27,4 +27,4 @@ LLVM_LIBC_FUNCTION(int, tcflow, (int fd, int action)) {
return 0;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/termios/linux/tcflush.cpp b/libc/src/termios/linux/tcflush.cpp
index 26183293142a63e..9c7e8f02431e887 100644
--- a/libc/src/termios/linux/tcflush.cpp
+++ b/libc/src/termios/linux/tcflush.cpp
@@ -16,11 +16,11 @@
#include <sys/syscall.h> // For syscall numbers
#include <termios.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, tcflush, (int fd, int queue_selector)) {
int ret =
- __llvm_libc::syscall_impl<int>(SYS_ioctl, fd, TCFLSH, queue_selector);
+ LIBC_NAMESPACE::syscall_impl<int>(SYS_ioctl, fd, TCFLSH, queue_selector);
if (ret < 0) {
libc_errno = -ret;
return -1;
@@ -28,4 +28,4 @@ LLVM_LIBC_FUNCTION(int, tcflush, (int fd, int queue_selector)) {
return 0;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/termios/linux/tcgetattr.cpp b/libc/src/termios/linux/tcgetattr.cpp
index 931591c73b2b7bf..254c48521bb908c 100644
--- a/libc/src/termios/linux/tcgetattr.cpp
+++ b/libc/src/termios/linux/tcgetattr.cpp
@@ -17,11 +17,11 @@
#include <sys/syscall.h> // For syscall numbers
#include <termios.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, tcgetattr, (int fd, struct termios *t)) {
- __llvm_libc::kernel_termios kt;
- int ret = __llvm_libc::syscall_impl<int>(SYS_ioctl, fd, TCGETS, &kt);
+ LIBC_NAMESPACE::kernel_termios kt;
+ int ret = LIBC_NAMESPACE::syscall_impl<int>(SYS_ioctl, fd, TCGETS, &kt);
if (ret < 0) {
libc_errno = -ret;
return -1;
@@ -43,4 +43,4 @@ LLVM_LIBC_FUNCTION(int, tcgetattr, (int fd, struct termios *t)) {
return 0;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/termios/linux/tcgetsid.cpp b/libc/src/termios/linux/tcgetsid.cpp
index 9afbc91ad38d582..7b2abf8f4cf08ce 100644
--- a/libc/src/termios/linux/tcgetsid.cpp
+++ b/libc/src/termios/linux/tcgetsid.cpp
@@ -16,11 +16,11 @@
#include <sys/syscall.h> // For syscall numbers
#include <termios.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(pid_t, tcgetsid, (int fd)) {
pid_t sid;
- int ret = __llvm_libc::syscall_impl<int>(SYS_ioctl, fd, TIOCGSID, &sid);
+ int ret = LIBC_NAMESPACE::syscall_impl<int>(SYS_ioctl, fd, TIOCGSID, &sid);
if (ret < 0) {
libc_errno = -ret;
return -1;
@@ -28,4 +28,4 @@ LLVM_LIBC_FUNCTION(pid_t, tcgetsid, (int fd)) {
return sid;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/termios/linux/tcsendbreak.cpp b/libc/src/termios/linux/tcsendbreak.cpp
index a2467f06c148658..fdd3f8adf7d8d3a 100644
--- a/libc/src/termios/linux/tcsendbreak.cpp
+++ b/libc/src/termios/linux/tcsendbreak.cpp
@@ -16,13 +16,13 @@
#include <sys/syscall.h> // For syscall numbers
#include <termios.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(pid_t, tcsendbreak, (int fd, int /* unused duration */)) {
// POSIX leaves the behavior for non-zero duration implementation dependent.
// Which means that the behavior can be the same as it is when duration is
// zero. So, we just pass zero to the syscall.
- int ret = __llvm_libc::syscall_impl<int>(SYS_ioctl, fd, TCSBRK, 0);
+ int ret = LIBC_NAMESPACE::syscall_impl<int>(SYS_ioctl, fd, TCSBRK, 0);
if (ret < 0) {
libc_errno = -ret;
return -1;
@@ -30,4 +30,4 @@ LLVM_LIBC_FUNCTION(pid_t, tcsendbreak, (int fd, int /* unused duration */)) {
return 0;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/termios/linux/tcsetattr.cpp b/libc/src/termios/linux/tcsetattr.cpp
index d3872b1138816d4..ba500a00210d998 100644
--- a/libc/src/termios/linux/tcsetattr.cpp
+++ b/libc/src/termios/linux/tcsetattr.cpp
@@ -17,7 +17,7 @@
#include <sys/syscall.h> // For syscall numbers
#include <termios.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, tcsetattr,
(int fd, int actions, const struct termios *t)) {
@@ -51,7 +51,7 @@ LLVM_LIBC_FUNCTION(int, tcsetattr,
kt.c_cc[i] = 0;
}
- int ret = __llvm_libc::syscall_impl<int>(SYS_ioctl, fd, cmd, &kt);
+ int ret = LIBC_NAMESPACE::syscall_impl<int>(SYS_ioctl, fd, cmd, &kt);
if (ret < 0) {
libc_errno = -ret;
return -1;
@@ -59,4 +59,4 @@ LLVM_LIBC_FUNCTION(int, tcsetattr,
return 0;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/termios/tcdrain.h b/libc/src/termios/tcdrain.h
index 1bde86d890b0feb..52042063108cc5d 100644
--- a/libc/src/termios/tcdrain.h
+++ b/libc/src/termios/tcdrain.h
@@ -11,10 +11,10 @@
#include <termios.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int tcdrain(int fd);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_TERMIOS_TCDRAIN_H
diff --git a/libc/src/termios/tcflow.h b/libc/src/termios/tcflow.h
index 4040c2724d56cee..267d3f682d7b2ed 100644
--- a/libc/src/termios/tcflow.h
+++ b/libc/src/termios/tcflow.h
@@ -11,10 +11,10 @@
#include <termios.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int tcflow(int fd, int action);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_TERMIOS_TCFLOW_H
diff --git a/libc/src/termios/tcflush.h b/libc/src/termios/tcflush.h
index 61fec9baae1a89d..d631ca21379e903 100644
--- a/libc/src/termios/tcflush.h
+++ b/libc/src/termios/tcflush.h
@@ -11,10 +11,10 @@
#include <termios.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int tcflush(int fd, int queue_selector);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_TERMIOS_TCFLUSH_H
diff --git a/libc/src/termios/tcgetattr.h b/libc/src/termios/tcgetattr.h
index 61fdcdbdfd8b927..c39aa4135256d1c 100644
--- a/libc/src/termios/tcgetattr.h
+++ b/libc/src/termios/tcgetattr.h
@@ -11,10 +11,10 @@
#include <termios.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int tcgetattr(int fd, struct termios *t);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_TERMIOS_TCGETATTR_H
diff --git a/libc/src/termios/tcgetsid.h b/libc/src/termios/tcgetsid.h
index 1d8934764a7af3b..07dbb22b1677566 100644
--- a/libc/src/termios/tcgetsid.h
+++ b/libc/src/termios/tcgetsid.h
@@ -11,10 +11,10 @@
#include <termios.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
pid_t tcgetsid(int fd);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_TERMIOS_TCGETSID_H
diff --git a/libc/src/termios/tcsendbreak.h b/libc/src/termios/tcsendbreak.h
index 52d72435ab129f8..487fdad5048042f 100644
--- a/libc/src/termios/tcsendbreak.h
+++ b/libc/src/termios/tcsendbreak.h
@@ -11,10 +11,10 @@
#include <termios.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int tcsendbreak(int fd, int duration);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_TERMIOS_TCSENDBREAK_H
diff --git a/libc/src/termios/tcsetattr.h b/libc/src/termios/tcsetattr.h
index a7fdfd7d57625fb..d514ac71210bb3b 100644
--- a/libc/src/termios/tcsetattr.h
+++ b/libc/src/termios/tcsetattr.h
@@ -11,10 +11,10 @@
#include <termios.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int tcsetattr(int fd, int actions, const struct termios *t);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_TERMIOS_TCSETATTR_H
diff --git a/libc/src/threads/call_once.cpp b/libc/src/threads/call_once.cpp
index 67ab34509a4c945..2d91094b1209189 100644
--- a/libc/src/threads/call_once.cpp
+++ b/libc/src/threads/call_once.cpp
@@ -12,7 +12,7 @@
#include <threads.h> // For once_flag and __call_once_func_t definitions.
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(void, call_once,
(once_flag * flag, __call_once_func_t func)) {
@@ -20,4 +20,4 @@ LLVM_LIBC_FUNCTION(void, call_once,
reinterpret_cast<CallOnceCallback *>(func));
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/threads/call_once.h b/libc/src/threads/call_once.h
index c1e1a71da2d5c5c..186d63cecdbdd2d 100644
--- a/libc/src/threads/call_once.h
+++ b/libc/src/threads/call_once.h
@@ -11,10 +11,10 @@
#include <threads.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
void call_once(once_flag *flag, __call_once_func_t func);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_THREADS_CALL_ONCE_H
diff --git a/libc/src/threads/cnd_broadcast.h b/libc/src/threads/cnd_broadcast.h
index fd021956b7f6645..4e996f22748f3fc 100644
--- a/libc/src/threads/cnd_broadcast.h
+++ b/libc/src/threads/cnd_broadcast.h
@@ -11,10 +11,10 @@
#include <threads.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int cnd_broadcast(cnd_t *cond);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_THREADS_CND_BROADCAST_H
diff --git a/libc/src/threads/cnd_destroy.h b/libc/src/threads/cnd_destroy.h
index 3400257529e38e3..d102e7b83e7bca3 100644
--- a/libc/src/threads/cnd_destroy.h
+++ b/libc/src/threads/cnd_destroy.h
@@ -11,10 +11,10 @@
#include <threads.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
void cnd_destroy(cnd_t *cond);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_THREADS_CND_DESTROY_H
diff --git a/libc/src/threads/cnd_init.h b/libc/src/threads/cnd_init.h
index 826564b0498634a..c4fc02f5f9e7ef2 100644
--- a/libc/src/threads/cnd_init.h
+++ b/libc/src/threads/cnd_init.h
@@ -11,10 +11,10 @@
#include <threads.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int cnd_init(cnd_t *cond);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_THREADS_CND_INIT_H
diff --git a/libc/src/threads/cnd_signal.h b/libc/src/threads/cnd_signal.h
index ec2a97721997702..4c60a9295299cf7 100644
--- a/libc/src/threads/cnd_signal.h
+++ b/libc/src/threads/cnd_signal.h
@@ -11,10 +11,10 @@
#include <threads.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int cnd_signal(cnd_t *cond);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_THREADS_CND_SIGNAL_H
diff --git a/libc/src/threads/cnd_wait.h b/libc/src/threads/cnd_wait.h
index 812e70425060f7c..5d2cdbb68c78f0d 100644
--- a/libc/src/threads/cnd_wait.h
+++ b/libc/src/threads/cnd_wait.h
@@ -11,10 +11,10 @@
#include <threads.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int cnd_wait(cnd_t *cond, mtx_t *mutex);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_THREADS_CND_WAIT_H
diff --git a/libc/src/threads/linux/CndVar.h b/libc/src/threads/linux/CndVar.h
index 535f7299fcc04ca..b4afdef9f9eba7a 100644
--- a/libc/src/threads/linux/CndVar.h
+++ b/libc/src/threads/linux/CndVar.h
@@ -19,7 +19,7 @@
#include <sys/syscall.h> // For syscall numbers.
#include <threads.h> // For values like thrd_success etc.
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
struct CndVar {
enum CndWaiterStatus : uint32_t {
@@ -84,8 +84,8 @@ struct CndVar {
}
}
- __llvm_libc::syscall_impl<long>(FUTEX_SYSCALL_ID, &waiter.futex_word.val,
- FUTEX_WAIT, WS_Waiting, 0, 0, 0);
+ LIBC_NAMESPACE::syscall_impl<long>(FUTEX_SYSCALL_ID, &waiter.futex_word.val,
+ FUTEX_WAIT, WS_Waiting, 0, 0, 0);
// At this point, if locking |m| fails, we can simply return as the
// queued up waiter would have been removed from the queue.
@@ -109,7 +109,7 @@ struct CndVar {
qmtx.futex_word = FutexWordType(Mutex::LockState::Free);
- __llvm_libc::syscall_impl<long>(
+ LIBC_NAMESPACE::syscall_impl<long>(
FUTEX_SYSCALL_ID, &qmtx.futex_word.val, FUTEX_WAKE_OP, 1, 1,
&first->futex_word.val,
FUTEX_OP(FUTEX_OP_SET, WS_Signalled, FUTEX_OP_CMP_EQ, WS_Waiting));
@@ -126,7 +126,7 @@ struct CndVar {
// atomically update the waiter status to WS_Signalled before waking
// up the waiter. A dummy location is used for the other futex of
// FUTEX_WAKE_OP.
- __llvm_libc::syscall_impl<long>(
+ LIBC_NAMESPACE::syscall_impl<long>(
FUTEX_SYSCALL_ID, &dummy_futex_word, FUTEX_WAKE_OP, 1, 1,
&waiter->futex_word.val,
FUTEX_OP(FUTEX_OP_SET, WS_Signalled, FUTEX_OP_CMP_EQ, WS_Waiting));
@@ -141,6 +141,6 @@ static_assert(sizeof(CndVar) == sizeof(cnd_t),
"internal representation of condition variable and the public "
"cnd_t type.");
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_THREADS_LINUX_CNDVAR_H
diff --git a/libc/src/threads/linux/Futex.h b/libc/src/threads/linux/Futex.h
index 53e2858d574722e..4b426ac51ad17ab 100644
--- a/libc/src/threads/linux/Futex.h
+++ b/libc/src/threads/linux/Futex.h
@@ -11,7 +11,7 @@
#include "src/__support/macros/properties/architectures.h" // Architecture macros
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
#if (defined(LIBC_TARGET_ARCH_IS_AARCH64) || \
defined(LIBC_TARGET_ARCH_IS_X86_64))
@@ -27,6 +27,6 @@ static_assert(sizeof(FutexWordType) == 4,
#error "Futex word base type not defined for the target architecture."
#endif
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_THREADS_LINUX_FUTEX_H
diff --git a/libc/src/threads/linux/call_once.cpp b/libc/src/threads/linux/call_once.cpp
index a3c0131ff78f184..5cdd8ebfd190ea1 100644
--- a/libc/src/threads/linux/call_once.cpp
+++ b/libc/src/threads/linux/call_once.cpp
@@ -19,7 +19,7 @@
#include <sys/syscall.h> // For syscall numbers.
#include <threads.h> // For call_once related type definition.
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
static constexpr FutexWordType START = 0x11;
static constexpr FutexWordType WAITING = 0x22;
@@ -46,10 +46,10 @@ LLVM_LIBC_FUNCTION(void, call_once,
func();
auto status = futex_word->exchange(FINISH);
if (status == WAITING) {
- __llvm_libc::syscall_impl(FUTEX_SYSCALL_ID, &futex_word->val,
- FUTEX_WAKE_PRIVATE,
- INT_MAX, // Wake all waiters.
- 0, 0, 0);
+ LIBC_NAMESPACE::syscall_impl(FUTEX_SYSCALL_ID, &futex_word->val,
+ FUTEX_WAKE_PRIVATE,
+ INT_MAX, // Wake all waiters.
+ 0, 0, 0);
}
return;
}
@@ -57,11 +57,11 @@ LLVM_LIBC_FUNCTION(void, call_once,
FutexWordType status = START;
if (futex_word->compare_exchange_strong(status, WAITING) ||
status == WAITING) {
- __llvm_libc::syscall_impl(
+ LIBC_NAMESPACE::syscall_impl(
FUTEX_SYSCALL_ID, &futex_word->val, FUTEX_WAIT_PRIVATE,
WAITING, // Block only if status is still |WAITING|.
0, 0, 0);
}
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/threads/linux/cnd_broadcast.cpp b/libc/src/threads/linux/cnd_broadcast.cpp
index 7b7c8f3b1cfd9cb..180ac6d68ee8641 100644
--- a/libc/src/threads/linux/cnd_broadcast.cpp
+++ b/libc/src/threads/linux/cnd_broadcast.cpp
@@ -11,11 +11,11 @@
#include "src/threads/cnd_broadcast.h"
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, cnd_broadcast, (cnd_t * cond)) {
CndVar *cndvar = reinterpret_cast<CndVar *>(cond);
return cndvar->broadcast();
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/threads/linux/cnd_destroy.cpp b/libc/src/threads/linux/cnd_destroy.cpp
index 947c5be0bcd8ca4..08eb3a1057b112e 100644
--- a/libc/src/threads/linux/cnd_destroy.cpp
+++ b/libc/src/threads/linux/cnd_destroy.cpp
@@ -11,11 +11,11 @@
#include "src/threads/cnd_destroy.h"
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(void, cnd_destroy, (cnd_t * cond)) {
CndVar *cndvar = reinterpret_cast<CndVar *>(cond);
CndVar::destroy(cndvar);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/threads/linux/cnd_init.cpp b/libc/src/threads/linux/cnd_init.cpp
index 5e3156de93708de..5e3f360b1d2b999 100644
--- a/libc/src/threads/linux/cnd_init.cpp
+++ b/libc/src/threads/linux/cnd_init.cpp
@@ -11,11 +11,11 @@
#include "src/threads/cnd_init.h"
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, cnd_init, (cnd_t * cond)) {
CndVar *cndvar = reinterpret_cast<CndVar *>(cond);
return CndVar::init(cndvar);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/threads/linux/cnd_signal.cpp b/libc/src/threads/linux/cnd_signal.cpp
index 6099b13ed987f11..dba01abdefbc942 100644
--- a/libc/src/threads/linux/cnd_signal.cpp
+++ b/libc/src/threads/linux/cnd_signal.cpp
@@ -11,11 +11,11 @@
#include "src/threads/cnd_signal.h"
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, cnd_signal, (cnd_t * cond)) {
CndVar *cndvar = reinterpret_cast<CndVar *>(cond);
return cndvar->notify_one();
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/threads/linux/cnd_wait.cpp b/libc/src/threads/linux/cnd_wait.cpp
index 5c0aed7be76da03..db3d7f1436eb76c 100644
--- a/libc/src/threads/linux/cnd_wait.cpp
+++ b/libc/src/threads/linux/cnd_wait.cpp
@@ -12,7 +12,7 @@
#include "src/__support/threads/mutex.h"
#include "src/threads/cnd_wait.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, cnd_wait, (cnd_t * cond, mtx_t *mtx)) {
CndVar *cndvar = reinterpret_cast<CndVar *>(cond);
@@ -20,4 +20,4 @@ LLVM_LIBC_FUNCTION(int, cnd_wait, (cnd_t * cond, mtx_t *mtx)) {
return cndvar->wait(mutex);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/threads/mtx_destroy.cpp b/libc/src/threads/mtx_destroy.cpp
index 64327003bfc585c..5ee4777f5b2c2eb 100644
--- a/libc/src/threads/mtx_destroy.cpp
+++ b/libc/src/threads/mtx_destroy.cpp
@@ -12,8 +12,8 @@
#include <threads.h> // For mtx_t definition.
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(void, mtx_destroy, (mtx_t *)) {}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/threads/mtx_destroy.h b/libc/src/threads/mtx_destroy.h
index 353bc27453bacb9..1abf5d572f5dc95 100644
--- a/libc/src/threads/mtx_destroy.h
+++ b/libc/src/threads/mtx_destroy.h
@@ -11,10 +11,10 @@
#include <threads.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
void mtx_destroy(mtx_t *mutex);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_THREADS_MTX_DESTROY_H
diff --git a/libc/src/threads/mtx_init.cpp b/libc/src/threads/mtx_init.cpp
index 188209c9d371842..74d08d33b116b95 100644
--- a/libc/src/threads/mtx_init.cpp
+++ b/libc/src/threads/mtx_init.cpp
@@ -12,7 +12,7 @@
#include <threads.h> // For mtx_t definition.
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
static_assert(sizeof(Mutex) <= sizeof(mtx_t),
"The public mtx_t type cannot accommodate the internal mutex "
@@ -24,4 +24,4 @@ LLVM_LIBC_FUNCTION(int, mtx_init, (mtx_t * m, int type)) {
return err == MutexError::NONE ? thrd_success : thrd_error;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/threads/mtx_init.h b/libc/src/threads/mtx_init.h
index 8fcaa42a2307d16..69294d796666385 100644
--- a/libc/src/threads/mtx_init.h
+++ b/libc/src/threads/mtx_init.h
@@ -11,10 +11,10 @@
#include <threads.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int mtx_init(mtx_t *mutex, int type);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_THREADS_MTX_INIT_H
diff --git a/libc/src/threads/mtx_lock.cpp b/libc/src/threads/mtx_lock.cpp
index 58379f6f9d0fd98..013a88a8e02b7a2 100644
--- a/libc/src/threads/mtx_lock.cpp
+++ b/libc/src/threads/mtx_lock.cpp
@@ -12,7 +12,7 @@
#include <threads.h> // For mtx_t definition.
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
// The implementation currently handles only plain mutexes.
LLVM_LIBC_FUNCTION(int, mtx_lock, (mtx_t * mutex)) {
@@ -21,4 +21,4 @@ LLVM_LIBC_FUNCTION(int, mtx_lock, (mtx_t * mutex)) {
return err == MutexError::NONE ? thrd_success : thrd_error;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/threads/mtx_lock.h b/libc/src/threads/mtx_lock.h
index df3ec0dccbdb72a..15c9e1a12545fbd 100644
--- a/libc/src/threads/mtx_lock.h
+++ b/libc/src/threads/mtx_lock.h
@@ -11,10 +11,10 @@
#include <threads.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int mtx_lock(mtx_t *mutex);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_THREADS_MTX_LOCK_H
diff --git a/libc/src/threads/mtx_unlock.cpp b/libc/src/threads/mtx_unlock.cpp
index f5c6a136d9dba1c..a72ee4427c5a9ed 100644
--- a/libc/src/threads/mtx_unlock.cpp
+++ b/libc/src/threads/mtx_unlock.cpp
@@ -12,7 +12,7 @@
#include <threads.h> // For mtx_t definition.
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
// The implementation currently handles only plain mutexes.
LLVM_LIBC_FUNCTION(int, mtx_unlock, (mtx_t * mutex)) {
@@ -21,4 +21,4 @@ LLVM_LIBC_FUNCTION(int, mtx_unlock, (mtx_t * mutex)) {
return err == MutexError::NONE ? thrd_success : thrd_error;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/threads/mtx_unlock.h b/libc/src/threads/mtx_unlock.h
index b58df6392265e4c..54fb034a04a21e3 100644
--- a/libc/src/threads/mtx_unlock.h
+++ b/libc/src/threads/mtx_unlock.h
@@ -11,10 +11,10 @@
#include <threads.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int mtx_unlock(mtx_t *mutex);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_THREADS_MTX_UNLOCK_H
diff --git a/libc/src/threads/thrd_create.cpp b/libc/src/threads/thrd_create.cpp
index 8ec3cf1c3fcd9e0..06cba84eb8646a6 100644
--- a/libc/src/threads/thrd_create.cpp
+++ b/libc/src/threads/thrd_create.cpp
@@ -13,14 +13,14 @@
#include <errno.h>
#include <threads.h> // For thrd_* type definitions.
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
-static_assert(sizeof(thrd_t) == sizeof(__llvm_libc::Thread),
+static_assert(sizeof(thrd_t) == sizeof(LIBC_NAMESPACE::Thread),
"Mismatch between thrd_t and internal Thread.");
LLVM_LIBC_FUNCTION(int, thrd_create,
(thrd_t * th, thrd_start_t func, void *arg)) {
- auto *thread = reinterpret_cast<__llvm_libc::Thread *>(th);
+ auto *thread = reinterpret_cast<LIBC_NAMESPACE::Thread *>(th);
int result = thread->run(func, arg);
if (result == 0)
return thrd_success;
@@ -30,4 +30,4 @@ LLVM_LIBC_FUNCTION(int, thrd_create,
return thrd_error;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/threads/thrd_create.h b/libc/src/threads/thrd_create.h
index 9ed19c48c0a4e13..0efa6f58c47eaf4 100644
--- a/libc/src/threads/thrd_create.h
+++ b/libc/src/threads/thrd_create.h
@@ -11,10 +11,10 @@
#include <threads.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int thrd_create(thrd_t *thread, thrd_start_t func, void *arg);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_THREADS_THRD_CREATE_H
diff --git a/libc/src/threads/thrd_current.cpp b/libc/src/threads/thrd_current.cpp
index e8afd7bf6c49ab7..b5ea0432aa52314 100644
--- a/libc/src/threads/thrd_current.cpp
+++ b/libc/src/threads/thrd_current.cpp
@@ -12,9 +12,9 @@
#include <threads.h> // For thrd_* type definitions.
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
-static_assert(sizeof(thrd_t) == sizeof(__llvm_libc::Thread),
+static_assert(sizeof(thrd_t) == sizeof(LIBC_NAMESPACE::Thread),
"Mismatch between thrd_t and internal Thread.");
LLVM_LIBC_FUNCTION(thrd_t, thrd_current, ()) {
@@ -23,4 +23,4 @@ LLVM_LIBC_FUNCTION(thrd_t, thrd_current, ()) {
return th;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/threads/thrd_current.h b/libc/src/threads/thrd_current.h
index 338a16dc56e9d4b..2125729ccffebfa 100644
--- a/libc/src/threads/thrd_current.h
+++ b/libc/src/threads/thrd_current.h
@@ -11,10 +11,10 @@
#include <threads.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
thrd_t thrd_current();
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_THREADS_THRD_CURRENT_H
diff --git a/libc/src/threads/thrd_detach.cpp b/libc/src/threads/thrd_detach.cpp
index 20c6540faa17c91..17731c638bd5288 100644
--- a/libc/src/threads/thrd_detach.cpp
+++ b/libc/src/threads/thrd_detach.cpp
@@ -12,9 +12,9 @@
#include <threads.h> // For thrd_* type definitions.
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
-static_assert(sizeof(thrd_t) == sizeof(__llvm_libc::Thread),
+static_assert(sizeof(thrd_t) == sizeof(LIBC_NAMESPACE::Thread),
"Mismatch between thrd_t and internal Thread.");
LLVM_LIBC_FUNCTION(int, thrd_detach, (thrd_t th)) {
@@ -23,4 +23,4 @@ LLVM_LIBC_FUNCTION(int, thrd_detach, (thrd_t th)) {
return 0;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/threads/thrd_detach.h b/libc/src/threads/thrd_detach.h
index 58d36e86380adf6..64f2094acd65dbd 100644
--- a/libc/src/threads/thrd_detach.h
+++ b/libc/src/threads/thrd_detach.h
@@ -11,10 +11,10 @@
#include <threads.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int thrd_detach(thrd_t thread);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_THREADS_THRD_DETACH_H
diff --git a/libc/src/threads/thrd_equal.cpp b/libc/src/threads/thrd_equal.cpp
index aac220ec9adb401..b9717cf121b04b7 100644
--- a/libc/src/threads/thrd_equal.cpp
+++ b/libc/src/threads/thrd_equal.cpp
@@ -12,9 +12,9 @@
#include <threads.h> // For thrd_* type definitions.
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
-static_assert(sizeof(thrd_t) == sizeof(__llvm_libc::Thread),
+static_assert(sizeof(thrd_t) == sizeof(LIBC_NAMESPACE::Thread),
"Mismatch between thrd_t and internal Thread.");
LLVM_LIBC_FUNCTION(int, thrd_equal, (thrd_t lhs, thrd_t rhs)) {
@@ -23,4 +23,4 @@ LLVM_LIBC_FUNCTION(int, thrd_equal, (thrd_t lhs, thrd_t rhs)) {
return *lhs_internal == *rhs_internal;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/threads/thrd_equal.h b/libc/src/threads/thrd_equal.h
index 9e1bebc0afe5e6d..5878ea458ba4124 100644
--- a/libc/src/threads/thrd_equal.h
+++ b/libc/src/threads/thrd_equal.h
@@ -11,10 +11,10 @@
#include <threads.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int thrd_equal(thrd_t lhs, thrd_t rhs);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_THREADS_THRD_EQUAL_H
diff --git a/libc/src/threads/thrd_exit.cpp b/libc/src/threads/thrd_exit.cpp
index 9935c23bba1ebab..67a7a419cf99a7d 100644
--- a/libc/src/threads/thrd_exit.cpp
+++ b/libc/src/threads/thrd_exit.cpp
@@ -12,13 +12,13 @@
#include <threads.h> // For thrd_* type definitions.
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
-static_assert(sizeof(thrd_t) == sizeof(__llvm_libc::Thread),
+static_assert(sizeof(thrd_t) == sizeof(LIBC_NAMESPACE::Thread),
"Mismatch between thrd_t and internal Thread.");
LLVM_LIBC_FUNCTION(void, thrd_exit, (int retval)) {
thread_exit(ThreadReturnValue(retval), ThreadStyle::STDC);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/threads/thrd_exit.h b/libc/src/threads/thrd_exit.h
index 4cc835118a8523d..19eb027d0357ac8 100644
--- a/libc/src/threads/thrd_exit.h
+++ b/libc/src/threads/thrd_exit.h
@@ -11,10 +11,10 @@
#include <threads.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
void thrd_exit(int retval);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_THREADS_THRD_EXIT_H
diff --git a/libc/src/threads/thrd_join.cpp b/libc/src/threads/thrd_join.cpp
index e4cf5522db92f7d..cc8ba4b97a3a598 100644
--- a/libc/src/threads/thrd_join.cpp
+++ b/libc/src/threads/thrd_join.cpp
@@ -12,9 +12,9 @@
#include <threads.h> // For thrd_* type definitions.
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
-static_assert(sizeof(thrd_t) == sizeof(__llvm_libc::Thread),
+static_assert(sizeof(thrd_t) == sizeof(LIBC_NAMESPACE::Thread),
"Mismatch between thrd_t and internal Thread.");
LLVM_LIBC_FUNCTION(int, thrd_join, (thrd_t th, int *retval)) {
@@ -23,4 +23,4 @@ LLVM_LIBC_FUNCTION(int, thrd_join, (thrd_t th, int *retval)) {
return result == 0 ? thrd_success : thrd_error;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/threads/thrd_join.h b/libc/src/threads/thrd_join.h
index d86529c8cb9759d..21a398c6e8352b1 100644
--- a/libc/src/threads/thrd_join.h
+++ b/libc/src/threads/thrd_join.h
@@ -11,10 +11,10 @@
#include <threads.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int thrd_join(thrd_t thread, int *retval);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_THREADS_THRD_JOIN_H
diff --git a/libc/src/threads/tss_create.cpp b/libc/src/threads/tss_create.cpp
index f384565fbb9d16b..ddea44dce301ddc 100644
--- a/libc/src/threads/tss_create.cpp
+++ b/libc/src/threads/tss_create.cpp
@@ -13,14 +13,14 @@
#include <threads.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, tss_create, (tss_t * key, tss_dtor_t dtor)) {
- auto k = __llvm_libc::new_tss_key(dtor);
+ auto k = LIBC_NAMESPACE::new_tss_key(dtor);
if (!k)
return thrd_error;
*key = *k;
return thrd_success;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/threads/tss_create.h b/libc/src/threads/tss_create.h
index 967bdca10c4fe18..def903e29e06e45 100644
--- a/libc/src/threads/tss_create.h
+++ b/libc/src/threads/tss_create.h
@@ -11,10 +11,10 @@
#include <threads.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int tss_create(tss_t *key, tss_dtor_t dtor);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_THREADS_TSS_CREATE_H
diff --git a/libc/src/threads/tss_delete.cpp b/libc/src/threads/tss_delete.cpp
index 6bdd4aa91867e86..a2a4e9aa349bab2 100644
--- a/libc/src/threads/tss_delete.cpp
+++ b/libc/src/threads/tss_delete.cpp
@@ -13,10 +13,10 @@
#include <threads.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(void, tss_delete, (tss_t key)) {
- __llvm_libc::tss_key_delete(key);
+ LIBC_NAMESPACE::tss_key_delete(key);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/threads/tss_delete.h b/libc/src/threads/tss_delete.h
index 1f55d3ba69f5956..3efc0d745dd14f0 100644
--- a/libc/src/threads/tss_delete.h
+++ b/libc/src/threads/tss_delete.h
@@ -11,10 +11,10 @@
#include <threads.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
void tss_delete(tss_t key);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_THREADS_TSS_DELETE_H
diff --git a/libc/src/threads/tss_get.cpp b/libc/src/threads/tss_get.cpp
index 4596a9337ffcce1..9b8c94fbeba2846 100644
--- a/libc/src/threads/tss_get.cpp
+++ b/libc/src/threads/tss_get.cpp
@@ -13,8 +13,8 @@
#include <threads.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(void *, tss_get, (tss_t key)) { return get_tss_value(key); }
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/threads/tss_get.h b/libc/src/threads/tss_get.h
index 4cedce988333fd0..dfdb79cf122b6d7 100644
--- a/libc/src/threads/tss_get.h
+++ b/libc/src/threads/tss_get.h
@@ -11,10 +11,10 @@
#include <threads.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
void *tss_get(tss_t);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_THREADS_TSS_GET_H
diff --git a/libc/src/threads/tss_set.cpp b/libc/src/threads/tss_set.cpp
index 977168a2a98cfd2..640896d14e1c7ba 100644
--- a/libc/src/threads/tss_set.cpp
+++ b/libc/src/threads/tss_set.cpp
@@ -13,7 +13,7 @@
#include <threads.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, tss_set, (tss_t key, void *data)) {
if (set_tss_value(key, data))
@@ -22,4 +22,4 @@ LLVM_LIBC_FUNCTION(int, tss_set, (tss_t key, void *data)) {
return thrd_error;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/threads/tss_set.h b/libc/src/threads/tss_set.h
index 49d69efa62ade33..249607fdc700eba 100644
--- a/libc/src/threads/tss_set.h
+++ b/libc/src/threads/tss_set.h
@@ -11,10 +11,10 @@
#include <threads.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int tss_set(tss_t, void *);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_THREADS_TSS_SET_H
diff --git a/libc/src/time/asctime.cpp b/libc/src/time/asctime.cpp
index 3ccfb042e14498f..9958903d043cf64 100644
--- a/libc/src/time/asctime.cpp
+++ b/libc/src/time/asctime.cpp
@@ -10,13 +10,13 @@
#include "src/__support/common.h"
#include "src/time/time_utils.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
-using __llvm_libc::time_utils::TimeConstants;
+using LIBC_NAMESPACE::time_utils::TimeConstants;
LLVM_LIBC_FUNCTION(char *, asctime, (const struct tm *timeptr)) {
static char buffer[TimeConstants::ASCTIME_BUFFER_SIZE];
return time_utils::asctime(timeptr, buffer, TimeConstants::ASCTIME_MAX_BYTES);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/time/asctime.h b/libc/src/time/asctime.h
index f053ad23eb4e3a2..941cd70250e362b 100644
--- a/libc/src/time/asctime.h
+++ b/libc/src/time/asctime.h
@@ -11,10 +11,10 @@
#include <time.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
char *asctime(const struct tm *timeptr);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_TIME_ASCTIME_H
diff --git a/libc/src/time/asctime_r.cpp b/libc/src/time/asctime_r.cpp
index f957dac3668364b..19a21241829ffde 100644
--- a/libc/src/time/asctime_r.cpp
+++ b/libc/src/time/asctime_r.cpp
@@ -10,13 +10,13 @@
#include "src/__support/common.h"
#include "src/time/time_utils.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
-using __llvm_libc::time_utils::TimeConstants;
+using LIBC_NAMESPACE::time_utils::TimeConstants;
LLVM_LIBC_FUNCTION(char *, asctime_r,
(const struct tm *timeptr, char *buffer)) {
return time_utils::asctime(timeptr, buffer, TimeConstants::ASCTIME_MAX_BYTES);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/time/asctime_r.h b/libc/src/time/asctime_r.h
index 21bba7ebaa3f54d..04d3c01ddd2b768 100644
--- a/libc/src/time/asctime_r.h
+++ b/libc/src/time/asctime_r.h
@@ -11,10 +11,10 @@
#include <time.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
char *asctime_r(const struct tm *timeptr, char *buffer);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_TIME_ASCTIME_R_H
diff --git a/libc/src/time/clock.h b/libc/src/time/clock.h
index 7a259e6f4b89558..d4af7656644a016 100644
--- a/libc/src/time/clock.h
+++ b/libc/src/time/clock.h
@@ -11,10 +11,10 @@
#include <time.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
clock_t clock();
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_TIME_CLOCK_H
diff --git a/libc/src/time/clock_gettime.h b/libc/src/time/clock_gettime.h
index a131251bac973ce..72e2e1949feb69f 100644
--- a/libc/src/time/clock_gettime.h
+++ b/libc/src/time/clock_gettime.h
@@ -11,10 +11,10 @@
#include <time.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int clock_gettime(clockid_t clockid, struct timespec *tp);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_TIME_CLOCK_GETTIME_H
diff --git a/libc/src/time/difftime.cpp b/libc/src/time/difftime.cpp
index 7b4526783f70709..95aa1be7abee11c 100644
--- a/libc/src/time/difftime.cpp
+++ b/libc/src/time/difftime.cpp
@@ -9,10 +9,10 @@
#include "src/time/difftime.h"
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(double, difftime, (time_t end, time_t beginning)) {
return static_cast<double>(end - beginning);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/time/difftime.h b/libc/src/time/difftime.h
index 249dfed4fe819fb..6498b8b943c22fa 100644
--- a/libc/src/time/difftime.h
+++ b/libc/src/time/difftime.h
@@ -11,10 +11,10 @@
#include <time.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
double difftime(time_t end, time_t beginning);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_TIME_DIFFTIME_H
diff --git a/libc/src/time/gettimeofday.h b/libc/src/time/gettimeofday.h
index ee08efba8381bbb..880b94cee7311b8 100644
--- a/libc/src/time/gettimeofday.h
+++ b/libc/src/time/gettimeofday.h
@@ -11,10 +11,10 @@
#include <time.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int gettimeofday(struct timeval *tv, void *tz);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_TIME_GETTIMEOFDAY_H
diff --git a/libc/src/time/gmtime.cpp b/libc/src/time/gmtime.cpp
index 75ce85941b184f4..8597f2201c4ec93 100644
--- a/libc/src/time/gmtime.cpp
+++ b/libc/src/time/gmtime.cpp
@@ -10,11 +10,11 @@
#include "src/__support/common.h"
#include "src/time/time_utils.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(struct tm *, gmtime, (const time_t *timer)) {
static struct tm tm_out;
return time_utils::gmtime_internal(timer, &tm_out);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/time/gmtime.h b/libc/src/time/gmtime.h
index 950ba4f5673ab57..d361eb27febfa04 100644
--- a/libc/src/time/gmtime.h
+++ b/libc/src/time/gmtime.h
@@ -11,10 +11,10 @@
#include <time.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
struct tm *gmtime(const time_t *timer);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_TIME_GMTIME_H
diff --git a/libc/src/time/gmtime_r.cpp b/libc/src/time/gmtime_r.cpp
index 67bf12696e2eeb8..15a0c0687158f3b 100644
--- a/libc/src/time/gmtime_r.cpp
+++ b/libc/src/time/gmtime_r.cpp
@@ -10,11 +10,11 @@
#include "src/__support/common.h"
#include "src/time/time_utils.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(struct tm *, gmtime_r,
(const time_t *timer, struct tm *result)) {
return time_utils::gmtime_internal(timer, result);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/time/gmtime_r.h b/libc/src/time/gmtime_r.h
index 619af603c98dbf2..f7aac287ecc36a7 100644
--- a/libc/src/time/gmtime_r.h
+++ b/libc/src/time/gmtime_r.h
@@ -11,10 +11,10 @@
#include <time.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
struct tm *gmtime_r(const time_t *timer, struct tm *result);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_TIME_GMTIME_R_H
diff --git a/libc/src/time/gpu/clock.cpp b/libc/src/time/gpu/clock.cpp
index 146addd24a7fc88..86cc97e2a3bfb00 100644
--- a/libc/src/time/gpu/clock.cpp
+++ b/libc/src/time/gpu/clock.cpp
@@ -10,7 +10,7 @@
#include "src/time/clock.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(clock_t, clock, ()) {
if (!GPU_CLOCKS_PER_SEC)
@@ -26,4 +26,4 @@ LLVM_LIBC_FUNCTION(clock_t, clock, ()) {
return clock_t(ticks * (CLOCKS_PER_SEC / GPU_CLOCKS_PER_SEC));
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/time/gpu/nanosleep.cpp b/libc/src/time/gpu/nanosleep.cpp
index 52cfecbab9be8dc..a0c735502ff5892 100644
--- a/libc/src/time/gpu/nanosleep.cpp
+++ b/libc/src/time/gpu/nanosleep.cpp
@@ -10,7 +10,7 @@
#include "time_utils.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
constexpr uint64_t TICKS_PER_NS = 1000000000UL;
@@ -68,4 +68,4 @@ LLVM_LIBC_FUNCTION(int, nanosleep,
return 0;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/time/gpu/time_utils.cpp b/libc/src/time/gpu/time_utils.cpp
index ef5e72f208116bb..935a5394e5fdbe0 100644
--- a/libc/src/time/gpu/time_utils.cpp
+++ b/libc/src/time/gpu/time_utils.cpp
@@ -8,7 +8,7 @@
#include "time_utils.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
#if defined(LIBC_TARGET_ARCH_IS_AMDGPU)
// This is expected to be initialized by the runtime if the default value is
@@ -16,7 +16,7 @@ namespace __llvm_libc {
// TODO: Once we have another use-case for this we should put it in a common
// device environment struct.
extern "C" [[gnu::visibility("protected")]] uint64_t
- [[clang::address_space(4)]] __llvm_libc_clock_freq = clock_freq;
+ [[clang::address_space(4)]] LIBC_NAMESPACE_clock_freq = clock_freq;
#endif
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/time/gpu/time_utils.h b/libc/src/time/gpu/time_utils.h
index da9cd3eebe7ebb9..075fcb61768ec7e 100644
--- a/libc/src/time/gpu/time_utils.h
+++ b/libc/src/time/gpu/time_utils.h
@@ -11,7 +11,7 @@
#include "src/__support/GPU/utils.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
#if defined(LIBC_TARGET_ARCH_IS_AMDGPU)
// AMDGPU does not have a single set frequency. Different architectures and
@@ -39,8 +39,8 @@ constexpr uint64_t clock_freq = 0;
// We provide an externally visible symbol such that the runtime can set this to
// the correct value. If it is not set we try to default to the known values.
extern "C" [[gnu::visibility("protected")]] uint64_t
- [[clang::address_space(4)]] __llvm_libc_clock_freq;
-#define GPU_CLOCKS_PER_SEC static_cast<clock_t>(__llvm_libc_clock_freq)
+ [[clang::address_space(4)]] LIBC_NAMESPACE_clock_freq;
+#define GPU_CLOCKS_PER_SEC static_cast<clock_t>(LIBC_NAMESPACE_clock_freq)
#elif defined(LIBC_TARGET_ARCH_IS_NVPTX)
// NPVTX uses a single 1 GHz fixed frequency clock for all target architectures.
@@ -49,6 +49,6 @@ extern "C" [[gnu::visibility("protected")]] uint64_t
#error "Unsupported target"
#endif
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_TIME_GPU_TIME_UTILS_H
diff --git a/libc/src/time/linux/clock.cpp b/libc/src/time/linux/clock.cpp
index cf27f5c2995712a..1e95f0526bc9c4a 100644
--- a/libc/src/time/linux/clock.cpp
+++ b/libc/src/time/linux/clock.cpp
@@ -17,7 +17,7 @@
#include <sys/syscall.h> // For syscall numbers.
#include <time.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(clock_t, clock, ()) {
struct timespec ts;
@@ -45,4 +45,4 @@ LLVM_LIBC_FUNCTION(clock_t, clock, ()) {
ts.tv_nsec / (1000000000 / CLOCKS_PER_SEC));
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/time/linux/clockGetTimeImpl.h b/libc/src/time/linux/clockGetTimeImpl.h
index e519ebcdddbdb9e..8c8c9fcf845cc7e 100644
--- a/libc/src/time/linux/clockGetTimeImpl.h
+++ b/libc/src/time/linux/clockGetTimeImpl.h
@@ -18,22 +18,22 @@
#include <sys/syscall.h> // For syscall numbers.
#include <time.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
namespace internal {
LIBC_INLINE ErrorOr<int> clock_gettimeimpl(clockid_t clockid,
struct timespec *ts) {
#if SYS_clock_gettime
- int ret = __llvm_libc::syscall_impl<int>(SYS_clock_gettime,
- static_cast<long>(clockid),
- reinterpret_cast<long>(ts));
+ int ret = LIBC_NAMESPACE::syscall_impl<int>(SYS_clock_gettime,
+ static_cast<long>(clockid),
+ reinterpret_cast<long>(ts));
#elif defined(SYS_clock_gettime64)
static_assert(
sizeof(time_t) == sizeof(int64_t),
"SYS_clock_gettime64 requires struct timespec with 64-bit members.");
- int ret = __llvm_libc::syscall_impl<int>(SYS_clock_gettime64,
- static_cast<long>(clockid),
- reinterpret_cast<long>(ts));
+ int ret = LIBC_NAMESPACE::syscall_impl<int>(SYS_clock_gettime64,
+ static_cast<long>(clockid),
+ reinterpret_cast<long>(ts));
#else
#error "SYS_clock_gettime and SYS_clock_gettime64 syscalls not available."
#endif
@@ -43,6 +43,6 @@ LIBC_INLINE ErrorOr<int> clock_gettimeimpl(clockid_t clockid,
}
} // namespace internal
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_TIME_LINUX_CLOCKGETTIMEIMPL_H
diff --git a/libc/src/time/linux/clock_gettime.cpp b/libc/src/time/linux/clock_gettime.cpp
index 33ec04eb352743e..47e974a866c8322 100644
--- a/libc/src/time/linux/clock_gettime.cpp
+++ b/libc/src/time/linux/clock_gettime.cpp
@@ -16,7 +16,7 @@
#include <sys/syscall.h> // For syscall numbers.
#include <time.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
// TODO(michaelrj): Move this into time/linux with the other syscalls.
LLVM_LIBC_FUNCTION(int, clock_gettime,
@@ -32,4 +32,4 @@ LLVM_LIBC_FUNCTION(int, clock_gettime,
return 0;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/time/linux/gettimeofday.cpp b/libc/src/time/linux/gettimeofday.cpp
index 2df6429974164a9..07ab4d579176edd 100644
--- a/libc/src/time/linux/gettimeofday.cpp
+++ b/libc/src/time/linux/gettimeofday.cpp
@@ -15,7 +15,7 @@
#include <sys/syscall.h> // For syscall numbers.
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
// TODO(michaelrj): Move this into time/linux with the other syscalls.
LLVM_LIBC_FUNCTION(int, gettimeofday,
@@ -38,4 +38,4 @@ LLVM_LIBC_FUNCTION(int, gettimeofday,
return 0;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/time/linux/nanosleep.cpp b/libc/src/time/linux/nanosleep.cpp
index 8c76dac75a176ad..bcfe567191f25f3 100644
--- a/libc/src/time/linux/nanosleep.cpp
+++ b/libc/src/time/linux/nanosleep.cpp
@@ -15,18 +15,18 @@
#include <stdint.h> // For int64_t.
#include <sys/syscall.h> // For syscall numbers.
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, nanosleep,
(const struct timespec *req, struct timespec *rem)) {
#if SYS_nanosleep
- int ret = __llvm_libc::syscall_impl<int>(SYS_nanosleep, req, rem);
+ int ret = LIBC_NAMESPACE::syscall_impl<int>(SYS_nanosleep, req, rem);
#elif defined(SYS_clock_nanosleep_time64)
static_assert(
sizeof(time_t) == sizeof(int64_t),
"SYS_clock_gettime64 requires struct timespec with 64-bit members.");
- int ret = __llvm_libc::syscall_impl<int>(SYS_clock_nanosleep_time64,
- CLOCK_REALTIME, 0, req, rem);
+ int ret = LIBC_NAMESPACE::syscall_impl<int>(SYS_clock_nanosleep_time64,
+ CLOCK_REALTIME, 0, req, rem);
#else
#error "SYS_nanosleep and SYS_clock_nanosleep_time64 syscalls not available."
#endif
@@ -38,4 +38,4 @@ LLVM_LIBC_FUNCTION(int, nanosleep,
return ret;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/time/linux/time.cpp b/libc/src/time/linux/time.cpp
index 4dbcabc8963510a..e286fae095b2aee 100644
--- a/libc/src/time/linux/time.cpp
+++ b/libc/src/time/linux/time.cpp
@@ -16,7 +16,7 @@
#include <sys/syscall.h> // For syscall numbers.
#include <time.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(time_t, time, (time_t * tp)) {
// TODO: Use the Linux VDSO to fetch the time and avoid the syscall.
@@ -32,4 +32,4 @@ LLVM_LIBC_FUNCTION(time_t, time, (time_t * tp)) {
return time_t(ts.tv_sec);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/time/mktime.cpp b/libc/src/time/mktime.cpp
index 3b3ea339f850f96..e57565f0d1fe016 100644
--- a/libc/src/time/mktime.cpp
+++ b/libc/src/time/mktime.cpp
@@ -12,9 +12,9 @@
#include <limits.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
-using __llvm_libc::time_utils::TimeConstants;
+using LIBC_NAMESPACE::time_utils::TimeConstants;
static constexpr int NON_LEAP_YEAR_DAYS_IN_MONTH[] = {31, 28, 31, 30, 31, 30,
31, 31, 30, 31, 30, 31};
@@ -114,4 +114,4 @@ LLVM_LIBC_FUNCTION(time_t, mktime, (struct tm * tm_out)) {
return static_cast<time_t>(seconds);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/time/mktime.h b/libc/src/time/mktime.h
index efe9cf44565a4c1..a50e97c52321b34 100644
--- a/libc/src/time/mktime.h
+++ b/libc/src/time/mktime.h
@@ -11,10 +11,10 @@
#include <time.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
time_t mktime(struct tm *t1);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_TIME_MKTIME_H
diff --git a/libc/src/time/nanosleep.h b/libc/src/time/nanosleep.h
index d8ecfb758f93c72..757394232c07905 100644
--- a/libc/src/time/nanosleep.h
+++ b/libc/src/time/nanosleep.h
@@ -11,10 +11,10 @@
#include <time.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int nanosleep(const struct timespec *req, struct timespec *rem);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_TIME_NANOSLEEP_H
diff --git a/libc/src/time/time_func.h b/libc/src/time/time_func.h
index a24834c50b62502..beb02020b575959 100644
--- a/libc/src/time/time_func.h
+++ b/libc/src/time/time_func.h
@@ -13,10 +13,10 @@
// Note this header file is named time_func.h to avoid conflicts with the
// public header file time.h.
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
time_t time(time_t *tp);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_TIME_TIME_FUNC_H
diff --git a/libc/src/time/time_utils.cpp b/libc/src/time/time_utils.cpp
index fadd26f97dfc228..199a74cb168a2c3 100644
--- a/libc/src/time/time_utils.cpp
+++ b/libc/src/time/time_utils.cpp
@@ -11,10 +11,10 @@
#include <limits.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
namespace time_utils {
-using __llvm_libc::time_utils::TimeConstants;
+using LIBC_NAMESPACE::time_utils::TimeConstants;
static int64_t computeRemainingYears(int64_t daysPerYears,
int64_t quotientYears,
@@ -151,4 +151,4 @@ int64_t update_from_seconds(int64_t total_seconds, struct tm *tm) {
}
} // namespace time_utils
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/time/time_utils.h b/libc/src/time/time_utils.h
index 424e7521504d917..a5da3ad74f34339 100644
--- a/libc/src/time/time_utils.h
+++ b/libc/src/time/time_utils.h
@@ -17,7 +17,7 @@
#include <stdint.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
namespace time_utils {
enum Month : int {
@@ -151,6 +151,6 @@ LIBC_INLINE struct tm *gmtime_internal(const time_t *timer, struct tm *result) {
}
} // namespace time_utils
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_TIME_TIME_UTILS_H
diff --git a/libc/src/unistd/access.h b/libc/src/unistd/access.h
index 2454e805731f97d..7623c853091fd05 100644
--- a/libc/src/unistd/access.h
+++ b/libc/src/unistd/access.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_UNISTD_ACCESS_H
#define LLVM_LIBC_SRC_UNISTD_ACCESS_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int access(const char *path, int mode);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_UNISTD_ACCESS_H
diff --git a/libc/src/unistd/chdir.h b/libc/src/unistd/chdir.h
index 228b78fc799249b..ca1dd356b7cfe21 100644
--- a/libc/src/unistd/chdir.h
+++ b/libc/src/unistd/chdir.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_UNISTD_CHDIR_H
#define LLVM_LIBC_SRC_UNISTD_CHDIR_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int chdir(const char *path);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_UNISTD_CHDIR_H
diff --git a/libc/src/unistd/close.h b/libc/src/unistd/close.h
index 56fce1172a16581..02e01c24120a0b9 100644
--- a/libc/src/unistd/close.h
+++ b/libc/src/unistd/close.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_UNISTD_CLOSE_H
#define LLVM_LIBC_SRC_UNISTD_CLOSE_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int close(int fd);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_UNISTD_CLOSE_H
diff --git a/libc/src/unistd/dup.h b/libc/src/unistd/dup.h
index 21b358251ea918f..d6daa5a9ad74d59 100644
--- a/libc/src/unistd/dup.h
+++ b/libc/src/unistd/dup.h
@@ -11,10 +11,10 @@
#include <unistd.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int dup(int fd);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_UNISTD_DUP_H
diff --git a/libc/src/unistd/dup2.h b/libc/src/unistd/dup2.h
index 39e4da8c19fbbe1..ba8c5f4b1601036 100644
--- a/libc/src/unistd/dup2.h
+++ b/libc/src/unistd/dup2.h
@@ -11,10 +11,10 @@
#include <unistd.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int dup2(int oldfd, int newfd);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_UNISTD_DUP2_H
diff --git a/libc/src/unistd/dup3.h b/libc/src/unistd/dup3.h
index c7e107071b7dac9..2b1082403daff78 100644
--- a/libc/src/unistd/dup3.h
+++ b/libc/src/unistd/dup3.h
@@ -11,10 +11,10 @@
#include <unistd.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int dup3(int oldfd, int newfd, int flags);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_UNISTD_DUP3_H
diff --git a/libc/src/unistd/environ.cpp b/libc/src/unistd/environ.cpp
index 2a554fd9fcb4c71..2266c7203273dba 100644
--- a/libc/src/unistd/environ.cpp
+++ b/libc/src/unistd/environ.cpp
@@ -6,11 +6,11 @@
//
//===----------------------------------------------------------------------===//
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
// This is initialized to the correct value by the statup code.
extern "C" {
char **environ = nullptr;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/unistd/environ.h b/libc/src/unistd/environ.h
index eb808411ac1875f..c09a04f99f88300 100644
--- a/libc/src/unistd/environ.h
+++ b/libc/src/unistd/environ.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_UNISTD_ENVIRON_H
#define LLVM_LIBC_SRC_UNISTD_ENVIRON_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
extern "C" char **environ;
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_UNISTD_ENVIRON_H
diff --git a/libc/src/unistd/execv.h b/libc/src/unistd/execv.h
index f26a5831781c465..7ff366464b4c8d1 100644
--- a/libc/src/unistd/execv.h
+++ b/libc/src/unistd/execv.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_UNISTD_EXECV_H
#define LLVM_LIBC_SRC_UNISTD_EXECV_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int execv(const char *path, char *const argv[]);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_UNISTD_EXECV_H
diff --git a/libc/src/unistd/execve.h b/libc/src/unistd/execve.h
index 48ac78d9b575dbd..0054a47d4ddd703 100644
--- a/libc/src/unistd/execve.h
+++ b/libc/src/unistd/execve.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_UNISTD_EXECVE_H
#define LLVM_LIBC_SRC_UNISTD_EXECVE_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int execve(const char *path, char *const argv[], char *const envp[]);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_UNISTD_EXECVE_H
diff --git a/libc/src/unistd/fchdir.h b/libc/src/unistd/fchdir.h
index 3d402e62f40665e..267785c919f5559 100644
--- a/libc/src/unistd/fchdir.h
+++ b/libc/src/unistd/fchdir.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_UNISTD_FCHDIR_H
#define LLVM_LIBC_SRC_UNISTD_FCHDIR_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int fchdir(int fd);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_UNISTD_FCHDIR_H
diff --git a/libc/src/unistd/fork.h b/libc/src/unistd/fork.h
index 8d591dd8667c5c9..6b1b72a7dfc0893 100644
--- a/libc/src/unistd/fork.h
+++ b/libc/src/unistd/fork.h
@@ -11,10 +11,10 @@
#include <unistd.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
pid_t fork();
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_UNISTD_FORK_H
diff --git a/libc/src/unistd/fsync.h b/libc/src/unistd/fsync.h
index 12e5d740b1885b4..b5742de359d94d8 100644
--- a/libc/src/unistd/fsync.h
+++ b/libc/src/unistd/fsync.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_UNISTD_FSYNC_H
#define LLVM_LIBC_SRC_UNISTD_FSYNC_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int fsync(int fd);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_UNISTD_FSYNC_H
diff --git a/libc/src/unistd/ftruncate.h b/libc/src/unistd/ftruncate.h
index 1971dc53af2d73e..5508ef0718e9423 100644
--- a/libc/src/unistd/ftruncate.h
+++ b/libc/src/unistd/ftruncate.h
@@ -11,10 +11,10 @@
#include <unistd.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int ftruncate(int, off_t);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_UNISTD_FTRUNCATE_H
diff --git a/libc/src/unistd/getcwd.h b/libc/src/unistd/getcwd.h
index 8a6947f09a12465..ab7038e453276c8 100644
--- a/libc/src/unistd/getcwd.h
+++ b/libc/src/unistd/getcwd.h
@@ -11,10 +11,10 @@
#include <unistd.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
char *getcwd(char *buf, size_t size);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_UNISTD_GETCWD_H
diff --git a/libc/src/unistd/geteuid.h b/libc/src/unistd/geteuid.h
index 0df98fbee955330..f19cbaefd5792a6 100644
--- a/libc/src/unistd/geteuid.h
+++ b/libc/src/unistd/geteuid.h
@@ -11,10 +11,10 @@
#include <unistd.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
uid_t geteuid();
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_UNISTD_GETEUID_H
diff --git a/libc/src/unistd/getopt.cpp b/libc/src/unistd/getopt.cpp
index d063a43202136a8..ccdfdc6c64666f7 100644
--- a/libc/src/unistd/getopt.cpp
+++ b/libc/src/unistd/getopt.cpp
@@ -19,7 +19,7 @@
// just the re-ordering of argv elements such that unknown arguments can be
// easily iterated over.
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
template <typename T> struct RefWrapper {
RefWrapper() = delete;
@@ -45,8 +45,9 @@ struct GetoptContext {
template <typename... Ts> void report_error(const char *fmt, Ts... ts) {
if (opterr)
- __llvm_libc::fprintf(
- errstream ? errstream : reinterpret_cast<FILE *>(__llvm_libc::stderr),
+ LIBC_NAMESPACE::fprintf(
+ errstream ? errstream
+ : reinterpret_cast<FILE *>(LIBC_NAMESPACE::stderr),
fmt, ts...);
}
};
@@ -201,4 +202,4 @@ LLVM_LIBC_FUNCTION(int, getopt,
return getopt_r(argc, argv, optstring, impl::ctx);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/unistd/getopt.h b/libc/src/unistd/getopt.h
index 0bc7ed6a1b1934f..ae27958756f44ac 100644
--- a/libc/src/unistd/getopt.h
+++ b/libc/src/unistd/getopt.h
@@ -12,7 +12,7 @@
#include <stdio.h>
#include <unistd.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
namespace impl {
void set_getopt_state(char **, int *, int *, unsigned *, int *, FILE *);
@@ -20,6 +20,6 @@ void set_getopt_state(char **, int *, int *, unsigned *, int *, FILE *);
int getopt(int argc, char *const argv[], const char *optstring);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_UNISTD_GETOPT_H
diff --git a/libc/src/unistd/getpid.h b/libc/src/unistd/getpid.h
index 7b6b9b1600ccd7c..5890dbf63681a9e 100644
--- a/libc/src/unistd/getpid.h
+++ b/libc/src/unistd/getpid.h
@@ -11,10 +11,10 @@
#include <unistd.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
pid_t getpid();
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_UNISTD_GETPID_H
diff --git a/libc/src/unistd/getppid.h b/libc/src/unistd/getppid.h
index c5744778b5f9787..a09c7ca2241872a 100644
--- a/libc/src/unistd/getppid.h
+++ b/libc/src/unistd/getppid.h
@@ -11,10 +11,10 @@
#include <unistd.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
pid_t getppid();
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_UNISTD_GETPPID_H
diff --git a/libc/src/unistd/getuid.h b/libc/src/unistd/getuid.h
index e3501ca04bf9941..35163783518c7da 100644
--- a/libc/src/unistd/getuid.h
+++ b/libc/src/unistd/getuid.h
@@ -11,10 +11,10 @@
#include <unistd.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
uid_t getuid();
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_UNISTD_GETUID_H
diff --git a/libc/src/unistd/isatty.h b/libc/src/unistd/isatty.h
index cffee57e0f2eca4..90a169730fe0425 100644
--- a/libc/src/unistd/isatty.h
+++ b/libc/src/unistd/isatty.h
@@ -11,10 +11,10 @@
#include <unistd.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int isatty(int fd);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_UNISTD_ISATTY_H
diff --git a/libc/src/unistd/link.h b/libc/src/unistd/link.h
index 492274286e0449f..a95111f3a7f9697 100644
--- a/libc/src/unistd/link.h
+++ b/libc/src/unistd/link.h
@@ -11,10 +11,10 @@
#include <unistd.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int link(const char *, const char *);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_UNISTD_LINK_H
diff --git a/libc/src/unistd/linkat.h b/libc/src/unistd/linkat.h
index 7bc161952a8663a..c53b87e5d11947b 100644
--- a/libc/src/unistd/linkat.h
+++ b/libc/src/unistd/linkat.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_UNISTD_LINKAT_H
#define LLVM_LIBC_SRC_UNISTD_LINKAT_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int linkat(int, const char *, int, const char *, int);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_UNISTD_LINKAT_H
diff --git a/libc/src/unistd/linux/access.cpp b/libc/src/unistd/linux/access.cpp
index 195a1c2c78d531d..f062ad43e75ff2d 100644
--- a/libc/src/unistd/linux/access.cpp
+++ b/libc/src/unistd/linux/access.cpp
@@ -15,14 +15,14 @@
#include <fcntl.h>
#include <sys/syscall.h> // For syscall numbers.
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, access, (const char *path, int mode)) {
#ifdef SYS_access
- int ret = __llvm_libc::syscall_impl<int>(SYS_access, path, mode);
+ int ret = LIBC_NAMESPACE::syscall_impl<int>(SYS_access, path, mode);
#elif defined(SYS_faccessat)
int ret =
- __llvm_libc::syscall_impl<int>(SYS_faccessat, AT_FDCWD, path, mode, 0);
+ LIBC_NAMESPACE::syscall_impl<int>(SYS_faccessat, AT_FDCWD, path, mode, 0);
#else
#error "access and faccessat syscalls not available."
#endif
@@ -34,4 +34,4 @@ LLVM_LIBC_FUNCTION(int, access, (const char *path, int mode)) {
return 0;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/unistd/linux/chdir.cpp b/libc/src/unistd/linux/chdir.cpp
index b3078d1e9d2fd2c..61d44ff1c8088e3 100644
--- a/libc/src/unistd/linux/chdir.cpp
+++ b/libc/src/unistd/linux/chdir.cpp
@@ -14,10 +14,10 @@
#include "src/errno/libc_errno.h"
#include <sys/syscall.h> // For syscall numbers.
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, chdir, (const char *path)) {
- int ret = __llvm_libc::syscall_impl<int>(SYS_chdir, path);
+ int ret = LIBC_NAMESPACE::syscall_impl<int>(SYS_chdir, path);
if (ret < 0) {
libc_errno = -ret;
return -1;
@@ -25,4 +25,4 @@ LLVM_LIBC_FUNCTION(int, chdir, (const char *path)) {
return 0;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/unistd/linux/close.cpp b/libc/src/unistd/linux/close.cpp
index 49cac104db48fd7..084334861abdc7f 100644
--- a/libc/src/unistd/linux/close.cpp
+++ b/libc/src/unistd/linux/close.cpp
@@ -14,10 +14,10 @@
#include "src/errno/libc_errno.h"
#include <sys/syscall.h> // For syscall numbers.
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, close, (int fd)) {
- int ret = __llvm_libc::syscall_impl<int>(SYS_close, fd);
+ int ret = LIBC_NAMESPACE::syscall_impl<int>(SYS_close, fd);
if (ret < 0) {
libc_errno = -ret;
return -1;
@@ -25,4 +25,4 @@ LLVM_LIBC_FUNCTION(int, close, (int fd)) {
return ret;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/unistd/linux/dup.cpp b/libc/src/unistd/linux/dup.cpp
index 423d1db5a35e8bd..a2e7d3fdec4295b 100644
--- a/libc/src/unistd/linux/dup.cpp
+++ b/libc/src/unistd/linux/dup.cpp
@@ -14,10 +14,10 @@
#include "src/errno/libc_errno.h"
#include <sys/syscall.h> // For syscall numbers.
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, dup, (int fd)) {
- int ret = __llvm_libc::syscall_impl<int>(SYS_dup, fd);
+ int ret = LIBC_NAMESPACE::syscall_impl<int>(SYS_dup, fd);
if (ret < 0) {
libc_errno = -ret;
return -1;
@@ -25,4 +25,4 @@ LLVM_LIBC_FUNCTION(int, dup, (int fd)) {
return ret;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/unistd/linux/dup2.cpp b/libc/src/unistd/linux/dup2.cpp
index 4a537feef2cb929..f6804e2deca5c4f 100644
--- a/libc/src/unistd/linux/dup2.cpp
+++ b/libc/src/unistd/linux/dup2.cpp
@@ -15,12 +15,12 @@
#include <fcntl.h>
#include <sys/syscall.h> // For syscall numbers.
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, dup2, (int oldfd, int newfd)) {
#ifdef SYS_dup2
// If dup2 syscall is available, we make use of directly.
- int ret = __llvm_libc::syscall_impl<int>(SYS_dup2, oldfd, newfd);
+ int ret = LIBC_NAMESPACE::syscall_impl<int>(SYS_dup2, oldfd, newfd);
#elif defined(SYS_dup3)
// If dup2 syscall is not available, we try using the dup3 syscall. However,
// dup3 fails if oldfd is the same as newfd. So, we handle that case
@@ -28,11 +28,11 @@ LLVM_LIBC_FUNCTION(int, dup2, (int oldfd, int newfd)) {
if (oldfd == newfd) {
// Check if oldfd is actually a valid file descriptor.
#if SYS_fcntl
- int ret = __llvm_libc::syscall_impl<int>(SYS_fcntl, oldfd, F_GETFD);
+ int ret = LIBC_NAMESPACE::syscall_impl<int>(SYS_fcntl, oldfd, F_GETFD);
#elif defined(SYS_fcntl64)
// Same as fcntl but can handle large offsets
static_assert(sizeof(off_t) == 8);
- int ret = __llvm_libc::syscall_impl<int>(SYS_fcntl64, oldfd, F_GETFD);
+ int ret = LIBC_NAMESPACE::syscall_impl<int>(SYS_fcntl64, oldfd, F_GETFD);
#else
#error "SYS_fcntl and SYS_fcntl64 syscalls not available."
#endif
@@ -41,7 +41,7 @@ LLVM_LIBC_FUNCTION(int, dup2, (int oldfd, int newfd)) {
libc_errno = -ret;
return -1;
}
- int ret = __llvm_libc::syscall_impl<int>(SYS_dup3, oldfd, newfd, 0);
+ int ret = LIBC_NAMESPACE::syscall_impl<int>(SYS_dup3, oldfd, newfd, 0);
#else
#error "dup2 and dup3 syscalls not available."
#endif
@@ -52,4 +52,4 @@ LLVM_LIBC_FUNCTION(int, dup2, (int oldfd, int newfd)) {
return ret;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/unistd/linux/dup3.cpp b/libc/src/unistd/linux/dup3.cpp
index bb0d18c499fae84..bf2c25728ca6a9a 100644
--- a/libc/src/unistd/linux/dup3.cpp
+++ b/libc/src/unistd/linux/dup3.cpp
@@ -14,15 +14,15 @@
#include "src/errno/libc_errno.h"
#include <sys/syscall.h> // For syscall numbers.
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, dup3, (int oldfd, int newfd, int flags)) {
// If dup2 syscall is available, we make use of directly.
- int ret = __llvm_libc::syscall_impl<int>(SYS_dup3, oldfd, newfd, flags);
+ int ret = LIBC_NAMESPACE::syscall_impl<int>(SYS_dup3, oldfd, newfd, flags);
if (ret >= 0)
return ret;
libc_errno = -ret;
return -1;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/unistd/linux/execv.cpp b/libc/src/unistd/linux/execv.cpp
index c57ee8ef49f057b..bd134ca523c774f 100644
--- a/libc/src/unistd/linux/execv.cpp
+++ b/libc/src/unistd/linux/execv.cpp
@@ -15,11 +15,11 @@
#include "src/errno/libc_errno.h"
#include <sys/syscall.h> // For syscall numbers.
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, execv, (const char *path, char *const argv[])) {
- int ret = __llvm_libc::syscall_impl<int>(SYS_execve, path, argv,
- __llvm_libc::environ);
+ int ret = LIBC_NAMESPACE::syscall_impl<int>(SYS_execve, path, argv,
+ LIBC_NAMESPACE::environ);
if (ret < 0) {
libc_errno = -ret;
return -1;
@@ -30,4 +30,4 @@ LLVM_LIBC_FUNCTION(int, execv, (const char *path, char *const argv[])) {
return ret;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/unistd/linux/execve.cpp b/libc/src/unistd/linux/execve.cpp
index 5eb875d7019642c..b6de0a400c4401a 100644
--- a/libc/src/unistd/linux/execve.cpp
+++ b/libc/src/unistd/linux/execve.cpp
@@ -15,11 +15,11 @@
#include "src/errno/libc_errno.h"
#include <sys/syscall.h> // For syscall numbers.
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, execve,
(const char *path, char *const argv[], char *const envp[])) {
- int ret = __llvm_libc::syscall_impl<int>(SYS_execve, path, argv, envp);
+ int ret = LIBC_NAMESPACE::syscall_impl<int>(SYS_execve, path, argv, envp);
if (ret < 0) {
libc_errno = -ret;
return -1;
@@ -30,4 +30,4 @@ LLVM_LIBC_FUNCTION(int, execve,
return ret;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/unistd/linux/fchdir.cpp b/libc/src/unistd/linux/fchdir.cpp
index 4bfca8df58eff3a..d24b9badfe44816 100644
--- a/libc/src/unistd/linux/fchdir.cpp
+++ b/libc/src/unistd/linux/fchdir.cpp
@@ -14,10 +14,10 @@
#include "src/errno/libc_errno.h"
#include <sys/syscall.h> // For syscall numbers.
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, fchdir, (int fd)) {
- int ret = __llvm_libc::syscall_impl<int>(SYS_fchdir, fd);
+ int ret = LIBC_NAMESPACE::syscall_impl<int>(SYS_fchdir, fd);
if (ret < 0) {
libc_errno = -ret;
return -1;
@@ -25,4 +25,4 @@ LLVM_LIBC_FUNCTION(int, fchdir, (int fd)) {
return 0;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/unistd/linux/fork.cpp b/libc/src/unistd/linux/fork.cpp
index 0cc37e7aaaf848e..6fa2b990b19a93d 100644
--- a/libc/src/unistd/linux/fork.cpp
+++ b/libc/src/unistd/linux/fork.cpp
@@ -17,7 +17,7 @@
#include <signal.h> // For SIGCHLD
#include <sys/syscall.h> // For syscall numbers.
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
// The implementation of fork here is very minimal. We will add more
// functionality and standard compliance in future.
@@ -25,9 +25,9 @@ namespace __llvm_libc {
LLVM_LIBC_FUNCTION(pid_t, fork, (void)) {
invoke_prepare_callbacks();
#ifdef SYS_fork
- pid_t ret = __llvm_libc::syscall_impl<pid_t>(SYS_fork);
+ pid_t ret = LIBC_NAMESPACE::syscall_impl<pid_t>(SYS_fork);
#elif defined(SYS_clone)
- pid_t ret = __llvm_libc::syscall_impl<pid_t>(SYS_clone, SIGCHLD, 0);
+ pid_t ret = LIBC_NAMESPACE::syscall_impl<pid_t>(SYS_clone, SIGCHLD, 0);
#else
#error "fork and clone syscalls not available."
#endif
@@ -36,7 +36,7 @@ LLVM_LIBC_FUNCTION(pid_t, fork, (void)) {
// The child is created with a single thread whose self object will be a
// copy of parent process' thread which called fork. So, we have to fix up
// the child process' self object with the new process' tid.
- self.attrib->tid = __llvm_libc::syscall_impl<pid_t>(SYS_gettid);
+ self.attrib->tid = LIBC_NAMESPACE::syscall_impl<pid_t>(SYS_gettid);
invoke_child_callbacks();
return 0;
}
@@ -51,4 +51,4 @@ LLVM_LIBC_FUNCTION(pid_t, fork, (void)) {
return ret;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/unistd/linux/fsync.cpp b/libc/src/unistd/linux/fsync.cpp
index 199378f82184b89..44d504ec459e3cc 100644
--- a/libc/src/unistd/linux/fsync.cpp
+++ b/libc/src/unistd/linux/fsync.cpp
@@ -14,10 +14,10 @@
#include "src/errno/libc_errno.h"
#include <sys/syscall.h> // For syscall numbers.
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, fsync, (int fd)) {
- int ret = __llvm_libc::syscall_impl<int>(SYS_fsync, fd);
+ int ret = LIBC_NAMESPACE::syscall_impl<int>(SYS_fsync, fd);
if (ret < 0) {
libc_errno = -ret;
return -1;
@@ -25,4 +25,4 @@ LLVM_LIBC_FUNCTION(int, fsync, (int fd)) {
return ret;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/unistd/linux/ftruncate.cpp b/libc/src/unistd/linux/ftruncate.cpp
index aebdfb60ffe4907..795bb98ceae0cc8 100644
--- a/libc/src/unistd/linux/ftruncate.cpp
+++ b/libc/src/unistd/linux/ftruncate.cpp
@@ -16,16 +16,16 @@
#include <sys/syscall.h> // For syscall numbers.
#include <unistd.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, ftruncate, (int fd, off_t len)) {
#ifdef SYS_ftruncate
- int ret = __llvm_libc::syscall_impl<int>(SYS_ftruncate, fd, len);
+ int ret = LIBC_NAMESPACE::syscall_impl<int>(SYS_ftruncate, fd, len);
#elif defined(SYS_ftruncate64)
// Same as ftruncate but can handle large offsets
static_assert(sizeof(off_t) == 8);
- int ret = __llvm_libc::syscall_impl<int>(SYS_ftruncate64, fd, (long)len,
- (long)(((uint64_t)(len)) >> 32));
+ int ret = LIBC_NAMESPACE::syscall_impl<int>(SYS_ftruncate64, fd, (long)len,
+ (long)(((uint64_t)(len)) >> 32));
#else
#error "ftruncate and ftruncate64 syscalls not available."
#endif
@@ -37,4 +37,4 @@ LLVM_LIBC_FUNCTION(int, ftruncate, (int fd, off_t len)) {
return 0;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/unistd/linux/getcwd.cpp b/libc/src/unistd/linux/getcwd.cpp
index 3a25ea990150fb1..11c58f1585564d9 100644
--- a/libc/src/unistd/linux/getcwd.cpp
+++ b/libc/src/unistd/linux/getcwd.cpp
@@ -17,12 +17,12 @@
#include <stdlib.h>
#include <sys/syscall.h> // For syscall numbers.
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
namespace {
bool getcwd_syscall(char *buf, size_t size) {
- int ret = __llvm_libc::syscall_impl<int>(SYS_getcwd, buf, size);
+ int ret = LIBC_NAMESPACE::syscall_impl<int>(SYS_getcwd, buf, size);
if (ret < 0) {
libc_errno = -ret;
return false;
@@ -63,4 +63,4 @@ LLVM_LIBC_FUNCTION(char *, getcwd, (char *buf, size_t size)) {
return buf;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/unistd/linux/geteuid.cpp b/libc/src/unistd/linux/geteuid.cpp
index ac1d07b9b8d46fa..2a7f163fb8cd473 100644
--- a/libc/src/unistd/linux/geteuid.cpp
+++ b/libc/src/unistd/linux/geteuid.cpp
@@ -13,10 +13,10 @@
#include <sys/syscall.h> // For syscall numbers.
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(uid_t, geteuid, ()) {
- return __llvm_libc::syscall_impl<uid_t>(SYS_geteuid);
+ return LIBC_NAMESPACE::syscall_impl<uid_t>(SYS_geteuid);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/unistd/linux/getpid.cpp b/libc/src/unistd/linux/getpid.cpp
index ae763d821e15188..85730738ca2ef63 100644
--- a/libc/src/unistd/linux/getpid.cpp
+++ b/libc/src/unistd/linux/getpid.cpp
@@ -13,10 +13,10 @@
#include <sys/syscall.h> // For syscall numbers.
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(pid_t, getpid, ()) {
- return __llvm_libc::syscall_impl<pid_t>(SYS_getpid);
+ return LIBC_NAMESPACE::syscall_impl<pid_t>(SYS_getpid);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/unistd/linux/getppid.cpp b/libc/src/unistd/linux/getppid.cpp
index e722c36a17c36ad..7ee11f32fd00838 100644
--- a/libc/src/unistd/linux/getppid.cpp
+++ b/libc/src/unistd/linux/getppid.cpp
@@ -13,10 +13,10 @@
#include <sys/syscall.h> // For syscall numbers.
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(pid_t, getppid, ()) {
- return __llvm_libc::syscall_impl<pid_t>(SYS_getppid);
+ return LIBC_NAMESPACE::syscall_impl<pid_t>(SYS_getppid);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/unistd/linux/getuid.cpp b/libc/src/unistd/linux/getuid.cpp
index f214ffd15fda51b..c8131803c84aa69 100644
--- a/libc/src/unistd/linux/getuid.cpp
+++ b/libc/src/unistd/linux/getuid.cpp
@@ -13,10 +13,10 @@
#include <sys/syscall.h> // For syscall numbers.
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(uid_t, getuid, ()) {
- return __llvm_libc::syscall_impl<uid_t>(SYS_getuid);
+ return LIBC_NAMESPACE::syscall_impl<uid_t>(SYS_getuid);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/unistd/linux/isatty.cpp b/libc/src/unistd/linux/isatty.cpp
index d81ae5aab22c0c7..205013897525b33 100644
--- a/libc/src/unistd/linux/isatty.cpp
+++ b/libc/src/unistd/linux/isatty.cpp
@@ -15,7 +15,7 @@
#include <sys/ioctl.h> // For ioctl numbers.
#include <sys/syscall.h> // For syscall numbers.
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, isatty, (int fd)) {
constexpr int INIT_VAL = 0x1234abcd;
@@ -23,7 +23,7 @@ LLVM_LIBC_FUNCTION(int, isatty, (int fd)) {
// This gets the line dicipline of the terminal. When called on something that
// isn't a terminal it doesn't change line_d_val and returns -1.
int result =
- __llvm_libc::syscall_impl<int>(SYS_ioctl, fd, TIOCGETD, &line_d_val);
+ LIBC_NAMESPACE::syscall_impl<int>(SYS_ioctl, fd, TIOCGETD, &line_d_val);
if (result == 0)
return 1;
@@ -31,4 +31,4 @@ LLVM_LIBC_FUNCTION(int, isatty, (int fd)) {
return 0;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/unistd/linux/link.cpp b/libc/src/unistd/linux/link.cpp
index 385756b8ea9ebe7..b5024ad7a59fb76 100644
--- a/libc/src/unistd/linux/link.cpp
+++ b/libc/src/unistd/linux/link.cpp
@@ -15,14 +15,14 @@
#include <fcntl.h>
#include <sys/syscall.h> // For syscall numbers.
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, link, (const char *path1, const char *path2)) {
#ifdef SYS_link
- int ret = __llvm_libc::syscall_impl<int>(SYS_link, path1, path2);
+ int ret = LIBC_NAMESPACE::syscall_impl<int>(SYS_link, path1, path2);
#elif defined(SYS_linkat)
- int ret = __llvm_libc::syscall_impl<int>(SYS_linkat, AT_FDCWD, path1,
- AT_FDCWD, path2, 0);
+ int ret = LIBC_NAMESPACE::syscall_impl<int>(SYS_linkat, AT_FDCWD, path1,
+ AT_FDCWD, path2, 0);
#else
#error "link or linkat syscalls not available."
#endif
@@ -33,4 +33,4 @@ LLVM_LIBC_FUNCTION(int, link, (const char *path1, const char *path2)) {
return ret;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/unistd/linux/linkat.cpp b/libc/src/unistd/linux/linkat.cpp
index ec1c2b45b2edc8f..c5d071ee83e010e 100644
--- a/libc/src/unistd/linux/linkat.cpp
+++ b/libc/src/unistd/linux/linkat.cpp
@@ -15,13 +15,13 @@
#include <fcntl.h>
#include <sys/syscall.h> // For syscall numbers.
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, linkat,
(int fd1, const char *path1, int fd2, const char *path2,
int flags)) {
- int ret =
- __llvm_libc::syscall_impl<int>(SYS_linkat, fd1, path1, fd2, path2, flags);
+ int ret = LIBC_NAMESPACE::syscall_impl<int>(SYS_linkat, fd1, path1, fd2,
+ path2, flags);
if (ret < 0) {
libc_errno = -ret;
return -1;
@@ -29,4 +29,4 @@ LLVM_LIBC_FUNCTION(int, linkat,
return ret;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/unistd/linux/lseek.cpp b/libc/src/unistd/linux/lseek.cpp
index 3ab0084269e2db9..6f3d9937db245ef 100644
--- a/libc/src/unistd/linux/lseek.cpp
+++ b/libc/src/unistd/linux/lseek.cpp
@@ -16,7 +16,7 @@
#include <sys/syscall.h> // For syscall numbers.
#include <unistd.h> // For off_t.
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(off_t, lseek, (int fd, off_t offset, int whence)) {
auto result = internal::lseekimpl(fd, offset, whence);
@@ -27,4 +27,4 @@ LLVM_LIBC_FUNCTION(off_t, lseek, (int fd, off_t offset, int whence)) {
return result.value();
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/unistd/linux/pread.cpp b/libc/src/unistd/linux/pread.cpp
index 8605925f120722a..614de9732c6271a 100644
--- a/libc/src/unistd/linux/pread.cpp
+++ b/libc/src/unistd/linux/pread.cpp
@@ -15,18 +15,18 @@
#include <stdint.h> // For uint64_t.
#include <sys/syscall.h> // For syscall numbers.
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(ssize_t, pread,
(int fd, void *buf, size_t count, off_t offset)) {
#ifdef LIBC_TARGET_ARCH_IS_RISCV32
static_assert(sizeof(off_t) == 8);
- ssize_t ret = __llvm_libc::syscall_impl<ssize_t>(
+ ssize_t ret = LIBC_NAMESPACE::syscall_impl<ssize_t>(
SYS_pread64, fd, buf, count, (long)offset,
(long)(((uint64_t)(offset)) >> 32));
#else
- ssize_t ret =
- __llvm_libc::syscall_impl<ssize_t>(SYS_pread64, fd, buf, count, offset);
+ ssize_t ret = LIBC_NAMESPACE::syscall_impl<ssize_t>(SYS_pread64, fd, buf,
+ count, offset);
#endif
if (ret < 0) {
libc_errno = static_cast<int>(-ret);
@@ -35,4 +35,4 @@ LLVM_LIBC_FUNCTION(ssize_t, pread,
return ret;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/unistd/linux/pwrite.cpp b/libc/src/unistd/linux/pwrite.cpp
index b4ea52a958ba2d4..6c6a0b555ac1335 100644
--- a/libc/src/unistd/linux/pwrite.cpp
+++ b/libc/src/unistd/linux/pwrite.cpp
@@ -15,18 +15,18 @@
#include <stdint.h> // For uint64_t.
#include <sys/syscall.h> // For syscall numbers.
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(ssize_t, pwrite,
(int fd, const void *buf, size_t count, off_t offset)) {
#ifdef LIBC_TARGET_ARCH_IS_RISCV32
static_assert(sizeof(off_t) == 8);
- ssize_t ret = __llvm_libc::syscall_impl<ssize_t>(
+ ssize_t ret = LIBC_NAMESPACE::syscall_impl<ssize_t>(
SYS_pwrite64, fd, buf, count, (long)offset,
(long)(((uint64_t)(offset)) >> 32));
#else
- ssize_t ret =
- __llvm_libc::syscall_impl<ssize_t>(SYS_pwrite64, fd, buf, count, offset);
+ ssize_t ret = LIBC_NAMESPACE::syscall_impl<ssize_t>(SYS_pwrite64, fd, buf,
+ count, offset);
#endif
if (ret < 0) {
libc_errno = static_cast<int>(-ret);
@@ -35,4 +35,4 @@ LLVM_LIBC_FUNCTION(ssize_t, pwrite,
return ret;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/unistd/linux/read.cpp b/libc/src/unistd/linux/read.cpp
index 6dbff2dee91768f..691a236982e3750 100644
--- a/libc/src/unistd/linux/read.cpp
+++ b/libc/src/unistd/linux/read.cpp
@@ -14,10 +14,10 @@
#include "src/errno/libc_errno.h"
#include <sys/syscall.h> // For syscall numbers.
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(ssize_t, read, (int fd, void *buf, size_t count)) {
- ssize_t ret = __llvm_libc::syscall_impl<ssize_t>(SYS_read, fd, buf, count);
+ ssize_t ret = LIBC_NAMESPACE::syscall_impl<ssize_t>(SYS_read, fd, buf, count);
if (ret < 0) {
libc_errno = static_cast<int>(-ret);
return -1;
@@ -25,4 +25,4 @@ LLVM_LIBC_FUNCTION(ssize_t, read, (int fd, void *buf, size_t count)) {
return ret;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/unistd/linux/readlink.cpp b/libc/src/unistd/linux/readlink.cpp
index 7989b11f5d28c0d..8dee58c8f215f3c 100644
--- a/libc/src/unistd/linux/readlink.cpp
+++ b/libc/src/unistd/linux/readlink.cpp
@@ -15,17 +15,17 @@
#include <fcntl.h>
#include <sys/syscall.h> // For syscall numbers.
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(ssize_t, readlink,
(const char *__restrict path, char *__restrict buf,
size_t bufsize)) {
#ifdef SYS_readlink
ssize_t ret =
- __llvm_libc::syscall_impl<ssize_t>(SYS_readlink, path, buf, bufsize);
+ LIBC_NAMESPACE::syscall_impl<ssize_t>(SYS_readlink, path, buf, bufsize);
#elif defined(SYS_readlinkat)
- ssize_t ret = __llvm_libc::syscall_impl<ssize_t>(SYS_readlinkat, AT_FDCWD,
- path, buf, bufsize);
+ ssize_t ret = LIBC_NAMESPACE::syscall_impl<ssize_t>(SYS_readlinkat, AT_FDCWD,
+ path, buf, bufsize);
#else
#error "readlink or readlinkat syscalls not available."
#endif
@@ -36,4 +36,4 @@ LLVM_LIBC_FUNCTION(ssize_t, readlink,
return ret;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/unistd/linux/readlinkat.cpp b/libc/src/unistd/linux/readlinkat.cpp
index 094853fe85ec0f4..479735d4f4d3d34 100644
--- a/libc/src/unistd/linux/readlinkat.cpp
+++ b/libc/src/unistd/linux/readlinkat.cpp
@@ -15,13 +15,13 @@
#include <fcntl.h>
#include <sys/syscall.h> // For syscall numbers.
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(ssize_t, readlinkat,
(int fd, const char *__restrict path, char *__restrict buf,
size_t bufsize)) {
- ssize_t ret = __llvm_libc::syscall_impl<ssize_t>(SYS_readlinkat, fd, path,
- buf, bufsize);
+ ssize_t ret = LIBC_NAMESPACE::syscall_impl<ssize_t>(SYS_readlinkat, fd, path,
+ buf, bufsize);
if (ret < 0) {
libc_errno = static_cast<int>(-ret);
return -1;
@@ -29,4 +29,4 @@ LLVM_LIBC_FUNCTION(ssize_t, readlinkat,
return ret;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/unistd/linux/rmdir.cpp b/libc/src/unistd/linux/rmdir.cpp
index 70f7206aad56394..234b0c3a09408be 100644
--- a/libc/src/unistd/linux/rmdir.cpp
+++ b/libc/src/unistd/linux/rmdir.cpp
@@ -15,14 +15,14 @@
#include <fcntl.h>
#include <sys/syscall.h> // For syscall numbers.
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, rmdir, (const char *path)) {
#ifdef SYS_rmdir
- int ret = __llvm_libc::syscall_impl<int>(SYS_rmdir, path);
+ int ret = LIBC_NAMESPACE::syscall_impl<int>(SYS_rmdir, path);
#elif defined(SYS_unlinkat)
- int ret = __llvm_libc::syscall_impl<int>(SYS_unlinkat, AT_FDCWD, path,
- AT_REMOVEDIR);
+ int ret = LIBC_NAMESPACE::syscall_impl<int>(SYS_unlinkat, AT_FDCWD, path,
+ AT_REMOVEDIR);
#else
#error "rmdir and unlinkat syscalls not available."
#endif
@@ -34,4 +34,4 @@ LLVM_LIBC_FUNCTION(int, rmdir, (const char *path)) {
return 0;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/unistd/linux/symlink.cpp b/libc/src/unistd/linux/symlink.cpp
index a9b7de8acf37324..e8983e252b8e360 100644
--- a/libc/src/unistd/linux/symlink.cpp
+++ b/libc/src/unistd/linux/symlink.cpp
@@ -15,14 +15,14 @@
#include <fcntl.h>
#include <sys/syscall.h> // For syscall numbers.
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, symlink, (const char *path1, const char *path2)) {
#ifdef SYS_symlink
- int ret = __llvm_libc::syscall_impl<int>(SYS_symlink, path1, path2);
+ int ret = LIBC_NAMESPACE::syscall_impl<int>(SYS_symlink, path1, path2);
#elif defined(SYS_symlinkat)
int ret =
- __llvm_libc::syscall_impl<int>(SYS_symlinkat, path1, AT_FDCWD, path2);
+ LIBC_NAMESPACE::syscall_impl<int>(SYS_symlinkat, path1, AT_FDCWD, path2);
#else
#error "symlink or symlinkat syscalls not available."
#endif
@@ -33,4 +33,4 @@ LLVM_LIBC_FUNCTION(int, symlink, (const char *path1, const char *path2)) {
return ret;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/unistd/linux/symlinkat.cpp b/libc/src/unistd/linux/symlinkat.cpp
index f5debb8cd0c20dd..64f02d13f9a0c19 100644
--- a/libc/src/unistd/linux/symlinkat.cpp
+++ b/libc/src/unistd/linux/symlinkat.cpp
@@ -15,11 +15,11 @@
#include <fcntl.h>
#include <sys/syscall.h> // For syscall numbers.
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, symlinkat,
(const char *path1, int fd, const char *path2)) {
- int ret = __llvm_libc::syscall_impl<int>(SYS_symlinkat, path1, fd, path2);
+ int ret = LIBC_NAMESPACE::syscall_impl<int>(SYS_symlinkat, path1, fd, path2);
if (ret < 0) {
libc_errno = -ret;
return -1;
@@ -27,4 +27,4 @@ LLVM_LIBC_FUNCTION(int, symlinkat,
return ret;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/unistd/linux/syscall.cpp b/libc/src/unistd/linux/syscall.cpp
index 5c61c6d064a6bd7..e1b13c9c143fa41 100644
--- a/libc/src/unistd/linux/syscall.cpp
+++ b/libc/src/unistd/linux/syscall.cpp
@@ -14,13 +14,13 @@
#include "src/errno/libc_errno.h"
#include <stdarg.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
-LLVM_LIBC_FUNCTION(long, __llvm_libc_syscall,
+LLVM_LIBC_FUNCTION(long, LIBC_NAMESPACE_syscall,
(long number, long arg1, long arg2, long arg3, long arg4,
long arg5, long arg6)) {
- long ret = __llvm_libc::syscall_impl<long>(number, arg1, arg2, arg3, arg4,
- arg5, arg6);
+ long ret = LIBC_NAMESPACE::syscall_impl<long>(number, arg1, arg2, arg3, arg4,
+ arg5, arg6);
// Syscalls may return large positive values that overflow, but will never
// return values between -4096 and -1
if (static_cast<unsigned long>(ret) > -4096UL) {
@@ -30,4 +30,4 @@ LLVM_LIBC_FUNCTION(long, __llvm_libc_syscall,
return ret;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/unistd/linux/sysconf.cpp b/libc/src/unistd/linux/sysconf.cpp
index 2816cb447c12841..b16e15551fc7889 100644
--- a/libc/src/unistd/linux/sysconf.cpp
+++ b/libc/src/unistd/linux/sysconf.cpp
@@ -14,7 +14,7 @@
#include <linux/param.h> // For EXEC_PAGESIZE.
#include <unistd.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(long, sysconf, (int name)) {
long ret = 0;
@@ -30,4 +30,4 @@ LLVM_LIBC_FUNCTION(long, sysconf, (int name)) {
return ret;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/unistd/linux/truncate.cpp b/libc/src/unistd/linux/truncate.cpp
index 7be355edfd48f47..0120cc738a92165 100644
--- a/libc/src/unistd/linux/truncate.cpp
+++ b/libc/src/unistd/linux/truncate.cpp
@@ -16,16 +16,16 @@
#include <sys/syscall.h> // For syscall numbers.
#include <unistd.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, truncate, (const char *path, off_t len)) {
#ifdef SYS_truncate
- int ret = __llvm_libc::syscall_impl<int>(SYS_truncate, path, len);
+ int ret = LIBC_NAMESPACE::syscall_impl<int>(SYS_truncate, path, len);
#elif defined(SYS_truncate64)
// Same as truncate but can handle large offsets
static_assert(sizeof(off_t) == 8);
- int ret = __llvm_libc::syscall_impl<int>(SYS_truncate64, path, (long)len,
- (long)(((uint64_t)(len)) >> 32));
+ int ret = LIBC_NAMESPACE::syscall_impl<int>(SYS_truncate64, path, (long)len,
+ (long)(((uint64_t)(len)) >> 32));
#else
#error "truncate and truncate64 syscalls not available."
#endif
@@ -36,4 +36,4 @@ LLVM_LIBC_FUNCTION(int, truncate, (const char *path, off_t len)) {
return 0;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/unistd/linux/unlink.cpp b/libc/src/unistd/linux/unlink.cpp
index d4bbdea8e970b32..e62fb8faa67af2a 100644
--- a/libc/src/unistd/linux/unlink.cpp
+++ b/libc/src/unistd/linux/unlink.cpp
@@ -15,13 +15,13 @@
#include <fcntl.h>
#include <sys/syscall.h> // For syscall numbers.
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, unlink, (const char *path)) {
#ifdef SYS_unlink
- int ret = __llvm_libc::syscall_impl<int>(SYS_unlink, path);
+ int ret = LIBC_NAMESPACE::syscall_impl<int>(SYS_unlink, path);
#elif defined(SYS_unlinkat)
- int ret = __llvm_libc::syscall_impl<int>(SYS_unlinkat, AT_FDCWD, path, 0);
+ int ret = LIBC_NAMESPACE::syscall_impl<int>(SYS_unlinkat, AT_FDCWD, path, 0);
#else
#error "unlink and unlinkat syscalls not available."
#endif
@@ -33,4 +33,4 @@ LLVM_LIBC_FUNCTION(int, unlink, (const char *path)) {
return 0;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/unistd/linux/unlinkat.cpp b/libc/src/unistd/linux/unlinkat.cpp
index eb4af39729f3768..4ec5e38cb405cd0 100644
--- a/libc/src/unistd/linux/unlinkat.cpp
+++ b/libc/src/unistd/linux/unlinkat.cpp
@@ -15,11 +15,11 @@
#include <fcntl.h>
#include <sys/syscall.h> // For syscall numbers.
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, unlinkat, (int dfd, const char *path, int flags)) {
#ifdef SYS_unlinkat
- int ret = __llvm_libc::syscall_impl<int>(SYS_unlinkat, dfd, path, flags);
+ int ret = LIBC_NAMESPACE::syscall_impl<int>(SYS_unlinkat, dfd, path, flags);
#else
#error "unlinkat syscalls not available."
#endif
@@ -31,4 +31,4 @@ LLVM_LIBC_FUNCTION(int, unlinkat, (int dfd, const char *path, int flags)) {
return 0;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/unistd/linux/write.cpp b/libc/src/unistd/linux/write.cpp
index 4884ccf1ed33324..bd6c9114f787751 100644
--- a/libc/src/unistd/linux/write.cpp
+++ b/libc/src/unistd/linux/write.cpp
@@ -14,10 +14,11 @@
#include <sys/syscall.h> // For syscall numbers.
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(ssize_t, write, (int fd, const void *buf, size_t count)) {
- ssize_t ret = __llvm_libc::syscall_impl<ssize_t>(SYS_write, fd, buf, count);
+ ssize_t ret =
+ LIBC_NAMESPACE::syscall_impl<ssize_t>(SYS_write, fd, buf, count);
if (ret < 0) {
libc_errno = static_cast<int>(-ret);
return -1;
@@ -25,4 +26,4 @@ LLVM_LIBC_FUNCTION(ssize_t, write, (int fd, const void *buf, size_t count)) {
return ret;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/unistd/lseek.h b/libc/src/unistd/lseek.h
index 28252e4d4917192..75e33d8a6987d19 100644
--- a/libc/src/unistd/lseek.h
+++ b/libc/src/unistd/lseek.h
@@ -11,10 +11,10 @@
#include <unistd.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
off_t lseek(int fd, off_t offset, int whence);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_UNISTD_LSEEK_H
diff --git a/libc/src/unistd/pread.h b/libc/src/unistd/pread.h
index 5ddf32eae4f8137..6ecfef4c82c602e 100644
--- a/libc/src/unistd/pread.h
+++ b/libc/src/unistd/pread.h
@@ -11,10 +11,10 @@
#include <unistd.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
ssize_t pread(int fd, void *buf, size_t count, off_t offset);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_UNISTD_PREAD_H
diff --git a/libc/src/unistd/pwrite.h b/libc/src/unistd/pwrite.h
index 4286314abee0ce3..535c9217c23531b 100644
--- a/libc/src/unistd/pwrite.h
+++ b/libc/src/unistd/pwrite.h
@@ -11,10 +11,10 @@
#include <unistd.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
ssize_t pwrite(int fd, const void *buf, size_t count, off_t offset);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_UNISTD_PWRITE_H
diff --git a/libc/src/unistd/read.h b/libc/src/unistd/read.h
index 62602c82a906ac6..05a56a2fdeaebb9 100644
--- a/libc/src/unistd/read.h
+++ b/libc/src/unistd/read.h
@@ -11,10 +11,10 @@
#include <unistd.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
ssize_t read(int fd, void *buf, size_t count);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_UNISTD_READ_H
diff --git a/libc/src/unistd/readlink.h b/libc/src/unistd/readlink.h
index ba246bf91b8a8b1..c93c430988c79c5 100644
--- a/libc/src/unistd/readlink.h
+++ b/libc/src/unistd/readlink.h
@@ -11,10 +11,10 @@
#include <unistd.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
ssize_t readlink(const char *__restrict, char *__restrict, size_t);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_UNISTD_READLINK_H
diff --git a/libc/src/unistd/readlinkat.h b/libc/src/unistd/readlinkat.h
index 54346ee1132cb82..a4357efec1a1b12 100644
--- a/libc/src/unistd/readlinkat.h
+++ b/libc/src/unistd/readlinkat.h
@@ -11,10 +11,10 @@
#include <unistd.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
ssize_t readlinkat(int, const char *__restrict, char *__restrict, size_t);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_UNISTD_READLINKAT_H
diff --git a/libc/src/unistd/rmdir.h b/libc/src/unistd/rmdir.h
index 5fe7fac23af7860..55dcbafe1f7df72 100644
--- a/libc/src/unistd/rmdir.h
+++ b/libc/src/unistd/rmdir.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_UNISTD_RMDIR_H
#define LLVM_LIBC_SRC_UNISTD_RMDIR_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int rmdir(const char *path);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_UNISTD_RMDIR_H
diff --git a/libc/src/unistd/swab.cpp b/libc/src/unistd/swab.cpp
index 44166a623ff42fd..5c2f5074ff97800 100644
--- a/libc/src/unistd/swab.cpp
+++ b/libc/src/unistd/swab.cpp
@@ -10,7 +10,7 @@
#include "src/__support/common.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(void, swab,
(const void *__restrict from, void *__restrict to,
@@ -23,4 +23,4 @@ LLVM_LIBC_FUNCTION(void, swab,
}
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/unistd/swab.h b/libc/src/unistd/swab.h
index e5e02e133314788..0a6aa49540b5b7d 100644
--- a/libc/src/unistd/swab.h
+++ b/libc/src/unistd/swab.h
@@ -11,10 +11,10 @@
#include <unistd.h> // For ssize_t
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
void swab(const void *__restrict from, void *__restrict to, ssize_t n);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_UNISTD_SWAB_H
diff --git a/libc/src/unistd/symlink.h b/libc/src/unistd/symlink.h
index a495db8238bc0d6..0a0124ccbc7ab75 100644
--- a/libc/src/unistd/symlink.h
+++ b/libc/src/unistd/symlink.h
@@ -11,10 +11,10 @@
#include <unistd.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int symlink(const char *, const char *);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_UNISTD_SYMLINK_H
diff --git a/libc/src/unistd/symlinkat.h b/libc/src/unistd/symlinkat.h
index ff77f0a52f6d0f0..ecca4380e98eb13 100644
--- a/libc/src/unistd/symlinkat.h
+++ b/libc/src/unistd/symlinkat.h
@@ -11,10 +11,10 @@
#include <unistd.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int symlinkat(const char *, int, const char *);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_UNISTD_SYMLINKAT_H
diff --git a/libc/src/unistd/syscall.h b/libc/src/unistd/syscall.h
index 81ff64ebcf5a13e..255459cadb8b714 100644
--- a/libc/src/unistd/syscall.h
+++ b/libc/src/unistd/syscall.h
@@ -12,11 +12,11 @@
#include <stdarg.h>
#include <unistd.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
-long __llvm_libc_syscall(long number, long arg1, long arg2, long arg3,
- long arg4, long arg5, long arg6);
+long LIBC_NAMESPACE_syscall(long number, long arg1, long arg2, long arg3,
+ long arg4, long arg5, long arg6);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_UNISTD_SYSCALL_H
diff --git a/libc/src/unistd/sysconf.h b/libc/src/unistd/sysconf.h
index b704edb4ada1fa0..89c5efa57463643 100644
--- a/libc/src/unistd/sysconf.h
+++ b/libc/src/unistd/sysconf.h
@@ -11,10 +11,10 @@
#include <unistd.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
long sysconf(int name);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_UNISTD_SYSCONF_H
diff --git a/libc/src/unistd/truncate.h b/libc/src/unistd/truncate.h
index a6ef92146008cc0..5245b6bf2ed028f 100644
--- a/libc/src/unistd/truncate.h
+++ b/libc/src/unistd/truncate.h
@@ -11,10 +11,10 @@
#include <unistd.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int truncate(const char *, off_t);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_UNISTD_TRUNCATE_H
diff --git a/libc/src/unistd/unlink.h b/libc/src/unistd/unlink.h
index 1119bfad7dbc533..d1d34fa1a8ac5c7 100644
--- a/libc/src/unistd/unlink.h
+++ b/libc/src/unistd/unlink.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_UNISTD_UNLINK_H
#define LLVM_LIBC_SRC_UNISTD_UNLINK_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int unlink(const char *path);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_UNISTD_UNLINK_H
diff --git a/libc/src/unistd/unlinkat.h b/libc/src/unistd/unlinkat.h
index b32d7b537851d3a..81d23bdf5cec368 100644
--- a/libc/src/unistd/unlinkat.h
+++ b/libc/src/unistd/unlinkat.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LIBC_SRC_UNISTD_UNLINKAT_H
#define LLVM_LIBC_SRC_UNISTD_UNLINKAT_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int unlinkat(int dfd, const char *path, int flags);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_UNISTD_UNLINKAT_H
diff --git a/libc/src/unistd/write.h b/libc/src/unistd/write.h
index 821dc49050ec5c7..52cdff348085f59 100644
--- a/libc/src/unistd/write.h
+++ b/libc/src/unistd/write.h
@@ -11,10 +11,10 @@
#include <unistd.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
ssize_t write(int fd, const void *buf, size_t count);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_UNISTD_WRITE_H
diff --git a/libc/src/wchar/btowc.cpp b/libc/src/wchar/btowc.cpp
index 6db888c1aa09cd3..040c60eb805c72e 100644
--- a/libc/src/wchar/btowc.cpp
+++ b/libc/src/wchar/btowc.cpp
@@ -12,7 +12,7 @@
#include <stdio.h> // for EOF.
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, btowc, (wint_t c)) {
auto result = internal::btowc(c);
@@ -23,4 +23,4 @@ LLVM_LIBC_FUNCTION(int, btowc, (wint_t c)) {
}
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/wchar/btowc.h b/libc/src/wchar/btowc.h
index ab37738e8c67cb3..de67f157b5729a5 100644
--- a/libc/src/wchar/btowc.h
+++ b/libc/src/wchar/btowc.h
@@ -11,10 +11,10 @@
#include <wchar.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
wint_t btowc(int c);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_WCHAR_BTOWC_H
diff --git a/libc/src/wchar/wctob.cpp b/libc/src/wchar/wctob.cpp
index 274818a37773aed..538d5388e505818 100644
--- a/libc/src/wchar/wctob.cpp
+++ b/libc/src/wchar/wctob.cpp
@@ -12,7 +12,7 @@
#include <stdio.h> // for EOF.
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, wctob, (wint_t c)) {
auto result = internal::wctob(c);
@@ -23,4 +23,4 @@ LLVM_LIBC_FUNCTION(int, wctob, (wint_t c)) {
}
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/wchar/wctob.h b/libc/src/wchar/wctob.h
index 5c0f229436d6256..1cc0c211e98a524 100644
--- a/libc/src/wchar/wctob.h
+++ b/libc/src/wchar/wctob.h
@@ -11,10 +11,10 @@
#include <wchar.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int wctob(wint_t c);
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_SRC_WCHAR_WCTOB_H
diff --git a/libc/startup/gpu/amdgpu/start.cpp b/libc/startup/gpu/amdgpu/start.cpp
index b2adb1d3abcaf68..a186dc84721a67e 100644
--- a/libc/startup/gpu/amdgpu/start.cpp
+++ b/libc/startup/gpu/amdgpu/start.cpp
@@ -13,13 +13,13 @@
extern "C" int main(int argc, char **argv, char **envp);
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
// The AMDGPU architecture provides a fixed frequency clock used for obtaining
// real time. However, the frequency of this clock varies between cards and can
// only be obtained via the driver. The loader will set this so we can use it.
extern "C" [[gnu::visibility("protected")]] uint64_t
- [[clang::address_space(4)]] __llvm_libc_clock_freq = 0;
+ [[clang::address_space(4)]] LIBC_NAMESPACE_clock_freq = 0;
extern "C" uintptr_t __init_array_start[];
extern "C" uintptr_t __init_array_end[];
@@ -41,21 +41,21 @@ static void call_fini_array_callbacks() {
reinterpret_cast<FiniCallback *>(__fini_array_start[i])();
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
extern "C" [[gnu::visibility("protected"), clang::amdgpu_kernel]] void
_begin(int argc, char **argv, char **env, void *rpc_shared_buffer) {
// We need to set up the RPC client first in case any of the constructors
// require it.
- __llvm_libc::rpc::client.reset(__llvm_libc::rpc::MAX_PORT_COUNT,
- rpc_shared_buffer);
+ LIBC_NAMESPACE::rpc::client.reset(LIBC_NAMESPACE::rpc::MAX_PORT_COUNT,
+ rpc_shared_buffer);
// We want the fini array callbacks to be run after other atexit
// callbacks are run. So, we register them before running the init
// array callbacks as they can potentially register their own atexit
// callbacks.
- __llvm_libc::atexit(&__llvm_libc::call_fini_array_callbacks);
- __llvm_libc::call_init_array_callbacks(argc, argv, env);
+ LIBC_NAMESPACE::atexit(&LIBC_NAMESPACE::call_fini_array_callbacks);
+ LIBC_NAMESPACE::call_init_array_callbacks(argc, argv, env);
}
extern "C" [[gnu::visibility("protected"), clang::amdgpu_kernel]] void
@@ -70,5 +70,5 @@ _end(int retval) {
// Only a single thread should call `exit` here, the rest should gracefully
// return from the kernel. This is so only one thread calls the destructors
// registred with 'atexit' above.
- __llvm_libc::exit(retval);
+ LIBC_NAMESPACE::exit(retval);
}
diff --git a/libc/startup/gpu/nvptx/start.cpp b/libc/startup/gpu/nvptx/start.cpp
index cd442394e74ce87..d93d2ad6883def7 100644
--- a/libc/startup/gpu/nvptx/start.cpp
+++ b/libc/startup/gpu/nvptx/start.cpp
@@ -13,7 +13,7 @@
extern "C" int main(int argc, char **argv, char **envp);
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
extern "C" {
// Nvidia's 'nvlink' linker does not provide these symbols. We instead need
@@ -39,21 +39,21 @@ static void call_fini_array_callbacks() {
reinterpret_cast<FiniCallback *>(__fini_array_start[i])();
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
extern "C" [[gnu::visibility("protected"), clang::nvptx_kernel]] void
_begin(int argc, char **argv, char **env, void *rpc_shared_buffer) {
// We need to set up the RPC client first in case any of the constructors
// require it.
- __llvm_libc::rpc::client.reset(__llvm_libc::rpc::MAX_PORT_COUNT,
- rpc_shared_buffer);
+ LIBC_NAMESPACE::rpc::client.reset(LIBC_NAMESPACE::rpc::MAX_PORT_COUNT,
+ rpc_shared_buffer);
// We want the fini array callbacks to be run after other atexit
// callbacks are run. So, we register them before running the init
// array callbacks as they can potentially register their own atexit
// callbacks.
- __llvm_libc::atexit(&__llvm_libc::call_fini_array_callbacks);
- __llvm_libc::call_init_array_callbacks(argc, argv, env);
+ LIBC_NAMESPACE::atexit(&LIBC_NAMESPACE::call_fini_array_callbacks);
+ LIBC_NAMESPACE::call_init_array_callbacks(argc, argv, env);
}
extern "C" [[gnu::visibility("protected"), clang::nvptx_kernel]] void
@@ -67,5 +67,5 @@ extern "C" [[gnu::visibility("protected"), clang::nvptx_kernel]] void
_end(int retval) {
// To finis the execution we invoke all the callbacks registered via 'atexit'
// and then exit with the appropriate return value.
- __llvm_libc::exit(retval);
+ LIBC_NAMESPACE::exit(retval);
}
diff --git a/libc/startup/linux/aarch64/start.cpp b/libc/startup/linux/aarch64/start.cpp
index 7b94ae64c4ced90..002af5313cc82dd 100644
--- a/libc/startup/linux/aarch64/start.cpp
+++ b/libc/startup/linux/aarch64/start.cpp
@@ -27,7 +27,7 @@ extern "C" int main(int, char **, char **);
// Source documentation:
// https://github.com/ARM-software/abi-aa/tree/main/sysvabi64
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
#ifdef SYS_mmap2
static constexpr long MMAP_SYSCALL_NUMBER = SYS_mmap2;
@@ -69,18 +69,18 @@ void init_tls(TLSDescriptor &tls_descriptor) {
// We cannot call the mmap function here as the functions set errno on
// failure. Since errno is implemented via a thread local variable, we cannot
// use errno before TLS is setup.
- long mmap_ret_val = __llvm_libc::syscall_impl<long>(
+ long mmap_ret_val = LIBC_NAMESPACE::syscall_impl<long>(
MMAP_SYSCALL_NUMBER, nullptr, alloc_size, PROT_READ | PROT_WRITE,
MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
// We cannot check the return value with MAP_FAILED as that is the return
// of the mmap function and not the mmap syscall.
if (mmap_ret_val < 0 && static_cast<uintptr_t>(mmap_ret_val) > -app.pageSize)
- __llvm_libc::syscall_impl<long>(SYS_exit, 1);
+ LIBC_NAMESPACE::syscall_impl<long>(SYS_exit, 1);
uintptr_t thread_ptr = uintptr_t(reinterpret_cast<uintptr_t *>(mmap_ret_val));
uintptr_t tls_addr = thread_ptr + size_of_pointers + padding;
- __llvm_libc::inline_memcpy(reinterpret_cast<char *>(tls_addr),
- reinterpret_cast<const char *>(app.tls.address),
- app.tls.init_size);
+ LIBC_NAMESPACE::inline_memcpy(reinterpret_cast<char *>(tls_addr),
+ reinterpret_cast<const char *>(app.tls.address),
+ app.tls.init_size);
tls_descriptor.size = alloc_size;
tls_descriptor.addr = thread_ptr;
tls_descriptor.tp = thread_ptr;
@@ -89,7 +89,7 @@ void init_tls(TLSDescriptor &tls_descriptor) {
void cleanup_tls(uintptr_t addr, uintptr_t size) {
if (size == 0)
return;
- __llvm_libc::syscall_impl<long>(SYS_munmap, addr, size);
+ LIBC_NAMESPACE::syscall_impl<long>(SYS_munmap, addr, size);
}
static void set_thread_ptr(uintptr_t val) { __arm_wsr64("tpidr_el0", val); }
@@ -123,9 +123,9 @@ static void call_fini_array_callbacks() {
reinterpret_cast<FiniCallback *>(__fini_array_start[i - 1])();
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
-using __llvm_libc::app;
+using LIBC_NAMESPACE::app;
// TODO: Would be nice to use the aux entry structure from elf.h when available.
struct AuxEntry {
@@ -134,10 +134,10 @@ struct AuxEntry {
};
__attribute__((noinline)) static void do_start() {
- auto tid = __llvm_libc::syscall_impl<long>(SYS_gettid);
+ auto tid = LIBC_NAMESPACE::syscall_impl<long>(SYS_gettid);
if (tid <= 0)
- __llvm_libc::syscall_impl<long>(SYS_exit, 1);
- __llvm_libc::main_thread_attrib.tid = static_cast<int>(tid);
+ LIBC_NAMESPACE::syscall_impl<long>(SYS_exit, 1);
+ LIBC_NAMESPACE::main_thread_attrib.tid = static_cast<int>(tid);
// After the argv array, is a 8-byte long NULL value before the array of env
// values. The end of the env values is marked by another 8-byte long NULL
@@ -184,22 +184,22 @@ __attribute__((noinline)) static void do_start() {
app.tls.align = phdr->p_align;
}
- __llvm_libc::TLSDescriptor tls;
- __llvm_libc::init_tls(tls);
+ LIBC_NAMESPACE::TLSDescriptor tls;
+ LIBC_NAMESPACE::init_tls(tls);
if (tls.size != 0)
- __llvm_libc::set_thread_ptr(tls.tp);
+ LIBC_NAMESPACE::set_thread_ptr(tls.tp);
- __llvm_libc::self.attrib = &__llvm_libc::main_thread_attrib;
- __llvm_libc::main_thread_attrib.atexit_callback_mgr =
- __llvm_libc::internal::get_thread_atexit_callback_mgr();
+ LIBC_NAMESPACE::self.attrib = &LIBC_NAMESPACE::main_thread_attrib;
+ LIBC_NAMESPACE::main_thread_attrib.atexit_callback_mgr =
+ LIBC_NAMESPACE::internal::get_thread_atexit_callback_mgr();
// We want the fini array callbacks to be run after other atexit
// callbacks are run. So, we register them before running the init
// array callbacks as they can potentially register their own atexit
// callbacks.
- __llvm_libc::atexit(&__llvm_libc::call_fini_array_callbacks);
+ LIBC_NAMESPACE::atexit(&LIBC_NAMESPACE::call_fini_array_callbacks);
- __llvm_libc::call_init_array_callbacks(
+ LIBC_NAMESPACE::call_init_array_callbacks(
static_cast<int>(app.args->argc),
reinterpret_cast<char **>(app.args->argv),
reinterpret_cast<char **>(env_ptr));
@@ -211,8 +211,8 @@ __attribute__((noinline)) static void do_start() {
// TODO: TLS cleanup should be done after all other atexit callbacks
// are run. So, register a cleanup callback for it with atexit before
// everything else.
- __llvm_libc::cleanup_tls(tls.addr, tls.size);
- __llvm_libc::exit(retval);
+ LIBC_NAMESPACE::cleanup_tls(tls.addr, tls.size);
+ LIBC_NAMESPACE::exit(retval);
}
extern "C" void _start() {
@@ -226,7 +226,7 @@ extern "C" void _start() {
// will take us to the previous stack pointer. That is the reason why the
// actual business logic of the startup code is pushed into a non-inline
// function do_start so that this function is free of any stack usage.
- app.args = reinterpret_cast<__llvm_libc::Args *>(
+ app.args = reinterpret_cast<LIBC_NAMESPACE::Args *>(
reinterpret_cast<uintptr_t *>(__builtin_frame_address(0)) + 2);
do_start();
}
diff --git a/libc/startup/linux/riscv64/start.cpp b/libc/startup/linux/riscv64/start.cpp
index 1bf05b94ad5acfe..ed976d294d94215 100644
--- a/libc/startup/linux/riscv64/start.cpp
+++ b/libc/startup/linux/riscv64/start.cpp
@@ -22,7 +22,7 @@
extern "C" int main(int, char **, char **);
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
#ifdef SYS_mmap2
static constexpr long MMAP_SYSCALL_NUMBER = SYS_mmap2;
@@ -56,18 +56,18 @@ void init_tls(TLSDescriptor &tls_descriptor) {
// We cannot call the mmap function here as the functions set errno on
// failure. Since errno is implemented via a thread local variable, we cannot
// use errno before TLS is setup.
- long mmap_ret_val = __llvm_libc::syscall_impl<long>(
+ long mmap_ret_val = LIBC_NAMESPACE::syscall_impl<long>(
MMAP_SYSCALL_NUMBER, nullptr, alloc_size, PROT_READ | PROT_WRITE,
MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
// We cannot check the return value with MAP_FAILED as that is the return
// of the mmap function and not the mmap syscall.
if (mmap_ret_val < 0 && static_cast<uintptr_t>(mmap_ret_val) > -app.pageSize)
- __llvm_libc::syscall_impl<long>(SYS_exit, 1);
+ LIBC_NAMESPACE::syscall_impl<long>(SYS_exit, 1);
uintptr_t thread_ptr = uintptr_t(reinterpret_cast<uintptr_t *>(mmap_ret_val));
uintptr_t tls_addr = thread_ptr + size_of_pointers + padding;
- __llvm_libc::inline_memcpy(reinterpret_cast<char *>(tls_addr),
- reinterpret_cast<const char *>(app.tls.address),
- app.tls.init_size);
+ LIBC_NAMESPACE::inline_memcpy(reinterpret_cast<char *>(tls_addr),
+ reinterpret_cast<const char *>(app.tls.address),
+ app.tls.init_size);
tls_descriptor.size = alloc_size;
tls_descriptor.addr = thread_ptr;
tls_descriptor.tp = tls_addr;
@@ -76,7 +76,7 @@ void init_tls(TLSDescriptor &tls_descriptor) {
void cleanup_tls(uintptr_t addr, uintptr_t size) {
if (size == 0)
return;
- __llvm_libc::syscall_impl<long>(SYS_munmap, addr, size);
+ LIBC_NAMESPACE::syscall_impl<long>(SYS_munmap, addr, size);
}
static void set_thread_ptr(uintptr_t val) {
@@ -112,14 +112,14 @@ static void call_fini_array_callbacks() {
reinterpret_cast<FiniCallback *>(__fini_array_start[i - 1])();
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
-using __llvm_libc::app;
+using LIBC_NAMESPACE::app;
// TODO: Would be nice to use the aux entry structure from elf.h when available.
struct AuxEntry {
- __llvm_libc::AuxEntryType type;
- __llvm_libc::AuxEntryType value;
+ LIBC_NAMESPACE::AuxEntryType type;
+ LIBC_NAMESPACE::AuxEntryType value;
};
#if defined(LIBC_TARGET_ARCH_IS_X86_64) || \
@@ -137,16 +137,16 @@ __attribute__((noinline)) static void do_start() {
".option norelax\n\t"
"lla gp, __global_pointer$\n\t"
".option pop\n\t");
- auto tid = __llvm_libc::syscall_impl<long>(SYS_gettid);
+ auto tid = LIBC_NAMESPACE::syscall_impl<long>(SYS_gettid);
if (tid <= 0)
- __llvm_libc::syscall_impl<long>(SYS_exit, 1);
- __llvm_libc::main_thread_attrib.tid = static_cast<int>(tid);
+ LIBC_NAMESPACE::syscall_impl<long>(SYS_exit, 1);
+ LIBC_NAMESPACE::main_thread_attrib.tid = static_cast<int>(tid);
// After the argv array, is a 8-byte long NULL value before the array of env
// values. The end of the env values is marked by another 8-byte long NULL
// value. We step over it (the "+ 1" below) to get to the env values.
- __llvm_libc::ArgVEntryType *env_ptr = app.args->argv + app.args->argc + 1;
- __llvm_libc::ArgVEntryType *env_end_marker = env_ptr;
+ LIBC_NAMESPACE::ArgVEntryType *env_ptr = app.args->argv + app.args->argc + 1;
+ LIBC_NAMESPACE::ArgVEntryType *env_end_marker = env_ptr;
app.envPtr = env_ptr;
while (*env_end_marker)
++env_end_marker;
@@ -187,22 +187,22 @@ __attribute__((noinline)) static void do_start() {
app.tls.align = phdr->p_align;
}
- __llvm_libc::TLSDescriptor tls;
- __llvm_libc::init_tls(tls);
+ LIBC_NAMESPACE::TLSDescriptor tls;
+ LIBC_NAMESPACE::init_tls(tls);
if (tls.size != 0)
- __llvm_libc::set_thread_ptr(tls.tp);
+ LIBC_NAMESPACE::set_thread_ptr(tls.tp);
- __llvm_libc::self.attrib = &__llvm_libc::main_thread_attrib;
- __llvm_libc::main_thread_attrib.atexit_callback_mgr =
- __llvm_libc::internal::get_thread_atexit_callback_mgr();
+ LIBC_NAMESPACE::self.attrib = &LIBC_NAMESPACE::main_thread_attrib;
+ LIBC_NAMESPACE::main_thread_attrib.atexit_callback_mgr =
+ LIBC_NAMESPACE::internal::get_thread_atexit_callback_mgr();
// We want the fini array callbacks to be run after other atexit
// callbacks are run. So, we register them before running the init
// array callbacks as they can potentially register their own atexit
// callbacks.
- __llvm_libc::atexit(&__llvm_libc::call_fini_array_callbacks);
+ LIBC_NAMESPACE::atexit(&LIBC_NAMESPACE::call_fini_array_callbacks);
- __llvm_libc::call_init_array_callbacks(
+ LIBC_NAMESPACE::call_init_array_callbacks(
static_cast<int>(app.args->argc),
reinterpret_cast<char **>(app.args->argv),
reinterpret_cast<char **>(env_ptr));
@@ -214,13 +214,13 @@ __attribute__((noinline)) static void do_start() {
// TODO: TLS cleanup should be done after all other atexit callbacks
// are run. So, register a cleanup callback for it with atexit before
// everything else.
- __llvm_libc::cleanup_tls(tls.addr, tls.size);
- __llvm_libc::exit(retval);
+ LIBC_NAMESPACE::cleanup_tls(tls.addr, tls.size);
+ LIBC_NAMESPACE::exit(retval);
}
extern "C" void _start() {
// Fetch the args using the frame pointer.
- app.args = reinterpret_cast<__llvm_libc::Args *>(
+ app.args = reinterpret_cast<LIBC_NAMESPACE::Args *>(
reinterpret_cast<uintptr_t *>(__builtin_frame_address(0)));
do_start();
}
diff --git a/libc/startup/linux/x86_64/start.cpp b/libc/startup/linux/x86_64/start.cpp
index 2f9dbfddf6bee6d..4b46a4f4a7b0813 100644
--- a/libc/startup/linux/x86_64/start.cpp
+++ b/libc/startup/linux/x86_64/start.cpp
@@ -23,7 +23,7 @@
extern "C" int main(int, char **, char **);
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
#ifdef SYS_mmap2
static constexpr long mmapSyscallNumber = SYS_mmap2;
@@ -59,13 +59,13 @@ void init_tls(TLSDescriptor &tls_descriptor) {
// We cannot call the mmap function here as the functions set errno on
// failure. Since errno is implemented via a thread local variable, we cannot
// use errno before TLS is setup.
- long mmapRetVal = __llvm_libc::syscall_impl<long>(
+ long mmapRetVal = LIBC_NAMESPACE::syscall_impl<long>(
mmapSyscallNumber, nullptr, tlsSizeWithAddr, PROT_READ | PROT_WRITE,
MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
// We cannot check the return value with MAP_FAILED as that is the return
// of the mmap function and not the mmap syscall.
if (mmapRetVal < 0 && static_cast<uintptr_t>(mmapRetVal) > -app.pageSize)
- __llvm_libc::syscall_impl<long>(SYS_exit, 1);
+ LIBC_NAMESPACE::syscall_impl<long>(SYS_exit, 1);
uintptr_t *tlsAddr = reinterpret_cast<uintptr_t *>(mmapRetVal);
// x86_64 TLS faces down from the thread pointer with the first entry
@@ -73,9 +73,9 @@ void init_tls(TLSDescriptor &tls_descriptor) {
uintptr_t endPtr = reinterpret_cast<uintptr_t>(tlsAddr) + tlsSize;
*reinterpret_cast<uintptr_t *>(endPtr) = endPtr;
- __llvm_libc::inline_memcpy(reinterpret_cast<char *>(tlsAddr),
- reinterpret_cast<const char *>(app.tls.address),
- app.tls.init_size);
+ LIBC_NAMESPACE::inline_memcpy(reinterpret_cast<char *>(tlsAddr),
+ reinterpret_cast<const char *>(app.tls.address),
+ app.tls.init_size);
tls_descriptor = {tlsSizeWithAddr, uintptr_t(tlsAddr), endPtr};
return;
@@ -84,12 +84,12 @@ void init_tls(TLSDescriptor &tls_descriptor) {
void cleanup_tls(uintptr_t addr, uintptr_t size) {
if (size == 0)
return;
- __llvm_libc::syscall_impl<long>(SYS_munmap, addr, size);
+ LIBC_NAMESPACE::syscall_impl<long>(SYS_munmap, addr, size);
}
// Sets the thread pointer to |val|. Returns true on success, false on failure.
static bool set_thread_ptr(uintptr_t val) {
- return __llvm_libc::syscall_impl(SYS_arch_prctl, ARCH_SET_FS, val) != -1;
+ return LIBC_NAMESPACE::syscall_impl(SYS_arch_prctl, ARCH_SET_FS, val) != -1;
}
using InitCallback = void(int, char **, char **);
@@ -121,9 +121,9 @@ static void call_fini_array_callbacks() {
reinterpret_cast<FiniCallback *>(__fini_array_start[i - 1])();
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
-using __llvm_libc::app;
+using LIBC_NAMESPACE::app;
// TODO: Would be nice to use the aux entry structure from elf.h when available.
struct AuxEntry {
@@ -135,7 +135,7 @@ extern "C" void _start() {
// This TU is compiled with -fno-omit-frame-pointer. Hence, the previous value
// of the base pointer is pushed on to the stack. So, we step over it (the
// "+ 1" below) to get to the args.
- app.args = reinterpret_cast<__llvm_libc::Args *>(
+ app.args = reinterpret_cast<LIBC_NAMESPACE::Args *>(
reinterpret_cast<uintptr_t *>(__builtin_frame_address(0)) + 1);
// The x86_64 ABI requires that the stack pointer is aligned to a 16-byte
@@ -152,10 +152,10 @@ extern "C" void _start() {
__asm__ __volatile__("andq $0xfffffffffffffff0, %rsp\n\t");
__asm__ __volatile__("andq $0xfffffffffffffff0, %rbp\n\t");
- auto tid = __llvm_libc::syscall_impl<long>(SYS_gettid);
+ auto tid = LIBC_NAMESPACE::syscall_impl<long>(SYS_gettid);
if (tid <= 0)
- __llvm_libc::syscall_impl<long>(SYS_exit, 1);
- __llvm_libc::main_thread_attrib.tid = static_cast<int>(tid);
+ LIBC_NAMESPACE::syscall_impl<long>(SYS_exit, 1);
+ LIBC_NAMESPACE::main_thread_attrib.tid = static_cast<int>(tid);
// After the argv array, is a 8-byte long NULL value before the array of env
// values. The end of the env values is marked by another 8-byte long NULL
@@ -202,22 +202,22 @@ extern "C" void _start() {
app.tls.align = phdr->p_align;
}
- __llvm_libc::TLSDescriptor tls;
- __llvm_libc::init_tls(tls);
- if (tls.size != 0 && !__llvm_libc::set_thread_ptr(tls.tp))
- __llvm_libc::syscall_impl<long>(SYS_exit, 1);
+ LIBC_NAMESPACE::TLSDescriptor tls;
+ LIBC_NAMESPACE::init_tls(tls);
+ if (tls.size != 0 && !LIBC_NAMESPACE::set_thread_ptr(tls.tp))
+ LIBC_NAMESPACE::syscall_impl<long>(SYS_exit, 1);
- __llvm_libc::self.attrib = &__llvm_libc::main_thread_attrib;
- __llvm_libc::main_thread_attrib.atexit_callback_mgr =
- __llvm_libc::internal::get_thread_atexit_callback_mgr();
+ LIBC_NAMESPACE::self.attrib = &LIBC_NAMESPACE::main_thread_attrib;
+ LIBC_NAMESPACE::main_thread_attrib.atexit_callback_mgr =
+ LIBC_NAMESPACE::internal::get_thread_atexit_callback_mgr();
// We want the fini array callbacks to be run after other atexit
// callbacks are run. So, we register them before running the init
// array callbacks as they can potentially register their own atexit
// callbacks.
- __llvm_libc::atexit(&__llvm_libc::call_fini_array_callbacks);
+ LIBC_NAMESPACE::atexit(&LIBC_NAMESPACE::call_fini_array_callbacks);
- __llvm_libc::call_init_array_callbacks(
+ LIBC_NAMESPACE::call_init_array_callbacks(
static_cast<int>(app.args->argc),
reinterpret_cast<char **>(app.args->argv),
reinterpret_cast<char **>(env_ptr));
@@ -229,6 +229,6 @@ extern "C" void _start() {
// TODO: TLS cleanup should be done after all other atexit callbacks
// are run. So, register a cleanup callback for it with atexit before
// everything else.
- __llvm_libc::cleanup_tls(tls.addr, tls.size);
- __llvm_libc::exit(retval);
+ LIBC_NAMESPACE::cleanup_tls(tls.addr, tls.size);
+ LIBC_NAMESPACE::exit(retval);
}
diff --git a/libc/test/IntegrationTest/test.cpp b/libc/test/IntegrationTest/test.cpp
index 8e2feccd0dac719..3bdbe89a3fb62d9 100644
--- a/libc/test/IntegrationTest/test.cpp
+++ b/libc/test/IntegrationTest/test.cpp
@@ -14,7 +14,7 @@
// entrypoint to the internal implementation of the function used for testing.
// This is done manually as not all targets support aliases.
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int bcmp(const void *lhs, const void *rhs, size_t count);
void bzero(void *ptr, size_t count);
@@ -24,29 +24,29 @@ void *memmove(void *dst, const void *src, size_t count);
void *memset(void *ptr, int value, size_t count);
int atexit(void (*func)(void));
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
extern "C" {
int bcmp(const void *lhs, const void *rhs, size_t count) {
- return __llvm_libc::bcmp(lhs, rhs, count);
+ return LIBC_NAMESPACE::bcmp(lhs, rhs, count);
}
-void bzero(void *ptr, size_t count) { __llvm_libc::bzero(ptr, count); }
+void bzero(void *ptr, size_t count) { LIBC_NAMESPACE::bzero(ptr, count); }
int memcmp(const void *lhs, const void *rhs, size_t count) {
- return __llvm_libc::memcmp(lhs, rhs, count);
+ return LIBC_NAMESPACE::memcmp(lhs, rhs, count);
}
void *memcpy(void *__restrict dst, const void *__restrict src, size_t count) {
- return __llvm_libc::memcpy(dst, src, count);
+ return LIBC_NAMESPACE::memcpy(dst, src, count);
}
void *memmove(void *dst, const void *src, size_t count) {
- return __llvm_libc::memmove(dst, src, count);
+ return LIBC_NAMESPACE::memmove(dst, src, count);
}
void *memset(void *ptr, int value, size_t count) {
- return __llvm_libc::memset(ptr, value, count);
+ return LIBC_NAMESPACE::memset(ptr, value, count);
}
// This is needed if the test was compiled with '-fno-use-cxa-atexit'.
-int atexit(void (*func)(void)) { return __llvm_libc::atexit(func); }
+int atexit(void (*func)(void)) { return LIBC_NAMESPACE::atexit(func); }
} // extern "C"
diff --git a/libc/test/IntegrationTest/test.h b/libc/test/IntegrationTest/test.h
index 8dff1980f9236e4..1e5ad1cfef0d7b5 100644
--- a/libc/test/IntegrationTest/test.h
+++ b/libc/test/IntegrationTest/test.h
@@ -15,34 +15,34 @@
#define __AS_STRING(val) #val
#define __CHECK_TRUE(file, line, val, should_exit) \
if (!(val)) { \
- __llvm_libc::write_to_stderr(file ":" __AS_STRING( \
+ LIBC_NAMESPACE::write_to_stderr(file ":" __AS_STRING( \
line) ": Expected '" #val "' to be true, but is false\n"); \
if (should_exit) \
- __llvm_libc::quick_exit(127); \
+ LIBC_NAMESPACE::quick_exit(127); \
}
#define __CHECK_FALSE(file, line, val, should_exit) \
if (val) { \
- __llvm_libc::write_to_stderr(file ":" __AS_STRING( \
+ LIBC_NAMESPACE::write_to_stderr(file ":" __AS_STRING( \
line) ": Expected '" #val "' to be false, but is true\n"); \
if (should_exit) \
- __llvm_libc::quick_exit(127); \
+ LIBC_NAMESPACE::quick_exit(127); \
}
#define __CHECK_EQ(file, line, val1, val2, should_exit) \
if ((val1) != (val2)) { \
- __llvm_libc::write_to_stderr(file ":" __AS_STRING( \
+ LIBC_NAMESPACE::write_to_stderr(file ":" __AS_STRING( \
line) ": Expected '" #val1 "' to be equal to '" #val2 "'\n"); \
if (should_exit) \
- __llvm_libc::quick_exit(127); \
+ LIBC_NAMESPACE::quick_exit(127); \
}
#define __CHECK_NE(file, line, val1, val2, should_exit) \
if ((val1) == (val2)) { \
- __llvm_libc::write_to_stderr(file ":" __AS_STRING( \
+ LIBC_NAMESPACE::write_to_stderr(file ":" __AS_STRING( \
line) ": Expected '" #val1 "' to not be equal to '" #val2 "'\n"); \
if (should_exit) \
- __llvm_libc::quick_exit(127); \
+ LIBC_NAMESPACE::quick_exit(127); \
}
#define EXPECT_TRUE(val) __CHECK_TRUE(__FILE__, __LINE__, val, false)
diff --git a/libc/test/UnitTest/BazelFilePath.cpp b/libc/test/UnitTest/BazelFilePath.cpp
index 7bee46c4029e57d..79730868ecdf3f1 100644
--- a/libc/test/UnitTest/BazelFilePath.cpp
+++ b/libc/test/UnitTest/BazelFilePath.cpp
@@ -13,7 +13,7 @@
#include "src/__support/CPP/string.h"
#include "src/__support/c_string.h"
-namespace __llvm_libc::testing {
+namespace LIBC_NAMESPACE::testing {
CString libc_make_test_file_path_func(const char *file_name) {
// This is the path to the folder bazel wants the test outputs written to.
@@ -22,4 +22,4 @@ CString libc_make_test_file_path_func(const char *file_name) {
return cpp::string(UNDECLARED_OUTPUTS_PATH) + file_name;
}
-} // namespace __llvm_libc::testing
+} // namespace LIBC_NAMESPACE::testing
diff --git a/libc/test/UnitTest/CmakeFilePath.cpp b/libc/test/UnitTest/CmakeFilePath.cpp
index 1e89167a002755d..2a7d1c39d3205cb 100644
--- a/libc/test/UnitTest/CmakeFilePath.cpp
+++ b/libc/test/UnitTest/CmakeFilePath.cpp
@@ -11,10 +11,10 @@
#include "src/__support/CPP/string.h"
#include "src/__support/c_string.h"
-namespace __llvm_libc::testing {
+namespace LIBC_NAMESPACE::testing {
CString libc_make_test_file_path_func(const char *file_name) {
return cpp::string(file_name);
}
-} // namespace __llvm_libc::testing
+} // namespace LIBC_NAMESPACE::testing
diff --git a/libc/test/UnitTest/ErrnoSetterMatcher.h b/libc/test/UnitTest/ErrnoSetterMatcher.h
index 1d786c7e462b159..c7f1272608c7450 100644
--- a/libc/test/UnitTest/ErrnoSetterMatcher.h
+++ b/libc/test/UnitTest/ErrnoSetterMatcher.h
@@ -16,7 +16,7 @@
#include "src/errno/libc_errno.h"
#include "test/UnitTest/Test.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
namespace testing {
namespace internal {
@@ -93,6 +93,6 @@ static internal::ErrnoSetterMatcher<RetT> Fails(int ExpectedErrno,
} // namespace ErrnoSetterMatcher
} // namespace testing
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_TEST_ERRNOSETTERMATCHER_H
diff --git a/libc/test/UnitTest/ExecuteFunction.h b/libc/test/UnitTest/ExecuteFunction.h
index 335720fdba2c7bb..2129e63a3a0029d 100644
--- a/libc/test/UnitTest/ExecuteFunction.h
+++ b/libc/test/UnitTest/ExecuteFunction.h
@@ -11,7 +11,7 @@
#include <stdint.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
namespace testutils {
class FunctionCaller {
@@ -47,6 +47,6 @@ invoke_in_subprocess(FunctionCaller *func,
const char *signal_as_string(int signum);
} // namespace testutils
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_UTILS_TESTUTILS_EXECUTEFUNCTION_H
diff --git a/libc/test/UnitTest/ExecuteFunctionUnix.cpp b/libc/test/UnitTest/ExecuteFunctionUnix.cpp
index 1caaa24b8d41464..b244337f9c6fcd6 100644
--- a/libc/test/UnitTest/ExecuteFunctionUnix.cpp
+++ b/libc/test/UnitTest/ExecuteFunctionUnix.cpp
@@ -17,7 +17,7 @@
#include <sys/wait.h>
#include <unistd.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
namespace testutils {
bool ProcessStatus::exited_normally() { return WIFEXITED(platform_defined); }
@@ -78,4 +78,4 @@ ProcessStatus invoke_in_subprocess(FunctionCaller *func, unsigned timeout_ms) {
const char *signal_as_string(int signum) { return ::strsignal(signum); }
} // namespace testutils
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/test/UnitTest/FPExceptMatcher.cpp b/libc/test/UnitTest/FPExceptMatcher.cpp
index c712fec01d485c9..1601b7e53f2be1b 100644
--- a/libc/test/UnitTest/FPExceptMatcher.cpp
+++ b/libc/test/UnitTest/FPExceptMatcher.cpp
@@ -13,7 +13,7 @@
#include <setjmp.h>
#include <signal.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
namespace testing {
#if defined(_WIN32)
@@ -47,4 +47,4 @@ FPExceptMatcher::FPExceptMatcher(FunctionCaller *func) {
}
} // namespace testing
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/test/UnitTest/FPExceptMatcher.h b/libc/test/UnitTest/FPExceptMatcher.h
index 1563561854abdb5..98c4f737d172753 100644
--- a/libc/test/UnitTest/FPExceptMatcher.h
+++ b/libc/test/UnitTest/FPExceptMatcher.h
@@ -13,7 +13,7 @@
#include "test/UnitTest/Test.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
namespace testing {
// TODO: Make the matcher match specific exceptions instead of just identifying
@@ -50,13 +50,13 @@ class FPExceptMatcher : public Matcher<bool> {
};
} // namespace testing
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#define ASSERT_RAISES_FP_EXCEPT(func) \
ASSERT_THAT( \
true, \
- __llvm_libc::testing::FPExceptMatcher( \
- __llvm_libc::testing::FPExceptMatcher::getFunctionCaller(func)))
+ LIBC_NAMESPACE::testing::FPExceptMatcher( \
+ LIBC_NAMESPACE::testing::FPExceptMatcher::getFunctionCaller(func)))
#else
#define ASSERT_RAISES_FP_EXCEPT(func) ASSERT_DEATH(func, WITH_SIGNAL(SIGFPE))
#endif // LIBC_COPT_TEST_USE_FUCHSIA
diff --git a/libc/test/UnitTest/FPMatcher.h b/libc/test/UnitTest/FPMatcher.h
index d8d032b3ef530d0..0c1f340449236e2 100644
--- a/libc/test/UnitTest/FPMatcher.h
+++ b/libc/test/UnitTest/FPMatcher.h
@@ -18,7 +18,7 @@
#include <math.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
namespace testing {
template <typename T, TestCond Condition> class FPMatcher : public Matcher<T> {
@@ -60,10 +60,10 @@ template <TestCond C, typename T> FPMatcher<T, C> getMatcher(T expectedValue) {
}
} // namespace testing
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#define DECLARE_SPECIAL_CONSTANTS(T) \
- using FPBits = __llvm_libc::fputil::FPBits<T>; \
+ using FPBits = LIBC_NAMESPACE::fputil::FPBits<T>; \
using UIntType = typename FPBits::UIntType; \
const T zero = T(FPBits::zero()); \
const T neg_zero = T(FPBits::neg_zero()); \
@@ -72,35 +72,27 @@ template <TestCond C, typename T> FPMatcher<T, C> getMatcher(T expectedValue) {
const T neg_inf = T(FPBits::neg_inf());
#define EXPECT_FP_EQ(expected, actual) \
- EXPECT_THAT( \
- actual, \
- __llvm_libc::testing::getMatcher<__llvm_libc::testing::TestCond::EQ>( \
- expected))
+ EXPECT_THAT(actual, LIBC_NAMESPACE::testing::getMatcher< \
+ LIBC_NAMESPACE::testing::TestCond::EQ>(expected))
#define TEST_FP_EQ(expected, actual) \
- __llvm_libc::testing::getMatcher<__llvm_libc::testing::TestCond::EQ>( \
+ LIBC_NAMESPACE::testing::getMatcher<LIBC_NAMESPACE::testing::TestCond::EQ>( \
expected) \
.match(actual)
#define EXPECT_FP_IS_NAN(actual) EXPECT_TRUE((actual) != (actual))
#define ASSERT_FP_EQ(expected, actual) \
- ASSERT_THAT( \
- actual, \
- __llvm_libc::testing::getMatcher<__llvm_libc::testing::TestCond::EQ>( \
- expected))
+ ASSERT_THAT(actual, LIBC_NAMESPACE::testing::getMatcher< \
+ LIBC_NAMESPACE::testing::TestCond::EQ>(expected))
#define EXPECT_FP_NE(expected, actual) \
- EXPECT_THAT( \
- actual, \
- __llvm_libc::testing::getMatcher<__llvm_libc::testing::TestCond::NE>( \
- expected))
+ EXPECT_THAT(actual, LIBC_NAMESPACE::testing::getMatcher< \
+ LIBC_NAMESPACE::testing::TestCond::NE>(expected))
#define ASSERT_FP_NE(expected, actual) \
- ASSERT_THAT( \
- actual, \
- __llvm_libc::testing::getMatcher<__llvm_libc::testing::TestCond::NE>( \
- expected))
+ ASSERT_THAT(actual, LIBC_NAMESPACE::testing::getMatcher< \
+ LIBC_NAMESPACE::testing::TestCond::NE>(expected))
#define EXPECT_MATH_ERRNO(expected) \
do { \
@@ -123,7 +115,7 @@ template <TestCond C, typename T> FPMatcher<T, C> getMatcher(T expectedValue) {
#define EXPECT_FP_EXCEPTION(expected) \
do { \
if (math_errhandling & MATH_ERREXCEPT) { \
- EXPECT_GE(__llvm_libc::fputil::test_except(FE_ALL_EXCEPT) & expected, \
+ EXPECT_GE(LIBC_NAMESPACE::fputil::test_except(FE_ALL_EXCEPT) & expected, \
expected); \
} \
} while (0)
@@ -131,38 +123,38 @@ template <TestCond C, typename T> FPMatcher<T, C> getMatcher(T expectedValue) {
#define ASSERT_FP_EXCEPTION(expected) \
do { \
if (math_errhandling & MATH_ERREXCEPT) { \
- ASSERT_GE(__llvm_libc::fputil::test_except(FE_ALL_EXCEPT) & expected, \
+ ASSERT_GE(LIBC_NAMESPACE::fputil::test_except(FE_ALL_EXCEPT) & expected, \
expected); \
} \
} while (0)
#define EXPECT_FP_EQ_WITH_EXCEPTION(expected_val, actual_val, expected_except) \
do { \
- __llvm_libc::fputil::clear_except(FE_ALL_EXCEPT); \
+ LIBC_NAMESPACE::fputil::clear_except(FE_ALL_EXCEPT); \
EXPECT_FP_EQ(expected_val, actual_val); \
if (math_errhandling & MATH_ERREXCEPT) { \
- EXPECT_GE(__llvm_libc::fputil::test_except(FE_ALL_EXCEPT) & \
+ EXPECT_GE(LIBC_NAMESPACE::fputil::test_except(FE_ALL_EXCEPT) & \
expected_except, \
expected_except); \
- __llvm_libc::fputil::clear_except(FE_ALL_EXCEPT); \
+ LIBC_NAMESPACE::fputil::clear_except(FE_ALL_EXCEPT); \
} \
} while (0)
#define EXPECT_FP_IS_NAN_WITH_EXCEPTION(actual_val, expected_except) \
do { \
- __llvm_libc::fputil::clear_except(FE_ALL_EXCEPT); \
+ LIBC_NAMESPACE::fputil::clear_except(FE_ALL_EXCEPT); \
EXPECT_FP_IS_NAN(actual_val); \
if (math_errhandling & MATH_ERREXCEPT) { \
- EXPECT_GE(__llvm_libc::fputil::test_except(FE_ALL_EXCEPT) & \
+ EXPECT_GE(LIBC_NAMESPACE::fputil::test_except(FE_ALL_EXCEPT) & \
expected_except, \
expected_except); \
- __llvm_libc::fputil::clear_except(FE_ALL_EXCEPT); \
+ LIBC_NAMESPACE::fputil::clear_except(FE_ALL_EXCEPT); \
} \
} while (0)
#define EXPECT_FP_EQ_ALL_ROUNDING(expected, actual) \
do { \
- using namespace __llvm_libc::fputil::testing; \
+ using namespace LIBC_NAMESPACE::fputil::testing; \
ForceRoundingMode __r1(RoundingMode::Nearest); \
if (__r1.success) \
EXPECT_FP_EQ((expected), (actual)); \
diff --git a/libc/test/UnitTest/FuchsiaTest.h b/libc/test/UnitTest/FuchsiaTest.h
index f711e83bdf26028..07a6e9b3f6bde5a 100644
--- a/libc/test/UnitTest/FuchsiaTest.h
+++ b/libc/test/UnitTest/FuchsiaTest.h
@@ -20,7 +20,7 @@
#define EXPECT_DEATH(FUNC, SIG) ([&] { ASSERT_DEATH(FUNC, SIG); }())
#endif
-namespace __llvm_libc::testing {
+namespace LIBC_NAMESPACE::testing {
using Test = ::zxtest::Test;
}
diff --git a/libc/test/UnitTest/HermeticTestUtils.cpp b/libc/test/UnitTest/HermeticTestUtils.cpp
index 3d88b0ed64e81e5..73d54b9eeb5ecc9 100644
--- a/libc/test/UnitTest/HermeticTestUtils.cpp
+++ b/libc/test/UnitTest/HermeticTestUtils.cpp
@@ -9,7 +9,7 @@
#include <stddef.h>
#include <stdint.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int bcmp(const void *lhs, const void *rhs, size_t count);
void bzero(void *ptr, size_t count);
@@ -19,7 +19,7 @@ void *memmove(void *dst, const void *src, size_t count);
void *memset(void *ptr, int value, size_t count);
int atexit(void (*func)(void));
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
namespace {
@@ -43,24 +43,24 @@ extern "C" {
// This is done manually as not all targets support aliases.
int bcmp(const void *lhs, const void *rhs, size_t count) {
- return __llvm_libc::bcmp(lhs, rhs, count);
+ return LIBC_NAMESPACE::bcmp(lhs, rhs, count);
}
-void bzero(void *ptr, size_t count) { __llvm_libc::bzero(ptr, count); }
+void bzero(void *ptr, size_t count) { LIBC_NAMESPACE::bzero(ptr, count); }
int memcmp(const void *lhs, const void *rhs, size_t count) {
- return __llvm_libc::memcmp(lhs, rhs, count);
+ return LIBC_NAMESPACE::memcmp(lhs, rhs, count);
}
void *memcpy(void *__restrict dst, const void *__restrict src, size_t count) {
- return __llvm_libc::memcpy(dst, src, count);
+ return LIBC_NAMESPACE::memcpy(dst, src, count);
}
void *memmove(void *dst, const void *src, size_t count) {
- return __llvm_libc::memmove(dst, src, count);
+ return LIBC_NAMESPACE::memmove(dst, src, count);
}
void *memset(void *ptr, int value, size_t count) {
- return __llvm_libc::memset(ptr, value, count);
+ return LIBC_NAMESPACE::memset(ptr, value, count);
}
// This is needed if the test was compiled with '-fno-use-cxa-atexit'.
-int atexit(void (*func)(void)) { return __llvm_libc::atexit(func); }
+int atexit(void (*func)(void)) { return LIBC_NAMESPACE::atexit(func); }
constexpr uint64_t ALIGNMENT = alignof(uintptr_t);
diff --git a/libc/test/UnitTest/LibcDeathTestExecutors.cpp b/libc/test/UnitTest/LibcDeathTestExecutors.cpp
index f25c0f77240024a..e891c4e3c0b586f 100644
--- a/libc/test/UnitTest/LibcDeathTestExecutors.cpp
+++ b/libc/test/UnitTest/LibcDeathTestExecutors.cpp
@@ -13,7 +13,7 @@
#include <cassert>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
namespace testing {
bool Test::testProcessKilled(testutils::FunctionCaller *Func, int Signal,
@@ -101,4 +101,4 @@ bool Test::testProcessExits(testutils::FunctionCaller *Func, int ExitCode,
}
} // namespace testing
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/test/UnitTest/LibcTest.cpp b/libc/test/UnitTest/LibcTest.cpp
index d9a9e50ca9a65be..2f18d5778e71d84 100644
--- a/libc/test/UnitTest/LibcTest.cpp
+++ b/libc/test/UnitTest/LibcTest.cpp
@@ -17,21 +17,21 @@
#include <time.h>
#elif defined(LIBC_TARGET_ARCH_IS_GPU)
#include "src/__support/GPU/utils.h"
-static long clock() { return __llvm_libc::gpu::fixed_frequency_clock(); }
+static long clock() { return LIBC_NAMESPACE::gpu::fixed_frequency_clock(); }
#if defined(LIBC_TARGET_ARCH_IS_NVPTX)
#define CLOCKS_PER_SEC 1000000000UL
#else
// The AMDGPU loader needs to initialize this at runtime by querying the driver.
extern "C" [[gnu::visibility("protected")]] uint64_t
- [[clang::address_space(4)]] __llvm_libc_clock_freq;
-#define CLOCKS_PER_SEC __llvm_libc_clock_freq
+ [[clang::address_space(4)]] LIBC_NAMESPACE_clock_freq;
+#define CLOCKS_PER_SEC LIBC_NAMESPACE_clock_freq
#endif
#else
static long clock() { return 0; }
#define CLOCKS_PER_SEC 1
#endif
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
namespace testing {
namespace internal {
@@ -244,52 +244,43 @@ template bool test<__uint128_t>(RunContext *Ctx, TestCond Cond, __uint128_t LHS,
const char *RHSStr, Location Loc);
#endif
-template bool test<__llvm_libc::cpp::Int<128>>(RunContext *Ctx, TestCond Cond,
- __llvm_libc::cpp::Int<128> LHS,
- __llvm_libc::cpp::Int<128> RHS,
- const char *LHSStr,
- const char *RHSStr,
- Location Loc);
+template bool test<LIBC_NAMESPACE::cpp::Int<128>>(
+ RunContext *Ctx, TestCond Cond, LIBC_NAMESPACE::cpp::Int<128> LHS,
+ LIBC_NAMESPACE::cpp::Int<128> RHS, const char *LHSStr, const char *RHSStr,
+ Location Loc);
-template bool test<__llvm_libc::cpp::UInt<128>>(RunContext *Ctx, TestCond Cond,
- __llvm_libc::cpp::UInt<128> LHS,
- __llvm_libc::cpp::UInt<128> RHS,
- const char *LHSStr,
- const char *RHSStr,
- Location Loc);
+template bool test<LIBC_NAMESPACE::cpp::UInt<128>>(
+ RunContext *Ctx, TestCond Cond, LIBC_NAMESPACE::cpp::UInt<128> LHS,
+ LIBC_NAMESPACE::cpp::UInt<128> RHS, const char *LHSStr, const char *RHSStr,
+ Location Loc);
-template bool test<__llvm_libc::cpp::UInt<192>>(RunContext *Ctx, TestCond Cond,
- __llvm_libc::cpp::UInt<192> LHS,
- __llvm_libc::cpp::UInt<192> RHS,
- const char *LHSStr,
- const char *RHSStr,
- Location Loc);
+template bool test<LIBC_NAMESPACE::cpp::UInt<192>>(
+ RunContext *Ctx, TestCond Cond, LIBC_NAMESPACE::cpp::UInt<192> LHS,
+ LIBC_NAMESPACE::cpp::UInt<192> RHS, const char *LHSStr, const char *RHSStr,
+ Location Loc);
-template bool test<__llvm_libc::cpp::UInt<256>>(RunContext *Ctx, TestCond Cond,
- __llvm_libc::cpp::UInt<256> LHS,
- __llvm_libc::cpp::UInt<256> RHS,
- const char *LHSStr,
- const char *RHSStr,
- Location Loc);
+template bool test<LIBC_NAMESPACE::cpp::UInt<256>>(
+ RunContext *Ctx, TestCond Cond, LIBC_NAMESPACE::cpp::UInt<256> LHS,
+ LIBC_NAMESPACE::cpp::UInt<256> RHS, const char *LHSStr, const char *RHSStr,
+ Location Loc);
+
+template bool test<LIBC_NAMESPACE::cpp::UInt<320>>(
+ RunContext *Ctx, TestCond Cond, LIBC_NAMESPACE::cpp::UInt<320> LHS,
+ LIBC_NAMESPACE::cpp::UInt<320> RHS, const char *LHSStr, const char *RHSStr,
+ Location Loc);
-template bool test<__llvm_libc::cpp::UInt<320>>(RunContext *Ctx, TestCond Cond,
- __llvm_libc::cpp::UInt<320> LHS,
- __llvm_libc::cpp::UInt<320> RHS,
+template bool test<LIBC_NAMESPACE::cpp::string_view>(
+ RunContext *Ctx, TestCond Cond, LIBC_NAMESPACE::cpp::string_view LHS,
+ LIBC_NAMESPACE::cpp::string_view RHS, const char *LHSStr,
+ const char *RHSStr, Location Loc);
+
+template bool test<LIBC_NAMESPACE::cpp::string>(RunContext *Ctx, TestCond Cond,
+ LIBC_NAMESPACE::cpp::string LHS,
+ LIBC_NAMESPACE::cpp::string RHS,
const char *LHSStr,
const char *RHSStr,
Location Loc);
-template bool test<__llvm_libc::cpp::string_view>(
- RunContext *Ctx, TestCond Cond, __llvm_libc::cpp::string_view LHS,
- __llvm_libc::cpp::string_view RHS, const char *LHSStr, const char *RHSStr,
- Location Loc);
-
-template bool test<__llvm_libc::cpp::string>(RunContext *Ctx, TestCond Cond,
- __llvm_libc::cpp::string LHS,
- __llvm_libc::cpp::string RHS,
- const char *LHSStr,
- const char *RHSStr, Location Loc);
-
} // namespace internal
bool Test::testStrEq(const char *LHS, const char *RHS, const char *LHSStr,
@@ -321,4 +312,4 @@ bool Test::testMatch(bool MatchResult, MatcherBase &Matcher, const char *LHSStr,
}
} // namespace testing
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/test/UnitTest/LibcTest.h b/libc/test/UnitTest/LibcTest.h
index d01618d008c7091..dc17c3c49d4277e 100644
--- a/libc/test/UnitTest/LibcTest.h
+++ b/libc/test/UnitTest/LibcTest.h
@@ -18,7 +18,7 @@
// This is defined as a macro here to avoid namespace issues.
#define libc_make_test_file_path(file_name) \
- (__llvm_libc::testing::libc_make_test_file_path_func(file_name))
+ (LIBC_NAMESPACE::testing::libc_make_test_file_path_func(file_name))
// This file can only include headers from src/__support/ or test/UnitTest. No
// other headers should be included.
@@ -32,7 +32,7 @@
#include "test/UnitTest/ExecuteFunction.h"
#include "test/UnitTest/TestLogger.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
namespace testing {
// Only the following conditions are supported. Notice that we do not have
@@ -67,7 +67,7 @@ struct Location {
TestLogger &operator<<(TestLogger &logger, Location Loc);
#define LIBC_TEST_LOC_() \
- __llvm_libc::testing::internal::Location(__FILE__, __LINE__)
+ LIBC_NAMESPACE::testing::internal::Location(__FILE__, __LINE__)
// Object to forward custom logging after the EXPECT / ASSERT macros.
struct Message {
@@ -150,16 +150,16 @@ class Test {
template <
typename ValType,
- cpp::enable_if_t<cpp::is_same_v<ValType, __llvm_libc::cpp::string_view>,
- int> = 0>
+ cpp::enable_if_t<
+ cpp::is_same_v<ValType, LIBC_NAMESPACE::cpp::string_view>, int> = 0>
bool test(TestCond Cond, ValType LHS, ValType RHS, const char *LHSStr,
const char *RHSStr, internal::Location Loc) {
return internal::test(Ctx, Cond, LHS, RHS, LHSStr, RHSStr, Loc);
}
template <typename ValType,
- cpp::enable_if_t<cpp::is_same_v<ValType, __llvm_libc::cpp::string>,
- int> = 0>
+ cpp::enable_if_t<
+ cpp::is_same_v<ValType, LIBC_NAMESPACE::cpp::string>, int> = 0>
bool test(TestCond Cond, ValType LHS, ValType RHS, const char *LHSStr,
const char *RHSStr, internal::Location Loc) {
return internal::test(Ctx, Cond, LHS, RHS, LHSStr, RHSStr, Loc);
@@ -225,8 +225,9 @@ constexpr bool valid_prefix(char const *lhs) {
}
// 'str' is a null terminated string of the form
-// "const char *__llvm_libc::testing::internal::GetTypeName() [ParamType = XXX]"
-// We return the substring that start at character '[' or a default message.
+// "const char *LIBC_NAMESPACE::testing::internal::GetTypeName() [ParamType =
+// XXX]" We return the substring that start at character '[' or a default
+// message.
constexpr char const *GetPrettyFunctionParamType(char const *str) {
for (const char *ptr = str; *ptr != '\0'; ++ptr)
if (*ptr == '[')
@@ -292,13 +293,13 @@ template <typename... Types> struct TypeList {
} // namespace internal
-// Make TypeList visible in __llvm_libc::testing.
+// Make TypeList visible in LIBC_NAMESPACE::testing.
template <typename... Types> using TypeList = internal::TypeList<Types...>;
CString libc_make_test_file_path_func(const char *file_name);
} // namespace testing
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
// For TYPED_TEST and TYPED_TEST_F below we need to display which type was used
// to run the test. The default will return the fully qualified canonical type
@@ -306,22 +307,23 @@ CString libc_make_test_file_path_func(const char *file_name);
// client to register the type name as they see it in the code.
#define REGISTER_TYPE_NAME(TYPE) \
template <> \
- constexpr const char *__llvm_libc::testing::internal::GetTypeName<TYPE>() { \
+ constexpr const char * \
+ LIBC_NAMESPACE::testing::internal::GetTypeName<TYPE>() { \
return "[ParamType = " #TYPE "]"; \
}
#define TYPED_TEST(SuiteName, TestName, TypeList) \
static_assert( \
- __llvm_libc::testing::internal::valid_prefix(#SuiteName), \
+ LIBC_NAMESPACE::testing::internal::valid_prefix(#SuiteName), \
"All LLVM-libc TYPED_TEST suite names must start with 'LlvmLibc'."); \
template <typename T> \
- class SuiteName##_##TestName : public __llvm_libc::testing::Test { \
+ class SuiteName##_##TestName : public LIBC_NAMESPACE::testing::Test { \
public: \
using ParamType = T; \
char name[256]; \
SuiteName##_##TestName() { \
addTest(this); \
- __llvm_libc::testing::internal::GenerateName<T>( \
+ LIBC_NAMESPACE::testing::internal::GenerateName<T>( \
name, sizeof(name), #SuiteName "." #TestName); \
} \
void Run() override; \
@@ -332,7 +334,7 @@ CString libc_make_test_file_path_func(const char *file_name);
template <typename T> void SuiteName##_##TestName<T>::Run()
#define TYPED_TEST_F(SuiteClass, TestName, TypeList) \
- static_assert(__llvm_libc::testing::internal::valid_prefix(#SuiteClass), \
+ static_assert(LIBC_NAMESPACE::testing::internal::valid_prefix(#SuiteClass), \
"All LLVM-libc TYPED_TEST_F suite class names must start " \
"with 'LlvmLibc'."); \
template <typename T> class SuiteClass##_##TestName : public SuiteClass<T> { \
@@ -341,7 +343,7 @@ CString libc_make_test_file_path_func(const char *file_name);
char name[256]; \
SuiteClass##_##TestName() { \
SuiteClass<T>::addTest(this); \
- __llvm_libc::testing::internal::GenerateName<T>( \
+ LIBC_NAMESPACE::testing::internal::GenerateName<T>( \
name, sizeof(name), #SuiteClass "." #TestName); \
} \
void Run() override; \
@@ -352,9 +354,9 @@ CString libc_make_test_file_path_func(const char *file_name);
template <typename T> void SuiteClass##_##TestName<T>::Run()
#define TEST(SuiteName, TestName) \
- static_assert(__llvm_libc::testing::internal::valid_prefix(#SuiteName), \
+ static_assert(LIBC_NAMESPACE::testing::internal::valid_prefix(#SuiteName), \
"All LLVM-libc TEST suite names must start with 'LlvmLibc'."); \
- class SuiteName##_##TestName : public __llvm_libc::testing::Test { \
+ class SuiteName##_##TestName : public LIBC_NAMESPACE::testing::Test { \
public: \
SuiteName##_##TestName() { addTest(this); } \
void Run() override; \
@@ -365,7 +367,7 @@ CString libc_make_test_file_path_func(const char *file_name);
#define TEST_F(SuiteClass, TestName) \
static_assert( \
- __llvm_libc::testing::internal::valid_prefix(#SuiteClass), \
+ LIBC_NAMESPACE::testing::internal::valid_prefix(#SuiteClass), \
"All LLVM-libc TEST_F suite class names must start with 'LlvmLibc'."); \
class SuiteClass##_##TestName : public SuiteClass { \
public: \
@@ -404,12 +406,12 @@ CString libc_make_test_file_path_func(const char *file_name);
if (TEST) \
; \
else \
- RET_OR_EMPTY __llvm_libc::testing::internal::Failure() = \
- __llvm_libc::testing::internal::Message()
+ RET_OR_EMPTY LIBC_NAMESPACE::testing::internal::Failure() = \
+ LIBC_NAMESPACE::testing::internal::Message()
#define LIBC_TEST_BINOP_(COND, LHS, RHS, RET_OR_EMPTY) \
- LIBC_TEST_SCAFFOLDING_(test(__llvm_libc::testing::TestCond::COND, LHS, RHS, \
- #LHS, #RHS, LIBC_TEST_LOC_()), \
+ LIBC_TEST_SCAFFOLDING_(test(LIBC_NAMESPACE::testing::TestCond::COND, LHS, \
+ RHS, #LHS, #RHS, LIBC_TEST_LOC_()), \
RET_OR_EMPTY)
////////////////////////////////////////////////////////////////////////////////
@@ -462,7 +464,7 @@ CString libc_make_test_file_path_func(const char *file_name);
#define LIBC_TEST_PROCESS_(TEST_FUNC, FUNC, VALUE, RET_OR_EMPTY) \
LIBC_TEST_SCAFFOLDING_( \
- TEST_FUNC(__llvm_libc::testing::Test::createCallable(FUNC), VALUE, \
+ TEST_FUNC(LIBC_NAMESPACE::testing::Test::createCallable(FUNC), VALUE, \
#FUNC, #VALUE, LIBC_TEST_LOC_()), \
RET_OR_EMPTY)
diff --git a/libc/test/UnitTest/LibcTestMain.cpp b/libc/test/UnitTest/LibcTestMain.cpp
index 756d1196bc36564..bf1a921c04ca98c 100644
--- a/libc/test/UnitTest/LibcTestMain.cpp
+++ b/libc/test/UnitTest/LibcTestMain.cpp
@@ -13,10 +13,10 @@ static const char *getTestFilter(int argc, char *argv[]) {
}
extern "C" int main(int argc, char **argv, char **envp) {
- __llvm_libc::testing::argc = argc;
- __llvm_libc::testing::argv = argv;
- __llvm_libc::testing::envp = envp;
+ LIBC_NAMESPACE::testing::argc = argc;
+ LIBC_NAMESPACE::testing::argv = argv;
+ LIBC_NAMESPACE::testing::envp = envp;
const char *TestFilter = getTestFilter(argc, argv);
- return __llvm_libc::testing::Test::runTests(TestFilter);
+ return LIBC_NAMESPACE::testing::Test::runTests(TestFilter);
}
diff --git a/libc/test/UnitTest/MemoryMatcher.cpp b/libc/test/UnitTest/MemoryMatcher.cpp
index 32f7d5e17e0208d..d9d89504dbeba79 100644
--- a/libc/test/UnitTest/MemoryMatcher.cpp
+++ b/libc/test/UnitTest/MemoryMatcher.cpp
@@ -10,9 +10,9 @@
#include "test/UnitTest/Test.h"
-using __llvm_libc::testing::tlog;
+using LIBC_NAMESPACE::testing::tlog;
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
namespace testing {
template <typename T>
@@ -75,4 +75,4 @@ void MemoryMatcher::explainError() {
}
} // namespace testing
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/test/UnitTest/MemoryMatcher.h b/libc/test/UnitTest/MemoryMatcher.h
index e3df4c09315c9f3..cf861a6757ae174 100644
--- a/libc/test/UnitTest/MemoryMatcher.h
+++ b/libc/test/UnitTest/MemoryMatcher.h
@@ -13,35 +13,35 @@
#include "test/UnitTest/Test.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
namespace testing {
-using MemoryView = __llvm_libc::cpp::span<const char>;
+using MemoryView = LIBC_NAMESPACE::cpp::span<const char>;
} // namespace testing
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#ifdef LIBC_COPT_TEST_USE_FUCHSIA
#define EXPECT_MEM_EQ(expected, actual) \
do { \
- __llvm_libc::testing::MemoryView e = (expected); \
- __llvm_libc::testing::MemoryView a = (actual); \
+ LIBC_NAMESPACE::testing::MemoryView e = (expected); \
+ LIBC_NAMESPACE::testing::MemoryView a = (actual); \
ASSERT_EQ(e.size(), a.size()); \
EXPECT_BYTES_EQ(e.data(), a.data(), e.size()); \
} while (0)
#define ASSERT_MEM_EQ(expected, actual) \
do { \
- __llvm_libc::testing::MemoryView e = (expected); \
- __llvm_libc::testing::MemoryView a = (actual); \
+ LIBC_NAMESPACE::testing::MemoryView e = (expected); \
+ LIBC_NAMESPACE::testing::MemoryView a = (actual); \
ASSERT_EQ(e.size(), a.size()); \
ASSERT_BYTES_EQ(e.data(), a.data(), e.size()); \
} while (0)
#else
-namespace __llvm_libc::testing {
+namespace LIBC_NAMESPACE::testing {
class MemoryMatcher : public Matcher<MemoryView> {
MemoryView expected;
@@ -57,12 +57,12 @@ class MemoryMatcher : public Matcher<MemoryView> {
void explainError() override;
};
-} // namespace __llvm_libc::testing
+} // namespace LIBC_NAMESPACE::testing
#define EXPECT_MEM_EQ(expected, actual) \
- EXPECT_THAT(actual, __llvm_libc::testing::MemoryMatcher(expected))
+ EXPECT_THAT(actual, LIBC_NAMESPACE::testing::MemoryMatcher(expected))
#define ASSERT_MEM_EQ(expected, actual) \
- ASSERT_THAT(actual, __llvm_libc::testing::MemoryMatcher(expected))
+ ASSERT_THAT(actual, LIBC_NAMESPACE::testing::MemoryMatcher(expected))
#endif
diff --git a/libc/test/UnitTest/PigweedTest.h b/libc/test/UnitTest/PigweedTest.h
index f3b33b76be4bd32..855633527fb3596 100644
--- a/libc/test/UnitTest/PigweedTest.h
+++ b/libc/test/UnitTest/PigweedTest.h
@@ -11,7 +11,7 @@
#include <gtest/gtest.h>
-namespace __llvm_libc::testing {
+namespace LIBC_NAMESPACE::testing {
using Test = ::testing::Test;
}
diff --git a/libc/test/UnitTest/PrintfMatcher.cpp b/libc/test/UnitTest/PrintfMatcher.cpp
index 019eafcfb4b220f..e895da2be120f8c 100644
--- a/libc/test/UnitTest/PrintfMatcher.cpp
+++ b/libc/test/UnitTest/PrintfMatcher.cpp
@@ -16,7 +16,7 @@
#include <stdint.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
namespace testing {
using printf_core::FormatFlags;
@@ -94,4 +94,4 @@ void FormatSectionMatcher::explainError() {
}
} // namespace testing
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/test/UnitTest/PrintfMatcher.h b/libc/test/UnitTest/PrintfMatcher.h
index 148c9ff80931dbb..a4fbeda4d585a6b 100644
--- a/libc/test/UnitTest/PrintfMatcher.h
+++ b/libc/test/UnitTest/PrintfMatcher.h
@@ -14,7 +14,7 @@
#include <errno.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
namespace testing {
class FormatSectionMatcher : public Matcher<printf_core::FormatSection> {
@@ -31,12 +31,12 @@ class FormatSectionMatcher : public Matcher<printf_core::FormatSection> {
};
} // namespace testing
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#define EXPECT_PFORMAT_EQ(expected, actual) \
- EXPECT_THAT(actual, __llvm_libc::testing::FormatSectionMatcher(expected))
+ EXPECT_THAT(actual, LIBC_NAMESPACE::testing::FormatSectionMatcher(expected))
#define ASSERT_PFORMAT_EQ(expected, actual) \
- ASSERT_THAT(actual, __llvm_libc::testing::FormatSectionMatcher(expected))
+ ASSERT_THAT(actual, LIBC_NAMESPACE::testing::FormatSectionMatcher(expected))
#endif // LLVM_LIBC_UTILS_UNITTEST_PRINTF_MATCHER_H
diff --git a/libc/test/UnitTest/RoundingModeUtils.cpp b/libc/test/UnitTest/RoundingModeUtils.cpp
index f880effd75a3512..c8f32f81e7134aa 100644
--- a/libc/test/UnitTest/RoundingModeUtils.cpp
+++ b/libc/test/UnitTest/RoundingModeUtils.cpp
@@ -12,7 +12,7 @@
#include <fenv.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
namespace fputil {
namespace testing {
@@ -48,4 +48,4 @@ ForceRoundingMode::~ForceRoundingMode() {
} // namespace testing
} // namespace fputil
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/test/UnitTest/RoundingModeUtils.h b/libc/test/UnitTest/RoundingModeUtils.h
index e8611c34b540337..d1c3c6ff400a542 100644
--- a/libc/test/UnitTest/RoundingModeUtils.h
+++ b/libc/test/UnitTest/RoundingModeUtils.h
@@ -11,7 +11,7 @@
#include <stdint.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
namespace fputil {
namespace testing {
@@ -32,6 +32,6 @@ template <RoundingMode R> struct ForceRoundingModeTest : ForceRoundingMode {
} // namespace testing
} // namespace fputil
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_UTILS_TESTUTILS_ROUNDINGMODEUTILS_H
diff --git a/libc/test/UnitTest/ScanfMatcher.cpp b/libc/test/UnitTest/ScanfMatcher.cpp
index 7374858910d5485..91cb73fb332ed3c 100644
--- a/libc/test/UnitTest/ScanfMatcher.cpp
+++ b/libc/test/UnitTest/ScanfMatcher.cpp
@@ -16,7 +16,7 @@
#include <stdint.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
namespace testing {
using scanf_core::FormatFlags;
@@ -99,4 +99,4 @@ void FormatSectionMatcher::explainError() {
}
} // namespace testing
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/test/UnitTest/ScanfMatcher.h b/libc/test/UnitTest/ScanfMatcher.h
index 864a35d74adeb8b..0b9a8868bf0b810 100644
--- a/libc/test/UnitTest/ScanfMatcher.h
+++ b/libc/test/UnitTest/ScanfMatcher.h
@@ -14,7 +14,7 @@
#include <errno.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
namespace testing {
class FormatSectionMatcher : public Matcher<scanf_core::FormatSection> {
@@ -31,12 +31,12 @@ class FormatSectionMatcher : public Matcher<scanf_core::FormatSection> {
};
} // namespace testing
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#define EXPECT_SFORMAT_EQ(expected, actual) \
- EXPECT_THAT(actual, __llvm_libc::testing::FormatSectionMatcher(expected))
+ EXPECT_THAT(actual, LIBC_NAMESPACE::testing::FormatSectionMatcher(expected))
#define ASSERT_SFORMAT_EQ(expected, actual) \
- ASSERT_THAT(actual, __llvm_libc::testing::FormatSectionMatcher(expected))
+ ASSERT_THAT(actual, LIBC_NAMESPACE::testing::FormatSectionMatcher(expected))
#endif // LLVM_LIBC_UTILS_UNITTEST_SCANF_MATCHER_H
diff --git a/libc/test/UnitTest/StringUtils.h b/libc/test/UnitTest/StringUtils.h
index 8f517a5ec9c8f48..ac28926d51cd897 100644
--- a/libc/test/UnitTest/StringUtils.h
+++ b/libc/test/UnitTest/StringUtils.h
@@ -12,7 +12,7 @@
#include "src/__support/CPP/string.h"
#include "src/__support/CPP/type_traits.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
// Return the first N hex digits of an integer as a string in upper case.
template <typename T>
@@ -31,6 +31,6 @@ int_to_hex(T value, size_t length = sizeof(T) * 2) {
return "0x" + s;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_UTILS_UNITTEST_SIMPLE_STRING_CONV_H
diff --git a/libc/test/UnitTest/TestLogger.cpp b/libc/test/UnitTest/TestLogger.cpp
index 02be4bdf5de8113..6bb0e17dc3888ef 100644
--- a/libc/test/UnitTest/TestLogger.cpp
+++ b/libc/test/UnitTest/TestLogger.cpp
@@ -6,13 +6,13 @@
#include <stdint.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
namespace testing {
// cpp::string_view specialization
template <>
TestLogger &TestLogger::operator<< <cpp::string_view>(cpp::string_view str) {
- __llvm_libc::write_to_stderr(str);
+ LIBC_NAMESPACE::write_to_stderr(str);
return *this;
}
@@ -83,4 +83,4 @@ template TestLogger &TestLogger::operator<< <cpp::UInt<320>>(cpp::UInt<320>);
TestLogger tlog;
} // namespace testing
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/test/UnitTest/TestLogger.h b/libc/test/UnitTest/TestLogger.h
index 2d46ea1ca14657a..6188bcf4434afa8 100644
--- a/libc/test/UnitTest/TestLogger.h
+++ b/libc/test/UnitTest/TestLogger.h
@@ -9,7 +9,7 @@
#ifndef LLVM_LIBC_TEST_UNITTEST_TESTLOGGER_H
#define LLVM_LIBC_TEST_UNITTEST_TESTLOGGER_H
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
namespace testing {
// A class to log to standard output in the context of hermetic tests.
@@ -22,6 +22,6 @@ struct TestLogger {
extern TestLogger tlog;
} // namespace testing
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif /* LLVM_LIBC_TEST_UNITTEST_TESTLOGGER_H */
diff --git a/libc/test/integration/src/__support/threads/thread_detach_test.cpp b/libc/test/integration/src/__support/threads/thread_detach_test.cpp
index 300cf2c7be3b7a5..697d991d07547c4 100644
--- a/libc/test/integration/src/__support/threads/thread_detach_test.cpp
+++ b/libc/test/integration/src/__support/threads/thread_detach_test.cpp
@@ -10,7 +10,7 @@
#include "src/__support/threads/thread.h"
#include "test/IntegrationTest/test.h"
-__llvm_libc::Mutex mutex(false, false, false);
+LIBC_NAMESPACE::Mutex mutex(false, false, false);
int func(void *) {
mutex.lock();
@@ -20,13 +20,13 @@ int func(void *) {
void detach_simple_test() {
mutex.lock();
- __llvm_libc::Thread th;
+ LIBC_NAMESPACE::Thread th;
th.run(func, nullptr, nullptr, 0);
// Since |mutex| is held by the current thread, we guarantee that
// th is running and hence it is safe to detach. Since the thread is
// still running, it should be simple detach.
- ASSERT_EQ(th.detach(), int(__llvm_libc::DetachType::SIMPLE));
+ ASSERT_EQ(th.detach(), int(LIBC_NAMESPACE::DetachType::SIMPLE));
// We will release |mutex| now to let the thread finish an cleanup itself.
mutex.unlock();
@@ -34,7 +34,7 @@ void detach_simple_test() {
void detach_cleanup_test() {
mutex.lock();
- __llvm_libc::Thread th;
+ LIBC_NAMESPACE::Thread th;
ASSERT_EQ(0, th.run(func, nullptr));
// Since |mutex| is held by the current thread, we will release it
@@ -47,7 +47,7 @@ void detach_cleanup_test() {
// Since |th| is now finished, detaching should cleanup the thread
// resources.
- ASSERT_EQ(th.detach(), int(__llvm_libc::DetachType::CLEANUP));
+ ASSERT_EQ(th.detach(), int(LIBC_NAMESPACE::DetachType::CLEANUP));
}
TEST_MAIN() {
diff --git a/libc/test/integration/src/__support/threads/thread_tls_test.cpp b/libc/test/integration/src/__support/threads/thread_tls_test.cpp
index 2574f1f8b250028..d7ad54e52b81c00 100644
--- a/libc/test/integration/src/__support/threads/thread_tls_test.cpp
+++ b/libc/test/integration/src/__support/threads/thread_tls_test.cpp
@@ -24,12 +24,12 @@ int func(void *) {
void thread_local_test() {
int retval;
- __llvm_libc::Thread th1;
+ LIBC_NAMESPACE::Thread th1;
th1.run(func, nullptr, nullptr, 0);
th1.join(&retval);
ASSERT_EQ(retval, INIT_VAL);
- __llvm_libc::Thread th2;
+ LIBC_NAMESPACE::Thread th2;
th2.run(func, nullptr, nullptr, 0);
th2.join(&retval);
ASSERT_EQ(retval, INIT_VAL);
diff --git a/libc/test/integration/src/pthread/pthread_create_test.cpp b/libc/test/integration/src/pthread/pthread_create_test.cpp
index 20a1139efbfa1ed..6b8c41d65730e40 100644
--- a/libc/test/integration/src/pthread/pthread_create_test.cpp
+++ b/libc/test/integration/src/pthread/pthread_create_test.cpp
@@ -40,12 +40,12 @@ struct TestThreadArgs {
pthread_attr_t attrs;
void *ret;
};
-static __llvm_libc::AllocChecker global_ac;
-static __llvm_libc::cpp::Atomic<long> global_thr_count = 0;
+static LIBC_NAMESPACE::AllocChecker global_ac;
+static LIBC_NAMESPACE::cpp::Atomic<long> global_thr_count = 0;
static void *successThread(void *Arg) {
- pthread_t th = __llvm_libc::pthread_self();
- auto *thread = reinterpret_cast<__llvm_libc::Thread *>(&th);
+ pthread_t th = LIBC_NAMESPACE::pthread_self();
+ auto *thread = reinterpret_cast<LIBC_NAMESPACE::Thread *>(&th);
ASSERT_EQ(libc_errno, 0);
ASSERT_TRUE(thread);
@@ -59,22 +59,23 @@ static void *successThread(void *Arg) {
size_t expec_stacksize, expec_guardsize, expec_stacksize2;
int expec_detached;
- ASSERT_EQ(__llvm_libc::pthread_attr_getstack(expec_attrs, &expec_stack,
- &expec_stacksize),
+ ASSERT_EQ(LIBC_NAMESPACE::pthread_attr_getstack(expec_attrs, &expec_stack,
+ &expec_stacksize),
0);
ASSERT_EQ(libc_errno, 0);
ASSERT_EQ(
- __llvm_libc::pthread_attr_getstacksize(expec_attrs, &expec_stacksize2),
+ LIBC_NAMESPACE::pthread_attr_getstacksize(expec_attrs, &expec_stacksize2),
0);
ASSERT_EQ(libc_errno, 0);
ASSERT_EQ(
- __llvm_libc::pthread_attr_getguardsize(expec_attrs, &expec_guardsize), 0);
+ LIBC_NAMESPACE::pthread_attr_getguardsize(expec_attrs, &expec_guardsize),
+ 0);
ASSERT_EQ(libc_errno, 0);
ASSERT_EQ(
- __llvm_libc::pthread_attr_getdetachstate(expec_attrs, &expec_detached),
+ LIBC_NAMESPACE::pthread_attr_getdetachstate(expec_attrs, &expec_detached),
0);
ASSERT_EQ(libc_errno, 0);
@@ -96,10 +97,10 @@ static void *successThread(void *Arg) {
ASSERT_EQ(expec_detached == PTHREAD_CREATE_JOINABLE,
thread->attrib->detach_state.load() ==
- static_cast<uint32_t>(__llvm_libc::DetachState::JOINABLE));
+ static_cast<uint32_t>(LIBC_NAMESPACE::DetachState::JOINABLE));
ASSERT_EQ(expec_detached == PTHREAD_CREATE_DETACHED,
thread->attrib->detach_state.load() ==
- static_cast<uint32_t>(__llvm_libc::DetachState::DETACHED));
+ static_cast<uint32_t>(LIBC_NAMESPACE::DetachState::DETACHED));
{
// Allocate some bytes on the stack on most of the stack and make sure we
@@ -123,7 +124,7 @@ static void *successThread(void *Arg) {
// [stack - expec_guardsize, stack) is both mapped and has PROT_NONE
// permissions. Maybe we can read from /proc/{self}/map?
- ASSERT_EQ(__llvm_libc::pthread_attr_destroy(expec_attrs), 0);
+ ASSERT_EQ(LIBC_NAMESPACE::pthread_attr_destroy(expec_attrs), 0);
ASSERT_EQ(libc_errno, 0);
// Arg is malloced, so free.
@@ -138,33 +139,33 @@ static void run_success_config(int detachstate, size_t guardsize,
TestThreadArgs *th_arg = new (global_ac) TestThreadArgs{};
pthread_attr_t *attr = &(th_arg->attrs);
- ASSERT_EQ(__llvm_libc::pthread_attr_init(attr), 0);
+ ASSERT_EQ(LIBC_NAMESPACE::pthread_attr_init(attr), 0);
ASSERT_EQ(libc_errno, 0);
- ASSERT_EQ(__llvm_libc::pthread_attr_setdetachstate(attr, detachstate), 0);
+ ASSERT_EQ(LIBC_NAMESPACE::pthread_attr_setdetachstate(attr, detachstate), 0);
ASSERT_EQ(libc_errno, 0);
- ASSERT_EQ(__llvm_libc::pthread_attr_setguardsize(attr, guardsize), 0);
+ ASSERT_EQ(LIBC_NAMESPACE::pthread_attr_setguardsize(attr, guardsize), 0);
ASSERT_EQ(libc_errno, 0);
void *Stack = nullptr;
if (customstack) {
- Stack = __llvm_libc::mmap(nullptr, stacksize, PROT_READ | PROT_WRITE,
- MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
+ Stack = LIBC_NAMESPACE::mmap(nullptr, stacksize, PROT_READ | PROT_WRITE,
+ MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
ASSERT_NE(Stack, MAP_FAILED);
ASSERT_NE(Stack, static_cast<void *>(nullptr));
ASSERT_EQ(libc_errno, 0);
- ASSERT_EQ(__llvm_libc::pthread_attr_setstack(attr, Stack, stacksize), 0);
+ ASSERT_EQ(LIBC_NAMESPACE::pthread_attr_setstack(attr, Stack, stacksize), 0);
ASSERT_EQ(libc_errno, 0);
} else {
- ASSERT_EQ(__llvm_libc::pthread_attr_setstacksize(attr, stacksize), 0);
+ ASSERT_EQ(LIBC_NAMESPACE::pthread_attr_setstacksize(attr, stacksize), 0);
ASSERT_EQ(libc_errno, 0);
}
void *expec_ret = nullptr;
if (detachstate == PTHREAD_CREATE_JOINABLE) {
- ASSERT_EQ(__llvm_libc::getrandom(&expec_ret, sizeof(expec_ret), 0),
+ ASSERT_EQ(LIBC_NAMESPACE::getrandom(&expec_ret, sizeof(expec_ret), 0),
static_cast<ssize_t>(sizeof(expec_ret)));
ASSERT_EQ(libc_errno, 0);
}
@@ -174,19 +175,19 @@ static void run_success_config(int detachstate, size_t guardsize,
pthread_t tid;
// th_arg and attr are cleanup by the thread.
- ASSERT_EQ(__llvm_libc::pthread_create(&tid, attr, successThread,
- reinterpret_cast<void *>(th_arg)),
+ ASSERT_EQ(LIBC_NAMESPACE::pthread_create(&tid, attr, successThread,
+ reinterpret_cast<void *>(th_arg)),
0);
ASSERT_EQ(libc_errno, 0);
if (detachstate == PTHREAD_CREATE_JOINABLE) {
void *th_ret;
- ASSERT_EQ(__llvm_libc::pthread_join(tid, &th_ret), 0);
+ ASSERT_EQ(LIBC_NAMESPACE::pthread_join(tid, &th_ret), 0);
ASSERT_EQ(libc_errno, 0);
ASSERT_EQ(th_ret, expec_ret);
if (customstack) {
- ASSERT_EQ(__llvm_libc::munmap(Stack, stacksize), 0);
+ ASSERT_EQ(LIBC_NAMESPACE::munmap(Stack, stacksize), 0);
ASSERT_EQ(libc_errno, 0);
}
} else {
@@ -197,7 +198,7 @@ static void run_success_config(int detachstate, size_t guardsize,
static void run_success_tests() {
// Test parameters
- using __llvm_libc::cpp::array;
+ using LIBC_NAMESPACE::cpp::array;
array<int, 2> detachstates = {PTHREAD_CREATE_DETACHED,
PTHREAD_CREATE_JOINABLE};
@@ -253,27 +254,28 @@ static void *failure_thread(void *) {
static void create_and_check_failure_thread(pthread_attr_t *attr) {
pthread_t tid;
- int result = __llvm_libc::pthread_create(&tid, attr, failure_thread, nullptr);
+ int result =
+ LIBC_NAMESPACE::pthread_create(&tid, attr, failure_thread, nullptr);
// EINVAL if we caught on overflow or something of that nature. EAGAIN if it
// was just really larger we failed mmap.
ASSERT_TRUE(result == EINVAL || result == EAGAIN);
// pthread_create should NOT set errno on error
ASSERT_EQ(libc_errno, 0);
- ASSERT_EQ(__llvm_libc::pthread_attr_destroy(attr), 0);
+ ASSERT_EQ(LIBC_NAMESPACE::pthread_attr_destroy(attr), 0);
ASSERT_EQ(libc_errno, 0);
}
static void run_failure_config(size_t guardsize, size_t stacksize) {
pthread_attr_t attr;
guardsize &= -EXEC_PAGESIZE;
- ASSERT_EQ(__llvm_libc::pthread_attr_init(&attr), 0);
+ ASSERT_EQ(LIBC_NAMESPACE::pthread_attr_init(&attr), 0);
ASSERT_EQ(libc_errno, 0);
- ASSERT_EQ(__llvm_libc::pthread_attr_setguardsize(&attr, guardsize), 0);
+ ASSERT_EQ(LIBC_NAMESPACE::pthread_attr_setguardsize(&attr, guardsize), 0);
ASSERT_EQ(libc_errno, 0);
- ASSERT_EQ(__llvm_libc::pthread_attr_setstacksize(&attr, stacksize), 0);
+ ASSERT_EQ(LIBC_NAMESPACE::pthread_attr_setstacksize(&attr, stacksize), 0);
ASSERT_EQ(libc_errno, 0);
create_and_check_failure_thread(&attr);
@@ -298,32 +300,32 @@ static void run_failure_tests() {
pthread_attr_t attr;
// Stacksize too small.
- ASSERT_EQ(__llvm_libc::pthread_attr_init(&attr), 0);
+ ASSERT_EQ(LIBC_NAMESPACE::pthread_attr_init(&attr), 0);
ASSERT_EQ(libc_errno, 0);
attr.__stacksize = PTHREAD_STACK_MIN - 16;
create_and_check_failure_thread(&attr);
// Stack misaligned.
- ASSERT_EQ(__llvm_libc::pthread_attr_init(&attr), 0);
+ ASSERT_EQ(LIBC_NAMESPACE::pthread_attr_init(&attr), 0);
ASSERT_EQ(libc_errno, 0);
attr.__stack = reinterpret_cast<void *>(1);
create_and_check_failure_thread(&attr);
// Stack + stacksize misaligned.
- ASSERT_EQ(__llvm_libc::pthread_attr_init(&attr), 0);
+ ASSERT_EQ(LIBC_NAMESPACE::pthread_attr_init(&attr), 0);
ASSERT_EQ(libc_errno, 0);
attr.__stacksize = PTHREAD_STACK_MIN + 1;
attr.__stack = reinterpret_cast<void *>(16);
create_and_check_failure_thread(&attr);
// Guardsize misaligned.
- ASSERT_EQ(__llvm_libc::pthread_attr_init(&attr), 0);
+ ASSERT_EQ(LIBC_NAMESPACE::pthread_attr_init(&attr), 0);
ASSERT_EQ(libc_errno, 0);
attr.__guardsize = EXEC_PAGESIZE / 2;
create_and_check_failure_thread(&attr);
// Detachstate is unknown.
- ASSERT_EQ(__llvm_libc::pthread_attr_init(&attr), 0);
+ ASSERT_EQ(LIBC_NAMESPACE::pthread_attr_init(&attr), 0);
ASSERT_EQ(libc_errno, 0);
attr.__detachstate = -1;
create_and_check_failure_thread(&attr);
diff --git a/libc/test/integration/src/pthread/pthread_equal_test.cpp b/libc/test/integration/src/pthread/pthread_equal_test.cpp
index 08d89892d22a94a..82f5a494e1bdfb5 100644
--- a/libc/test/integration/src/pthread/pthread_equal_test.cpp
+++ b/libc/test/integration/src/pthread/pthread_equal_test.cpp
@@ -24,21 +24,21 @@ pthread_t child_thread;
pthread_mutex_t mutex;
static void *child_func(void *arg) {
- __llvm_libc::pthread_mutex_lock(&mutex);
+ LIBC_NAMESPACE::pthread_mutex_lock(&mutex);
int *ret = reinterpret_cast<int *>(arg);
- auto self = __llvm_libc::pthread_self();
- *ret = __llvm_libc::pthread_equal(child_thread, self);
- __llvm_libc::pthread_mutex_unlock(&mutex);
+ auto self = LIBC_NAMESPACE::pthread_self();
+ *ret = LIBC_NAMESPACE::pthread_equal(child_thread, self);
+ LIBC_NAMESPACE::pthread_mutex_unlock(&mutex);
return nullptr;
}
TEST_MAIN() {
// We init and lock the mutex so that we guarantee that the child thread is
// waiting after startup.
- ASSERT_EQ(__llvm_libc::pthread_mutex_init(&mutex, nullptr), 0);
- ASSERT_EQ(__llvm_libc::pthread_mutex_lock(&mutex), 0);
+ ASSERT_EQ(LIBC_NAMESPACE::pthread_mutex_init(&mutex, nullptr), 0);
+ ASSERT_EQ(LIBC_NAMESPACE::pthread_mutex_lock(&mutex), 0);
- auto main_thread = __llvm_libc::pthread_self();
+ auto main_thread = LIBC_NAMESPACE::pthread_self();
// The idea here is that, we start a child thread which will immediately
// wait on |mutex|. The main thread will update the global |child_thread| var
@@ -47,22 +47,23 @@ TEST_MAIN() {
// comparison is returned in the thread arg.
int result = 0;
pthread_t th;
- ASSERT_EQ(__llvm_libc::pthread_create(&th, nullptr, child_func, &result), 0);
+ ASSERT_EQ(LIBC_NAMESPACE::pthread_create(&th, nullptr, child_func, &result),
+ 0);
// This new thread should of course not be equal to the main thread.
- ASSERT_EQ(__llvm_libc::pthread_equal(th, main_thread), 0);
+ ASSERT_EQ(LIBC_NAMESPACE::pthread_equal(th, main_thread), 0);
// Set the |child_thread| global var and unlock to allow the child to perform
// the comparison.
child_thread = th;
- ASSERT_EQ(__llvm_libc::pthread_mutex_unlock(&mutex), 0);
+ ASSERT_EQ(LIBC_NAMESPACE::pthread_mutex_unlock(&mutex), 0);
void *retval;
- ASSERT_EQ(__llvm_libc::pthread_join(th, &retval), 0);
+ ASSERT_EQ(LIBC_NAMESPACE::pthread_join(th, &retval), 0);
ASSERT_EQ(uintptr_t(retval), uintptr_t(nullptr));
// The child thread should see that pthread_self return value is the same as
// |child_thread|.
ASSERT_NE(result, 0);
- __llvm_libc::pthread_mutex_destroy(&mutex);
+ LIBC_NAMESPACE::pthread_mutex_destroy(&mutex);
return 0;
}
diff --git a/libc/test/integration/src/pthread/pthread_exit_test.cpp b/libc/test/integration/src/pthread/pthread_exit_test.cpp
index e60fe67d2a2a0bd..48e6c81713a4035 100644
--- a/libc/test/integration/src/pthread/pthread_exit_test.cpp
+++ b/libc/test/integration/src/pthread/pthread_exit_test.cpp
@@ -35,7 +35,7 @@ void *func(void *) {
// Touch the thread local variable so that it gets initialized and a callback
// for its destructor gets registered with __cxa_thread_atexit.
thread_local_a.set(321);
- __llvm_libc::pthread_exit(nullptr);
+ LIBC_NAMESPACE::pthread_exit(nullptr);
return nullptr;
}
@@ -43,11 +43,11 @@ TEST_MAIN() {
pthread_t th;
void *retval;
- ASSERT_EQ(__llvm_libc::pthread_create(&th, nullptr, func, nullptr), 0);
- ASSERT_EQ(__llvm_libc::pthread_join(th, &retval), 0);
+ ASSERT_EQ(LIBC_NAMESPACE::pthread_create(&th, nullptr, func, nullptr), 0);
+ ASSERT_EQ(LIBC_NAMESPACE::pthread_join(th, &retval), 0);
ASSERT_TRUE(dtor_called);
- __llvm_libc::pthread_exit(nullptr);
+ LIBC_NAMESPACE::pthread_exit(nullptr);
return 0;
}
diff --git a/libc/test/integration/src/pthread/pthread_join_test.cpp b/libc/test/integration/src/pthread/pthread_join_test.cpp
index 7397fa89a9f47e2..f4126357a0579dc 100644
--- a/libc/test/integration/src/pthread/pthread_join_test.cpp
+++ b/libc/test/integration/src/pthread/pthread_join_test.cpp
@@ -17,9 +17,10 @@
static void *simpleFunc(void *) { return nullptr; }
static void nullJoinTest() {
pthread_t Tid;
- ASSERT_EQ(__llvm_libc::pthread_create(&Tid, nullptr, simpleFunc, nullptr), 0);
+ ASSERT_EQ(LIBC_NAMESPACE::pthread_create(&Tid, nullptr, simpleFunc, nullptr),
+ 0);
ASSERT_EQ(libc_errno, 0);
- ASSERT_EQ(__llvm_libc::pthread_join(Tid, nullptr), 0);
+ ASSERT_EQ(LIBC_NAMESPACE::pthread_join(Tid, nullptr), 0);
ASSERT_EQ(libc_errno, 0);
}
diff --git a/libc/test/integration/src/pthread/pthread_mutex_test.cpp b/libc/test/integration/src/pthread/pthread_mutex_test.cpp
index 67300872dc60a27..ce2a3538924da84 100644
--- a/libc/test/integration/src/pthread/pthread_mutex_test.cpp
+++ b/libc/test/integration/src/pthread/pthread_mutex_test.cpp
@@ -28,12 +28,12 @@ static int shared_int = START;
void *counter(void *arg) {
int last_count = START;
while (true) {
- __llvm_libc::pthread_mutex_lock(&mutex);
+ LIBC_NAMESPACE::pthread_mutex_lock(&mutex);
if (shared_int == last_count + 1) {
shared_int++;
last_count = shared_int;
}
- __llvm_libc::pthread_mutex_unlock(&mutex);
+ LIBC_NAMESPACE::pthread_mutex_unlock(&mutex);
if (last_count >= MAX)
break;
}
@@ -41,16 +41,16 @@ void *counter(void *arg) {
}
void relay_counter() {
- ASSERT_EQ(__llvm_libc::pthread_mutex_init(&mutex, nullptr), 0);
+ ASSERT_EQ(LIBC_NAMESPACE::pthread_mutex_init(&mutex, nullptr), 0);
// The idea of this test is that two competing threads will update
// a counter only if the other thread has updated it.
pthread_t thread;
- __llvm_libc::pthread_create(&thread, nullptr, counter, nullptr);
+ LIBC_NAMESPACE::pthread_create(&thread, nullptr, counter, nullptr);
int last_count = START;
while (true) {
- ASSERT_EQ(__llvm_libc::pthread_mutex_lock(&mutex), 0);
+ ASSERT_EQ(LIBC_NAMESPACE::pthread_mutex_lock(&mutex), 0);
if (shared_int == START) {
++shared_int;
last_count = shared_int;
@@ -59,51 +59,51 @@ void relay_counter() {
++shared_int;
last_count = shared_int;
}
- ASSERT_EQ(__llvm_libc::pthread_mutex_unlock(&mutex), 0);
+ ASSERT_EQ(LIBC_NAMESPACE::pthread_mutex_unlock(&mutex), 0);
if (last_count > MAX)
break;
}
void *retval = reinterpret_cast<void *>(123);
- __llvm_libc::pthread_join(thread, &retval);
+ LIBC_NAMESPACE::pthread_join(thread, &retval);
ASSERT_EQ(uintptr_t(retval), uintptr_t(nullptr));
- __llvm_libc::pthread_mutex_destroy(&mutex);
+ LIBC_NAMESPACE::pthread_mutex_destroy(&mutex);
}
pthread_mutex_t start_lock, step_lock;
bool started, step;
void *stepper(void *arg) {
- __llvm_libc::pthread_mutex_lock(&start_lock);
+ LIBC_NAMESPACE::pthread_mutex_lock(&start_lock);
started = true;
- __llvm_libc::pthread_mutex_unlock(&start_lock);
+ LIBC_NAMESPACE::pthread_mutex_unlock(&start_lock);
- __llvm_libc::pthread_mutex_lock(&step_lock);
+ LIBC_NAMESPACE::pthread_mutex_lock(&step_lock);
step = true;
- __llvm_libc::pthread_mutex_unlock(&step_lock);
+ LIBC_NAMESPACE::pthread_mutex_unlock(&step_lock);
return nullptr;
}
void wait_and_step() {
- ASSERT_EQ(__llvm_libc::pthread_mutex_init(&start_lock, nullptr), 0);
- ASSERT_EQ(__llvm_libc::pthread_mutex_init(&step_lock, nullptr), 0);
+ ASSERT_EQ(LIBC_NAMESPACE::pthread_mutex_init(&start_lock, nullptr), 0);
+ ASSERT_EQ(LIBC_NAMESPACE::pthread_mutex_init(&step_lock, nullptr), 0);
// In this test, we start a new thread but block it before it can make a
// step. Once we ensure that the thread is blocked, we unblock it.
// After unblocking, we then verify that the thread was indeed unblocked.
step = false;
started = false;
- ASSERT_EQ(__llvm_libc::pthread_mutex_lock(&step_lock), 0);
+ ASSERT_EQ(LIBC_NAMESPACE::pthread_mutex_lock(&step_lock), 0);
pthread_t thread;
- __llvm_libc::pthread_create(&thread, nullptr, stepper, nullptr);
+ LIBC_NAMESPACE::pthread_create(&thread, nullptr, stepper, nullptr);
while (true) {
// Make sure the thread actually started.
- ASSERT_EQ(__llvm_libc::pthread_mutex_lock(&start_lock), 0);
+ ASSERT_EQ(LIBC_NAMESPACE::pthread_mutex_lock(&start_lock), 0);
bool s = started;
- ASSERT_EQ(__llvm_libc::pthread_mutex_unlock(&start_lock), 0);
+ ASSERT_EQ(LIBC_NAMESPACE::pthread_mutex_unlock(&start_lock), 0);
if (s)
break;
}
@@ -112,22 +112,22 @@ void wait_and_step() {
ASSERT_FALSE(step);
// Unlock the step lock and wait until the step is made.
- ASSERT_EQ(__llvm_libc::pthread_mutex_unlock(&step_lock), 0);
+ ASSERT_EQ(LIBC_NAMESPACE::pthread_mutex_unlock(&step_lock), 0);
while (true) {
- ASSERT_EQ(__llvm_libc::pthread_mutex_lock(&step_lock), 0);
+ ASSERT_EQ(LIBC_NAMESPACE::pthread_mutex_lock(&step_lock), 0);
bool current_step_value = step;
- ASSERT_EQ(__llvm_libc::pthread_mutex_unlock(&step_lock), 0);
+ ASSERT_EQ(LIBC_NAMESPACE::pthread_mutex_unlock(&step_lock), 0);
if (current_step_value)
break;
}
void *retval = reinterpret_cast<void *>(123);
- __llvm_libc::pthread_join(thread, &retval);
+ LIBC_NAMESPACE::pthread_join(thread, &retval);
ASSERT_EQ(uintptr_t(retval), uintptr_t(nullptr));
- __llvm_libc::pthread_mutex_destroy(&start_lock);
- __llvm_libc::pthread_mutex_destroy(&step_lock);
+ LIBC_NAMESPACE::pthread_mutex_destroy(&start_lock);
+ LIBC_NAMESPACE::pthread_mutex_destroy(&step_lock);
}
static constexpr int THREAD_COUNT = 10;
@@ -136,54 +136,54 @@ static pthread_mutex_t counter_lock;
static int wait_count = 0;
void *waiter_func(void *) {
- __llvm_libc::pthread_mutex_lock(&counter_lock);
+ LIBC_NAMESPACE::pthread_mutex_lock(&counter_lock);
++wait_count;
- __llvm_libc::pthread_mutex_unlock(&counter_lock);
+ LIBC_NAMESPACE::pthread_mutex_unlock(&counter_lock);
// Block on the waiter lock until the main
// thread unblocks.
- __llvm_libc::pthread_mutex_lock(&multiple_waiter_lock);
- __llvm_libc::pthread_mutex_unlock(&multiple_waiter_lock);
+ LIBC_NAMESPACE::pthread_mutex_lock(&multiple_waiter_lock);
+ LIBC_NAMESPACE::pthread_mutex_unlock(&multiple_waiter_lock);
- __llvm_libc::pthread_mutex_lock(&counter_lock);
+ LIBC_NAMESPACE::pthread_mutex_lock(&counter_lock);
--wait_count;
- __llvm_libc::pthread_mutex_unlock(&counter_lock);
+ LIBC_NAMESPACE::pthread_mutex_unlock(&counter_lock);
return nullptr;
}
void multiple_waiters() {
- __llvm_libc::pthread_mutex_init(&multiple_waiter_lock, nullptr);
- __llvm_libc::pthread_mutex_init(&counter_lock, nullptr);
+ LIBC_NAMESPACE::pthread_mutex_init(&multiple_waiter_lock, nullptr);
+ LIBC_NAMESPACE::pthread_mutex_init(&counter_lock, nullptr);
- __llvm_libc::pthread_mutex_lock(&multiple_waiter_lock);
+ LIBC_NAMESPACE::pthread_mutex_lock(&multiple_waiter_lock);
pthread_t waiters[THREAD_COUNT];
for (int i = 0; i < THREAD_COUNT; ++i) {
- __llvm_libc::pthread_create(waiters + i, nullptr, waiter_func, nullptr);
+ LIBC_NAMESPACE::pthread_create(waiters + i, nullptr, waiter_func, nullptr);
}
// Spin until the counter is incremented to the desired
// value.
while (true) {
- __llvm_libc::pthread_mutex_lock(&counter_lock);
+ LIBC_NAMESPACE::pthread_mutex_lock(&counter_lock);
if (wait_count == THREAD_COUNT) {
- __llvm_libc::pthread_mutex_unlock(&counter_lock);
+ LIBC_NAMESPACE::pthread_mutex_unlock(&counter_lock);
break;
}
- __llvm_libc::pthread_mutex_unlock(&counter_lock);
+ LIBC_NAMESPACE::pthread_mutex_unlock(&counter_lock);
}
- __llvm_libc::pthread_mutex_unlock(&multiple_waiter_lock);
+ LIBC_NAMESPACE::pthread_mutex_unlock(&multiple_waiter_lock);
void *retval;
for (int i = 0; i < THREAD_COUNT; ++i) {
- __llvm_libc::pthread_join(waiters[i], &retval);
+ LIBC_NAMESPACE::pthread_join(waiters[i], &retval);
}
ASSERT_EQ(wait_count, 0);
- __llvm_libc::pthread_mutex_destroy(&multiple_waiter_lock);
- __llvm_libc::pthread_mutex_destroy(&counter_lock);
+ LIBC_NAMESPACE::pthread_mutex_destroy(&multiple_waiter_lock);
+ LIBC_NAMESPACE::pthread_mutex_destroy(&counter_lock);
}
TEST_MAIN() {
diff --git a/libc/test/integration/src/pthread/pthread_name_test.cpp b/libc/test/integration/src/pthread/pthread_name_test.cpp
index fa227b3074988b2..d341792d11d6cbc 100644
--- a/libc/test/integration/src/pthread/pthread_name_test.cpp
+++ b/libc/test/integration/src/pthread/pthread_name_test.cpp
@@ -23,60 +23,64 @@
#include <pthread.h>
#include <stdint.h> // uintptr_t
-using string_view = __llvm_libc::cpp::string_view;
+using string_view = LIBC_NAMESPACE::cpp::string_view;
char child_thread_name_buffer[16];
pthread_mutex_t mutex;
static void *child_func(void *) {
- __llvm_libc::pthread_mutex_lock(&mutex);
- auto self = __llvm_libc::pthread_self();
- __llvm_libc::pthread_getname_np(self, child_thread_name_buffer, 16);
- __llvm_libc::pthread_mutex_unlock(&mutex);
+ LIBC_NAMESPACE::pthread_mutex_lock(&mutex);
+ auto self = LIBC_NAMESPACE::pthread_self();
+ LIBC_NAMESPACE::pthread_getname_np(self, child_thread_name_buffer, 16);
+ LIBC_NAMESPACE::pthread_mutex_unlock(&mutex);
return nullptr;
}
TEST_MAIN() {
// We init and lock the mutex so that we guarantee that the child thread is
// waiting after startup.
- ASSERT_EQ(__llvm_libc::pthread_mutex_init(&mutex, nullptr), 0);
- ASSERT_EQ(__llvm_libc::pthread_mutex_lock(&mutex), 0);
+ ASSERT_EQ(LIBC_NAMESPACE::pthread_mutex_init(&mutex, nullptr), 0);
+ ASSERT_EQ(LIBC_NAMESPACE::pthread_mutex_lock(&mutex), 0);
- auto main_thread = __llvm_libc::pthread_self();
+ auto main_thread = LIBC_NAMESPACE::pthread_self();
const char MAIN_THREAD_NAME[] = "main_thread";
char thread_name_buffer[16];
- ASSERT_EQ(__llvm_libc::pthread_setname_np(main_thread, MAIN_THREAD_NAME), 0);
+ ASSERT_EQ(LIBC_NAMESPACE::pthread_setname_np(main_thread, MAIN_THREAD_NAME),
+ 0);
ASSERT_EQ(
- __llvm_libc::pthread_getname_np(main_thread, thread_name_buffer, 16), 0);
+ LIBC_NAMESPACE::pthread_getname_np(main_thread, thread_name_buffer, 16),
+ 0);
ASSERT_EQ(string_view(MAIN_THREAD_NAME),
string_view(reinterpret_cast<const char *>(thread_name_buffer)));
pthread_t th;
- ASSERT_EQ(__llvm_libc::pthread_create(&th, nullptr, child_func, nullptr), 0);
+ ASSERT_EQ(LIBC_NAMESPACE::pthread_create(&th, nullptr, child_func, nullptr),
+ 0);
// This new thread should of course not be equal to the main thread.
const char CHILD_THREAD_NAME[] = "child_thread";
- ASSERT_EQ(__llvm_libc::pthread_setname_np(th, CHILD_THREAD_NAME), 0);
- ASSERT_EQ(__llvm_libc::pthread_getname_np(th, thread_name_buffer, 16), 0);
+ ASSERT_EQ(LIBC_NAMESPACE::pthread_setname_np(th, CHILD_THREAD_NAME), 0);
+ ASSERT_EQ(LIBC_NAMESPACE::pthread_getname_np(th, thread_name_buffer, 16), 0);
ASSERT_EQ(string_view(CHILD_THREAD_NAME),
string_view(reinterpret_cast<const char *>(thread_name_buffer)));
- ASSERT_EQ(__llvm_libc::pthread_mutex_unlock(&mutex), 0);
+ ASSERT_EQ(LIBC_NAMESPACE::pthread_mutex_unlock(&mutex), 0);
void *retval;
- ASSERT_EQ(__llvm_libc::pthread_join(th, &retval), 0);
+ ASSERT_EQ(LIBC_NAMESPACE::pthread_join(th, &retval), 0);
ASSERT_EQ(uintptr_t(retval), uintptr_t(nullptr));
// Make sure that the child thread saw it name correctly.
ASSERT_EQ(
string_view(CHILD_THREAD_NAME),
string_view(reinterpret_cast<const char *>(child_thread_name_buffer)));
- __llvm_libc::pthread_mutex_destroy(&mutex);
+ LIBC_NAMESPACE::pthread_mutex_destroy(&mutex);
- ASSERT_EQ(__llvm_libc::pthread_setname_np(main_thread,
- "a really long name for a thread"),
+ ASSERT_EQ(LIBC_NAMESPACE::pthread_setname_np(
+ main_thread, "a really long name for a thread"),
ERANGE);
char smallbuf[1];
- ASSERT_EQ(__llvm_libc::pthread_getname_np(main_thread, smallbuf, 1), ERANGE);
+ ASSERT_EQ(LIBC_NAMESPACE::pthread_getname_np(main_thread, smallbuf, 1),
+ ERANGE);
return 0;
}
diff --git a/libc/test/integration/src/pthread/pthread_once_test.cpp b/libc/test/integration/src/pthread/pthread_once_test.cpp
index 201982460c5ea29..8e0f234ee8c6b13 100644
--- a/libc/test/integration/src/pthread/pthread_once_test.cpp
+++ b/libc/test/integration/src/pthread/pthread_once_test.cpp
@@ -21,14 +21,14 @@
#include <stdint.h> // uintptr_t
static constexpr unsigned int NUM_THREADS = 5;
-static __llvm_libc::cpp::Atomic<unsigned int> thread_count;
+static LIBC_NAMESPACE::cpp::Atomic<unsigned int> thread_count;
static unsigned int call_count;
static void pthread_once_func() { ++call_count; }
static void *func(void *) {
static pthread_once_t flag = PTHREAD_ONCE_INIT;
- ASSERT_EQ(__llvm_libc::pthread_once(&flag, pthread_once_func), 0);
+ ASSERT_EQ(LIBC_NAMESPACE::pthread_once(&flag, pthread_once_func), 0);
thread_count.fetch_add(1);
@@ -42,13 +42,13 @@ void call_from_5_threads() {
pthread_t threads[NUM_THREADS];
for (unsigned int i = 0; i < NUM_THREADS; ++i) {
- ASSERT_EQ(__llvm_libc::pthread_create(threads + i, nullptr, func, nullptr),
- 0);
+ ASSERT_EQ(
+ LIBC_NAMESPACE::pthread_create(threads + i, nullptr, func, nullptr), 0);
}
for (unsigned int i = 0; i < NUM_THREADS; ++i) {
void *retval;
- ASSERT_EQ(__llvm_libc::pthread_join(threads[i], &retval), 0);
+ ASSERT_EQ(LIBC_NAMESPACE::pthread_join(threads[i], &retval), 0);
ASSERT_EQ(uintptr_t(retval), uintptr_t(0));
}
@@ -58,16 +58,16 @@ void call_from_5_threads() {
static pthread_mutex_t once_func_blocker;
static void blocking_once_func() {
- __llvm_libc::pthread_mutex_lock(&once_func_blocker);
- __llvm_libc::pthread_mutex_unlock(&once_func_blocker);
+ LIBC_NAMESPACE::pthread_mutex_lock(&once_func_blocker);
+ LIBC_NAMESPACE::pthread_mutex_unlock(&once_func_blocker);
}
-static __llvm_libc::cpp::Atomic<unsigned int> start_count;
-static __llvm_libc::cpp::Atomic<unsigned int> done_count;
+static LIBC_NAMESPACE::cpp::Atomic<unsigned int> start_count;
+static LIBC_NAMESPACE::cpp::Atomic<unsigned int> done_count;
static void *once_func_caller(void *) {
static pthread_once_t flag;
start_count.fetch_add(1);
- __llvm_libc::pthread_once(&flag, blocking_once_func);
+ LIBC_NAMESPACE::pthread_once(&flag, blocking_once_func);
done_count.fetch_add(1);
return nullptr;
}
@@ -79,15 +79,17 @@ void test_synchronization() {
start_count = 0;
done_count = 0;
- ASSERT_EQ(__llvm_libc::pthread_mutex_init(&once_func_blocker, nullptr), 0);
+ ASSERT_EQ(LIBC_NAMESPACE::pthread_mutex_init(&once_func_blocker, nullptr), 0);
// Lock the blocking mutex so that the once func blocks.
- ASSERT_EQ(__llvm_libc::pthread_mutex_lock(&once_func_blocker), 0);
+ ASSERT_EQ(LIBC_NAMESPACE::pthread_mutex_lock(&once_func_blocker), 0);
pthread_t t1, t2;
ASSERT_EQ(
- __llvm_libc::pthread_create(&t1, nullptr, once_func_caller, nullptr), 0);
+ LIBC_NAMESPACE::pthread_create(&t1, nullptr, once_func_caller, nullptr),
+ 0);
ASSERT_EQ(
- __llvm_libc::pthread_create(&t2, nullptr, once_func_caller, nullptr), 0);
+ LIBC_NAMESPACE::pthread_create(&t2, nullptr, once_func_caller, nullptr),
+ 0);
while (start_count.load() != 2)
; // Spin until both threads start.
@@ -96,17 +98,17 @@ void test_synchronization() {
EXPECT_EQ(done_count.val, 0U);
// Unlock the blocking mutex so that the once func blocks.
- ASSERT_EQ(__llvm_libc::pthread_mutex_unlock(&once_func_blocker), 0);
+ ASSERT_EQ(LIBC_NAMESPACE::pthread_mutex_unlock(&once_func_blocker), 0);
void *retval;
- ASSERT_EQ(__llvm_libc::pthread_join(t1, &retval), uintptr_t(0));
+ ASSERT_EQ(LIBC_NAMESPACE::pthread_join(t1, &retval), uintptr_t(0));
ASSERT_EQ(uintptr_t(retval), 0);
- ASSERT_EQ(__llvm_libc::pthread_join(t2, &retval), uintptr_t(0));
+ ASSERT_EQ(LIBC_NAMESPACE::pthread_join(t2, &retval), uintptr_t(0));
ASSERT_EQ(uintptr_t(retval), 0);
ASSERT_EQ(done_count.val, 2U);
- __llvm_libc::pthread_mutex_destroy(&once_func_blocker);
+ LIBC_NAMESPACE::pthread_mutex_destroy(&once_func_blocker);
}
TEST_MAIN() {
diff --git a/libc/test/integration/src/pthread/pthread_test.cpp b/libc/test/integration/src/pthread/pthread_test.cpp
index fa6a828d9208b95..3565a7cb08685ac 100644
--- a/libc/test/integration/src/pthread/pthread_test.cpp
+++ b/libc/test/integration/src/pthread/pthread_test.cpp
@@ -25,11 +25,12 @@ void create_and_join() {
pthread_t thread;
int old_counter_val = counter;
ASSERT_EQ(
- __llvm_libc::pthread_create(&thread, nullptr, thread_func, nullptr), 0);
+ LIBC_NAMESPACE::pthread_create(&thread, nullptr, thread_func, nullptr),
+ 0);
// Start with a retval we dont expect.
void *retval = reinterpret_cast<void *>(thread_count + 1);
- ASSERT_EQ(__llvm_libc::pthread_join(thread, &retval), 0);
+ ASSERT_EQ(LIBC_NAMESPACE::pthread_join(thread, &retval), 0);
ASSERT_EQ(uintptr_t(retval), uintptr_t(nullptr));
ASSERT_EQ(counter, old_counter_val + 1);
}
@@ -43,15 +44,15 @@ void spawn_and_join() {
for (int i = 0; i < thread_count; ++i) {
args[i] = i;
- ASSERT_EQ(__llvm_libc::pthread_create(thread_list + i, nullptr, return_arg,
- args + i),
+ ASSERT_EQ(LIBC_NAMESPACE::pthread_create(thread_list + i, nullptr,
+ return_arg, args + i),
0);
}
for (int i = 0; i < thread_count; ++i) {
// Start with a retval we dont expect.
void *retval = reinterpret_cast<void *>(thread_count + 1);
- ASSERT_EQ(__llvm_libc::pthread_join(thread_list[i], &retval), 0);
+ ASSERT_EQ(LIBC_NAMESPACE::pthread_join(thread_list[i], &retval), 0);
ASSERT_EQ(*reinterpret_cast<int *>(retval), i);
}
}
diff --git a/libc/test/integration/src/pthread/pthread_tss_test.cpp b/libc/test/integration/src/pthread/pthread_tss_test.cpp
index b5843d226ff10ff..c90525a0000ee15 100644
--- a/libc/test/integration/src/pthread/pthread_tss_test.cpp
+++ b/libc/test/integration/src/pthread/pthread_tss_test.cpp
@@ -34,8 +34,8 @@ static void dtor(void *data) {
static void dtor_failure(void *) { ASSERT_TRUE(false); }
static void *func(void *obj) {
- ASSERT_EQ(__llvm_libc::pthread_setspecific(key, &child_thread_data), 0);
- int *d = reinterpret_cast<int *>(__llvm_libc::pthread_getspecific(key));
+ ASSERT_EQ(LIBC_NAMESPACE::pthread_setspecific(key, &child_thread_data), 0);
+ int *d = reinterpret_cast<int *>(LIBC_NAMESPACE::pthread_getspecific(key));
ASSERT_TRUE(d != nullptr);
ASSERT_EQ(&child_thread_data, d);
ASSERT_EQ(*d, THREAD_DATA_INITVAL);
@@ -45,37 +45,37 @@ static void *func(void *obj) {
static void *func_null_val(void *) {
// null value, we should not call dtor
- ASSERT_EQ(__llvm_libc::pthread_setspecific(key, nullptr), 0);
- ASSERT_EQ(__llvm_libc::pthread_getspecific(key), nullptr);
+ ASSERT_EQ(LIBC_NAMESPACE::pthread_setspecific(key, nullptr), 0);
+ ASSERT_EQ(LIBC_NAMESPACE::pthread_getspecific(key), nullptr);
return nullptr;
}
static void standard_usage_test() {
- ASSERT_EQ(__llvm_libc::pthread_key_create(&key, &dtor), 0);
- ASSERT_EQ(__llvm_libc::pthread_setspecific(key, &main_thread_data), 0);
- int *d = reinterpret_cast<int *>(__llvm_libc::pthread_getspecific(key));
+ ASSERT_EQ(LIBC_NAMESPACE::pthread_key_create(&key, &dtor), 0);
+ ASSERT_EQ(LIBC_NAMESPACE::pthread_setspecific(key, &main_thread_data), 0);
+ int *d = reinterpret_cast<int *>(LIBC_NAMESPACE::pthread_getspecific(key));
ASSERT_TRUE(d != nullptr);
ASSERT_EQ(&main_thread_data, d);
ASSERT_EQ(*d, THREAD_DATA_INITVAL);
pthread_t th;
int arg = 0xBAD;
- ASSERT_EQ(__llvm_libc::pthread_create(&th, nullptr, &func, &arg), 0);
+ ASSERT_EQ(LIBC_NAMESPACE::pthread_create(&th, nullptr, &func, &arg), 0);
void *retval = &child_thread_data; // Init to some non-nullptr val.
- ASSERT_EQ(__llvm_libc::pthread_join(th, &retval), 0);
+ ASSERT_EQ(LIBC_NAMESPACE::pthread_join(th, &retval), 0);
ASSERT_EQ(retval, nullptr);
ASSERT_EQ(arg, THREAD_RUN_VAL);
ASSERT_EQ(child_thread_data, THREAD_DATA_FINIVAL);
- ASSERT_EQ(__llvm_libc::pthread_key_delete(key), 0);
+ ASSERT_EQ(LIBC_NAMESPACE::pthread_key_delete(key), 0);
}
static void null_value_test() {
pthread_t th;
- ASSERT_EQ(__llvm_libc::pthread_key_create(&key, &dtor_failure), 0);
- ASSERT_EQ(__llvm_libc::pthread_create(&th, nullptr, &func_null_val, nullptr),
- 0);
- ASSERT_EQ(__llvm_libc::pthread_join(th, nullptr), 0);
- ASSERT_EQ(__llvm_libc::pthread_key_delete(key), 0);
+ ASSERT_EQ(LIBC_NAMESPACE::pthread_key_create(&key, &dtor_failure), 0);
+ ASSERT_EQ(
+ LIBC_NAMESPACE::pthread_create(&th, nullptr, &func_null_val, nullptr), 0);
+ ASSERT_EQ(LIBC_NAMESPACE::pthread_join(th, nullptr), 0);
+ ASSERT_EQ(LIBC_NAMESPACE::pthread_key_delete(key), 0);
}
TEST_MAIN() {
diff --git a/libc/test/integration/src/spawn/posix_spawn_test.cpp b/libc/test/integration/src/spawn/posix_spawn_test.cpp
index 69b60a4138762a9..104096c40c3abec 100644
--- a/libc/test/integration/src/spawn/posix_spawn_test.cpp
+++ b/libc/test/integration/src/spawn/posix_spawn_test.cpp
@@ -30,16 +30,16 @@ char *argv[] = {
void spawn_and_wait_for_normal_exit(char **envp) {
pid_t cpid;
posix_spawn_file_actions_t file_actions;
- ASSERT_EQ(__llvm_libc::posix_spawn_file_actions_init(&file_actions), 0);
- __llvm_libc::posix_spawn_file_actions_addopen(
+ ASSERT_EQ(LIBC_NAMESPACE::posix_spawn_file_actions_init(&file_actions), 0);
+ LIBC_NAMESPACE::posix_spawn_file_actions_addopen(
&file_actions, CHILD_FD, "testdata/posix_spawn.test", O_RDONLY, 0);
- ASSERT_EQ(
- __llvm_libc::posix_spawn(&cpid, arg0, &file_actions, nullptr, argv, envp),
- 0);
+ ASSERT_EQ(LIBC_NAMESPACE::posix_spawn(&cpid, arg0, &file_actions, nullptr,
+ argv, envp),
+ 0);
ASSERT_TRUE(cpid > 0);
int status;
- ASSERT_EQ(__llvm_libc::waitpid(cpid, &status, 0), cpid);
- ASSERT_EQ(__llvm_libc::posix_spawn_file_actions_destroy(&file_actions), 0);
+ ASSERT_EQ(LIBC_NAMESPACE::waitpid(cpid, &status, 0), cpid);
+ ASSERT_EQ(LIBC_NAMESPACE::posix_spawn_file_actions_destroy(&file_actions), 0);
ASSERT_TRUE(WIFEXITED(status));
int exit_status = WEXITSTATUS(status);
ASSERT_EQ(exit_status, 0);
diff --git a/libc/test/integration/src/stdio/sprintf_size_test.cpp b/libc/test/integration/src/stdio/sprintf_size_test.cpp
index 117a059ecfe0906..833159436d49cbe 100644
--- a/libc/test/integration/src/stdio/sprintf_size_test.cpp
+++ b/libc/test/integration/src/stdio/sprintf_size_test.cpp
@@ -51,8 +51,9 @@ TEST_MAIN(int argc, char **argv, char **envp) {
#ifndef INTEGRATION_DISABLE_PRINTF
char buf[100];
- ASSERT_EQ(__llvm_libc::sprintf(buf, argv[1], argv[2], argv[3][0], argv[4][0]),
- 14);
+ ASSERT_EQ(
+ LIBC_NAMESPACE::sprintf(buf, argv[1], argv[2], argv[3][0], argv[4][0]),
+ 14);
ASSERT_TRUE(my_streq(buf, "First arg a 48"));
#endif
diff --git a/libc/test/integration/src/stdlib/getenv_test.cpp b/libc/test/integration/src/stdlib/getenv_test.cpp
index 9c292bfaebf1f3f..82a9b89533d2eb5 100644
--- a/libc/test/integration/src/stdlib/getenv_test.cpp
+++ b/libc/test/integration/src/stdlib/getenv_test.cpp
@@ -28,19 +28,21 @@ static bool my_streq(const char *lhs, const char *rhs) {
}
TEST_MAIN(int argc, char **argv, char **envp) {
- ASSERT_TRUE(my_streq(__llvm_libc::getenv(""), static_cast<char *>(nullptr)));
- ASSERT_TRUE(my_streq(__llvm_libc::getenv("="), static_cast<char *>(nullptr)));
- ASSERT_TRUE(my_streq(__llvm_libc::getenv("MISSING ENV VARIABLE"),
+ ASSERT_TRUE(
+ my_streq(LIBC_NAMESPACE::getenv(""), static_cast<char *>(nullptr)));
+ ASSERT_TRUE(
+ my_streq(LIBC_NAMESPACE::getenv("="), static_cast<char *>(nullptr)));
+ ASSERT_TRUE(my_streq(LIBC_NAMESPACE::getenv("MISSING ENV VARIABLE"),
static_cast<char *>(nullptr)));
ASSERT_FALSE(
- my_streq(__llvm_libc::getenv("PATH"), static_cast<char *>(nullptr)));
- ASSERT_TRUE(my_streq(__llvm_libc::getenv("FRANCE"), "Paris"));
- ASSERT_FALSE(my_streq(__llvm_libc::getenv("FRANCE"), "Berlin"));
- ASSERT_TRUE(my_streq(__llvm_libc::getenv("GERMANY"), "Berlin"));
+ my_streq(LIBC_NAMESPACE::getenv("PATH"), static_cast<char *>(nullptr)));
+ ASSERT_TRUE(my_streq(LIBC_NAMESPACE::getenv("FRANCE"), "Paris"));
+ ASSERT_FALSE(my_streq(LIBC_NAMESPACE::getenv("FRANCE"), "Berlin"));
+ ASSERT_TRUE(my_streq(LIBC_NAMESPACE::getenv("GERMANY"), "Berlin"));
ASSERT_TRUE(
- my_streq(__llvm_libc::getenv("FRANC"), static_cast<char *>(nullptr)));
- ASSERT_TRUE(
- my_streq(__llvm_libc::getenv("FRANCE1"), static_cast<char *>(nullptr)));
+ my_streq(LIBC_NAMESPACE::getenv("FRANC"), static_cast<char *>(nullptr)));
+ ASSERT_TRUE(my_streq(LIBC_NAMESPACE::getenv("FRANCE1"),
+ static_cast<char *>(nullptr)));
return 0;
}
diff --git a/libc/test/integration/src/threads/call_once_test.cpp b/libc/test/integration/src/threads/call_once_test.cpp
index a84eca2e5b0bb4d..efb920d00723a4d 100644
--- a/libc/test/integration/src/threads/call_once_test.cpp
+++ b/libc/test/integration/src/threads/call_once_test.cpp
@@ -20,14 +20,14 @@
#include <threads.h>
static constexpr unsigned int NUM_THREADS = 5;
-static __llvm_libc::cpp::Atomic<unsigned int> thread_count;
+static LIBC_NAMESPACE::cpp::Atomic<unsigned int> thread_count;
static unsigned int call_count;
static void call_once_func() { ++call_count; }
static int func(void *) {
static once_flag flag = ONCE_FLAG_INIT;
- __llvm_libc::call_once(&flag, call_once_func);
+ LIBC_NAMESPACE::call_once(&flag, call_once_func);
thread_count.fetch_add(1);
@@ -41,13 +41,13 @@ void call_from_5_threads() {
thrd_t threads[NUM_THREADS];
for (unsigned int i = 0; i < NUM_THREADS; ++i) {
- ASSERT_EQ(__llvm_libc::thrd_create(threads + i, func, nullptr),
+ ASSERT_EQ(LIBC_NAMESPACE::thrd_create(threads + i, func, nullptr),
static_cast<int>(thrd_success));
}
for (unsigned int i = 0; i < NUM_THREADS; ++i) {
int retval;
- ASSERT_EQ(__llvm_libc::thrd_join(threads[i], &retval),
+ ASSERT_EQ(LIBC_NAMESPACE::thrd_join(threads[i], &retval),
static_cast<int>(thrd_success));
ASSERT_EQ(retval, 0);
}
@@ -58,16 +58,16 @@ void call_from_5_threads() {
static mtx_t once_func_blocker;
static void blocking_once_func() {
- __llvm_libc::mtx_lock(&once_func_blocker);
- __llvm_libc::mtx_unlock(&once_func_blocker);
+ LIBC_NAMESPACE::mtx_lock(&once_func_blocker);
+ LIBC_NAMESPACE::mtx_unlock(&once_func_blocker);
}
-static __llvm_libc::cpp::Atomic<unsigned int> start_count;
-static __llvm_libc::cpp::Atomic<unsigned int> done_count;
+static LIBC_NAMESPACE::cpp::Atomic<unsigned int> start_count;
+static LIBC_NAMESPACE::cpp::Atomic<unsigned int> done_count;
static int once_func_caller(void *) {
static once_flag flag;
start_count.fetch_add(1);
- __llvm_libc::call_once(&flag, blocking_once_func);
+ LIBC_NAMESPACE::call_once(&flag, blocking_once_func);
done_count.fetch_add(1);
return 0;
}
@@ -79,16 +79,16 @@ void test_synchronization() {
start_count = 0;
done_count = 0;
- ASSERT_EQ(__llvm_libc::mtx_init(&once_func_blocker, mtx_plain),
+ ASSERT_EQ(LIBC_NAMESPACE::mtx_init(&once_func_blocker, mtx_plain),
static_cast<int>(thrd_success));
// Lock the blocking mutex so that the once func blocks.
- ASSERT_EQ(__llvm_libc::mtx_lock(&once_func_blocker),
+ ASSERT_EQ(LIBC_NAMESPACE::mtx_lock(&once_func_blocker),
static_cast<int>(thrd_success));
thrd_t t1, t2;
- ASSERT_EQ(__llvm_libc::thrd_create(&t1, once_func_caller, nullptr),
+ ASSERT_EQ(LIBC_NAMESPACE::thrd_create(&t1, once_func_caller, nullptr),
static_cast<int>(thrd_success));
- ASSERT_EQ(__llvm_libc::thrd_create(&t2, once_func_caller, nullptr),
+ ASSERT_EQ(LIBC_NAMESPACE::thrd_create(&t2, once_func_caller, nullptr),
static_cast<int>(thrd_success));
while (start_count.load() != 2)
@@ -98,20 +98,20 @@ void test_synchronization() {
EXPECT_EQ(done_count.val, 0U);
// Unlock the blocking mutex so that the once func blocks.
- ASSERT_EQ(__llvm_libc::mtx_unlock(&once_func_blocker),
+ ASSERT_EQ(LIBC_NAMESPACE::mtx_unlock(&once_func_blocker),
static_cast<int>(thrd_success));
int retval;
- ASSERT_EQ(__llvm_libc::thrd_join(t1, &retval),
+ ASSERT_EQ(LIBC_NAMESPACE::thrd_join(t1, &retval),
static_cast<int>(thrd_success));
ASSERT_EQ(retval, 0);
- ASSERT_EQ(__llvm_libc::thrd_join(t2, &retval),
+ ASSERT_EQ(LIBC_NAMESPACE::thrd_join(t2, &retval),
static_cast<int>(thrd_success));
ASSERT_EQ(retval, 0);
ASSERT_EQ(done_count.val, 2U);
- __llvm_libc::mtx_destroy(&once_func_blocker);
+ LIBC_NAMESPACE::mtx_destroy(&once_func_blocker);
}
TEST_MAIN() {
diff --git a/libc/test/integration/src/threads/cnd_test.cpp b/libc/test/integration/src/threads/cnd_test.cpp
index ecc04ffa780eb47..8791c6adbaa69f3 100644
--- a/libc/test/integration/src/threads/cnd_test.cpp
+++ b/libc/test/integration/src/threads/cnd_test.cpp
@@ -37,56 +37,56 @@ namespace wait_notify_broadcast_test {
constexpr unsigned int THRD_COUNT = 1000;
-static __llvm_libc::cpp::Atomic<unsigned int> broadcast_count(0);
+static LIBC_NAMESPACE::cpp::Atomic<unsigned int> broadcast_count(0);
static cnd_t broadcast_cnd, threads_ready_cnd;
static mtx_t broadcast_mtx, threads_ready_mtx;
int broadcast_thread_func(void *) {
- __llvm_libc::mtx_lock(&broadcast_mtx);
+ LIBC_NAMESPACE::mtx_lock(&broadcast_mtx);
unsigned oldval = broadcast_count.fetch_add(1);
if (oldval == THRD_COUNT - 1) {
- __llvm_libc::mtx_lock(&threads_ready_mtx);
- __llvm_libc::cnd_signal(&threads_ready_cnd);
- __llvm_libc::mtx_unlock(&threads_ready_mtx);
+ LIBC_NAMESPACE::mtx_lock(&threads_ready_mtx);
+ LIBC_NAMESPACE::cnd_signal(&threads_ready_cnd);
+ LIBC_NAMESPACE::mtx_unlock(&threads_ready_mtx);
}
- __llvm_libc::cnd_wait(&broadcast_cnd, &broadcast_mtx);
- __llvm_libc::mtx_unlock(&broadcast_mtx);
+ LIBC_NAMESPACE::cnd_wait(&broadcast_cnd, &broadcast_mtx);
+ LIBC_NAMESPACE::mtx_unlock(&broadcast_mtx);
broadcast_count.fetch_sub(1);
return 0;
}
void wait_notify_broadcast_test() {
- __llvm_libc::cnd_init(&broadcast_cnd);
- __llvm_libc::cnd_init(&threads_ready_cnd);
- __llvm_libc::mtx_init(&broadcast_mtx, mtx_plain);
- __llvm_libc::mtx_init(&threads_ready_mtx, mtx_plain);
+ LIBC_NAMESPACE::cnd_init(&broadcast_cnd);
+ LIBC_NAMESPACE::cnd_init(&threads_ready_cnd);
+ LIBC_NAMESPACE::mtx_init(&broadcast_mtx, mtx_plain);
+ LIBC_NAMESPACE::mtx_init(&threads_ready_mtx, mtx_plain);
- __llvm_libc::mtx_lock(&threads_ready_mtx);
+ LIBC_NAMESPACE::mtx_lock(&threads_ready_mtx);
thrd_t threads[THRD_COUNT];
for (unsigned int i = 0; i < THRD_COUNT; ++i)
- __llvm_libc::thrd_create(&threads[i], broadcast_thread_func, nullptr);
+ LIBC_NAMESPACE::thrd_create(&threads[i], broadcast_thread_func, nullptr);
- __llvm_libc::cnd_wait(&threads_ready_cnd, &threads_ready_mtx);
- __llvm_libc::mtx_unlock(&threads_ready_mtx);
+ LIBC_NAMESPACE::cnd_wait(&threads_ready_cnd, &threads_ready_mtx);
+ LIBC_NAMESPACE::mtx_unlock(&threads_ready_mtx);
- __llvm_libc::mtx_lock(&broadcast_mtx);
+ LIBC_NAMESPACE::mtx_lock(&broadcast_mtx);
ASSERT_EQ(broadcast_count.val, THRD_COUNT);
- __llvm_libc::cnd_broadcast(&broadcast_cnd);
- __llvm_libc::mtx_unlock(&broadcast_mtx);
+ LIBC_NAMESPACE::cnd_broadcast(&broadcast_cnd);
+ LIBC_NAMESPACE::mtx_unlock(&broadcast_mtx);
for (unsigned int i = 0; i < THRD_COUNT; ++i) {
int retval = 0xBAD;
- __llvm_libc::thrd_join(threads[i], &retval);
+ LIBC_NAMESPACE::thrd_join(threads[i], &retval);
ASSERT_EQ(retval, 0);
}
ASSERT_EQ(broadcast_count.val, 0U);
- __llvm_libc::cnd_destroy(&broadcast_cnd);
- __llvm_libc::cnd_destroy(&threads_ready_cnd);
- __llvm_libc::mtx_destroy(&broadcast_mtx);
- __llvm_libc::mtx_destroy(&threads_ready_mtx);
+ LIBC_NAMESPACE::cnd_destroy(&broadcast_cnd);
+ LIBC_NAMESPACE::cnd_destroy(&threads_ready_cnd);
+ LIBC_NAMESPACE::mtx_destroy(&broadcast_mtx);
+ LIBC_NAMESPACE::mtx_destroy(&threads_ready_mtx);
}
} // namespace wait_notify_broadcast_test
@@ -101,46 +101,47 @@ mtx_t waiter_mtx, main_thread_mtx;
cnd_t waiter_cnd, main_thread_cnd;
int waiter_thread_func(void *unused) {
- __llvm_libc::mtx_lock(&waiter_mtx);
+ LIBC_NAMESPACE::mtx_lock(&waiter_mtx);
- __llvm_libc::mtx_lock(&main_thread_mtx);
- __llvm_libc::cnd_signal(&main_thread_cnd);
- __llvm_libc::mtx_unlock(&main_thread_mtx);
+ LIBC_NAMESPACE::mtx_lock(&main_thread_mtx);
+ LIBC_NAMESPACE::cnd_signal(&main_thread_cnd);
+ LIBC_NAMESPACE::mtx_unlock(&main_thread_mtx);
- __llvm_libc::cnd_wait(&waiter_cnd, &waiter_mtx);
- __llvm_libc::mtx_unlock(&waiter_mtx);
+ LIBC_NAMESPACE::cnd_wait(&waiter_cnd, &waiter_mtx);
+ LIBC_NAMESPACE::mtx_unlock(&waiter_mtx);
return 0x600D;
}
void single_waiter_test() {
- ASSERT_EQ(__llvm_libc::mtx_init(&waiter_mtx, mtx_plain), int(thrd_success));
- ASSERT_EQ(__llvm_libc::mtx_init(&main_thread_mtx, mtx_plain),
+ ASSERT_EQ(LIBC_NAMESPACE::mtx_init(&waiter_mtx, mtx_plain),
int(thrd_success));
- ASSERT_EQ(__llvm_libc::cnd_init(&waiter_cnd), int(thrd_success));
- ASSERT_EQ(__llvm_libc::cnd_init(&main_thread_cnd), int(thrd_success));
+ ASSERT_EQ(LIBC_NAMESPACE::mtx_init(&main_thread_mtx, mtx_plain),
+ int(thrd_success));
+ ASSERT_EQ(LIBC_NAMESPACE::cnd_init(&waiter_cnd), int(thrd_success));
+ ASSERT_EQ(LIBC_NAMESPACE::cnd_init(&main_thread_cnd), int(thrd_success));
- ASSERT_EQ(__llvm_libc::mtx_lock(&main_thread_mtx), int(thrd_success));
+ ASSERT_EQ(LIBC_NAMESPACE::mtx_lock(&main_thread_mtx), int(thrd_success));
thrd_t waiter_thread;
- __llvm_libc::thrd_create(&waiter_thread, waiter_thread_func, nullptr);
+ LIBC_NAMESPACE::thrd_create(&waiter_thread, waiter_thread_func, nullptr);
- ASSERT_EQ(__llvm_libc::cnd_wait(&main_thread_cnd, &main_thread_mtx),
+ ASSERT_EQ(LIBC_NAMESPACE::cnd_wait(&main_thread_cnd, &main_thread_mtx),
int(thrd_success));
- ASSERT_EQ(__llvm_libc::mtx_unlock(&main_thread_mtx), int(thrd_success));
+ ASSERT_EQ(LIBC_NAMESPACE::mtx_unlock(&main_thread_mtx), int(thrd_success));
- ASSERT_EQ(__llvm_libc::mtx_lock(&waiter_mtx), int(thrd_success));
- ASSERT_EQ(__llvm_libc::cnd_signal(&waiter_cnd), int(thrd_success));
- ASSERT_EQ(__llvm_libc::mtx_unlock(&waiter_mtx), int(thrd_success));
+ ASSERT_EQ(LIBC_NAMESPACE::mtx_lock(&waiter_mtx), int(thrd_success));
+ ASSERT_EQ(LIBC_NAMESPACE::cnd_signal(&waiter_cnd), int(thrd_success));
+ ASSERT_EQ(LIBC_NAMESPACE::mtx_unlock(&waiter_mtx), int(thrd_success));
int retval;
- __llvm_libc::thrd_join(waiter_thread, &retval);
+ LIBC_NAMESPACE::thrd_join(waiter_thread, &retval);
ASSERT_EQ(retval, 0x600D);
- __llvm_libc::mtx_destroy(&waiter_mtx);
- __llvm_libc::mtx_destroy(&main_thread_mtx);
- __llvm_libc::cnd_destroy(&waiter_cnd);
- __llvm_libc::cnd_destroy(&main_thread_cnd);
+ LIBC_NAMESPACE::mtx_destroy(&waiter_mtx);
+ LIBC_NAMESPACE::mtx_destroy(&main_thread_mtx);
+ LIBC_NAMESPACE::cnd_destroy(&waiter_cnd);
+ LIBC_NAMESPACE::cnd_destroy(&main_thread_cnd);
}
} // namespace single_waiter_test
diff --git a/libc/test/integration/src/threads/mtx_test.cpp b/libc/test/integration/src/threads/mtx_test.cpp
index 5887e1132f56b12..82b0350af97afc9 100644
--- a/libc/test/integration/src/threads/mtx_test.cpp
+++ b/libc/test/integration/src/threads/mtx_test.cpp
@@ -26,12 +26,12 @@ static int shared_int = START;
int counter(void *arg) {
int last_count = START;
while (true) {
- __llvm_libc::mtx_lock(&mutex);
+ LIBC_NAMESPACE::mtx_lock(&mutex);
if (shared_int == last_count + 1) {
shared_int++;
last_count = shared_int;
}
- __llvm_libc::mtx_unlock(&mutex);
+ LIBC_NAMESPACE::mtx_unlock(&mutex);
if (last_count >= MAX)
break;
}
@@ -39,17 +39,17 @@ int counter(void *arg) {
}
void relay_counter() {
- ASSERT_EQ(__llvm_libc::mtx_init(&mutex, mtx_plain),
+ ASSERT_EQ(LIBC_NAMESPACE::mtx_init(&mutex, mtx_plain),
static_cast<int>(thrd_success));
// The idea of this test is that two competing threads will update
// a counter only if the other thread has updated it.
thrd_t thread;
- __llvm_libc::thrd_create(&thread, counter, nullptr);
+ LIBC_NAMESPACE::thrd_create(&thread, counter, nullptr);
int last_count = START;
while (true) {
- ASSERT_EQ(__llvm_libc::mtx_lock(&mutex), static_cast<int>(thrd_success));
+ ASSERT_EQ(LIBC_NAMESPACE::mtx_lock(&mutex), static_cast<int>(thrd_success));
if (shared_int == START) {
++shared_int;
last_count = shared_int;
@@ -58,36 +58,37 @@ void relay_counter() {
++shared_int;
last_count = shared_int;
}
- ASSERT_EQ(__llvm_libc::mtx_unlock(&mutex), static_cast<int>(thrd_success));
+ ASSERT_EQ(LIBC_NAMESPACE::mtx_unlock(&mutex),
+ static_cast<int>(thrd_success));
if (last_count > MAX)
break;
}
int retval = 123;
- __llvm_libc::thrd_join(thread, &retval);
+ LIBC_NAMESPACE::thrd_join(thread, &retval);
ASSERT_EQ(retval, 0);
- __llvm_libc::mtx_destroy(&mutex);
+ LIBC_NAMESPACE::mtx_destroy(&mutex);
}
mtx_t start_lock, step_lock;
bool started, step;
int stepper(void *arg) {
- __llvm_libc::mtx_lock(&start_lock);
+ LIBC_NAMESPACE::mtx_lock(&start_lock);
started = true;
- __llvm_libc::mtx_unlock(&start_lock);
+ LIBC_NAMESPACE::mtx_unlock(&start_lock);
- __llvm_libc::mtx_lock(&step_lock);
+ LIBC_NAMESPACE::mtx_lock(&step_lock);
step = true;
- __llvm_libc::mtx_unlock(&step_lock);
+ LIBC_NAMESPACE::mtx_unlock(&step_lock);
return 0;
}
void wait_and_step() {
- ASSERT_EQ(__llvm_libc::mtx_init(&start_lock, mtx_plain),
+ ASSERT_EQ(LIBC_NAMESPACE::mtx_init(&start_lock, mtx_plain),
static_cast<int>(thrd_success));
- ASSERT_EQ(__llvm_libc::mtx_init(&step_lock, mtx_plain),
+ ASSERT_EQ(LIBC_NAMESPACE::mtx_init(&step_lock, mtx_plain),
static_cast<int>(thrd_success));
// In this test, we start a new thread but block it before it can make a
@@ -95,17 +96,18 @@ void wait_and_step() {
// After unblocking, we then verify that the thread was indeed unblocked.
step = false;
started = false;
- ASSERT_EQ(__llvm_libc::mtx_lock(&step_lock), static_cast<int>(thrd_success));
+ ASSERT_EQ(LIBC_NAMESPACE::mtx_lock(&step_lock),
+ static_cast<int>(thrd_success));
thrd_t thread;
- __llvm_libc::thrd_create(&thread, stepper, nullptr);
+ LIBC_NAMESPACE::thrd_create(&thread, stepper, nullptr);
while (true) {
// Make sure the thread actually started.
- ASSERT_EQ(__llvm_libc::mtx_lock(&start_lock),
+ ASSERT_EQ(LIBC_NAMESPACE::mtx_lock(&start_lock),
static_cast<int>(thrd_success));
bool s = started;
- ASSERT_EQ(__llvm_libc::mtx_unlock(&start_lock),
+ ASSERT_EQ(LIBC_NAMESPACE::mtx_unlock(&start_lock),
static_cast<int>(thrd_success));
if (s)
break;
@@ -115,25 +117,25 @@ void wait_and_step() {
ASSERT_FALSE(step);
// Unlock the step lock and wait until the step is made.
- ASSERT_EQ(__llvm_libc::mtx_unlock(&step_lock),
+ ASSERT_EQ(LIBC_NAMESPACE::mtx_unlock(&step_lock),
static_cast<int>(thrd_success));
while (true) {
- ASSERT_EQ(__llvm_libc::mtx_lock(&step_lock),
+ ASSERT_EQ(LIBC_NAMESPACE::mtx_lock(&step_lock),
static_cast<int>(thrd_success));
bool current_step_value = step;
- ASSERT_EQ(__llvm_libc::mtx_unlock(&step_lock),
+ ASSERT_EQ(LIBC_NAMESPACE::mtx_unlock(&step_lock),
static_cast<int>(thrd_success));
if (current_step_value)
break;
}
int retval = 123;
- __llvm_libc::thrd_join(thread, &retval);
+ LIBC_NAMESPACE::thrd_join(thread, &retval);
ASSERT_EQ(retval, 0);
- __llvm_libc::mtx_destroy(&start_lock);
- __llvm_libc::mtx_destroy(&step_lock);
+ LIBC_NAMESPACE::mtx_destroy(&start_lock);
+ LIBC_NAMESPACE::mtx_destroy(&step_lock);
}
static constexpr int THREAD_COUNT = 10;
@@ -142,54 +144,54 @@ static mtx_t counter_lock;
static int wait_count = 0;
int waiter_func(void *) {
- __llvm_libc::mtx_lock(&counter_lock);
+ LIBC_NAMESPACE::mtx_lock(&counter_lock);
++wait_count;
- __llvm_libc::mtx_unlock(&counter_lock);
+ LIBC_NAMESPACE::mtx_unlock(&counter_lock);
// Block on the waiter lock until the main
// thread unblocks.
- __llvm_libc::mtx_lock(&multiple_waiter_lock);
- __llvm_libc::mtx_unlock(&multiple_waiter_lock);
+ LIBC_NAMESPACE::mtx_lock(&multiple_waiter_lock);
+ LIBC_NAMESPACE::mtx_unlock(&multiple_waiter_lock);
- __llvm_libc::mtx_lock(&counter_lock);
+ LIBC_NAMESPACE::mtx_lock(&counter_lock);
--wait_count;
- __llvm_libc::mtx_unlock(&counter_lock);
+ LIBC_NAMESPACE::mtx_unlock(&counter_lock);
return 0;
}
void multiple_waiters() {
- __llvm_libc::mtx_init(&multiple_waiter_lock, mtx_plain);
- __llvm_libc::mtx_init(&counter_lock, mtx_plain);
+ LIBC_NAMESPACE::mtx_init(&multiple_waiter_lock, mtx_plain);
+ LIBC_NAMESPACE::mtx_init(&counter_lock, mtx_plain);
- __llvm_libc::mtx_lock(&multiple_waiter_lock);
+ LIBC_NAMESPACE::mtx_lock(&multiple_waiter_lock);
thrd_t waiters[THREAD_COUNT];
for (int i = 0; i < THREAD_COUNT; ++i) {
- __llvm_libc::thrd_create(waiters + i, waiter_func, nullptr);
+ LIBC_NAMESPACE::thrd_create(waiters + i, waiter_func, nullptr);
}
// Spin until the counter is incremented to the desired
// value.
while (true) {
- __llvm_libc::mtx_lock(&counter_lock);
+ LIBC_NAMESPACE::mtx_lock(&counter_lock);
if (wait_count == THREAD_COUNT) {
- __llvm_libc::mtx_unlock(&counter_lock);
+ LIBC_NAMESPACE::mtx_unlock(&counter_lock);
break;
}
- __llvm_libc::mtx_unlock(&counter_lock);
+ LIBC_NAMESPACE::mtx_unlock(&counter_lock);
}
- __llvm_libc::mtx_unlock(&multiple_waiter_lock);
+ LIBC_NAMESPACE::mtx_unlock(&multiple_waiter_lock);
int retval;
for (int i = 0; i < THREAD_COUNT; ++i) {
- __llvm_libc::thrd_join(waiters[i], &retval);
+ LIBC_NAMESPACE::thrd_join(waiters[i], &retval);
}
ASSERT_EQ(wait_count, 0);
- __llvm_libc::mtx_destroy(&multiple_waiter_lock);
- __llvm_libc::mtx_destroy(&counter_lock);
+ LIBC_NAMESPACE::mtx_destroy(&multiple_waiter_lock);
+ LIBC_NAMESPACE::mtx_destroy(&counter_lock);
}
TEST_MAIN() {
diff --git a/libc/test/integration/src/threads/thrd_equal_test.cpp b/libc/test/integration/src/threads/thrd_equal_test.cpp
index 8b4a00dff323138..4f8866f088b9253 100644
--- a/libc/test/integration/src/threads/thrd_equal_test.cpp
+++ b/libc/test/integration/src/threads/thrd_equal_test.cpp
@@ -23,21 +23,21 @@ thrd_t child_thread;
mtx_t mutex;
static int child_func(void *arg) {
- __llvm_libc::mtx_lock(&mutex);
+ LIBC_NAMESPACE::mtx_lock(&mutex);
int *ret = reinterpret_cast<int *>(arg);
- auto self = __llvm_libc::thrd_current();
- *ret = __llvm_libc::thrd_equal(child_thread, self);
- __llvm_libc::mtx_unlock(&mutex);
+ auto self = LIBC_NAMESPACE::thrd_current();
+ *ret = LIBC_NAMESPACE::thrd_equal(child_thread, self);
+ LIBC_NAMESPACE::mtx_unlock(&mutex);
return 0;
}
TEST_MAIN() {
// We init and lock the mutex so that we guarantee that the child thread is
// waiting after startup.
- ASSERT_EQ(__llvm_libc::mtx_init(&mutex, mtx_plain), int(thrd_success));
- ASSERT_EQ(__llvm_libc::mtx_lock(&mutex), int(thrd_success));
+ ASSERT_EQ(LIBC_NAMESPACE::mtx_init(&mutex, mtx_plain), int(thrd_success));
+ ASSERT_EQ(LIBC_NAMESPACE::mtx_lock(&mutex), int(thrd_success));
- auto main_thread = __llvm_libc::thrd_current();
+ auto main_thread = LIBC_NAMESPACE::thrd_current();
// The idea here is that, we start a child thread which will immediately
// wait on |mutex|. The main thread will update the global |child_thread| var
@@ -46,23 +46,23 @@ TEST_MAIN() {
// comparison is returned in the thread arg.
int result = 0;
thrd_t th;
- ASSERT_EQ(__llvm_libc::thrd_create(&th, child_func, &result),
+ ASSERT_EQ(LIBC_NAMESPACE::thrd_create(&th, child_func, &result),
int(thrd_success));
// This new thread should of course not be equal to the main thread.
- ASSERT_EQ(__llvm_libc::thrd_equal(th, main_thread), 0);
+ ASSERT_EQ(LIBC_NAMESPACE::thrd_equal(th, main_thread), 0);
// Set the |child_thread| global var and unlock to allow the child to perform
// the comparison.
child_thread = th;
- ASSERT_EQ(__llvm_libc::mtx_unlock(&mutex), int(thrd_success));
+ ASSERT_EQ(LIBC_NAMESPACE::mtx_unlock(&mutex), int(thrd_success));
int retval;
- ASSERT_EQ(__llvm_libc::thrd_join(th, &retval), int(thrd_success));
+ ASSERT_EQ(LIBC_NAMESPACE::thrd_join(th, &retval), int(thrd_success));
ASSERT_EQ(retval, 0);
// The child thread should see that thrd_current return value is the same as
// |child_thread|.
ASSERT_NE(result, 0);
- __llvm_libc::mtx_destroy(&mutex);
+ LIBC_NAMESPACE::mtx_destroy(&mutex);
return 0;
}
diff --git a/libc/test/integration/src/threads/thrd_exit_test.cpp b/libc/test/integration/src/threads/thrd_exit_test.cpp
index 6e7baa9d0da670b..0939a7621f443c4 100644
--- a/libc/test/integration/src/threads/thrd_exit_test.cpp
+++ b/libc/test/integration/src/threads/thrd_exit_test.cpp
@@ -33,7 +33,7 @@ thread_local A thread_local_a(123);
int func(void *) {
thread_local_a.set(321);
- __llvm_libc::thrd_exit(0);
+ LIBC_NAMESPACE::thrd_exit(0);
return 0;
}
@@ -41,11 +41,11 @@ TEST_MAIN() {
thrd_t th;
int retval;
- ASSERT_EQ(__llvm_libc::thrd_create(&th, func, nullptr), thrd_success);
- ASSERT_EQ(__llvm_libc::thrd_join(th, &retval), thrd_success);
+ ASSERT_EQ(LIBC_NAMESPACE::thrd_create(&th, func, nullptr), thrd_success);
+ ASSERT_EQ(LIBC_NAMESPACE::thrd_join(th, &retval), thrd_success);
ASSERT_TRUE(dtor_called);
- __llvm_libc::thrd_exit(0);
+ LIBC_NAMESPACE::thrd_exit(0);
return 0;
}
diff --git a/libc/test/integration/src/threads/thrd_test.cpp b/libc/test/integration/src/threads/thrd_test.cpp
index 33d230c1ec028b0..58728366b53ee6c 100644
--- a/libc/test/integration/src/threads/thrd_test.cpp
+++ b/libc/test/integration/src/threads/thrd_test.cpp
@@ -24,10 +24,10 @@ void create_and_join() {
for (counter = 0; counter <= thread_count;) {
thrd_t thread;
int old_counter_val = counter;
- ASSERT_EQ(__llvm_libc::thrd_create(&thread, thread_func, nullptr),
+ ASSERT_EQ(LIBC_NAMESPACE::thrd_create(&thread, thread_func, nullptr),
(int)thrd_success);
int retval = thread_count + 1; // Start with a retval we dont expect.
- ASSERT_EQ(__llvm_libc::thrd_join(thread, &retval), (int)thrd_success);
+ ASSERT_EQ(LIBC_NAMESPACE::thrd_join(thread, &retval), (int)thrd_success);
ASSERT_EQ(retval, 0);
ASSERT_EQ(counter, old_counter_val + 1);
}
@@ -41,13 +41,14 @@ void spawn_and_join() {
for (int i = 0; i < thread_count; ++i) {
args[i] = i;
- ASSERT_EQ(__llvm_libc::thrd_create(thread_list + i, return_arg, args + i),
- (int)thrd_success);
+ ASSERT_EQ(
+ LIBC_NAMESPACE::thrd_create(thread_list + i, return_arg, args + i),
+ (int)thrd_success);
}
for (int i = 0; i < thread_count; ++i) {
int retval = thread_count + 1; // Start with a retval we dont expect.
- ASSERT_EQ(__llvm_libc::thrd_join(thread_list[i], &retval),
+ ASSERT_EQ(LIBC_NAMESPACE::thrd_join(thread_list[i], &retval),
(int)thrd_success);
ASSERT_EQ(retval, i);
}
diff --git a/libc/test/integration/src/threads/tss_test.cpp b/libc/test/integration/src/threads/tss_test.cpp
index df0954d5e2e461b..c1c91c810bdf2dc 100644
--- a/libc/test/integration/src/threads/tss_test.cpp
+++ b/libc/test/integration/src/threads/tss_test.cpp
@@ -31,8 +31,8 @@ void dtor(void *data) {
}
int func(void *obj) {
- ASSERT_EQ(__llvm_libc::tss_set(key, &child_thread_data), thrd_success);
- int *d = reinterpret_cast<int *>(__llvm_libc::tss_get(key));
+ ASSERT_EQ(LIBC_NAMESPACE::tss_set(key, &child_thread_data), thrd_success);
+ int *d = reinterpret_cast<int *>(LIBC_NAMESPACE::tss_get(key));
ASSERT_TRUE(d != nullptr);
ASSERT_EQ(&child_thread_data, d);
ASSERT_EQ(*d, THREAD_DATA_INITVAL);
@@ -41,23 +41,23 @@ int func(void *obj) {
}
TEST_MAIN() {
- ASSERT_EQ(__llvm_libc::tss_create(&key, &dtor), thrd_success);
- ASSERT_EQ(__llvm_libc::tss_set(key, &main_thread_data), thrd_success);
- int *d = reinterpret_cast<int *>(__llvm_libc::tss_get(key));
+ ASSERT_EQ(LIBC_NAMESPACE::tss_create(&key, &dtor), thrd_success);
+ ASSERT_EQ(LIBC_NAMESPACE::tss_set(key, &main_thread_data), thrd_success);
+ int *d = reinterpret_cast<int *>(LIBC_NAMESPACE::tss_get(key));
ASSERT_TRUE(d != nullptr);
ASSERT_EQ(&main_thread_data, d);
ASSERT_EQ(*d, THREAD_DATA_INITVAL);
thrd_t th;
int arg = 0xBAD;
- ASSERT_EQ(__llvm_libc::thrd_create(&th, &func, &arg), thrd_success);
+ ASSERT_EQ(LIBC_NAMESPACE::thrd_create(&th, &func, &arg), thrd_success);
int retval = THREAD_DATA_INITVAL; // Init to some non-zero val.
- ASSERT_EQ(__llvm_libc::thrd_join(th, &retval), thrd_success);
+ ASSERT_EQ(LIBC_NAMESPACE::thrd_join(th, &retval), thrd_success);
ASSERT_EQ(retval, 0);
ASSERT_EQ(arg, THREAD_RUN_VAL);
ASSERT_EQ(child_thread_data, THREAD_DATA_FINIVAL);
- __llvm_libc::tss_delete(key);
+ LIBC_NAMESPACE::tss_delete(key);
return 0;
}
diff --git a/libc/test/integration/src/unistd/execv_test.cpp b/libc/test/integration/src/unistd/execv_test.cpp
index 4a3969058485d63..254ef955f2720e0 100644
--- a/libc/test/integration/src/unistd/execv_test.cpp
+++ b/libc/test/integration/src/unistd/execv_test.cpp
@@ -16,36 +16,36 @@
#include <sys/wait.h>
void fork_and_execv_normal_exit() {
- pid_t pid = __llvm_libc::fork();
+ pid_t pid = LIBC_NAMESPACE::fork();
if (pid == 0) {
const char *path = "libc_execv_test_normal_exit";
char *const argv[] = {
const_cast<char *>("execv_test_normal_exit"),
nullptr,
};
- __llvm_libc::execv(path, argv);
+ LIBC_NAMESPACE::execv(path, argv);
}
ASSERT_TRUE(pid > 0);
int status;
- pid_t cpid = __llvm_libc::waitpid(pid, &status, 0);
+ pid_t cpid = LIBC_NAMESPACE::waitpid(pid, &status, 0);
ASSERT_TRUE(cpid > 0);
ASSERT_EQ(cpid, pid);
ASSERT_TRUE(WIFEXITED(status));
}
void fork_and_execv_signal_exit() {
- pid_t pid = __llvm_libc::fork();
+ pid_t pid = LIBC_NAMESPACE::fork();
if (pid == 0) {
const char *path = "libc_execv_test_signal_exit";
char *const argv[] = {
const_cast<char *>("execv_test_normal_exit"),
nullptr,
};
- __llvm_libc::execv(path, argv);
+ LIBC_NAMESPACE::execv(path, argv);
}
ASSERT_TRUE(pid > 0);
int status;
- pid_t cpid = __llvm_libc::waitpid(pid, &status, 0);
+ pid_t cpid = LIBC_NAMESPACE::waitpid(pid, &status, 0);
ASSERT_TRUE(cpid > 0);
ASSERT_EQ(cpid, pid);
ASSERT_FALSE(WIFEXITED(status));
diff --git a/libc/test/integration/src/unistd/execve_test.cpp b/libc/test/integration/src/unistd/execve_test.cpp
index 409fec74f4d8dfd..fb1a83da6385667 100644
--- a/libc/test/integration/src/unistd/execve_test.cpp
+++ b/libc/test/integration/src/unistd/execve_test.cpp
@@ -16,36 +16,36 @@
#include <sys/wait.h>
void fork_and_execv_normal_exit(char **envp) {
- pid_t pid = __llvm_libc::fork();
+ pid_t pid = LIBC_NAMESPACE::fork();
if (pid == 0) {
const char *path = "libc_execv_test_normal_exit";
char *const argv[] = {
const_cast<char *>("execv_test_normal_exit"),
nullptr,
};
- __llvm_libc::execve(path, argv, envp);
+ LIBC_NAMESPACE::execve(path, argv, envp);
}
ASSERT_TRUE(pid > 0);
int status;
- pid_t cpid = __llvm_libc::waitpid(pid, &status, 0);
+ pid_t cpid = LIBC_NAMESPACE::waitpid(pid, &status, 0);
ASSERT_TRUE(cpid > 0);
ASSERT_EQ(cpid, pid);
ASSERT_TRUE(WIFEXITED(status));
}
void fork_and_execv_signal_exit(char **envp) {
- pid_t pid = __llvm_libc::fork();
+ pid_t pid = LIBC_NAMESPACE::fork();
if (pid == 0) {
const char *path = "libc_execv_test_signal_exit";
char *const argv[] = {
const_cast<char *>("execv_test_normal_exit"),
nullptr,
};
- __llvm_libc::execve(path, argv, envp);
+ LIBC_NAMESPACE::execve(path, argv, envp);
}
ASSERT_TRUE(pid > 0);
int status;
- pid_t cpid = __llvm_libc::waitpid(pid, &status, 0);
+ pid_t cpid = LIBC_NAMESPACE::waitpid(pid, &status, 0);
ASSERT_TRUE(cpid > 0);
ASSERT_EQ(cpid, pid);
ASSERT_FALSE(WIFEXITED(status));
diff --git a/libc/test/integration/src/unistd/fork_test.cpp b/libc/test/integration/src/unistd/fork_test.cpp
index 16798627ad9ab61..9c9213ed46316d2 100644
--- a/libc/test/integration/src/unistd/fork_test.cpp
+++ b/libc/test/integration/src/unistd/fork_test.cpp
@@ -26,19 +26,19 @@
// a child.
void fork_and_wait_normal_exit() {
- pid_t pid = __llvm_libc::fork();
+ pid_t pid = LIBC_NAMESPACE::fork();
if (pid == 0)
return; // Just end without any thing special.
ASSERT_TRUE(pid > 0);
int status;
- pid_t cpid = __llvm_libc::wait(&status);
+ pid_t cpid = LIBC_NAMESPACE::wait(&status);
ASSERT_TRUE(cpid > 0);
ASSERT_EQ(cpid, pid);
ASSERT_TRUE(WIFEXITED(status));
}
void fork_and_wait4_normal_exit() {
- pid_t pid = __llvm_libc::fork();
+ pid_t pid = LIBC_NAMESPACE::fork();
if (pid == 0)
return; // Just end without any thing special.
ASSERT_TRUE(pid > 0);
@@ -46,31 +46,31 @@ void fork_and_wait4_normal_exit() {
struct rusage usage;
usage.ru_utime = {0, 0};
usage.ru_stime = {0, 0};
- pid_t cpid = __llvm_libc::wait4(pid, &status, 0, &usage);
+ pid_t cpid = LIBC_NAMESPACE::wait4(pid, &status, 0, &usage);
ASSERT_TRUE(cpid > 0);
ASSERT_EQ(cpid, pid);
ASSERT_TRUE(WIFEXITED(status));
}
void fork_and_waitpid_normal_exit() {
- pid_t pid = __llvm_libc::fork();
+ pid_t pid = LIBC_NAMESPACE::fork();
if (pid == 0)
return; // Just end without any thing special.
ASSERT_TRUE(pid > 0);
int status;
- pid_t cpid = __llvm_libc::waitpid(pid, &status, 0);
+ pid_t cpid = LIBC_NAMESPACE::waitpid(pid, &status, 0);
ASSERT_TRUE(cpid > 0);
ASSERT_EQ(cpid, pid);
ASSERT_TRUE(WIFEXITED(status));
}
void fork_and_wait_signal_exit() {
- pid_t pid = __llvm_libc::fork();
+ pid_t pid = LIBC_NAMESPACE::fork();
if (pid == 0)
- __llvm_libc::raise(SIGUSR1);
+ LIBC_NAMESPACE::raise(SIGUSR1);
ASSERT_TRUE(pid > 0);
int status;
- pid_t cpid = __llvm_libc::wait(&status);
+ pid_t cpid = LIBC_NAMESPACE::wait(&status);
ASSERT_TRUE(cpid > 0);
ASSERT_EQ(cpid, pid);
ASSERT_FALSE(WIFEXITED(status));
@@ -78,15 +78,15 @@ void fork_and_wait_signal_exit() {
}
void fork_and_wait4_signal_exit() {
- pid_t pid = __llvm_libc::fork();
+ pid_t pid = LIBC_NAMESPACE::fork();
if (pid == 0)
- __llvm_libc::raise(SIGUSR1);
+ LIBC_NAMESPACE::raise(SIGUSR1);
ASSERT_TRUE(pid > 0);
int status;
struct rusage usage;
usage.ru_utime = {0, 0};
usage.ru_stime = {0, 0};
- pid_t cpid = __llvm_libc::wait4(pid, &status, 0, &usage);
+ pid_t cpid = LIBC_NAMESPACE::wait4(pid, &status, 0, &usage);
ASSERT_TRUE(cpid > 0);
ASSERT_EQ(cpid, pid);
ASSERT_FALSE(WIFEXITED(status));
@@ -94,12 +94,12 @@ void fork_and_wait4_signal_exit() {
}
void fork_and_waitpid_signal_exit() {
- pid_t pid = __llvm_libc::fork();
+ pid_t pid = LIBC_NAMESPACE::fork();
if (pid == 0)
- __llvm_libc::raise(SIGUSR1);
+ LIBC_NAMESPACE::raise(SIGUSR1);
ASSERT_TRUE(pid > 0);
int status;
- pid_t cpid = __llvm_libc::waitpid(pid, &status, 0);
+ pid_t cpid = LIBC_NAMESPACE::waitpid(pid, &status, 0);
ASSERT_TRUE(cpid > 0);
ASSERT_EQ(cpid, pid);
ASSERT_FALSE(WIFEXITED(status));
@@ -118,19 +118,20 @@ static void parent_cb() { parent = DONE; }
static void child_cb() { child = DONE; }
void fork_with_atfork_callbacks() {
- ASSERT_EQ(__llvm_libc::pthread_atfork(&prepare_cb, &parent_cb, &child_cb), 0);
- pid_t pid = __llvm_libc::fork();
+ ASSERT_EQ(LIBC_NAMESPACE::pthread_atfork(&prepare_cb, &parent_cb, &child_cb),
+ 0);
+ pid_t pid = LIBC_NAMESPACE::fork();
if (pid == 0) {
// Raise a signal from the child if unexpected at-fork
// behavior is observed.
if (child != DONE || prepare != DONE || parent == DONE)
- __llvm_libc::raise(SIGUSR1);
+ LIBC_NAMESPACE::raise(SIGUSR1);
return;
}
ASSERT_TRUE(pid > 0);
int status;
- pid_t cpid = __llvm_libc::waitpid(pid, &status, 0);
+ pid_t cpid = LIBC_NAMESPACE::waitpid(pid, &status, 0);
ASSERT_TRUE(cpid > 0);
ASSERT_EQ(cpid, pid);
ASSERT_TRUE(WIFEXITED(status));
diff --git a/libc/test/integration/src/unistd/getcwd_test.cpp b/libc/test/integration/src/unistd/getcwd_test.cpp
index 3214ebf7085cf04..3d8f5821a69efcb 100644
--- a/libc/test/integration/src/unistd/getcwd_test.cpp
+++ b/libc/test/integration/src/unistd/getcwd_test.cpp
@@ -15,26 +15,26 @@
#include <stdlib.h> // For malloc and free
-using __llvm_libc::cpp::string_view;
+using LIBC_NAMESPACE::cpp::string_view;
TEST_MAIN(int argc, char **argv, char **envp) {
char buffer[1024];
- ASSERT_TRUE(string_view(__llvm_libc::getenv("PWD")) ==
- __llvm_libc::getcwd(buffer, 1024));
+ ASSERT_TRUE(string_view(LIBC_NAMESPACE::getenv("PWD")) ==
+ LIBC_NAMESPACE::getcwd(buffer, 1024));
// nullptr buffer
- char *cwd = __llvm_libc::getcwd(nullptr, 0);
- ASSERT_TRUE(string_view(__llvm_libc::getenv("PWD")) == cwd);
+ char *cwd = LIBC_NAMESPACE::getcwd(nullptr, 0);
+ ASSERT_TRUE(string_view(LIBC_NAMESPACE::getenv("PWD")) == cwd);
free(cwd);
// Bad size
- cwd = __llvm_libc::getcwd(buffer, 0);
+ cwd = LIBC_NAMESPACE::getcwd(buffer, 0);
ASSERT_TRUE(cwd == nullptr);
ASSERT_EQ(libc_errno, EINVAL);
libc_errno = 0;
// Insufficient size
- cwd = __llvm_libc::getcwd(buffer, 2);
+ cwd = LIBC_NAMESPACE::getcwd(buffer, 2);
ASSERT_TRUE(cwd == nullptr);
int err = libc_errno;
ASSERT_EQ(err, ERANGE);
diff --git a/libc/test/integration/startup/gpu/rpc_interface_test.cpp b/libc/test/integration/startup/gpu/rpc_interface_test.cpp
index 3aa1346e940c91d..674e2cc1ed7499f 100644
--- a/libc/test/integration/startup/gpu/rpc_interface_test.cpp
+++ b/libc/test/integration/startup/gpu/rpc_interface_test.cpp
@@ -11,7 +11,7 @@
#include "src/__support/RPC/rpc_client.h"
#include "test/IntegrationTest/test.h"
-using namespace __llvm_libc;
+using namespace LIBC_NAMESPACE;
// Test to ensure that we can use aribtrary combinations of sends and recieves
// as long as they are mirrored.
diff --git a/libc/test/integration/startup/gpu/rpc_stream_test.cpp b/libc/test/integration/startup/gpu/rpc_stream_test.cpp
index afde3dd863db129..09a4ae67256e3a6 100644
--- a/libc/test/integration/startup/gpu/rpc_stream_test.cpp
+++ b/libc/test/integration/startup/gpu/rpc_stream_test.cpp
@@ -18,7 +18,7 @@
extern "C" void *malloc(uint64_t);
extern "C" void free(void *);
-using namespace __llvm_libc;
+using namespace LIBC_NAMESPACE;
static void test_stream() {
static const char str[] =
diff --git a/libc/test/integration/startup/gpu/rpc_test.cpp b/libc/test/integration/startup/gpu/rpc_test.cpp
index 75e9574e613dabb..4032d890c53ec89 100644
--- a/libc/test/integration/startup/gpu/rpc_test.cpp
+++ b/libc/test/integration/startup/gpu/rpc_test.cpp
@@ -11,7 +11,7 @@
#include "src/__support/RPC/rpc_client.h"
#include "test/IntegrationTest/test.h"
-using namespace __llvm_libc;
+using namespace LIBC_NAMESPACE;
static void test_add_simple() {
uint32_t num_additions =
diff --git a/libc/test/integration/startup/linux/tls_test.cpp b/libc/test/integration/startup/linux/tls_test.cpp
index d8315af6b987ac0..5f235a96006d651 100644
--- a/libc/test/integration/startup/linux/tls_test.cpp
+++ b/libc/test/integration/startup/linux/tls_test.cpp
@@ -29,8 +29,8 @@ TEST_MAIN(int argc, char **argv, char **envp) {
// local var, this helps us test setting of errno and
// reading it back.
ASSERT_TRUE(libc_errno == 0);
- void *addr = __llvm_libc::mmap(nullptr, 0, PROT_READ,
- MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
+ void *addr = LIBC_NAMESPACE::mmap(nullptr, 0, PROT_READ,
+ MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
ASSERT_TRUE(addr == MAP_FAILED);
ASSERT_TRUE(libc_errno == EINVAL);
diff --git a/libc/test/src/__support/CPP/atomic_test.cpp b/libc/test/src/__support/CPP/atomic_test.cpp
index 16408f7ad1467bf..5b105c8eb3d56cf 100644
--- a/libc/test/src/__support/CPP/atomic_test.cpp
+++ b/libc/test/src/__support/CPP/atomic_test.cpp
@@ -13,22 +13,22 @@
// threads, at which point it becomes a chicken and egg problem.
TEST(LlvmLibcAtomicTest, LoadStore) {
- __llvm_libc::cpp::Atomic<int> aint(123);
- ASSERT_EQ(aint.load(__llvm_libc::cpp::MemoryOrder::RELAXED), 123);
+ LIBC_NAMESPACE::cpp::Atomic<int> aint(123);
+ ASSERT_EQ(aint.load(LIBC_NAMESPACE::cpp::MemoryOrder::RELAXED), 123);
- aint.store(100, __llvm_libc::cpp::MemoryOrder::RELAXED);
- ASSERT_EQ(aint.load(__llvm_libc::cpp::MemoryOrder::RELAXED), 100);
+ aint.store(100, LIBC_NAMESPACE::cpp::MemoryOrder::RELAXED);
+ ASSERT_EQ(aint.load(LIBC_NAMESPACE::cpp::MemoryOrder::RELAXED), 100);
aint = 1234; // Equivalent of store
- ASSERT_EQ(aint.load(__llvm_libc::cpp::MemoryOrder::RELAXED), 1234);
+ ASSERT_EQ(aint.load(LIBC_NAMESPACE::cpp::MemoryOrder::RELAXED), 1234);
}
TEST(LlvmLibcAtomicTest, CompareExchangeStrong) {
int desired = 123;
- __llvm_libc::cpp::Atomic<int> aint(desired);
+ LIBC_NAMESPACE::cpp::Atomic<int> aint(desired);
ASSERT_TRUE(aint.compare_exchange_strong(desired, 100));
- ASSERT_EQ(aint.load(__llvm_libc::cpp::MemoryOrder::RELAXED), 100);
+ ASSERT_EQ(aint.load(LIBC_NAMESPACE::cpp::MemoryOrder::RELAXED), 100);
ASSERT_FALSE(aint.compare_exchange_strong(desired, 100));
- ASSERT_EQ(aint.load(__llvm_libc::cpp::MemoryOrder::RELAXED), 100);
+ ASSERT_EQ(aint.load(LIBC_NAMESPACE::cpp::MemoryOrder::RELAXED), 100);
}
diff --git a/libc/test/src/__support/CPP/bitset_test.cpp b/libc/test/src/__support/CPP/bitset_test.cpp
index 9983cfc8bbbd489..f1d4e4c2f963644 100644
--- a/libc/test/src/__support/CPP/bitset_test.cpp
+++ b/libc/test/src/__support/CPP/bitset_test.cpp
@@ -10,14 +10,14 @@
#include "test/UnitTest/Test.h"
TEST(LlvmLibcBitsetTest, SetBitForSizeEqualToOne) {
- __llvm_libc::cpp::bitset<1> bitset;
+ LIBC_NAMESPACE::cpp::bitset<1> bitset;
EXPECT_FALSE(bitset.test(0));
bitset.set(0);
EXPECT_TRUE(bitset.test(0));
}
TEST(LlvmLibcBitsetTest, SetsBitsForSizeEqualToTwo) {
- __llvm_libc::cpp::bitset<2> bitset;
+ LIBC_NAMESPACE::cpp::bitset<2> bitset;
bitset.set(0);
EXPECT_TRUE(bitset.test(0));
bitset.set(1);
@@ -25,7 +25,7 @@ TEST(LlvmLibcBitsetTest, SetsBitsForSizeEqualToTwo) {
}
TEST(LlvmLibcBitsetTest, SetsAllBitsForSizeLessThanEight) {
- __llvm_libc::cpp::bitset<7> bitset;
+ LIBC_NAMESPACE::cpp::bitset<7> bitset;
for (size_t i = 0; i < 7; ++i)
bitset.set(i);
// Verify all bits are now set.
@@ -34,7 +34,7 @@ TEST(LlvmLibcBitsetTest, SetsAllBitsForSizeLessThanEight) {
}
TEST(LlvmLibcBitsetTest, SetsAllBitsForSizeLessThanSixteen) {
- __llvm_libc::cpp::bitset<15> bitset;
+ LIBC_NAMESPACE::cpp::bitset<15> bitset;
for (size_t i = 0; i < 15; ++i)
bitset.set(i);
// Verify all bits are now set.
@@ -43,7 +43,7 @@ TEST(LlvmLibcBitsetTest, SetsAllBitsForSizeLessThanSixteen) {
}
TEST(LlvmLibcBitsetTest, SetsAllBitsForSizeLessThanThirtyTwo) {
- __llvm_libc::cpp::bitset<31> bitset;
+ LIBC_NAMESPACE::cpp::bitset<31> bitset;
for (size_t i = 0; i < 31; ++i)
bitset.set(i);
// Verify all bits are now set.
@@ -52,12 +52,12 @@ TEST(LlvmLibcBitsetTest, SetsAllBitsForSizeLessThanThirtyTwo) {
}
TEST(LlvmLibcBitsetTest, DefaultHasNoSetBits) {
- __llvm_libc::cpp::bitset<64> bitset;
+ LIBC_NAMESPACE::cpp::bitset<64> bitset;
for (size_t i = 0; i < 64; ++i) {
EXPECT_FALSE(bitset.test(i));
}
// Same for odd number.
- __llvm_libc::cpp::bitset<65> odd_bitset;
+ LIBC_NAMESPACE::cpp::bitset<65> odd_bitset;
for (size_t i = 0; i < 65; ++i) {
EXPECT_FALSE(odd_bitset.test(i));
}
@@ -66,7 +66,7 @@ TEST(LlvmLibcBitsetTest, DefaultHasNoSetBits) {
TEST(LlvmLibcBitsetTest, SettingBitXDoesNotSetBitY) {
for (size_t i = 0; i < 256; ++i) {
// Initialize within the loop to start with a fresh bitset.
- __llvm_libc::cpp::bitset<256> bitset;
+ LIBC_NAMESPACE::cpp::bitset<256> bitset;
bitset.set(i);
for (size_t neighbor = 0; neighbor < 256; ++neighbor) {
@@ -79,7 +79,7 @@ TEST(LlvmLibcBitsetTest, SettingBitXDoesNotSetBitY) {
// Same for odd number.
for (size_t i = 0; i < 255; ++i) {
- __llvm_libc::cpp::bitset<255> bitset;
+ LIBC_NAMESPACE::cpp::bitset<255> bitset;
bitset.set(i);
for (size_t neighbor = 0; neighbor < 255; ++neighbor) {
@@ -92,7 +92,7 @@ TEST(LlvmLibcBitsetTest, SettingBitXDoesNotSetBitY) {
}
TEST(LlvmLibcBitsetTest, SettingBitXDoesNotResetBitY) {
- __llvm_libc::cpp::bitset<128> bitset;
+ LIBC_NAMESPACE::cpp::bitset<128> bitset;
for (size_t i = 0; i < 128; ++i)
bitset.set(i);
@@ -102,7 +102,7 @@ TEST(LlvmLibcBitsetTest, SettingBitXDoesNotResetBitY) {
}
TEST(LlvmLibcBitsetTest, FlipTest) {
- __llvm_libc::cpp::bitset<128> bitset;
+ LIBC_NAMESPACE::cpp::bitset<128> bitset;
bitset.flip();
@@ -146,8 +146,8 @@ TEST(LlvmLibcBitsetTest, FlipTest) {
}
TEST(LlvmLibcBitsetTest, EqualTest) {
- __llvm_libc::cpp::bitset<128> bitset_a;
- __llvm_libc::cpp::bitset<128> bitset_b;
+ LIBC_NAMESPACE::cpp::bitset<128> bitset_a;
+ LIBC_NAMESPACE::cpp::bitset<128> bitset_b;
// New sets should be empty, and so they should be equal.
ASSERT_TRUE(bitset_a == bitset_b);
@@ -174,7 +174,7 @@ TEST(LlvmLibcBitsetTest, EqualTest) {
}
TEST(LlvmLibcBitsetTest, SetRangeTest) {
- __llvm_libc::cpp::bitset<256> bitset;
+ LIBC_NAMESPACE::cpp::bitset<256> bitset;
// Range from 1 to 1 should only set bit 1
bitset.set_range(1, 1);
diff --git a/libc/test/src/__support/CPP/cstddef_test.cpp b/libc/test/src/__support/CPP/cstddef_test.cpp
index ffae423f4fd0030..8337081345a02d6 100644
--- a/libc/test/src/__support/CPP/cstddef_test.cpp
+++ b/libc/test/src/__support/CPP/cstddef_test.cpp
@@ -9,7 +9,7 @@
#include "src/__support/CPP/cstddef.h"
#include "test/UnitTest/Test.h"
-namespace __llvm_libc::cpp {
+namespace LIBC_NAMESPACE::cpp {
TEST(LlvmLibcByteTest, to_integer) {
const char str[] = "abc";
@@ -41,4 +41,4 @@ TEST(LlvmLibcByteTest, bitwise) {
ASSERT_EQ(b, byte{0b00001111});
}
-} // namespace __llvm_libc::cpp
+} // namespace LIBC_NAMESPACE::cpp
diff --git a/libc/test/src/__support/CPP/integer_sequence_test.cpp b/libc/test/src/__support/CPP/integer_sequence_test.cpp
index 1d040e6bc3e3c3e..fe378522b446b90 100644
--- a/libc/test/src/__support/CPP/integer_sequence_test.cpp
+++ b/libc/test/src/__support/CPP/integer_sequence_test.cpp
@@ -9,7 +9,7 @@
#include "src/__support/CPP/utility.h"
#include "test/UnitTest/Test.h"
-using namespace __llvm_libc::cpp;
+using namespace LIBC_NAMESPACE::cpp;
TEST(LlvmLibcIntegerSequencetTest, Basic) {
EXPECT_TRUE(
diff --git a/libc/test/src/__support/CPP/limits_test.cpp b/libc/test/src/__support/CPP/limits_test.cpp
index fea428e66eff85b..12641b7b51b6ce8 100644
--- a/libc/test/src/__support/CPP/limits_test.cpp
+++ b/libc/test/src/__support/CPP/limits_test.cpp
@@ -10,7 +10,7 @@
#include "src/__support/UInt.h"
#include "test/UnitTest/Test.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
// This just checks against the C spec, almost all implementations will surpass
// this.
@@ -32,14 +32,14 @@ TEST(LlvmLibcLimitsTest, LimitsFollowSpec) {
}
TEST(LlvmLibcLimitsTest, UInt128Limits) {
- auto umax128 = cpp::numeric_limits<__llvm_libc::cpp::UInt<128>>::max();
+ auto umax128 = cpp::numeric_limits<LIBC_NAMESPACE::cpp::UInt<128>>::max();
auto umax64 =
- __llvm_libc::cpp::UInt<128>(cpp::numeric_limits<uint64_t>::max());
+ LIBC_NAMESPACE::cpp::UInt<128>(cpp::numeric_limits<uint64_t>::max());
EXPECT_GT(umax128, umax64);
- ASSERT_EQ(~__llvm_libc::cpp::UInt<128>(0), umax128);
+ ASSERT_EQ(~LIBC_NAMESPACE::cpp::UInt<128>(0), umax128);
#ifdef __SIZEOF_INT128__
ASSERT_EQ(~__uint128_t(0), cpp::numeric_limits<__uint128_t>::max());
#endif
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/test/src/__support/CPP/optional_test.cpp b/libc/test/src/__support/CPP/optional_test.cpp
index c59175d59a2c43f..f9254d42c9a9ea8 100644
--- a/libc/test/src/__support/CPP/optional_test.cpp
+++ b/libc/test/src/__support/CPP/optional_test.cpp
@@ -9,8 +9,8 @@
#include "src/__support/CPP/optional.h"
#include "test/UnitTest/Test.h"
-using __llvm_libc::cpp::nullopt;
-using __llvm_libc::cpp::optional;
+using LIBC_NAMESPACE::cpp::nullopt;
+using LIBC_NAMESPACE::cpp::optional;
// This class has three properties for testing:
// 1) No default constructor.
diff --git a/libc/test/src/__support/CPP/span_test.cpp b/libc/test/src/__support/CPP/span_test.cpp
index 4476f4e98b94ea0..6da06c31e7adfd1 100644
--- a/libc/test/src/__support/CPP/span_test.cpp
+++ b/libc/test/src/__support/CPP/span_test.cpp
@@ -10,8 +10,8 @@
#include "src/__support/CPP/span.h"
#include "test/UnitTest/Test.h"
-using __llvm_libc::cpp::array;
-using __llvm_libc::cpp::span;
+using LIBC_NAMESPACE::cpp::array;
+using LIBC_NAMESPACE::cpp::span;
TEST(LlvmLibcSpanTest, InitializeEmpty) {
span<int> s;
diff --git a/libc/test/src/__support/CPP/string_test.cpp b/libc/test/src/__support/CPP/string_test.cpp
index 928277fe2e9cc76..e606ab127adc213 100644
--- a/libc/test/src/__support/CPP/string_test.cpp
+++ b/libc/test/src/__support/CPP/string_test.cpp
@@ -9,9 +9,9 @@
#include "src/__support/CPP/string.h"
#include "test/UnitTest/Test.h"
-using __llvm_libc::cpp::string;
-using __llvm_libc::cpp::string_view;
-using __llvm_libc::cpp::to_string;
+using LIBC_NAMESPACE::cpp::string;
+using LIBC_NAMESPACE::cpp::string_view;
+using LIBC_NAMESPACE::cpp::to_string;
TEST(LlvmLibcStringTest, InitializeEmpty) {
const string s;
diff --git a/libc/test/src/__support/CPP/stringstream_test.cpp b/libc/test/src/__support/CPP/stringstream_test.cpp
index c6bfd775e3460b4..e285fc5715bce2e 100644
--- a/libc/test/src/__support/CPP/stringstream_test.cpp
+++ b/libc/test/src/__support/CPP/stringstream_test.cpp
@@ -10,8 +10,8 @@
#include "src/__support/CPP/stringstream.h"
#include "test/UnitTest/Test.h"
-using __llvm_libc::cpp::span;
-using __llvm_libc::cpp::StringStream;
+using LIBC_NAMESPACE::cpp::span;
+using LIBC_NAMESPACE::cpp::StringStream;
TEST(LlvmLibcStringStreamTest, Simple) {
char buf[256];
diff --git a/libc/test/src/__support/CPP/stringview_test.cpp b/libc/test/src/__support/CPP/stringview_test.cpp
index 59a0d396095d0a3..33eb8ab4765728a 100644
--- a/libc/test/src/__support/CPP/stringview_test.cpp
+++ b/libc/test/src/__support/CPP/stringview_test.cpp
@@ -9,7 +9,7 @@
#include "src/__support/CPP/string_view.h"
#include "test/UnitTest/Test.h"
-using __llvm_libc::cpp::string_view;
+using LIBC_NAMESPACE::cpp::string_view;
TEST(LlvmLibcStringViewTest, InitializeCheck) {
string_view v;
diff --git a/libc/test/src/__support/CPP/type_traits_test.cpp b/libc/test/src/__support/CPP/type_traits_test.cpp
index 4e1eb41b7399207..0e5f4a1f738b7aa 100644
--- a/libc/test/src/__support/CPP/type_traits_test.cpp
+++ b/libc/test/src/__support/CPP/type_traits_test.cpp
@@ -11,7 +11,7 @@
// TODO: Split this file if it becomes too big.
-namespace __llvm_libc::cpp {
+namespace LIBC_NAMESPACE::cpp {
class Class {};
union Union {};
@@ -432,4 +432,4 @@ TEST(LlvmLibcTypeTraitsTest, true_type) { EXPECT_TRUE((true_type::value)); }
// TODO void_t
-} // namespace __llvm_libc::cpp
+} // namespace LIBC_NAMESPACE::cpp
diff --git a/libc/test/src/__support/FPUtil/dyadic_float_test.cpp b/libc/test/src/__support/FPUtil/dyadic_float_test.cpp
index b1ef7111867fc84..8fafa767ae38e34 100644
--- a/libc/test/src/__support/FPUtil/dyadic_float_test.cpp
+++ b/libc/test/src/__support/FPUtil/dyadic_float_test.cpp
@@ -12,9 +12,9 @@
#include "test/UnitTest/Test.h"
#include "utils/MPFRWrapper/MPFRUtils.h"
-using Float128 = __llvm_libc::fputil::DyadicFloat<128>;
-using Float192 = __llvm_libc::fputil::DyadicFloat<192>;
-using Float256 = __llvm_libc::fputil::DyadicFloat<256>;
+using Float128 = LIBC_NAMESPACE::fputil::DyadicFloat<128>;
+using Float192 = LIBC_NAMESPACE::fputil::DyadicFloat<192>;
+using Float256 = LIBC_NAMESPACE::fputil::DyadicFloat<256>;
TEST(LlvmLibcDyadicFloatTest, BasicConversions) {
Float128 x(/*sign*/ false, /*exponent*/ 0,
diff --git a/libc/test/src/__support/FPUtil/fpbits_test.cpp b/libc/test/src/__support/FPUtil/fpbits_test.cpp
index f910eb1d8763791..916523e28266935 100644
--- a/libc/test/src/__support/FPUtil/fpbits_test.cpp
+++ b/libc/test/src/__support/FPUtil/fpbits_test.cpp
@@ -10,14 +10,15 @@
#include "src/__support/FPUtil/fpbits_str.h"
#include "test/UnitTest/Test.h"
-using __llvm_libc::fputil::FPBits;
+using LIBC_NAMESPACE::fputil::FPBits;
TEST(LlvmLibcFPBitsTest, FloatType) {
- EXPECT_STREQ(__llvm_libc::str(FPBits<float>::inf()).c_str(), "(+Infinity)");
- EXPECT_STREQ(__llvm_libc::str(FPBits<float>::neg_inf()).c_str(),
+ EXPECT_STREQ(LIBC_NAMESPACE::str(FPBits<float>::inf()).c_str(),
+ "(+Infinity)");
+ EXPECT_STREQ(LIBC_NAMESPACE::str(FPBits<float>::neg_inf()).c_str(),
"(-Infinity)");
EXPECT_STREQ(
- __llvm_libc::str(FPBits<float>(FPBits<float>::build_nan(1))).c_str(),
+ LIBC_NAMESPACE::str(FPBits<float>(FPBits<float>::build_nan(1))).c_str(),
"(NaN)");
FPBits<float> zero(0.0f);
@@ -25,7 +26,7 @@ TEST(LlvmLibcFPBitsTest, FloatType) {
EXPECT_EQ(zero.get_unbiased_exponent(), static_cast<uint16_t>(0));
EXPECT_EQ(zero.get_mantissa(), static_cast<uint32_t>(0));
EXPECT_EQ(zero.uintval(), static_cast<uint32_t>(0x00000000));
- EXPECT_STREQ(__llvm_libc::str(zero).c_str(),
+ EXPECT_STREQ(LIBC_NAMESPACE::str(zero).c_str(),
"0x00000000 = (S: 0, E: 0x0000, M: 0x00000000)");
FPBits<float> negzero(-0.0f);
@@ -33,7 +34,7 @@ TEST(LlvmLibcFPBitsTest, FloatType) {
EXPECT_EQ(negzero.get_unbiased_exponent(), static_cast<uint16_t>(0));
EXPECT_EQ(negzero.get_mantissa(), static_cast<uint32_t>(0));
EXPECT_EQ(negzero.uintval(), static_cast<uint32_t>(0x80000000));
- EXPECT_STREQ(__llvm_libc::str(negzero).c_str(),
+ EXPECT_STREQ(LIBC_NAMESPACE::str(negzero).c_str(),
"0x80000000 = (S: 1, E: 0x0000, M: 0x00000000)");
FPBits<float> one(1.0f);
@@ -41,7 +42,7 @@ TEST(LlvmLibcFPBitsTest, FloatType) {
EXPECT_EQ(one.get_unbiased_exponent(), static_cast<uint16_t>(0x7F));
EXPECT_EQ(one.get_mantissa(), static_cast<uint32_t>(0));
EXPECT_EQ(one.uintval(), static_cast<uint32_t>(0x3F800000));
- EXPECT_STREQ(__llvm_libc::str(one).c_str(),
+ EXPECT_STREQ(LIBC_NAMESPACE::str(one).c_str(),
"0x3F800000 = (S: 0, E: 0x007F, M: 0x00000000)");
FPBits<float> negone(-1.0f);
@@ -49,7 +50,7 @@ TEST(LlvmLibcFPBitsTest, FloatType) {
EXPECT_EQ(negone.get_unbiased_exponent(), static_cast<uint16_t>(0x7F));
EXPECT_EQ(negone.get_mantissa(), static_cast<uint32_t>(0));
EXPECT_EQ(negone.uintval(), static_cast<uint32_t>(0xBF800000));
- EXPECT_STREQ(__llvm_libc::str(negone).c_str(),
+ EXPECT_STREQ(LIBC_NAMESPACE::str(negone).c_str(),
"0xBF800000 = (S: 1, E: 0x007F, M: 0x00000000)");
FPBits<float> num(1.125f);
@@ -57,7 +58,7 @@ TEST(LlvmLibcFPBitsTest, FloatType) {
EXPECT_EQ(num.get_unbiased_exponent(), static_cast<uint16_t>(0x7F));
EXPECT_EQ(num.get_mantissa(), static_cast<uint32_t>(0x00100000));
EXPECT_EQ(num.uintval(), static_cast<uint32_t>(0x3F900000));
- EXPECT_STREQ(__llvm_libc::str(num).c_str(),
+ EXPECT_STREQ(LIBC_NAMESPACE::str(num).c_str(),
"0x3F900000 = (S: 0, E: 0x007F, M: 0x00100000)");
FPBits<float> negnum(-1.125f);
@@ -65,16 +66,17 @@ TEST(LlvmLibcFPBitsTest, FloatType) {
EXPECT_EQ(negnum.get_unbiased_exponent(), static_cast<uint16_t>(0x7F));
EXPECT_EQ(negnum.get_mantissa(), static_cast<uint32_t>(0x00100000));
EXPECT_EQ(negnum.uintval(), static_cast<uint32_t>(0xBF900000));
- EXPECT_STREQ(__llvm_libc::str(negnum).c_str(),
+ EXPECT_STREQ(LIBC_NAMESPACE::str(negnum).c_str(),
"0xBF900000 = (S: 1, E: 0x007F, M: 0x00100000)");
}
TEST(LlvmLibcFPBitsTest, DoubleType) {
- EXPECT_STREQ(__llvm_libc::str(FPBits<double>::inf()).c_str(), "(+Infinity)");
- EXPECT_STREQ(__llvm_libc::str(FPBits<double>::neg_inf()).c_str(),
+ EXPECT_STREQ(LIBC_NAMESPACE::str(FPBits<double>::inf()).c_str(),
+ "(+Infinity)");
+ EXPECT_STREQ(LIBC_NAMESPACE::str(FPBits<double>::neg_inf()).c_str(),
"(-Infinity)");
EXPECT_STREQ(
- __llvm_libc::str(FPBits<double>(FPBits<double>::build_nan(1))).c_str(),
+ LIBC_NAMESPACE::str(FPBits<double>(FPBits<double>::build_nan(1))).c_str(),
"(NaN)");
FPBits<double> zero(0.0);
@@ -82,7 +84,7 @@ TEST(LlvmLibcFPBitsTest, DoubleType) {
EXPECT_EQ(zero.get_unbiased_exponent(), static_cast<uint16_t>(0x0000));
EXPECT_EQ(zero.get_mantissa(), static_cast<uint64_t>(0x0000000000000000));
EXPECT_EQ(zero.uintval(), static_cast<uint64_t>(0x0000000000000000));
- EXPECT_STREQ(__llvm_libc::str(zero).c_str(),
+ EXPECT_STREQ(LIBC_NAMESPACE::str(zero).c_str(),
"0x0000000000000000 = (S: 0, E: 0x0000, M: 0x0000000000000000)");
FPBits<double> negzero(-0.0);
@@ -90,7 +92,7 @@ TEST(LlvmLibcFPBitsTest, DoubleType) {
EXPECT_EQ(negzero.get_unbiased_exponent(), static_cast<uint16_t>(0x0000));
EXPECT_EQ(negzero.get_mantissa(), static_cast<uint64_t>(0x0000000000000000));
EXPECT_EQ(negzero.uintval(), static_cast<uint64_t>(0x8000000000000000));
- EXPECT_STREQ(__llvm_libc::str(negzero).c_str(),
+ EXPECT_STREQ(LIBC_NAMESPACE::str(negzero).c_str(),
"0x8000000000000000 = (S: 1, E: 0x0000, M: 0x0000000000000000)");
FPBits<double> one(1.0);
@@ -98,7 +100,7 @@ TEST(LlvmLibcFPBitsTest, DoubleType) {
EXPECT_EQ(one.get_unbiased_exponent(), static_cast<uint16_t>(0x03FF));
EXPECT_EQ(one.get_mantissa(), static_cast<uint64_t>(0x0000000000000000));
EXPECT_EQ(one.uintval(), static_cast<uint64_t>(0x3FF0000000000000));
- EXPECT_STREQ(__llvm_libc::str(one).c_str(),
+ EXPECT_STREQ(LIBC_NAMESPACE::str(one).c_str(),
"0x3FF0000000000000 = (S: 0, E: 0x03FF, M: 0x0000000000000000)");
FPBits<double> negone(-1.0);
@@ -106,7 +108,7 @@ TEST(LlvmLibcFPBitsTest, DoubleType) {
EXPECT_EQ(negone.get_unbiased_exponent(), static_cast<uint16_t>(0x03FF));
EXPECT_EQ(negone.get_mantissa(), static_cast<uint64_t>(0x0000000000000000));
EXPECT_EQ(negone.uintval(), static_cast<uint64_t>(0xBFF0000000000000));
- EXPECT_STREQ(__llvm_libc::str(negone).c_str(),
+ EXPECT_STREQ(LIBC_NAMESPACE::str(negone).c_str(),
"0xBFF0000000000000 = (S: 1, E: 0x03FF, M: 0x0000000000000000)");
FPBits<double> num(1.125);
@@ -114,7 +116,7 @@ TEST(LlvmLibcFPBitsTest, DoubleType) {
EXPECT_EQ(num.get_unbiased_exponent(), static_cast<uint16_t>(0x03FF));
EXPECT_EQ(num.get_mantissa(), static_cast<uint64_t>(0x0002000000000000));
EXPECT_EQ(num.uintval(), static_cast<uint64_t>(0x3FF2000000000000));
- EXPECT_STREQ(__llvm_libc::str(num).c_str(),
+ EXPECT_STREQ(LIBC_NAMESPACE::str(num).c_str(),
"0x3FF2000000000000 = (S: 0, E: 0x03FF, M: 0x0002000000000000)");
FPBits<double> negnum(-1.125);
@@ -122,7 +124,7 @@ TEST(LlvmLibcFPBitsTest, DoubleType) {
EXPECT_EQ(negnum.get_unbiased_exponent(), static_cast<uint16_t>(0x03FF));
EXPECT_EQ(negnum.get_mantissa(), static_cast<uint64_t>(0x0002000000000000));
EXPECT_EQ(negnum.uintval(), static_cast<uint64_t>(0xBFF2000000000000));
- EXPECT_STREQ(__llvm_libc::str(negnum).c_str(),
+ EXPECT_STREQ(LIBC_NAMESPACE::str(negnum).c_str(),
"0xBFF2000000000000 = (S: 1, E: 0x03FF, M: 0x0002000000000000)");
}
@@ -131,14 +133,14 @@ TEST(LlvmLibcFPBitsTest, X86LongDoubleType) {
if constexpr (sizeof(long double) == sizeof(double))
return; // The tests for the "double" type cover for this case.
- EXPECT_STREQ(__llvm_libc::str(FPBits<long double>::inf()).c_str(),
+ EXPECT_STREQ(LIBC_NAMESPACE::str(FPBits<long double>::inf()).c_str(),
"(+Infinity)");
- EXPECT_STREQ(__llvm_libc::str(FPBits<long double>::neg_inf()).c_str(),
+ EXPECT_STREQ(LIBC_NAMESPACE::str(FPBits<long double>::neg_inf()).c_str(),
"(-Infinity)");
- EXPECT_STREQ(
- __llvm_libc::str(FPBits<long double>(FPBits<long double>::build_nan(1)))
- .c_str(),
- "(NaN)");
+ EXPECT_STREQ(LIBC_NAMESPACE::str(
+ FPBits<long double>(FPBits<long double>::build_nan(1)))
+ .c_str(),
+ "(NaN)");
FPBits<long double> zero(0.0l);
EXPECT_EQ(zero.get_sign(), false);
@@ -147,7 +149,7 @@ TEST(LlvmLibcFPBitsTest, X86LongDoubleType) {
<< 64);
EXPECT_EQ(zero.uintval(), static_cast<UInt128>(0x0000000000000000) << 64);
EXPECT_STREQ(
- __llvm_libc::str(zero).c_str(),
+ LIBC_NAMESPACE::str(zero).c_str(),
"0x00000000000000000000000000000000 = "
"(S: 0, E: 0x0000, I: 0, M: 0x00000000000000000000000000000000)");
@@ -158,7 +160,7 @@ TEST(LlvmLibcFPBitsTest, X86LongDoubleType) {
<< 64);
EXPECT_EQ(negzero.uintval(), static_cast<UInt128>(0x1) << 79);
EXPECT_STREQ(
- __llvm_libc::str(negzero).c_str(),
+ LIBC_NAMESPACE::str(negzero).c_str(),
"0x00000000000080000000000000000000 = "
"(S: 1, E: 0x0000, I: 0, M: 0x00000000000000000000000000000000)");
@@ -168,7 +170,7 @@ TEST(LlvmLibcFPBitsTest, X86LongDoubleType) {
EXPECT_EQ(one.get_mantissa(), static_cast<UInt128>(0x0000000000000000) << 64);
EXPECT_EQ(one.uintval(), static_cast<UInt128>(0x3FFF8) << 60);
EXPECT_STREQ(
- __llvm_libc::str(one).c_str(),
+ LIBC_NAMESPACE::str(one).c_str(),
"0x0000000000003FFF8000000000000000 = "
"(S: 0, E: 0x3FFF, I: 1, M: 0x00000000000000000000000000000000)");
@@ -179,7 +181,7 @@ TEST(LlvmLibcFPBitsTest, X86LongDoubleType) {
<< 64);
EXPECT_EQ(negone.uintval(), static_cast<UInt128>(0xBFFF8) << 60);
EXPECT_STREQ(
- __llvm_libc::str(negone).c_str(),
+ LIBC_NAMESPACE::str(negone).c_str(),
"0x000000000000BFFF8000000000000000 = "
"(S: 1, E: 0x3FFF, I: 1, M: 0x00000000000000000000000000000000)");
@@ -189,7 +191,7 @@ TEST(LlvmLibcFPBitsTest, X86LongDoubleType) {
EXPECT_EQ(num.get_mantissa(), static_cast<UInt128>(0x1) << 60);
EXPECT_EQ(num.uintval(), static_cast<UInt128>(0x3FFF9) << 60);
EXPECT_STREQ(
- __llvm_libc::str(num).c_str(),
+ LIBC_NAMESPACE::str(num).c_str(),
"0x0000000000003FFF9000000000000000 = "
"(S: 0, E: 0x3FFF, I: 1, M: 0x00000000000000001000000000000000)");
@@ -199,7 +201,7 @@ TEST(LlvmLibcFPBitsTest, X86LongDoubleType) {
EXPECT_EQ(negnum.get_mantissa(), static_cast<UInt128>(0x1) << 60);
EXPECT_EQ(negnum.uintval(), static_cast<UInt128>(0xBFFF9) << 60);
EXPECT_STREQ(
- __llvm_libc::str(negnum).c_str(),
+ LIBC_NAMESPACE::str(negnum).c_str(),
"0x000000000000BFFF9000000000000000 = "
"(S: 1, E: 0x3FFF, I: 1, M: 0x00000000000000001000000000000000)");
}
@@ -208,14 +210,14 @@ TEST(LlvmLibcFPBitsTest, LongDoubleType) {
#if defined(LONG_DOUBLE_IS_DOUBLE)
return; // The tests for the "double" type cover for this case.
#else
- EXPECT_STREQ(__llvm_libc::str(FPBits<long double>::inf()).c_str(),
+ EXPECT_STREQ(LIBC_NAMESPACE::str(FPBits<long double>::inf()).c_str(),
"(+Infinity)");
- EXPECT_STREQ(__llvm_libc::str(FPBits<long double>::neg_inf()).c_str(),
+ EXPECT_STREQ(LIBC_NAMESPACE::str(FPBits<long double>::neg_inf()).c_str(),
"(-Infinity)");
- EXPECT_STREQ(
- __llvm_libc::str(FPBits<long double>(FPBits<long double>::build_nan(1)))
- .c_str(),
- "(NaN)");
+ EXPECT_STREQ(LIBC_NAMESPACE::str(
+ FPBits<long double>(FPBits<long double>::build_nan(1)))
+ .c_str(),
+ "(NaN)");
FPBits<long double> zero(0.0l);
EXPECT_EQ(zero.get_sign(), false);
@@ -223,7 +225,7 @@ TEST(LlvmLibcFPBitsTest, LongDoubleType) {
EXPECT_EQ(zero.get_mantissa(), static_cast<UInt128>(0x0000000000000000)
<< 64);
EXPECT_EQ(zero.uintval(), static_cast<UInt128>(0x0000000000000000) << 64);
- EXPECT_STREQ(__llvm_libc::str(zero).c_str(),
+ EXPECT_STREQ(LIBC_NAMESPACE::str(zero).c_str(),
"0x00000000000000000000000000000000 = "
"(S: 0, E: 0x0000, M: 0x00000000000000000000000000000000)");
@@ -233,7 +235,7 @@ TEST(LlvmLibcFPBitsTest, LongDoubleType) {
EXPECT_EQ(negzero.get_mantissa(), static_cast<UInt128>(0x0000000000000000)
<< 64);
EXPECT_EQ(negzero.uintval(), static_cast<UInt128>(0x1) << 127);
- EXPECT_STREQ(__llvm_libc::str(negzero).c_str(),
+ EXPECT_STREQ(LIBC_NAMESPACE::str(negzero).c_str(),
"0x80000000000000000000000000000000 = "
"(S: 1, E: 0x0000, M: 0x00000000000000000000000000000000)");
@@ -242,7 +244,7 @@ TEST(LlvmLibcFPBitsTest, LongDoubleType) {
EXPECT_EQ(one.get_unbiased_exponent(), static_cast<uint16_t>(0x3FFF));
EXPECT_EQ(one.get_mantissa(), static_cast<UInt128>(0x0000000000000000) << 64);
EXPECT_EQ(one.uintval(), static_cast<UInt128>(0x3FFF) << 112);
- EXPECT_STREQ(__llvm_libc::str(one).c_str(),
+ EXPECT_STREQ(LIBC_NAMESPACE::str(one).c_str(),
"0x3FFF0000000000000000000000000000 = "
"(S: 0, E: 0x3FFF, M: 0x00000000000000000000000000000000)");
@@ -252,7 +254,7 @@ TEST(LlvmLibcFPBitsTest, LongDoubleType) {
EXPECT_EQ(negone.get_mantissa(), static_cast<UInt128>(0x0000000000000000)
<< 64);
EXPECT_EQ(negone.uintval(), static_cast<UInt128>(0xBFFF) << 112);
- EXPECT_STREQ(__llvm_libc::str(negone).c_str(),
+ EXPECT_STREQ(LIBC_NAMESPACE::str(negone).c_str(),
"0xBFFF0000000000000000000000000000 = "
"(S: 1, E: 0x3FFF, M: 0x00000000000000000000000000000000)");
@@ -261,7 +263,7 @@ TEST(LlvmLibcFPBitsTest, LongDoubleType) {
EXPECT_EQ(num.get_unbiased_exponent(), static_cast<uint16_t>(0x3FFF));
EXPECT_EQ(num.get_mantissa(), static_cast<UInt128>(0x2) << 108);
EXPECT_EQ(num.uintval(), static_cast<UInt128>(0x3FFF2) << 108);
- EXPECT_STREQ(__llvm_libc::str(num).c_str(),
+ EXPECT_STREQ(LIBC_NAMESPACE::str(num).c_str(),
"0x3FFF2000000000000000000000000000 = "
"(S: 0, E: 0x3FFF, M: 0x00002000000000000000000000000000)");
@@ -270,7 +272,7 @@ TEST(LlvmLibcFPBitsTest, LongDoubleType) {
EXPECT_EQ(negnum.get_unbiased_exponent(), static_cast<uint16_t>(0x3FFF));
EXPECT_EQ(negnum.get_mantissa(), static_cast<UInt128>(0x2) << 108);
EXPECT_EQ(negnum.uintval(), static_cast<UInt128>(0xBFFF2) << 108);
- EXPECT_STREQ(__llvm_libc::str(negnum).c_str(),
+ EXPECT_STREQ(LIBC_NAMESPACE::str(negnum).c_str(),
"0xBFFF2000000000000000000000000000 = "
"(S: 1, E: 0x3FFF, M: 0x00002000000000000000000000000000)");
#endif
diff --git a/libc/test/src/__support/FPUtil/rounding_mode_test.cpp b/libc/test/src/__support/FPUtil/rounding_mode_test.cpp
index 01c1b3c2a9ffaf4..e73d10d9658841c 100644
--- a/libc/test/src/__support/FPUtil/rounding_mode_test.cpp
+++ b/libc/test/src/__support/FPUtil/rounding_mode_test.cpp
@@ -12,11 +12,11 @@
#include <fenv.h>
-using __llvm_libc::testing::mpfr::ForceRoundingMode;
-using __llvm_libc::testing::mpfr::RoundingMode;
+using LIBC_NAMESPACE::testing::mpfr::ForceRoundingMode;
+using LIBC_NAMESPACE::testing::mpfr::RoundingMode;
TEST(LlvmLibcFEnvImplTest, QuickRoundingUpTest) {
- using __llvm_libc::fputil::fenv_is_round_up;
+ using LIBC_NAMESPACE::fputil::fenv_is_round_up;
{
ForceRoundingMode __r(RoundingMode::Upward);
if (__r.success)
@@ -40,7 +40,7 @@ TEST(LlvmLibcFEnvImplTest, QuickRoundingUpTest) {
}
TEST(LlvmLibcFEnvImplTest, QuickRoundingDownTest) {
- using __llvm_libc::fputil::fenv_is_round_down;
+ using LIBC_NAMESPACE::fputil::fenv_is_round_down;
{
ForceRoundingMode __r(RoundingMode::Upward);
if (__r.success)
@@ -64,7 +64,7 @@ TEST(LlvmLibcFEnvImplTest, QuickRoundingDownTest) {
}
TEST(LlvmLibcFEnvImplTest, QuickRoundingNearestTest) {
- using __llvm_libc::fputil::fenv_is_round_to_nearest;
+ using LIBC_NAMESPACE::fputil::fenv_is_round_to_nearest;
{
ForceRoundingMode __r(RoundingMode::Upward);
if (__r.success)
@@ -88,7 +88,7 @@ TEST(LlvmLibcFEnvImplTest, QuickRoundingNearestTest) {
}
TEST(LlvmLibcFEnvImplTest, QuickRoundingTowardZeroTest) {
- using __llvm_libc::fputil::fenv_is_round_to_zero;
+ using LIBC_NAMESPACE::fputil::fenv_is_round_to_zero;
{
ForceRoundingMode __r(RoundingMode::Upward);
if (__r.success)
@@ -112,7 +112,7 @@ TEST(LlvmLibcFEnvImplTest, QuickRoundingTowardZeroTest) {
}
TEST(LlvmLibcFEnvImplTest, QuickGetRoundTest) {
- using __llvm_libc::fputil::quick_get_round;
+ using LIBC_NAMESPACE::fputil::quick_get_round;
{
ForceRoundingMode __r(RoundingMode::Upward);
if (__r.success)
diff --git a/libc/test/src/__support/File/file_test.cpp b/libc/test/src/__support/File/file_test.cpp
index 1a67ebdd5015430..fbcedc163de10a8 100644
--- a/libc/test/src/__support/File/file_test.cpp
+++ b/libc/test/src/__support/File/file_test.cpp
@@ -15,11 +15,11 @@
#include <stdio.h>
#include <stdlib.h>
-using ModeFlags = __llvm_libc::File::ModeFlags;
-using MemoryView = __llvm_libc::testing::MemoryView;
-using __llvm_libc::ErrorOr;
-using __llvm_libc::File;
-using __llvm_libc::FileIOResult;
+using ModeFlags = LIBC_NAMESPACE::File::ModeFlags;
+using MemoryView = LIBC_NAMESPACE::testing::MemoryView;
+using LIBC_NAMESPACE::ErrorOr;
+using LIBC_NAMESPACE::File;
+using LIBC_NAMESPACE::FileIOResult;
class StringFile : public File {
static constexpr size_t SIZE = 512;
@@ -28,11 +28,12 @@ class StringFile : public File {
size_t eof_marker;
bool write_append;
- static FileIOResult str_read(__llvm_libc::File *f, void *data, size_t len);
- static FileIOResult str_write(__llvm_libc::File *f, const void *data,
+ static FileIOResult str_read(LIBC_NAMESPACE::File *f, void *data, size_t len);
+ static FileIOResult str_write(LIBC_NAMESPACE::File *f, const void *data,
size_t len);
- static ErrorOr<long> str_seek(__llvm_libc::File *f, long offset, int whence);
- static int str_close(__llvm_libc::File *f) {
+ static ErrorOr<long> str_seek(LIBC_NAMESPACE::File *f, long offset,
+ int whence);
+ static int str_close(LIBC_NAMESPACE::File *f) {
delete reinterpret_cast<StringFile *>(f);
return 0;
}
@@ -40,11 +41,12 @@ class StringFile : public File {
public:
explicit StringFile(char *buffer, size_t buflen, int bufmode, bool owned,
ModeFlags modeflags)
- : __llvm_libc::File(&str_write, &str_read, &str_seek, &str_close,
- reinterpret_cast<uint8_t *>(buffer), buflen, bufmode,
- owned, modeflags),
+ : LIBC_NAMESPACE::File(&str_write, &str_read, &str_seek, &str_close,
+ reinterpret_cast<uint8_t *>(buffer), buflen,
+ bufmode, owned, modeflags),
pos(0), eof_marker(0), write_append(false) {
- if (modeflags & static_cast<ModeFlags>(__llvm_libc::File::OpenMode::APPEND))
+ if (modeflags &
+ static_cast<ModeFlags>(LIBC_NAMESPACE::File::OpenMode::APPEND))
write_append = true;
}
@@ -63,7 +65,7 @@ class StringFile : public File {
}
};
-FileIOResult StringFile::str_read(__llvm_libc::File *f, void *data,
+FileIOResult StringFile::str_read(LIBC_NAMESPACE::File *f, void *data,
size_t len) {
StringFile *sf = static_cast<StringFile *>(f);
if (sf->pos >= sf->eof_marker)
@@ -75,7 +77,7 @@ FileIOResult StringFile::str_read(__llvm_libc::File *f, void *data,
return i;
}
-FileIOResult StringFile::str_write(__llvm_libc::File *f, const void *data,
+FileIOResult StringFile::str_write(LIBC_NAMESPACE::File *f, const void *data,
size_t len) {
StringFile *sf = static_cast<StringFile *>(f);
if (sf->write_append)
@@ -91,7 +93,7 @@ FileIOResult StringFile::str_write(__llvm_libc::File *f, const void *data,
return i;
}
-ErrorOr<long> StringFile::str_seek(__llvm_libc::File *f, long offset,
+ErrorOr<long> StringFile::str_seek(LIBC_NAMESPACE::File *f, long offset,
int whence) {
StringFile *sf = static_cast<StringFile *>(f);
if (whence == SEEK_SET)
@@ -105,11 +107,11 @@ ErrorOr<long> StringFile::str_seek(__llvm_libc::File *f, long offset,
StringFile *new_string_file(char *buffer, size_t buflen, int bufmode,
bool owned, const char *mode) {
- __llvm_libc::AllocChecker ac;
+ LIBC_NAMESPACE::AllocChecker ac;
// We will just assume the allocation succeeds. We cannot test anything
// otherwise.
return new (ac) StringFile(buffer, buflen, bufmode, owned,
- __llvm_libc::File::mode_flags(mode));
+ LIBC_NAMESPACE::File::mode_flags(mode));
}
TEST(LlvmLibcFileTest, WriteOnly) {
diff --git a/libc/test/src/__support/File/platform_file_test.cpp b/libc/test/src/__support/File/platform_file_test.cpp
index 022c8afa44109b3..469d7500032b931 100644
--- a/libc/test/src/__support/File/platform_file_test.cpp
+++ b/libc/test/src/__support/File/platform_file_test.cpp
@@ -11,12 +11,12 @@
#include <stdio.h> // For SEEK_* macros
-using File = __llvm_libc::File;
+using File = LIBC_NAMESPACE::File;
constexpr char TEXT[] = "Hello, File";
constexpr size_t TEXT_SIZE = sizeof(TEXT) - 1; // Ignore the null terminator
LIBC_INLINE File *openfile(const char *file_name, const char *mode) {
- auto error_or_file = __llvm_libc::openfile(file_name, mode);
+ auto error_or_file = LIBC_NAMESPACE::openfile(file_name, mode);
return error_or_file.has_value() ? error_or_file.value() : nullptr;
}
diff --git a/libc/test/src/__support/File/platform_stderr_test.cpp b/libc/test/src/__support/File/platform_stderr_test.cpp
index ac79572fdb82f20..1311d729026ef81 100644
--- a/libc/test/src/__support/File/platform_stderr_test.cpp
+++ b/libc/test/src/__support/File/platform_stderr_test.cpp
@@ -8,5 +8,5 @@
#include "test/UnitTest/Test.h"
TEST(LlvmLibcPlatformStreamTest, StdErrSmokeTest) {
- EXPECT_FALSE(__llvm_libc::stderr == nullptr);
+ EXPECT_FALSE(LIBC_NAMESPACE::stderr == nullptr);
}
diff --git a/libc/test/src/__support/File/platform_stdin_test.cpp b/libc/test/src/__support/File/platform_stdin_test.cpp
index c0c41d54c399569..2fdf71623ae460f 100644
--- a/libc/test/src/__support/File/platform_stdin_test.cpp
+++ b/libc/test/src/__support/File/platform_stdin_test.cpp
@@ -8,5 +8,5 @@
#include "test/UnitTest/Test.h"
TEST(LlvmLibcPlatformStreamTest, StdInSmokeTest) {
- EXPECT_FALSE(__llvm_libc::stdin == nullptr);
+ EXPECT_FALSE(LIBC_NAMESPACE::stdin == nullptr);
}
diff --git a/libc/test/src/__support/File/platform_stdout_test.cpp b/libc/test/src/__support/File/platform_stdout_test.cpp
index a47281a7532d8ff..b479e8d287f7945 100644
--- a/libc/test/src/__support/File/platform_stdout_test.cpp
+++ b/libc/test/src/__support/File/platform_stdout_test.cpp
@@ -8,5 +8,5 @@
#include "test/UnitTest/Test.h"
TEST(LlvmLibcPlatformStreamTest, StdOutSmokeTest) {
- EXPECT_FALSE(__llvm_libc::stdout == nullptr);
+ EXPECT_FALSE(LIBC_NAMESPACE::stdout == nullptr);
}
diff --git a/libc/test/src/__support/OSUtil/linux/x86_64/syscall_test.cpp b/libc/test/src/__support/OSUtil/linux/x86_64/syscall_test.cpp
index 84e750a1b9d509b..9dd1a6ad9ef2363 100644
--- a/libc/test/src/__support/OSUtil/linux/x86_64/syscall_test.cpp
+++ b/libc/test/src/__support/OSUtil/linux/x86_64/syscall_test.cpp
@@ -14,32 +14,34 @@ TEST(LlvmLibcX86_64_SyscallTest, APITest) {
// We only do a signature test here. Actual functionality tests are
// done by the unit tests of the syscall wrappers like mmap.
- using __llvm_libc::cpp::function;
+ using LIBC_NAMESPACE::cpp::function;
function<long(long)> f(
- [](long n) { return __llvm_libc::syscall_impl<long>(n); });
- function<long(long, long)> f1(
- [](long n, long a1) { return __llvm_libc::syscall_impl<long>(n, a1); });
+ [](long n) { return LIBC_NAMESPACE::syscall_impl<long>(n); });
+ function<long(long, long)> f1([](long n, long a1) {
+ return LIBC_NAMESPACE::syscall_impl<long>(n, a1);
+ });
function<long(long, long, long)> f2([](long n, long a1, long a2) {
- return __llvm_libc::syscall_impl<long>(n, a1, a2);
+ return LIBC_NAMESPACE::syscall_impl<long>(n, a1, a2);
});
function<long(long, long, long, long)> f3(
[](long n, long a1, long a2, long a3) {
- return __llvm_libc::syscall_impl<long>(n, a1, a2, a3);
+ return LIBC_NAMESPACE::syscall_impl<long>(n, a1, a2, a3);
});
function<long(long, long, long, long, long)> f4(
[](long n, long a1, long a2, long a3, long a4) {
- return __llvm_libc::syscall_impl<long>(n, a1, a2, a3, a4);
+ return LIBC_NAMESPACE::syscall_impl<long>(n, a1, a2, a3, a4);
});
function<long(long, long, long, long, long, long)> f5(
[](long n, long a1, long a2, long a3, long a4, long a5) {
- return __llvm_libc::syscall_impl<long>(n, a1, a2, a3, a4, a5);
+ return LIBC_NAMESPACE::syscall_impl<long>(n, a1, a2, a3, a4, a5);
});
function<long(long, long, long, long, long, long, long)> f6(
[](long n, long a1, long a2, long a3, long a4, long a5, long a6) {
- return __llvm_libc::syscall_impl<long>(n, a1, a2, a3, a4, a5, a6);
+ return LIBC_NAMESPACE::syscall_impl<long>(n, a1, a2, a3, a4, a5, a6);
});
- function<long(long, void *)> not_long_type(
- [](long n, void *a1) { return __llvm_libc::syscall_impl<long>(n, a1); });
+ function<long(long, void *)> not_long_type([](long n, void *a1) {
+ return LIBC_NAMESPACE::syscall_impl<long>(n, a1);
+ });
}
diff --git a/libc/test/src/__support/RPC/rpc_smoke_test.cpp b/libc/test/src/__support/RPC/rpc_smoke_test.cpp
index 587ca8eb111f237..730b1e2e3cc2933 100644
--- a/libc/test/src/__support/RPC/rpc_smoke_test.cpp
+++ b/libc/test/src/__support/RPC/rpc_smoke_test.cpp
@@ -17,8 +17,8 @@ struct Packet {
uint64_t unused;
};
-using ProcAType = __llvm_libc::rpc::Process<false, Packet>;
-using ProcBType = __llvm_libc::rpc::Process<true, Packet>;
+using ProcAType = LIBC_NAMESPACE::rpc::Process<false, Packet>;
+using ProcBType = LIBC_NAMESPACE::rpc::Process<true, Packet>;
static_assert(ProcAType::inbox_offset(port_count) ==
ProcBType::outbox_offset(port_count));
diff --git a/libc/test/src/__support/arg_list_test.cpp b/libc/test/src/__support/arg_list_test.cpp
index f266ccfdd1ff684..1876cf7f70b4b81 100644
--- a/libc/test/src/__support/arg_list_test.cpp
+++ b/libc/test/src/__support/arg_list_test.cpp
@@ -13,7 +13,7 @@
int get_nth_int(int n, ...) {
va_list vlist;
va_start(vlist, n);
- __llvm_libc::internal::ArgList v(vlist);
+ LIBC_NAMESPACE::internal::ArgList v(vlist);
va_end(vlist);
for (int i = 0; i < n; ++i) {
@@ -29,10 +29,10 @@ TEST(LlvmLibcArgListTest, BasicUsage) {
int sum_two_nums(int first, int second, ...) {
va_list vlist;
va_start(vlist, second);
- __llvm_libc::internal::ArgList v1(vlist);
+ LIBC_NAMESPACE::internal::ArgList v1(vlist);
va_end(vlist);
- __llvm_libc::internal::ArgList v2 = v1;
+ LIBC_NAMESPACE::internal::ArgList v2 = v1;
int first_val;
for (int i = 0; i < first; ++i) {
@@ -60,7 +60,7 @@ TEST(LlvmLibcArgListTest, CopyConstructor) {
long int check_primitives(int first, ...) {
va_list vlist;
va_start(vlist, first);
- __llvm_libc::internal::ArgList args(vlist);
+ LIBC_NAMESPACE::internal::ArgList args(vlist);
va_end(vlist);
long int count = 0;
@@ -106,7 +106,7 @@ struct S {
long int check_struct_type(int first, ...) {
va_list vlist;
va_start(vlist, first);
- __llvm_libc::internal::ArgList args(vlist);
+ LIBC_NAMESPACE::internal::ArgList args(vlist);
va_end(vlist);
S s = args.next_var<S>();
@@ -130,7 +130,7 @@ using int4 = int __attribute__((ext_vector_type(4)));
int check_vector_type(int first, ...) {
va_list vlist;
va_start(vlist, first);
- __llvm_libc::internal::ArgList args(vlist);
+ LIBC_NAMESPACE::internal::ArgList args(vlist);
va_end(vlist);
int1 v1 = args.next_var<int1>();
diff --git a/libc/test/src/__support/blockstore_test.cpp b/libc/test/src/__support/blockstore_test.cpp
index 10277af49116d6e..f62857275fe4c90 100644
--- a/libc/test/src/__support/blockstore_test.cpp
+++ b/libc/test/src/__support/blockstore_test.cpp
@@ -15,11 +15,11 @@ struct Element {
unsigned c;
};
-class LlvmLibcBlockStoreTest : public __llvm_libc::testing::Test {
+class LlvmLibcBlockStoreTest : public LIBC_NAMESPACE::testing::Test {
public:
template <size_t BLOCK_SIZE, size_t ELEMENT_COUNT, bool REVERSE>
void populate_and_iterate() {
- __llvm_libc::cpp::BlockStore<Element, BLOCK_SIZE, REVERSE> block_store;
+ LIBC_NAMESPACE::cpp::BlockStore<Element, BLOCK_SIZE, REVERSE> block_store;
for (int i = 0; i < int(ELEMENT_COUNT); ++i)
ASSERT_TRUE(block_store.push_back({i, 2 * i, 3 * unsigned(i)}));
auto end = block_store.end();
@@ -38,12 +38,12 @@ class LlvmLibcBlockStoreTest : public __llvm_libc::testing::Test {
}
}
ASSERT_EQ(i, int(ELEMENT_COUNT));
- __llvm_libc::cpp::BlockStore<Element, BLOCK_SIZE, REVERSE>::destroy(
+ LIBC_NAMESPACE::cpp::BlockStore<Element, BLOCK_SIZE, REVERSE>::destroy(
&block_store);
}
template <bool REVERSE> void back_test() {
- using __llvm_libc::cpp::BlockStore;
+ using LIBC_NAMESPACE::cpp::BlockStore;
BlockStore<int, 4, REVERSE> block_store;
for (int i = 0; i < 20; i++)
ASSERT_TRUE(block_store.push_back(i));
@@ -53,7 +53,7 @@ class LlvmLibcBlockStoreTest : public __llvm_libc::testing::Test {
}
template <bool REVERSE> void empty_test() {
- using __llvm_libc::cpp::BlockStore;
+ using LIBC_NAMESPACE::cpp::BlockStore;
BlockStore<int, 2, REVERSE> block_store;
ASSERT_TRUE(block_store.empty());
diff --git a/libc/test/src/__support/char_vector_test.cpp b/libc/test/src/__support/char_vector_test.cpp
index 3d60092b504ef43..ea41d534e64cc6a 100644
--- a/libc/test/src/__support/char_vector_test.cpp
+++ b/libc/test/src/__support/char_vector_test.cpp
@@ -9,7 +9,7 @@
#include "src/__support/char_vector.h"
#include "test/UnitTest/Test.h"
-using __llvm_libc::CharVector;
+using LIBC_NAMESPACE::CharVector;
TEST(LlvmLibcCharVectorTest, InitializeCheck) {
CharVector v;
diff --git a/libc/test/src/__support/endian_test.cpp b/libc/test/src/__support/endian_test.cpp
index 42296a68240207b..4d95c03cf1398d5 100644
--- a/libc/test/src/__support/endian_test.cpp
+++ b/libc/test/src/__support/endian_test.cpp
@@ -9,7 +9,7 @@
#include "src/__support/endian.h"
#include "test/UnitTest/Test.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
struct LlvmLibcEndian : testing::Test {
template <typename T> void check(const T original, const T swapped) {
@@ -52,4 +52,4 @@ TEST_F(LlvmLibcEndian, uint64_t) {
check(original, swapped);
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/test/src/__support/fixedvector_test.cpp b/libc/test/src/__support/fixedvector_test.cpp
index bc1ee3819c4793a..a70ebfabed22700 100644
--- a/libc/test/src/__support/fixedvector_test.cpp
+++ b/libc/test/src/__support/fixedvector_test.cpp
@@ -10,7 +10,7 @@
#include "test/UnitTest/Test.h"
TEST(LlvmLibcFixedVectorTest, PushAndPop) {
- __llvm_libc::FixedVector<int, 20> fixed_vector;
+ LIBC_NAMESPACE::FixedVector<int, 20> fixed_vector;
ASSERT_TRUE(fixed_vector.empty());
for (int i = 0; i < 20; i++)
ASSERT_TRUE(fixed_vector.push_back(i));
@@ -25,7 +25,7 @@ TEST(LlvmLibcFixedVectorTest, PushAndPop) {
}
TEST(LlvmLibcFixedVectorTest, Reset) {
- __llvm_libc::FixedVector<int, 20> fixed_vector;
+ LIBC_NAMESPACE::FixedVector<int, 20> fixed_vector;
ASSERT_TRUE(fixed_vector.empty());
for (int i = 0; i < 20; i++)
ASSERT_TRUE(fixed_vector.push_back(i));
@@ -35,11 +35,11 @@ TEST(LlvmLibcFixedVectorTest, Reset) {
}
TEST(LlvmLibcFixedVectorTest, Destroy) {
- __llvm_libc::FixedVector<int, 20> fixed_vector;
+ LIBC_NAMESPACE::FixedVector<int, 20> fixed_vector;
ASSERT_TRUE(fixed_vector.empty());
for (int i = 0; i < 20; i++)
ASSERT_TRUE(fixed_vector.push_back(i));
ASSERT_FALSE(fixed_vector.empty());
- __llvm_libc::FixedVector<int, 20>::destroy(&fixed_vector);
+ LIBC_NAMESPACE::FixedVector<int, 20>::destroy(&fixed_vector);
ASSERT_TRUE(fixed_vector.empty());
}
diff --git a/libc/test/src/__support/high_precision_decimal_test.cpp b/libc/test/src/__support/high_precision_decimal_test.cpp
index abe4a604b4a3909..a9c039e45774e9b 100644
--- a/libc/test/src/__support/high_precision_decimal_test.cpp
+++ b/libc/test/src/__support/high_precision_decimal_test.cpp
@@ -12,8 +12,8 @@
#include "test/UnitTest/Test.h"
TEST(LlvmLibcHighPrecisionDecimalTest, BasicInit) {
- __llvm_libc::internal::HighPrecisionDecimal hpd =
- __llvm_libc::internal::HighPrecisionDecimal("1.2345");
+ LIBC_NAMESPACE::internal::HighPrecisionDecimal hpd =
+ LIBC_NAMESPACE::internal::HighPrecisionDecimal("1.2345");
uint8_t *digits = hpd.get_digits();
EXPECT_EQ(digits[0], uint8_t(1));
@@ -26,8 +26,8 @@ TEST(LlvmLibcHighPrecisionDecimalTest, BasicInit) {
}
TEST(LlvmLibcHighPrecisionDecimalTest, BasicShift) {
- __llvm_libc::internal::HighPrecisionDecimal hpd =
- __llvm_libc::internal::HighPrecisionDecimal("1");
+ LIBC_NAMESPACE::internal::HighPrecisionDecimal hpd =
+ LIBC_NAMESPACE::internal::HighPrecisionDecimal("1");
uint8_t *digits = hpd.get_digits();
hpd.shift(1); // shift left 1, equal to multiplying by 2.
@@ -38,8 +38,8 @@ TEST(LlvmLibcHighPrecisionDecimalTest, BasicShift) {
}
TEST(LlvmLibcHighPrecisionDecimalTest, ShouldRoundup) {
- __llvm_libc::internal::HighPrecisionDecimal hpd =
- __llvm_libc::internal::HighPrecisionDecimal(".5");
+ LIBC_NAMESPACE::internal::HighPrecisionDecimal hpd =
+ LIBC_NAMESPACE::internal::HighPrecisionDecimal(".5");
uint8_t *digits = hpd.get_digits();
EXPECT_EQ(digits[0], uint8_t(5));
@@ -49,8 +49,8 @@ TEST(LlvmLibcHighPrecisionDecimalTest, ShouldRoundup) {
}
TEST(LlvmLibcHighPrecisionDecimalTest, SmallShift) {
- __llvm_libc::internal::HighPrecisionDecimal hpd =
- __llvm_libc::internal::HighPrecisionDecimal("1.2345");
+ LIBC_NAMESPACE::internal::HighPrecisionDecimal hpd =
+ LIBC_NAMESPACE::internal::HighPrecisionDecimal("1.2345");
uint8_t *digits = hpd.get_digits();
hpd.shift(-1); // shift right one, equal to dividing by 2
@@ -98,8 +98,8 @@ TEST(LlvmLibcHighPrecisionDecimalTest, SmallShift) {
}
TEST(LlvmLibcHighPrecisionDecimalTest, MediumShift) {
- __llvm_libc::internal::HighPrecisionDecimal hpd =
- __llvm_libc::internal::HighPrecisionDecimal(".299792458");
+ LIBC_NAMESPACE::internal::HighPrecisionDecimal hpd =
+ LIBC_NAMESPACE::internal::HighPrecisionDecimal(".299792458");
uint8_t *digits = hpd.get_digits();
hpd.shift(-3); // shift right three, equal to dividing by 8
@@ -135,8 +135,8 @@ TEST(LlvmLibcHighPrecisionDecimalTest, MediumShift) {
}
TEST(LlvmLibcHighPrecisionDecimalTest, BigShift) {
- __llvm_libc::internal::HighPrecisionDecimal hpd =
- __llvm_libc::internal::HighPrecisionDecimal(".299792458");
+ LIBC_NAMESPACE::internal::HighPrecisionDecimal hpd =
+ LIBC_NAMESPACE::internal::HighPrecisionDecimal(".299792458");
uint8_t *digits = hpd.get_digits();
hpd.shift(-29); // shift right 29, equal to dividing by 536,870,912
@@ -190,8 +190,8 @@ TEST(LlvmLibcHighPrecisionDecimalTest, BigShift) {
}
TEST(LlvmLibcHighPrecisionDecimalTest, BigShiftInSteps) {
- __llvm_libc::internal::HighPrecisionDecimal hpd =
- __llvm_libc::internal::HighPrecisionDecimal("1");
+ LIBC_NAMESPACE::internal::HighPrecisionDecimal hpd =
+ LIBC_NAMESPACE::internal::HighPrecisionDecimal("1");
uint8_t *digits = hpd.get_digits();
hpd.shift(60); // shift left 60, equal to multiplying by
@@ -287,8 +287,8 @@ TEST(LlvmLibcHighPrecisionDecimalTest, BigShiftInSteps) {
}
TEST(LlvmLibcHighPrecisionDecimalTest, VeryBigShift) {
- __llvm_libc::internal::HighPrecisionDecimal hpd =
- __llvm_libc::internal::HighPrecisionDecimal("1");
+ LIBC_NAMESPACE::internal::HighPrecisionDecimal hpd =
+ LIBC_NAMESPACE::internal::HighPrecisionDecimal("1");
uint8_t *digits = hpd.get_digits();
hpd.shift(100); // shift left 100, equal to multiplying by
@@ -340,8 +340,8 @@ TEST(LlvmLibcHighPrecisionDecimalTest, VeryBigShift) {
}
TEST(LlvmLibcHighPrecisionDecimalTest, RoundingTest) {
- __llvm_libc::internal::HighPrecisionDecimal hpd =
- __llvm_libc::internal::HighPrecisionDecimal("1.2345");
+ LIBC_NAMESPACE::internal::HighPrecisionDecimal hpd =
+ LIBC_NAMESPACE::internal::HighPrecisionDecimal("1.2345");
EXPECT_EQ(hpd.round_to_integer_type<uint32_t>(), uint32_t(1));
EXPECT_EQ(hpd.round_to_integer_type<uint64_t>(), uint64_t(1));
@@ -360,7 +360,7 @@ TEST(LlvmLibcHighPrecisionDecimalTest, RoundingTest) {
EXPECT_EQ(hpd.round_to_integer_type<UInt128>(), UInt128(5));
// 2.5 is right between two integers, so we round to even (2)
- hpd = __llvm_libc::internal::HighPrecisionDecimal("2.5");
+ hpd = LIBC_NAMESPACE::internal::HighPrecisionDecimal("2.5");
EXPECT_EQ(hpd.round_to_integer_type<uint32_t>(), uint32_t(2));
EXPECT_EQ(hpd.round_to_integer_type<uint64_t>(), uint64_t(2));
@@ -378,13 +378,13 @@ TEST(LlvmLibcHighPrecisionDecimalTest, RoundingTest) {
// handled, so int types that are too small are ignored for this test.)
// 1099511627776 = 2^40
- hpd = __llvm_libc::internal::HighPrecisionDecimal("1099511627776");
+ hpd = LIBC_NAMESPACE::internal::HighPrecisionDecimal("1099511627776");
EXPECT_EQ(hpd.round_to_integer_type<uint64_t>(), uint64_t(1099511627776));
EXPECT_EQ(hpd.round_to_integer_type<UInt128>(), UInt128(1099511627776));
// 1267650600228229401496703205376 = 2^100
- hpd = __llvm_libc::internal::HighPrecisionDecimal(
+ hpd = LIBC_NAMESPACE::internal::HighPrecisionDecimal(
"1267650600228229401496703205376");
UInt128 result = UInt128(1) << 100;
@@ -393,15 +393,15 @@ TEST(LlvmLibcHighPrecisionDecimalTest, RoundingTest) {
}
TEST(LlvmLibcHighPrecisionDecimalTest, BigExpTest) {
- __llvm_libc::internal::HighPrecisionDecimal big_hpd =
- __llvm_libc::internal::HighPrecisionDecimal("1e123456789");
+ LIBC_NAMESPACE::internal::HighPrecisionDecimal big_hpd =
+ LIBC_NAMESPACE::internal::HighPrecisionDecimal("1e123456789");
// We need to add one to handle the digit before the decimal point in our
// number.
EXPECT_EQ(big_hpd.get_decimal_point(), 123456789 + 1);
- __llvm_libc::internal::HighPrecisionDecimal big_negative_hpd =
- __llvm_libc::internal::HighPrecisionDecimal("1e-123456789");
+ LIBC_NAMESPACE::internal::HighPrecisionDecimal big_negative_hpd =
+ LIBC_NAMESPACE::internal::HighPrecisionDecimal("1e-123456789");
// Same, but since the number is negative the net result is -123456788
EXPECT_EQ(big_negative_hpd.get_decimal_point(), -123456789 + 1);
diff --git a/libc/test/src/__support/integer_to_string_test.cpp b/libc/test/src/__support/integer_to_string_test.cpp
index 991582e896d2fed..c8913bf461bb360 100644
--- a/libc/test/src/__support/integer_to_string_test.cpp
+++ b/libc/test/src/__support/integer_to_string_test.cpp
@@ -16,14 +16,14 @@
#include "limits.h"
-using __llvm_libc::IntegerToString;
-using __llvm_libc::cpp::span;
-using __llvm_libc::cpp::string_view;
-using __llvm_libc::radix::Bin;
-using __llvm_libc::radix::Custom;
-using __llvm_libc::radix::Dec;
-using __llvm_libc::radix::Hex;
-using __llvm_libc::radix::Oct;
+using LIBC_NAMESPACE::IntegerToString;
+using LIBC_NAMESPACE::cpp::span;
+using LIBC_NAMESPACE::cpp::string_view;
+using LIBC_NAMESPACE::radix::Bin;
+using LIBC_NAMESPACE::radix::Custom;
+using LIBC_NAMESPACE::radix::Dec;
+using LIBC_NAMESPACE::radix::Hex;
+using LIBC_NAMESPACE::radix::Oct;
#define EXPECT(type, value, string_value) \
{ \
@@ -225,7 +225,7 @@ TEST(LlvmLibcIntegerToStringTest, UINT64_Base_36) {
}
TEST(LlvmLibcIntegerToStringTest, UINT256_Base_16) {
- using UInt256 = __llvm_libc::cpp::UInt<256>;
+ using UInt256 = LIBC_NAMESPACE::cpp::UInt<256>;
using type = IntegerToString<UInt256, Hex::WithWidth<64>>;
EXPECT(type, static_cast<UInt256>(0),
"0000000000000000000000000000000000000000000000000000000000000000");
diff --git a/libc/test/src/__support/str_to_float_test.cpp b/libc/test/src/__support/str_to_float_test.cpp
index 4ebdb33549ef621..ae729418ebe3639 100644
--- a/libc/test/src/__support/str_to_float_test.cpp
+++ b/libc/test/src/__support/str_to_float_test.cpp
@@ -13,20 +13,20 @@
#include "test/UnitTest/Test.h"
-class LlvmLibcStrToFloatTest : public __llvm_libc::testing::Test {
+class LlvmLibcStrToFloatTest : public LIBC_NAMESPACE::testing::Test {
public:
template <class T>
void clinger_fast_path_test(
- const typename __llvm_libc::fputil::FPBits<T>::UIntType inputMantissa,
+ const typename LIBC_NAMESPACE::fputil::FPBits<T>::UIntType inputMantissa,
const int32_t inputExp10,
- const typename __llvm_libc::fputil::FPBits<T>::UIntType
+ const typename LIBC_NAMESPACE::fputil::FPBits<T>::UIntType
expectedOutputMantissa,
const uint32_t expectedOutputExp2) {
- typename __llvm_libc::fputil::FPBits<T>::UIntType actual_output_mantissa =
- 0;
+ typename LIBC_NAMESPACE::fputil::FPBits<T>::UIntType
+ actual_output_mantissa = 0;
uint32_t actual_output_exp2 = 0;
- auto result = __llvm_libc::internal::clinger_fast_path<T>(
+ auto result = LIBC_NAMESPACE::internal::clinger_fast_path<T>(
{inputMantissa, inputExp10});
ASSERT_TRUE(result.has_value());
@@ -40,26 +40,26 @@ class LlvmLibcStrToFloatTest : public __llvm_libc::testing::Test {
template <class T>
void clinger_fast_path_fails_test(
- const typename __llvm_libc::fputil::FPBits<T>::UIntType inputMantissa,
+ const typename LIBC_NAMESPACE::fputil::FPBits<T>::UIntType inputMantissa,
const int32_t inputExp10) {
- ASSERT_FALSE(
- __llvm_libc::internal::clinger_fast_path<T>({inputMantissa, inputExp10})
- .has_value());
+ ASSERT_FALSE(LIBC_NAMESPACE::internal::clinger_fast_path<T>(
+ {inputMantissa, inputExp10})
+ .has_value());
}
template <class T>
void eisel_lemire_test(
- const typename __llvm_libc::fputil::FPBits<T>::UIntType inputMantissa,
+ const typename LIBC_NAMESPACE::fputil::FPBits<T>::UIntType inputMantissa,
const int32_t inputExp10,
- const typename __llvm_libc::fputil::FPBits<T>::UIntType
+ const typename LIBC_NAMESPACE::fputil::FPBits<T>::UIntType
expectedOutputMantissa,
const uint32_t expectedOutputExp2) {
- typename __llvm_libc::fputil::FPBits<T>::UIntType actual_output_mantissa =
- 0;
+ typename LIBC_NAMESPACE::fputil::FPBits<T>::UIntType
+ actual_output_mantissa = 0;
uint32_t actual_output_exp2 = 0;
auto result =
- __llvm_libc::internal::eisel_lemire<T>({inputMantissa, inputExp10});
+ LIBC_NAMESPACE::internal::eisel_lemire<T>({inputMantissa, inputExp10});
ASSERT_TRUE(result.has_value());
@@ -73,15 +73,16 @@ class LlvmLibcStrToFloatTest : public __llvm_libc::testing::Test {
template <class T>
void simple_decimal_conversion_test(
const char *__restrict numStart,
- const typename __llvm_libc::fputil::FPBits<T>::UIntType
+ const typename LIBC_NAMESPACE::fputil::FPBits<T>::UIntType
expectedOutputMantissa,
const uint32_t expectedOutputExp2, const int expectedErrno = 0) {
- typename __llvm_libc::fputil::FPBits<T>::UIntType actual_output_mantissa =
- 0;
+ typename LIBC_NAMESPACE::fputil::FPBits<T>::UIntType
+ actual_output_mantissa = 0;
uint32_t actual_output_exp2 = 0;
libc_errno = 0;
- auto result = __llvm_libc::internal::simple_decimal_conversion<T>(numStart);
+ auto result =
+ LIBC_NAMESPACE::internal::simple_decimal_conversion<T>(numStart);
actual_output_mantissa = result.num.mantissa;
actual_output_exp2 = result.num.exponent;
@@ -95,39 +96,40 @@ class LlvmLibcStrToFloatTest : public __llvm_libc::testing::Test {
TEST(LlvmLibcStrToFloatTest, LeadingZeroes) {
uint64_t test_num64 = 1;
uint32_t num_of_zeroes = 63;
- EXPECT_EQ(__llvm_libc::internal::leading_zeroes<uint64_t>(0), 64u);
+ EXPECT_EQ(LIBC_NAMESPACE::internal::leading_zeroes<uint64_t>(0), 64u);
for (; num_of_zeroes < 64; test_num64 <<= 1, num_of_zeroes--) {
- EXPECT_EQ(__llvm_libc::internal::leading_zeroes<uint64_t>(test_num64),
+ EXPECT_EQ(LIBC_NAMESPACE::internal::leading_zeroes<uint64_t>(test_num64),
num_of_zeroes);
}
test_num64 = 3;
num_of_zeroes = 62;
for (; num_of_zeroes > 63; test_num64 <<= 1, num_of_zeroes--) {
- EXPECT_EQ(__llvm_libc::internal::leading_zeroes<uint64_t>(test_num64),
+ EXPECT_EQ(LIBC_NAMESPACE::internal::leading_zeroes<uint64_t>(test_num64),
num_of_zeroes);
}
- EXPECT_EQ(__llvm_libc::internal::leading_zeroes<uint64_t>(0xffffffffffffffff),
- 0u);
+ EXPECT_EQ(
+ LIBC_NAMESPACE::internal::leading_zeroes<uint64_t>(0xffffffffffffffff),
+ 0u);
test_num64 = 1;
num_of_zeroes = 63;
for (; num_of_zeroes > 63;
test_num64 = (test_num64 << 1) + 1, num_of_zeroes--) {
- EXPECT_EQ(__llvm_libc::internal::leading_zeroes<uint64_t>(test_num64),
+ EXPECT_EQ(LIBC_NAMESPACE::internal::leading_zeroes<uint64_t>(test_num64),
num_of_zeroes);
}
uint64_t test_num32 = 1;
num_of_zeroes = 31;
- EXPECT_EQ(__llvm_libc::internal::leading_zeroes<uint32_t>(0), 32u);
+ EXPECT_EQ(LIBC_NAMESPACE::internal::leading_zeroes<uint32_t>(0), 32u);
for (; num_of_zeroes < 32; test_num32 <<= 1, num_of_zeroes--) {
- EXPECT_EQ(__llvm_libc::internal::leading_zeroes<uint32_t>(test_num32),
+ EXPECT_EQ(LIBC_NAMESPACE::internal::leading_zeroes<uint32_t>(test_num32),
num_of_zeroes);
}
- EXPECT_EQ(__llvm_libc::internal::leading_zeroes<uint32_t>(0xffffffff), 0u);
+ EXPECT_EQ(LIBC_NAMESPACE::internal::leading_zeroes<uint32_t>(0xffffffff), 0u);
}
TEST_F(LlvmLibcStrToFloatTest, ClingerFastPathFloat64Simple) {
@@ -188,11 +190,11 @@ TEST_F(LlvmLibcStrToFloatTest, EiselLemireFallbackStates) {
// from both of its closest floating point approximations
// (12345678901234548736 and 12345678901234550784)
ASSERT_FALSE(
- __llvm_libc::internal::eisel_lemire<double>({12345678901234549760u, 0})
+ LIBC_NAMESPACE::internal::eisel_lemire<double>({12345678901234549760u, 0})
.has_value());
ASSERT_FALSE(
- __llvm_libc::internal::eisel_lemire<float>({20040229, 0}).has_value());
+ LIBC_NAMESPACE::internal::eisel_lemire<float>({20040229, 0}).has_value());
}
TEST_F(LlvmLibcStrToFloatTest, SimpleDecimalConversion64BasicWholeNumbers) {
@@ -252,8 +254,9 @@ TEST(LlvmLibcStrToFloatTest, SimpleDecimalConversionExtraTypes) {
uint32_t output_exp2 = 0;
libc_errno = 0;
- auto float_result = __llvm_libc::internal::simple_decimal_conversion<float>(
- "123456789012345678900");
+ auto float_result =
+ LIBC_NAMESPACE::internal::simple_decimal_conversion<float>(
+ "123456789012345678900");
float_output_mantissa = float_result.num.mantissa;
output_exp2 = float_result.num.exponent;
EXPECT_EQ(float_output_mantissa, uint32_t(0xd629d4));
@@ -264,8 +267,9 @@ TEST(LlvmLibcStrToFloatTest, SimpleDecimalConversionExtraTypes) {
output_exp2 = 0;
libc_errno = 0;
- auto double_result = __llvm_libc::internal::simple_decimal_conversion<double>(
- "123456789012345678900");
+ auto double_result =
+ LIBC_NAMESPACE::internal::simple_decimal_conversion<double>(
+ "123456789012345678900");
double_output_mantissa = double_result.num.mantissa;
output_exp2 = double_result.num.exponent;
@@ -314,16 +318,16 @@ TEST_F(LlvmLibcStrToFloatTest, EiselLemireFloat80TableLimits) {
TEST_F(LlvmLibcStrToFloatTest, EiselLemireFloat80Fallback) {
// This number is halfway between two possible results, and the algorithm
// can't determine which is correct.
- ASSERT_FALSE(__llvm_libc::internal::eisel_lemire<long double>(
+ ASSERT_FALSE(LIBC_NAMESPACE::internal::eisel_lemire<long double>(
{12345678901234567890u, 1})
.has_value());
// These numbers' exponents are out of range for the current powers of ten
// table.
- ASSERT_FALSE(
- __llvm_libc::internal::eisel_lemire<long double>({1, 1000}).has_value());
- ASSERT_FALSE(
- __llvm_libc::internal::eisel_lemire<long double>({1, -1000}).has_value());
+ ASSERT_FALSE(LIBC_NAMESPACE::internal::eisel_lemire<long double>({1, 1000})
+ .has_value());
+ ASSERT_FALSE(LIBC_NAMESPACE::internal::eisel_lemire<long double>({1, -1000})
+ .has_value());
}
#else // Quad precision long double
TEST_F(LlvmLibcStrToFloatTest, EiselLemireFloat128Simple) {
@@ -348,7 +352,7 @@ TEST_F(LlvmLibcStrToFloatTest, EiselLemireFloat128LongerMantissa) {
TEST_F(LlvmLibcStrToFloatTest, EiselLemireFloat128Fallback) {
ASSERT_FALSE(
- __llvm_libc::internal::eisel_lemire<long double>(
+ LIBC_NAMESPACE::internal::eisel_lemire<long double>(
{(UInt128(0x5ce0e9a56015fec5) << 64) + UInt128(0xaadfa328ae39b333),
1})
.has_value());
diff --git a/libc/test/src/__support/uint_test.cpp b/libc/test/src/__support/uint_test.cpp
index 3fe9b26bc425603..971bac55bd9d3f1 100644
--- a/libc/test/src/__support/uint_test.cpp
+++ b/libc/test/src/__support/uint_test.cpp
@@ -11,18 +11,18 @@
#include "test/UnitTest/Test.h"
-// We want to test __llvm_libc::cpp::UInt<128> explicitly. So, for convenience,
-// we use a sugar which does not conflict with the UInt128 type which can
-// resolve to __uint128_t if the platform has it.
-using LL_UInt128 = __llvm_libc::cpp::UInt<128>;
-using LL_UInt192 = __llvm_libc::cpp::UInt<192>;
-using LL_UInt256 = __llvm_libc::cpp::UInt<256>;
-using LL_UInt320 = __llvm_libc::cpp::UInt<320>;
-using LL_UInt512 = __llvm_libc::cpp::UInt<512>;
-using LL_UInt1024 = __llvm_libc::cpp::UInt<1024>;
-
-using LL_Int128 = __llvm_libc::cpp::Int<128>;
-using LL_Int192 = __llvm_libc::cpp::Int<192>;
+// We want to test LIBC_NAMESPACE::cpp::UInt<128> explicitly. So, for
+// convenience, we use a sugar which does not conflict with the UInt128 type
+// which can resolve to __uint128_t if the platform has it.
+using LL_UInt128 = LIBC_NAMESPACE::cpp::UInt<128>;
+using LL_UInt192 = LIBC_NAMESPACE::cpp::UInt<192>;
+using LL_UInt256 = LIBC_NAMESPACE::cpp::UInt<256>;
+using LL_UInt320 = LIBC_NAMESPACE::cpp::UInt<320>;
+using LL_UInt512 = LIBC_NAMESPACE::cpp::UInt<512>;
+using LL_UInt1024 = LIBC_NAMESPACE::cpp::UInt<1024>;
+
+using LL_Int128 = LIBC_NAMESPACE::cpp::Int<128>;
+using LL_Int192 = LIBC_NAMESPACE::cpp::Int<192>;
TEST(LlvmLibcUIntClassTest, BasicInit) {
LL_UInt128 half_val(12345);
diff --git a/libc/test/src/assert/assert_test.cpp b/libc/test/src/assert/assert_test.cpp
index 8a896494e29f74a..d5d25506053405c 100644
--- a/libc/test/src/assert/assert_test.cpp
+++ b/libc/test/src/assert/assert_test.cpp
@@ -14,7 +14,7 @@ extern "C" int close(int);
TEST(LlvmLibcAssert, Enabled) {
// -1 matches against any signal, which is necessary for now until
- // __llvm_libc::abort() unblocks SIGABRT. Close standard error for the
+ // LIBC_NAMESPACE::abort() unblocks SIGABRT. Close standard error for the
// child process so we don't print the assertion failure message.
EXPECT_DEATH(
[] {
diff --git a/libc/test/src/ctype/isalnum_test.cpp b/libc/test/src/ctype/isalnum_test.cpp
index d44263a6ea7d15d..b71d36111d72560 100644
--- a/libc/test/src/ctype/isalnum_test.cpp
+++ b/libc/test/src/ctype/isalnum_test.cpp
@@ -16,8 +16,8 @@ TEST(LlvmLibcIsAlNum, DefaultLocale) {
for (int c = -255; c < 255; ++c) {
if (('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z') ||
('0' <= c && c <= '9'))
- EXPECT_NE(__llvm_libc::isalnum(c), 0);
+ EXPECT_NE(LIBC_NAMESPACE::isalnum(c), 0);
else
- EXPECT_EQ(__llvm_libc::isalnum(c), 0);
+ EXPECT_EQ(LIBC_NAMESPACE::isalnum(c), 0);
}
}
diff --git a/libc/test/src/ctype/isalpha_test.cpp b/libc/test/src/ctype/isalpha_test.cpp
index 916aae3ecd05e55..10cdb962ee2ee5f 100644
--- a/libc/test/src/ctype/isalpha_test.cpp
+++ b/libc/test/src/ctype/isalpha_test.cpp
@@ -15,8 +15,8 @@ TEST(LlvmLibcIsAlpha, DefaultLocale) {
// non-zero integer and everything else returns zero.
for (int ch = -255; ch < 255; ++ch) {
if (('a' <= ch && ch <= 'z') || ('A' <= ch && ch <= 'Z'))
- EXPECT_NE(__llvm_libc::isalpha(ch), 0);
+ EXPECT_NE(LIBC_NAMESPACE::isalpha(ch), 0);
else
- EXPECT_EQ(__llvm_libc::isalpha(ch), 0);
+ EXPECT_EQ(LIBC_NAMESPACE::isalpha(ch), 0);
}
}
diff --git a/libc/test/src/ctype/isascii_test.cpp b/libc/test/src/ctype/isascii_test.cpp
index 80b0b1c162675fc..646756eb0861b59 100644
--- a/libc/test/src/ctype/isascii_test.cpp
+++ b/libc/test/src/ctype/isascii_test.cpp
@@ -16,8 +16,8 @@ TEST(LlvmLibcIsAscii, DefaultLocale) {
// return a non-zero integer and everything else returns zero.
for (int ch = -255; ch < 255; ++ch) {
if (0 <= ch && ch <= 0x7f)
- EXPECT_NE(__llvm_libc::isascii(ch), 0);
+ EXPECT_NE(LIBC_NAMESPACE::isascii(ch), 0);
else
- EXPECT_EQ(__llvm_libc::isascii(ch), 0);
+ EXPECT_EQ(LIBC_NAMESPACE::isascii(ch), 0);
}
}
diff --git a/libc/test/src/ctype/isblank_test.cpp b/libc/test/src/ctype/isblank_test.cpp
index f34e0cb37be97b7..97041fbc8fd8637 100644
--- a/libc/test/src/ctype/isblank_test.cpp
+++ b/libc/test/src/ctype/isblank_test.cpp
@@ -14,8 +14,8 @@ TEST(LlvmLibcIsBlank, DefaultLocale) {
// return a non-zero integer and everything else returns zero.
for (int ch = -255; ch < 255; ++ch) {
if (ch == ' ' || ch == '\t')
- EXPECT_NE(__llvm_libc::isblank(ch), 0);
+ EXPECT_NE(LIBC_NAMESPACE::isblank(ch), 0);
else
- EXPECT_EQ(__llvm_libc::isblank(ch), 0);
+ EXPECT_EQ(LIBC_NAMESPACE::isblank(ch), 0);
}
}
diff --git a/libc/test/src/ctype/iscntrl_test.cpp b/libc/test/src/ctype/iscntrl_test.cpp
index 89b0c9a1490791b..f8a0804cefbd2f8 100644
--- a/libc/test/src/ctype/iscntrl_test.cpp
+++ b/libc/test/src/ctype/iscntrl_test.cpp
@@ -14,8 +14,8 @@ TEST(LlvmLibcIsCntrl, DefaultLocale) {
// return a non-zero integer, all others return zero.
for (int ch = -255; ch < 255; ++ch) {
if ((0 <= ch && ch <= 0x1f /*US*/) || ch == 0x7f /*DEL*/)
- EXPECT_NE(__llvm_libc::iscntrl(ch), 0);
+ EXPECT_NE(LIBC_NAMESPACE::iscntrl(ch), 0);
else
- EXPECT_EQ(__llvm_libc::iscntrl(ch), 0);
+ EXPECT_EQ(LIBC_NAMESPACE::iscntrl(ch), 0);
}
}
diff --git a/libc/test/src/ctype/isdigit_test.cpp b/libc/test/src/ctype/isdigit_test.cpp
index fd49475f5bc0c9c..a9f84db3ef7e879 100644
--- a/libc/test/src/ctype/isdigit_test.cpp
+++ b/libc/test/src/ctype/isdigit_test.cpp
@@ -15,8 +15,8 @@ TEST(LlvmLibcIsDigit, DefaultLocale) {
// non-zero integer and everything else returns zero.
for (int ch = -255; ch < 255; ++ch) {
if ('0' <= ch && ch <= '9')
- EXPECT_NE(__llvm_libc::isdigit(ch), 0);
+ EXPECT_NE(LIBC_NAMESPACE::isdigit(ch), 0);
else
- EXPECT_EQ(__llvm_libc::isdigit(ch), 0);
+ EXPECT_EQ(LIBC_NAMESPACE::isdigit(ch), 0);
}
}
diff --git a/libc/test/src/ctype/isgraph_test.cpp b/libc/test/src/ctype/isgraph_test.cpp
index 7c3ed36d9ec9e2c..4d57d677fc4ba5c 100644
--- a/libc/test/src/ctype/isgraph_test.cpp
+++ b/libc/test/src/ctype/isgraph_test.cpp
@@ -14,8 +14,8 @@ TEST(LlvmLibcIsGraph, DefaultLocale) {
// return a non-zero integer, everything else returns zero.
for (int ch = -255; ch < 255; ++ch) {
if ('!' <= ch && ch <= '~') // A-Z, a-z, 0-9, punctuation.
- EXPECT_NE(__llvm_libc::isgraph(ch), 0);
+ EXPECT_NE(LIBC_NAMESPACE::isgraph(ch), 0);
else
- EXPECT_EQ(__llvm_libc::isgraph(ch), 0);
+ EXPECT_EQ(LIBC_NAMESPACE::isgraph(ch), 0);
}
}
diff --git a/libc/test/src/ctype/islower_test.cpp b/libc/test/src/ctype/islower_test.cpp
index c399cc4e6d59adf..ba7caf65b6fd39b 100644
--- a/libc/test/src/ctype/islower_test.cpp
+++ b/libc/test/src/ctype/islower_test.cpp
@@ -14,8 +14,8 @@ TEST(LlvmLibcIsLower, DefaultLocale) {
// return a non-zero integer and everything else returns zero.
for (int ch = -255; ch < 255; ++ch) {
if ('a' <= ch && ch <= 'z')
- EXPECT_NE(__llvm_libc::islower(ch), 0);
+ EXPECT_NE(LIBC_NAMESPACE::islower(ch), 0);
else
- EXPECT_EQ(__llvm_libc::islower(ch), 0);
+ EXPECT_EQ(LIBC_NAMESPACE::islower(ch), 0);
}
}
diff --git a/libc/test/src/ctype/isprint_test.cpp b/libc/test/src/ctype/isprint_test.cpp
index 08963209c1d4cb0..48378c45e1ef986 100644
--- a/libc/test/src/ctype/isprint_test.cpp
+++ b/libc/test/src/ctype/isprint_test.cpp
@@ -12,9 +12,9 @@
TEST(LlvmLibcIsPrint, DefaultLocale) {
for (int ch = -255; ch < 255; ++ch) {
if (' ' <= ch && ch <= '~') { // A-Z, a-z, 0-9, punctuation, space.
- EXPECT_NE(__llvm_libc::isprint(ch), 0);
+ EXPECT_NE(LIBC_NAMESPACE::isprint(ch), 0);
} else {
- EXPECT_EQ(__llvm_libc::isprint(ch), 0);
+ EXPECT_EQ(LIBC_NAMESPACE::isprint(ch), 0);
}
}
}
diff --git a/libc/test/src/ctype/ispunct_test.cpp b/libc/test/src/ctype/ispunct_test.cpp
index 3b82e1958d768a5..ecf78e1eb9b4693 100644
--- a/libc/test/src/ctype/ispunct_test.cpp
+++ b/libc/test/src/ctype/ispunct_test.cpp
@@ -27,8 +27,8 @@ TEST(LlvmLibcIsPunct, DefaultLocale) {
// return a non-zero integer, and everything else returns zero.
for (int ch = -255; ch < 255; ++ch) {
if (is_punctuation_character(ch))
- EXPECT_NE(__llvm_libc::ispunct(ch), 0);
+ EXPECT_NE(LIBC_NAMESPACE::ispunct(ch), 0);
else
- EXPECT_EQ(__llvm_libc::ispunct(ch), 0);
+ EXPECT_EQ(LIBC_NAMESPACE::ispunct(ch), 0);
}
}
diff --git a/libc/test/src/ctype/isspace_test.cpp b/libc/test/src/ctype/isspace_test.cpp
index 9777bb24fc1a7a3..6e11919100ec984 100644
--- a/libc/test/src/ctype/isspace_test.cpp
+++ b/libc/test/src/ctype/isspace_test.cpp
@@ -21,8 +21,8 @@ TEST(LlvmLibcIsSpace, DefaultLocale) {
// 0x20 | space
for (int ch = -255; ch < 255; ++ch) {
if (ch == 0x20 || (0x09 <= ch && ch <= 0x0d))
- EXPECT_NE(__llvm_libc::isspace(ch), 0);
+ EXPECT_NE(LIBC_NAMESPACE::isspace(ch), 0);
else
- EXPECT_EQ(__llvm_libc::isspace(ch), 0);
+ EXPECT_EQ(LIBC_NAMESPACE::isspace(ch), 0);
}
}
diff --git a/libc/test/src/ctype/isupper_test.cpp b/libc/test/src/ctype/isupper_test.cpp
index 5407c763528e725..05b2fd069ef0692 100644
--- a/libc/test/src/ctype/isupper_test.cpp
+++ b/libc/test/src/ctype/isupper_test.cpp
@@ -14,8 +14,8 @@ TEST(LlvmLibcIsUpper, DefaultLocale) {
// return a non-zero integer and everything else returns zero.
for (int ch = -255; ch < 255; ++ch) {
if ('A' <= ch && ch <= 'Z')
- EXPECT_NE(__llvm_libc::isupper(ch), 0);
+ EXPECT_NE(LIBC_NAMESPACE::isupper(ch), 0);
else
- EXPECT_EQ(__llvm_libc::isupper(ch), 0);
+ EXPECT_EQ(LIBC_NAMESPACE::isupper(ch), 0);
}
}
diff --git a/libc/test/src/ctype/isxdigit_test.cpp b/libc/test/src/ctype/isxdigit_test.cpp
index b98d3bde6d064a4..b8f27a968540cbc 100644
--- a/libc/test/src/ctype/isxdigit_test.cpp
+++ b/libc/test/src/ctype/isxdigit_test.cpp
@@ -13,8 +13,8 @@ TEST(LlvmLibcIsXDigit, DefaultLocale) {
for (int ch = -255; ch < 255; ++ch) {
if (('0' <= ch && ch <= '9') || ('a' <= ch && ch <= 'f') ||
('A' <= ch && ch <= 'F'))
- EXPECT_NE(__llvm_libc::isxdigit(ch), 0);
+ EXPECT_NE(LIBC_NAMESPACE::isxdigit(ch), 0);
else
- EXPECT_EQ(__llvm_libc::isxdigit(ch), 0);
+ EXPECT_EQ(LIBC_NAMESPACE::isxdigit(ch), 0);
}
}
diff --git a/libc/test/src/ctype/toascii_test.cpp b/libc/test/src/ctype/toascii_test.cpp
index d5dde8c85d61762..92f807242617728 100644
--- a/libc/test/src/ctype/toascii_test.cpp
+++ b/libc/test/src/ctype/toascii_test.cpp
@@ -17,8 +17,8 @@ TEST(LlvmLibcToAscii, DefaultLocale) {
// mod 128 (which is equivalent to & 0x7f)
for (int ch = -255; ch < 255; ++ch) {
if (0 <= ch && ch <= 0x7f)
- EXPECT_EQ(__llvm_libc::toascii(ch), ch);
+ EXPECT_EQ(LIBC_NAMESPACE::toascii(ch), ch);
else
- EXPECT_EQ(__llvm_libc::toascii(ch), ch & 0x7f);
+ EXPECT_EQ(LIBC_NAMESPACE::toascii(ch), ch & 0x7f);
}
}
diff --git a/libc/test/src/ctype/tolower_test.cpp b/libc/test/src/ctype/tolower_test.cpp
index 2c2b7d966202afe..3770ce4ea68b697 100644
--- a/libc/test/src/ctype/tolower_test.cpp
+++ b/libc/test/src/ctype/tolower_test.cpp
@@ -13,8 +13,8 @@ TEST(LlvmLibcToLower, DefaultLocale) {
for (int ch = -255; ch < 255; ++ch) {
// This follows pattern 'A' + 32 = 'a'.
if ('A' <= ch && ch <= 'Z')
- EXPECT_EQ(__llvm_libc::tolower(ch), ch + 32);
+ EXPECT_EQ(LIBC_NAMESPACE::tolower(ch), ch + 32);
else
- EXPECT_EQ(__llvm_libc::tolower(ch), ch);
+ EXPECT_EQ(LIBC_NAMESPACE::tolower(ch), ch);
}
}
diff --git a/libc/test/src/ctype/toupper_test.cpp b/libc/test/src/ctype/toupper_test.cpp
index d0879d48e77fded..0413b43fb6009b4 100644
--- a/libc/test/src/ctype/toupper_test.cpp
+++ b/libc/test/src/ctype/toupper_test.cpp
@@ -13,8 +13,8 @@ TEST(LlvmLibcToUpper, DefaultLocale) {
for (int ch = -255; ch < 255; ++ch) {
// This follows pattern 'a' - 32 = 'A'.
if ('a' <= ch && ch <= 'z')
- EXPECT_EQ(__llvm_libc::toupper(ch), ch - 32);
+ EXPECT_EQ(LIBC_NAMESPACE::toupper(ch), ch - 32);
else
- EXPECT_EQ(__llvm_libc::toupper(ch), ch);
+ EXPECT_EQ(LIBC_NAMESPACE::toupper(ch), ch);
}
}
diff --git a/libc/test/src/dirent/dirent_test.cpp b/libc/test/src/dirent/dirent_test.cpp
index 72f9f4632c8dc7f..ff1a30a2639fe25 100644
--- a/libc/test/src/dirent/dirent_test.cpp
+++ b/libc/test/src/dirent/dirent_test.cpp
@@ -17,20 +17,20 @@
#include <dirent.h>
-using string_view = __llvm_libc::cpp::string_view;
+using string_view = LIBC_NAMESPACE::cpp::string_view;
TEST(LlvmLibcDirentTest, SimpleOpenAndRead) {
- ::DIR *dir = __llvm_libc::opendir("testdata");
+ ::DIR *dir = LIBC_NAMESPACE::opendir("testdata");
ASSERT_TRUE(dir != nullptr);
// The file descriptors 0, 1 and 2 are reserved for standard streams.
// So, the file descriptor for the newly opened directory should be
// greater than 2.
- ASSERT_GT(__llvm_libc::dirfd(dir), 2);
+ ASSERT_GT(LIBC_NAMESPACE::dirfd(dir), 2);
struct ::dirent *file1 = nullptr, *file2 = nullptr, *dir1 = nullptr,
*dir2 = nullptr;
while (true) {
- struct ::dirent *d = __llvm_libc::readdir(dir);
+ struct ::dirent *d = LIBC_NAMESPACE::readdir(dir);
if (d == nullptr)
break;
if (string_view(&d->d_name[0]) == "file1.txt")
@@ -51,12 +51,12 @@ TEST(LlvmLibcDirentTest, SimpleOpenAndRead) {
ASSERT_TRUE(dir1 != nullptr);
ASSERT_TRUE(dir2 != nullptr);
- ASSERT_EQ(__llvm_libc::closedir(dir), 0);
+ ASSERT_EQ(LIBC_NAMESPACE::closedir(dir), 0);
}
TEST(LlvmLibcDirentTest, OpenNonExistentDir) {
libc_errno = 0;
- ::DIR *dir = __llvm_libc::opendir("___xyz123__.non_existent__");
+ ::DIR *dir = LIBC_NAMESPACE::opendir("___xyz123__.non_existent__");
ASSERT_TRUE(dir == nullptr);
ASSERT_EQ(libc_errno, ENOENT);
libc_errno = 0;
@@ -64,7 +64,7 @@ TEST(LlvmLibcDirentTest, OpenNonExistentDir) {
TEST(LlvmLibcDirentTest, OpenFile) {
libc_errno = 0;
- ::DIR *dir = __llvm_libc::opendir("testdata/file1.txt");
+ ::DIR *dir = LIBC_NAMESPACE::opendir("testdata/file1.txt");
ASSERT_TRUE(dir == nullptr);
ASSERT_EQ(libc_errno, ENOTDIR);
libc_errno = 0;
diff --git a/libc/test/src/fcntl/creat_test.cpp b/libc/test/src/fcntl/creat_test.cpp
index 1b0e8cb43a92ff5..ca926b30e62faf7 100644
--- a/libc/test/src/fcntl/creat_test.cpp
+++ b/libc/test/src/fcntl/creat_test.cpp
@@ -14,17 +14,17 @@
#include "test/UnitTest/Test.h"
TEST(LlvmLibcCreatTest, CreatAndOpen) {
- using __llvm_libc::testing::ErrnoSetterMatcher::Succeeds;
+ using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds;
constexpr const char *TEST_FILE = "testdata/creat.test";
- int fd = __llvm_libc::creat(TEST_FILE, S_IRWXU);
+ int fd = LIBC_NAMESPACE::creat(TEST_FILE, S_IRWXU);
ASSERT_EQ(libc_errno, 0);
ASSERT_GT(fd, 0);
- ASSERT_THAT(__llvm_libc::close(fd), Succeeds(0));
+ ASSERT_THAT(LIBC_NAMESPACE::close(fd), Succeeds(0));
- fd = __llvm_libc::open(TEST_FILE, O_RDONLY);
+ fd = LIBC_NAMESPACE::open(TEST_FILE, O_RDONLY);
ASSERT_EQ(libc_errno, 0);
ASSERT_GT(fd, 0);
- ASSERT_THAT(__llvm_libc::close(fd), Succeeds(0));
+ ASSERT_THAT(LIBC_NAMESPACE::close(fd), Succeeds(0));
// TODO: 'remove' the test file at the end.
}
diff --git a/libc/test/src/fcntl/openat_test.cpp b/libc/test/src/fcntl/openat_test.cpp
index 73cce41563b9092..b95f3f212720116 100644
--- a/libc/test/src/fcntl/openat_test.cpp
+++ b/libc/test/src/fcntl/openat_test.cpp
@@ -17,27 +17,27 @@
#include <fcntl.h>
TEST(LlvmLibcUniStd, OpenAndReadTest) {
- using __llvm_libc::testing::ErrnoSetterMatcher::Succeeds;
+ using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds;
constexpr const char *TEST_DIR = "testdata";
constexpr const char *TEST_FILE = "openat.test";
- int dir_fd = __llvm_libc::open(TEST_DIR, O_DIRECTORY);
+ int dir_fd = LIBC_NAMESPACE::open(TEST_DIR, O_DIRECTORY);
ASSERT_EQ(libc_errno, 0);
ASSERT_GT(dir_fd, 0);
constexpr const char TEST_MSG[] = "openat test";
constexpr int TEST_MSG_SIZE = sizeof(TEST_MSG) - 1;
- int read_fd = __llvm_libc::openat(dir_fd, TEST_FILE, O_RDONLY);
+ int read_fd = LIBC_NAMESPACE::openat(dir_fd, TEST_FILE, O_RDONLY);
ASSERT_EQ(libc_errno, 0);
ASSERT_GT(read_fd, 0);
char read_buf[TEST_MSG_SIZE];
- ASSERT_THAT(__llvm_libc::read(read_fd, read_buf, TEST_MSG_SIZE),
+ ASSERT_THAT(LIBC_NAMESPACE::read(read_fd, read_buf, TEST_MSG_SIZE),
Succeeds(TEST_MSG_SIZE));
- ASSERT_THAT(__llvm_libc::close(read_fd), Succeeds(0));
- ASSERT_THAT(__llvm_libc::close(dir_fd), Succeeds(0));
+ ASSERT_THAT(LIBC_NAMESPACE::close(read_fd), Succeeds(0));
+ ASSERT_THAT(LIBC_NAMESPACE::close(dir_fd), Succeeds(0));
}
TEST(LlvmLibcUniStd, FailTest) {
- using __llvm_libc::testing::ErrnoSetterMatcher::Fails;
- EXPECT_THAT(__llvm_libc::openat(AT_FDCWD, "openat.test", O_RDONLY),
+ using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails;
+ EXPECT_THAT(LIBC_NAMESPACE::openat(AT_FDCWD, "openat.test", O_RDONLY),
Fails(ENOENT));
}
diff --git a/libc/test/src/fenv/enabled_exceptions_test.cpp b/libc/test/src/fenv/enabled_exceptions_test.cpp
index bb0c572da7541dc..f9509202ab680ed 100644
--- a/libc/test/src/fenv/enabled_exceptions_test.cpp
+++ b/libc/test/src/fenv/enabled_exceptions_test.cpp
@@ -29,9 +29,9 @@ TEST(LlvmLibcExceptionStatusTest, RaiseAndCrash) {
// exception and reading back to see if the exception got enabled. If the
// exception did not get enabled, then it means that the HW does not support
// trapping exceptions.
- __llvm_libc::fputil::disable_except(FE_ALL_EXCEPT);
- __llvm_libc::fputil::enable_except(FE_DIVBYZERO);
- if (__llvm_libc::fputil::get_except() == 0)
+ LIBC_NAMESPACE::fputil::disable_except(FE_ALL_EXCEPT);
+ LIBC_NAMESPACE::fputil::enable_except(FE_DIVBYZERO);
+ if (LIBC_NAMESPACE::fputil::get_except() == 0)
return;
#endif // Architectures where exception trapping is not supported
@@ -50,9 +50,9 @@ TEST(LlvmLibcExceptionStatusTest, RaiseAndCrash) {
FE_DIVBYZERO | FE_INVALID | FE_INEXACT | FE_OVERFLOW | FE_UNDERFLOW;
for (int e : excepts) {
- __llvm_libc::fputil::disable_except(FE_ALL_EXCEPT);
- __llvm_libc::fputil::enable_except(e);
- ASSERT_EQ(__llvm_libc::feclearexcept(FE_ALL_EXCEPT), 0);
+ LIBC_NAMESPACE::fputil::disable_except(FE_ALL_EXCEPT);
+ LIBC_NAMESPACE::fputil::enable_except(e);
+ ASSERT_EQ(LIBC_NAMESPACE::feclearexcept(FE_ALL_EXCEPT), 0);
// Raising all exceptions except |e| should not call the
// SIGFPE handler. They should set the exception flag though,
// so we verify that. Since other exceptions like FE_DIVBYZERO
@@ -60,8 +60,8 @@ TEST(LlvmLibcExceptionStatusTest, RaiseAndCrash) {
// exception flags when FE_INEXACT is enabled.
if (e != FE_INEXACT) {
int others = ALL_EXCEPTS & ~e;
- ASSERT_EQ(__llvm_libc::feraiseexcept(others), 0);
- ASSERT_EQ(__llvm_libc::fetestexcept(others), others);
+ ASSERT_EQ(LIBC_NAMESPACE::feraiseexcept(others), 0);
+ ASSERT_EQ(LIBC_NAMESPACE::fetestexcept(others), others);
}
ASSERT_RAISES_FP_EXCEPT([=] {
@@ -69,12 +69,12 @@ TEST(LlvmLibcExceptionStatusTest, RaiseAndCrash) {
// a death test which runs this closure in a different thread. So,
// we enable the exception again inside this closure so that the
// exception gets enabled for the thread running this closure.
- __llvm_libc::fputil::enable_except(e);
- __llvm_libc::feraiseexcept(e);
+ LIBC_NAMESPACE::fputil::enable_except(e);
+ LIBC_NAMESPACE::feraiseexcept(e);
});
// Cleanup.
- __llvm_libc::fputil::disable_except(FE_ALL_EXCEPT);
- ASSERT_EQ(__llvm_libc::feclearexcept(FE_ALL_EXCEPT), 0);
+ LIBC_NAMESPACE::fputil::disable_except(FE_ALL_EXCEPT);
+ ASSERT_EQ(LIBC_NAMESPACE::feclearexcept(FE_ALL_EXCEPT), 0);
}
}
diff --git a/libc/test/src/fenv/exception_flags_test.cpp b/libc/test/src/fenv/exception_flags_test.cpp
index 9d26fe7b93ba650..434adc06b1a36a9 100644
--- a/libc/test/src/fenv/exception_flags_test.cpp
+++ b/libc/test/src/fenv/exception_flags_test.cpp
@@ -17,8 +17,8 @@
TEST(LlvmLibcFenvTest, GetExceptFlagAndSetExceptFlag) {
// We will disable all exceptions to prevent invocation of the exception
// handler.
- __llvm_libc::fputil::disable_except(FE_ALL_EXCEPT);
- __llvm_libc::fputil::clear_except(FE_ALL_EXCEPT);
+ LIBC_NAMESPACE::fputil::disable_except(FE_ALL_EXCEPT);
+ LIBC_NAMESPACE::fputil::clear_except(FE_ALL_EXCEPT);
int excepts[] = {FE_DIVBYZERO, FE_INVALID, FE_INEXACT, FE_OVERFLOW,
FE_UNDERFLOW};
@@ -27,32 +27,32 @@ TEST(LlvmLibcFenvTest, GetExceptFlagAndSetExceptFlag) {
// The overall idea is to raise an except and save the exception flags.
// Next, clear the flags and then set the saved exception flags. This
// should set the flag corresponding to the previously raised exception.
- __llvm_libc::fputil::raise_except(e);
+ LIBC_NAMESPACE::fputil::raise_except(e);
// Make sure that the exception flag is set.
- ASSERT_NE(__llvm_libc::fputil::test_except(FE_ALL_EXCEPT) & e, 0);
+ ASSERT_NE(LIBC_NAMESPACE::fputil::test_except(FE_ALL_EXCEPT) & e, 0);
fexcept_t eflags;
- ASSERT_EQ(__llvm_libc::fegetexceptflag(&eflags, FE_ALL_EXCEPT), 0);
+ ASSERT_EQ(LIBC_NAMESPACE::fegetexceptflag(&eflags, FE_ALL_EXCEPT), 0);
- __llvm_libc::fputil::clear_except(e);
- ASSERT_EQ(__llvm_libc::fputil::test_except(FE_ALL_EXCEPT) & e, 0);
+ LIBC_NAMESPACE::fputil::clear_except(e);
+ ASSERT_EQ(LIBC_NAMESPACE::fputil::test_except(FE_ALL_EXCEPT) & e, 0);
- ASSERT_EQ(__llvm_libc::fesetexceptflag(&eflags, FE_ALL_EXCEPT), 0);
- ASSERT_NE(__llvm_libc::fputil::test_except(FE_ALL_EXCEPT) & e, 0);
+ ASSERT_EQ(LIBC_NAMESPACE::fesetexceptflag(&eflags, FE_ALL_EXCEPT), 0);
+ ASSERT_NE(LIBC_NAMESPACE::fputil::test_except(FE_ALL_EXCEPT) & e, 0);
// Cleanup. We clear all excepts as raising excepts like FE_OVERFLOW
// can also raise FE_INEXACT.
- __llvm_libc::fputil::clear_except(FE_ALL_EXCEPT);
+ LIBC_NAMESPACE::fputil::clear_except(FE_ALL_EXCEPT);
}
// Next, we will raise one exception and save the flags.
- __llvm_libc::fputil::raise_except(FE_INVALID);
+ LIBC_NAMESPACE::fputil::raise_except(FE_INVALID);
fexcept_t eflags;
- __llvm_libc::fegetexceptflag(&eflags, FE_ALL_EXCEPT);
+ LIBC_NAMESPACE::fegetexceptflag(&eflags, FE_ALL_EXCEPT);
// Clear all exceptions and raise two other exceptions.
- __llvm_libc::fputil::clear_except(FE_ALL_EXCEPT);
- __llvm_libc::fputil::raise_except(FE_OVERFLOW | FE_INEXACT);
+ LIBC_NAMESPACE::fputil::clear_except(FE_ALL_EXCEPT);
+ LIBC_NAMESPACE::fputil::raise_except(FE_OVERFLOW | FE_INEXACT);
// When we set the flags and test, we should only see FE_INVALID.
- __llvm_libc::fesetexceptflag(&eflags, FE_ALL_EXCEPT);
- EXPECT_EQ(__llvm_libc::fputil::test_except(FE_ALL_EXCEPT), FE_INVALID);
+ LIBC_NAMESPACE::fesetexceptflag(&eflags, FE_ALL_EXCEPT);
+ EXPECT_EQ(LIBC_NAMESPACE::fputil::test_except(FE_ALL_EXCEPT), FE_INVALID);
}
diff --git a/libc/test/src/fenv/exception_status_test.cpp b/libc/test/src/fenv/exception_status_test.cpp
index 3563187c917e04f..e4e2240fc374c83 100644
--- a/libc/test/src/fenv/exception_status_test.cpp
+++ b/libc/test/src/fenv/exception_status_test.cpp
@@ -20,7 +20,7 @@ TEST(LlvmLibcExceptionStatusTest, RaiseAndTest) {
// status flags are updated. The intention is really not to invoke the
// exception handler. Hence, we will disable all exceptions at the
// beginning.
- __llvm_libc::fputil::disable_except(FE_ALL_EXCEPT);
+ LIBC_NAMESPACE::fputil::disable_except(FE_ALL_EXCEPT);
int excepts[] = {FE_DIVBYZERO, FE_INVALID, FE_INEXACT, FE_OVERFLOW,
FE_UNDERFLOW};
@@ -29,28 +29,28 @@ TEST(LlvmLibcExceptionStatusTest, RaiseAndTest) {
FE_DIVBYZERO | FE_INVALID | FE_INEXACT | FE_OVERFLOW | FE_UNDERFLOW;
for (int e : excepts) {
- int r = __llvm_libc::feraiseexcept(e);
+ int r = LIBC_NAMESPACE::feraiseexcept(e);
ASSERT_EQ(r, 0);
- int s = __llvm_libc::fetestexcept(e);
+ int s = LIBC_NAMESPACE::fetestexcept(e);
ASSERT_EQ(s, e);
- r = __llvm_libc::feclearexcept(e);
+ r = LIBC_NAMESPACE::feclearexcept(e);
ASSERT_EQ(r, 0);
- s = __llvm_libc::fetestexcept(e);
+ s = LIBC_NAMESPACE::fetestexcept(e);
ASSERT_EQ(s, 0);
}
for (int e1 : excepts) {
for (int e2 : excepts) {
int e = e1 | e2;
- int r = __llvm_libc::feraiseexcept(e);
+ int r = LIBC_NAMESPACE::feraiseexcept(e);
ASSERT_EQ(r, 0);
- int s = __llvm_libc::fetestexcept(e);
+ int s = LIBC_NAMESPACE::fetestexcept(e);
ASSERT_EQ(s, e);
- r = __llvm_libc::feclearexcept(e);
+ r = LIBC_NAMESPACE::feclearexcept(e);
ASSERT_EQ(r, 0);
- s = __llvm_libc::fetestexcept(e);
+ s = LIBC_NAMESPACE::fetestexcept(e);
ASSERT_EQ(s, 0);
}
}
@@ -59,14 +59,14 @@ TEST(LlvmLibcExceptionStatusTest, RaiseAndTest) {
for (int e2 : excepts) {
for (int e3 : excepts) {
int e = e1 | e2 | e3;
- int r = __llvm_libc::feraiseexcept(e);
+ int r = LIBC_NAMESPACE::feraiseexcept(e);
ASSERT_EQ(r, 0);
- int s = __llvm_libc::fetestexcept(e);
+ int s = LIBC_NAMESPACE::fetestexcept(e);
ASSERT_EQ(s, e);
- r = __llvm_libc::feclearexcept(e);
+ r = LIBC_NAMESPACE::feclearexcept(e);
ASSERT_EQ(r, 0);
- s = __llvm_libc::fetestexcept(e);
+ s = LIBC_NAMESPACE::fetestexcept(e);
ASSERT_EQ(s, 0);
}
}
@@ -77,14 +77,14 @@ TEST(LlvmLibcExceptionStatusTest, RaiseAndTest) {
for (int e3 : excepts) {
for (int e4 : excepts) {
int e = e1 | e2 | e3 | e4;
- int r = __llvm_libc::feraiseexcept(e);
+ int r = LIBC_NAMESPACE::feraiseexcept(e);
ASSERT_EQ(r, 0);
- int s = __llvm_libc::fetestexcept(e);
+ int s = LIBC_NAMESPACE::fetestexcept(e);
ASSERT_EQ(s, e);
- r = __llvm_libc::feclearexcept(e);
+ r = LIBC_NAMESPACE::feclearexcept(e);
ASSERT_EQ(r, 0);
- s = __llvm_libc::fetestexcept(e);
+ s = LIBC_NAMESPACE::fetestexcept(e);
ASSERT_EQ(s, 0);
}
}
@@ -97,14 +97,14 @@ TEST(LlvmLibcExceptionStatusTest, RaiseAndTest) {
for (int e4 : excepts) {
for (int e5 : excepts) {
int e = e1 | e2 | e3 | e4 | e5;
- int r = __llvm_libc::feraiseexcept(e);
+ int r = LIBC_NAMESPACE::feraiseexcept(e);
ASSERT_EQ(r, 0);
- int s = __llvm_libc::fetestexcept(e);
+ int s = LIBC_NAMESPACE::fetestexcept(e);
ASSERT_EQ(s, e);
- r = __llvm_libc::feclearexcept(e);
+ r = LIBC_NAMESPACE::feclearexcept(e);
ASSERT_EQ(r, 0);
- s = __llvm_libc::fetestexcept(e);
+ s = LIBC_NAMESPACE::fetestexcept(e);
ASSERT_EQ(s, 0);
}
}
@@ -112,8 +112,8 @@ TEST(LlvmLibcExceptionStatusTest, RaiseAndTest) {
}
}
- int r = __llvm_libc::feraiseexcept(ALL_EXCEPTS);
+ int r = LIBC_NAMESPACE::feraiseexcept(ALL_EXCEPTS);
ASSERT_EQ(r, 0);
- int s = __llvm_libc::fetestexcept(ALL_EXCEPTS);
+ int s = LIBC_NAMESPACE::fetestexcept(ALL_EXCEPTS);
ASSERT_EQ(s, ALL_EXCEPTS);
}
diff --git a/libc/test/src/fenv/feclearexcept_test.cpp b/libc/test/src/fenv/feclearexcept_test.cpp
index 80414b2d2cd850c..fa3e856d1ba200d 100644
--- a/libc/test/src/fenv/feclearexcept_test.cpp
+++ b/libc/test/src/fenv/feclearexcept_test.cpp
@@ -17,13 +17,13 @@
TEST(LlvmLibcFEnvTest, ClearTest) {
uint16_t excepts[] = {FE_DIVBYZERO, FE_INVALID, FE_INEXACT, FE_OVERFLOW,
FE_UNDERFLOW};
- __llvm_libc::fputil::disable_except(FE_ALL_EXCEPT);
- __llvm_libc::fputil::clear_except(FE_ALL_EXCEPT);
+ LIBC_NAMESPACE::fputil::disable_except(FE_ALL_EXCEPT);
+ LIBC_NAMESPACE::fputil::clear_except(FE_ALL_EXCEPT);
for (uint16_t e : excepts)
- ASSERT_EQ(__llvm_libc::fputil::test_except(e), 0);
+ ASSERT_EQ(LIBC_NAMESPACE::fputil::test_except(e), 0);
- __llvm_libc::fputil::raise_except(FE_ALL_EXCEPT);
+ LIBC_NAMESPACE::fputil::raise_except(FE_ALL_EXCEPT);
for (uint16_t e1 : excepts) {
for (uint16_t e2 : excepts) {
@@ -31,11 +31,11 @@ TEST(LlvmLibcFEnvTest, ClearTest) {
for (uint16_t e4 : excepts) {
for (uint16_t e5 : excepts) {
// We clear one exception and test to verify that it was cleared.
- __llvm_libc::feclearexcept(e1 | e2 | e3 | e4 | e5);
- ASSERT_EQ(__llvm_libc::fputil::test_except(e1 | e2 | e3 | e4 | e5),
- 0);
+ LIBC_NAMESPACE::feclearexcept(e1 | e2 | e3 | e4 | e5);
+ ASSERT_EQ(
+ LIBC_NAMESPACE::fputil::test_except(e1 | e2 | e3 | e4 | e5), 0);
// After clearing, we raise the exception again.
- __llvm_libc::fputil::raise_except(e1 | e2 | e3 | e4 | e5);
+ LIBC_NAMESPACE::fputil::raise_except(e1 | e2 | e3 | e4 | e5);
}
}
}
diff --git a/libc/test/src/fenv/feenableexcept_test.cpp b/libc/test/src/fenv/feenableexcept_test.cpp
index c27a2bff6a03872..c891a552d40cfe2 100644
--- a/libc/test/src/fenv/feenableexcept_test.cpp
+++ b/libc/test/src/fenv/feenableexcept_test.cpp
@@ -24,37 +24,37 @@ TEST(LlvmLibcFEnvTest, EnableTest) {
// exception and reading back to see if the exception got enabled. If the
// exception did not get enabled, then it means that the HW does not support
// trapping exceptions.
- __llvm_libc::fedisableexcept(FE_ALL_EXCEPT);
- __llvm_libc::feenableexcept(FE_DIVBYZERO);
- if (__llvm_libc::fegetexcept() == 0)
+ LIBC_NAMESPACE::fedisableexcept(FE_ALL_EXCEPT);
+ LIBC_NAMESPACE::feenableexcept(FE_DIVBYZERO);
+ if (LIBC_NAMESPACE::fegetexcept() == 0)
return;
#endif // Architectures where exception trapping is not supported
int excepts[] = {FE_DIVBYZERO, FE_INVALID, FE_INEXACT, FE_OVERFLOW,
FE_UNDERFLOW};
- __llvm_libc::fedisableexcept(FE_ALL_EXCEPT);
- ASSERT_EQ(0, __llvm_libc::fegetexcept());
+ LIBC_NAMESPACE::fedisableexcept(FE_ALL_EXCEPT);
+ ASSERT_EQ(0, LIBC_NAMESPACE::fegetexcept());
for (int e : excepts) {
- __llvm_libc::feenableexcept(e);
- ASSERT_EQ(e, __llvm_libc::fegetexcept());
- __llvm_libc::fedisableexcept(e);
+ LIBC_NAMESPACE::feenableexcept(e);
+ ASSERT_EQ(e, LIBC_NAMESPACE::fegetexcept());
+ LIBC_NAMESPACE::fedisableexcept(e);
}
for (int e1 : excepts) {
for (int e2 : excepts) {
- __llvm_libc::feenableexcept(e1 | e2);
- ASSERT_EQ(e1 | e2, __llvm_libc::fegetexcept());
- __llvm_libc::fedisableexcept(e1 | e2);
+ LIBC_NAMESPACE::feenableexcept(e1 | e2);
+ ASSERT_EQ(e1 | e2, LIBC_NAMESPACE::fegetexcept());
+ LIBC_NAMESPACE::fedisableexcept(e1 | e2);
}
}
for (int e1 : excepts) {
for (int e2 : excepts) {
for (int e3 : excepts) {
- __llvm_libc::feenableexcept(e1 | e2 | e3);
- ASSERT_EQ(e1 | e2 | e3, __llvm_libc::fegetexcept());
- __llvm_libc::fedisableexcept(e1 | e2 | e3);
+ LIBC_NAMESPACE::feenableexcept(e1 | e2 | e3);
+ ASSERT_EQ(e1 | e2 | e3, LIBC_NAMESPACE::fegetexcept());
+ LIBC_NAMESPACE::fedisableexcept(e1 | e2 | e3);
}
}
}
@@ -63,9 +63,9 @@ TEST(LlvmLibcFEnvTest, EnableTest) {
for (int e2 : excepts) {
for (int e3 : excepts) {
for (int e4 : excepts) {
- __llvm_libc::feenableexcept(e1 | e2 | e3 | e4);
- ASSERT_EQ(e1 | e2 | e3 | e4, __llvm_libc::fegetexcept());
- __llvm_libc::fedisableexcept(e1 | e2 | e3 | e4);
+ LIBC_NAMESPACE::feenableexcept(e1 | e2 | e3 | e4);
+ ASSERT_EQ(e1 | e2 | e3 | e4, LIBC_NAMESPACE::fegetexcept());
+ LIBC_NAMESPACE::fedisableexcept(e1 | e2 | e3 | e4);
}
}
}
@@ -76,9 +76,9 @@ TEST(LlvmLibcFEnvTest, EnableTest) {
for (int e3 : excepts) {
for (int e4 : excepts) {
for (int e5 : excepts) {
- __llvm_libc::feenableexcept(e1 | e2 | e3 | e4 | e5);
- ASSERT_EQ(e1 | e2 | e3 | e4 | e5, __llvm_libc::fegetexcept());
- __llvm_libc::fedisableexcept(e1 | e2 | e3 | e4 | e5);
+ LIBC_NAMESPACE::feenableexcept(e1 | e2 | e3 | e4 | e5);
+ ASSERT_EQ(e1 | e2 | e3 | e4 | e5, LIBC_NAMESPACE::fegetexcept());
+ LIBC_NAMESPACE::fedisableexcept(e1 | e2 | e3 | e4 | e5);
}
}
}
diff --git a/libc/test/src/fenv/feholdexcept_test.cpp b/libc/test/src/fenv/feholdexcept_test.cpp
index 40e336ef41af3b1..fe23ef23226ad40 100644
--- a/libc/test/src/fenv/feholdexcept_test.cpp
+++ b/libc/test/src/fenv/feholdexcept_test.cpp
@@ -24,9 +24,9 @@ TEST(LlvmLibcFEnvTest, RaiseAndCrash) {
// exception and reading back to see if the exception got enabled. If the
// exception did not get enabled, then it means that the HW does not support
// trapping exceptions.
- __llvm_libc::fputil::disable_except(FE_ALL_EXCEPT);
- __llvm_libc::fputil::enable_except(FE_DIVBYZERO);
- if (__llvm_libc::fputil::get_except() == 0)
+ LIBC_NAMESPACE::fputil::disable_except(FE_ALL_EXCEPT);
+ LIBC_NAMESPACE::fputil::enable_except(FE_DIVBYZERO);
+ if (LIBC_NAMESPACE::fputil::get_except() == 0)
return;
#endif // Architectures where exception trapping is not supported
@@ -35,13 +35,13 @@ TEST(LlvmLibcFEnvTest, RaiseAndCrash) {
for (int e : excepts) {
fenv_t env;
- __llvm_libc::fputil::disable_except(FE_ALL_EXCEPT);
- __llvm_libc::fputil::enable_except(e);
- ASSERT_EQ(__llvm_libc::fputil::clear_except(FE_ALL_EXCEPT), 0);
- ASSERT_EQ(__llvm_libc::feholdexcept(&env), 0);
+ LIBC_NAMESPACE::fputil::disable_except(FE_ALL_EXCEPT);
+ LIBC_NAMESPACE::fputil::enable_except(e);
+ ASSERT_EQ(LIBC_NAMESPACE::fputil::clear_except(FE_ALL_EXCEPT), 0);
+ ASSERT_EQ(LIBC_NAMESPACE::feholdexcept(&env), 0);
// feholdexcept should disable all excepts so raising an exception
// should not crash/invoke the exception handler.
- ASSERT_EQ(__llvm_libc::fputil::raise_except(e), 0);
+ ASSERT_EQ(LIBC_NAMESPACE::fputil::raise_except(e), 0);
ASSERT_RAISES_FP_EXCEPT([=] {
// When we put back the saved env, which has the exception enabled, it
@@ -51,12 +51,12 @@ TEST(LlvmLibcFEnvTest, RaiseAndCrash) {
// run in a different thread. So, we set the old environment inside
// this closure so that the exception gets enabled for the thread running
// this closure.
- __llvm_libc::fputil::set_env(&env);
- __llvm_libc::fputil::raise_except(e);
+ LIBC_NAMESPACE::fputil::set_env(&env);
+ LIBC_NAMESPACE::fputil::raise_except(e);
});
// Cleanup
- __llvm_libc::fputil::disable_except(FE_ALL_EXCEPT);
- ASSERT_EQ(__llvm_libc::fputil::clear_except(FE_ALL_EXCEPT), 0);
+ LIBC_NAMESPACE::fputil::disable_except(FE_ALL_EXCEPT);
+ ASSERT_EQ(LIBC_NAMESPACE::fputil::clear_except(FE_ALL_EXCEPT), 0);
}
}
diff --git a/libc/test/src/fenv/feupdateenv_test.cpp b/libc/test/src/fenv/feupdateenv_test.cpp
index 1b3884a7337fe7d..96f253f76077a0f 100644
--- a/libc/test/src/fenv/feupdateenv_test.cpp
+++ b/libc/test/src/fenv/feupdateenv_test.cpp
@@ -15,13 +15,13 @@
#include <signal.h>
TEST(LlvmLibcFEnvTest, UpdateEnvTest) {
- __llvm_libc::fputil::disable_except(FE_ALL_EXCEPT);
- __llvm_libc::fputil::clear_except(FE_ALL_EXCEPT);
+ LIBC_NAMESPACE::fputil::disable_except(FE_ALL_EXCEPT);
+ LIBC_NAMESPACE::fputil::clear_except(FE_ALL_EXCEPT);
fenv_t env;
- ASSERT_EQ(__llvm_libc::fputil::get_env(&env), 0);
- __llvm_libc::fputil::set_except(FE_INVALID | FE_INEXACT);
- ASSERT_EQ(__llvm_libc::feupdateenv(&env), 0);
- ASSERT_EQ(__llvm_libc::fputil::test_except(FE_INVALID | FE_INEXACT),
+ ASSERT_EQ(LIBC_NAMESPACE::fputil::get_env(&env), 0);
+ LIBC_NAMESPACE::fputil::set_except(FE_INVALID | FE_INEXACT);
+ ASSERT_EQ(LIBC_NAMESPACE::feupdateenv(&env), 0);
+ ASSERT_EQ(LIBC_NAMESPACE::fputil::test_except(FE_INVALID | FE_INEXACT),
FE_INVALID | FE_INEXACT);
}
diff --git a/libc/test/src/fenv/getenv_and_setenv_test.cpp b/libc/test/src/fenv/getenv_and_setenv_test.cpp
index 5fe21325e1e7912..8184a5c3bb9997a 100644
--- a/libc/test/src/fenv/getenv_and_setenv_test.cpp
+++ b/libc/test/src/fenv/getenv_and_setenv_test.cpp
@@ -19,55 +19,55 @@
TEST(LlvmLibcFenvTest, GetEnvAndSetEnv) {
// We will disable all exceptions to prevent invocation of the exception
// handler.
- __llvm_libc::fputil::disable_except(FE_ALL_EXCEPT);
+ LIBC_NAMESPACE::fputil::disable_except(FE_ALL_EXCEPT);
int excepts[] = {FE_DIVBYZERO, FE_INVALID, FE_INEXACT, FE_OVERFLOW,
FE_UNDERFLOW};
for (int e : excepts) {
- __llvm_libc::fputil::clear_except(FE_ALL_EXCEPT);
+ LIBC_NAMESPACE::fputil::clear_except(FE_ALL_EXCEPT);
// Save the cleared environment.
fenv_t env;
- ASSERT_EQ(__llvm_libc::fegetenv(&env), 0);
+ ASSERT_EQ(LIBC_NAMESPACE::fegetenv(&env), 0);
- __llvm_libc::fputil::raise_except(e);
+ LIBC_NAMESPACE::fputil::raise_except(e);
// Make sure that the exception is raised.
- ASSERT_NE(__llvm_libc::fputil::test_except(FE_ALL_EXCEPT) & e, 0);
+ ASSERT_NE(LIBC_NAMESPACE::fputil::test_except(FE_ALL_EXCEPT) & e, 0);
- ASSERT_EQ(__llvm_libc::fesetenv(&env), 0);
- ASSERT_EQ(__llvm_libc::fputil::test_except(FE_ALL_EXCEPT) & e, 0);
+ ASSERT_EQ(LIBC_NAMESPACE::fesetenv(&env), 0);
+ ASSERT_EQ(LIBC_NAMESPACE::fputil::test_except(FE_ALL_EXCEPT) & e, 0);
}
}
TEST(LlvmLibcFenvTest, Set_FE_DFL_ENV) {
// We will disable all exceptions to prevent invocation of the exception
// handler.
- __llvm_libc::fputil::disable_except(FE_ALL_EXCEPT);
+ LIBC_NAMESPACE::fputil::disable_except(FE_ALL_EXCEPT);
int excepts[] = {FE_DIVBYZERO, FE_INVALID, FE_INEXACT, FE_OVERFLOW,
FE_UNDERFLOW};
for (int e : excepts) {
- __llvm_libc::fputil::clear_except(FE_ALL_EXCEPT);
+ LIBC_NAMESPACE::fputil::clear_except(FE_ALL_EXCEPT);
// Save the cleared environment.
fenv_t env;
- ASSERT_EQ(__llvm_libc::fegetenv(&env), 0);
+ ASSERT_EQ(LIBC_NAMESPACE::fegetenv(&env), 0);
- __llvm_libc::fputil::raise_except(e);
+ LIBC_NAMESPACE::fputil::raise_except(e);
// Make sure that the exception is raised.
- ASSERT_NE(__llvm_libc::fputil::test_except(FE_ALL_EXCEPT) & e, 0);
+ ASSERT_NE(LIBC_NAMESPACE::fputil::test_except(FE_ALL_EXCEPT) & e, 0);
- ASSERT_EQ(__llvm_libc::fesetenv(FE_DFL_ENV), 0);
+ ASSERT_EQ(LIBC_NAMESPACE::fesetenv(FE_DFL_ENV), 0);
// Setting the default env should clear all exceptions.
- ASSERT_EQ(__llvm_libc::fputil::test_except(FE_ALL_EXCEPT) & e, 0);
+ ASSERT_EQ(LIBC_NAMESPACE::fputil::test_except(FE_ALL_EXCEPT) & e, 0);
}
- ASSERT_EQ(__llvm_libc::fesetround(FE_DOWNWARD), 0);
- ASSERT_EQ(__llvm_libc::fesetenv(FE_DFL_ENV), 0);
+ ASSERT_EQ(LIBC_NAMESPACE::fesetround(FE_DOWNWARD), 0);
+ ASSERT_EQ(LIBC_NAMESPACE::fesetenv(FE_DFL_ENV), 0);
// Setting the default env should set rounding mode to FE_TONEAREST.
- int rm = __llvm_libc::fegetround();
+ int rm = LIBC_NAMESPACE::fegetround();
EXPECT_EQ(rm, FE_TONEAREST);
}
@@ -76,8 +76,8 @@ TEST(LlvmLibcFenvTest, Windows_Set_Get_Test) {
// If a valid fenv_t is written, then reading it back out should be identical.
fenv_t setEnv = {0x7e00053e, 0x0f00000f};
fenv_t getEnv;
- ASSERT_EQ(__llvm_libc::fesetenv(&setEnv), 0);
- ASSERT_EQ(__llvm_libc::fegetenv(&getEnv), 0);
+ ASSERT_EQ(LIBC_NAMESPACE::fesetenv(&setEnv), 0);
+ ASSERT_EQ(LIBC_NAMESPACE::fegetenv(&getEnv), 0);
ASSERT_EQ(setEnv._Fe_ctl, getEnv._Fe_ctl);
ASSERT_EQ(setEnv._Fe_stat, getEnv._Fe_stat);
diff --git a/libc/test/src/fenv/rounding_mode_test.cpp b/libc/test/src/fenv/rounding_mode_test.cpp
index 0f03b5f50cf915a..4560160e8e2e9b0 100644
--- a/libc/test/src/fenv/rounding_mode_test.cpp
+++ b/libc/test/src/fenv/rounding_mode_test.cpp
@@ -16,28 +16,26 @@
TEST(LlvmLibcRoundingModeTest, SetAndGet) {
struct ResetDefaultRoundingMode {
int original;
- ~ResetDefaultRoundingMode() {
- __llvm_libc::fesetround(original);
- }
- } reset{__llvm_libc::fegetround()};
+ ~ResetDefaultRoundingMode() { LIBC_NAMESPACE::fesetround(original); }
+ } reset{LIBC_NAMESPACE::fegetround()};
- int s = __llvm_libc::fesetround(FE_TONEAREST);
+ int s = LIBC_NAMESPACE::fesetround(FE_TONEAREST);
EXPECT_EQ(s, 0);
- int rm = __llvm_libc::fegetround();
+ int rm = LIBC_NAMESPACE::fegetround();
EXPECT_EQ(rm, FE_TONEAREST);
- s = __llvm_libc::fesetround(FE_UPWARD);
+ s = LIBC_NAMESPACE::fesetround(FE_UPWARD);
EXPECT_EQ(s, 0);
- rm = __llvm_libc::fegetround();
+ rm = LIBC_NAMESPACE::fegetround();
EXPECT_EQ(rm, FE_UPWARD);
- s = __llvm_libc::fesetround(FE_DOWNWARD);
+ s = LIBC_NAMESPACE::fesetround(FE_DOWNWARD);
EXPECT_EQ(s, 0);
- rm = __llvm_libc::fegetround();
+ rm = LIBC_NAMESPACE::fegetround();
EXPECT_EQ(rm, FE_DOWNWARD);
- s = __llvm_libc::fesetround(FE_TOWARDZERO);
+ s = LIBC_NAMESPACE::fesetround(FE_TOWARDZERO);
EXPECT_EQ(s, 0);
- rm = __llvm_libc::fegetround();
+ rm = LIBC_NAMESPACE::fegetround();
EXPECT_EQ(rm, FE_TOWARDZERO);
}
diff --git a/libc/test/src/inttypes/imaxabs_test.cpp b/libc/test/src/inttypes/imaxabs_test.cpp
index 7c9870495c35a4b..8d3a8a2984bb467 100644
--- a/libc/test/src/inttypes/imaxabs_test.cpp
+++ b/libc/test/src/inttypes/imaxabs_test.cpp
@@ -10,13 +10,13 @@
#include "test/UnitTest/Test.h"
TEST(LlvmLibcImaxAbsTest, Zero) {
- EXPECT_EQ(__llvm_libc::imaxabs(0), intmax_t(0));
+ EXPECT_EQ(LIBC_NAMESPACE::imaxabs(0), intmax_t(0));
}
TEST(LlvmLibcImaxAbsTest, Positive) {
- EXPECT_EQ(__llvm_libc::imaxabs(1), intmax_t(1));
+ EXPECT_EQ(LIBC_NAMESPACE::imaxabs(1), intmax_t(1));
}
TEST(LlvmLibcImaxAbsTest, Negative) {
- EXPECT_EQ(__llvm_libc::imaxabs(-1), intmax_t(1));
+ EXPECT_EQ(LIBC_NAMESPACE::imaxabs(-1), intmax_t(1));
}
diff --git a/libc/test/src/inttypes/imaxdiv_test.cpp b/libc/test/src/inttypes/imaxdiv_test.cpp
index 321aad5d0ebc51c..59eb1d71158d092 100644
--- a/libc/test/src/inttypes/imaxdiv_test.cpp
+++ b/libc/test/src/inttypes/imaxdiv_test.cpp
@@ -12,4 +12,4 @@
#include <inttypes.h>
-LIST_DIV_TESTS(intmax_t, imaxdiv_t, __llvm_libc::imaxdiv)
+LIST_DIV_TESTS(intmax_t, imaxdiv_t, LIBC_NAMESPACE::imaxdiv)
diff --git a/libc/test/src/inttypes/strtoimax_test.cpp b/libc/test/src/inttypes/strtoimax_test.cpp
index 3947e684fbbcab3..de76d621d268dca 100644
--- a/libc/test/src/inttypes/strtoimax_test.cpp
+++ b/libc/test/src/inttypes/strtoimax_test.cpp
@@ -12,4 +12,4 @@
#include "test/src/stdlib/StrtolTest.h"
-STRTOL_TEST(Strtoimax, __llvm_libc::strtoimax)
+STRTOL_TEST(Strtoimax, LIBC_NAMESPACE::strtoimax)
diff --git a/libc/test/src/inttypes/strtoumax_test.cpp b/libc/test/src/inttypes/strtoumax_test.cpp
index 77c6dedf6b98d14..82d7be92bb1d35e 100644
--- a/libc/test/src/inttypes/strtoumax_test.cpp
+++ b/libc/test/src/inttypes/strtoumax_test.cpp
@@ -12,4 +12,4 @@
#include "test/src/stdlib/StrtolTest.h"
-STRTOL_TEST(Strtoumax, __llvm_libc::strtoumax)
+STRTOL_TEST(Strtoumax, LIBC_NAMESPACE::strtoumax)
diff --git a/libc/test/src/math/CeilTest.h b/libc/test/src/math/CeilTest.h
index 78c1a08b9c82eaa..d1e2b2e6fd17d4f 100644
--- a/libc/test/src/math/CeilTest.h
+++ b/libc/test/src/math/CeilTest.h
@@ -12,9 +12,9 @@
#include <math.h>
-namespace mpfr = __llvm_libc::testing::mpfr;
+namespace mpfr = LIBC_NAMESPACE::testing::mpfr;
-template <typename T> class CeilTest : public __llvm_libc::testing::Test {
+template <typename T> class CeilTest : public LIBC_NAMESPACE::testing::Test {
DECLARE_SPECIAL_CONSTANTS(T)
diff --git a/libc/test/src/math/CopySignTest.h b/libc/test/src/math/CopySignTest.h
index 3d1eed1b066242b..aecd012d1d524a1 100644
--- a/libc/test/src/math/CopySignTest.h
+++ b/libc/test/src/math/CopySignTest.h
@@ -12,9 +12,10 @@
#include <math.h>
-namespace mpfr = __llvm_libc::testing::mpfr;
+namespace mpfr = LIBC_NAMESPACE::testing::mpfr;
-template <typename T> class CopySignTest : public __llvm_libc::testing::Test {
+template <typename T>
+class CopySignTest : public LIBC_NAMESPACE::testing::Test {
DECLARE_SPECIAL_CONSTANTS(T)
diff --git a/libc/test/src/math/FAbsTest.h b/libc/test/src/math/FAbsTest.h
index 38b09cff19e2dda..3342926142ff1fb 100644
--- a/libc/test/src/math/FAbsTest.h
+++ b/libc/test/src/math/FAbsTest.h
@@ -12,9 +12,9 @@
#include <math.h>
-namespace mpfr = __llvm_libc::testing::mpfr;
+namespace mpfr = LIBC_NAMESPACE::testing::mpfr;
-template <typename T> class FAbsTest : public __llvm_libc::testing::Test {
+template <typename T> class FAbsTest : public LIBC_NAMESPACE::testing::Test {
DECLARE_SPECIAL_CONSTANTS(T)
diff --git a/libc/test/src/math/FDimTest.h b/libc/test/src/math/FDimTest.h
index c0dbda10b318b97..3118c3661013e7c 100644
--- a/libc/test/src/math/FDimTest.h
+++ b/libc/test/src/math/FDimTest.h
@@ -13,10 +13,10 @@
#include <math.h>
template <typename T>
-class FDimTestTemplate : public __llvm_libc::testing::Test {
+class FDimTestTemplate : public LIBC_NAMESPACE::testing::Test {
public:
using FuncPtr = T (*)(T, T);
- using FPBits = __llvm_libc::fputil::FPBits<T>;
+ using FPBits = LIBC_NAMESPACE::fputil::FPBits<T>;
using UIntType = typename FPBits::UIntType;
void test_na_n_arg(FuncPtr func) {
@@ -74,9 +74,9 @@ class FDimTestTemplate : public __llvm_libc::testing::Test {
private:
// constexpr does not work on FPBits yet, so we cannot have these constants as
// static.
- const T nan = T(__llvm_libc::fputil::FPBits<T>::build_quiet_nan(1));
- const T inf = T(__llvm_libc::fputil::FPBits<T>::inf());
- const T neg_inf = T(__llvm_libc::fputil::FPBits<T>::neg_inf());
- const T zero = T(__llvm_libc::fputil::FPBits<T>::zero());
- const T neg_zero = T(__llvm_libc::fputil::FPBits<T>::neg_zero());
+ const T nan = T(LIBC_NAMESPACE::fputil::FPBits<T>::build_quiet_nan(1));
+ const T inf = T(LIBC_NAMESPACE::fputil::FPBits<T>::inf());
+ const T neg_inf = T(LIBC_NAMESPACE::fputil::FPBits<T>::neg_inf());
+ const T zero = T(LIBC_NAMESPACE::fputil::FPBits<T>::zero());
+ const T neg_zero = T(LIBC_NAMESPACE::fputil::FPBits<T>::neg_zero());
};
diff --git a/libc/test/src/math/FMaxTest.h b/libc/test/src/math/FMaxTest.h
index 0a6c767588c11d7..e371086274acf7c 100644
--- a/libc/test/src/math/FMaxTest.h
+++ b/libc/test/src/math/FMaxTest.h
@@ -12,9 +12,9 @@
#include <math.h>
-namespace mpfr = __llvm_libc::testing::mpfr;
+namespace mpfr = LIBC_NAMESPACE::testing::mpfr;
-template <typename T> class FMaxTest : public __llvm_libc::testing::Test {
+template <typename T> class FMaxTest : public LIBC_NAMESPACE::testing::Test {
DECLARE_SPECIAL_CONSTANTS(T)
diff --git a/libc/test/src/math/FMinTest.h b/libc/test/src/math/FMinTest.h
index 10c87f9d6a102d4..7f8393ac2b5e910 100644
--- a/libc/test/src/math/FMinTest.h
+++ b/libc/test/src/math/FMinTest.h
@@ -12,9 +12,9 @@
#include <math.h>
-namespace mpfr = __llvm_libc::testing::mpfr;
+namespace mpfr = LIBC_NAMESPACE::testing::mpfr;
-template <typename T> class FMinTest : public __llvm_libc::testing::Test {
+template <typename T> class FMinTest : public LIBC_NAMESPACE::testing::Test {
DECLARE_SPECIAL_CONSTANTS(T)
diff --git a/libc/test/src/math/FModTest.h b/libc/test/src/math/FModTest.h
index 6bff888294d2b0f..5fc0ebf6d33e407 100644
--- a/libc/test/src/math/FModTest.h
+++ b/libc/test/src/math/FModTest.h
@@ -21,11 +21,11 @@
EXPECT_FP_EQ(expected, f(x, y)); \
EXPECT_MATH_ERRNO((dom_err) ? EDOM : 0); \
EXPECT_FP_EXCEPTION(expected_exception); \
- __llvm_libc::fputil::clear_except(FE_ALL_EXCEPT)
+ LIBC_NAMESPACE::fputil::clear_except(FE_ALL_EXCEPT)
#define TEST_REGULAR(x, y, expected) TEST_SPECIAL(x, y, expected, false, 0)
-template <typename T> class FmodTest : public __llvm_libc::testing::Test {
+template <typename T> class FmodTest : public LIBC_NAMESPACE::testing::Test {
DECLARE_SPECIAL_CONSTANTS(T)
diff --git a/libc/test/src/math/FloorTest.h b/libc/test/src/math/FloorTest.h
index ce1075af7699573..843c70ba2baeb37 100644
--- a/libc/test/src/math/FloorTest.h
+++ b/libc/test/src/math/FloorTest.h
@@ -12,9 +12,9 @@
#include <math.h>
-namespace mpfr = __llvm_libc::testing::mpfr;
+namespace mpfr = LIBC_NAMESPACE::testing::mpfr;
-template <typename T> class FloorTest : public __llvm_libc::testing::Test {
+template <typename T> class FloorTest : public LIBC_NAMESPACE::testing::Test {
DECLARE_SPECIAL_CONSTANTS(T)
diff --git a/libc/test/src/math/FmaTest.h b/libc/test/src/math/FmaTest.h
index 3a5ed2bf3e53bfc..c2573d03792692f 100644
--- a/libc/test/src/math/FmaTest.h
+++ b/libc/test/src/math/FmaTest.h
@@ -15,25 +15,25 @@
#include "test/src/math/RandUtils.h"
#include "utils/MPFRWrapper/MPFRUtils.h"
-namespace mpfr = __llvm_libc::testing::mpfr;
+namespace mpfr = LIBC_NAMESPACE::testing::mpfr;
template <typename T>
-class FmaTestTemplate : public __llvm_libc::testing::Test {
+class FmaTestTemplate : public LIBC_NAMESPACE::testing::Test {
private:
using Func = T (*)(T, T, T);
- using FPBits = __llvm_libc::fputil::FPBits<T>;
+ using FPBits = LIBC_NAMESPACE::fputil::FPBits<T>;
using UIntType = typename FPBits::UIntType;
- const T nan = T(__llvm_libc::fputil::FPBits<T>::build_quiet_nan(1));
- const T inf = T(__llvm_libc::fputil::FPBits<T>::inf());
- const T neg_inf = T(__llvm_libc::fputil::FPBits<T>::neg_inf());
- const T zero = T(__llvm_libc::fputil::FPBits<T>::zero());
- const T neg_zero = T(__llvm_libc::fputil::FPBits<T>::neg_zero());
+ const T nan = T(LIBC_NAMESPACE::fputil::FPBits<T>::build_quiet_nan(1));
+ const T inf = T(LIBC_NAMESPACE::fputil::FPBits<T>::inf());
+ const T neg_inf = T(LIBC_NAMESPACE::fputil::FPBits<T>::neg_inf());
+ const T zero = T(LIBC_NAMESPACE::fputil::FPBits<T>::zero());
+ const T neg_zero = T(LIBC_NAMESPACE::fputil::FPBits<T>::neg_zero());
UIntType get_random_bit_pattern() {
UIntType bits{0};
for (UIntType i = 0; i < sizeof(UIntType) / 2; ++i) {
- bits =
- (bits << 2) + static_cast<uint16_t>(__llvm_libc::testutils::rand());
+ bits = (bits << 2) +
+ static_cast<uint16_t>(LIBC_NAMESPACE::testutils::rand());
}
return bits;
}
diff --git a/libc/test/src/math/FrexpTest.h b/libc/test/src/math/FrexpTest.h
index 6bfb4d276e9854b..19c98872e041167 100644
--- a/libc/test/src/math/FrexpTest.h
+++ b/libc/test/src/math/FrexpTest.h
@@ -13,14 +13,14 @@
#include <math.h>
-namespace mpfr = __llvm_libc::testing::mpfr;
+namespace mpfr = LIBC_NAMESPACE::testing::mpfr;
-template <typename T> class FrexpTest : public __llvm_libc::testing::Test {
+template <typename T> class FrexpTest : public LIBC_NAMESPACE::testing::Test {
DECLARE_SPECIAL_CONSTANTS(T)
static constexpr UIntType HIDDEN_BIT =
- UIntType(1) << __llvm_libc::fputil::MantissaWidth<T>::VALUE;
+ UIntType(1) << LIBC_NAMESPACE::fputil::MantissaWidth<T>::VALUE;
public:
typedef T (*FrexpFunc)(T, int *);
@@ -103,8 +103,8 @@ template <typename T> class FrexpTest : public __llvm_libc::testing::Test {
mpfr::BinaryOutput<T> result;
result.f = func(x, &result.i);
- ASSERT_TRUE(__llvm_libc::fputil::abs(result.f) < 1.0);
- ASSERT_TRUE(__llvm_libc::fputil::abs(result.f) >= 0.5);
+ ASSERT_TRUE(LIBC_NAMESPACE::fputil::abs(result.f) < 1.0);
+ ASSERT_TRUE(LIBC_NAMESPACE::fputil::abs(result.f) >= 0.5);
ASSERT_MPFR_MATCH(mpfr::Operation::Frexp, x, result, 0.0);
}
}
diff --git a/libc/test/src/math/HypotTest.h b/libc/test/src/math/HypotTest.h
index d1409265c6709a1..c01a771b9505fae 100644
--- a/libc/test/src/math/HypotTest.h
+++ b/libc/test/src/math/HypotTest.h
@@ -16,13 +16,13 @@
#include <math.h>
-namespace mpfr = __llvm_libc::testing::mpfr;
+namespace mpfr = LIBC_NAMESPACE::testing::mpfr;
template <typename T>
-class HypotTestTemplate : public __llvm_libc::testing::Test {
+class HypotTestTemplate : public LIBC_NAMESPACE::testing::Test {
private:
using Func = T (*)(T, T);
- using FPBits = __llvm_libc::fputil::FPBits<T>;
+ using FPBits = LIBC_NAMESPACE::fputil::FPBits<T>;
using UIntType = typename FPBits::UIntType;
const T nan = T(FPBits::build_quiet_nan(1));
const T inf = T(FPBits::inf());
diff --git a/libc/test/src/math/ILogbTest.h b/libc/test/src/math/ILogbTest.h
index 6ad5eb065c8aa44..e51a5d7a2544cdc 100644
--- a/libc/test/src/math/ILogbTest.h
+++ b/libc/test/src/math/ILogbTest.h
@@ -16,7 +16,7 @@
#include <limits.h>
-class LlvmLibcILogbTest : public __llvm_libc::testing::Test {
+class LlvmLibcILogbTest : public LIBC_NAMESPACE::testing::Test {
public:
template <typename T> struct ILogbFunc {
typedef int (*Func)(T);
@@ -24,14 +24,15 @@ class LlvmLibcILogbTest : public __llvm_libc::testing::Test {
template <typename T>
void test_special_numbers(typename ILogbFunc<T>::Func func) {
- EXPECT_EQ(FP_ILOGB0, func(T(__llvm_libc::fputil::FPBits<T>::zero())));
- EXPECT_EQ(FP_ILOGB0, func(T(__llvm_libc::fputil::FPBits<T>::neg_zero())));
+ EXPECT_EQ(FP_ILOGB0, func(T(LIBC_NAMESPACE::fputil::FPBits<T>::zero())));
+ EXPECT_EQ(FP_ILOGB0,
+ func(T(LIBC_NAMESPACE::fputil::FPBits<T>::neg_zero())));
EXPECT_EQ(FP_ILOGBNAN,
- func(T(__llvm_libc::fputil::FPBits<T>::build_quiet_nan(1))));
+ func(T(LIBC_NAMESPACE::fputil::FPBits<T>::build_quiet_nan(1))));
- EXPECT_EQ(INT_MAX, func(T(__llvm_libc::fputil::FPBits<T>::inf())));
- EXPECT_EQ(INT_MAX, func(T(__llvm_libc::fputil::FPBits<T>::neg_inf())));
+ EXPECT_EQ(INT_MAX, func(T(LIBC_NAMESPACE::fputil::FPBits<T>::inf())));
+ EXPECT_EQ(INT_MAX, func(T(LIBC_NAMESPACE::fputil::FPBits<T>::neg_inf())));
}
template <typename T>
@@ -75,7 +76,7 @@ class LlvmLibcILogbTest : public __llvm_libc::testing::Test {
template <typename T>
void test_subnormal_range(typename ILogbFunc<T>::Func func) {
- using FPBits = __llvm_libc::fputil::FPBits<T>;
+ using FPBits = LIBC_NAMESPACE::fputil::FPBits<T>;
using UIntType = typename FPBits::UIntType;
constexpr UIntType COUNT = 10'001;
constexpr UIntType STEP =
@@ -88,14 +89,14 @@ class LlvmLibcILogbTest : public __llvm_libc::testing::Test {
continue;
int exponent;
- __llvm_libc::fputil::frexp(x, exponent);
+ LIBC_NAMESPACE::fputil::frexp(x, exponent);
ASSERT_EQ(exponent, func(x) + 1);
}
}
template <typename T>
void test_normal_range(typename ILogbFunc<T>::Func func) {
- using FPBits = __llvm_libc::fputil::FPBits<T>;
+ using FPBits = LIBC_NAMESPACE::fputil::FPBits<T>;
using UIntType = typename FPBits::UIntType;
constexpr UIntType COUNT = 10'001;
constexpr UIntType STEP =
@@ -106,7 +107,7 @@ class LlvmLibcILogbTest : public __llvm_libc::testing::Test {
continue;
int exponent;
- __llvm_libc::fputil::frexp(x, exponent);
+ LIBC_NAMESPACE::fputil::frexp(x, exponent);
ASSERT_EQ(exponent, func(x) + 1);
}
}
diff --git a/libc/test/src/math/LdExpTest.h b/libc/test/src/math/LdExpTest.h
index 2e592995ae792e9..bffa7335fb25b17 100644
--- a/libc/test/src/math/LdExpTest.h
+++ b/libc/test/src/math/LdExpTest.h
@@ -19,20 +19,20 @@
#include <stdint.h>
template <typename T>
-class LdExpTestTemplate : public __llvm_libc::testing::Test {
- using FPBits = __llvm_libc::fputil::FPBits<T>;
- using NormalFloat = __llvm_libc::fputil::NormalFloat<T>;
+class LdExpTestTemplate : public LIBC_NAMESPACE::testing::Test {
+ using FPBits = LIBC_NAMESPACE::fputil::FPBits<T>;
+ using NormalFloat = LIBC_NAMESPACE::fputil::NormalFloat<T>;
using UIntType = typename FPBits::UIntType;
static constexpr UIntType MANTISSA_WIDTH =
- __llvm_libc::fputil::MantissaWidth<T>::VALUE;
+ LIBC_NAMESPACE::fputil::MantissaWidth<T>::VALUE;
// A normalized mantissa to be used with tests.
static constexpr UIntType MANTISSA = NormalFloat::ONE + 0x1234;
- const T zero = T(__llvm_libc::fputil::FPBits<T>::zero());
- const T neg_zero = T(__llvm_libc::fputil::FPBits<T>::neg_zero());
- const T inf = T(__llvm_libc::fputil::FPBits<T>::inf());
- const T neg_inf = T(__llvm_libc::fputil::FPBits<T>::neg_inf());
- const T nan = T(__llvm_libc::fputil::FPBits<T>::build_quiet_nan(1));
+ const T zero = T(LIBC_NAMESPACE::fputil::FPBits<T>::zero());
+ const T neg_zero = T(LIBC_NAMESPACE::fputil::FPBits<T>::neg_zero());
+ const T inf = T(LIBC_NAMESPACE::fputil::FPBits<T>::inf());
+ const T neg_inf = T(LIBC_NAMESPACE::fputil::FPBits<T>::neg_inf());
+ const T nan = T(LIBC_NAMESPACE::fputil::FPBits<T>::build_quiet_nan(1));
public:
typedef T (*LdExpFunc)(T, int);
diff --git a/libc/test/src/math/LogbTest.h b/libc/test/src/math/LogbTest.h
index b4a17fd9b0c34fa..c2cf4f1f1483336 100644
--- a/libc/test/src/math/LogbTest.h
+++ b/libc/test/src/math/LogbTest.h
@@ -13,14 +13,14 @@
#include <math.h>
-namespace mpfr = __llvm_libc::testing::mpfr;
+namespace mpfr = LIBC_NAMESPACE::testing::mpfr;
-template <typename T> class LogbTest : public __llvm_libc::testing::Test {
+template <typename T> class LogbTest : public LIBC_NAMESPACE::testing::Test {
DECLARE_SPECIAL_CONSTANTS(T)
static constexpr UIntType HIDDEN_BIT =
- UIntType(1) << __llvm_libc::fputil::MantissaWidth<T>::VALUE;
+ UIntType(1) << LIBC_NAMESPACE::fputil::MantissaWidth<T>::VALUE;
public:
typedef T (*LogbFunc)(T);
@@ -80,7 +80,7 @@ template <typename T> class LogbTest : public __llvm_libc::testing::Test {
continue;
int exponent;
- __llvm_libc::fputil::frexp(x, exponent);
+ LIBC_NAMESPACE::fputil::frexp(x, exponent);
ASSERT_FP_EQ(T(exponent), func(x) + T(1.0));
}
}
diff --git a/libc/test/src/math/ModfTest.h b/libc/test/src/math/ModfTest.h
index e4596c232287a37..21adef8a08d8d49 100644
--- a/libc/test/src/math/ModfTest.h
+++ b/libc/test/src/math/ModfTest.h
@@ -14,9 +14,9 @@
#include <math.h>
-namespace mpfr = __llvm_libc::testing::mpfr;
+namespace mpfr = LIBC_NAMESPACE::testing::mpfr;
-template <typename T> class ModfTest : public __llvm_libc::testing::Test {
+template <typename T> class ModfTest : public LIBC_NAMESPACE::testing::Test {
DECLARE_SPECIAL_CONSTANTS(T)
@@ -93,8 +93,8 @@ template <typename T> class ModfTest : public __llvm_libc::testing::Test {
T integral;
T frac = func(x, &integral);
- ASSERT_TRUE(__llvm_libc::fputil::abs(frac) < 1.0l);
- ASSERT_TRUE(__llvm_libc::fputil::trunc(x) == integral);
+ ASSERT_TRUE(LIBC_NAMESPACE::fputil::abs(frac) < 1.0l);
+ ASSERT_TRUE(LIBC_NAMESPACE::fputil::trunc(x) == integral);
ASSERT_TRUE(integral + frac == x);
}
}
diff --git a/libc/test/src/math/NextAfterTest.h b/libc/test/src/math/NextAfterTest.h
index e6de9419d990401..4e450cf5bc1e9e7 100644
--- a/libc/test/src/math/NextAfterTest.h
+++ b/libc/test/src/math/NextAfterTest.h
@@ -18,13 +18,13 @@
#include <math.h>
template <typename T>
-class NextAfterTestTemplate : public __llvm_libc::testing::Test {
- using FPBits = __llvm_libc::fputil::FPBits<T>;
- using MantissaWidth = __llvm_libc::fputil::MantissaWidth<T>;
+class NextAfterTestTemplate : public LIBC_NAMESPACE::testing::Test {
+ using FPBits = LIBC_NAMESPACE::fputil::FPBits<T>;
+ using MantissaWidth = LIBC_NAMESPACE::fputil::MantissaWidth<T>;
using UIntType = typename FPBits::UIntType;
static constexpr int BIT_WIDTH_OF_TYPE =
- __llvm_libc::fputil::FloatProperties<T>::BIT_WIDTH;
+ LIBC_NAMESPACE::fputil::FloatProperties<T>::BIT_WIDTH;
const T zero = T(FPBits::zero());
const T neg_zero = T(FPBits::neg_zero());
@@ -52,54 +52,54 @@ class NextAfterTestTemplate : public __llvm_libc::testing::Test {
T x = zero;
T result = func(x, T(1));
UIntType expected_bits = 1;
- T expected = __llvm_libc::cpp::bit_cast<T>(expected_bits);
+ T expected = LIBC_NAMESPACE::cpp::bit_cast<T>(expected_bits);
ASSERT_FP_EQ(result, expected);
result = func(x, T(-1));
expected_bits = (UIntType(1) << (BIT_WIDTH_OF_TYPE - 1)) + 1;
- expected = __llvm_libc::cpp::bit_cast<T>(expected_bits);
+ expected = LIBC_NAMESPACE::cpp::bit_cast<T>(expected_bits);
ASSERT_FP_EQ(result, expected);
x = neg_zero;
result = func(x, 1);
expected_bits = 1;
- expected = __llvm_libc::cpp::bit_cast<T>(expected_bits);
+ expected = LIBC_NAMESPACE::cpp::bit_cast<T>(expected_bits);
ASSERT_FP_EQ(result, expected);
result = func(x, -1);
expected_bits = (UIntType(1) << (BIT_WIDTH_OF_TYPE - 1)) + 1;
- expected = __llvm_libc::cpp::bit_cast<T>(expected_bits);
+ expected = LIBC_NAMESPACE::cpp::bit_cast<T>(expected_bits);
ASSERT_FP_EQ(result, expected);
// 'from' is max subnormal value.
- x = __llvm_libc::cpp::bit_cast<T>(max_subnormal);
+ x = LIBC_NAMESPACE::cpp::bit_cast<T>(max_subnormal);
result = func(x, 1);
- expected = __llvm_libc::cpp::bit_cast<T>(min_normal);
+ expected = LIBC_NAMESPACE::cpp::bit_cast<T>(min_normal);
ASSERT_FP_EQ(result, expected);
result = func(x, 0);
expected_bits = max_subnormal - 1;
- expected = __llvm_libc::cpp::bit_cast<T>(expected_bits);
+ expected = LIBC_NAMESPACE::cpp::bit_cast<T>(expected_bits);
ASSERT_FP_EQ(result, expected);
x = -x;
result = func(x, -1);
expected_bits = (UIntType(1) << (BIT_WIDTH_OF_TYPE - 1)) + min_normal;
- expected = __llvm_libc::cpp::bit_cast<T>(expected_bits);
+ expected = LIBC_NAMESPACE::cpp::bit_cast<T>(expected_bits);
ASSERT_FP_EQ(result, expected);
result = func(x, 0);
expected_bits =
(UIntType(1) << (BIT_WIDTH_OF_TYPE - 1)) + max_subnormal - 1;
- expected = __llvm_libc::cpp::bit_cast<T>(expected_bits);
+ expected = LIBC_NAMESPACE::cpp::bit_cast<T>(expected_bits);
ASSERT_FP_EQ(result, expected);
// 'from' is min subnormal value.
- x = __llvm_libc::cpp::bit_cast<T>(min_subnormal);
+ x = LIBC_NAMESPACE::cpp::bit_cast<T>(min_subnormal);
result = func(x, 1);
expected_bits = min_subnormal + 1;
- expected = __llvm_libc::cpp::bit_cast<T>(expected_bits);
+ expected = LIBC_NAMESPACE::cpp::bit_cast<T>(expected_bits);
ASSERT_FP_EQ(result, expected);
ASSERT_FP_EQ(func(x, 0), 0);
@@ -107,35 +107,35 @@ class NextAfterTestTemplate : public __llvm_libc::testing::Test {
result = func(x, -1);
expected_bits =
(UIntType(1) << (BIT_WIDTH_OF_TYPE - 1)) + min_subnormal + 1;
- expected = __llvm_libc::cpp::bit_cast<T>(expected_bits);
+ expected = LIBC_NAMESPACE::cpp::bit_cast<T>(expected_bits);
ASSERT_FP_EQ(result, expected);
ASSERT_FP_EQ(func(x, 0), T(-0.0));
// 'from' is min normal.
- x = __llvm_libc::cpp::bit_cast<T>(min_normal);
+ x = LIBC_NAMESPACE::cpp::bit_cast<T>(min_normal);
result = func(x, 0);
expected_bits = max_subnormal;
- expected = __llvm_libc::cpp::bit_cast<T>(expected_bits);
+ expected = LIBC_NAMESPACE::cpp::bit_cast<T>(expected_bits);
ASSERT_FP_EQ(result, expected);
result = func(x, inf);
expected_bits = min_normal + 1;
- expected = __llvm_libc::cpp::bit_cast<T>(expected_bits);
+ expected = LIBC_NAMESPACE::cpp::bit_cast<T>(expected_bits);
ASSERT_FP_EQ(result, expected);
x = -x;
result = func(x, 0);
expected_bits = (UIntType(1) << (BIT_WIDTH_OF_TYPE - 1)) + max_subnormal;
- expected = __llvm_libc::cpp::bit_cast<T>(expected_bits);
+ expected = LIBC_NAMESPACE::cpp::bit_cast<T>(expected_bits);
ASSERT_FP_EQ(result, expected);
result = func(x, -inf);
expected_bits = (UIntType(1) << (BIT_WIDTH_OF_TYPE - 1)) + min_normal + 1;
- expected = __llvm_libc::cpp::bit_cast<T>(expected_bits);
+ expected = LIBC_NAMESPACE::cpp::bit_cast<T>(expected_bits);
ASSERT_FP_EQ(result, expected);
// 'from' is max normal and 'to' is infinity.
- x = __llvm_libc::cpp::bit_cast<T>(max_normal);
+ x = LIBC_NAMESPACE::cpp::bit_cast<T>(max_normal);
result = func(x, inf);
ASSERT_FP_EQ(result, inf);
@@ -146,14 +146,14 @@ class NextAfterTestTemplate : public __llvm_libc::testing::Test {
x = inf;
result = func(x, 0);
expected_bits = max_normal;
- expected = __llvm_libc::cpp::bit_cast<T>(expected_bits);
+ expected = LIBC_NAMESPACE::cpp::bit_cast<T>(expected_bits);
ASSERT_FP_EQ(result, expected);
ASSERT_FP_EQ(func(x, inf), inf);
x = neg_inf;
result = func(x, 0);
expected_bits = (UIntType(1) << (BIT_WIDTH_OF_TYPE - 1)) + max_normal;
- expected = __llvm_libc::cpp::bit_cast<T>(expected_bits);
+ expected = LIBC_NAMESPACE::cpp::bit_cast<T>(expected_bits);
ASSERT_FP_EQ(result, expected);
ASSERT_FP_EQ(func(x, neg_inf), neg_inf);
diff --git a/libc/test/src/math/RIntTest.h b/libc/test/src/math/RIntTest.h
index b18123139d8cac1..272112142e21e0f 100644
--- a/libc/test/src/math/RIntTest.h
+++ b/libc/test/src/math/RIntTest.h
@@ -19,18 +19,18 @@
#include <math.h>
#include <stdio.h>
-namespace mpfr = __llvm_libc::testing::mpfr;
+namespace mpfr = LIBC_NAMESPACE::testing::mpfr;
static constexpr int ROUNDING_MODES[4] = {FE_UPWARD, FE_DOWNWARD, FE_TOWARDZERO,
FE_TONEAREST};
template <typename T>
-class RIntTestTemplate : public __llvm_libc::testing::Test {
+class RIntTestTemplate : public LIBC_NAMESPACE::testing::Test {
public:
typedef T (*RIntFunc)(T);
private:
- using FPBits = __llvm_libc::fputil::FPBits<T>;
+ using FPBits = LIBC_NAMESPACE::fputil::FPBits<T>;
using UIntType = typename FPBits::UIntType;
const T zero = T(FPBits::zero());
@@ -57,7 +57,7 @@ class RIntTestTemplate : public __llvm_libc::testing::Test {
public:
void testSpecialNumbers(RIntFunc func) {
for (int mode : ROUNDING_MODES) {
- __llvm_libc::fputil::set_round(mode);
+ LIBC_NAMESPACE::fputil::set_round(mode);
ASSERT_FP_EQ(inf, func(inf));
ASSERT_FP_EQ(neg_inf, func(neg_inf));
ASSERT_FP_EQ(nan, func(nan));
@@ -68,7 +68,7 @@ class RIntTestTemplate : public __llvm_libc::testing::Test {
void testRoundNumbers(RIntFunc func) {
for (int mode : ROUNDING_MODES) {
- __llvm_libc::fputil::set_round(mode);
+ LIBC_NAMESPACE::fputil::set_round(mode);
mpfr::RoundingMode mpfr_mode = to_mpfr_rounding_mode(mode);
ASSERT_FP_EQ(func(T(1.0)), mpfr::round(T(1.0), mpfr_mode));
ASSERT_FP_EQ(func(T(-1.0)), mpfr::round(T(-1.0), mpfr_mode));
@@ -81,7 +81,7 @@ class RIntTestTemplate : public __llvm_libc::testing::Test {
void testFractions(RIntFunc func) {
for (int mode : ROUNDING_MODES) {
- __llvm_libc::fputil::set_round(mode);
+ LIBC_NAMESPACE::fputil::set_round(mode);
mpfr::RoundingMode mpfr_mode = to_mpfr_rounding_mode(mode);
ASSERT_FP_EQ(func(T(0.5)), mpfr::round(T(0.5), mpfr_mode));
ASSERT_FP_EQ(func(T(-0.5)), mpfr::round(T(-0.5), mpfr_mode));
@@ -101,7 +101,7 @@ class RIntTestTemplate : public __llvm_libc::testing::Test {
i += STEP) {
T x = T(FPBits(i));
for (int mode : ROUNDING_MODES) {
- __llvm_libc::fputil::set_round(mode);
+ LIBC_NAMESPACE::fputil::set_round(mode);
mpfr::RoundingMode mpfr_mode = to_mpfr_rounding_mode(mode);
ASSERT_FP_EQ(func(x), mpfr::round(x, mpfr_mode));
}
@@ -121,7 +121,7 @@ class RIntTestTemplate : public __llvm_libc::testing::Test {
}
for (int mode : ROUNDING_MODES) {
- __llvm_libc::fputil::set_round(mode);
+ LIBC_NAMESPACE::fputil::set_round(mode);
mpfr::RoundingMode mpfr_mode = to_mpfr_rounding_mode(mode);
ASSERT_FP_EQ(func(x), mpfr::round(x, mpfr_mode));
}
diff --git a/libc/test/src/math/RandUtils.cpp b/libc/test/src/math/RandUtils.cpp
index 0ccc62327f05910..0d09764f6056d6e 100644
--- a/libc/test/src/math/RandUtils.cpp
+++ b/libc/test/src/math/RandUtils.cpp
@@ -10,10 +10,10 @@
#include <cstdlib>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
namespace testutils {
int rand() { return std::rand(); }
} // namespace testutils
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/test/src/math/RandUtils.h b/libc/test/src/math/RandUtils.h
index b65a98bfed21d95..05236ead2aced19 100644
--- a/libc/test/src/math/RandUtils.h
+++ b/libc/test/src/math/RandUtils.h
@@ -6,11 +6,11 @@
//
//===----------------------------------------------------------------------===//
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
namespace testutils {
// Wrapper for std::rand.
int rand();
} // namespace testutils
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/test/src/math/RemQuoTest.h b/libc/test/src/math/RemQuoTest.h
index 5766beff2cebacb..6da0756c3a1b3de 100644
--- a/libc/test/src/math/RemQuoTest.h
+++ b/libc/test/src/math/RemQuoTest.h
@@ -16,18 +16,18 @@
#include "utils/MPFRWrapper/MPFRUtils.h"
#include <math.h>
-namespace mpfr = __llvm_libc::testing::mpfr;
+namespace mpfr = LIBC_NAMESPACE::testing::mpfr;
template <typename T>
-class RemQuoTestTemplate : public __llvm_libc::testing::Test {
- using FPBits = __llvm_libc::fputil::FPBits<T>;
+class RemQuoTestTemplate : public LIBC_NAMESPACE::testing::Test {
+ using FPBits = LIBC_NAMESPACE::fputil::FPBits<T>;
using UIntType = typename FPBits::UIntType;
- const T zero = T(__llvm_libc::fputil::FPBits<T>::zero());
- const T neg_zero = T(__llvm_libc::fputil::FPBits<T>::neg_zero());
- const T inf = T(__llvm_libc::fputil::FPBits<T>::inf());
- const T neg_inf = T(__llvm_libc::fputil::FPBits<T>::neg_inf());
- const T nan = T(__llvm_libc::fputil::FPBits<T>::build_quiet_nan(1));
+ const T zero = T(LIBC_NAMESPACE::fputil::FPBits<T>::zero());
+ const T neg_zero = T(LIBC_NAMESPACE::fputil::FPBits<T>::neg_zero());
+ const T inf = T(LIBC_NAMESPACE::fputil::FPBits<T>::inf());
+ const T neg_inf = T(LIBC_NAMESPACE::fputil::FPBits<T>::neg_inf());
+ const T nan = T(LIBC_NAMESPACE::fputil::FPBits<T>::build_quiet_nan(1));
public:
typedef T (*RemQuoFunc)(T, T, int *);
diff --git a/libc/test/src/math/RoundTest.h b/libc/test/src/math/RoundTest.h
index 0e104e22444b584..e99491ccf380f85 100644
--- a/libc/test/src/math/RoundTest.h
+++ b/libc/test/src/math/RoundTest.h
@@ -12,9 +12,9 @@
#include <math.h>
-namespace mpfr = __llvm_libc::testing::mpfr;
+namespace mpfr = LIBC_NAMESPACE::testing::mpfr;
-template <typename T> class RoundTest : public __llvm_libc::testing::Test {
+template <typename T> class RoundTest : public LIBC_NAMESPACE::testing::Test {
DECLARE_SPECIAL_CONSTANTS(T)
diff --git a/libc/test/src/math/RoundToIntegerTest.h b/libc/test/src/math/RoundToIntegerTest.h
index a7b85edac63721c..6b205869e7a7a7a 100644
--- a/libc/test/src/math/RoundToIntegerTest.h
+++ b/libc/test/src/math/RoundToIntegerTest.h
@@ -18,32 +18,32 @@
#include <errno.h>
#include <math.h>
-namespace mpfr = __llvm_libc::testing::mpfr;
+namespace mpfr = LIBC_NAMESPACE::testing::mpfr;
static constexpr int ROUNDING_MODES[4] = {FE_UPWARD, FE_DOWNWARD, FE_TOWARDZERO,
FE_TONEAREST};
template <typename F, typename I, bool TestModes = false>
-class RoundToIntegerTestTemplate : public __llvm_libc::testing::Test {
+class RoundToIntegerTestTemplate : public LIBC_NAMESPACE::testing::Test {
public:
typedef I (*RoundToIntegerFunc)(F);
private:
- using FPBits = __llvm_libc::fputil::FPBits<F>;
+ using FPBits = LIBC_NAMESPACE::fputil::FPBits<F>;
using UIntType = typename FPBits::UIntType;
- const F zero = F(__llvm_libc::fputil::FPBits<F>::zero());
- const F neg_zero = F(__llvm_libc::fputil::FPBits<F>::neg_zero());
- const F inf = F(__llvm_libc::fputil::FPBits<F>::inf());
- const F neg_inf = F(__llvm_libc::fputil::FPBits<F>::neg_inf());
- const F nan = F(__llvm_libc::fputil::FPBits<F>::build_quiet_nan(1));
+ const F zero = F(LIBC_NAMESPACE::fputil::FPBits<F>::zero());
+ const F neg_zero = F(LIBC_NAMESPACE::fputil::FPBits<F>::neg_zero());
+ const F inf = F(LIBC_NAMESPACE::fputil::FPBits<F>::inf());
+ const F neg_inf = F(LIBC_NAMESPACE::fputil::FPBits<F>::neg_inf());
+ const F nan = F(LIBC_NAMESPACE::fputil::FPBits<F>::build_quiet_nan(1));
static constexpr I INTEGER_MIN = I(1) << (sizeof(I) * 8 - 1);
static constexpr I INTEGER_MAX = -(INTEGER_MIN + 1);
void test_one_input(RoundToIntegerFunc func, F input, I expected,
bool expectError) {
libc_errno = 0;
- __llvm_libc::fputil::clear_except(FE_ALL_EXCEPT);
+ LIBC_NAMESPACE::fputil::clear_except(FE_ALL_EXCEPT);
ASSERT_EQ(func(input), expected);
@@ -77,7 +77,7 @@ class RoundToIntegerTestTemplate : public __llvm_libc::testing::Test {
// We will disable all exceptions so that the test will not
// crash with SIGFPE. We can still use fetestexcept to check
// if the appropriate flag was raised.
- __llvm_libc::fputil::disable_except(FE_ALL_EXCEPT);
+ LIBC_NAMESPACE::fputil::disable_except(FE_ALL_EXCEPT);
}
}
@@ -96,7 +96,7 @@ class RoundToIntegerTestTemplate : public __llvm_libc::testing::Test {
void testInfinityAndNaN(RoundToIntegerFunc func) {
if (TestModes) {
for (int mode : ROUNDING_MODES) {
- __llvm_libc::fputil::set_round(mode);
+ LIBC_NAMESPACE::fputil::set_round(mode);
do_infinity_and_na_n_test(func);
}
} else {
@@ -140,7 +140,7 @@ class RoundToIntegerTestTemplate : public __llvm_libc::testing::Test {
void testRoundNumbers(RoundToIntegerFunc func) {
if (TestModes) {
for (int mode : ROUNDING_MODES) {
- __llvm_libc::fputil::set_round(mode);
+ LIBC_NAMESPACE::fputil::set_round(mode);
do_round_numbers_test(func);
}
} else {
@@ -167,7 +167,7 @@ class RoundToIntegerTestTemplate : public __llvm_libc::testing::Test {
void testFractions(RoundToIntegerFunc func) {
if (TestModes) {
for (int mode : ROUNDING_MODES) {
- __llvm_libc::fputil::set_round(mode);
+ LIBC_NAMESPACE::fputil::set_round(mode);
do_fractions_test(func, mode);
}
} else {
@@ -193,12 +193,12 @@ class RoundToIntegerTestTemplate : public __llvm_libc::testing::Test {
bits.set_unbiased_exponent(EXPONENT_LIMIT + FPBits::EXPONENT_BIAS);
bits.set_sign(1);
bits.set_mantissa(UIntType(0x1)
- << (__llvm_libc::fputil::MantissaWidth<F>::VALUE - 1));
+ << (LIBC_NAMESPACE::fputil::MantissaWidth<F>::VALUE - 1));
F x = F(bits);
if (TestModes) {
for (int m : ROUNDING_MODES) {
- __llvm_libc::fputil::set_round(m);
+ LIBC_NAMESPACE::fputil::set_round(m);
long mpfr_long_result;
bool erangeflag =
mpfr::round_to_long(x, to_mpfr_rounding_mode(m), mpfr_long_result);
@@ -226,22 +226,22 @@ class RoundToIntegerTestTemplate : public __llvm_libc::testing::Test {
// All subnormal numbers should round to zero.
if (TestModes) {
if (x > 0) {
- __llvm_libc::fputil::set_round(FE_UPWARD);
+ LIBC_NAMESPACE::fputil::set_round(FE_UPWARD);
test_one_input(func, x, I(1), false);
- __llvm_libc::fputil::set_round(FE_DOWNWARD);
+ LIBC_NAMESPACE::fputil::set_round(FE_DOWNWARD);
test_one_input(func, x, I(0), false);
- __llvm_libc::fputil::set_round(FE_TOWARDZERO);
+ LIBC_NAMESPACE::fputil::set_round(FE_TOWARDZERO);
test_one_input(func, x, I(0), false);
- __llvm_libc::fputil::set_round(FE_TONEAREST);
+ LIBC_NAMESPACE::fputil::set_round(FE_TONEAREST);
test_one_input(func, x, I(0), false);
} else {
- __llvm_libc::fputil::set_round(FE_UPWARD);
+ LIBC_NAMESPACE::fputil::set_round(FE_UPWARD);
test_one_input(func, x, I(0), false);
- __llvm_libc::fputil::set_round(FE_DOWNWARD);
+ LIBC_NAMESPACE::fputil::set_round(FE_DOWNWARD);
test_one_input(func, x, I(-1), false);
- __llvm_libc::fputil::set_round(FE_TOWARDZERO);
+ LIBC_NAMESPACE::fputil::set_round(FE_TOWARDZERO);
test_one_input(func, x, I(0), false);
- __llvm_libc::fputil::set_round(FE_TONEAREST);
+ LIBC_NAMESPACE::fputil::set_round(FE_TONEAREST);
test_one_input(func, x, I(0), false);
}
} else {
@@ -276,7 +276,7 @@ class RoundToIntegerTestTemplate : public __llvm_libc::testing::Test {
bool erangeflag = mpfr::round_to_long(x, to_mpfr_rounding_mode(m),
mpfr_long_result);
I mpfr_result = mpfr_long_result;
- __llvm_libc::fputil::set_round(m);
+ LIBC_NAMESPACE::fputil::set_round(m);
if (erangeflag)
test_one_input(func, x, x > 0 ? INTEGER_MAX : INTEGER_MIN, true);
else
diff --git a/libc/test/src/math/SqrtTest.h b/libc/test/src/math/SqrtTest.h
index f73a14ac4c19d36..24f14b78d2f0f5d 100644
--- a/libc/test/src/math/SqrtTest.h
+++ b/libc/test/src/math/SqrtTest.h
@@ -13,14 +13,14 @@
#include <math.h>
-namespace mpfr = __llvm_libc::testing::mpfr;
+namespace mpfr = LIBC_NAMESPACE::testing::mpfr;
-template <typename T> class SqrtTest : public __llvm_libc::testing::Test {
+template <typename T> class SqrtTest : public LIBC_NAMESPACE::testing::Test {
DECLARE_SPECIAL_CONSTANTS(T)
static constexpr UIntType HIDDEN_BIT =
- UIntType(1) << __llvm_libc::fputil::MantissaWidth<T>::VALUE;
+ UIntType(1) << LIBC_NAMESPACE::fputil::MantissaWidth<T>::VALUE;
public:
typedef T (*SqrtFunc)(T);
@@ -48,7 +48,7 @@ template <typename T> class SqrtTest : public __llvm_libc::testing::Test {
constexpr UIntType COUNT = 200'001;
constexpr UIntType STEP = HIDDEN_BIT / COUNT;
for (UIntType i = 0, v = 0; i <= COUNT; ++i, v += STEP) {
- T x = __llvm_libc::cpp::bit_cast<T>(v);
+ T x = LIBC_NAMESPACE::cpp::bit_cast<T>(v);
EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Sqrt, x, func(x), 0.5);
}
}
@@ -57,7 +57,7 @@ template <typename T> class SqrtTest : public __llvm_libc::testing::Test {
constexpr UIntType COUNT = 200'001;
constexpr UIntType STEP = UIntType(-1) / COUNT;
for (UIntType i = 0, v = 0; i <= COUNT; ++i, v += STEP) {
- T x = __llvm_libc::cpp::bit_cast<T>(v);
+ T x = LIBC_NAMESPACE::cpp::bit_cast<T>(v);
if (isnan(x) || (x < 0)) {
continue;
}
diff --git a/libc/test/src/math/TruncTest.h b/libc/test/src/math/TruncTest.h
index 7d9e1cbb5ae2fc5..fa29ee1ce8c3a4d 100644
--- a/libc/test/src/math/TruncTest.h
+++ b/libc/test/src/math/TruncTest.h
@@ -12,9 +12,9 @@
#include <math.h>
-namespace mpfr = __llvm_libc::testing::mpfr;
+namespace mpfr = LIBC_NAMESPACE::testing::mpfr;
-template <typename T> class TruncTest : public __llvm_libc::testing::Test {
+template <typename T> class TruncTest : public LIBC_NAMESPACE::testing::Test {
DECLARE_SPECIAL_CONSTANTS(T)
diff --git a/libc/test/src/math/acosf_test.cpp b/libc/test/src/math/acosf_test.cpp
index 63895ec3e30aefb..cb1a07448b471fc 100644
--- a/libc/test/src/math/acosf_test.cpp
+++ b/libc/test/src/math/acosf_test.cpp
@@ -17,31 +17,31 @@
#include <errno.h>
#include <stdint.h>
-using FPBits = __llvm_libc::fputil::FPBits<float>;
+using FPBits = LIBC_NAMESPACE::fputil::FPBits<float>;
-namespace mpfr = __llvm_libc::testing::mpfr;
+namespace mpfr = LIBC_NAMESPACE::testing::mpfr;
DECLARE_SPECIAL_CONSTANTS(float)
TEST(LlvmLibcAcosfTest, SpecialNumbers) {
libc_errno = 0;
- EXPECT_FP_EQ_ALL_ROUNDING(aNaN, __llvm_libc::acosf(aNaN));
+ EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::acosf(aNaN));
EXPECT_MATH_ERRNO(0);
- EXPECT_FP_EQ_ALL_ROUNDING(aNaN, __llvm_libc::acosf(inf));
+ EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::acosf(inf));
EXPECT_MATH_ERRNO(EDOM);
- EXPECT_FP_EQ_ALL_ROUNDING(aNaN, __llvm_libc::acosf(neg_inf));
+ EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::acosf(neg_inf));
EXPECT_MATH_ERRNO(EDOM);
- EXPECT_FP_EQ_ALL_ROUNDING(zero, __llvm_libc::acosf(1.0f));
+ EXPECT_FP_EQ_ALL_ROUNDING(zero, LIBC_NAMESPACE::acosf(1.0f));
EXPECT_MATH_ERRNO(0);
- EXPECT_FP_EQ_ALL_ROUNDING(aNaN, __llvm_libc::acosf(2.0f));
+ EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::acosf(2.0f));
EXPECT_MATH_ERRNO(EDOM);
- EXPECT_FP_EQ_ALL_ROUNDING(aNaN, __llvm_libc::acosf(-2.0f));
+ EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::acosf(-2.0f));
EXPECT_MATH_ERRNO(EDOM);
}
@@ -53,7 +53,7 @@ TEST(LlvmLibcAcosfTest, InFloatRange) {
if (isnan(x) || isinf(x))
continue;
ASSERT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Acos, x,
- __llvm_libc::acosf(x), 0.5);
+ LIBC_NAMESPACE::acosf(x), 0.5);
}
}
@@ -78,8 +78,8 @@ TEST(LlvmLibcAcosfTest, SpecificBitPatterns) {
for (int i = 0; i < N; ++i) {
float x = float(FPBits(INPUTS[i]));
EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Acos, x,
- __llvm_libc::acosf(x), 0.5);
+ LIBC_NAMESPACE::acosf(x), 0.5);
EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Acos, -x,
- __llvm_libc::acosf(-x), 0.5);
+ LIBC_NAMESPACE::acosf(-x), 0.5);
}
}
diff --git a/libc/test/src/math/acoshf_test.cpp b/libc/test/src/math/acoshf_test.cpp
index 895503c6bc73cdc..846f5033fb39a09 100644
--- a/libc/test/src/math/acoshf_test.cpp
+++ b/libc/test/src/math/acoshf_test.cpp
@@ -17,28 +17,28 @@
#include <errno.h>
#include <stdint.h>
-using FPBits_t = __llvm_libc::fputil::FPBits<float>;
+using FPBits_t = LIBC_NAMESPACE::fputil::FPBits<float>;
-namespace mpfr = __llvm_libc::testing::mpfr;
+namespace mpfr = LIBC_NAMESPACE::testing::mpfr;
DECLARE_SPECIAL_CONSTANTS(float)
TEST(LlvmLibcAcoshfTest, SpecialNumbers) {
libc_errno = 0;
- EXPECT_FP_EQ_ALL_ROUNDING(aNaN, __llvm_libc::acoshf(aNaN));
+ EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::acoshf(aNaN));
EXPECT_MATH_ERRNO(0);
- EXPECT_FP_EQ_ALL_ROUNDING(aNaN, __llvm_libc::acoshf(0.0f));
+ EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::acoshf(0.0f));
EXPECT_MATH_ERRNO(EDOM);
- EXPECT_FP_EQ_ALL_ROUNDING(0.0f, __llvm_libc::acoshf(1.0f));
+ EXPECT_FP_EQ_ALL_ROUNDING(0.0f, LIBC_NAMESPACE::acoshf(1.0f));
EXPECT_MATH_ERRNO(0);
- EXPECT_FP_EQ_ALL_ROUNDING(inf, __llvm_libc::acoshf(inf));
+ EXPECT_FP_EQ_ALL_ROUNDING(inf, LIBC_NAMESPACE::acoshf(inf));
EXPECT_MATH_ERRNO(0);
- EXPECT_FP_EQ_ALL_ROUNDING(aNaN, __llvm_libc::acoshf(neg_inf));
+ EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::acoshf(neg_inf));
EXPECT_MATH_ERRNO(EDOM);
}
@@ -50,7 +50,7 @@ TEST(LlvmLibcAcoshfTest, InFloatRange) {
if (isnan(x) || isinf(x))
continue;
ASSERT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Acosh, x,
- __llvm_libc::acoshf(x), 0.5);
+ LIBC_NAMESPACE::acoshf(x), 0.5);
}
}
@@ -74,6 +74,6 @@ TEST(LlvmLibcAcoshfTest, SpecificBitPatterns) {
for (int i = 0; i < N; ++i) {
float x = float(FPBits_t(INPUTS[i]));
EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Acosh, x,
- __llvm_libc::acoshf(x), 0.5);
+ LIBC_NAMESPACE::acoshf(x), 0.5);
}
}
diff --git a/libc/test/src/math/asinf_test.cpp b/libc/test/src/math/asinf_test.cpp
index cc99e5b7b6cac8f..49dcd38e82bf59d 100644
--- a/libc/test/src/math/asinf_test.cpp
+++ b/libc/test/src/math/asinf_test.cpp
@@ -18,28 +18,28 @@
#include <errno.h>
#include <stdint.h>
-using FPBits = __llvm_libc::fputil::FPBits<float>;
+using FPBits = LIBC_NAMESPACE::fputil::FPBits<float>;
-namespace mpfr = __llvm_libc::testing::mpfr;
+namespace mpfr = LIBC_NAMESPACE::testing::mpfr;
DECLARE_SPECIAL_CONSTANTS(float)
TEST(LlvmLibcAsinfTest, SpecialNumbers) {
libc_errno = 0;
- EXPECT_FP_EQ_ALL_ROUNDING(aNaN, __llvm_libc::asinf(aNaN));
+ EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::asinf(aNaN));
EXPECT_MATH_ERRNO(0);
- EXPECT_FP_EQ_ALL_ROUNDING(0.0f, __llvm_libc::asinf(0.0f));
+ EXPECT_FP_EQ_ALL_ROUNDING(0.0f, LIBC_NAMESPACE::asinf(0.0f));
EXPECT_MATH_ERRNO(0);
- EXPECT_FP_EQ_ALL_ROUNDING(-0.0f, __llvm_libc::asinf(-0.0f));
+ EXPECT_FP_EQ_ALL_ROUNDING(-0.0f, LIBC_NAMESPACE::asinf(-0.0f));
EXPECT_MATH_ERRNO(0);
- EXPECT_FP_EQ_ALL_ROUNDING(aNaN, __llvm_libc::asinf(inf));
+ EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::asinf(inf));
EXPECT_MATH_ERRNO(EDOM);
- EXPECT_FP_EQ_ALL_ROUNDING(aNaN, __llvm_libc::asinf(neg_inf));
+ EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::asinf(neg_inf));
EXPECT_MATH_ERRNO(EDOM);
}
@@ -51,7 +51,7 @@ TEST(LlvmLibcAsinfTest, InFloatRange) {
if (isnan(x) || isinf(x))
continue;
ASSERT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Asin, x,
- __llvm_libc::asinf(x), 0.5);
+ LIBC_NAMESPACE::asinf(x), 0.5);
}
}
@@ -74,8 +74,8 @@ TEST(LlvmLibcAsinfTest, SpecificBitPatterns) {
for (int i = 0; i < N; ++i) {
float x = float(FPBits(INPUTS[i]));
EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Asin, x,
- __llvm_libc::asinf(x), 0.5);
+ LIBC_NAMESPACE::asinf(x), 0.5);
EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Asin, -x,
- __llvm_libc::asinf(-x), 0.5);
+ LIBC_NAMESPACE::asinf(-x), 0.5);
}
}
diff --git a/libc/test/src/math/asinhf_test.cpp b/libc/test/src/math/asinhf_test.cpp
index cadb9572c372e84..0bbd5db031e079f 100644
--- a/libc/test/src/math/asinhf_test.cpp
+++ b/libc/test/src/math/asinhf_test.cpp
@@ -17,28 +17,28 @@
#include <errno.h>
#include <stdint.h>
-using FPBits_t = __llvm_libc::fputil::FPBits<float>;
+using FPBits_t = LIBC_NAMESPACE::fputil::FPBits<float>;
-namespace mpfr = __llvm_libc::testing::mpfr;
+namespace mpfr = LIBC_NAMESPACE::testing::mpfr;
DECLARE_SPECIAL_CONSTANTS(float)
TEST(LlvmLibcAsinhfTest, SpecialNumbers) {
libc_errno = 0;
- EXPECT_FP_EQ_ALL_ROUNDING(aNaN, __llvm_libc::asinhf(aNaN));
+ EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::asinhf(aNaN));
EXPECT_MATH_ERRNO(0);
- EXPECT_FP_EQ_ALL_ROUNDING(0.0f, __llvm_libc::asinhf(0.0f));
+ EXPECT_FP_EQ_ALL_ROUNDING(0.0f, LIBC_NAMESPACE::asinhf(0.0f));
EXPECT_MATH_ERRNO(0);
- EXPECT_FP_EQ_ALL_ROUNDING(-0.0f, __llvm_libc::asinhf(-0.0f));
+ EXPECT_FP_EQ_ALL_ROUNDING(-0.0f, LIBC_NAMESPACE::asinhf(-0.0f));
EXPECT_MATH_ERRNO(0);
- EXPECT_FP_EQ_ALL_ROUNDING(inf, __llvm_libc::asinhf(inf));
+ EXPECT_FP_EQ_ALL_ROUNDING(inf, LIBC_NAMESPACE::asinhf(inf));
EXPECT_MATH_ERRNO(0);
- EXPECT_FP_EQ_ALL_ROUNDING(neg_inf, __llvm_libc::asinhf(neg_inf));
+ EXPECT_FP_EQ_ALL_ROUNDING(neg_inf, LIBC_NAMESPACE::asinhf(neg_inf));
EXPECT_MATH_ERRNO(0);
}
@@ -50,9 +50,9 @@ TEST(LlvmLibcAsinhfTest, InFloatRange) {
if (isnan(x) || isinf(x))
continue;
ASSERT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Asinh, x,
- __llvm_libc::asinhf(x), 0.5);
+ LIBC_NAMESPACE::asinhf(x), 0.5);
ASSERT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Asinh, -x,
- __llvm_libc::asinhf(-x), 0.5);
+ LIBC_NAMESPACE::asinhf(-x), 0.5);
}
}
@@ -75,8 +75,8 @@ TEST(LlvmLibcAsinhfTest, SpecificBitPatterns) {
for (int i = 0; i < N; ++i) {
float x = float(FPBits_t(INPUTS[i]));
EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Asinh, x,
- __llvm_libc::asinhf(x), 0.5);
+ LIBC_NAMESPACE::asinhf(x), 0.5);
EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Asinh, -x,
- __llvm_libc::asinhf(-x), 0.5);
+ LIBC_NAMESPACE::asinhf(-x), 0.5);
}
}
diff --git a/libc/test/src/math/atanf_test.cpp b/libc/test/src/math/atanf_test.cpp
index cd60b8d8a775e6a..c7eab7b66872396 100644
--- a/libc/test/src/math/atanf_test.cpp
+++ b/libc/test/src/math/atanf_test.cpp
@@ -19,26 +19,26 @@
#include <initializer_list>
-using FPBits = __llvm_libc::fputil::FPBits<float>;
+using FPBits = LIBC_NAMESPACE::fputil::FPBits<float>;
-namespace mpfr = __llvm_libc::testing::mpfr;
+namespace mpfr = LIBC_NAMESPACE::testing::mpfr;
DECLARE_SPECIAL_CONSTANTS(float)
TEST(LlvmLibcAtanfTest, SpecialNumbers) {
libc_errno = 0;
- __llvm_libc::fputil::clear_except(FE_ALL_EXCEPT);
- EXPECT_FP_EQ_ALL_ROUNDING(aNaN, __llvm_libc::atanf(aNaN));
+ LIBC_NAMESPACE::fputil::clear_except(FE_ALL_EXCEPT);
+ EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::atanf(aNaN));
EXPECT_FP_EXCEPTION(0);
EXPECT_MATH_ERRNO(0);
- __llvm_libc::fputil::clear_except(FE_ALL_EXCEPT);
- EXPECT_FP_EQ_ALL_ROUNDING(0.0f, __llvm_libc::atanf(0.0f));
+ LIBC_NAMESPACE::fputil::clear_except(FE_ALL_EXCEPT);
+ EXPECT_FP_EQ_ALL_ROUNDING(0.0f, LIBC_NAMESPACE::atanf(0.0f));
EXPECT_FP_EXCEPTION(0);
EXPECT_MATH_ERRNO(0);
- __llvm_libc::fputil::clear_except(FE_ALL_EXCEPT);
- EXPECT_FP_EQ_ALL_ROUNDING(-0.0f, __llvm_libc::atanf(-0.0f));
+ LIBC_NAMESPACE::fputil::clear_except(FE_ALL_EXCEPT);
+ EXPECT_FP_EQ_ALL_ROUNDING(-0.0f, LIBC_NAMESPACE::atanf(-0.0f));
EXPECT_FP_EXCEPTION(0);
EXPECT_MATH_ERRNO(0);
}
@@ -49,9 +49,9 @@ TEST(LlvmLibcAtanfTest, InFloatRange) {
for (uint32_t i = 0, v = 0; i <= COUNT; ++i, v += STEP) {
float x = float(FPBits(v));
EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Atan, x,
- __llvm_libc::atanf(x), 0.5);
+ LIBC_NAMESPACE::atanf(x), 0.5);
EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Atan, -x,
- __llvm_libc::atanf(-x), 0.5);
+ LIBC_NAMESPACE::atanf(-x), 0.5);
}
}
@@ -61,6 +61,6 @@ TEST(LlvmLibcAtanfTest, SpecialValues) {
0x7F800000U, 0xFF800000U}) {
float x = float(FPBits(v));
EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Atan, x,
- __llvm_libc::atanf(x), 0.5);
+ LIBC_NAMESPACE::atanf(x), 0.5);
}
}
diff --git a/libc/test/src/math/atanhf_test.cpp b/libc/test/src/math/atanhf_test.cpp
index 021a3f177b821e5..c1a8d1997187728 100644
--- a/libc/test/src/math/atanhf_test.cpp
+++ b/libc/test/src/math/atanhf_test.cpp
@@ -17,70 +17,70 @@
#include <errno.h>
#include <stdint.h>
-using FPBits = __llvm_libc::fputil::FPBits<float>;
+using FPBits = LIBC_NAMESPACE::fputil::FPBits<float>;
-namespace mpfr = __llvm_libc::testing::mpfr;
+namespace mpfr = LIBC_NAMESPACE::testing::mpfr;
DECLARE_SPECIAL_CONSTANTS(float)
TEST(LlvmLibcAtanhfTest, SpecialNumbers) {
libc_errno = 0;
- __llvm_libc::fputil::clear_except(FE_ALL_EXCEPT);
- EXPECT_FP_EQ_ALL_ROUNDING(aNaN, __llvm_libc::atanhf(aNaN));
+ LIBC_NAMESPACE::fputil::clear_except(FE_ALL_EXCEPT);
+ EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::atanhf(aNaN));
EXPECT_FP_EXCEPTION(0);
EXPECT_MATH_ERRNO(0);
- __llvm_libc::fputil::clear_except(FE_ALL_EXCEPT);
- EXPECT_FP_EQ_ALL_ROUNDING(0.0f, __llvm_libc::atanhf(0.0f));
+ LIBC_NAMESPACE::fputil::clear_except(FE_ALL_EXCEPT);
+ EXPECT_FP_EQ_ALL_ROUNDING(0.0f, LIBC_NAMESPACE::atanhf(0.0f));
EXPECT_FP_EXCEPTION(0);
EXPECT_MATH_ERRNO(0);
- __llvm_libc::fputil::clear_except(FE_ALL_EXCEPT);
- EXPECT_FP_EQ_ALL_ROUNDING(-0.0f, __llvm_libc::atanhf(-0.0f));
+ LIBC_NAMESPACE::fputil::clear_except(FE_ALL_EXCEPT);
+ EXPECT_FP_EQ_ALL_ROUNDING(-0.0f, LIBC_NAMESPACE::atanhf(-0.0f));
EXPECT_FP_EXCEPTION(0);
EXPECT_MATH_ERRNO(0);
- __llvm_libc::fputil::clear_except(FE_ALL_EXCEPT);
- EXPECT_FP_EQ_ALL_ROUNDING(inf, __llvm_libc::atanhf(1.0f));
+ LIBC_NAMESPACE::fputil::clear_except(FE_ALL_EXCEPT);
+ EXPECT_FP_EQ_ALL_ROUNDING(inf, LIBC_NAMESPACE::atanhf(1.0f));
EXPECT_FP_EXCEPTION(FE_DIVBYZERO);
EXPECT_MATH_ERRNO(ERANGE);
- __llvm_libc::fputil::clear_except(FE_ALL_EXCEPT);
- EXPECT_FP_EQ_ALL_ROUNDING(neg_inf, __llvm_libc::atanhf(-1.0f));
+ LIBC_NAMESPACE::fputil::clear_except(FE_ALL_EXCEPT);
+ EXPECT_FP_EQ_ALL_ROUNDING(neg_inf, LIBC_NAMESPACE::atanhf(-1.0f));
EXPECT_FP_EXCEPTION(FE_DIVBYZERO);
EXPECT_MATH_ERRNO(ERANGE);
auto bt = FPBits(1.0f);
bt.bits += 1;
- __llvm_libc::fputil::clear_except(FE_ALL_EXCEPT);
- EXPECT_FP_EQ_ALL_ROUNDING(aNaN, __llvm_libc::atanhf(bt.get_val()));
+ LIBC_NAMESPACE::fputil::clear_except(FE_ALL_EXCEPT);
+ EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::atanhf(bt.get_val()));
EXPECT_FP_EXCEPTION(FE_INVALID);
EXPECT_MATH_ERRNO(EDOM);
- __llvm_libc::fputil::clear_except(FE_ALL_EXCEPT);
+ LIBC_NAMESPACE::fputil::clear_except(FE_ALL_EXCEPT);
bt.set_sign(true);
- EXPECT_FP_EQ_ALL_ROUNDING(aNaN, __llvm_libc::atanhf(bt.get_val()));
+ EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::atanhf(bt.get_val()));
EXPECT_FP_EXCEPTION(FE_INVALID);
EXPECT_MATH_ERRNO(EDOM);
- __llvm_libc::fputil::clear_except(FE_ALL_EXCEPT);
- EXPECT_FP_EQ_ALL_ROUNDING(aNaN, __llvm_libc::atanhf(2.0f));
+ LIBC_NAMESPACE::fputil::clear_except(FE_ALL_EXCEPT);
+ EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::atanhf(2.0f));
EXPECT_FP_EXCEPTION(FE_INVALID);
EXPECT_MATH_ERRNO(EDOM);
- __llvm_libc::fputil::clear_except(FE_ALL_EXCEPT);
- EXPECT_FP_EQ_ALL_ROUNDING(aNaN, __llvm_libc::atanhf(-2.0f));
+ LIBC_NAMESPACE::fputil::clear_except(FE_ALL_EXCEPT);
+ EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::atanhf(-2.0f));
EXPECT_FP_EXCEPTION(FE_INVALID);
EXPECT_MATH_ERRNO(EDOM);
- __llvm_libc::fputil::clear_except(FE_ALL_EXCEPT);
- EXPECT_FP_EQ_ALL_ROUNDING(aNaN, __llvm_libc::atanhf(inf));
+ LIBC_NAMESPACE::fputil::clear_except(FE_ALL_EXCEPT);
+ EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::atanhf(inf));
EXPECT_FP_EXCEPTION(FE_INVALID);
EXPECT_MATH_ERRNO(EDOM);
bt.set_sign(true);
- EXPECT_FP_EQ_ALL_ROUNDING(aNaN, __llvm_libc::atanhf(neg_inf));
+ EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::atanhf(neg_inf));
EXPECT_FP_EXCEPTION(FE_INVALID);
EXPECT_MATH_ERRNO(EDOM);
}
@@ -90,20 +90,22 @@ TEST(LlvmLibcAtanhfTest, InFloatRange) {
const uint32_t STEP = FPBits(1.0f).uintval() / COUNT;
for (uint32_t i = 0, v = 0; i <= COUNT; ++i, v += STEP) {
float x = float(FPBits(v));
- ASSERT_MPFR_MATCH(mpfr::Operation::Atanh, x, __llvm_libc::atanhf(x), 0.5);
- ASSERT_MPFR_MATCH(mpfr::Operation::Atanh, -x, __llvm_libc::atanhf(-x), 0.5);
+ ASSERT_MPFR_MATCH(mpfr::Operation::Atanh, x, LIBC_NAMESPACE::atanhf(x),
+ 0.5);
+ ASSERT_MPFR_MATCH(mpfr::Operation::Atanh, -x, LIBC_NAMESPACE::atanhf(-x),
+ 0.5);
}
}
// For small values, atanh(x) is x.
TEST(LlvmLibcAtanhfTest, SmallValues) {
float x = float(FPBits(uint32_t(0x17800000)));
- float result = __llvm_libc::atanhf(x);
+ float result = LIBC_NAMESPACE::atanhf(x);
EXPECT_MPFR_MATCH(mpfr::Operation::Atanh, x, result, 0.5);
EXPECT_FP_EQ(x, result);
x = float(FPBits(uint32_t(0x00400000)));
- result = __llvm_libc::atanhf(x);
+ result = LIBC_NAMESPACE::atanhf(x);
EXPECT_MPFR_MATCH(mpfr::Operation::Atanh, x, result, 0.5);
EXPECT_FP_EQ(x, result);
}
diff --git a/libc/test/src/math/ceil_test.cpp b/libc/test/src/math/ceil_test.cpp
index 2a592e3ee85b0cc..800452a43426c7c 100644
--- a/libc/test/src/math/ceil_test.cpp
+++ b/libc/test/src/math/ceil_test.cpp
@@ -10,4 +10,4 @@
#include "src/math/ceil.h"
-LIST_CEIL_TESTS(double, __llvm_libc::ceil)
+LIST_CEIL_TESTS(double, LIBC_NAMESPACE::ceil)
diff --git a/libc/test/src/math/ceilf_test.cpp b/libc/test/src/math/ceilf_test.cpp
index cfa8cb2c5aa6dd4..2a2504228adb0ad 100644
--- a/libc/test/src/math/ceilf_test.cpp
+++ b/libc/test/src/math/ceilf_test.cpp
@@ -10,4 +10,4 @@
#include "src/math/ceilf.h"
-LIST_CEIL_TESTS(float, __llvm_libc::ceilf)
+LIST_CEIL_TESTS(float, LIBC_NAMESPACE::ceilf)
diff --git a/libc/test/src/math/ceill_test.cpp b/libc/test/src/math/ceill_test.cpp
index 6fe30465edc8574..0f766602a0f6d41 100644
--- a/libc/test/src/math/ceill_test.cpp
+++ b/libc/test/src/math/ceill_test.cpp
@@ -10,4 +10,4 @@
#include "src/math/ceill.h"
-LIST_CEIL_TESTS(long double, __llvm_libc::ceill)
+LIST_CEIL_TESTS(long double, LIBC_NAMESPACE::ceill)
diff --git a/libc/test/src/math/copysign_test.cpp b/libc/test/src/math/copysign_test.cpp
index 37bfa0d90c37896..5b3d812c02da4d1 100644
--- a/libc/test/src/math/copysign_test.cpp
+++ b/libc/test/src/math/copysign_test.cpp
@@ -10,4 +10,4 @@
#include "src/math/copysign.h"
-LIST_COPYSIGN_TESTS(double, __llvm_libc::copysign)
+LIST_COPYSIGN_TESTS(double, LIBC_NAMESPACE::copysign)
diff --git a/libc/test/src/math/copysignf_test.cpp b/libc/test/src/math/copysignf_test.cpp
index fec283ccd0c7acd..344ffee2359ec8b 100644
--- a/libc/test/src/math/copysignf_test.cpp
+++ b/libc/test/src/math/copysignf_test.cpp
@@ -10,4 +10,4 @@
#include "src/math/copysignf.h"
-LIST_COPYSIGN_TESTS(float, __llvm_libc::copysignf)
+LIST_COPYSIGN_TESTS(float, LIBC_NAMESPACE::copysignf)
diff --git a/libc/test/src/math/copysignl_test.cpp b/libc/test/src/math/copysignl_test.cpp
index d1de911196b62b7..bed60678dc161da 100644
--- a/libc/test/src/math/copysignl_test.cpp
+++ b/libc/test/src/math/copysignl_test.cpp
@@ -10,4 +10,4 @@
#include "src/math/copysignl.h"
-LIST_COPYSIGN_TESTS(long double, __llvm_libc::copysignl)
+LIST_COPYSIGN_TESTS(long double, LIBC_NAMESPACE::copysignl)
diff --git a/libc/test/src/math/cos_test.cpp b/libc/test/src/math/cos_test.cpp
index f93d8699e730259..6d8aeaf2230dae9 100644
--- a/libc/test/src/math/cos_test.cpp
+++ b/libc/test/src/math/cos_test.cpp
@@ -13,7 +13,7 @@
#include <math.h>
-namespace mpfr = __llvm_libc::testing::mpfr;
+namespace mpfr = LIBC_NAMESPACE::testing::mpfr;
DECLARE_SPECIAL_CONSTANTS(double)
@@ -27,6 +27,6 @@ TEST(LlvmLibccosTest, Range) {
if (isnan(x) || isinf(x) || x > _2pi || x < -_2pi)
continue;
- ASSERT_MPFR_MATCH(mpfr::Operation::Cos, x, __llvm_libc::cos(x), 1.0);
+ ASSERT_MPFR_MATCH(mpfr::Operation::Cos, x, LIBC_NAMESPACE::cos(x), 1.0);
}
}
diff --git a/libc/test/src/math/cosf_test.cpp b/libc/test/src/math/cosf_test.cpp
index e9a7ea5db7429ff..7b2fdf9f1b6bffa 100644
--- a/libc/test/src/math/cosf_test.cpp
+++ b/libc/test/src/math/cosf_test.cpp
@@ -18,29 +18,29 @@
#include <errno.h>
#include <stdint.h>
-using __llvm_libc::testing::SDCOMP26094_VALUES;
-using FPBits = __llvm_libc::fputil::FPBits<float>;
+using LIBC_NAMESPACE::testing::SDCOMP26094_VALUES;
+using FPBits = LIBC_NAMESPACE::fputil::FPBits<float>;
-namespace mpfr = __llvm_libc::testing::mpfr;
+namespace mpfr = LIBC_NAMESPACE::testing::mpfr;
DECLARE_SPECIAL_CONSTANTS(float)
TEST(LlvmLibcCosfTest, SpecialNumbers) {
libc_errno = 0;
- EXPECT_FP_EQ(aNaN, __llvm_libc::cosf(aNaN));
+ EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::cosf(aNaN));
EXPECT_MATH_ERRNO(0);
- EXPECT_FP_EQ(1.0f, __llvm_libc::cosf(0.0f));
+ EXPECT_FP_EQ(1.0f, LIBC_NAMESPACE::cosf(0.0f));
EXPECT_MATH_ERRNO(0);
- EXPECT_FP_EQ(1.0f, __llvm_libc::cosf(-0.0f));
+ EXPECT_FP_EQ(1.0f, LIBC_NAMESPACE::cosf(-0.0f));
EXPECT_MATH_ERRNO(0);
- EXPECT_FP_EQ(aNaN, __llvm_libc::cosf(inf));
+ EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::cosf(inf));
EXPECT_MATH_ERRNO(EDOM);
- EXPECT_FP_EQ(aNaN, __llvm_libc::cosf(neg_inf));
+ EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::cosf(neg_inf));
EXPECT_MATH_ERRNO(EDOM);
}
@@ -52,7 +52,7 @@ TEST(LlvmLibcCosfTest, InFloatRange) {
if (isnan(x) || isinf(x))
continue;
ASSERT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Cos, x,
- __llvm_libc::cosf(x), 0.5);
+ LIBC_NAMESPACE::cosf(x), 0.5);
}
}
@@ -106,9 +106,9 @@ TEST(LlvmLibcCosfTest, SpecificBitPatterns) {
for (int i = 0; i < N; ++i) {
float x = float(FPBits(INPUTS[i]));
EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Cos, x,
- __llvm_libc::cosf(x), 0.5);
+ LIBC_NAMESPACE::cosf(x), 0.5);
EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Cos, -x,
- __llvm_libc::cosf(-x), 0.5);
+ LIBC_NAMESPACE::cosf(-x), 0.5);
}
}
@@ -117,6 +117,6 @@ TEST(LlvmLibcCosfTest, SpecificBitPatterns) {
TEST(LlvmLibcCosfTest, SDCOMP_26094) {
for (uint32_t v : SDCOMP26094_VALUES) {
float x = float(FPBits(v));
- ASSERT_MPFR_MATCH(mpfr::Operation::Cos, x, __llvm_libc::cosf(x), 0.5);
+ ASSERT_MPFR_MATCH(mpfr::Operation::Cos, x, LIBC_NAMESPACE::cosf(x), 0.5);
}
}
diff --git a/libc/test/src/math/coshf_test.cpp b/libc/test/src/math/coshf_test.cpp
index 90ce3044b2c11c5..f45f35ad3ea0585 100644
--- a/libc/test/src/math/coshf_test.cpp
+++ b/libc/test/src/math/coshf_test.cpp
@@ -18,43 +18,43 @@
#include <errno.h>
#include <stdint.h>
-using FPBits = __llvm_libc::fputil::FPBits<float>;
+using FPBits = LIBC_NAMESPACE::fputil::FPBits<float>;
-namespace mpfr = __llvm_libc::testing::mpfr;
+namespace mpfr = LIBC_NAMESPACE::testing::mpfr;
DECLARE_SPECIAL_CONSTANTS(float)
TEST(LlvmLibcCoshfTest, SpecialNumbers) {
libc_errno = 0;
- EXPECT_FP_EQ(aNaN, __llvm_libc::coshf(aNaN));
+ EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::coshf(aNaN));
EXPECT_MATH_ERRNO(0);
- EXPECT_FP_EQ(inf, __llvm_libc::coshf(inf));
+ EXPECT_FP_EQ(inf, LIBC_NAMESPACE::coshf(inf));
EXPECT_MATH_ERRNO(0);
- EXPECT_FP_EQ(inf, __llvm_libc::coshf(neg_inf));
+ EXPECT_FP_EQ(inf, LIBC_NAMESPACE::coshf(neg_inf));
EXPECT_MATH_ERRNO(0);
- EXPECT_FP_EQ(1.0f, __llvm_libc::coshf(0.0f));
+ EXPECT_FP_EQ(1.0f, LIBC_NAMESPACE::coshf(0.0f));
EXPECT_MATH_ERRNO(0);
- EXPECT_FP_EQ(1.0f, __llvm_libc::coshf(-0.0f));
+ EXPECT_FP_EQ(1.0f, LIBC_NAMESPACE::coshf(-0.0f));
EXPECT_MATH_ERRNO(0);
}
TEST(LlvmLibcCoshfTest, Overflow) {
libc_errno = 0;
EXPECT_FP_EQ_WITH_EXCEPTION(
- inf, __llvm_libc::coshf(float(FPBits(0x7f7fffffU))), FE_OVERFLOW);
+ inf, LIBC_NAMESPACE::coshf(float(FPBits(0x7f7fffffU))), FE_OVERFLOW);
EXPECT_MATH_ERRNO(ERANGE);
EXPECT_FP_EQ_WITH_EXCEPTION(
- inf, __llvm_libc::coshf(float(FPBits(0x42cffff8U))), FE_OVERFLOW);
+ inf, LIBC_NAMESPACE::coshf(float(FPBits(0x42cffff8U))), FE_OVERFLOW);
EXPECT_MATH_ERRNO(ERANGE);
EXPECT_FP_EQ_WITH_EXCEPTION(
- inf, __llvm_libc::coshf(float(FPBits(0x42d00008U))), FE_OVERFLOW);
+ inf, LIBC_NAMESPACE::coshf(float(FPBits(0x42d00008U))), FE_OVERFLOW);
EXPECT_MATH_ERRNO(ERANGE);
}
@@ -65,18 +65,18 @@ TEST(LlvmLibcCoshfTest, InFloatRange) {
float x = float(FPBits(v));
if (isnan(x) || isinf(x))
continue;
- ASSERT_MPFR_MATCH(mpfr::Operation::Cosh, x, __llvm_libc::coshf(x), 0.5);
+ ASSERT_MPFR_MATCH(mpfr::Operation::Cosh, x, LIBC_NAMESPACE::coshf(x), 0.5);
}
}
TEST(LlvmLibcCoshfTest, SmallValues) {
float x = float(FPBits(0x17800000U));
- float result = __llvm_libc::coshf(x);
+ float result = LIBC_NAMESPACE::coshf(x);
EXPECT_MPFR_MATCH(mpfr::Operation::Cosh, x, result, 0.5);
EXPECT_FP_EQ(1.0f, result);
x = float(FPBits(0x0040000U));
- result = __llvm_libc::coshf(x);
+ result = LIBC_NAMESPACE::coshf(x);
EXPECT_MPFR_MATCH(mpfr::Operation::Cosh, x, result, 0.5);
EXPECT_FP_EQ(1.0f, result);
}
diff --git a/libc/test/src/math/differential_testing/BinaryOpSingleOutputDiff.h b/libc/test/src/math/differential_testing/BinaryOpSingleOutputDiff.h
index ccab38e5287909b..1ea50deccb7eaf8 100644
--- a/libc/test/src/math/differential_testing/BinaryOpSingleOutputDiff.h
+++ b/libc/test/src/math/differential_testing/BinaryOpSingleOutputDiff.h
@@ -11,7 +11,7 @@
#include <fstream>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
namespace testing {
template <typename T> class BinaryOpSingleOutputDiff {
@@ -141,18 +141,18 @@ template <typename T> class BinaryOpSingleOutputDiff {
};
} // namespace testing
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#define BINARY_OP_SINGLE_OUTPUT_DIFF(T, myFunc, otherFunc, filename) \
int main() { \
- __llvm_libc::testing::BinaryOpSingleOutputDiff<T>::run_diff( \
+ LIBC_NAMESPACE::testing::BinaryOpSingleOutputDiff<T>::run_diff( \
&myFunc, &otherFunc, filename); \
return 0; \
}
#define BINARY_OP_SINGLE_OUTPUT_PERF(T, myFunc, otherFunc, filename) \
int main() { \
- __llvm_libc::testing::BinaryOpSingleOutputDiff<T>::run_perf( \
+ LIBC_NAMESPACE::testing::BinaryOpSingleOutputDiff<T>::run_perf( \
&myFunc, &otherFunc, filename); \
return 0; \
}
diff --git a/libc/test/src/math/differential_testing/SingleInputSingleOutputDiff.h b/libc/test/src/math/differential_testing/SingleInputSingleOutputDiff.h
index 4805e1acac20029..c20cf3152f62200 100644
--- a/libc/test/src/math/differential_testing/SingleInputSingleOutputDiff.h
+++ b/libc/test/src/math/differential_testing/SingleInputSingleOutputDiff.h
@@ -11,7 +11,7 @@
#include <fstream>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
namespace testing {
template <typename T> class SingleInputSingleOutputDiff {
@@ -100,18 +100,18 @@ template <typename T> class SingleInputSingleOutputDiff {
};
} // namespace testing
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#define SINGLE_INPUT_SINGLE_OUTPUT_DIFF(T, myFunc, otherFunc, filename) \
int main() { \
- __llvm_libc::testing::SingleInputSingleOutputDiff<T>::runDiff( \
+ LIBC_NAMESPACE::testing::SingleInputSingleOutputDiff<T>::runDiff( \
&myFunc, &otherFunc, filename); \
return 0; \
}
#define SINGLE_INPUT_SINGLE_OUTPUT_PERF(T, myFunc, otherFunc, filename) \
int main() { \
- __llvm_libc::testing::SingleInputSingleOutputDiff<T>::runPerf( \
+ LIBC_NAMESPACE::testing::SingleInputSingleOutputDiff<T>::runPerf( \
&myFunc, &otherFunc, filename); \
return 0; \
}
diff --git a/libc/test/src/math/differential_testing/Timer.cpp b/libc/test/src/math/differential_testing/Timer.cpp
index 6780389d5322d8c..979196ae6b83599 100644
--- a/libc/test/src/math/differential_testing/Timer.cpp
+++ b/libc/test/src/math/differential_testing/Timer.cpp
@@ -11,7 +11,7 @@
#include <chrono>
#include <fstream>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
namespace testing {
struct TimerImplementation {
@@ -39,4 +39,4 @@ uint64_t Timer::nanoseconds() const {
}
} // namespace testing
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/test/src/math/differential_testing/Timer.h b/libc/test/src/math/differential_testing/Timer.h
index 9df13a0d4074603..d4acff7ba0eb183 100644
--- a/libc/test/src/math/differential_testing/Timer.h
+++ b/libc/test/src/math/differential_testing/Timer.h
@@ -11,7 +11,7 @@
#include <stdint.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
namespace testing {
class Timer {
@@ -28,6 +28,6 @@ class Timer {
};
} // namespace testing
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_UTILS_TESTUTILS_TIMER_H
diff --git a/libc/test/src/math/differential_testing/ceilf_diff.cpp b/libc/test/src/math/differential_testing/ceilf_diff.cpp
index af911b4cc26228a..7c0bb1e95a03fd6 100644
--- a/libc/test/src/math/differential_testing/ceilf_diff.cpp
+++ b/libc/test/src/math/differential_testing/ceilf_diff.cpp
@@ -12,5 +12,5 @@
#include <math.h>
-SINGLE_INPUT_SINGLE_OUTPUT_DIFF(float, __llvm_libc::ceilf, ::ceilf,
+SINGLE_INPUT_SINGLE_OUTPUT_DIFF(float, LIBC_NAMESPACE::ceilf, ::ceilf,
"ceilf_diff.log")
diff --git a/libc/test/src/math/differential_testing/ceilf_perf.cpp b/libc/test/src/math/differential_testing/ceilf_perf.cpp
index 23420390d15346b..c304231e0678dee 100644
--- a/libc/test/src/math/differential_testing/ceilf_perf.cpp
+++ b/libc/test/src/math/differential_testing/ceilf_perf.cpp
@@ -12,5 +12,5 @@
#include <math.h>
-SINGLE_INPUT_SINGLE_OUTPUT_PERF(float, __llvm_libc::ceilf, ::ceilf,
+SINGLE_INPUT_SINGLE_OUTPUT_PERF(float, LIBC_NAMESPACE::ceilf, ::ceilf,
"ceilf_perf.log")
diff --git a/libc/test/src/math/differential_testing/cosf_diff.cpp b/libc/test/src/math/differential_testing/cosf_diff.cpp
index 232a3ceb11418b5..ee3102384a8e6b7 100644
--- a/libc/test/src/math/differential_testing/cosf_diff.cpp
+++ b/libc/test/src/math/differential_testing/cosf_diff.cpp
@@ -12,5 +12,5 @@
#include <math.h>
-SINGLE_INPUT_SINGLE_OUTPUT_DIFF(float, __llvm_libc::cosf, ::cosf,
+SINGLE_INPUT_SINGLE_OUTPUT_DIFF(float, LIBC_NAMESPACE::cosf, ::cosf,
"cosf_diff.log")
diff --git a/libc/test/src/math/differential_testing/cosf_perf.cpp b/libc/test/src/math/differential_testing/cosf_perf.cpp
index 3107d199431033b..981a94133b80406 100644
--- a/libc/test/src/math/differential_testing/cosf_perf.cpp
+++ b/libc/test/src/math/differential_testing/cosf_perf.cpp
@@ -12,5 +12,5 @@
#include <math.h>
-SINGLE_INPUT_SINGLE_OUTPUT_PERF(float, __llvm_libc::cosf, ::cosf,
+SINGLE_INPUT_SINGLE_OUTPUT_PERF(float, LIBC_NAMESPACE::cosf, ::cosf,
"cosf_perf.log")
diff --git a/libc/test/src/math/differential_testing/exp2f_diff.cpp b/libc/test/src/math/differential_testing/exp2f_diff.cpp
index c1f279a2b466d3b..545c6de320fc7c4 100644
--- a/libc/test/src/math/differential_testing/exp2f_diff.cpp
+++ b/libc/test/src/math/differential_testing/exp2f_diff.cpp
@@ -12,5 +12,5 @@
#include <math.h>
-SINGLE_INPUT_SINGLE_OUTPUT_DIFF(float, __llvm_libc::exp2f, ::exp2f,
+SINGLE_INPUT_SINGLE_OUTPUT_DIFF(float, LIBC_NAMESPACE::exp2f, ::exp2f,
"exp2f_diff.log")
diff --git a/libc/test/src/math/differential_testing/exp2f_perf.cpp b/libc/test/src/math/differential_testing/exp2f_perf.cpp
index 2ffa593c9f6e448..4aae5220e6a5167 100644
--- a/libc/test/src/math/differential_testing/exp2f_perf.cpp
+++ b/libc/test/src/math/differential_testing/exp2f_perf.cpp
@@ -12,5 +12,5 @@
#include <math.h>
-SINGLE_INPUT_SINGLE_OUTPUT_PERF(float, __llvm_libc::exp2f, ::exp2f,
+SINGLE_INPUT_SINGLE_OUTPUT_PERF(float, LIBC_NAMESPACE::exp2f, ::exp2f,
"exp2f_perf.log")
diff --git a/libc/test/src/math/differential_testing/expf_diff.cpp b/libc/test/src/math/differential_testing/expf_diff.cpp
index a69efde44c1cabf..7c2e90744bc9156 100644
--- a/libc/test/src/math/differential_testing/expf_diff.cpp
+++ b/libc/test/src/math/differential_testing/expf_diff.cpp
@@ -12,5 +12,5 @@
#include <math.h>
-SINGLE_INPUT_SINGLE_OUTPUT_DIFF(float, __llvm_libc::expf, ::expf,
+SINGLE_INPUT_SINGLE_OUTPUT_DIFF(float, LIBC_NAMESPACE::expf, ::expf,
"expf_diff.log")
diff --git a/libc/test/src/math/differential_testing/expf_perf.cpp b/libc/test/src/math/differential_testing/expf_perf.cpp
index 1a28fd125af071f..c34173b21b4f60a 100644
--- a/libc/test/src/math/differential_testing/expf_perf.cpp
+++ b/libc/test/src/math/differential_testing/expf_perf.cpp
@@ -12,5 +12,5 @@
#include <math.h>
-SINGLE_INPUT_SINGLE_OUTPUT_PERF(float, __llvm_libc::expf, ::expf,
+SINGLE_INPUT_SINGLE_OUTPUT_PERF(float, LIBC_NAMESPACE::expf, ::expf,
"expf_perf.log")
diff --git a/libc/test/src/math/differential_testing/expm1f_diff.cpp b/libc/test/src/math/differential_testing/expm1f_diff.cpp
index e12072efec57ddf..3cbd8a99690fb49 100644
--- a/libc/test/src/math/differential_testing/expm1f_diff.cpp
+++ b/libc/test/src/math/differential_testing/expm1f_diff.cpp
@@ -12,5 +12,5 @@
#include <math.h>
-SINGLE_INPUT_SINGLE_OUTPUT_DIFF(float, __llvm_libc::expm1f, ::expm1f,
+SINGLE_INPUT_SINGLE_OUTPUT_DIFF(float, LIBC_NAMESPACE::expm1f, ::expm1f,
"expm1f_diff.log")
diff --git a/libc/test/src/math/differential_testing/expm1f_perf.cpp b/libc/test/src/math/differential_testing/expm1f_perf.cpp
index 9e8e2dfb8cd92af..3c25ef81d4808c3 100644
--- a/libc/test/src/math/differential_testing/expm1f_perf.cpp
+++ b/libc/test/src/math/differential_testing/expm1f_perf.cpp
@@ -12,5 +12,5 @@
#include <math.h>
-SINGLE_INPUT_SINGLE_OUTPUT_PERF(float, __llvm_libc::expm1f, ::expm1f,
+SINGLE_INPUT_SINGLE_OUTPUT_PERF(float, LIBC_NAMESPACE::expm1f, ::expm1f,
"expm1f_perf.log")
diff --git a/libc/test/src/math/differential_testing/fabsf_diff.cpp b/libc/test/src/math/differential_testing/fabsf_diff.cpp
index 6bf11f654c71cd0..9bf9eff888fb51a 100644
--- a/libc/test/src/math/differential_testing/fabsf_diff.cpp
+++ b/libc/test/src/math/differential_testing/fabsf_diff.cpp
@@ -12,5 +12,5 @@
#include <math.h>
-SINGLE_INPUT_SINGLE_OUTPUT_DIFF(float, __llvm_libc::fabsf, ::fabsf,
+SINGLE_INPUT_SINGLE_OUTPUT_DIFF(float, LIBC_NAMESPACE::fabsf, ::fabsf,
"fabsf_diff.log")
diff --git a/libc/test/src/math/differential_testing/fabsf_perf.cpp b/libc/test/src/math/differential_testing/fabsf_perf.cpp
index 2fcf72de348e236..f9f9cea72c6dae8 100644
--- a/libc/test/src/math/differential_testing/fabsf_perf.cpp
+++ b/libc/test/src/math/differential_testing/fabsf_perf.cpp
@@ -12,5 +12,5 @@
#include <math.h>
-SINGLE_INPUT_SINGLE_OUTPUT_PERF(float, __llvm_libc::fabsf, ::fabsf,
+SINGLE_INPUT_SINGLE_OUTPUT_PERF(float, LIBC_NAMESPACE::fabsf, ::fabsf,
"fabsf_perf.log")
diff --git a/libc/test/src/math/differential_testing/floorf_diff.cpp b/libc/test/src/math/differential_testing/floorf_diff.cpp
index 788214fb26407dd..6d72927b5010c57 100644
--- a/libc/test/src/math/differential_testing/floorf_diff.cpp
+++ b/libc/test/src/math/differential_testing/floorf_diff.cpp
@@ -12,5 +12,5 @@
#include <math.h>
-SINGLE_INPUT_SINGLE_OUTPUT_DIFF(float, __llvm_libc::floorf, ::floorf,
+SINGLE_INPUT_SINGLE_OUTPUT_DIFF(float, LIBC_NAMESPACE::floorf, ::floorf,
"floorf_diff.log")
diff --git a/libc/test/src/math/differential_testing/floorf_perf.cpp b/libc/test/src/math/differential_testing/floorf_perf.cpp
index 498cdc960c66d13..abd1cd7885ffd21 100644
--- a/libc/test/src/math/differential_testing/floorf_perf.cpp
+++ b/libc/test/src/math/differential_testing/floorf_perf.cpp
@@ -12,5 +12,5 @@
#include <math.h>
-SINGLE_INPUT_SINGLE_OUTPUT_PERF(float, __llvm_libc::floorf, ::floorf,
+SINGLE_INPUT_SINGLE_OUTPUT_PERF(float, LIBC_NAMESPACE::floorf, ::floorf,
"floorf_perf.log")
diff --git a/libc/test/src/math/differential_testing/fmod_diff.cpp b/libc/test/src/math/differential_testing/fmod_diff.cpp
index c20a7c5140f0091..026e529c6cae2a9 100644
--- a/libc/test/src/math/differential_testing/fmod_diff.cpp
+++ b/libc/test/src/math/differential_testing/fmod_diff.cpp
@@ -12,4 +12,5 @@
#include <math.h>
-BINARY_OP_SINGLE_OUTPUT_DIFF(double, __llvm_libc::fmod, ::fmod, "fmod_diff.log")
+BINARY_OP_SINGLE_OUTPUT_DIFF(double, LIBC_NAMESPACE::fmod, ::fmod,
+ "fmod_diff.log")
diff --git a/libc/test/src/math/differential_testing/fmod_perf.cpp b/libc/test/src/math/differential_testing/fmod_perf.cpp
index 37878bee99c3af1..219ee7860a242be 100644
--- a/libc/test/src/math/differential_testing/fmod_perf.cpp
+++ b/libc/test/src/math/differential_testing/fmod_perf.cpp
@@ -12,4 +12,5 @@
#include <math.h>
-BINARY_OP_SINGLE_OUTPUT_PERF(double, __llvm_libc::fmod, ::fmod, "fmod_perf.log")
+BINARY_OP_SINGLE_OUTPUT_PERF(double, LIBC_NAMESPACE::fmod, ::fmod,
+ "fmod_perf.log")
diff --git a/libc/test/src/math/differential_testing/fmodf_diff.cpp b/libc/test/src/math/differential_testing/fmodf_diff.cpp
index 634c6399877b0fc..7029b1ee42cd0e7 100644
--- a/libc/test/src/math/differential_testing/fmodf_diff.cpp
+++ b/libc/test/src/math/differential_testing/fmodf_diff.cpp
@@ -12,5 +12,5 @@
#include <math.h>
-BINARY_OP_SINGLE_OUTPUT_DIFF(float, __llvm_libc::fmodf, ::fmodf,
+BINARY_OP_SINGLE_OUTPUT_DIFF(float, LIBC_NAMESPACE::fmodf, ::fmodf,
"fmodf_diff.log")
diff --git a/libc/test/src/math/differential_testing/fmodf_perf.cpp b/libc/test/src/math/differential_testing/fmodf_perf.cpp
index 36d0fe56d964afb..c2927bb1ea9d9fe 100644
--- a/libc/test/src/math/differential_testing/fmodf_perf.cpp
+++ b/libc/test/src/math/differential_testing/fmodf_perf.cpp
@@ -12,5 +12,5 @@
#include <math.h>
-BINARY_OP_SINGLE_OUTPUT_PERF(float, __llvm_libc::fmodf, ::fmodf,
+BINARY_OP_SINGLE_OUTPUT_PERF(float, LIBC_NAMESPACE::fmodf, ::fmodf,
"fmodf_perf.log")
diff --git a/libc/test/src/math/differential_testing/hypot_diff.cpp b/libc/test/src/math/differential_testing/hypot_diff.cpp
index 28dbd2bfc35e3d3..c61e589bdb2dffa 100644
--- a/libc/test/src/math/differential_testing/hypot_diff.cpp
+++ b/libc/test/src/math/differential_testing/hypot_diff.cpp
@@ -12,5 +12,5 @@
#include <math.h>
-BINARY_OP_SINGLE_OUTPUT_DIFF(double, __llvm_libc::hypot, ::hypot,
+BINARY_OP_SINGLE_OUTPUT_DIFF(double, LIBC_NAMESPACE::hypot, ::hypot,
"hypot_diff.log")
diff --git a/libc/test/src/math/differential_testing/hypot_perf.cpp b/libc/test/src/math/differential_testing/hypot_perf.cpp
index f90605455f768c0..01a72e6fbc3d795 100644
--- a/libc/test/src/math/differential_testing/hypot_perf.cpp
+++ b/libc/test/src/math/differential_testing/hypot_perf.cpp
@@ -12,5 +12,5 @@
#include <math.h>
-BINARY_OP_SINGLE_OUTPUT_PERF(double, __llvm_libc::hypot, ::hypot,
+BINARY_OP_SINGLE_OUTPUT_PERF(double, LIBC_NAMESPACE::hypot, ::hypot,
"hypot_perf.log")
diff --git a/libc/test/src/math/differential_testing/hypotf_diff.cpp b/libc/test/src/math/differential_testing/hypotf_diff.cpp
index e1ee9f28cc55a63..d1c70fc2b6edbdc 100644
--- a/libc/test/src/math/differential_testing/hypotf_diff.cpp
+++ b/libc/test/src/math/differential_testing/hypotf_diff.cpp
@@ -12,5 +12,5 @@
#include <math.h>
-BINARY_OP_SINGLE_OUTPUT_DIFF(float, __llvm_libc::hypotf, ::hypotf,
+BINARY_OP_SINGLE_OUTPUT_DIFF(float, LIBC_NAMESPACE::hypotf, ::hypotf,
"hypotf_diff.log")
diff --git a/libc/test/src/math/differential_testing/hypotf_perf.cpp b/libc/test/src/math/differential_testing/hypotf_perf.cpp
index 75c61cb0592af21..ed57b186f889ba8 100644
--- a/libc/test/src/math/differential_testing/hypotf_perf.cpp
+++ b/libc/test/src/math/differential_testing/hypotf_perf.cpp
@@ -12,5 +12,5 @@
#include <math.h>
-BINARY_OP_SINGLE_OUTPUT_PERF(float, __llvm_libc::hypotf, ::hypotf,
+BINARY_OP_SINGLE_OUTPUT_PERF(float, LIBC_NAMESPACE::hypotf, ::hypotf,
"hypotf_perf.log")
diff --git a/libc/test/src/math/differential_testing/log10f_perf.cpp b/libc/test/src/math/differential_testing/log10f_perf.cpp
index e890d0393e0af84..60c1161a31cf963 100644
--- a/libc/test/src/math/differential_testing/log10f_perf.cpp
+++ b/libc/test/src/math/differential_testing/log10f_perf.cpp
@@ -12,5 +12,5 @@
#include <math.h>
-SINGLE_INPUT_SINGLE_OUTPUT_PERF(float, __llvm_libc::log10f, ::log10f,
+SINGLE_INPUT_SINGLE_OUTPUT_PERF(float, LIBC_NAMESPACE::log10f, ::log10f,
"log10f_perf.log")
diff --git a/libc/test/src/math/differential_testing/log1pf_perf.cpp b/libc/test/src/math/differential_testing/log1pf_perf.cpp
index 9904aba10d35e4d..5cd523d82184cc3 100644
--- a/libc/test/src/math/differential_testing/log1pf_perf.cpp
+++ b/libc/test/src/math/differential_testing/log1pf_perf.cpp
@@ -12,5 +12,5 @@
#include <math.h>
-SINGLE_INPUT_SINGLE_OUTPUT_PERF(float, __llvm_libc::log1pf, ::log1pf,
+SINGLE_INPUT_SINGLE_OUTPUT_PERF(float, LIBC_NAMESPACE::log1pf, ::log1pf,
"log1pf_perf.log")
diff --git a/libc/test/src/math/differential_testing/log2f_diff.cpp b/libc/test/src/math/differential_testing/log2f_diff.cpp
index 48aec5cb7a8c573..aef431dce48701e 100644
--- a/libc/test/src/math/differential_testing/log2f_diff.cpp
+++ b/libc/test/src/math/differential_testing/log2f_diff.cpp
@@ -12,5 +12,5 @@
#include <math.h>
-SINGLE_INPUT_SINGLE_OUTPUT_DIFF(float, __llvm_libc::log2f, ::log2f,
+SINGLE_INPUT_SINGLE_OUTPUT_DIFF(float, LIBC_NAMESPACE::log2f, ::log2f,
"log2f_diff.log")
diff --git a/libc/test/src/math/differential_testing/log2f_perf.cpp b/libc/test/src/math/differential_testing/log2f_perf.cpp
index 5bab271fc49e00f..ee899394c421ede 100644
--- a/libc/test/src/math/differential_testing/log2f_perf.cpp
+++ b/libc/test/src/math/differential_testing/log2f_perf.cpp
@@ -12,5 +12,5 @@
#include <math.h>
-SINGLE_INPUT_SINGLE_OUTPUT_PERF(float, __llvm_libc::log2f, ::log2f,
+SINGLE_INPUT_SINGLE_OUTPUT_PERF(float, LIBC_NAMESPACE::log2f, ::log2f,
"log2f_perf.log")
diff --git a/libc/test/src/math/differential_testing/logbf_diff.cpp b/libc/test/src/math/differential_testing/logbf_diff.cpp
index 93439c7fc89816f..37441eb40a4dfaf 100644
--- a/libc/test/src/math/differential_testing/logbf_diff.cpp
+++ b/libc/test/src/math/differential_testing/logbf_diff.cpp
@@ -12,5 +12,5 @@
#include <math.h>
-SINGLE_INPUT_SINGLE_OUTPUT_DIFF(float, __llvm_libc::logbf, ::logbf,
+SINGLE_INPUT_SINGLE_OUTPUT_DIFF(float, LIBC_NAMESPACE::logbf, ::logbf,
"logbf_diff.log")
diff --git a/libc/test/src/math/differential_testing/logbf_perf.cpp b/libc/test/src/math/differential_testing/logbf_perf.cpp
index 38fa331d2664481..89d5bd13f9316b6 100644
--- a/libc/test/src/math/differential_testing/logbf_perf.cpp
+++ b/libc/test/src/math/differential_testing/logbf_perf.cpp
@@ -12,5 +12,5 @@
#include <math.h>
-SINGLE_INPUT_SINGLE_OUTPUT_PERF(float, __llvm_libc::logbf, ::logbf,
+SINGLE_INPUT_SINGLE_OUTPUT_PERF(float, LIBC_NAMESPACE::logbf, ::logbf,
"logbf_perf.log")
diff --git a/libc/test/src/math/differential_testing/logf_diff.cpp b/libc/test/src/math/differential_testing/logf_diff.cpp
index 6f5c1ef907e706c..4ed1307f7120810 100644
--- a/libc/test/src/math/differential_testing/logf_diff.cpp
+++ b/libc/test/src/math/differential_testing/logf_diff.cpp
@@ -12,5 +12,5 @@
#include <math.h>
-SINGLE_INPUT_SINGLE_OUTPUT_DIFF(float, __llvm_libc::logf, ::logf,
+SINGLE_INPUT_SINGLE_OUTPUT_DIFF(float, LIBC_NAMESPACE::logf, ::logf,
"logf_diff.log")
diff --git a/libc/test/src/math/differential_testing/logf_perf.cpp b/libc/test/src/math/differential_testing/logf_perf.cpp
index ed907ed61048f58..f1b3f986bd40a38 100644
--- a/libc/test/src/math/differential_testing/logf_perf.cpp
+++ b/libc/test/src/math/differential_testing/logf_perf.cpp
@@ -12,5 +12,5 @@
#include <math.h>
-SINGLE_INPUT_SINGLE_OUTPUT_PERF(float, __llvm_libc::logf, ::logf,
+SINGLE_INPUT_SINGLE_OUTPUT_PERF(float, LIBC_NAMESPACE::logf, ::logf,
"logf_perf.log")
diff --git a/libc/test/src/math/differential_testing/nearbyintf_diff.cpp b/libc/test/src/math/differential_testing/nearbyintf_diff.cpp
index dfcf2fd1cc0e5f1..14200116883db4c 100644
--- a/libc/test/src/math/differential_testing/nearbyintf_diff.cpp
+++ b/libc/test/src/math/differential_testing/nearbyintf_diff.cpp
@@ -12,5 +12,5 @@
#include <math.h>
-SINGLE_INPUT_SINGLE_OUTPUT_DIFF(float, __llvm_libc::nearbyintf, ::nearbyintf,
+SINGLE_INPUT_SINGLE_OUTPUT_DIFF(float, LIBC_NAMESPACE::nearbyintf, ::nearbyintf,
"nearbyintf_diff.log")
diff --git a/libc/test/src/math/differential_testing/nearbyintf_perf.cpp b/libc/test/src/math/differential_testing/nearbyintf_perf.cpp
index 6ee98a967a70641..9c5736fb4ab0480 100644
--- a/libc/test/src/math/differential_testing/nearbyintf_perf.cpp
+++ b/libc/test/src/math/differential_testing/nearbyintf_perf.cpp
@@ -12,5 +12,5 @@
#include <math.h>
-SINGLE_INPUT_SINGLE_OUTPUT_PERF(float, __llvm_libc::nearbyintf, ::nearbyintf,
+SINGLE_INPUT_SINGLE_OUTPUT_PERF(float, LIBC_NAMESPACE::nearbyintf, ::nearbyintf,
"nearbyintf_perf.log")
diff --git a/libc/test/src/math/differential_testing/rintf_diff.cpp b/libc/test/src/math/differential_testing/rintf_diff.cpp
index 2ed954dde5484c6..e60f66085e5d705 100644
--- a/libc/test/src/math/differential_testing/rintf_diff.cpp
+++ b/libc/test/src/math/differential_testing/rintf_diff.cpp
@@ -12,5 +12,5 @@
#include <math.h>
-SINGLE_INPUT_SINGLE_OUTPUT_DIFF(float, __llvm_libc::rintf, ::rintf,
+SINGLE_INPUT_SINGLE_OUTPUT_DIFF(float, LIBC_NAMESPACE::rintf, ::rintf,
"rintf_diff.log")
diff --git a/libc/test/src/math/differential_testing/rintf_perf.cpp b/libc/test/src/math/differential_testing/rintf_perf.cpp
index 517f04b688e5616..432e5da77f3789e 100644
--- a/libc/test/src/math/differential_testing/rintf_perf.cpp
+++ b/libc/test/src/math/differential_testing/rintf_perf.cpp
@@ -12,5 +12,5 @@
#include <math.h>
-SINGLE_INPUT_SINGLE_OUTPUT_PERF(float, __llvm_libc::rintf, ::rintf,
+SINGLE_INPUT_SINGLE_OUTPUT_PERF(float, LIBC_NAMESPACE::rintf, ::rintf,
"rintf_perf.log")
diff --git a/libc/test/src/math/differential_testing/roundf_diff.cpp b/libc/test/src/math/differential_testing/roundf_diff.cpp
index 803566a9e4b843e..e1401a01af3574d 100644
--- a/libc/test/src/math/differential_testing/roundf_diff.cpp
+++ b/libc/test/src/math/differential_testing/roundf_diff.cpp
@@ -12,5 +12,5 @@
#include <math.h>
-SINGLE_INPUT_SINGLE_OUTPUT_DIFF(float, __llvm_libc::roundf, ::roundf,
+SINGLE_INPUT_SINGLE_OUTPUT_DIFF(float, LIBC_NAMESPACE::roundf, ::roundf,
"roundf_diff.log")
diff --git a/libc/test/src/math/differential_testing/roundf_perf.cpp b/libc/test/src/math/differential_testing/roundf_perf.cpp
index 51be6f187e26be8..091c7b2b86800f4 100644
--- a/libc/test/src/math/differential_testing/roundf_perf.cpp
+++ b/libc/test/src/math/differential_testing/roundf_perf.cpp
@@ -12,5 +12,5 @@
#include <math.h>
-SINGLE_INPUT_SINGLE_OUTPUT_PERF(float, __llvm_libc::roundf, ::roundf,
+SINGLE_INPUT_SINGLE_OUTPUT_PERF(float, LIBC_NAMESPACE::roundf, ::roundf,
"roundf_perf.log")
diff --git a/libc/test/src/math/differential_testing/sinf_diff.cpp b/libc/test/src/math/differential_testing/sinf_diff.cpp
index d69db9b1a136bf8..cb4557e6796b556 100644
--- a/libc/test/src/math/differential_testing/sinf_diff.cpp
+++ b/libc/test/src/math/differential_testing/sinf_diff.cpp
@@ -12,5 +12,5 @@
#include <math.h>
-SINGLE_INPUT_SINGLE_OUTPUT_DIFF(float, __llvm_libc::sinf, ::sinf,
+SINGLE_INPUT_SINGLE_OUTPUT_DIFF(float, LIBC_NAMESPACE::sinf, ::sinf,
"sinf_diff.log")
diff --git a/libc/test/src/math/differential_testing/sinf_perf.cpp b/libc/test/src/math/differential_testing/sinf_perf.cpp
index b32821a9483236a..7247bca2853d881 100644
--- a/libc/test/src/math/differential_testing/sinf_perf.cpp
+++ b/libc/test/src/math/differential_testing/sinf_perf.cpp
@@ -12,5 +12,5 @@
#include <math.h>
-SINGLE_INPUT_SINGLE_OUTPUT_PERF(float, __llvm_libc::sinf, ::sinf,
+SINGLE_INPUT_SINGLE_OUTPUT_PERF(float, LIBC_NAMESPACE::sinf, ::sinf,
"sinf_perf.log")
diff --git a/libc/test/src/math/differential_testing/sqrtf_diff.cpp b/libc/test/src/math/differential_testing/sqrtf_diff.cpp
index 3fdcf930d2582bf..22ddeaac9caf999 100644
--- a/libc/test/src/math/differential_testing/sqrtf_diff.cpp
+++ b/libc/test/src/math/differential_testing/sqrtf_diff.cpp
@@ -12,5 +12,5 @@
#include <math.h>
-SINGLE_INPUT_SINGLE_OUTPUT_DIFF(float, __llvm_libc::sqrtf, ::sqrtf,
+SINGLE_INPUT_SINGLE_OUTPUT_DIFF(float, LIBC_NAMESPACE::sqrtf, ::sqrtf,
"sqrtf_diff.log")
diff --git a/libc/test/src/math/differential_testing/sqrtf_perf.cpp b/libc/test/src/math/differential_testing/sqrtf_perf.cpp
index d3ceb9d46fb2733..5ae586ba31267dd 100644
--- a/libc/test/src/math/differential_testing/sqrtf_perf.cpp
+++ b/libc/test/src/math/differential_testing/sqrtf_perf.cpp
@@ -12,5 +12,5 @@
#include <math.h>
-SINGLE_INPUT_SINGLE_OUTPUT_PERF(float, __llvm_libc::sqrtf, ::sqrtf,
+SINGLE_INPUT_SINGLE_OUTPUT_PERF(float, LIBC_NAMESPACE::sqrtf, ::sqrtf,
"sqrtf_perf.log")
diff --git a/libc/test/src/math/differential_testing/truncf_diff.cpp b/libc/test/src/math/differential_testing/truncf_diff.cpp
index 30ed0fab1d898c6..7f6ac4e6a926941 100644
--- a/libc/test/src/math/differential_testing/truncf_diff.cpp
+++ b/libc/test/src/math/differential_testing/truncf_diff.cpp
@@ -12,5 +12,5 @@
#include <math.h>
-SINGLE_INPUT_SINGLE_OUTPUT_DIFF(float, __llvm_libc::truncf, ::truncf,
+SINGLE_INPUT_SINGLE_OUTPUT_DIFF(float, LIBC_NAMESPACE::truncf, ::truncf,
"truncf_diff.log")
diff --git a/libc/test/src/math/differential_testing/truncf_perf.cpp b/libc/test/src/math/differential_testing/truncf_perf.cpp
index f5cee930003eac0..e07db1320fddd79 100644
--- a/libc/test/src/math/differential_testing/truncf_perf.cpp
+++ b/libc/test/src/math/differential_testing/truncf_perf.cpp
@@ -12,5 +12,5 @@
#include <math.h>
-SINGLE_INPUT_SINGLE_OUTPUT_PERF(float, __llvm_libc::truncf, ::truncf,
+SINGLE_INPUT_SINGLE_OUTPUT_PERF(float, LIBC_NAMESPACE::truncf, ::truncf,
"truncf_perf.log")
diff --git a/libc/test/src/math/erff_test.cpp b/libc/test/src/math/erff_test.cpp
index a25ac6f0fca4c97..3cb24778d96a151 100644
--- a/libc/test/src/math/erff_test.cpp
+++ b/libc/test/src/math/erff_test.cpp
@@ -16,17 +16,17 @@
#include <errno.h>
#include <stdint.h>
-namespace mpfr = __llvm_libc::testing::mpfr;
-using __llvm_libc::testing::tlog;
+namespace mpfr = LIBC_NAMESPACE::testing::mpfr;
+using LIBC_NAMESPACE::testing::tlog;
DECLARE_SPECIAL_CONSTANTS(float)
TEST(LlvmLibcErffTest, SpecialNumbers) {
- EXPECT_FP_EQ_ALL_ROUNDING(aNaN, __llvm_libc::erff(aNaN));
- EXPECT_FP_EQ_ALL_ROUNDING(1.0f, __llvm_libc::erff(inf));
- EXPECT_FP_EQ_ALL_ROUNDING(-1.0f, __llvm_libc::erff(neg_inf));
- EXPECT_FP_EQ_ALL_ROUNDING(zero, __llvm_libc::erff(zero));
- EXPECT_FP_EQ_ALL_ROUNDING(neg_zero, __llvm_libc::erff(neg_zero));
+ EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::erff(aNaN));
+ EXPECT_FP_EQ_ALL_ROUNDING(1.0f, LIBC_NAMESPACE::erff(inf));
+ EXPECT_FP_EQ_ALL_ROUNDING(-1.0f, LIBC_NAMESPACE::erff(neg_inf));
+ EXPECT_FP_EQ_ALL_ROUNDING(zero, LIBC_NAMESPACE::erff(zero));
+ EXPECT_FP_EQ_ALL_ROUNDING(neg_zero, LIBC_NAMESPACE::erff(neg_zero));
}
TEST(LlvmLibcErffTest, TrickyInputs) {
@@ -38,9 +38,9 @@ TEST(LlvmLibcErffTest, TrickyInputs) {
for (int i = 0; i < N; ++i) {
float x = float(FPBits(INPUTS[i]));
EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Erf, x,
- __llvm_libc::erff(x), 0.5);
+ LIBC_NAMESPACE::erff(x), 0.5);
EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Erf, -x,
- __llvm_libc::erff(-x), 0.5);
+ LIBC_NAMESPACE::erff(-x), 0.5);
}
}
@@ -67,7 +67,7 @@ TEST(LlvmLibcErffTest, InFloatRange) {
if (isnan(x))
continue;
- float result = __llvm_libc::erff(x);
+ float result = LIBC_NAMESPACE::erff(x);
++cc;
if (isnan(result))
continue;
diff --git a/libc/test/src/math/exhaustive/acosf_test.cpp b/libc/test/src/math/exhaustive/acosf_test.cpp
index 4cece0b76ecacbf..df4adae5fd0e64f 100644
--- a/libc/test/src/math/exhaustive/acosf_test.cpp
+++ b/libc/test/src/math/exhaustive/acosf_test.cpp
@@ -10,11 +10,11 @@
#include "src/math/acosf.h"
#include "utils/MPFRWrapper/MPFRUtils.h"
-namespace mpfr = __llvm_libc::testing::mpfr;
+namespace mpfr = LIBC_NAMESPACE::testing::mpfr;
using LlvmLibcAcosfExhaustiveTest =
LlvmLibcUnaryOpExhaustiveMathTest<float, mpfr::Operation::Acos,
- __llvm_libc::acosf>;
+ LIBC_NAMESPACE::acosf>;
// Range: [0, Inf];
static constexpr uint32_t POS_START = 0x0000'0000U;
diff --git a/libc/test/src/math/exhaustive/acoshf_test.cpp b/libc/test/src/math/exhaustive/acoshf_test.cpp
index 1dd993c26b8cacb..eff8b64a7dae1a0 100644
--- a/libc/test/src/math/exhaustive/acoshf_test.cpp
+++ b/libc/test/src/math/exhaustive/acoshf_test.cpp
@@ -10,11 +10,11 @@
#include "src/math/acoshf.h"
#include "utils/MPFRWrapper/MPFRUtils.h"
-namespace mpfr = __llvm_libc::testing::mpfr;
+namespace mpfr = LIBC_NAMESPACE::testing::mpfr;
using LlvmLibcAcoshfExhaustiveTest =
LlvmLibcUnaryOpExhaustiveMathTest<float, mpfr::Operation::Acosh,
- __llvm_libc::acoshf>;
+ LIBC_NAMESPACE::acoshf>;
// Range: [1, Inf];
static constexpr uint32_t POS_START = 0x3f80'0000U;
diff --git a/libc/test/src/math/exhaustive/asinf_test.cpp b/libc/test/src/math/exhaustive/asinf_test.cpp
index 5dcb625304a1f5e..f88d254b0750414 100644
--- a/libc/test/src/math/exhaustive/asinf_test.cpp
+++ b/libc/test/src/math/exhaustive/asinf_test.cpp
@@ -10,11 +10,11 @@
#include "src/math/asinf.h"
#include "utils/MPFRWrapper/MPFRUtils.h"
-namespace mpfr = __llvm_libc::testing::mpfr;
+namespace mpfr = LIBC_NAMESPACE::testing::mpfr;
using LlvmLibcAsinfExhaustiveTest =
LlvmLibcUnaryOpExhaustiveMathTest<float, mpfr::Operation::Asin,
- __llvm_libc::asinf>;
+ LIBC_NAMESPACE::asinf>;
// Range: [0, Inf];
static constexpr uint32_t POS_START = 0x0000'0000U;
diff --git a/libc/test/src/math/exhaustive/asinhf_test.cpp b/libc/test/src/math/exhaustive/asinhf_test.cpp
index 6af0ec0d6b03d14..8bc62bd393dac4a 100644
--- a/libc/test/src/math/exhaustive/asinhf_test.cpp
+++ b/libc/test/src/math/exhaustive/asinhf_test.cpp
@@ -10,11 +10,11 @@
#include "src/math/asinhf.h"
#include "utils/MPFRWrapper/MPFRUtils.h"
-namespace mpfr = __llvm_libc::testing::mpfr;
+namespace mpfr = LIBC_NAMESPACE::testing::mpfr;
using LlvmLibcAsinhfExhaustiveTest =
LlvmLibcUnaryOpExhaustiveMathTest<float, mpfr::Operation::Asinh,
- __llvm_libc::asinhf>;
+ LIBC_NAMESPACE::asinhf>;
// Range: [0, Inf];
static constexpr uint32_t POS_START = 0x0000'0000U;
diff --git a/libc/test/src/math/exhaustive/atanf_test.cpp b/libc/test/src/math/exhaustive/atanf_test.cpp
index c7c891ecbbd1ec8..508c288b050c55e 100644
--- a/libc/test/src/math/exhaustive/atanf_test.cpp
+++ b/libc/test/src/math/exhaustive/atanf_test.cpp
@@ -10,11 +10,11 @@
#include "src/math/atanf.h"
#include "utils/MPFRWrapper/MPFRUtils.h"
-namespace mpfr = __llvm_libc::testing::mpfr;
+namespace mpfr = LIBC_NAMESPACE::testing::mpfr;
using LlvmLibcAtanfExhaustiveTest =
LlvmLibcUnaryOpExhaustiveMathTest<float, mpfr::Operation::Atan,
- __llvm_libc::atanf>;
+ LIBC_NAMESPACE::atanf>;
// Range: [0, Inf];
static constexpr uint32_t POS_START = 0x0000'0000U;
diff --git a/libc/test/src/math/exhaustive/atanhf_test.cpp b/libc/test/src/math/exhaustive/atanhf_test.cpp
index 17bd6ec9dda04b0..d2e63b33a0b990f 100644
--- a/libc/test/src/math/exhaustive/atanhf_test.cpp
+++ b/libc/test/src/math/exhaustive/atanhf_test.cpp
@@ -11,11 +11,11 @@
#include "src/math/atanhf.h"
#include "utils/MPFRWrapper/MPFRUtils.h"
-using FPBits = __llvm_libc::fputil::FPBits<float>;
+using FPBits = LIBC_NAMESPACE::fputil::FPBits<float>;
using LlvmLibcAtanhfExhaustiveTest =
LlvmLibcUnaryOpExhaustiveMathTest<float, mpfr::Operation::Atanh,
- __llvm_libc::atanhf>;
+ LIBC_NAMESPACE::atanhf>;
// Range: [0, 1.0];
static const uint32_t POS_START = 0x0000'0000U;
diff --git a/libc/test/src/math/exhaustive/cosf_test.cpp b/libc/test/src/math/exhaustive/cosf_test.cpp
index 465d8242bc85438..89b75199ba1225e 100644
--- a/libc/test/src/math/exhaustive/cosf_test.cpp
+++ b/libc/test/src/math/exhaustive/cosf_test.cpp
@@ -10,11 +10,11 @@
#include "src/math/cosf.h"
#include "utils/MPFRWrapper/MPFRUtils.h"
-namespace mpfr = __llvm_libc::testing::mpfr;
+namespace mpfr = LIBC_NAMESPACE::testing::mpfr;
using LlvmLibcCosfExhaustiveTest =
LlvmLibcUnaryOpExhaustiveMathTest<float, mpfr::Operation::Cos,
- __llvm_libc::cosf>;
+ LIBC_NAMESPACE::cosf>;
// Range: [0, Inf];
static constexpr uint32_t POS_START = 0x0000'0000U;
diff --git a/libc/test/src/math/exhaustive/coshf_test.cpp b/libc/test/src/math/exhaustive/coshf_test.cpp
index 5fb4856b0cf79c8..cbfa654800bfd75 100644
--- a/libc/test/src/math/exhaustive/coshf_test.cpp
+++ b/libc/test/src/math/exhaustive/coshf_test.cpp
@@ -10,11 +10,11 @@
#include "src/math/coshf.h"
#include "utils/MPFRWrapper/MPFRUtils.h"
-namespace mpfr = __llvm_libc::testing::mpfr;
+namespace mpfr = LIBC_NAMESPACE::testing::mpfr;
using LlvmLibcCoshfExhaustiveTest =
LlvmLibcUnaryOpExhaustiveMathTest<float, mpfr::Operation::Cosh,
- __llvm_libc::coshf>;
+ LIBC_NAMESPACE::coshf>;
// Range: [0, Inf];
static constexpr uint32_t POS_START = 0x0000'0000U;
diff --git a/libc/test/src/math/exhaustive/erff_test.cpp b/libc/test/src/math/exhaustive/erff_test.cpp
index f8e1a1b3106317a..5b8884a9d4d0c1a 100644
--- a/libc/test/src/math/exhaustive/erff_test.cpp
+++ b/libc/test/src/math/exhaustive/erff_test.cpp
@@ -10,11 +10,11 @@
#include "src/math/erff.h"
#include "utils/MPFRWrapper/MPFRUtils.h"
-namespace mpfr = __llvm_libc::testing::mpfr;
+namespace mpfr = LIBC_NAMESPACE::testing::mpfr;
using LlvmLibcErffExhaustiveTest =
LlvmLibcUnaryOpExhaustiveMathTest<float, mpfr::Operation::Erf,
- __llvm_libc::erff>;
+ LIBC_NAMESPACE::erff>;
// Range: [0, Inf];
static constexpr uint32_t POS_START = 0x0000'0000U;
diff --git a/libc/test/src/math/exhaustive/exhaustive_test.h b/libc/test/src/math/exhaustive/exhaustive_test.h
index 00dad034dd6cc41..c4e68d40e8e91e7 100644
--- a/libc/test/src/math/exhaustive/exhaustive_test.h
+++ b/libc/test/src/math/exhaustive/exhaustive_test.h
@@ -33,14 +33,14 @@
// or test_full_range_all_roundings(start, stop).
// * For single input single output math function, use the convenient template:
// LlvmLibcUnaryOpExhaustiveMathTest<FloatType, Op, Func>.
-namespace mpfr = __llvm_libc::testing::mpfr;
+namespace mpfr = LIBC_NAMESPACE::testing::mpfr;
template <typename T> using UnaryOp = T(T);
template <typename T, mpfr::Operation Op, UnaryOp<T> Func>
-struct UnaryOpChecker : public virtual __llvm_libc::testing::Test {
+struct UnaryOpChecker : public virtual LIBC_NAMESPACE::testing::Test {
using FloatType = T;
- using FPBits = __llvm_libc::fputil::FPBits<FloatType>;
+ using FPBits = LIBC_NAMESPACE::fputil::FPBits<FloatType>;
using UIntType = typename FPBits::UIntType;
static constexpr UnaryOp<FloatType> *FUNC = Func;
@@ -67,11 +67,12 @@ struct UnaryOpChecker : public virtual __llvm_libc::testing::Test {
}
};
-// Checker class needs inherit from __llvm_libc::testing::Test and provide
+// Checker class needs inherit from LIBC_NAMESPACE::testing::Test and provide
// UIntType and check method.
template <typename Checker>
-struct LlvmLibcExhaustiveMathTest : public virtual __llvm_libc::testing::Test,
- public Checker {
+struct LlvmLibcExhaustiveMathTest
+ : public virtual LIBC_NAMESPACE::testing::Test,
+ public Checker {
using FloatType = typename Checker::FloatType;
using FPBits = typename Checker::FPBits;
using UIntType = typename Checker::UIntType;
diff --git a/libc/test/src/math/exhaustive/exp10f_test.cpp b/libc/test/src/math/exhaustive/exp10f_test.cpp
index eba0f65de1a8fc7..0daad67847b3320 100644
--- a/libc/test/src/math/exhaustive/exp10f_test.cpp
+++ b/libc/test/src/math/exhaustive/exp10f_test.cpp
@@ -10,11 +10,11 @@
#include "src/math/exp10f.h"
#include "utils/MPFRWrapper/MPFRUtils.h"
-namespace mpfr = __llvm_libc::testing::mpfr;
+namespace mpfr = LIBC_NAMESPACE::testing::mpfr;
using LlvmLibcExp10fExhaustiveTest =
LlvmLibcUnaryOpExhaustiveMathTest<float, mpfr::Operation::Exp10,
- __llvm_libc::exp10f>;
+ LIBC_NAMESPACE::exp10f>;
// Range: [0, Inf];
static constexpr uint32_t POS_START = 0x0000'0000U;
diff --git a/libc/test/src/math/exhaustive/exp2f_test.cpp b/libc/test/src/math/exhaustive/exp2f_test.cpp
index 8c9b88988ba68c4..6b91c36b29e330a 100644
--- a/libc/test/src/math/exhaustive/exp2f_test.cpp
+++ b/libc/test/src/math/exhaustive/exp2f_test.cpp
@@ -10,11 +10,11 @@
#include "src/math/exp2f.h"
#include "utils/MPFRWrapper/MPFRUtils.h"
-namespace mpfr = __llvm_libc::testing::mpfr;
+namespace mpfr = LIBC_NAMESPACE::testing::mpfr;
using LlvmLibcExp2fExhaustiveTest =
LlvmLibcUnaryOpExhaustiveMathTest<float, mpfr::Operation::Exp2,
- __llvm_libc::exp2f>;
+ LIBC_NAMESPACE::exp2f>;
// Range: [0, Inf];
static constexpr uint32_t POS_START = 0x0000'0000U;
diff --git a/libc/test/src/math/exhaustive/expf_test.cpp b/libc/test/src/math/exhaustive/expf_test.cpp
index 75002a2de96538b..79ab79433362ae8 100644
--- a/libc/test/src/math/exhaustive/expf_test.cpp
+++ b/libc/test/src/math/exhaustive/expf_test.cpp
@@ -10,11 +10,11 @@
#include "src/math/expf.h"
#include "utils/MPFRWrapper/MPFRUtils.h"
-namespace mpfr = __llvm_libc::testing::mpfr;
+namespace mpfr = LIBC_NAMESPACE::testing::mpfr;
using LlvmLibcExpfExhaustiveTest =
LlvmLibcUnaryOpExhaustiveMathTest<float, mpfr::Operation::Exp,
- __llvm_libc::expf>;
+ LIBC_NAMESPACE::expf>;
// Range: [0, Inf];
static constexpr uint32_t POS_START = 0x0000'0000U;
diff --git a/libc/test/src/math/exhaustive/expm1f_test.cpp b/libc/test/src/math/exhaustive/expm1f_test.cpp
index 2cd27f1e88f2769..9c50f1a70aa74db 100644
--- a/libc/test/src/math/exhaustive/expm1f_test.cpp
+++ b/libc/test/src/math/exhaustive/expm1f_test.cpp
@@ -10,11 +10,11 @@
#include "src/math/expm1f.h"
#include "utils/MPFRWrapper/MPFRUtils.h"
-namespace mpfr = __llvm_libc::testing::mpfr;
+namespace mpfr = LIBC_NAMESPACE::testing::mpfr;
using LlvmLibcExpm1fExhaustiveTest =
LlvmLibcUnaryOpExhaustiveMathTest<float, mpfr::Operation::Expm1,
- __llvm_libc::expm1f>;
+ LIBC_NAMESPACE::expm1f>;
// Range: [0, Inf];
static constexpr uint32_t POS_START = 0x0000'0000U;
diff --git a/libc/test/src/math/exhaustive/fmod_generic_impl_test.cpp b/libc/test/src/math/exhaustive/fmod_generic_impl_test.cpp
index 1273cf0b588bd1b..b47d24c54869bba 100644
--- a/libc/test/src/math/exhaustive/fmod_generic_impl_test.cpp
+++ b/libc/test/src/math/exhaustive/fmod_generic_impl_test.cpp
@@ -14,15 +14,15 @@
#include <array>
#include <limits>
-namespace mpfr = __llvm_libc::testing::mpfr;
+namespace mpfr = LIBC_NAMESPACE::testing::mpfr;
template <typename T, bool InverseMultiplication>
-class LlvmLibcFModTest : public __llvm_libc::testing::Test {
+class LlvmLibcFModTest : public LIBC_NAMESPACE::testing::Test {
- using DivisionHelper = __llvm_libc::cpp::conditional_t<
+ using DivisionHelper = LIBC_NAMESPACE::cpp::conditional_t<
InverseMultiplication,
- __llvm_libc::fputil::generic::FModDivisionInvMultHelper<T>,
- __llvm_libc::fputil::generic::FModDivisionSimpleHelper<T>>;
+ LIBC_NAMESPACE::fputil::generic::FModDivisionInvMultHelper<T>,
+ LIBC_NAMESPACE::fputil::generic::FModDivisionSimpleHelper<T>>;
static constexpr std::array<T, 11> test_bases = {
T(0.0),
@@ -39,8 +39,8 @@ class LlvmLibcFModTest : public __llvm_libc::testing::Test {
public:
void testExtensive() {
- using FMod = __llvm_libc::fputil::generic::FMod<
- T, __llvm_libc::fputil::generic::FModFastMathWrapper<T>,
+ using FMod = LIBC_NAMESPACE::fputil::generic::FMod<
+ T, LIBC_NAMESPACE::fputil::generic::FModFastMathWrapper<T>,
DivisionHelper>;
using nl = std::numeric_limits<T>;
int min2 = nl::min_exponent - nl::digits - 5;
diff --git a/libc/test/src/math/exhaustive/hypotf_test.cpp b/libc/test/src/math/exhaustive/hypotf_test.cpp
index c45e7412a7b1265..8812f0e5dcde34a 100644
--- a/libc/test/src/math/exhaustive/hypotf_test.cpp
+++ b/libc/test/src/math/exhaustive/hypotf_test.cpp
@@ -13,11 +13,11 @@
#include "test/UnitTest/FPMatcher.h"
#include "utils/MPFRWrapper/MPFRUtils.h"
-namespace mpfr = __llvm_libc::testing::mpfr;
+namespace mpfr = LIBC_NAMESPACE::testing::mpfr;
-struct HypotfChecker : public virtual __llvm_libc::testing::Test {
+struct HypotfChecker : public virtual LIBC_NAMESPACE::testing::Test {
using FloatType = float;
- using FPBits = __llvm_libc::fputil::FPBits<float>;
+ using FPBits = LIBC_NAMESPACE::fputil::FPBits<float>;
using UIntType = typename FPBits::UIntType;
uint64_t check(uint32_t start, uint32_t stop, mpfr::RoundingMode rounding) {
@@ -35,12 +35,12 @@ struct HypotfChecker : public virtual __llvm_libc::testing::Test {
uint32_t ybits = Y_START;
do {
float y = float(FPBits(ybits));
- bool correct = TEST_FP_EQ(__llvm_libc::fputil::hypot(x, y),
- __llvm_libc::hypotf(x, y));
+ bool correct = TEST_FP_EQ(LIBC_NAMESPACE::fputil::hypot(x, y),
+ LIBC_NAMESPACE::hypotf(x, y));
// Using MPFR will be much slower.
// mpfr::BinaryInput<float> input{x, y};
// bool correct = TEST_MPFR_MATCH_ROUNDING_SILENTLY(
- // mpfr::Operation::Hypot, input, __llvm_libc::hypotf(x, y), 0.5,
+ // mpfr::Operation::Hypot, input, LIBC_NAMESPACE::hypotf(x, y), 0.5,
// rounding);
failed += (!correct);
} while (ybits++ < Y_STOP);
diff --git a/libc/test/src/math/exhaustive/log10f_test.cpp b/libc/test/src/math/exhaustive/log10f_test.cpp
index 912fda144be674e..d626df07e28f419 100644
--- a/libc/test/src/math/exhaustive/log10f_test.cpp
+++ b/libc/test/src/math/exhaustive/log10f_test.cpp
@@ -10,11 +10,11 @@
#include "src/math/log10f.h"
#include "utils/MPFRWrapper/MPFRUtils.h"
-namespace mpfr = __llvm_libc::testing::mpfr;
+namespace mpfr = LIBC_NAMESPACE::testing::mpfr;
using LlvmLibcLog10fExhaustiveTest =
LlvmLibcUnaryOpExhaustiveMathTest<float, mpfr::Operation::Log10,
- __llvm_libc::log10f>;
+ LIBC_NAMESPACE::log10f>;
// Range: [0, Inf];
static constexpr uint32_t POS_START = 0x0000'0000U;
diff --git a/libc/test/src/math/exhaustive/log1pf_test.cpp b/libc/test/src/math/exhaustive/log1pf_test.cpp
index 992781571f03549..698e08e543871c6 100644
--- a/libc/test/src/math/exhaustive/log1pf_test.cpp
+++ b/libc/test/src/math/exhaustive/log1pf_test.cpp
@@ -10,11 +10,11 @@
#include "src/math/log1pf.h"
#include "utils/MPFRWrapper/MPFRUtils.h"
-namespace mpfr = __llvm_libc::testing::mpfr;
+namespace mpfr = LIBC_NAMESPACE::testing::mpfr;
using LlvmLibcLog1pfExhaustiveTest =
LlvmLibcUnaryOpExhaustiveMathTest<float, mpfr::Operation::Log1p,
- __llvm_libc::log1pf>;
+ LIBC_NAMESPACE::log1pf>;
// Range: [0, Inf];
static constexpr uint32_t POS_START = 0x0000'0000U;
diff --git a/libc/test/src/math/exhaustive/log2f_test.cpp b/libc/test/src/math/exhaustive/log2f_test.cpp
index 249ea2e1dfaa145..a84b0964c6045c0 100644
--- a/libc/test/src/math/exhaustive/log2f_test.cpp
+++ b/libc/test/src/math/exhaustive/log2f_test.cpp
@@ -10,11 +10,11 @@
#include "src/math/log2f.h"
#include "utils/MPFRWrapper/MPFRUtils.h"
-namespace mpfr = __llvm_libc::testing::mpfr;
+namespace mpfr = LIBC_NAMESPACE::testing::mpfr;
using LlvmLibcLog2fExhaustiveTest =
LlvmLibcUnaryOpExhaustiveMathTest<float, mpfr::Operation::Log2,
- __llvm_libc::log2f>;
+ LIBC_NAMESPACE::log2f>;
// Range: [0, Inf];
static constexpr uint32_t POS_START = 0x0000'0000U;
diff --git a/libc/test/src/math/exhaustive/logf_test.cpp b/libc/test/src/math/exhaustive/logf_test.cpp
index cf54ba5e78c23f8..2f0ff201e562241 100644
--- a/libc/test/src/math/exhaustive/logf_test.cpp
+++ b/libc/test/src/math/exhaustive/logf_test.cpp
@@ -10,11 +10,11 @@
#include "src/math/logf.h"
#include "utils/MPFRWrapper/MPFRUtils.h"
-namespace mpfr = __llvm_libc::testing::mpfr;
+namespace mpfr = LIBC_NAMESPACE::testing::mpfr;
using LlvmLibcLogfExhaustiveTest =
LlvmLibcUnaryOpExhaustiveMathTest<float, mpfr::Operation::Log,
- __llvm_libc::logf>;
+ LIBC_NAMESPACE::logf>;
// Range: [0, Inf];
static constexpr uint32_t POS_START = 0x0000'0000U;
diff --git a/libc/test/src/math/exhaustive/sincosf_test.cpp b/libc/test/src/math/exhaustive/sincosf_test.cpp
index 19179243047c084..f73a1a64c5e4dde 100644
--- a/libc/test/src/math/exhaustive/sincosf_test.cpp
+++ b/libc/test/src/math/exhaustive/sincosf_test.cpp
@@ -10,11 +10,11 @@
#include "src/math/sincosf.h"
#include "utils/MPFRWrapper/MPFRUtils.h"
-namespace mpfr = __llvm_libc::testing::mpfr;
+namespace mpfr = LIBC_NAMESPACE::testing::mpfr;
-struct SincosfChecker : public virtual __llvm_libc::testing::Test {
+struct SincosfChecker : public virtual LIBC_NAMESPACE::testing::Test {
using FloatType = float;
- using FPBits = __llvm_libc::fputil::FPBits<float>;
+ using FPBits = LIBC_NAMESPACE::fputil::FPBits<float>;
using UIntType = uint32_t;
uint64_t check(UIntType start, UIntType stop, mpfr::RoundingMode rounding) {
@@ -27,7 +27,7 @@ struct SincosfChecker : public virtual __llvm_libc::testing::Test {
FPBits xbits(bits);
FloatType x = FloatType(xbits);
FloatType sinx, cosx;
- __llvm_libc::sincosf(x, &sinx, &cosx);
+ LIBC_NAMESPACE::sincosf(x, &sinx, &cosx);
bool correct = TEST_MPFR_MATCH_ROUNDING_SILENTLY(mpfr::Operation::Sin, x,
sinx, 0.5, rounding);
diff --git a/libc/test/src/math/exhaustive/sinf_test.cpp b/libc/test/src/math/exhaustive/sinf_test.cpp
index 1c0ce568eadf73c..72255ae2d642123 100644
--- a/libc/test/src/math/exhaustive/sinf_test.cpp
+++ b/libc/test/src/math/exhaustive/sinf_test.cpp
@@ -10,11 +10,11 @@
#include "src/math/sinf.h"
#include "utils/MPFRWrapper/MPFRUtils.h"
-namespace mpfr = __llvm_libc::testing::mpfr;
+namespace mpfr = LIBC_NAMESPACE::testing::mpfr;
using LlvmLibcSinfExhaustiveTest =
LlvmLibcUnaryOpExhaustiveMathTest<float, mpfr::Operation::Sin,
- __llvm_libc::sinf>;
+ LIBC_NAMESPACE::sinf>;
// Range: [0, Inf];
static constexpr uint32_t POS_START = 0x0000'0000U;
diff --git a/libc/test/src/math/exhaustive/sinhf_test.cpp b/libc/test/src/math/exhaustive/sinhf_test.cpp
index 50f1094abf14f38..51505afb8c3bf1f 100644
--- a/libc/test/src/math/exhaustive/sinhf_test.cpp
+++ b/libc/test/src/math/exhaustive/sinhf_test.cpp
@@ -10,11 +10,11 @@
#include "src/math/sinhf.h"
#include "utils/MPFRWrapper/MPFRUtils.h"
-namespace mpfr = __llvm_libc::testing::mpfr;
+namespace mpfr = LIBC_NAMESPACE::testing::mpfr;
using LlvmLibcSinhfExhaustiveTest =
LlvmLibcUnaryOpExhaustiveMathTest<float, mpfr::Operation::Sinh,
- __llvm_libc::sinhf>;
+ LIBC_NAMESPACE::sinhf>;
// Range: [0, Inf];
static constexpr uint32_t POS_START = 0x0000'0000U;
diff --git a/libc/test/src/math/exhaustive/sqrtf_test.cpp b/libc/test/src/math/exhaustive/sqrtf_test.cpp
index e475182a9359a2f..6f761320554e37b 100644
--- a/libc/test/src/math/exhaustive/sqrtf_test.cpp
+++ b/libc/test/src/math/exhaustive/sqrtf_test.cpp
@@ -10,11 +10,11 @@
#include "src/math/sqrtf.h"
#include "utils/MPFRWrapper/MPFRUtils.h"
-namespace mpfr = __llvm_libc::testing::mpfr;
+namespace mpfr = LIBC_NAMESPACE::testing::mpfr;
using LlvmLibcSqrtfExhaustiveTest =
LlvmLibcUnaryOpExhaustiveMathTest<float, mpfr::Operation::Sqrt,
- __llvm_libc::sqrtf>;
+ LIBC_NAMESPACE::sqrtf>;
// Range: [0, Inf];
static constexpr uint32_t POS_START = 0x0000'0000U;
diff --git a/libc/test/src/math/exhaustive/tanf_test.cpp b/libc/test/src/math/exhaustive/tanf_test.cpp
index 9e1278b4c3ea51b..09e63ea0d89c7c1 100644
--- a/libc/test/src/math/exhaustive/tanf_test.cpp
+++ b/libc/test/src/math/exhaustive/tanf_test.cpp
@@ -11,11 +11,11 @@
#include "src/math/tanf.h"
#include "utils/MPFRWrapper/MPFRUtils.h"
-namespace mpfr = __llvm_libc::testing::mpfr;
+namespace mpfr = LIBC_NAMESPACE::testing::mpfr;
using LlvmLibcTanfExhaustiveTest =
LlvmLibcUnaryOpExhaustiveMathTest<float, mpfr::Operation::Tan,
- __llvm_libc::tanf>;
+ LIBC_NAMESPACE::tanf>;
// Range: [0, Inf];
static constexpr uint32_t POS_START = 0x0000'0000U;
diff --git a/libc/test/src/math/exhaustive/tanhf_test.cpp b/libc/test/src/math/exhaustive/tanhf_test.cpp
index 3c3951c14ffdc03..e341064d5a9ecd8 100644
--- a/libc/test/src/math/exhaustive/tanhf_test.cpp
+++ b/libc/test/src/math/exhaustive/tanhf_test.cpp
@@ -10,11 +10,11 @@
#include "src/math/tanhf.h"
#include "utils/MPFRWrapper/MPFRUtils.h"
-namespace mpfr = __llvm_libc::testing::mpfr;
+namespace mpfr = LIBC_NAMESPACE::testing::mpfr;
using LlvmLibcTanhfExhaustiveTest =
LlvmLibcUnaryOpExhaustiveMathTest<float, mpfr::Operation::Tanh,
- __llvm_libc::tanhf>;
+ LIBC_NAMESPACE::tanhf>;
// Range: [0, Inf];
static constexpr uint32_t POS_START = 0x0000'0000U;
diff --git a/libc/test/src/math/exp10_test.cpp b/libc/test/src/math/exp10_test.cpp
index 2b4c5ccc13f5d82..86d902eaad306b2 100644
--- a/libc/test/src/math/exp10_test.cpp
+++ b/libc/test/src/math/exp10_test.cpp
@@ -17,20 +17,21 @@
#include <errno.h>
#include <stdint.h>
-namespace mpfr = __llvm_libc::testing::mpfr;
-using __llvm_libc::testing::tlog;
+namespace mpfr = LIBC_NAMESPACE::testing::mpfr;
+using LIBC_NAMESPACE::testing::tlog;
DECLARE_SPECIAL_CONSTANTS(double)
TEST(LlvmLibcExp10Test, SpecialNumbers) {
- EXPECT_FP_EQ(aNaN, __llvm_libc::exp10(aNaN));
- EXPECT_FP_EQ(inf, __llvm_libc::exp10(inf));
- EXPECT_FP_EQ_ALL_ROUNDING(zero, __llvm_libc::exp10(neg_inf));
- EXPECT_FP_EQ_WITH_EXCEPTION(zero, __llvm_libc::exp10(-0x1.0p20),
+ EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::exp10(aNaN));
+ EXPECT_FP_EQ(inf, LIBC_NAMESPACE::exp10(inf));
+ EXPECT_FP_EQ_ALL_ROUNDING(zero, LIBC_NAMESPACE::exp10(neg_inf));
+ EXPECT_FP_EQ_WITH_EXCEPTION(zero, LIBC_NAMESPACE::exp10(-0x1.0p20),
FE_UNDERFLOW);
- EXPECT_FP_EQ_WITH_EXCEPTION(inf, __llvm_libc::exp10(0x1.0p20), FE_OVERFLOW);
- EXPECT_FP_EQ_ALL_ROUNDING(1.0, __llvm_libc::exp10(0.0));
- EXPECT_FP_EQ_ALL_ROUNDING(1.0, __llvm_libc::exp10(-0.0));
+ EXPECT_FP_EQ_WITH_EXCEPTION(inf, LIBC_NAMESPACE::exp10(0x1.0p20),
+ FE_OVERFLOW);
+ EXPECT_FP_EQ_ALL_ROUNDING(1.0, LIBC_NAMESPACE::exp10(0.0));
+ EXPECT_FP_EQ_ALL_ROUNDING(1.0, LIBC_NAMESPACE::exp10(-0.0));
}
TEST(LlvmLibcExp10Test, TrickyInputs) {
@@ -80,14 +81,14 @@ TEST(LlvmLibcExp10Test, TrickyInputs) {
for (int i = 0; i < N; ++i) {
double x = double(FPBits(INPUTS[i]));
EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Exp10, x,
- __llvm_libc::exp10(x), 0.5);
+ LIBC_NAMESPACE::exp10(x), 0.5);
}
}
TEST(LlvmLibcExp10Test, InDoubleRange) {
constexpr uint64_t COUNT = 1'231;
- uint64_t START = __llvm_libc::fputil::FPBits<double>(0.25).uintval();
- uint64_t STOP = __llvm_libc::fputil::FPBits<double>(4.0).uintval();
+ uint64_t START = LIBC_NAMESPACE::fputil::FPBits<double>(0.25).uintval();
+ uint64_t STOP = LIBC_NAMESPACE::fputil::FPBits<double>(4.0).uintval();
uint64_t STEP = (STOP - START) / COUNT;
auto test = [&](mpfr::RoundingMode rounding_mode) {
@@ -106,7 +107,7 @@ TEST(LlvmLibcExp10Test, InDoubleRange) {
if (isnan(x) || isinf(x) || x < 0.0)
continue;
libc_errno = 0;
- double result = __llvm_libc::exp10(x);
+ double result = LIBC_NAMESPACE::exp10(x);
++cc;
if (isnan(result) || isinf(result))
continue;
diff --git a/libc/test/src/math/exp10f_test.cpp b/libc/test/src/math/exp10f_test.cpp
index 384f9064db107f2..ac8f5515347054c 100644
--- a/libc/test/src/math/exp10f_test.cpp
+++ b/libc/test/src/math/exp10f_test.cpp
@@ -16,58 +16,58 @@
#include <stdint.h>
-namespace mpfr = __llvm_libc::testing::mpfr;
+namespace mpfr = LIBC_NAMESPACE::testing::mpfr;
DECLARE_SPECIAL_CONSTANTS(float)
TEST(LlvmLibcExp10fTest, SpecialNumbers) {
libc_errno = 0;
- EXPECT_FP_EQ(aNaN, __llvm_libc::exp10f(aNaN));
+ EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::exp10f(aNaN));
EXPECT_MATH_ERRNO(0);
- EXPECT_FP_EQ(inf, __llvm_libc::exp10f(inf));
+ EXPECT_FP_EQ(inf, LIBC_NAMESPACE::exp10f(inf));
EXPECT_MATH_ERRNO(0);
- EXPECT_FP_EQ(0.0f, __llvm_libc::exp10f(neg_inf));
+ EXPECT_FP_EQ(0.0f, LIBC_NAMESPACE::exp10f(neg_inf));
EXPECT_MATH_ERRNO(0);
- EXPECT_FP_EQ(1.0f, __llvm_libc::exp10f(0.0f));
+ EXPECT_FP_EQ(1.0f, LIBC_NAMESPACE::exp10f(0.0f));
EXPECT_MATH_ERRNO(0);
- EXPECT_FP_EQ(1.0f, __llvm_libc::exp10f(-0.0f));
+ EXPECT_FP_EQ(1.0f, LIBC_NAMESPACE::exp10f(-0.0f));
EXPECT_MATH_ERRNO(0);
}
TEST(LlvmLibcExp10fTest, Overflow) {
libc_errno = 0;
EXPECT_FP_EQ_WITH_EXCEPTION(
- inf, __llvm_libc::exp10f(float(FPBits(0x7f7fffffU))), FE_OVERFLOW);
+ inf, LIBC_NAMESPACE::exp10f(float(FPBits(0x7f7fffffU))), FE_OVERFLOW);
EXPECT_MATH_ERRNO(ERANGE);
EXPECT_FP_EQ_WITH_EXCEPTION(
- inf, __llvm_libc::exp10f(float(FPBits(0x43000000U))), FE_OVERFLOW);
+ inf, LIBC_NAMESPACE::exp10f(float(FPBits(0x43000000U))), FE_OVERFLOW);
EXPECT_MATH_ERRNO(ERANGE);
EXPECT_FP_EQ_WITH_EXCEPTION(
- inf, __llvm_libc::exp10f(float(FPBits(0x43000001U))), FE_OVERFLOW);
+ inf, LIBC_NAMESPACE::exp10f(float(FPBits(0x43000001U))), FE_OVERFLOW);
EXPECT_MATH_ERRNO(ERANGE);
}
TEST(LlvmLibcExp10fTest, Underflow) {
libc_errno = 0;
EXPECT_FP_EQ_WITH_EXCEPTION(
- 0.0f, __llvm_libc::exp10f(float(FPBits(0xff7fffffU))), FE_UNDERFLOW);
+ 0.0f, LIBC_NAMESPACE::exp10f(float(FPBits(0xff7fffffU))), FE_UNDERFLOW);
EXPECT_MATH_ERRNO(ERANGE);
float x = float(FPBits(0xc2cffff8U));
EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Exp10, x,
- __llvm_libc::exp10f(x), 0.5);
+ LIBC_NAMESPACE::exp10f(x), 0.5);
EXPECT_MATH_ERRNO(ERANGE);
x = float(FPBits(0xc2d00008U));
EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Exp10, x,
- __llvm_libc::exp10f(x), 0.5);
+ LIBC_NAMESPACE::exp10f(x), 0.5);
EXPECT_MATH_ERRNO(ERANGE);
}
@@ -99,9 +99,9 @@ TEST(LlvmLibcExp10fTest, TrickyInputs) {
libc_errno = 0;
float x = float(FPBits(INPUTS[i]));
EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Exp10, x,
- __llvm_libc::exp10f(x), 0.5);
+ LIBC_NAMESPACE::exp10f(x), 0.5);
EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Exp10, -x,
- __llvm_libc::exp10f(-x), 0.5);
+ LIBC_NAMESPACE::exp10f(-x), 0.5);
}
}
@@ -113,7 +113,7 @@ TEST(LlvmLibcExp10fTest, InFloatRange) {
if (isnan(x) || isinf(x))
continue;
libc_errno = 0;
- float result = __llvm_libc::exp10f(x);
+ float result = LIBC_NAMESPACE::exp10f(x);
// If the computation resulted in an error or did not produce valid result
// in the single-precision floating point range, then ignore comparing with
@@ -122,6 +122,6 @@ TEST(LlvmLibcExp10fTest, InFloatRange) {
if (isnan(result) || isinf(result) || libc_errno != 0)
continue;
ASSERT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Exp10, x,
- __llvm_libc::exp10f(x), 0.5);
+ LIBC_NAMESPACE::exp10f(x), 0.5);
}
}
diff --git a/libc/test/src/math/exp2_test.cpp b/libc/test/src/math/exp2_test.cpp
index 61081690880c509..6a90c9ba911bd3f 100644
--- a/libc/test/src/math/exp2_test.cpp
+++ b/libc/test/src/math/exp2_test.cpp
@@ -17,19 +17,20 @@
#include <errno.h>
#include <stdint.h>
-namespace mpfr = __llvm_libc::testing::mpfr;
-using __llvm_libc::testing::tlog;
+namespace mpfr = LIBC_NAMESPACE::testing::mpfr;
+using LIBC_NAMESPACE::testing::tlog;
DECLARE_SPECIAL_CONSTANTS(double)
TEST(LlvmLibcExp2Test, SpecialNumbers) {
- EXPECT_FP_EQ(aNaN, __llvm_libc::exp2(aNaN));
- EXPECT_FP_EQ(inf, __llvm_libc::exp2(inf));
- EXPECT_FP_EQ_ALL_ROUNDING(zero, __llvm_libc::exp2(neg_inf));
- EXPECT_FP_EQ_WITH_EXCEPTION(zero, __llvm_libc::exp2(-0x1.0p20), FE_UNDERFLOW);
- EXPECT_FP_EQ_WITH_EXCEPTION(inf, __llvm_libc::exp2(0x1.0p20), FE_OVERFLOW);
- EXPECT_FP_EQ_ALL_ROUNDING(1.0, __llvm_libc::exp2(0.0));
- EXPECT_FP_EQ_ALL_ROUNDING(1.0, __llvm_libc::exp2(-0.0));
+ EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::exp2(aNaN));
+ EXPECT_FP_EQ(inf, LIBC_NAMESPACE::exp2(inf));
+ EXPECT_FP_EQ_ALL_ROUNDING(zero, LIBC_NAMESPACE::exp2(neg_inf));
+ EXPECT_FP_EQ_WITH_EXCEPTION(zero, LIBC_NAMESPACE::exp2(-0x1.0p20),
+ FE_UNDERFLOW);
+ EXPECT_FP_EQ_WITH_EXCEPTION(inf, LIBC_NAMESPACE::exp2(0x1.0p20), FE_OVERFLOW);
+ EXPECT_FP_EQ_ALL_ROUNDING(1.0, LIBC_NAMESPACE::exp2(0.0));
+ EXPECT_FP_EQ_ALL_ROUNDING(1.0, LIBC_NAMESPACE::exp2(-0.0));
}
TEST(LlvmLibcExp2Test, TrickyInputs) {
@@ -55,14 +56,14 @@ TEST(LlvmLibcExp2Test, TrickyInputs) {
for (int i = 0; i < N; ++i) {
double x = double(FPBits(INPUTS[i]));
EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Exp2, x,
- __llvm_libc::exp2(x), 0.5);
+ LIBC_NAMESPACE::exp2(x), 0.5);
}
}
TEST(LlvmLibcExp2Test, InDoubleRange) {
constexpr uint64_t COUNT = 1'231;
- uint64_t START = __llvm_libc::fputil::FPBits<double>(0.25).uintval();
- uint64_t STOP = __llvm_libc::fputil::FPBits<double>(4.0).uintval();
+ uint64_t START = LIBC_NAMESPACE::fputil::FPBits<double>(0.25).uintval();
+ uint64_t STOP = LIBC_NAMESPACE::fputil::FPBits<double>(4.0).uintval();
uint64_t STEP = (STOP - START) / COUNT;
auto test = [&](mpfr::RoundingMode rounding_mode) {
@@ -81,7 +82,7 @@ TEST(LlvmLibcExp2Test, InDoubleRange) {
if (isnan(x) || isinf(x) || x < 0.0)
continue;
libc_errno = 0;
- double result = __llvm_libc::exp2(x);
+ double result = LIBC_NAMESPACE::exp2(x);
++cc;
if (isnan(result) || isinf(result))
continue;
diff --git a/libc/test/src/math/exp2f_test.cpp b/libc/test/src/math/exp2f_test.cpp
index afd2c0f700514c8..987e1b9f59cbb7b 100644
--- a/libc/test/src/math/exp2f_test.cpp
+++ b/libc/test/src/math/exp2f_test.cpp
@@ -17,41 +17,41 @@
#include <stdint.h>
-namespace mpfr = __llvm_libc::testing::mpfr;
+namespace mpfr = LIBC_NAMESPACE::testing::mpfr;
DECLARE_SPECIAL_CONSTANTS(float)
TEST(LlvmLibcExp2fTest, SpecialNumbers) {
libc_errno = 0;
- EXPECT_FP_EQ(aNaN, __llvm_libc::exp2f(aNaN));
+ EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::exp2f(aNaN));
EXPECT_MATH_ERRNO(0);
- EXPECT_FP_EQ(inf, __llvm_libc::exp2f(inf));
+ EXPECT_FP_EQ(inf, LIBC_NAMESPACE::exp2f(inf));
EXPECT_MATH_ERRNO(0);
- EXPECT_FP_EQ(0.0f, __llvm_libc::exp2f(neg_inf));
+ EXPECT_FP_EQ(0.0f, LIBC_NAMESPACE::exp2f(neg_inf));
EXPECT_MATH_ERRNO(0);
- EXPECT_FP_EQ(1.0f, __llvm_libc::exp2f(0.0f));
+ EXPECT_FP_EQ(1.0f, LIBC_NAMESPACE::exp2f(0.0f));
EXPECT_MATH_ERRNO(0);
- EXPECT_FP_EQ(1.0f, __llvm_libc::exp2f(-0.0f));
+ EXPECT_FP_EQ(1.0f, LIBC_NAMESPACE::exp2f(-0.0f));
EXPECT_MATH_ERRNO(0);
}
TEST(LlvmLibcExp2fTest, Overflow) {
libc_errno = 0;
EXPECT_FP_EQ_WITH_EXCEPTION(
- inf, __llvm_libc::exp2f(float(FPBits(0x7f7fffffU))), FE_OVERFLOW);
+ inf, LIBC_NAMESPACE::exp2f(float(FPBits(0x7f7fffffU))), FE_OVERFLOW);
EXPECT_MATH_ERRNO(ERANGE);
EXPECT_FP_EQ_WITH_EXCEPTION(
- inf, __llvm_libc::exp2f(float(FPBits(0x43000000U))), FE_OVERFLOW);
+ inf, LIBC_NAMESPACE::exp2f(float(FPBits(0x43000000U))), FE_OVERFLOW);
EXPECT_MATH_ERRNO(ERANGE);
EXPECT_FP_EQ_WITH_EXCEPTION(
- inf, __llvm_libc::exp2f(float(FPBits(0x43000001U))), FE_OVERFLOW);
+ inf, LIBC_NAMESPACE::exp2f(float(FPBits(0x43000001U))), FE_OVERFLOW);
EXPECT_MATH_ERRNO(ERANGE);
}
@@ -75,7 +75,7 @@ TEST(LlvmLibcExp2fTest, TrickyInputs) {
libc_errno = 0;
float x = float(FPBits(INPUTS[i]));
EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Exp2, x,
- __llvm_libc::exp2f(x), 0.5);
+ LIBC_NAMESPACE::exp2f(x), 0.5);
EXPECT_MATH_ERRNO(0);
}
}
@@ -83,22 +83,22 @@ TEST(LlvmLibcExp2fTest, TrickyInputs) {
TEST(LlvmLibcExp2fTest, Underflow) {
libc_errno = 0;
EXPECT_FP_EQ_WITH_EXCEPTION(
- 0.0f, __llvm_libc::exp2f(float(FPBits(0xff7fffffU))), FE_UNDERFLOW);
+ 0.0f, LIBC_NAMESPACE::exp2f(float(FPBits(0xff7fffffU))), FE_UNDERFLOW);
EXPECT_MATH_ERRNO(ERANGE);
float x = float(FPBits(0xc3158000U));
EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Exp2, x,
- __llvm_libc::exp2f(x), 0.5);
+ LIBC_NAMESPACE::exp2f(x), 0.5);
EXPECT_MATH_ERRNO(0);
x = float(FPBits(0xc3160000U));
EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Exp2, x,
- __llvm_libc::exp2f(x), 0.5);
+ LIBC_NAMESPACE::exp2f(x), 0.5);
EXPECT_MATH_ERRNO(ERANGE);
x = float(FPBits(0xc3165432U));
EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Exp2, x,
- __llvm_libc::exp2f(x), 0.5);
+ LIBC_NAMESPACE::exp2f(x), 0.5);
EXPECT_MATH_ERRNO(ERANGE);
}
@@ -110,7 +110,7 @@ TEST(LlvmLibcExp2fTest, InFloatRange) {
if (isnan(x) || isinf(x))
continue;
libc_errno = 0;
- float result = __llvm_libc::exp2f(x);
+ float result = LIBC_NAMESPACE::exp2f(x);
// If the computation resulted in an error or did not produce valid result
// in the single-precision floating point range, then ignore comparing with
@@ -119,6 +119,6 @@ TEST(LlvmLibcExp2fTest, InFloatRange) {
if (isnan(result) || isinf(result) || libc_errno != 0)
continue;
ASSERT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Exp2, x,
- __llvm_libc::exp2f(x), 0.5);
+ LIBC_NAMESPACE::exp2f(x), 0.5);
}
}
diff --git a/libc/test/src/math/exp_test.cpp b/libc/test/src/math/exp_test.cpp
index 7ff149acdb32f81..06894bce70699e5 100644
--- a/libc/test/src/math/exp_test.cpp
+++ b/libc/test/src/math/exp_test.cpp
@@ -17,19 +17,20 @@
#include <errno.h>
#include <stdint.h>
-namespace mpfr = __llvm_libc::testing::mpfr;
-using __llvm_libc::testing::tlog;
+namespace mpfr = LIBC_NAMESPACE::testing::mpfr;
+using LIBC_NAMESPACE::testing::tlog;
DECLARE_SPECIAL_CONSTANTS(double)
TEST(LlvmLibcExpTest, SpecialNumbers) {
- EXPECT_FP_EQ(aNaN, __llvm_libc::exp(aNaN));
- EXPECT_FP_EQ(inf, __llvm_libc::exp(inf));
- EXPECT_FP_EQ_ALL_ROUNDING(zero, __llvm_libc::exp(neg_inf));
- EXPECT_FP_EQ_WITH_EXCEPTION(zero, __llvm_libc::exp(-0x1.0p20), FE_UNDERFLOW);
- EXPECT_FP_EQ_WITH_EXCEPTION(inf, __llvm_libc::exp(0x1.0p20), FE_OVERFLOW);
- EXPECT_FP_EQ_ALL_ROUNDING(1.0, __llvm_libc::exp(0.0));
- EXPECT_FP_EQ_ALL_ROUNDING(1.0, __llvm_libc::exp(-0.0));
+ EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::exp(aNaN));
+ EXPECT_FP_EQ(inf, LIBC_NAMESPACE::exp(inf));
+ EXPECT_FP_EQ_ALL_ROUNDING(zero, LIBC_NAMESPACE::exp(neg_inf));
+ EXPECT_FP_EQ_WITH_EXCEPTION(zero, LIBC_NAMESPACE::exp(-0x1.0p20),
+ FE_UNDERFLOW);
+ EXPECT_FP_EQ_WITH_EXCEPTION(inf, LIBC_NAMESPACE::exp(0x1.0p20), FE_OVERFLOW);
+ EXPECT_FP_EQ_ALL_ROUNDING(1.0, LIBC_NAMESPACE::exp(0.0));
+ EXPECT_FP_EQ_ALL_ROUNDING(1.0, LIBC_NAMESPACE::exp(-0.0));
}
TEST(LlvmLibcExpTest, TrickyInputs) {
@@ -52,15 +53,15 @@ TEST(LlvmLibcExpTest, TrickyInputs) {
};
for (int i = 0; i < N; ++i) {
double x = double(FPBits(INPUTS[i]));
- EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Exp, x, __llvm_libc::exp(x),
- 0.5);
+ EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Exp, x,
+ LIBC_NAMESPACE::exp(x), 0.5);
}
}
TEST(LlvmLibcExpTest, InDoubleRange) {
constexpr uint64_t COUNT = 1'231;
- uint64_t START = __llvm_libc::fputil::FPBits<double>(0.25).uintval();
- uint64_t STOP = __llvm_libc::fputil::FPBits<double>(4.0).uintval();
+ uint64_t START = LIBC_NAMESPACE::fputil::FPBits<double>(0.25).uintval();
+ uint64_t STOP = LIBC_NAMESPACE::fputil::FPBits<double>(4.0).uintval();
uint64_t STEP = (STOP - START) / COUNT;
auto test = [&](mpfr::RoundingMode rounding_mode) {
@@ -79,7 +80,7 @@ TEST(LlvmLibcExpTest, InDoubleRange) {
if (isnan(x) || isinf(x) || x < 0.0)
continue;
libc_errno = 0;
- double result = __llvm_libc::exp(x);
+ double result = LIBC_NAMESPACE::exp(x);
++cc;
if (isnan(result) || isinf(result))
continue;
diff --git a/libc/test/src/math/expf_test.cpp b/libc/test/src/math/expf_test.cpp
index acc0e645a4186a2..f015e46d50b6b2d 100644
--- a/libc/test/src/math/expf_test.cpp
+++ b/libc/test/src/math/expf_test.cpp
@@ -16,58 +16,58 @@
#include <stdint.h>
-namespace mpfr = __llvm_libc::testing::mpfr;
+namespace mpfr = LIBC_NAMESPACE::testing::mpfr;
DECLARE_SPECIAL_CONSTANTS(float)
TEST(LlvmLibcExpfTest, SpecialNumbers) {
libc_errno = 0;
- EXPECT_FP_EQ(aNaN, __llvm_libc::expf(aNaN));
+ EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::expf(aNaN));
EXPECT_MATH_ERRNO(0);
- EXPECT_FP_EQ(inf, __llvm_libc::expf(inf));
+ EXPECT_FP_EQ(inf, LIBC_NAMESPACE::expf(inf));
EXPECT_MATH_ERRNO(0);
- EXPECT_FP_EQ(0.0f, __llvm_libc::expf(neg_inf));
+ EXPECT_FP_EQ(0.0f, LIBC_NAMESPACE::expf(neg_inf));
EXPECT_MATH_ERRNO(0);
- EXPECT_FP_EQ(1.0f, __llvm_libc::expf(0.0f));
+ EXPECT_FP_EQ(1.0f, LIBC_NAMESPACE::expf(0.0f));
EXPECT_MATH_ERRNO(0);
- EXPECT_FP_EQ(1.0f, __llvm_libc::expf(-0.0f));
+ EXPECT_FP_EQ(1.0f, LIBC_NAMESPACE::expf(-0.0f));
EXPECT_MATH_ERRNO(0);
}
TEST(LlvmLibcExpfTest, Overflow) {
libc_errno = 0;
EXPECT_FP_EQ_WITH_EXCEPTION(
- inf, __llvm_libc::expf(float(FPBits(0x7f7fffffU))), FE_OVERFLOW);
+ inf, LIBC_NAMESPACE::expf(float(FPBits(0x7f7fffffU))), FE_OVERFLOW);
EXPECT_MATH_ERRNO(ERANGE);
EXPECT_FP_EQ_WITH_EXCEPTION(
- inf, __llvm_libc::expf(float(FPBits(0x42cffff8U))), FE_OVERFLOW);
+ inf, LIBC_NAMESPACE::expf(float(FPBits(0x42cffff8U))), FE_OVERFLOW);
EXPECT_MATH_ERRNO(ERANGE);
EXPECT_FP_EQ_WITH_EXCEPTION(
- inf, __llvm_libc::expf(float(FPBits(0x42d00008U))), FE_OVERFLOW);
+ inf, LIBC_NAMESPACE::expf(float(FPBits(0x42d00008U))), FE_OVERFLOW);
EXPECT_MATH_ERRNO(ERANGE);
}
TEST(LlvmLibcExpfTest, Underflow) {
libc_errno = 0;
EXPECT_FP_EQ_WITH_EXCEPTION(
- 0.0f, __llvm_libc::expf(float(FPBits(0xff7fffffU))), FE_UNDERFLOW);
+ 0.0f, LIBC_NAMESPACE::expf(float(FPBits(0xff7fffffU))), FE_UNDERFLOW);
EXPECT_MATH_ERRNO(ERANGE);
float x = float(FPBits(0xc2cffff8U));
- EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Exp, x, __llvm_libc::expf(x),
- 0.5);
+ EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Exp, x,
+ LIBC_NAMESPACE::expf(x), 0.5);
EXPECT_MATH_ERRNO(ERANGE);
x = float(FPBits(0xc2d00008U));
- EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Exp, x, __llvm_libc::expf(x),
- 0.5);
+ EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Exp, x,
+ LIBC_NAMESPACE::expf(x), 0.5);
EXPECT_MATH_ERRNO(ERANGE);
}
@@ -78,28 +78,28 @@ TEST(LlvmLibcExpfTest, Borderline) {
libc_errno = 0;
x = float(FPBits(0x42affff8U));
- ASSERT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Exp, x, __llvm_libc::expf(x),
- 0.5);
+ ASSERT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Exp, x,
+ LIBC_NAMESPACE::expf(x), 0.5);
EXPECT_MATH_ERRNO(0);
x = float(FPBits(0x42b00008U));
- ASSERT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Exp, x, __llvm_libc::expf(x),
- 0.5);
+ ASSERT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Exp, x,
+ LIBC_NAMESPACE::expf(x), 0.5);
EXPECT_MATH_ERRNO(0);
x = float(FPBits(0xc2affff8U));
- ASSERT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Exp, x, __llvm_libc::expf(x),
- 0.5);
+ ASSERT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Exp, x,
+ LIBC_NAMESPACE::expf(x), 0.5);
EXPECT_MATH_ERRNO(0);
x = float(FPBits(0xc2b00008U));
- ASSERT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Exp, x, __llvm_libc::expf(x),
- 0.5);
+ ASSERT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Exp, x,
+ LIBC_NAMESPACE::expf(x), 0.5);
EXPECT_MATH_ERRNO(0);
x = float(FPBits(0xc236bd8cU));
- EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Exp, x, __llvm_libc::expf(x),
- 0.5);
+ EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Exp, x,
+ LIBC_NAMESPACE::expf(x), 0.5);
EXPECT_MATH_ERRNO(0);
}
@@ -111,7 +111,7 @@ TEST(LlvmLibcExpfTest, InFloatRange) {
if (isnan(x) || isinf(x))
continue;
libc_errno = 0;
- float result = __llvm_libc::expf(x);
+ float result = LIBC_NAMESPACE::expf(x);
// If the computation resulted in an error or did not produce valid result
// in the single-precision floating point range, then ignore comparing with
@@ -120,6 +120,6 @@ TEST(LlvmLibcExpfTest, InFloatRange) {
if (isnan(result) || isinf(result) || libc_errno != 0)
continue;
EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Exp, x,
- __llvm_libc::expf(x), 0.5);
+ LIBC_NAMESPACE::expf(x), 0.5);
}
}
diff --git a/libc/test/src/math/explogxf_test.cpp b/libc/test/src/math/explogxf_test.cpp
index d6d646db9c89b91..7b402e17fbc7f3f 100644
--- a/libc/test/src/math/explogxf_test.cpp
+++ b/libc/test/src/math/explogxf_test.cpp
@@ -14,7 +14,7 @@
#include "utils/MPFRWrapper/MPFRUtils.h"
#include <math.h>
-namespace mpfr = __llvm_libc::testing::mpfr;
+namespace mpfr = LIBC_NAMESPACE::testing::mpfr;
DECLARE_SPECIAL_CONSTANTS(float)
@@ -27,8 +27,8 @@ auto f_normal = [](float x) -> bool {
TEST(LlvmLibcExpxfTest, InFloatRange) {
auto fx = [](float x) -> float {
- auto result = __llvm_libc::exp_b_range_reduc<__llvm_libc::ExpBase>(x);
- double r = __llvm_libc::ExpBase::powb_lo(result.lo);
+ auto result = LIBC_NAMESPACE::exp_b_range_reduc<LIBC_NAMESPACE::ExpBase>(x);
+ double r = LIBC_NAMESPACE::ExpBase::powb_lo(result.lo);
return static_cast<float>(result.mh * r);
};
auto f_check = [](float x) -> bool {
@@ -40,11 +40,11 @@ TEST(LlvmLibcExpxfTest, InFloatRange) {
}
TEST(LlvmLibcLog2xfTest, InFloatRange) {
- CHECK_DATA(0.0f, inf, mpfr::Operation::Log2, __llvm_libc::log2_eval, f_normal,
- def_count, def_prec);
+ CHECK_DATA(0.0f, inf, mpfr::Operation::Log2, LIBC_NAMESPACE::log2_eval,
+ f_normal, def_count, def_prec);
}
TEST(LlvmLibcLogxfTest, InFloatRange) {
- CHECK_DATA(0.0f, inf, mpfr::Operation::Log, __llvm_libc::log_eval, f_normal,
- def_count, def_prec);
+ CHECK_DATA(0.0f, inf, mpfr::Operation::Log, LIBC_NAMESPACE::log_eval,
+ f_normal, def_count, def_prec);
}
diff --git a/libc/test/src/math/expm1f_test.cpp b/libc/test/src/math/expm1f_test.cpp
index c05edf8da3cd781..f63c9f464c6d7d1 100644
--- a/libc/test/src/math/expm1f_test.cpp
+++ b/libc/test/src/math/expm1f_test.cpp
@@ -16,53 +16,53 @@
#include <stdint.h>
-namespace mpfr = __llvm_libc::testing::mpfr;
+namespace mpfr = LIBC_NAMESPACE::testing::mpfr;
DECLARE_SPECIAL_CONSTANTS(float)
TEST(LlvmLibcExpm1fTest, SpecialNumbers) {
libc_errno = 0;
- EXPECT_FP_EQ(aNaN, __llvm_libc::expm1f(aNaN));
+ EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::expm1f(aNaN));
EXPECT_MATH_ERRNO(0);
- EXPECT_FP_EQ(inf, __llvm_libc::expm1f(inf));
+ EXPECT_FP_EQ(inf, LIBC_NAMESPACE::expm1f(inf));
EXPECT_MATH_ERRNO(0);
- EXPECT_FP_EQ(-1.0f, __llvm_libc::expm1f(neg_inf));
+ EXPECT_FP_EQ(-1.0f, LIBC_NAMESPACE::expm1f(neg_inf));
EXPECT_MATH_ERRNO(0);
- EXPECT_FP_EQ(0.0f, __llvm_libc::expm1f(0.0f));
+ EXPECT_FP_EQ(0.0f, LIBC_NAMESPACE::expm1f(0.0f));
EXPECT_MATH_ERRNO(0);
- EXPECT_FP_EQ(-0.0f, __llvm_libc::expm1f(-0.0f));
+ EXPECT_FP_EQ(-0.0f, LIBC_NAMESPACE::expm1f(-0.0f));
EXPECT_MATH_ERRNO(0);
}
TEST(LlvmLibcExpm1fTest, Overflow) {
libc_errno = 0;
EXPECT_FP_EQ_WITH_EXCEPTION(
- inf, __llvm_libc::expm1f(float(FPBits(0x7f7fffffU))), FE_OVERFLOW);
+ inf, LIBC_NAMESPACE::expm1f(float(FPBits(0x7f7fffffU))), FE_OVERFLOW);
EXPECT_MATH_ERRNO(ERANGE);
EXPECT_FP_EQ_WITH_EXCEPTION(
- inf, __llvm_libc::expm1f(float(FPBits(0x42cffff8U))), FE_OVERFLOW);
+ inf, LIBC_NAMESPACE::expm1f(float(FPBits(0x42cffff8U))), FE_OVERFLOW);
EXPECT_MATH_ERRNO(ERANGE);
EXPECT_FP_EQ_WITH_EXCEPTION(
- inf, __llvm_libc::expm1f(float(FPBits(0x42d00008U))), FE_OVERFLOW);
+ inf, LIBC_NAMESPACE::expm1f(float(FPBits(0x42d00008U))), FE_OVERFLOW);
EXPECT_MATH_ERRNO(ERANGE);
}
TEST(LlvmLibcExpm1fTest, Underflow) {
libc_errno = 0;
- EXPECT_FP_EQ(-1.0f, __llvm_libc::expm1f(float(FPBits(0xff7fffffU))));
+ EXPECT_FP_EQ(-1.0f, LIBC_NAMESPACE::expm1f(float(FPBits(0xff7fffffU))));
float x = float(FPBits(0xc2cffff8U));
- EXPECT_FP_EQ(-1.0f, __llvm_libc::expm1f(x));
+ EXPECT_FP_EQ(-1.0f, LIBC_NAMESPACE::expm1f(x));
x = float(FPBits(0xc2d00008U));
- EXPECT_FP_EQ(-1.0f, __llvm_libc::expm1f(x));
+ EXPECT_FP_EQ(-1.0f, LIBC_NAMESPACE::expm1f(x));
}
// Test with inputs which are the borders of underflow/overflow but still
@@ -73,42 +73,42 @@ TEST(LlvmLibcExpm1fTest, Borderline) {
libc_errno = 0;
x = float(FPBits(0x42affff8U));
ASSERT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Expm1, x,
- __llvm_libc::expm1f(x), 0.5);
+ LIBC_NAMESPACE::expm1f(x), 0.5);
EXPECT_MATH_ERRNO(0);
x = float(FPBits(0x42b00008U));
ASSERT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Expm1, x,
- __llvm_libc::expm1f(x), 0.5);
+ LIBC_NAMESPACE::expm1f(x), 0.5);
EXPECT_MATH_ERRNO(0);
x = float(FPBits(0xc2affff8U));
ASSERT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Expm1, x,
- __llvm_libc::expm1f(x), 0.5);
+ LIBC_NAMESPACE::expm1f(x), 0.5);
EXPECT_MATH_ERRNO(0);
x = float(FPBits(0xc2b00008U));
ASSERT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Expm1, x,
- __llvm_libc::expm1f(x), 0.5);
+ LIBC_NAMESPACE::expm1f(x), 0.5);
EXPECT_MATH_ERRNO(0);
x = float(FPBits(0x3dc252ddU));
ASSERT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Expm1, x,
- __llvm_libc::expm1f(x), 0.5);
+ LIBC_NAMESPACE::expm1f(x), 0.5);
EXPECT_MATH_ERRNO(0);
x = float(FPBits(0x3e35bec5U));
ASSERT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Expm1, x,
- __llvm_libc::expm1f(x), 0.5);
+ LIBC_NAMESPACE::expm1f(x), 0.5);
EXPECT_MATH_ERRNO(0);
x = float(FPBits(0x942ed494U));
ASSERT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Expm1, x,
- __llvm_libc::expm1f(x), 0.5);
+ LIBC_NAMESPACE::expm1f(x), 0.5);
EXPECT_MATH_ERRNO(0);
x = float(FPBits(0xbdc1c6cbU));
ASSERT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Expm1, x,
- __llvm_libc::expm1f(x), 0.5);
+ LIBC_NAMESPACE::expm1f(x), 0.5);
EXPECT_MATH_ERRNO(0);
}
@@ -120,7 +120,7 @@ TEST(LlvmLibcExpm1fTest, InFloatRange) {
if (isnan(x) || isinf(x))
continue;
libc_errno = 0;
- float result = __llvm_libc::expm1f(x);
+ float result = LIBC_NAMESPACE::expm1f(x);
// If the computation resulted in an error or did not produce valid result
// in the single-precision floating point range, then ignore comparing with
@@ -129,6 +129,6 @@ TEST(LlvmLibcExpm1fTest, InFloatRange) {
if (isnan(result) || isinf(result) || libc_errno != 0)
continue;
ASSERT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Expm1, x,
- __llvm_libc::expm1f(x), 0.5);
+ LIBC_NAMESPACE::expm1f(x), 0.5);
}
}
diff --git a/libc/test/src/math/fabs_test.cpp b/libc/test/src/math/fabs_test.cpp
index 2bf0ddda44ade35..0447040ddae3061 100644
--- a/libc/test/src/math/fabs_test.cpp
+++ b/libc/test/src/math/fabs_test.cpp
@@ -10,4 +10,4 @@
#include "src/math/fabs.h"
-LIST_FABS_TESTS(double, __llvm_libc::fabs)
+LIST_FABS_TESTS(double, LIBC_NAMESPACE::fabs)
diff --git a/libc/test/src/math/fabsf_test.cpp b/libc/test/src/math/fabsf_test.cpp
index 6374a1018f1da42..9f1e2a66d47655c 100644
--- a/libc/test/src/math/fabsf_test.cpp
+++ b/libc/test/src/math/fabsf_test.cpp
@@ -10,4 +10,4 @@
#include "src/math/fabsf.h"
-LIST_FABS_TESTS(float, __llvm_libc::fabsf)
+LIST_FABS_TESTS(float, LIBC_NAMESPACE::fabsf)
diff --git a/libc/test/src/math/fabsl_test.cpp b/libc/test/src/math/fabsl_test.cpp
index ff1320225452a92..37d2b54a4c53e11 100644
--- a/libc/test/src/math/fabsl_test.cpp
+++ b/libc/test/src/math/fabsl_test.cpp
@@ -10,4 +10,4 @@
#include "src/math/fabsl.h"
-LIST_FABS_TESTS(long double, __llvm_libc::fabsl)
+LIST_FABS_TESTS(long double, LIBC_NAMESPACE::fabsl)
diff --git a/libc/test/src/math/fdim_test.cpp b/libc/test/src/math/fdim_test.cpp
index 80174b79b95b83c..2f00a30ad1ee6f7 100644
--- a/libc/test/src/math/fdim_test.cpp
+++ b/libc/test/src/math/fdim_test.cpp
@@ -16,16 +16,18 @@
using LlvmLibcFDimTest = FDimTestTemplate<double>;
-TEST_F(LlvmLibcFDimTest, NaNArg_fdim) { test_na_n_arg(&__llvm_libc::fdim); }
+TEST_F(LlvmLibcFDimTest, NaNArg_fdim) { test_na_n_arg(&LIBC_NAMESPACE::fdim); }
-TEST_F(LlvmLibcFDimTest, InfArg_fdim) { test_inf_arg(&__llvm_libc::fdim); }
+TEST_F(LlvmLibcFDimTest, InfArg_fdim) { test_inf_arg(&LIBC_NAMESPACE::fdim); }
TEST_F(LlvmLibcFDimTest, NegInfArg_fdim) {
- test_neg_inf_arg(&__llvm_libc::fdim);
+ test_neg_inf_arg(&LIBC_NAMESPACE::fdim);
}
-TEST_F(LlvmLibcFDimTest, BothZero_fdim) { test_both_zero(&__llvm_libc::fdim); }
+TEST_F(LlvmLibcFDimTest, BothZero_fdim) {
+ test_both_zero(&LIBC_NAMESPACE::fdim);
+}
TEST_F(LlvmLibcFDimTest, InDoubleRange_fdim) {
- test_in_range(&__llvm_libc::fdim);
+ test_in_range(&LIBC_NAMESPACE::fdim);
}
diff --git a/libc/test/src/math/fdimf_test.cpp b/libc/test/src/math/fdimf_test.cpp
index 531b89b81ffc9ed..27511baf25b6da8 100644
--- a/libc/test/src/math/fdimf_test.cpp
+++ b/libc/test/src/math/fdimf_test.cpp
@@ -16,18 +16,20 @@
using LlvmLibcFDimTest = FDimTestTemplate<float>;
-TEST_F(LlvmLibcFDimTest, NaNArg_fdimf) { test_na_n_arg(&__llvm_libc::fdimf); }
+TEST_F(LlvmLibcFDimTest, NaNArg_fdimf) {
+ test_na_n_arg(&LIBC_NAMESPACE::fdimf);
+}
-TEST_F(LlvmLibcFDimTest, InfArg_fdimf) { test_inf_arg(&__llvm_libc::fdimf); }
+TEST_F(LlvmLibcFDimTest, InfArg_fdimf) { test_inf_arg(&LIBC_NAMESPACE::fdimf); }
TEST_F(LlvmLibcFDimTest, NegInfArg_fdimf) {
- test_neg_inf_arg(&__llvm_libc::fdimf);
+ test_neg_inf_arg(&LIBC_NAMESPACE::fdimf);
}
TEST_F(LlvmLibcFDimTest, BothZero_fdimf) {
- test_both_zero(&__llvm_libc::fdimf);
+ test_both_zero(&LIBC_NAMESPACE::fdimf);
}
TEST_F(LlvmLibcFDimTest, InFloatRange_fdimf) {
- test_in_range(&__llvm_libc::fdimf);
+ test_in_range(&LIBC_NAMESPACE::fdimf);
}
diff --git a/libc/test/src/math/fdiml_test.cpp b/libc/test/src/math/fdiml_test.cpp
index bb6c54d567a0b28..45aedb0a1cdea61 100644
--- a/libc/test/src/math/fdiml_test.cpp
+++ b/libc/test/src/math/fdiml_test.cpp
@@ -16,18 +16,20 @@
using LlvmLibcFDimTest = FDimTestTemplate<long double>;
-TEST_F(LlvmLibcFDimTest, NaNArg_fdiml) { test_na_n_arg(&__llvm_libc::fdiml); }
+TEST_F(LlvmLibcFDimTest, NaNArg_fdiml) {
+ test_na_n_arg(&LIBC_NAMESPACE::fdiml);
+}
-TEST_F(LlvmLibcFDimTest, InfArg_fdiml) { test_inf_arg(&__llvm_libc::fdiml); }
+TEST_F(LlvmLibcFDimTest, InfArg_fdiml) { test_inf_arg(&LIBC_NAMESPACE::fdiml); }
TEST_F(LlvmLibcFDimTest, NegInfArg_fdiml) {
- test_neg_inf_arg(&__llvm_libc::fdiml);
+ test_neg_inf_arg(&LIBC_NAMESPACE::fdiml);
}
TEST_F(LlvmLibcFDimTest, BothZero_fdiml) {
- test_both_zero(&__llvm_libc::fdiml);
+ test_both_zero(&LIBC_NAMESPACE::fdiml);
}
TEST_F(LlvmLibcFDimTest, InLongDoubleRange_fdiml) {
- test_in_range(&__llvm_libc::fdiml);
+ test_in_range(&LIBC_NAMESPACE::fdiml);
}
diff --git a/libc/test/src/math/floor_test.cpp b/libc/test/src/math/floor_test.cpp
index e68ed3ecbb603e0..9231d07aeb7f8f4 100644
--- a/libc/test/src/math/floor_test.cpp
+++ b/libc/test/src/math/floor_test.cpp
@@ -10,4 +10,4 @@
#include "src/math/floor.h"
-LIST_FLOOR_TESTS(double, __llvm_libc::floor)
+LIST_FLOOR_TESTS(double, LIBC_NAMESPACE::floor)
diff --git a/libc/test/src/math/floorf_test.cpp b/libc/test/src/math/floorf_test.cpp
index f0538f7b97b22f4..cbb11f36f58da3c 100644
--- a/libc/test/src/math/floorf_test.cpp
+++ b/libc/test/src/math/floorf_test.cpp
@@ -10,4 +10,4 @@
#include "src/math/floorf.h"
-LIST_FLOOR_TESTS(float, __llvm_libc::floorf)
+LIST_FLOOR_TESTS(float, LIBC_NAMESPACE::floorf)
diff --git a/libc/test/src/math/floorl_test.cpp b/libc/test/src/math/floorl_test.cpp
index 1b244fd62a117be..26f6a7703ed0f6e 100644
--- a/libc/test/src/math/floorl_test.cpp
+++ b/libc/test/src/math/floorl_test.cpp
@@ -10,4 +10,4 @@
#include "src/math/floorl.h"
-LIST_FLOOR_TESTS(long double, __llvm_libc::floorl)
+LIST_FLOOR_TESTS(long double, LIBC_NAMESPACE::floorl)
diff --git a/libc/test/src/math/fma_test.cpp b/libc/test/src/math/fma_test.cpp
index be6b138342d5c8c..20224d99894be6d 100644
--- a/libc/test/src/math/fma_test.cpp
+++ b/libc/test/src/math/fma_test.cpp
@@ -270,20 +270,22 @@ struct LlvmLibcFmaTest : public FmaTestTemplate<double> {
double c = (signs & 1) ? -INPUTS[i].c : INPUTS[i].c;
mpfr::TernaryInput<double> input{a, b, c};
ASSERT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Fma, input,
- __llvm_libc::fma(a, b, c), 0.5);
+ LIBC_NAMESPACE::fma(a, b, c), 0.5);
}
}
}
};
TEST_F(LlvmLibcFmaTest, SpecialNumbers) {
- test_special_numbers(&__llvm_libc::fma);
+ test_special_numbers(&LIBC_NAMESPACE::fma);
}
TEST_F(LlvmLibcFmaTest, SubnormalRange) {
- test_subnormal_range(&__llvm_libc::fma);
+ test_subnormal_range(&LIBC_NAMESPACE::fma);
}
-TEST_F(LlvmLibcFmaTest, NormalRange) { test_normal_range(&__llvm_libc::fma); }
+TEST_F(LlvmLibcFmaTest, NormalRange) {
+ test_normal_range(&LIBC_NAMESPACE::fma);
+}
TEST_F(LlvmLibcFmaTest, ExtraValues) { test_more_values(); }
diff --git a/libc/test/src/math/fmaf_test.cpp b/libc/test/src/math/fmaf_test.cpp
index 8d1cf254701c906..b607d4a66f8eb0a 100644
--- a/libc/test/src/math/fmaf_test.cpp
+++ b/libc/test/src/math/fmaf_test.cpp
@@ -13,11 +13,13 @@
using LlvmLibcFmafTest = FmaTestTemplate<float>;
TEST_F(LlvmLibcFmafTest, SpecialNumbers) {
- test_special_numbers(&__llvm_libc::fmaf);
+ test_special_numbers(&LIBC_NAMESPACE::fmaf);
}
TEST_F(LlvmLibcFmafTest, SubnormalRange) {
- test_subnormal_range(&__llvm_libc::fmaf);
+ test_subnormal_range(&LIBC_NAMESPACE::fmaf);
}
-TEST_F(LlvmLibcFmafTest, NormalRange) { test_normal_range(&__llvm_libc::fmaf); }
+TEST_F(LlvmLibcFmafTest, NormalRange) {
+ test_normal_range(&LIBC_NAMESPACE::fmaf);
+}
diff --git a/libc/test/src/math/fmax_test.cpp b/libc/test/src/math/fmax_test.cpp
index 9c81c09414f0139..6800939625ebc06 100644
--- a/libc/test/src/math/fmax_test.cpp
+++ b/libc/test/src/math/fmax_test.cpp
@@ -10,4 +10,4 @@
#include "src/math/fmax.h"
-LIST_FMAX_TESTS(double, __llvm_libc::fmax)
+LIST_FMAX_TESTS(double, LIBC_NAMESPACE::fmax)
diff --git a/libc/test/src/math/fmaxf_test.cpp b/libc/test/src/math/fmaxf_test.cpp
index cf337d4f07e0307..25c6f7339e8c95e 100644
--- a/libc/test/src/math/fmaxf_test.cpp
+++ b/libc/test/src/math/fmaxf_test.cpp
@@ -10,4 +10,4 @@
#include "src/math/fmaxf.h"
-LIST_FMAX_TESTS(float, __llvm_libc::fmaxf)
+LIST_FMAX_TESTS(float, LIBC_NAMESPACE::fmaxf)
diff --git a/libc/test/src/math/fmaxl_test.cpp b/libc/test/src/math/fmaxl_test.cpp
index 636bc4208caef65..9ac986c00012a01 100644
--- a/libc/test/src/math/fmaxl_test.cpp
+++ b/libc/test/src/math/fmaxl_test.cpp
@@ -10,4 +10,4 @@
#include "src/math/fmaxl.h"
-LIST_FMAX_TESTS(long double, __llvm_libc::fmaxl)
+LIST_FMAX_TESTS(long double, LIBC_NAMESPACE::fmaxl)
diff --git a/libc/test/src/math/fmin_test.cpp b/libc/test/src/math/fmin_test.cpp
index 3515f97faca33cd..5d241519021d436 100644
--- a/libc/test/src/math/fmin_test.cpp
+++ b/libc/test/src/math/fmin_test.cpp
@@ -10,4 +10,4 @@
#include "src/math/fmin.h"
-LIST_FMIN_TESTS(double, __llvm_libc::fmin)
+LIST_FMIN_TESTS(double, LIBC_NAMESPACE::fmin)
diff --git a/libc/test/src/math/fminf_test.cpp b/libc/test/src/math/fminf_test.cpp
index 1a762478af613b1..1af5b79155b1dcd 100644
--- a/libc/test/src/math/fminf_test.cpp
+++ b/libc/test/src/math/fminf_test.cpp
@@ -10,4 +10,4 @@
#include "src/math/fminf.h"
-LIST_FMIN_TESTS(float, __llvm_libc::fminf)
+LIST_FMIN_TESTS(float, LIBC_NAMESPACE::fminf)
diff --git a/libc/test/src/math/fminl_test.cpp b/libc/test/src/math/fminl_test.cpp
index ce8b705b0385e2e..0791f8c4ad8595c 100644
--- a/libc/test/src/math/fminl_test.cpp
+++ b/libc/test/src/math/fminl_test.cpp
@@ -10,4 +10,4 @@
#include "src/math/fminl.h"
-LIST_FMIN_TESTS(long double, __llvm_libc::fminl)
+LIST_FMIN_TESTS(long double, LIBC_NAMESPACE::fminl)
diff --git a/libc/test/src/math/fmod_test.cpp b/libc/test/src/math/fmod_test.cpp
index 03790e4941e1918..ec39e0567a7ca03 100644
--- a/libc/test/src/math/fmod_test.cpp
+++ b/libc/test/src/math/fmod_test.cpp
@@ -10,4 +10,4 @@
#include "src/math/fmod.h"
-LIST_FMOD_TESTS(double, __llvm_libc::fmod)
+LIST_FMOD_TESTS(double, LIBC_NAMESPACE::fmod)
diff --git a/libc/test/src/math/fmodf_test.cpp b/libc/test/src/math/fmodf_test.cpp
index 2b13379eba25235..5c3c6286e88fef0 100644
--- a/libc/test/src/math/fmodf_test.cpp
+++ b/libc/test/src/math/fmodf_test.cpp
@@ -10,4 +10,4 @@
#include "src/math/fmodf.h"
-LIST_FMOD_TESTS(float, __llvm_libc::fmodf)
+LIST_FMOD_TESTS(float, LIBC_NAMESPACE::fmodf)
diff --git a/libc/test/src/math/frexp_test.cpp b/libc/test/src/math/frexp_test.cpp
index a44aefc7d8b4e33..4d078baffcb3937 100644
--- a/libc/test/src/math/frexp_test.cpp
+++ b/libc/test/src/math/frexp_test.cpp
@@ -10,4 +10,4 @@
#include "src/math/frexp.h"
-LIST_FREXP_TESTS(double, __llvm_libc::frexp)
+LIST_FREXP_TESTS(double, LIBC_NAMESPACE::frexp)
diff --git a/libc/test/src/math/frexpf_test.cpp b/libc/test/src/math/frexpf_test.cpp
index 5d78f94ec1e596a..577eb9609cfcc5b 100644
--- a/libc/test/src/math/frexpf_test.cpp
+++ b/libc/test/src/math/frexpf_test.cpp
@@ -10,4 +10,4 @@
#include "src/math/frexpf.h"
-LIST_FREXP_TESTS(float, __llvm_libc::frexpf)
+LIST_FREXP_TESTS(float, LIBC_NAMESPACE::frexpf)
diff --git a/libc/test/src/math/frexpl_test.cpp b/libc/test/src/math/frexpl_test.cpp
index 4904ccd14907bb8..e5184cd225bcfa9 100644
--- a/libc/test/src/math/frexpl_test.cpp
+++ b/libc/test/src/math/frexpl_test.cpp
@@ -10,4 +10,4 @@
#include "src/math/frexpl.h"
-LIST_FREXP_TESTS(long double, __llvm_libc::frexpl)
+LIST_FREXP_TESTS(long double, LIBC_NAMESPACE::frexpl)
diff --git a/libc/test/src/math/generic_sqrt_test.cpp b/libc/test/src/math/generic_sqrt_test.cpp
index cecfc0ee3de3aee..d0ab31ffd0fe63c 100644
--- a/libc/test/src/math/generic_sqrt_test.cpp
+++ b/libc/test/src/math/generic_sqrt_test.cpp
@@ -10,4 +10,4 @@
#include "src/__support/FPUtil/generic/sqrt.h"
-LIST_SQRT_TESTS(double, __llvm_libc::fputil::sqrt<double>)
+LIST_SQRT_TESTS(double, LIBC_NAMESPACE::fputil::sqrt<double>)
diff --git a/libc/test/src/math/generic_sqrtf_test.cpp b/libc/test/src/math/generic_sqrtf_test.cpp
index 64bf92133b98f3e..f22ac8829d5ac89 100644
--- a/libc/test/src/math/generic_sqrtf_test.cpp
+++ b/libc/test/src/math/generic_sqrtf_test.cpp
@@ -10,4 +10,4 @@
#include "src/__support/FPUtil/generic/sqrt.h"
-LIST_SQRT_TESTS(float, __llvm_libc::fputil::sqrt<float>)
+LIST_SQRT_TESTS(float, LIBC_NAMESPACE::fputil::sqrt<float>)
diff --git a/libc/test/src/math/generic_sqrtl_test.cpp b/libc/test/src/math/generic_sqrtl_test.cpp
index 6b68aaed9700487..ddc6a23695be430 100644
--- a/libc/test/src/math/generic_sqrtl_test.cpp
+++ b/libc/test/src/math/generic_sqrtl_test.cpp
@@ -10,4 +10,4 @@
#include "src/__support/FPUtil/generic/sqrt.h"
-LIST_SQRT_TESTS(long double, __llvm_libc::fputil::sqrt<long double>)
+LIST_SQRT_TESTS(long double, LIBC_NAMESPACE::fputil::sqrt<long double>)
diff --git a/libc/test/src/math/hypot_test.cpp b/libc/test/src/math/hypot_test.cpp
index 2d7b640adf10ac3..8f560f053326b62 100644
--- a/libc/test/src/math/hypot_test.cpp
+++ b/libc/test/src/math/hypot_test.cpp
@@ -13,13 +13,13 @@
using LlvmLibcHypotTest = HypotTestTemplate<double>;
TEST_F(LlvmLibcHypotTest, SpecialNumbers) {
- test_special_numbers(&__llvm_libc::hypot);
+ test_special_numbers(&LIBC_NAMESPACE::hypot);
}
TEST_F(LlvmLibcHypotTest, SubnormalRange) {
- test_subnormal_range(&__llvm_libc::hypot);
+ test_subnormal_range(&LIBC_NAMESPACE::hypot);
}
TEST_F(LlvmLibcHypotTest, NormalRange) {
- test_normal_range(&__llvm_libc::hypot);
+ test_normal_range(&LIBC_NAMESPACE::hypot);
}
diff --git a/libc/test/src/math/hypotf_hard_to_round.h b/libc/test/src/math/hypotf_hard_to_round.h
index 1b2abfd2fb909b1..f85be91ca3ec4a9 100644
--- a/libc/test/src/math/hypotf_hard_to_round.h
+++ b/libc/test/src/math/hypotf_hard_to_round.h
@@ -11,7 +11,7 @@
#include "utils/MPFRWrapper/MPFRUtils.h"
-namespace mpfr = __llvm_libc::testing::mpfr;
+namespace mpfr = LIBC_NAMESPACE::testing::mpfr;
constexpr int N_HARD_TO_ROUND = 1217;
constexpr mpfr::BinaryInput<float> HYPOTF_HARD_TO_ROUND[N_HARD_TO_ROUND] = {
diff --git a/libc/test/src/math/hypotf_test.cpp b/libc/test/src/math/hypotf_test.cpp
index 437e0fc29b76b31..ee16e3dbcd11135 100644
--- a/libc/test/src/math/hypotf_test.cpp
+++ b/libc/test/src/math/hypotf_test.cpp
@@ -14,17 +14,18 @@
using LlvmLibcHypotfTest = HypotTestTemplate<float>;
TEST_F(LlvmLibcHypotfTest, SpecialNumbers) {
- test_special_numbers(&__llvm_libc::hypotf);
+ test_special_numbers(&LIBC_NAMESPACE::hypotf);
}
TEST_F(LlvmLibcHypotfTest, SubnormalRange) {
- test_subnormal_range(&__llvm_libc::hypotf);
+ test_subnormal_range(&LIBC_NAMESPACE::hypotf);
}
TEST_F(LlvmLibcHypotfTest, NormalRange) {
- test_normal_range(&__llvm_libc::hypotf);
+ test_normal_range(&LIBC_NAMESPACE::hypotf);
}
TEST_F(LlvmLibcHypotfTest, TrickyInputs) {
- test_input_list(&__llvm_libc::hypotf, N_HARD_TO_ROUND, HYPOTF_HARD_TO_ROUND);
+ test_input_list(&LIBC_NAMESPACE::hypotf, N_HARD_TO_ROUND,
+ HYPOTF_HARD_TO_ROUND);
}
diff --git a/libc/test/src/math/ilogb_test.cpp b/libc/test/src/math/ilogb_test.cpp
index a77adec4adba44d..7011c43386e66a5 100644
--- a/libc/test/src/math/ilogb_test.cpp
+++ b/libc/test/src/math/ilogb_test.cpp
@@ -16,21 +16,21 @@
#include <math.h>
TEST_F(LlvmLibcILogbTest, SpecialNumbers_ilogb) {
- test_special_numbers<double>(&__llvm_libc::ilogb);
+ test_special_numbers<double>(&LIBC_NAMESPACE::ilogb);
}
TEST_F(LlvmLibcILogbTest, PowersOfTwo_ilogb) {
- test_powers_of_two<double>(&__llvm_libc::ilogb);
+ test_powers_of_two<double>(&LIBC_NAMESPACE::ilogb);
}
TEST_F(LlvmLibcILogbTest, SomeIntegers_ilogb) {
- test_some_integers<double>(&__llvm_libc::ilogb);
+ test_some_integers<double>(&LIBC_NAMESPACE::ilogb);
}
TEST_F(LlvmLibcILogbTest, SubnormalRange_ilogb) {
- test_subnormal_range<double>(&__llvm_libc::ilogb);
+ test_subnormal_range<double>(&LIBC_NAMESPACE::ilogb);
}
TEST_F(LlvmLibcILogbTest, NormalRange_ilogb) {
- test_normal_range<double>(&__llvm_libc::ilogb);
+ test_normal_range<double>(&LIBC_NAMESPACE::ilogb);
}
diff --git a/libc/test/src/math/ilogbf_test.cpp b/libc/test/src/math/ilogbf_test.cpp
index 20904a13c98a812..dcff8eeb1518059 100644
--- a/libc/test/src/math/ilogbf_test.cpp
+++ b/libc/test/src/math/ilogbf_test.cpp
@@ -16,21 +16,21 @@
#include <math.h>
TEST_F(LlvmLibcILogbTest, SpecialNumbers_ilogbf) {
- test_special_numbers<float>(&__llvm_libc::ilogbf);
+ test_special_numbers<float>(&LIBC_NAMESPACE::ilogbf);
}
TEST_F(LlvmLibcILogbTest, PowersOfTwo_ilogbf) {
- test_powers_of_two<float>(&__llvm_libc::ilogbf);
+ test_powers_of_two<float>(&LIBC_NAMESPACE::ilogbf);
}
TEST_F(LlvmLibcILogbTest, SomeIntegers_ilogbf) {
- test_some_integers<float>(&__llvm_libc::ilogbf);
+ test_some_integers<float>(&LIBC_NAMESPACE::ilogbf);
}
TEST_F(LlvmLibcILogbTest, SubnormalRange_ilogbf) {
- test_subnormal_range<float>(&__llvm_libc::ilogbf);
+ test_subnormal_range<float>(&LIBC_NAMESPACE::ilogbf);
}
TEST_F(LlvmLibcILogbTest, NormalRange_ilogbf) {
- test_normal_range<float>(&__llvm_libc::ilogbf);
+ test_normal_range<float>(&LIBC_NAMESPACE::ilogbf);
}
diff --git a/libc/test/src/math/ilogbl_test.cpp b/libc/test/src/math/ilogbl_test.cpp
index 9647f232245dc3e..29a221ad7f08f7a 100644
--- a/libc/test/src/math/ilogbl_test.cpp
+++ b/libc/test/src/math/ilogbl_test.cpp
@@ -16,21 +16,21 @@
#include <math.h>
TEST_F(LlvmLibcILogbTest, SpecialNumbers_ilogbl) {
- test_special_numbers<long double>(&__llvm_libc::ilogbl);
+ test_special_numbers<long double>(&LIBC_NAMESPACE::ilogbl);
}
TEST_F(LlvmLibcILogbTest, PowersOfTwo_ilogbl) {
- test_powers_of_two<long double>(&__llvm_libc::ilogbl);
+ test_powers_of_two<long double>(&LIBC_NAMESPACE::ilogbl);
}
TEST_F(LlvmLibcILogbTest, SomeIntegers_ilogbl) {
- test_some_integers<long double>(&__llvm_libc::ilogbl);
+ test_some_integers<long double>(&LIBC_NAMESPACE::ilogbl);
}
TEST_F(LlvmLibcILogbTest, SubnormalRange_ilogbl) {
- test_subnormal_range<long double>(&__llvm_libc::ilogbl);
+ test_subnormal_range<long double>(&LIBC_NAMESPACE::ilogbl);
}
TEST_F(LlvmLibcILogbTest, NormalRange_ilogbl) {
- test_normal_range<long double>(&__llvm_libc::ilogbl);
+ test_normal_range<long double>(&LIBC_NAMESPACE::ilogbl);
}
diff --git a/libc/test/src/math/inv_trigf_utils_test.cpp b/libc/test/src/math/inv_trigf_utils_test.cpp
index ffcca5cce420390..4f50027bf82a83a 100644
--- a/libc/test/src/math/inv_trigf_utils_test.cpp
+++ b/libc/test/src/math/inv_trigf_utils_test.cpp
@@ -14,7 +14,7 @@
#include "utils/MPFRWrapper/MPFRUtils.h"
#include <math.h>
-namespace mpfr = __llvm_libc::testing::mpfr;
+namespace mpfr = LIBC_NAMESPACE::testing::mpfr;
DECLARE_SPECIAL_CONSTANTS(float)
@@ -24,11 +24,11 @@ constexpr float def_prec = 0.500001f;
auto f_normal = [](float x) -> bool { return !(isnan(x) || isinf(x)); };
TEST(LlvmLibcAtanfPosTest, InFloatRange) {
- CHECK_DATA(0.0f, inf, mpfr::Operation::Atan, __llvm_libc::atan_eval, f_normal,
- def_count, def_prec);
+ CHECK_DATA(0.0f, inf, mpfr::Operation::Atan, LIBC_NAMESPACE::atan_eval,
+ f_normal, def_count, def_prec);
}
TEST(LlvmLibcAtanfNegTest, InFloatRange) {
- CHECK_DATA(-0.0f, neg_inf, mpfr::Operation::Atan, __llvm_libc::atan_eval,
+ CHECK_DATA(-0.0f, neg_inf, mpfr::Operation::Atan, LIBC_NAMESPACE::atan_eval,
f_normal, def_count, def_prec);
}
diff --git a/libc/test/src/math/ldexp_test.cpp b/libc/test/src/math/ldexp_test.cpp
index c078aa4b7ef84c7..aad580f95fb99d4 100644
--- a/libc/test/src/math/ldexp_test.cpp
+++ b/libc/test/src/math/ldexp_test.cpp
@@ -10,4 +10,4 @@
#include "src/math/ldexp.h"
-LIST_LDEXP_TESTS(double, __llvm_libc::ldexp)
+LIST_LDEXP_TESTS(double, LIBC_NAMESPACE::ldexp)
diff --git a/libc/test/src/math/ldexpf_test.cpp b/libc/test/src/math/ldexpf_test.cpp
index 4fe80fc79151cd6..f4cce37b9277dc5 100644
--- a/libc/test/src/math/ldexpf_test.cpp
+++ b/libc/test/src/math/ldexpf_test.cpp
@@ -10,4 +10,4 @@
#include "src/math/ldexpf.h"
-LIST_LDEXP_TESTS(float, __llvm_libc::ldexpf)
+LIST_LDEXP_TESTS(float, LIBC_NAMESPACE::ldexpf)
diff --git a/libc/test/src/math/ldexpl_test.cpp b/libc/test/src/math/ldexpl_test.cpp
index 5e6e6e75ae0855b..405e53390e8c34d 100644
--- a/libc/test/src/math/ldexpl_test.cpp
+++ b/libc/test/src/math/ldexpl_test.cpp
@@ -10,4 +10,4 @@
#include "src/math/ldexpl.h"
-LIST_LDEXP_TESTS(long double, __llvm_libc::ldexpl)
+LIST_LDEXP_TESTS(long double, LIBC_NAMESPACE::ldexpl)
diff --git a/libc/test/src/math/llrint_test.cpp b/libc/test/src/math/llrint_test.cpp
index 8027004bd50a5dd..8cf7d92095891bf 100644
--- a/libc/test/src/math/llrint_test.cpp
+++ b/libc/test/src/math/llrint_test.cpp
@@ -10,4 +10,5 @@
#include "src/math/llrint.h"
-LIST_ROUND_TO_INTEGER_TESTS_WITH_MODES(double, long long, __llvm_libc::llrint)
+LIST_ROUND_TO_INTEGER_TESTS_WITH_MODES(double, long long,
+ LIBC_NAMESPACE::llrint)
diff --git a/libc/test/src/math/llrintf_test.cpp b/libc/test/src/math/llrintf_test.cpp
index 9ad710e4698350c..0d9d3c4111bb245 100644
--- a/libc/test/src/math/llrintf_test.cpp
+++ b/libc/test/src/math/llrintf_test.cpp
@@ -10,4 +10,5 @@
#include "src/math/llrintf.h"
-LIST_ROUND_TO_INTEGER_TESTS_WITH_MODES(float, long long, __llvm_libc::llrintf)
+LIST_ROUND_TO_INTEGER_TESTS_WITH_MODES(float, long long,
+ LIBC_NAMESPACE::llrintf)
diff --git a/libc/test/src/math/llrintl_test.cpp b/libc/test/src/math/llrintl_test.cpp
index 948e961e57bd4d0..1ceb9fecc40391f 100644
--- a/libc/test/src/math/llrintl_test.cpp
+++ b/libc/test/src/math/llrintl_test.cpp
@@ -11,4 +11,4 @@
#include "src/math/llrintl.h"
LIST_ROUND_TO_INTEGER_TESTS_WITH_MODES(long double, long long,
- __llvm_libc::llrintl)
+ LIBC_NAMESPACE::llrintl)
diff --git a/libc/test/src/math/llround_test.cpp b/libc/test/src/math/llround_test.cpp
index c86095dc9aae03b..bda2fca6e8659f3 100644
--- a/libc/test/src/math/llround_test.cpp
+++ b/libc/test/src/math/llround_test.cpp
@@ -10,4 +10,4 @@
#include "src/math/llround.h"
-LIST_ROUND_TO_INTEGER_TESTS(double, long long, __llvm_libc::llround)
+LIST_ROUND_TO_INTEGER_TESTS(double, long long, LIBC_NAMESPACE::llround)
diff --git a/libc/test/src/math/llroundf_test.cpp b/libc/test/src/math/llroundf_test.cpp
index 5e36258c246ae13..a35b5fabbac34c3 100644
--- a/libc/test/src/math/llroundf_test.cpp
+++ b/libc/test/src/math/llroundf_test.cpp
@@ -10,4 +10,4 @@
#include "src/math/llroundf.h"
-LIST_ROUND_TO_INTEGER_TESTS(float, long long, __llvm_libc::llroundf)
+LIST_ROUND_TO_INTEGER_TESTS(float, long long, LIBC_NAMESPACE::llroundf)
diff --git a/libc/test/src/math/llroundl_test.cpp b/libc/test/src/math/llroundl_test.cpp
index 8fbc840c4f2acc7..e43d49f4cbe1bf3 100644
--- a/libc/test/src/math/llroundl_test.cpp
+++ b/libc/test/src/math/llroundl_test.cpp
@@ -10,4 +10,4 @@
#include "src/math/llroundl.h"
-LIST_ROUND_TO_INTEGER_TESTS(long double, long long, __llvm_libc::llroundl)
+LIST_ROUND_TO_INTEGER_TESTS(long double, long long, LIBC_NAMESPACE::llroundl)
diff --git a/libc/test/src/math/log10_test.cpp b/libc/test/src/math/log10_test.cpp
index f841fbed8a9f8b7..46458c324673b02 100644
--- a/libc/test/src/math/log10_test.cpp
+++ b/libc/test/src/math/log10_test.cpp
@@ -17,19 +17,21 @@
#include <errno.h>
#include <stdint.h>
-namespace mpfr = __llvm_libc::testing::mpfr;
-using __llvm_libc::testing::tlog;
+namespace mpfr = LIBC_NAMESPACE::testing::mpfr;
+using LIBC_NAMESPACE::testing::tlog;
DECLARE_SPECIAL_CONSTANTS(double)
TEST(LlvmLibcLog10Test, SpecialNumbers) {
- EXPECT_FP_EQ(aNaN, __llvm_libc::log10(aNaN));
- EXPECT_FP_EQ(inf, __llvm_libc::log10(inf));
- EXPECT_FP_IS_NAN_WITH_EXCEPTION(__llvm_libc::log10(neg_inf), FE_INVALID);
- EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, __llvm_libc::log10(0.0), FE_DIVBYZERO);
- EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, __llvm_libc::log10(-0.0), FE_DIVBYZERO);
- EXPECT_FP_IS_NAN_WITH_EXCEPTION(__llvm_libc::log10(-1.0), FE_INVALID);
- EXPECT_FP_EQ_ALL_ROUNDING(zero, __llvm_libc::log10(1.0));
+ EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::log10(aNaN));
+ EXPECT_FP_EQ(inf, LIBC_NAMESPACE::log10(inf));
+ EXPECT_FP_IS_NAN_WITH_EXCEPTION(LIBC_NAMESPACE::log10(neg_inf), FE_INVALID);
+ EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, LIBC_NAMESPACE::log10(0.0),
+ FE_DIVBYZERO);
+ EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, LIBC_NAMESPACE::log10(-0.0),
+ FE_DIVBYZERO);
+ EXPECT_FP_IS_NAN_WITH_EXCEPTION(LIBC_NAMESPACE::log10(-1.0), FE_INVALID);
+ EXPECT_FP_EQ_ALL_ROUNDING(zero, LIBC_NAMESPACE::log10(1.0));
}
TEST(LlvmLibcLog10Test, TrickyInputs) {
@@ -66,7 +68,7 @@ TEST(LlvmLibcLog10Test, TrickyInputs) {
for (int i = 0; i < N; ++i) {
double x = double(FPBits(INPUTS[i]));
EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Log10, x,
- __llvm_libc::log10(x), 0.5);
+ LIBC_NAMESPACE::log10(x), 0.5);
}
}
@@ -74,7 +76,7 @@ TEST(LlvmLibcLog10Test, AllExponents) {
double x = 0x1.0p-1074;
for (int i = -1074; i < 1024; ++i, x *= 2.0) {
ASSERT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Log10, x,
- __llvm_libc::log10(x), 0.5);
+ LIBC_NAMESPACE::log10(x), 0.5);
}
}
@@ -101,7 +103,7 @@ TEST(LlvmLibcLog10Test, InDoubleRange) {
if (isnan(x) || isinf(x) || x < 0.0)
continue;
libc_errno = 0;
- double result = __llvm_libc::log10(x);
+ double result = LIBC_NAMESPACE::log10(x);
++cc;
if (isnan(result) || isinf(result))
continue;
diff --git a/libc/test/src/math/log10f_test.cpp b/libc/test/src/math/log10f_test.cpp
index 444a742003235fd..05c42b9265ad927 100644
--- a/libc/test/src/math/log10f_test.cpp
+++ b/libc/test/src/math/log10f_test.cpp
@@ -16,19 +16,20 @@
#include <errno.h>
#include <stdint.h>
-namespace mpfr = __llvm_libc::testing::mpfr;
+namespace mpfr = LIBC_NAMESPACE::testing::mpfr;
DECLARE_SPECIAL_CONSTANTS(float)
TEST(LlvmLibcLog10fTest, SpecialNumbers) {
- EXPECT_FP_EQ(aNaN, __llvm_libc::log10f(aNaN));
- EXPECT_FP_EQ(inf, __llvm_libc::log10f(inf));
- EXPECT_FP_IS_NAN_WITH_EXCEPTION(__llvm_libc::log10f(neg_inf), FE_INVALID);
- EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, __llvm_libc::log10f(0.0f), FE_DIVBYZERO);
- EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, __llvm_libc::log10f(-0.0f),
+ EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::log10f(aNaN));
+ EXPECT_FP_EQ(inf, LIBC_NAMESPACE::log10f(inf));
+ EXPECT_FP_IS_NAN_WITH_EXCEPTION(LIBC_NAMESPACE::log10f(neg_inf), FE_INVALID);
+ EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, LIBC_NAMESPACE::log10f(0.0f),
FE_DIVBYZERO);
- EXPECT_FP_IS_NAN_WITH_EXCEPTION(__llvm_libc::log10f(-1.0f), FE_INVALID);
- EXPECT_FP_EQ_ALL_ROUNDING(zero, __llvm_libc::log10f(1.0f));
+ EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, LIBC_NAMESPACE::log10f(-0.0f),
+ FE_DIVBYZERO);
+ EXPECT_FP_IS_NAN_WITH_EXCEPTION(LIBC_NAMESPACE::log10f(-1.0f), FE_INVALID);
+ EXPECT_FP_EQ_ALL_ROUNDING(zero, LIBC_NAMESPACE::log10f(1.0f));
}
TEST(LlvmLibcLog10fTest, TrickyInputs) {
@@ -60,7 +61,7 @@ TEST(LlvmLibcLog10fTest, TrickyInputs) {
for (int i = 0; i < N; ++i) {
float x = float(FPBits(INPUTS[i]));
EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Log10, x,
- __llvm_libc::log10f(x), 0.5);
+ LIBC_NAMESPACE::log10f(x), 0.5);
}
}
@@ -70,6 +71,6 @@ TEST(LlvmLibcLog10fTest, InFloatRange) {
for (uint32_t i = 0, v = 0; i <= COUNT; ++i, v += STEP) {
float x = float(FPBits(v));
ASSERT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Log10, x,
- __llvm_libc::log10f(x), 0.5);
+ LIBC_NAMESPACE::log10f(x), 0.5);
}
}
diff --git a/libc/test/src/math/log1p_test.cpp b/libc/test/src/math/log1p_test.cpp
index c128c5e6c918f40..b677e7b416e1a6c 100644
--- a/libc/test/src/math/log1p_test.cpp
+++ b/libc/test/src/math/log1p_test.cpp
@@ -17,19 +17,20 @@
#include <errno.h>
#include <stdint.h>
-namespace mpfr = __llvm_libc::testing::mpfr;
-using __llvm_libc::testing::tlog;
+namespace mpfr = LIBC_NAMESPACE::testing::mpfr;
+using LIBC_NAMESPACE::testing::tlog;
DECLARE_SPECIAL_CONSTANTS(double)
TEST(LlvmLibcLog1pTest, SpecialNumbers) {
- EXPECT_FP_EQ(aNaN, __llvm_libc::log1p(aNaN));
- EXPECT_FP_EQ(inf, __llvm_libc::log1p(inf));
- EXPECT_FP_IS_NAN_WITH_EXCEPTION(__llvm_libc::log1p(neg_inf), FE_INVALID);
- EXPECT_FP_IS_NAN_WITH_EXCEPTION(__llvm_libc::log1p(-2.0), FE_INVALID);
- EXPECT_FP_EQ(zero, __llvm_libc::log1p(0.0));
- EXPECT_FP_EQ(neg_zero, __llvm_libc::log1p(-0.0));
- EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, __llvm_libc::log1p(-1.0), FE_DIVBYZERO);
+ EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::log1p(aNaN));
+ EXPECT_FP_EQ(inf, LIBC_NAMESPACE::log1p(inf));
+ EXPECT_FP_IS_NAN_WITH_EXCEPTION(LIBC_NAMESPACE::log1p(neg_inf), FE_INVALID);
+ EXPECT_FP_IS_NAN_WITH_EXCEPTION(LIBC_NAMESPACE::log1p(-2.0), FE_INVALID);
+ EXPECT_FP_EQ(zero, LIBC_NAMESPACE::log1p(0.0));
+ EXPECT_FP_EQ(neg_zero, LIBC_NAMESPACE::log1p(-0.0));
+ EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, LIBC_NAMESPACE::log1p(-1.0),
+ FE_DIVBYZERO);
}
TEST(LlvmLibcLog1pTest, TrickyInputs) {
@@ -68,7 +69,7 @@ TEST(LlvmLibcLog1pTest, TrickyInputs) {
for (int i = 0; i < N; ++i) {
double x = double(FPBits(INPUTS[i]));
EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Log1p, x,
- __llvm_libc::log1p(x), 0.5);
+ LIBC_NAMESPACE::log1p(x), 0.5);
}
}
@@ -76,7 +77,7 @@ TEST(LlvmLibcLog1pTest, AllExponents) {
double x = 0x1.0p-1074;
for (int i = -1074; i < 1024; ++i, x *= 2.0) {
ASSERT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Log1p, x,
- __llvm_libc::log1p(x), 0.5);
+ LIBC_NAMESPACE::log1p(x), 0.5);
}
}
@@ -102,7 +103,7 @@ TEST(LlvmLibcLog1pTest, InDoubleRange) {
if (isnan(x) || isinf(x) || x < 0.0)
continue;
libc_errno = 0;
- double result = __llvm_libc::log1p(x);
+ double result = LIBC_NAMESPACE::log1p(x);
++cc;
if (isnan(result) || isinf(result))
continue;
diff --git a/libc/test/src/math/log1pf_test.cpp b/libc/test/src/math/log1pf_test.cpp
index 264687d5fc2b0e0..d8132e479e83dba 100644
--- a/libc/test/src/math/log1pf_test.cpp
+++ b/libc/test/src/math/log1pf_test.cpp
@@ -17,17 +17,17 @@
#include <errno.h>
#include <stdint.h>
-namespace mpfr = __llvm_libc::testing::mpfr;
+namespace mpfr = LIBC_NAMESPACE::testing::mpfr;
DECLARE_SPECIAL_CONSTANTS(float)
TEST(LlvmLibclog1pfTest, SpecialNumbers) {
- EXPECT_FP_EQ(aNaN, __llvm_libc::log1pf(aNaN));
- EXPECT_FP_EQ(inf, __llvm_libc::log1pf(inf));
- EXPECT_FP_IS_NAN_WITH_EXCEPTION(__llvm_libc::log1pf(neg_inf), FE_INVALID);
- EXPECT_FP_EQ(zero, __llvm_libc::log1pf(0.0f));
- EXPECT_FP_EQ(neg_zero, __llvm_libc::log1pf(-0.0f));
- EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, __llvm_libc::log1pf(-1.0f),
+ EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::log1pf(aNaN));
+ EXPECT_FP_EQ(inf, LIBC_NAMESPACE::log1pf(inf));
+ EXPECT_FP_IS_NAN_WITH_EXCEPTION(LIBC_NAMESPACE::log1pf(neg_inf), FE_INVALID);
+ EXPECT_FP_EQ(zero, LIBC_NAMESPACE::log1pf(0.0f));
+ EXPECT_FP_EQ(neg_zero, LIBC_NAMESPACE::log1pf(-0.0f));
+ EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, LIBC_NAMESPACE::log1pf(-1.0f),
FE_DIVBYZERO);
}
@@ -65,7 +65,7 @@ TEST(LlvmLibclog1pfTest, TrickyInputs) {
for (int i = 0; i < N; ++i) {
float x = float(FPBits(INPUTS[i]));
EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Log1p, x,
- __llvm_libc::log1pf(x), 0.5);
+ LIBC_NAMESPACE::log1pf(x), 0.5);
}
}
@@ -78,6 +78,6 @@ TEST(LlvmLibclog1pfTest, InFloatRange) {
continue;
libc_errno = 0;
ASSERT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Log1p, x,
- __llvm_libc::log1pf(x), 0.5);
+ LIBC_NAMESPACE::log1pf(x), 0.5);
}
}
diff --git a/libc/test/src/math/log2_test.cpp b/libc/test/src/math/log2_test.cpp
index c4756875d6a54b3..42643fa7083fc13 100644
--- a/libc/test/src/math/log2_test.cpp
+++ b/libc/test/src/math/log2_test.cpp
@@ -17,19 +17,20 @@
#include <errno.h>
#include <stdint.h>
-namespace mpfr = __llvm_libc::testing::mpfr;
-using __llvm_libc::testing::tlog;
+namespace mpfr = LIBC_NAMESPACE::testing::mpfr;
+using LIBC_NAMESPACE::testing::tlog;
DECLARE_SPECIAL_CONSTANTS(double)
TEST(LlvmLibcLog2Test, SpecialNumbers) {
- EXPECT_FP_EQ(aNaN, __llvm_libc::log2(aNaN));
- EXPECT_FP_EQ(inf, __llvm_libc::log2(inf));
- EXPECT_FP_IS_NAN_WITH_EXCEPTION(__llvm_libc::log2(neg_inf), FE_INVALID);
- EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, __llvm_libc::log2(0.0), FE_DIVBYZERO);
- EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, __llvm_libc::log2(-0.0), FE_DIVBYZERO);
- EXPECT_FP_IS_NAN_WITH_EXCEPTION(__llvm_libc::log2(-1.0), FE_INVALID);
- EXPECT_FP_EQ_ALL_ROUNDING(zero, __llvm_libc::log2(1.0));
+ EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::log2(aNaN));
+ EXPECT_FP_EQ(inf, LIBC_NAMESPACE::log2(inf));
+ EXPECT_FP_IS_NAN_WITH_EXCEPTION(LIBC_NAMESPACE::log2(neg_inf), FE_INVALID);
+ EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, LIBC_NAMESPACE::log2(0.0), FE_DIVBYZERO);
+ EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, LIBC_NAMESPACE::log2(-0.0),
+ FE_DIVBYZERO);
+ EXPECT_FP_IS_NAN_WITH_EXCEPTION(LIBC_NAMESPACE::log2(-1.0), FE_INVALID);
+ EXPECT_FP_EQ_ALL_ROUNDING(zero, LIBC_NAMESPACE::log2(1.0));
}
TEST(LlvmLibcLog2Test, TrickyInputs) {
@@ -65,7 +66,7 @@ TEST(LlvmLibcLog2Test, TrickyInputs) {
for (int i = 0; i < N; ++i) {
double x = double(FPBits(INPUTS[i]));
EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Log2, x,
- __llvm_libc::log2(x), 0.5);
+ LIBC_NAMESPACE::log2(x), 0.5);
}
}
@@ -73,7 +74,7 @@ TEST(LlvmLibcLog2Test, AllExponents) {
double x = 0x1.0p-1074;
for (int i = -1074; i < 1024; ++i, x *= 2.0) {
ASSERT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Log2, x,
- __llvm_libc::log2(x), 0.5);
+ LIBC_NAMESPACE::log2(x), 0.5);
}
}
@@ -101,7 +102,7 @@ TEST(LlvmLibcLog2Test, InDoubleRange) {
if (isnan(x) || isinf(x) || x < 0.0)
continue;
libc_errno = 0;
- double result = __llvm_libc::log2(x);
+ double result = LIBC_NAMESPACE::log2(x);
++cc;
if (isnan(result) || isinf(result))
continue;
diff --git a/libc/test/src/math/log2f_test.cpp b/libc/test/src/math/log2f_test.cpp
index afc7a748c63d5f4..d4f4b937c955437 100644
--- a/libc/test/src/math/log2f_test.cpp
+++ b/libc/test/src/math/log2f_test.cpp
@@ -16,18 +16,20 @@
#include <stdint.h>
-namespace mpfr = __llvm_libc::testing::mpfr;
+namespace mpfr = LIBC_NAMESPACE::testing::mpfr;
DECLARE_SPECIAL_CONSTANTS(float)
TEST(LlvmLibcLog2fTest, SpecialNumbers) {
- EXPECT_FP_EQ(aNaN, __llvm_libc::log2f(aNaN));
- EXPECT_FP_EQ(inf, __llvm_libc::log2f(inf));
- EXPECT_FP_IS_NAN_WITH_EXCEPTION(__llvm_libc::log2f(neg_inf), FE_INVALID);
- EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, __llvm_libc::log2f(0.0f), FE_DIVBYZERO);
- EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, __llvm_libc::log2f(-0.0f), FE_DIVBYZERO);
- EXPECT_FP_IS_NAN_WITH_EXCEPTION(__llvm_libc::log2f(-1.0f), FE_INVALID);
- EXPECT_FP_EQ_ALL_ROUNDING(zero, __llvm_libc::log2f(1.0f));
+ EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::log2f(aNaN));
+ EXPECT_FP_EQ(inf, LIBC_NAMESPACE::log2f(inf));
+ EXPECT_FP_IS_NAN_WITH_EXCEPTION(LIBC_NAMESPACE::log2f(neg_inf), FE_INVALID);
+ EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, LIBC_NAMESPACE::log2f(0.0f),
+ FE_DIVBYZERO);
+ EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, LIBC_NAMESPACE::log2f(-0.0f),
+ FE_DIVBYZERO);
+ EXPECT_FP_IS_NAN_WITH_EXCEPTION(LIBC_NAMESPACE::log2f(-1.0f), FE_INVALID);
+ EXPECT_FP_EQ_ALL_ROUNDING(zero, LIBC_NAMESPACE::log2f(1.0f));
}
TEST(LlvmLibcLog2fTest, TrickyInputs) {
@@ -39,7 +41,7 @@ TEST(LlvmLibcLog2fTest, TrickyInputs) {
for (int i = 0; i < N; ++i) {
float x = float(FPBits(INPUTS[i]));
EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Log2, x,
- __llvm_libc::log2f(x), 0.5);
+ LIBC_NAMESPACE::log2f(x), 0.5);
}
}
@@ -51,7 +53,7 @@ TEST(LlvmLibcLog2fTest, InFloatRange) {
if (isnan(x) || isinf(x))
continue;
libc_errno = 0;
- float result = __llvm_libc::log2f(x);
+ float result = LIBC_NAMESPACE::log2f(x);
// If the computation resulted in an error or did not produce valid result
// in the single-precision floating point range, then ignore comparing with
// MPFR result as MPFR can still produce valid results because of its
@@ -59,6 +61,6 @@ TEST(LlvmLibcLog2fTest, InFloatRange) {
if (isnan(result) || isinf(result) || libc_errno != 0)
continue;
ASSERT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Log2, x,
- __llvm_libc::log2f(x), 0.5);
+ LIBC_NAMESPACE::log2f(x), 0.5);
}
}
diff --git a/libc/test/src/math/log_test.cpp b/libc/test/src/math/log_test.cpp
index 5b662534bbf580e..caa274828fd66ac 100644
--- a/libc/test/src/math/log_test.cpp
+++ b/libc/test/src/math/log_test.cpp
@@ -17,19 +17,19 @@
#include <errno.h>
#include <stdint.h>
-namespace mpfr = __llvm_libc::testing::mpfr;
-using __llvm_libc::testing::tlog;
+namespace mpfr = LIBC_NAMESPACE::testing::mpfr;
+using LIBC_NAMESPACE::testing::tlog;
DECLARE_SPECIAL_CONSTANTS(double)
TEST(LlvmLibcLogTest, SpecialNumbers) {
- EXPECT_FP_EQ(aNaN, __llvm_libc::log(aNaN));
- EXPECT_FP_EQ(inf, __llvm_libc::log(inf));
- EXPECT_FP_IS_NAN_WITH_EXCEPTION(__llvm_libc::log(neg_inf), FE_INVALID);
- EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, __llvm_libc::log(0.0), FE_DIVBYZERO);
- EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, __llvm_libc::log(-0.0), FE_DIVBYZERO);
- EXPECT_FP_IS_NAN_WITH_EXCEPTION(__llvm_libc::log(-1.0), FE_INVALID);
- EXPECT_FP_EQ_ALL_ROUNDING(zero, __llvm_libc::log(1.0));
+ EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::log(aNaN));
+ EXPECT_FP_EQ(inf, LIBC_NAMESPACE::log(inf));
+ EXPECT_FP_IS_NAN_WITH_EXCEPTION(LIBC_NAMESPACE::log(neg_inf), FE_INVALID);
+ EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, LIBC_NAMESPACE::log(0.0), FE_DIVBYZERO);
+ EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, LIBC_NAMESPACE::log(-0.0), FE_DIVBYZERO);
+ EXPECT_FP_IS_NAN_WITH_EXCEPTION(LIBC_NAMESPACE::log(-1.0), FE_INVALID);
+ EXPECT_FP_EQ_ALL_ROUNDING(zero, LIBC_NAMESPACE::log(1.0));
}
TEST(LlvmLibcLogTest, TrickyInputs) {
@@ -64,16 +64,16 @@ TEST(LlvmLibcLogTest, TrickyInputs) {
};
for (int i = 0; i < N; ++i) {
double x = double(FPBits(INPUTS[i]));
- EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Log, x, __llvm_libc::log(x),
- 0.5);
+ EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Log, x,
+ LIBC_NAMESPACE::log(x), 0.5);
}
}
TEST(LlvmLibcLogTest, AllExponents) {
double x = 0x1.0p-1074;
for (int i = -1074; i < 1024; ++i, x *= 2.0) {
- ASSERT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Log, x, __llvm_libc::log(x),
- 0.5);
+ ASSERT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Log, x,
+ LIBC_NAMESPACE::log(x), 0.5);
}
}
@@ -101,7 +101,7 @@ TEST(LlvmLibcLogTest, InDoubleRange) {
if (isnan(x) || isinf(x) || x < 0.0)
continue;
libc_errno = 0;
- double result = __llvm_libc::log(x);
+ double result = LIBC_NAMESPACE::log(x);
++cc;
if (isnan(result) || isinf(result))
continue;
diff --git a/libc/test/src/math/logb_test.cpp b/libc/test/src/math/logb_test.cpp
index b90348522aa3aa6..2dc56c2e613ccb2 100644
--- a/libc/test/src/math/logb_test.cpp
+++ b/libc/test/src/math/logb_test.cpp
@@ -10,4 +10,4 @@
#include "src/math/logb.h"
-LIST_LOGB_TESTS(double, __llvm_libc::logb)
+LIST_LOGB_TESTS(double, LIBC_NAMESPACE::logb)
diff --git a/libc/test/src/math/logbf_test.cpp b/libc/test/src/math/logbf_test.cpp
index 727eefffbb1740c..c25485ca78b065b 100644
--- a/libc/test/src/math/logbf_test.cpp
+++ b/libc/test/src/math/logbf_test.cpp
@@ -10,4 +10,4 @@
#include "src/math/logbf.h"
-LIST_LOGB_TESTS(float, __llvm_libc::logbf)
+LIST_LOGB_TESTS(float, LIBC_NAMESPACE::logbf)
diff --git a/libc/test/src/math/logbl_test.cpp b/libc/test/src/math/logbl_test.cpp
index 1c7b0d4e66e84ec..b26cee65783c420 100644
--- a/libc/test/src/math/logbl_test.cpp
+++ b/libc/test/src/math/logbl_test.cpp
@@ -10,4 +10,4 @@
#include "src/math/logbl.h"
-LIST_LOGB_TESTS(long double, __llvm_libc::logbl)
+LIST_LOGB_TESTS(long double, LIBC_NAMESPACE::logbl)
diff --git a/libc/test/src/math/logf_test.cpp b/libc/test/src/math/logf_test.cpp
index 6f8983c4645dff6..832bdd21edd417a 100644
--- a/libc/test/src/math/logf_test.cpp
+++ b/libc/test/src/math/logf_test.cpp
@@ -15,18 +15,20 @@
#include <stdint.h>
-namespace mpfr = __llvm_libc::testing::mpfr;
+namespace mpfr = LIBC_NAMESPACE::testing::mpfr;
DECLARE_SPECIAL_CONSTANTS(float)
TEST(LlvmLibcLogfTest, SpecialNumbers) {
- EXPECT_FP_EQ(aNaN, __llvm_libc::logf(aNaN));
- EXPECT_FP_EQ(inf, __llvm_libc::logf(inf));
- EXPECT_FP_IS_NAN_WITH_EXCEPTION(__llvm_libc::logf(neg_inf), FE_INVALID);
- EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, __llvm_libc::logf(0.0f), FE_DIVBYZERO);
- EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, __llvm_libc::logf(-0.0f), FE_DIVBYZERO);
- EXPECT_FP_IS_NAN_WITH_EXCEPTION(__llvm_libc::logf(-1.0f), FE_INVALID);
- EXPECT_FP_EQ_ALL_ROUNDING(zero, __llvm_libc::logf(1.0f));
+ EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::logf(aNaN));
+ EXPECT_FP_EQ(inf, LIBC_NAMESPACE::logf(inf));
+ EXPECT_FP_IS_NAN_WITH_EXCEPTION(LIBC_NAMESPACE::logf(neg_inf), FE_INVALID);
+ EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, LIBC_NAMESPACE::logf(0.0f),
+ FE_DIVBYZERO);
+ EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, LIBC_NAMESPACE::logf(-0.0f),
+ FE_DIVBYZERO);
+ EXPECT_FP_IS_NAN_WITH_EXCEPTION(LIBC_NAMESPACE::logf(-1.0f), FE_INVALID);
+ EXPECT_FP_EQ_ALL_ROUNDING(zero, LIBC_NAMESPACE::logf(1.0f));
}
TEST(LlvmLibcLogfTest, TrickyInputs) {
@@ -71,7 +73,7 @@ TEST(LlvmLibcLogfTest, TrickyInputs) {
for (int i = 0; i < N; ++i) {
float x = float(FPBits(INPUTS[i]));
EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Log, x,
- __llvm_libc::logf(x), 0.5);
+ LIBC_NAMESPACE::logf(x), 0.5);
}
}
@@ -83,6 +85,6 @@ TEST(LlvmLibcLogfTest, InFloatRange) {
if (isnan(x) || isinf(x))
continue;
ASSERT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Log, x,
- __llvm_libc::logf(x), 0.5);
+ LIBC_NAMESPACE::logf(x), 0.5);
}
}
diff --git a/libc/test/src/math/lrint_test.cpp b/libc/test/src/math/lrint_test.cpp
index 0dbfa3dd466d99f..9cff2661225361a 100644
--- a/libc/test/src/math/lrint_test.cpp
+++ b/libc/test/src/math/lrint_test.cpp
@@ -10,4 +10,4 @@
#include "src/math/lrint.h"
-LIST_ROUND_TO_INTEGER_TESTS_WITH_MODES(double, long, __llvm_libc::lrint)
+LIST_ROUND_TO_INTEGER_TESTS_WITH_MODES(double, long, LIBC_NAMESPACE::lrint)
diff --git a/libc/test/src/math/lrintf_test.cpp b/libc/test/src/math/lrintf_test.cpp
index 407813aa83c0feb..9c696a39e6928cb 100644
--- a/libc/test/src/math/lrintf_test.cpp
+++ b/libc/test/src/math/lrintf_test.cpp
@@ -10,4 +10,4 @@
#include "src/math/lrintf.h"
-LIST_ROUND_TO_INTEGER_TESTS_WITH_MODES(float, long, __llvm_libc::lrintf)
+LIST_ROUND_TO_INTEGER_TESTS_WITH_MODES(float, long, LIBC_NAMESPACE::lrintf)
diff --git a/libc/test/src/math/lrintl_test.cpp b/libc/test/src/math/lrintl_test.cpp
index a4551c38de10663..e44dd30d2c6cccc 100644
--- a/libc/test/src/math/lrintl_test.cpp
+++ b/libc/test/src/math/lrintl_test.cpp
@@ -10,4 +10,5 @@
#include "src/math/lrintl.h"
-LIST_ROUND_TO_INTEGER_TESTS_WITH_MODES(long double, long, __llvm_libc::lrintl)
+LIST_ROUND_TO_INTEGER_TESTS_WITH_MODES(long double, long,
+ LIBC_NAMESPACE::lrintl)
diff --git a/libc/test/src/math/lround_test.cpp b/libc/test/src/math/lround_test.cpp
index 0ee580f316b44ac..1fb2fc71e20ccbb 100644
--- a/libc/test/src/math/lround_test.cpp
+++ b/libc/test/src/math/lround_test.cpp
@@ -10,4 +10,4 @@
#include "src/math/lround.h"
-LIST_ROUND_TO_INTEGER_TESTS(double, long, __llvm_libc::lround)
+LIST_ROUND_TO_INTEGER_TESTS(double, long, LIBC_NAMESPACE::lround)
diff --git a/libc/test/src/math/lroundf_test.cpp b/libc/test/src/math/lroundf_test.cpp
index 7a2aad20e4f664b..38fe5c7d1a52dc5 100644
--- a/libc/test/src/math/lroundf_test.cpp
+++ b/libc/test/src/math/lroundf_test.cpp
@@ -10,4 +10,4 @@
#include "src/math/lroundf.h"
-LIST_ROUND_TO_INTEGER_TESTS(float, long, __llvm_libc::lroundf)
+LIST_ROUND_TO_INTEGER_TESTS(float, long, LIBC_NAMESPACE::lroundf)
diff --git a/libc/test/src/math/lroundl_test.cpp b/libc/test/src/math/lroundl_test.cpp
index c0ea33978205236..8a29ba95a61732d 100644
--- a/libc/test/src/math/lroundl_test.cpp
+++ b/libc/test/src/math/lroundl_test.cpp
@@ -10,4 +10,4 @@
#include "src/math/lroundl.h"
-LIST_ROUND_TO_INTEGER_TESTS(long double, long, __llvm_libc::lroundl)
+LIST_ROUND_TO_INTEGER_TESTS(long double, long, LIBC_NAMESPACE::lroundl)
diff --git a/libc/test/src/math/modf_test.cpp b/libc/test/src/math/modf_test.cpp
index ff89517506b4f27..b4b03bad848de57 100644
--- a/libc/test/src/math/modf_test.cpp
+++ b/libc/test/src/math/modf_test.cpp
@@ -10,4 +10,4 @@
#include "src/math/modf.h"
-LIST_MODF_TESTS(double, __llvm_libc::modf)
+LIST_MODF_TESTS(double, LIBC_NAMESPACE::modf)
diff --git a/libc/test/src/math/modff_test.cpp b/libc/test/src/math/modff_test.cpp
index 440304ab95ac78f..068dbc3f5313590 100644
--- a/libc/test/src/math/modff_test.cpp
+++ b/libc/test/src/math/modff_test.cpp
@@ -10,4 +10,4 @@
#include "src/math/modff.h"
-LIST_MODF_TESTS(float, __llvm_libc::modff)
+LIST_MODF_TESTS(float, LIBC_NAMESPACE::modff)
diff --git a/libc/test/src/math/modfl_test.cpp b/libc/test/src/math/modfl_test.cpp
index c98678b3e9243e3..ae8a72642c5871e 100644
--- a/libc/test/src/math/modfl_test.cpp
+++ b/libc/test/src/math/modfl_test.cpp
@@ -10,4 +10,4 @@
#include "src/math/modfl.h"
-LIST_MODF_TESTS(long double, __llvm_libc::modfl)
+LIST_MODF_TESTS(long double, LIBC_NAMESPACE::modfl)
diff --git a/libc/test/src/math/nextafter_test.cpp b/libc/test/src/math/nextafter_test.cpp
index 2dde48ceb053c6c..998b19fb1dccd37 100644
--- a/libc/test/src/math/nextafter_test.cpp
+++ b/libc/test/src/math/nextafter_test.cpp
@@ -10,4 +10,4 @@
#include "src/math/nextafter.h"
-LIST_NEXTAFTER_TESTS(double, __llvm_libc::nextafter)
+LIST_NEXTAFTER_TESTS(double, LIBC_NAMESPACE::nextafter)
diff --git a/libc/test/src/math/nextafterf_test.cpp b/libc/test/src/math/nextafterf_test.cpp
index 14234c717797eb5..31770bc591ec1fa 100644
--- a/libc/test/src/math/nextafterf_test.cpp
+++ b/libc/test/src/math/nextafterf_test.cpp
@@ -10,4 +10,4 @@
#include "src/math/nextafterf.h"
-LIST_NEXTAFTER_TESTS(float, __llvm_libc::nextafterf)
+LIST_NEXTAFTER_TESTS(float, LIBC_NAMESPACE::nextafterf)
diff --git a/libc/test/src/math/nextafterl_test.cpp b/libc/test/src/math/nextafterl_test.cpp
index db85d83edc690ef..4c8577f2690a1fd 100644
--- a/libc/test/src/math/nextafterl_test.cpp
+++ b/libc/test/src/math/nextafterl_test.cpp
@@ -10,4 +10,4 @@
#include "src/math/nextafterl.h"
-LIST_NEXTAFTER_TESTS(long double, __llvm_libc::nextafterl)
+LIST_NEXTAFTER_TESTS(long double, LIBC_NAMESPACE::nextafterl)
diff --git a/libc/test/src/math/remquo_test.cpp b/libc/test/src/math/remquo_test.cpp
index 8efec397f39d33b..4358331a8f76e2b 100644
--- a/libc/test/src/math/remquo_test.cpp
+++ b/libc/test/src/math/remquo_test.cpp
@@ -10,4 +10,4 @@
#include "src/math/remquo.h"
-LIST_REMQUO_TESTS(double, __llvm_libc::remquo)
+LIST_REMQUO_TESTS(double, LIBC_NAMESPACE::remquo)
diff --git a/libc/test/src/math/remquof_test.cpp b/libc/test/src/math/remquof_test.cpp
index 1af4ba4e0153b55..590b4ffb4595fdf 100644
--- a/libc/test/src/math/remquof_test.cpp
+++ b/libc/test/src/math/remquof_test.cpp
@@ -10,4 +10,4 @@
#include "src/math/remquof.h"
-LIST_REMQUO_TESTS(float, __llvm_libc::remquof)
+LIST_REMQUO_TESTS(float, LIBC_NAMESPACE::remquof)
diff --git a/libc/test/src/math/remquol_test.cpp b/libc/test/src/math/remquol_test.cpp
index e4438e83fe18ce1..ae2db4493041054 100644
--- a/libc/test/src/math/remquol_test.cpp
+++ b/libc/test/src/math/remquol_test.cpp
@@ -10,4 +10,4 @@
#include "src/math/remquol.h"
-LIST_REMQUO_TESTS(long double, __llvm_libc::remquol)
+LIST_REMQUO_TESTS(long double, LIBC_NAMESPACE::remquol)
diff --git a/libc/test/src/math/rint_test.cpp b/libc/test/src/math/rint_test.cpp
index eafa1a7fe6119fe..9c89b7acec56d5e 100644
--- a/libc/test/src/math/rint_test.cpp
+++ b/libc/test/src/math/rint_test.cpp
@@ -10,4 +10,4 @@
#include "src/math/rint.h"
-LIST_RINT_TESTS(double, __llvm_libc::rint)
+LIST_RINT_TESTS(double, LIBC_NAMESPACE::rint)
diff --git a/libc/test/src/math/rintf_test.cpp b/libc/test/src/math/rintf_test.cpp
index c15a697fac9208c..f875bab2556cadd 100644
--- a/libc/test/src/math/rintf_test.cpp
+++ b/libc/test/src/math/rintf_test.cpp
@@ -10,4 +10,4 @@
#include "src/math/rintf.h"
-LIST_RINT_TESTS(float, __llvm_libc::rintf)
+LIST_RINT_TESTS(float, LIBC_NAMESPACE::rintf)
diff --git a/libc/test/src/math/rintl_test.cpp b/libc/test/src/math/rintl_test.cpp
index 6c50873a272d046..458ca05a985af57 100644
--- a/libc/test/src/math/rintl_test.cpp
+++ b/libc/test/src/math/rintl_test.cpp
@@ -10,4 +10,4 @@
#include "src/math/rintl.h"
-LIST_RINT_TESTS(long double, __llvm_libc::rintl)
+LIST_RINT_TESTS(long double, LIBC_NAMESPACE::rintl)
diff --git a/libc/test/src/math/round_test.cpp b/libc/test/src/math/round_test.cpp
index 87ce079e89afc29..dbcb56717e20833 100644
--- a/libc/test/src/math/round_test.cpp
+++ b/libc/test/src/math/round_test.cpp
@@ -10,4 +10,4 @@
#include "src/math/round.h"
-LIST_ROUND_TESTS(double, __llvm_libc::round)
+LIST_ROUND_TESTS(double, LIBC_NAMESPACE::round)
diff --git a/libc/test/src/math/roundf_test.cpp b/libc/test/src/math/roundf_test.cpp
index 0a182dd02deee6f..053596a16e22f6c 100644
--- a/libc/test/src/math/roundf_test.cpp
+++ b/libc/test/src/math/roundf_test.cpp
@@ -10,4 +10,4 @@
#include "src/math/roundf.h"
-LIST_ROUND_TESTS(float, __llvm_libc::roundf)
+LIST_ROUND_TESTS(float, LIBC_NAMESPACE::roundf)
diff --git a/libc/test/src/math/roundl_test.cpp b/libc/test/src/math/roundl_test.cpp
index 32cf724fb7c4f3b..2a2a213a8181cda 100644
--- a/libc/test/src/math/roundl_test.cpp
+++ b/libc/test/src/math/roundl_test.cpp
@@ -10,4 +10,4 @@
#include "src/math/roundl.h"
-LIST_ROUND_TESTS(long double, __llvm_libc::roundl)
+LIST_ROUND_TESTS(long double, LIBC_NAMESPACE::roundl)
diff --git a/libc/test/src/math/scalbn_test.cpp b/libc/test/src/math/scalbn_test.cpp
index d4d60bf8afca180..413a2395ca3c57d 100644
--- a/libc/test/src/math/scalbn_test.cpp
+++ b/libc/test/src/math/scalbn_test.cpp
@@ -10,4 +10,4 @@
#include "src/math/scalbn.h"
-LIST_SCALBN_TESTS(double, __llvm_libc::scalbn)
+LIST_SCALBN_TESTS(double, LIBC_NAMESPACE::scalbn)
diff --git a/libc/test/src/math/scalbnf_test.cpp b/libc/test/src/math/scalbnf_test.cpp
index cbf2e7e1361e10c..e97781c2b235464 100644
--- a/libc/test/src/math/scalbnf_test.cpp
+++ b/libc/test/src/math/scalbnf_test.cpp
@@ -10,4 +10,4 @@
#include "src/math/scalbnf.h"
-LIST_SCALBN_TESTS(float, __llvm_libc::scalbnf)
+LIST_SCALBN_TESTS(float, LIBC_NAMESPACE::scalbnf)
diff --git a/libc/test/src/math/scalbnl_test.cpp b/libc/test/src/math/scalbnl_test.cpp
index 197887b2448c057..b0e005379090249 100644
--- a/libc/test/src/math/scalbnl_test.cpp
+++ b/libc/test/src/math/scalbnl_test.cpp
@@ -10,4 +10,4 @@
#include "src/math/scalbnl.h"
-LIST_SCALBN_TESTS(long double, __llvm_libc::scalbnl)
+LIST_SCALBN_TESTS(long double, LIBC_NAMESPACE::scalbnl)
diff --git a/libc/test/src/math/sdcomp26094.h b/libc/test/src/math/sdcomp26094.h
index 284578b8f78568e..4a77b2a4cd078ad 100644
--- a/libc/test/src/math/sdcomp26094.h
+++ b/libc/test/src/math/sdcomp26094.h
@@ -13,15 +13,15 @@
#include <stdint.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
namespace testing {
-static constexpr __llvm_libc::cpp::array<uint32_t, 10> SDCOMP26094_VALUES{
+static constexpr LIBC_NAMESPACE::cpp::array<uint32_t, 10> SDCOMP26094_VALUES{
0x46427f1b, 0x4647e568, 0x46428bac, 0x4647f1f9, 0x4647fe8a,
0x45d8d7f1, 0x45d371a4, 0x45ce0b57, 0x45d35882, 0x45cdf235,
};
} // namespace testing
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_TEST_SRC_MATH_SDCOMP26094_H
diff --git a/libc/test/src/math/sin_test.cpp b/libc/test/src/math/sin_test.cpp
index d92bd8553a2ef01..ee8451f5008106a 100644
--- a/libc/test/src/math/sin_test.cpp
+++ b/libc/test/src/math/sin_test.cpp
@@ -14,7 +14,7 @@
#include <math.h>
-namespace mpfr = __llvm_libc::testing::mpfr;
+namespace mpfr = LIBC_NAMESPACE::testing::mpfr;
DECLARE_SPECIAL_CONSTANTS(double)
@@ -28,6 +28,6 @@ TEST(LlvmLibcSinTest, Range) {
if (isnan(x) || isinf(x) || x > _2pi || x < -_2pi)
continue;
- ASSERT_MPFR_MATCH(mpfr::Operation::Sin, x, __llvm_libc::sin(x), 1.0);
+ ASSERT_MPFR_MATCH(mpfr::Operation::Sin, x, LIBC_NAMESPACE::sin(x), 1.0);
}
}
diff --git a/libc/test/src/math/sincosf_test.cpp b/libc/test/src/math/sincosf_test.cpp
index 3a5bdd12fbc38a7..f67fba1d31dfcdb 100644
--- a/libc/test/src/math/sincosf_test.cpp
+++ b/libc/test/src/math/sincosf_test.cpp
@@ -18,10 +18,10 @@
#include <errno.h>
#include <stdint.h>
-using __llvm_libc::testing::SDCOMP26094_VALUES;
-using FPBits = __llvm_libc::fputil::FPBits<float>;
+using LIBC_NAMESPACE::testing::SDCOMP26094_VALUES;
+using FPBits = LIBC_NAMESPACE::fputil::FPBits<float>;
-namespace mpfr = __llvm_libc::testing::mpfr;
+namespace mpfr = LIBC_NAMESPACE::testing::mpfr;
DECLARE_SPECIAL_CONSTANTS(float)
@@ -29,27 +29,27 @@ TEST(LlvmLibcSinCosfTest, SpecialNumbers) {
libc_errno = 0;
float sin, cos;
- __llvm_libc::sincosf(aNaN, &sin, &cos);
+ LIBC_NAMESPACE::sincosf(aNaN, &sin, &cos);
EXPECT_FP_EQ(aNaN, cos);
EXPECT_FP_EQ(aNaN, sin);
EXPECT_MATH_ERRNO(0);
- __llvm_libc::sincosf(0.0f, &sin, &cos);
+ LIBC_NAMESPACE::sincosf(0.0f, &sin, &cos);
EXPECT_FP_EQ(1.0f, cos);
EXPECT_FP_EQ(0.0f, sin);
EXPECT_MATH_ERRNO(0);
- __llvm_libc::sincosf(-0.0f, &sin, &cos);
+ LIBC_NAMESPACE::sincosf(-0.0f, &sin, &cos);
EXPECT_FP_EQ(1.0f, cos);
EXPECT_FP_EQ(-0.0f, sin);
EXPECT_MATH_ERRNO(0);
- __llvm_libc::sincosf(inf, &sin, &cos);
+ LIBC_NAMESPACE::sincosf(inf, &sin, &cos);
EXPECT_FP_EQ(aNaN, cos);
EXPECT_FP_EQ(aNaN, sin);
EXPECT_MATH_ERRNO(EDOM);
- __llvm_libc::sincosf(neg_inf, &sin, &cos);
+ LIBC_NAMESPACE::sincosf(neg_inf, &sin, &cos);
EXPECT_FP_EQ(aNaN, cos);
EXPECT_FP_EQ(aNaN, sin);
EXPECT_MATH_ERRNO(EDOM);
@@ -58,11 +58,11 @@ TEST(LlvmLibcSinCosfTest, SpecialNumbers) {
#define EXPECT_SINCOS_MATCH_ALL_ROUNDING(input) \
{ \
float sin, cos; \
- namespace mpfr = __llvm_libc::testing::mpfr; \
+ namespace mpfr = LIBC_NAMESPACE::testing::mpfr; \
\
mpfr::ForceRoundingMode __r1(mpfr::RoundingMode::Nearest); \
if (__r1.success) { \
- __llvm_libc::sincosf(input, &sin, &cos); \
+ LIBC_NAMESPACE::sincosf(input, &sin, &cos); \
EXPECT_MPFR_MATCH(mpfr::Operation::Sin, input, sin, 0.5, \
mpfr::RoundingMode::Nearest); \
EXPECT_MPFR_MATCH(mpfr::Operation::Cos, input, cos, 0.5, \
@@ -71,7 +71,7 @@ TEST(LlvmLibcSinCosfTest, SpecialNumbers) {
\
mpfr::ForceRoundingMode __r2(mpfr::RoundingMode::Upward); \
if (__r2.success) { \
- __llvm_libc::sincosf(input, &sin, &cos); \
+ LIBC_NAMESPACE::sincosf(input, &sin, &cos); \
EXPECT_MPFR_MATCH(mpfr::Operation::Sin, input, sin, 0.5, \
mpfr::RoundingMode::Upward); \
EXPECT_MPFR_MATCH(mpfr::Operation::Cos, input, cos, 0.5, \
@@ -80,7 +80,7 @@ TEST(LlvmLibcSinCosfTest, SpecialNumbers) {
\
mpfr::ForceRoundingMode __r3(mpfr::RoundingMode::Downward); \
if (__r3.success) { \
- __llvm_libc::sincosf(input, &sin, &cos); \
+ LIBC_NAMESPACE::sincosf(input, &sin, &cos); \
EXPECT_MPFR_MATCH(mpfr::Operation::Sin, input, sin, 0.5, \
mpfr::RoundingMode::Downward); \
EXPECT_MPFR_MATCH(mpfr::Operation::Cos, input, cos, 0.5, \
@@ -89,7 +89,7 @@ TEST(LlvmLibcSinCosfTest, SpecialNumbers) {
\
mpfr::ForceRoundingMode __r4(mpfr::RoundingMode::TowardZero); \
if (__r4.success) { \
- __llvm_libc::sincosf(input, &sin, &cos); \
+ LIBC_NAMESPACE::sincosf(input, &sin, &cos); \
EXPECT_MPFR_MATCH(mpfr::Operation::Sin, input, sin, 0.5, \
mpfr::RoundingMode::TowardZero); \
EXPECT_MPFR_MATCH(mpfr::Operation::Cos, input, cos, 0.5, \
diff --git a/libc/test/src/math/sinf_test.cpp b/libc/test/src/math/sinf_test.cpp
index 3c94ae86a21c4e1..24251104421269c 100644
--- a/libc/test/src/math/sinf_test.cpp
+++ b/libc/test/src/math/sinf_test.cpp
@@ -18,29 +18,29 @@
#include <errno.h>
#include <stdint.h>
-using __llvm_libc::testing::SDCOMP26094_VALUES;
-using FPBits = __llvm_libc::fputil::FPBits<float>;
+using LIBC_NAMESPACE::testing::SDCOMP26094_VALUES;
+using FPBits = LIBC_NAMESPACE::fputil::FPBits<float>;
-namespace mpfr = __llvm_libc::testing::mpfr;
+namespace mpfr = LIBC_NAMESPACE::testing::mpfr;
DECLARE_SPECIAL_CONSTANTS(float)
TEST(LlvmLibcSinfTest, SpecialNumbers) {
libc_errno = 0;
- EXPECT_FP_EQ(aNaN, __llvm_libc::sinf(aNaN));
+ EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::sinf(aNaN));
EXPECT_MATH_ERRNO(0);
- EXPECT_FP_EQ(0.0f, __llvm_libc::sinf(0.0f));
+ EXPECT_FP_EQ(0.0f, LIBC_NAMESPACE::sinf(0.0f));
EXPECT_MATH_ERRNO(0);
- EXPECT_FP_EQ(-0.0f, __llvm_libc::sinf(-0.0f));
+ EXPECT_FP_EQ(-0.0f, LIBC_NAMESPACE::sinf(-0.0f));
EXPECT_MATH_ERRNO(0);
- EXPECT_FP_EQ(aNaN, __llvm_libc::sinf(inf));
+ EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::sinf(inf));
EXPECT_MATH_ERRNO(EDOM);
- EXPECT_FP_EQ(aNaN, __llvm_libc::sinf(neg_inf));
+ EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::sinf(neg_inf));
EXPECT_MATH_ERRNO(EDOM);
}
@@ -52,7 +52,7 @@ TEST(LlvmLibcSinfTest, InFloatRange) {
if (isnan(x) || isinf(x))
continue;
ASSERT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Sin, x,
- __llvm_libc::sinf(x), 0.5);
+ LIBC_NAMESPACE::sinf(x), 0.5);
}
}
@@ -100,21 +100,21 @@ TEST(LlvmLibcSinfTest, SpecificBitPatterns) {
for (int i = 0; i < N; ++i) {
float x = float(FPBits(INPUTS[i]));
EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Sin, x,
- __llvm_libc::sinf(x), 0.5);
+ LIBC_NAMESPACE::sinf(x), 0.5);
EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Sin, -x,
- __llvm_libc::sinf(-x), 0.5);
+ LIBC_NAMESPACE::sinf(-x), 0.5);
}
}
// For small values, sin(x) is x.
TEST(LlvmLibcSinfTest, SmallValues) {
float x = float(FPBits(0x1780'0000U));
- EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Sin, x, __llvm_libc::sinf(x),
- 0.5);
+ EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Sin, x,
+ LIBC_NAMESPACE::sinf(x), 0.5);
x = float(FPBits(0x0040'0000U));
- EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Sin, x, __llvm_libc::sinf(x),
- 0.5);
+ EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Sin, x,
+ LIBC_NAMESPACE::sinf(x), 0.5);
}
// SDCOMP-26094: check sinf in the cases for which the range reducer
@@ -123,6 +123,6 @@ TEST(LlvmLibcSinfTest, SDCOMP_26094) {
for (uint32_t v : SDCOMP26094_VALUES) {
float x = float(FPBits((v)));
EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Sin, x,
- __llvm_libc::sinf(x), 0.5);
+ LIBC_NAMESPACE::sinf(x), 0.5);
}
}
diff --git a/libc/test/src/math/sinhf_test.cpp b/libc/test/src/math/sinhf_test.cpp
index f42b8318af8241c..92284ca7d0988df 100644
--- a/libc/test/src/math/sinhf_test.cpp
+++ b/libc/test/src/math/sinhf_test.cpp
@@ -18,28 +18,28 @@
#include <errno.h>
#include <stdint.h>
-using FPBits = __llvm_libc::fputil::FPBits<float>;
+using FPBits = LIBC_NAMESPACE::fputil::FPBits<float>;
-namespace mpfr = __llvm_libc::testing::mpfr;
+namespace mpfr = LIBC_NAMESPACE::testing::mpfr;
DECLARE_SPECIAL_CONSTANTS(float)
TEST(LlvmLibcSinhfTest, SpecialNumbers) {
libc_errno = 0;
- EXPECT_FP_EQ(aNaN, __llvm_libc::sinhf(aNaN));
+ EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::sinhf(aNaN));
EXPECT_MATH_ERRNO(0);
- EXPECT_FP_EQ(0.0f, __llvm_libc::sinhf(0.0f));
+ EXPECT_FP_EQ(0.0f, LIBC_NAMESPACE::sinhf(0.0f));
EXPECT_MATH_ERRNO(0);
- EXPECT_FP_EQ(-0.0f, __llvm_libc::sinhf(-0.0f));
+ EXPECT_FP_EQ(-0.0f, LIBC_NAMESPACE::sinhf(-0.0f));
EXPECT_MATH_ERRNO(0);
- EXPECT_FP_EQ(inf, __llvm_libc::sinhf(inf));
+ EXPECT_FP_EQ(inf, LIBC_NAMESPACE::sinhf(inf));
EXPECT_MATH_ERRNO(0);
- EXPECT_FP_EQ(neg_inf, __llvm_libc::sinhf(neg_inf));
+ EXPECT_FP_EQ(neg_inf, LIBC_NAMESPACE::sinhf(neg_inf));
EXPECT_MATH_ERRNO(0);
}
@@ -50,19 +50,19 @@ TEST(LlvmLibcSinhfTest, InFloatRange) {
float x = float(FPBits(v));
if (isnan(x) || isinf(x))
continue;
- ASSERT_MPFR_MATCH(mpfr::Operation::Sinh, x, __llvm_libc::sinhf(x), 0.5);
+ ASSERT_MPFR_MATCH(mpfr::Operation::Sinh, x, LIBC_NAMESPACE::sinhf(x), 0.5);
}
}
// For small values, sinh(x) is x.
TEST(LlvmLibcSinhfTest, SmallValues) {
float x = float(FPBits(uint32_t(0x17800000)));
- float result = __llvm_libc::sinhf(x);
+ float result = LIBC_NAMESPACE::sinhf(x);
EXPECT_MPFR_MATCH(mpfr::Operation::Sinh, x, result, 0.5);
EXPECT_FP_EQ(x, result);
x = float(FPBits(uint32_t(0x00400000)));
- result = __llvm_libc::sinhf(x);
+ result = LIBC_NAMESPACE::sinhf(x);
EXPECT_MPFR_MATCH(mpfr::Operation::Sinh, x, result, 0.5);
EXPECT_FP_EQ(x, result);
}
@@ -70,24 +70,24 @@ TEST(LlvmLibcSinhfTest, SmallValues) {
TEST(LlvmLibcSinhfTest, Overflow) {
libc_errno = 0;
EXPECT_FP_EQ_WITH_EXCEPTION(
- inf, __llvm_libc::sinhf(float(FPBits(0x7f7fffffU))), FE_OVERFLOW);
+ inf, LIBC_NAMESPACE::sinhf(float(FPBits(0x7f7fffffU))), FE_OVERFLOW);
EXPECT_MATH_ERRNO(ERANGE);
EXPECT_FP_EQ_WITH_EXCEPTION(
- inf, __llvm_libc::sinhf(float(FPBits(0x42cffff8U))), FE_OVERFLOW);
+ inf, LIBC_NAMESPACE::sinhf(float(FPBits(0x42cffff8U))), FE_OVERFLOW);
EXPECT_MATH_ERRNO(ERANGE);
EXPECT_FP_EQ_WITH_EXCEPTION(
- inf, __llvm_libc::sinhf(float(FPBits(0x42d00008U))), FE_OVERFLOW);
+ inf, LIBC_NAMESPACE::sinhf(float(FPBits(0x42d00008U))), FE_OVERFLOW);
EXPECT_MATH_ERRNO(ERANGE);
}
TEST(LlvmLibcSinhfTest, ExceptionalValues) {
float x = float(FPBits(uint32_t(0x3a12'85ffU)));
EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Sinh, x,
- __llvm_libc::sinhf(x), 0.5);
+ LIBC_NAMESPACE::sinhf(x), 0.5);
x = -float(FPBits(uint32_t(0x3a12'85ffU)));
EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Sinh, x,
- __llvm_libc::sinhf(x), 0.5);
+ LIBC_NAMESPACE::sinhf(x), 0.5);
}
diff --git a/libc/test/src/math/smoke/CeilTest.h b/libc/test/src/math/smoke/CeilTest.h
index 053218386cbcf31..c10fd2816014358 100644
--- a/libc/test/src/math/smoke/CeilTest.h
+++ b/libc/test/src/math/smoke/CeilTest.h
@@ -11,7 +11,7 @@
#include <math.h>
-template <typename T> class CeilTest : public __llvm_libc::testing::Test {
+template <typename T> class CeilTest : public LIBC_NAMESPACE::testing::Test {
DECLARE_SPECIAL_CONSTANTS(T)
diff --git a/libc/test/src/math/smoke/CopySignTest.h b/libc/test/src/math/smoke/CopySignTest.h
index 2d50dd4877b10a7..c33f78038a3cff9 100644
--- a/libc/test/src/math/smoke/CopySignTest.h
+++ b/libc/test/src/math/smoke/CopySignTest.h
@@ -11,7 +11,8 @@
#include <math.h>
-template <typename T> class CopySignTest : public __llvm_libc::testing::Test {
+template <typename T>
+class CopySignTest : public LIBC_NAMESPACE::testing::Test {
DECLARE_SPECIAL_CONSTANTS(T)
diff --git a/libc/test/src/math/smoke/FAbsTest.h b/libc/test/src/math/smoke/FAbsTest.h
index df79703d42b1eb8..7d905baefe85145 100644
--- a/libc/test/src/math/smoke/FAbsTest.h
+++ b/libc/test/src/math/smoke/FAbsTest.h
@@ -11,7 +11,7 @@
#include <math.h>
-template <typename T> class FAbsTest : public __llvm_libc::testing::Test {
+template <typename T> class FAbsTest : public LIBC_NAMESPACE::testing::Test {
DECLARE_SPECIAL_CONSTANTS(T)
diff --git a/libc/test/src/math/smoke/FDimTest.h b/libc/test/src/math/smoke/FDimTest.h
index c0dbda10b318b97..3118c3661013e7c 100644
--- a/libc/test/src/math/smoke/FDimTest.h
+++ b/libc/test/src/math/smoke/FDimTest.h
@@ -13,10 +13,10 @@
#include <math.h>
template <typename T>
-class FDimTestTemplate : public __llvm_libc::testing::Test {
+class FDimTestTemplate : public LIBC_NAMESPACE::testing::Test {
public:
using FuncPtr = T (*)(T, T);
- using FPBits = __llvm_libc::fputil::FPBits<T>;
+ using FPBits = LIBC_NAMESPACE::fputil::FPBits<T>;
using UIntType = typename FPBits::UIntType;
void test_na_n_arg(FuncPtr func) {
@@ -74,9 +74,9 @@ class FDimTestTemplate : public __llvm_libc::testing::Test {
private:
// constexpr does not work on FPBits yet, so we cannot have these constants as
// static.
- const T nan = T(__llvm_libc::fputil::FPBits<T>::build_quiet_nan(1));
- const T inf = T(__llvm_libc::fputil::FPBits<T>::inf());
- const T neg_inf = T(__llvm_libc::fputil::FPBits<T>::neg_inf());
- const T zero = T(__llvm_libc::fputil::FPBits<T>::zero());
- const T neg_zero = T(__llvm_libc::fputil::FPBits<T>::neg_zero());
+ const T nan = T(LIBC_NAMESPACE::fputil::FPBits<T>::build_quiet_nan(1));
+ const T inf = T(LIBC_NAMESPACE::fputil::FPBits<T>::inf());
+ const T neg_inf = T(LIBC_NAMESPACE::fputil::FPBits<T>::neg_inf());
+ const T zero = T(LIBC_NAMESPACE::fputil::FPBits<T>::zero());
+ const T neg_zero = T(LIBC_NAMESPACE::fputil::FPBits<T>::neg_zero());
};
diff --git a/libc/test/src/math/smoke/FMaxTest.h b/libc/test/src/math/smoke/FMaxTest.h
index 5c353a6b7e0efc2..e1192a4e0a7d1ae 100644
--- a/libc/test/src/math/smoke/FMaxTest.h
+++ b/libc/test/src/math/smoke/FMaxTest.h
@@ -11,7 +11,7 @@
#include <math.h>
-template <typename T> class FMaxTest : public __llvm_libc::testing::Test {
+template <typename T> class FMaxTest : public LIBC_NAMESPACE::testing::Test {
DECLARE_SPECIAL_CONSTANTS(T)
diff --git a/libc/test/src/math/smoke/FMinTest.h b/libc/test/src/math/smoke/FMinTest.h
index 071ab75928c4bcb..f0764ec3855b23c 100644
--- a/libc/test/src/math/smoke/FMinTest.h
+++ b/libc/test/src/math/smoke/FMinTest.h
@@ -11,7 +11,7 @@
#include <math.h>
-template <typename T> class FMinTest : public __llvm_libc::testing::Test {
+template <typename T> class FMinTest : public LIBC_NAMESPACE::testing::Test {
DECLARE_SPECIAL_CONSTANTS(T)
diff --git a/libc/test/src/math/smoke/FModTest.h b/libc/test/src/math/smoke/FModTest.h
index 6bff888294d2b0f..5fc0ebf6d33e407 100644
--- a/libc/test/src/math/smoke/FModTest.h
+++ b/libc/test/src/math/smoke/FModTest.h
@@ -21,11 +21,11 @@
EXPECT_FP_EQ(expected, f(x, y)); \
EXPECT_MATH_ERRNO((dom_err) ? EDOM : 0); \
EXPECT_FP_EXCEPTION(expected_exception); \
- __llvm_libc::fputil::clear_except(FE_ALL_EXCEPT)
+ LIBC_NAMESPACE::fputil::clear_except(FE_ALL_EXCEPT)
#define TEST_REGULAR(x, y, expected) TEST_SPECIAL(x, y, expected, false, 0)
-template <typename T> class FmodTest : public __llvm_libc::testing::Test {
+template <typename T> class FmodTest : public LIBC_NAMESPACE::testing::Test {
DECLARE_SPECIAL_CONSTANTS(T)
diff --git a/libc/test/src/math/smoke/FloorTest.h b/libc/test/src/math/smoke/FloorTest.h
index b1125b0517e5e3c..1c1b62c2dcda2a1 100644
--- a/libc/test/src/math/smoke/FloorTest.h
+++ b/libc/test/src/math/smoke/FloorTest.h
@@ -11,7 +11,7 @@
#include <math.h>
-template <typename T> class FloorTest : public __llvm_libc::testing::Test {
+template <typename T> class FloorTest : public LIBC_NAMESPACE::testing::Test {
DECLARE_SPECIAL_CONSTANTS(T)
diff --git a/libc/test/src/math/smoke/FmaTest.h b/libc/test/src/math/smoke/FmaTest.h
index d276dba4291a67d..3c1c120d77d4508 100644
--- a/libc/test/src/math/smoke/FmaTest.h
+++ b/libc/test/src/math/smoke/FmaTest.h
@@ -14,16 +14,16 @@
#include "test/UnitTest/Test.h"
template <typename T>
-class FmaTestTemplate : public __llvm_libc::testing::Test {
+class FmaTestTemplate : public LIBC_NAMESPACE::testing::Test {
private:
using Func = T (*)(T, T, T);
- using FPBits = __llvm_libc::fputil::FPBits<T>;
+ using FPBits = LIBC_NAMESPACE::fputil::FPBits<T>;
using UIntType = typename FPBits::UIntType;
- const T nan = T(__llvm_libc::fputil::FPBits<T>::build_quiet_nan(1));
- const T inf = T(__llvm_libc::fputil::FPBits<T>::inf());
- const T neg_inf = T(__llvm_libc::fputil::FPBits<T>::neg_inf());
- const T zero = T(__llvm_libc::fputil::FPBits<T>::zero());
- const T neg_zero = T(__llvm_libc::fputil::FPBits<T>::neg_zero());
+ const T nan = T(LIBC_NAMESPACE::fputil::FPBits<T>::build_quiet_nan(1));
+ const T inf = T(LIBC_NAMESPACE::fputil::FPBits<T>::inf());
+ const T neg_inf = T(LIBC_NAMESPACE::fputil::FPBits<T>::neg_inf());
+ const T zero = T(LIBC_NAMESPACE::fputil::FPBits<T>::zero());
+ const T neg_zero = T(LIBC_NAMESPACE::fputil::FPBits<T>::neg_zero());
public:
void test_special_numbers(Func func) {
diff --git a/libc/test/src/math/smoke/FrexpTest.h b/libc/test/src/math/smoke/FrexpTest.h
index 7a3a948912bb873..1740770fd6c4787 100644
--- a/libc/test/src/math/smoke/FrexpTest.h
+++ b/libc/test/src/math/smoke/FrexpTest.h
@@ -12,12 +12,12 @@
#include <math.h>
-template <typename T> class FrexpTest : public __llvm_libc::testing::Test {
+template <typename T> class FrexpTest : public LIBC_NAMESPACE::testing::Test {
DECLARE_SPECIAL_CONSTANTS(T)
static constexpr UIntType HIDDEN_BIT =
- UIntType(1) << __llvm_libc::fputil::MantissaWidth<T>::VALUE;
+ UIntType(1) << LIBC_NAMESPACE::fputil::MantissaWidth<T>::VALUE;
public:
typedef T (*FrexpFunc)(T, int *);
diff --git a/libc/test/src/math/smoke/HypotTest.h b/libc/test/src/math/smoke/HypotTest.h
index 084dbc4d83d750b..22c2fe4d1c3593b 100644
--- a/libc/test/src/math/smoke/HypotTest.h
+++ b/libc/test/src/math/smoke/HypotTest.h
@@ -16,10 +16,10 @@
#include <math.h>
template <typename T>
-class HypotTestTemplate : public __llvm_libc::testing::Test {
+class HypotTestTemplate : public LIBC_NAMESPACE::testing::Test {
private:
using Func = T (*)(T, T);
- using FPBits = __llvm_libc::fputil::FPBits<T>;
+ using FPBits = LIBC_NAMESPACE::fputil::FPBits<T>;
using UIntType = typename FPBits::UIntType;
const T nan = T(FPBits::build_quiet_nan(1));
const T inf = T(FPBits::inf());
diff --git a/libc/test/src/math/smoke/ILogbTest.h b/libc/test/src/math/smoke/ILogbTest.h
index 6ad5eb065c8aa44..e51a5d7a2544cdc 100644
--- a/libc/test/src/math/smoke/ILogbTest.h
+++ b/libc/test/src/math/smoke/ILogbTest.h
@@ -16,7 +16,7 @@
#include <limits.h>
-class LlvmLibcILogbTest : public __llvm_libc::testing::Test {
+class LlvmLibcILogbTest : public LIBC_NAMESPACE::testing::Test {
public:
template <typename T> struct ILogbFunc {
typedef int (*Func)(T);
@@ -24,14 +24,15 @@ class LlvmLibcILogbTest : public __llvm_libc::testing::Test {
template <typename T>
void test_special_numbers(typename ILogbFunc<T>::Func func) {
- EXPECT_EQ(FP_ILOGB0, func(T(__llvm_libc::fputil::FPBits<T>::zero())));
- EXPECT_EQ(FP_ILOGB0, func(T(__llvm_libc::fputil::FPBits<T>::neg_zero())));
+ EXPECT_EQ(FP_ILOGB0, func(T(LIBC_NAMESPACE::fputil::FPBits<T>::zero())));
+ EXPECT_EQ(FP_ILOGB0,
+ func(T(LIBC_NAMESPACE::fputil::FPBits<T>::neg_zero())));
EXPECT_EQ(FP_ILOGBNAN,
- func(T(__llvm_libc::fputil::FPBits<T>::build_quiet_nan(1))));
+ func(T(LIBC_NAMESPACE::fputil::FPBits<T>::build_quiet_nan(1))));
- EXPECT_EQ(INT_MAX, func(T(__llvm_libc::fputil::FPBits<T>::inf())));
- EXPECT_EQ(INT_MAX, func(T(__llvm_libc::fputil::FPBits<T>::neg_inf())));
+ EXPECT_EQ(INT_MAX, func(T(LIBC_NAMESPACE::fputil::FPBits<T>::inf())));
+ EXPECT_EQ(INT_MAX, func(T(LIBC_NAMESPACE::fputil::FPBits<T>::neg_inf())));
}
template <typename T>
@@ -75,7 +76,7 @@ class LlvmLibcILogbTest : public __llvm_libc::testing::Test {
template <typename T>
void test_subnormal_range(typename ILogbFunc<T>::Func func) {
- using FPBits = __llvm_libc::fputil::FPBits<T>;
+ using FPBits = LIBC_NAMESPACE::fputil::FPBits<T>;
using UIntType = typename FPBits::UIntType;
constexpr UIntType COUNT = 10'001;
constexpr UIntType STEP =
@@ -88,14 +89,14 @@ class LlvmLibcILogbTest : public __llvm_libc::testing::Test {
continue;
int exponent;
- __llvm_libc::fputil::frexp(x, exponent);
+ LIBC_NAMESPACE::fputil::frexp(x, exponent);
ASSERT_EQ(exponent, func(x) + 1);
}
}
template <typename T>
void test_normal_range(typename ILogbFunc<T>::Func func) {
- using FPBits = __llvm_libc::fputil::FPBits<T>;
+ using FPBits = LIBC_NAMESPACE::fputil::FPBits<T>;
using UIntType = typename FPBits::UIntType;
constexpr UIntType COUNT = 10'001;
constexpr UIntType STEP =
@@ -106,7 +107,7 @@ class LlvmLibcILogbTest : public __llvm_libc::testing::Test {
continue;
int exponent;
- __llvm_libc::fputil::frexp(x, exponent);
+ LIBC_NAMESPACE::fputil::frexp(x, exponent);
ASSERT_EQ(exponent, func(x) + 1);
}
}
diff --git a/libc/test/src/math/smoke/LdExpTest.h b/libc/test/src/math/smoke/LdExpTest.h
index 2e592995ae792e9..bffa7335fb25b17 100644
--- a/libc/test/src/math/smoke/LdExpTest.h
+++ b/libc/test/src/math/smoke/LdExpTest.h
@@ -19,20 +19,20 @@
#include <stdint.h>
template <typename T>
-class LdExpTestTemplate : public __llvm_libc::testing::Test {
- using FPBits = __llvm_libc::fputil::FPBits<T>;
- using NormalFloat = __llvm_libc::fputil::NormalFloat<T>;
+class LdExpTestTemplate : public LIBC_NAMESPACE::testing::Test {
+ using FPBits = LIBC_NAMESPACE::fputil::FPBits<T>;
+ using NormalFloat = LIBC_NAMESPACE::fputil::NormalFloat<T>;
using UIntType = typename FPBits::UIntType;
static constexpr UIntType MANTISSA_WIDTH =
- __llvm_libc::fputil::MantissaWidth<T>::VALUE;
+ LIBC_NAMESPACE::fputil::MantissaWidth<T>::VALUE;
// A normalized mantissa to be used with tests.
static constexpr UIntType MANTISSA = NormalFloat::ONE + 0x1234;
- const T zero = T(__llvm_libc::fputil::FPBits<T>::zero());
- const T neg_zero = T(__llvm_libc::fputil::FPBits<T>::neg_zero());
- const T inf = T(__llvm_libc::fputil::FPBits<T>::inf());
- const T neg_inf = T(__llvm_libc::fputil::FPBits<T>::neg_inf());
- const T nan = T(__llvm_libc::fputil::FPBits<T>::build_quiet_nan(1));
+ const T zero = T(LIBC_NAMESPACE::fputil::FPBits<T>::zero());
+ const T neg_zero = T(LIBC_NAMESPACE::fputil::FPBits<T>::neg_zero());
+ const T inf = T(LIBC_NAMESPACE::fputil::FPBits<T>::inf());
+ const T neg_inf = T(LIBC_NAMESPACE::fputil::FPBits<T>::neg_inf());
+ const T nan = T(LIBC_NAMESPACE::fputil::FPBits<T>::build_quiet_nan(1));
public:
typedef T (*LdExpFunc)(T, int);
diff --git a/libc/test/src/math/smoke/LogbTest.h b/libc/test/src/math/smoke/LogbTest.h
index 885bd7c8a6371c3..34cf92c19ed8b1b 100644
--- a/libc/test/src/math/smoke/LogbTest.h
+++ b/libc/test/src/math/smoke/LogbTest.h
@@ -12,12 +12,12 @@
#include <math.h>
-template <typename T> class LogbTest : public __llvm_libc::testing::Test {
+template <typename T> class LogbTest : public LIBC_NAMESPACE::testing::Test {
DECLARE_SPECIAL_CONSTANTS(T)
static constexpr UIntType HIDDEN_BIT =
- UIntType(1) << __llvm_libc::fputil::MantissaWidth<T>::VALUE;
+ UIntType(1) << LIBC_NAMESPACE::fputil::MantissaWidth<T>::VALUE;
public:
typedef T (*LogbFunc)(T);
@@ -77,7 +77,7 @@ template <typename T> class LogbTest : public __llvm_libc::testing::Test {
continue;
int exponent;
- __llvm_libc::fputil::frexp(x, exponent);
+ LIBC_NAMESPACE::fputil::frexp(x, exponent);
ASSERT_FP_EQ(T(exponent), func(x) + T(1.0));
}
}
diff --git a/libc/test/src/math/smoke/ModfTest.h b/libc/test/src/math/smoke/ModfTest.h
index 687d0dd74ab67bf..012a3247f92ead6 100644
--- a/libc/test/src/math/smoke/ModfTest.h
+++ b/libc/test/src/math/smoke/ModfTest.h
@@ -13,7 +13,7 @@
#include <math.h>
-template <typename T> class ModfTest : public __llvm_libc::testing::Test {
+template <typename T> class ModfTest : public LIBC_NAMESPACE::testing::Test {
DECLARE_SPECIAL_CONSTANTS(T)
@@ -90,8 +90,8 @@ template <typename T> class ModfTest : public __llvm_libc::testing::Test {
T integral;
T frac = func(x, &integral);
- ASSERT_TRUE(__llvm_libc::fputil::abs(frac) < 1.0l);
- ASSERT_TRUE(__llvm_libc::fputil::trunc(x) == integral);
+ ASSERT_TRUE(LIBC_NAMESPACE::fputil::abs(frac) < 1.0l);
+ ASSERT_TRUE(LIBC_NAMESPACE::fputil::trunc(x) == integral);
ASSERT_TRUE(integral + frac == x);
}
}
diff --git a/libc/test/src/math/smoke/NextAfterTest.h b/libc/test/src/math/smoke/NextAfterTest.h
index e6de9419d990401..4e450cf5bc1e9e7 100644
--- a/libc/test/src/math/smoke/NextAfterTest.h
+++ b/libc/test/src/math/smoke/NextAfterTest.h
@@ -18,13 +18,13 @@
#include <math.h>
template <typename T>
-class NextAfterTestTemplate : public __llvm_libc::testing::Test {
- using FPBits = __llvm_libc::fputil::FPBits<T>;
- using MantissaWidth = __llvm_libc::fputil::MantissaWidth<T>;
+class NextAfterTestTemplate : public LIBC_NAMESPACE::testing::Test {
+ using FPBits = LIBC_NAMESPACE::fputil::FPBits<T>;
+ using MantissaWidth = LIBC_NAMESPACE::fputil::MantissaWidth<T>;
using UIntType = typename FPBits::UIntType;
static constexpr int BIT_WIDTH_OF_TYPE =
- __llvm_libc::fputil::FloatProperties<T>::BIT_WIDTH;
+ LIBC_NAMESPACE::fputil::FloatProperties<T>::BIT_WIDTH;
const T zero = T(FPBits::zero());
const T neg_zero = T(FPBits::neg_zero());
@@ -52,54 +52,54 @@ class NextAfterTestTemplate : public __llvm_libc::testing::Test {
T x = zero;
T result = func(x, T(1));
UIntType expected_bits = 1;
- T expected = __llvm_libc::cpp::bit_cast<T>(expected_bits);
+ T expected = LIBC_NAMESPACE::cpp::bit_cast<T>(expected_bits);
ASSERT_FP_EQ(result, expected);
result = func(x, T(-1));
expected_bits = (UIntType(1) << (BIT_WIDTH_OF_TYPE - 1)) + 1;
- expected = __llvm_libc::cpp::bit_cast<T>(expected_bits);
+ expected = LIBC_NAMESPACE::cpp::bit_cast<T>(expected_bits);
ASSERT_FP_EQ(result, expected);
x = neg_zero;
result = func(x, 1);
expected_bits = 1;
- expected = __llvm_libc::cpp::bit_cast<T>(expected_bits);
+ expected = LIBC_NAMESPACE::cpp::bit_cast<T>(expected_bits);
ASSERT_FP_EQ(result, expected);
result = func(x, -1);
expected_bits = (UIntType(1) << (BIT_WIDTH_OF_TYPE - 1)) + 1;
- expected = __llvm_libc::cpp::bit_cast<T>(expected_bits);
+ expected = LIBC_NAMESPACE::cpp::bit_cast<T>(expected_bits);
ASSERT_FP_EQ(result, expected);
// 'from' is max subnormal value.
- x = __llvm_libc::cpp::bit_cast<T>(max_subnormal);
+ x = LIBC_NAMESPACE::cpp::bit_cast<T>(max_subnormal);
result = func(x, 1);
- expected = __llvm_libc::cpp::bit_cast<T>(min_normal);
+ expected = LIBC_NAMESPACE::cpp::bit_cast<T>(min_normal);
ASSERT_FP_EQ(result, expected);
result = func(x, 0);
expected_bits = max_subnormal - 1;
- expected = __llvm_libc::cpp::bit_cast<T>(expected_bits);
+ expected = LIBC_NAMESPACE::cpp::bit_cast<T>(expected_bits);
ASSERT_FP_EQ(result, expected);
x = -x;
result = func(x, -1);
expected_bits = (UIntType(1) << (BIT_WIDTH_OF_TYPE - 1)) + min_normal;
- expected = __llvm_libc::cpp::bit_cast<T>(expected_bits);
+ expected = LIBC_NAMESPACE::cpp::bit_cast<T>(expected_bits);
ASSERT_FP_EQ(result, expected);
result = func(x, 0);
expected_bits =
(UIntType(1) << (BIT_WIDTH_OF_TYPE - 1)) + max_subnormal - 1;
- expected = __llvm_libc::cpp::bit_cast<T>(expected_bits);
+ expected = LIBC_NAMESPACE::cpp::bit_cast<T>(expected_bits);
ASSERT_FP_EQ(result, expected);
// 'from' is min subnormal value.
- x = __llvm_libc::cpp::bit_cast<T>(min_subnormal);
+ x = LIBC_NAMESPACE::cpp::bit_cast<T>(min_subnormal);
result = func(x, 1);
expected_bits = min_subnormal + 1;
- expected = __llvm_libc::cpp::bit_cast<T>(expected_bits);
+ expected = LIBC_NAMESPACE::cpp::bit_cast<T>(expected_bits);
ASSERT_FP_EQ(result, expected);
ASSERT_FP_EQ(func(x, 0), 0);
@@ -107,35 +107,35 @@ class NextAfterTestTemplate : public __llvm_libc::testing::Test {
result = func(x, -1);
expected_bits =
(UIntType(1) << (BIT_WIDTH_OF_TYPE - 1)) + min_subnormal + 1;
- expected = __llvm_libc::cpp::bit_cast<T>(expected_bits);
+ expected = LIBC_NAMESPACE::cpp::bit_cast<T>(expected_bits);
ASSERT_FP_EQ(result, expected);
ASSERT_FP_EQ(func(x, 0), T(-0.0));
// 'from' is min normal.
- x = __llvm_libc::cpp::bit_cast<T>(min_normal);
+ x = LIBC_NAMESPACE::cpp::bit_cast<T>(min_normal);
result = func(x, 0);
expected_bits = max_subnormal;
- expected = __llvm_libc::cpp::bit_cast<T>(expected_bits);
+ expected = LIBC_NAMESPACE::cpp::bit_cast<T>(expected_bits);
ASSERT_FP_EQ(result, expected);
result = func(x, inf);
expected_bits = min_normal + 1;
- expected = __llvm_libc::cpp::bit_cast<T>(expected_bits);
+ expected = LIBC_NAMESPACE::cpp::bit_cast<T>(expected_bits);
ASSERT_FP_EQ(result, expected);
x = -x;
result = func(x, 0);
expected_bits = (UIntType(1) << (BIT_WIDTH_OF_TYPE - 1)) + max_subnormal;
- expected = __llvm_libc::cpp::bit_cast<T>(expected_bits);
+ expected = LIBC_NAMESPACE::cpp::bit_cast<T>(expected_bits);
ASSERT_FP_EQ(result, expected);
result = func(x, -inf);
expected_bits = (UIntType(1) << (BIT_WIDTH_OF_TYPE - 1)) + min_normal + 1;
- expected = __llvm_libc::cpp::bit_cast<T>(expected_bits);
+ expected = LIBC_NAMESPACE::cpp::bit_cast<T>(expected_bits);
ASSERT_FP_EQ(result, expected);
// 'from' is max normal and 'to' is infinity.
- x = __llvm_libc::cpp::bit_cast<T>(max_normal);
+ x = LIBC_NAMESPACE::cpp::bit_cast<T>(max_normal);
result = func(x, inf);
ASSERT_FP_EQ(result, inf);
@@ -146,14 +146,14 @@ class NextAfterTestTemplate : public __llvm_libc::testing::Test {
x = inf;
result = func(x, 0);
expected_bits = max_normal;
- expected = __llvm_libc::cpp::bit_cast<T>(expected_bits);
+ expected = LIBC_NAMESPACE::cpp::bit_cast<T>(expected_bits);
ASSERT_FP_EQ(result, expected);
ASSERT_FP_EQ(func(x, inf), inf);
x = neg_inf;
result = func(x, 0);
expected_bits = (UIntType(1) << (BIT_WIDTH_OF_TYPE - 1)) + max_normal;
- expected = __llvm_libc::cpp::bit_cast<T>(expected_bits);
+ expected = LIBC_NAMESPACE::cpp::bit_cast<T>(expected_bits);
ASSERT_FP_EQ(result, expected);
ASSERT_FP_EQ(func(x, neg_inf), neg_inf);
diff --git a/libc/test/src/math/smoke/RIntTest.h b/libc/test/src/math/smoke/RIntTest.h
index 7a6d5c7ed78c96f..839240fa9c98202 100644
--- a/libc/test/src/math/smoke/RIntTest.h
+++ b/libc/test/src/math/smoke/RIntTest.h
@@ -22,12 +22,12 @@ static constexpr int ROUNDING_MODES[4] = {FE_UPWARD, FE_DOWNWARD, FE_TOWARDZERO,
FE_TONEAREST};
template <typename T>
-class RIntTestTemplate : public __llvm_libc::testing::Test {
+class RIntTestTemplate : public LIBC_NAMESPACE::testing::Test {
public:
typedef T (*RIntFunc)(T);
private:
- using FPBits = __llvm_libc::fputil::FPBits<T>;
+ using FPBits = LIBC_NAMESPACE::fputil::FPBits<T>;
using UIntType = typename FPBits::UIntType;
const T zero = T(FPBits::zero());
@@ -39,7 +39,7 @@ class RIntTestTemplate : public __llvm_libc::testing::Test {
public:
void testSpecialNumbers(RIntFunc func) {
for (int mode : ROUNDING_MODES) {
- __llvm_libc::fputil::set_round(mode);
+ LIBC_NAMESPACE::fputil::set_round(mode);
ASSERT_FP_EQ(inf, func(inf));
ASSERT_FP_EQ(neg_inf, func(neg_inf));
ASSERT_FP_EQ(nan, func(nan));
diff --git a/libc/test/src/math/smoke/RemQuoTest.h b/libc/test/src/math/smoke/RemQuoTest.h
index 4d49fd7dedc402e..5a5d14377750235 100644
--- a/libc/test/src/math/smoke/RemQuoTest.h
+++ b/libc/test/src/math/smoke/RemQuoTest.h
@@ -16,15 +16,15 @@
#include <math.h>
template <typename T>
-class RemQuoTestTemplate : public __llvm_libc::testing::Test {
- using FPBits = __llvm_libc::fputil::FPBits<T>;
+class RemQuoTestTemplate : public LIBC_NAMESPACE::testing::Test {
+ using FPBits = LIBC_NAMESPACE::fputil::FPBits<T>;
using UIntType = typename FPBits::UIntType;
- const T zero = T(__llvm_libc::fputil::FPBits<T>::zero());
- const T neg_zero = T(__llvm_libc::fputil::FPBits<T>::neg_zero());
- const T inf = T(__llvm_libc::fputil::FPBits<T>::inf());
- const T neg_inf = T(__llvm_libc::fputil::FPBits<T>::neg_inf());
- const T nan = T(__llvm_libc::fputil::FPBits<T>::build_quiet_nan(1));
+ const T zero = T(LIBC_NAMESPACE::fputil::FPBits<T>::zero());
+ const T neg_zero = T(LIBC_NAMESPACE::fputil::FPBits<T>::neg_zero());
+ const T inf = T(LIBC_NAMESPACE::fputil::FPBits<T>::inf());
+ const T neg_inf = T(LIBC_NAMESPACE::fputil::FPBits<T>::neg_inf());
+ const T nan = T(LIBC_NAMESPACE::fputil::FPBits<T>::build_quiet_nan(1));
public:
typedef T (*RemQuoFunc)(T, T, int *);
diff --git a/libc/test/src/math/smoke/RoundTest.h b/libc/test/src/math/smoke/RoundTest.h
index c67f1ce48220a9a..2e95f182ce948b7 100644
--- a/libc/test/src/math/smoke/RoundTest.h
+++ b/libc/test/src/math/smoke/RoundTest.h
@@ -11,7 +11,7 @@
#include <math.h>
-template <typename T> class RoundTest : public __llvm_libc::testing::Test {
+template <typename T> class RoundTest : public LIBC_NAMESPACE::testing::Test {
DECLARE_SPECIAL_CONSTANTS(T)
diff --git a/libc/test/src/math/smoke/RoundToIntegerTest.h b/libc/test/src/math/smoke/RoundToIntegerTest.h
index c37186bff57b3c8..31ce852fb75df2e 100644
--- a/libc/test/src/math/smoke/RoundToIntegerTest.h
+++ b/libc/test/src/math/smoke/RoundToIntegerTest.h
@@ -21,26 +21,26 @@ static constexpr int ROUNDING_MODES[4] = {FE_UPWARD, FE_DOWNWARD, FE_TOWARDZERO,
FE_TONEAREST};
template <typename F, typename I, bool TestModes = false>
-class RoundToIntegerTestTemplate : public __llvm_libc::testing::Test {
+class RoundToIntegerTestTemplate : public LIBC_NAMESPACE::testing::Test {
public:
typedef I (*RoundToIntegerFunc)(F);
private:
- using FPBits = __llvm_libc::fputil::FPBits<F>;
+ using FPBits = LIBC_NAMESPACE::fputil::FPBits<F>;
using UIntType = typename FPBits::UIntType;
- const F zero = F(__llvm_libc::fputil::FPBits<F>::zero());
- const F neg_zero = F(__llvm_libc::fputil::FPBits<F>::neg_zero());
- const F inf = F(__llvm_libc::fputil::FPBits<F>::inf());
- const F neg_inf = F(__llvm_libc::fputil::FPBits<F>::neg_inf());
- const F nan = F(__llvm_libc::fputil::FPBits<F>::build_quiet_nan(1));
+ const F zero = F(LIBC_NAMESPACE::fputil::FPBits<F>::zero());
+ const F neg_zero = F(LIBC_NAMESPACE::fputil::FPBits<F>::neg_zero());
+ const F inf = F(LIBC_NAMESPACE::fputil::FPBits<F>::inf());
+ const F neg_inf = F(LIBC_NAMESPACE::fputil::FPBits<F>::neg_inf());
+ const F nan = F(LIBC_NAMESPACE::fputil::FPBits<F>::build_quiet_nan(1));
static constexpr I INTEGER_MIN = I(1) << (sizeof(I) * 8 - 1);
static constexpr I INTEGER_MAX = -(INTEGER_MIN + 1);
void test_one_input(RoundToIntegerFunc func, F input, I expected,
bool expectError) {
libc_errno = 0;
- __llvm_libc::fputil::clear_except(FE_ALL_EXCEPT);
+ LIBC_NAMESPACE::fputil::clear_except(FE_ALL_EXCEPT);
ASSERT_EQ(func(input), expected);
@@ -59,7 +59,7 @@ class RoundToIntegerTestTemplate : public __llvm_libc::testing::Test {
// We will disable all exceptions so that the test will not
// crash with SIGFPE. We can still use fetestexcept to check
// if the appropriate flag was raised.
- __llvm_libc::fputil::disable_except(FE_ALL_EXCEPT);
+ LIBC_NAMESPACE::fputil::disable_except(FE_ALL_EXCEPT);
}
}
@@ -78,7 +78,7 @@ class RoundToIntegerTestTemplate : public __llvm_libc::testing::Test {
void testInfinityAndNaN(RoundToIntegerFunc func) {
if (TestModes) {
for (int mode : ROUNDING_MODES) {
- __llvm_libc::fputil::set_round(mode);
+ LIBC_NAMESPACE::fputil::set_round(mode);
do_infinity_and_na_n_test(func);
}
} else {
@@ -100,7 +100,7 @@ class RoundToIntegerTestTemplate : public __llvm_libc::testing::Test {
void testRoundNumbers(RoundToIntegerFunc func) {
if (TestModes) {
for (int mode : ROUNDING_MODES) {
- __llvm_libc::fputil::set_round(mode);
+ LIBC_NAMESPACE::fputil::set_round(mode);
do_round_numbers_test(func);
}
} else {
@@ -121,22 +121,22 @@ class RoundToIntegerTestTemplate : public __llvm_libc::testing::Test {
// All subnormal numbers should round to zero.
if (TestModes) {
if (x > 0) {
- __llvm_libc::fputil::set_round(FE_UPWARD);
+ LIBC_NAMESPACE::fputil::set_round(FE_UPWARD);
test_one_input(func, x, I(1), false);
- __llvm_libc::fputil::set_round(FE_DOWNWARD);
+ LIBC_NAMESPACE::fputil::set_round(FE_DOWNWARD);
test_one_input(func, x, I(0), false);
- __llvm_libc::fputil::set_round(FE_TOWARDZERO);
+ LIBC_NAMESPACE::fputil::set_round(FE_TOWARDZERO);
test_one_input(func, x, I(0), false);
- __llvm_libc::fputil::set_round(FE_TONEAREST);
+ LIBC_NAMESPACE::fputil::set_round(FE_TONEAREST);
test_one_input(func, x, I(0), false);
} else {
- __llvm_libc::fputil::set_round(FE_UPWARD);
+ LIBC_NAMESPACE::fputil::set_round(FE_UPWARD);
test_one_input(func, x, I(0), false);
- __llvm_libc::fputil::set_round(FE_DOWNWARD);
+ LIBC_NAMESPACE::fputil::set_round(FE_DOWNWARD);
test_one_input(func, x, I(-1), false);
- __llvm_libc::fputil::set_round(FE_TOWARDZERO);
+ LIBC_NAMESPACE::fputil::set_round(FE_TOWARDZERO);
test_one_input(func, x, I(0), false);
- __llvm_libc::fputil::set_round(FE_TONEAREST);
+ LIBC_NAMESPACE::fputil::set_round(FE_TONEAREST);
test_one_input(func, x, I(0), false);
}
} else {
diff --git a/libc/test/src/math/smoke/SqrtTest.h b/libc/test/src/math/smoke/SqrtTest.h
index c3896e302373a26..d4b2f9dd2624f1d 100644
--- a/libc/test/src/math/smoke/SqrtTest.h
+++ b/libc/test/src/math/smoke/SqrtTest.h
@@ -12,12 +12,12 @@
#include <math.h>
-template <typename T> class SqrtTest : public __llvm_libc::testing::Test {
+template <typename T> class SqrtTest : public LIBC_NAMESPACE::testing::Test {
DECLARE_SPECIAL_CONSTANTS(T)
static constexpr UIntType HIDDEN_BIT =
- UIntType(1) << __llvm_libc::fputil::MantissaWidth<T>::VALUE;
+ UIntType(1) << LIBC_NAMESPACE::fputil::MantissaWidth<T>::VALUE;
public:
typedef T (*SqrtFunc)(T);
diff --git a/libc/test/src/math/smoke/TruncTest.h b/libc/test/src/math/smoke/TruncTest.h
index 32b5503589ca7a0..8334a7b7c0f90da 100644
--- a/libc/test/src/math/smoke/TruncTest.h
+++ b/libc/test/src/math/smoke/TruncTest.h
@@ -11,7 +11,7 @@
#include <math.h>
-template <typename T> class TruncTest : public __llvm_libc::testing::Test {
+template <typename T> class TruncTest : public LIBC_NAMESPACE::testing::Test {
DECLARE_SPECIAL_CONSTANTS(T)
diff --git a/libc/test/src/math/smoke/acosf_test.cpp b/libc/test/src/math/smoke/acosf_test.cpp
index 0fc20970232f7bc..b8ba3d5f85cee7f 100644
--- a/libc/test/src/math/smoke/acosf_test.cpp
+++ b/libc/test/src/math/smoke/acosf_test.cpp
@@ -16,28 +16,28 @@
#include <errno.h>
#include <stdint.h>
-using FPBits = __llvm_libc::fputil::FPBits<float>;
+using FPBits = LIBC_NAMESPACE::fputil::FPBits<float>;
DECLARE_SPECIAL_CONSTANTS(float)
TEST(LlvmLibcAcosfTest, SpecialNumbers) {
libc_errno = 0;
- EXPECT_FP_EQ_ALL_ROUNDING(aNaN, __llvm_libc::acosf(aNaN));
+ EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::acosf(aNaN));
EXPECT_MATH_ERRNO(0);
- EXPECT_FP_EQ_ALL_ROUNDING(aNaN, __llvm_libc::acosf(inf));
+ EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::acosf(inf));
EXPECT_MATH_ERRNO(EDOM);
- EXPECT_FP_EQ_ALL_ROUNDING(aNaN, __llvm_libc::acosf(neg_inf));
+ EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::acosf(neg_inf));
EXPECT_MATH_ERRNO(EDOM);
- EXPECT_FP_EQ_ALL_ROUNDING(zero, __llvm_libc::acosf(1.0f));
+ EXPECT_FP_EQ_ALL_ROUNDING(zero, LIBC_NAMESPACE::acosf(1.0f));
EXPECT_MATH_ERRNO(0);
- EXPECT_FP_EQ_ALL_ROUNDING(aNaN, __llvm_libc::acosf(2.0f));
+ EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::acosf(2.0f));
EXPECT_MATH_ERRNO(EDOM);
- EXPECT_FP_EQ_ALL_ROUNDING(aNaN, __llvm_libc::acosf(-2.0f));
+ EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::acosf(-2.0f));
EXPECT_MATH_ERRNO(EDOM);
}
diff --git a/libc/test/src/math/smoke/acoshf_test.cpp b/libc/test/src/math/smoke/acoshf_test.cpp
index ac3021ff3154e41..b8d7453bfdb212a 100644
--- a/libc/test/src/math/smoke/acoshf_test.cpp
+++ b/libc/test/src/math/smoke/acoshf_test.cpp
@@ -16,25 +16,25 @@
#include <errno.h>
#include <stdint.h>
-using FPBits_t = __llvm_libc::fputil::FPBits<float>;
+using FPBits_t = LIBC_NAMESPACE::fputil::FPBits<float>;
DECLARE_SPECIAL_CONSTANTS(float)
TEST(LlvmLibcAcoshfTest, SpecialNumbers) {
libc_errno = 0;
- EXPECT_FP_EQ_ALL_ROUNDING(aNaN, __llvm_libc::acoshf(aNaN));
+ EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::acoshf(aNaN));
EXPECT_MATH_ERRNO(0);
- EXPECT_FP_EQ_ALL_ROUNDING(aNaN, __llvm_libc::acoshf(0.0f));
+ EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::acoshf(0.0f));
EXPECT_MATH_ERRNO(EDOM);
- EXPECT_FP_EQ_ALL_ROUNDING(0.0f, __llvm_libc::acoshf(1.0f));
+ EXPECT_FP_EQ_ALL_ROUNDING(0.0f, LIBC_NAMESPACE::acoshf(1.0f));
EXPECT_MATH_ERRNO(0);
- EXPECT_FP_EQ_ALL_ROUNDING(inf, __llvm_libc::acoshf(inf));
+ EXPECT_FP_EQ_ALL_ROUNDING(inf, LIBC_NAMESPACE::acoshf(inf));
EXPECT_MATH_ERRNO(0);
- EXPECT_FP_EQ_ALL_ROUNDING(aNaN, __llvm_libc::acoshf(neg_inf));
+ EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::acoshf(neg_inf));
EXPECT_MATH_ERRNO(EDOM);
}
diff --git a/libc/test/src/math/smoke/asinf_test.cpp b/libc/test/src/math/smoke/asinf_test.cpp
index f6455475947a3e2..e2eca352e1d8824 100644
--- a/libc/test/src/math/smoke/asinf_test.cpp
+++ b/libc/test/src/math/smoke/asinf_test.cpp
@@ -16,31 +16,31 @@
#include <errno.h>
#include <stdint.h>
-using FPBits = __llvm_libc::fputil::FPBits<float>;
+using FPBits = LIBC_NAMESPACE::fputil::FPBits<float>;
DECLARE_SPECIAL_CONSTANTS(float)
TEST(LlvmLibcAsinfTest, SpecialNumbers) {
libc_errno = 0;
- EXPECT_FP_EQ_ALL_ROUNDING(aNaN, __llvm_libc::asinf(aNaN));
+ EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::asinf(aNaN));
EXPECT_MATH_ERRNO(0);
- EXPECT_FP_EQ_ALL_ROUNDING(0.0f, __llvm_libc::asinf(0.0f));
+ EXPECT_FP_EQ_ALL_ROUNDING(0.0f, LIBC_NAMESPACE::asinf(0.0f));
EXPECT_MATH_ERRNO(0);
- EXPECT_FP_EQ_ALL_ROUNDING(-0.0f, __llvm_libc::asinf(-0.0f));
+ EXPECT_FP_EQ_ALL_ROUNDING(-0.0f, LIBC_NAMESPACE::asinf(-0.0f));
EXPECT_MATH_ERRNO(0);
- EXPECT_FP_EQ_ALL_ROUNDING(aNaN, __llvm_libc::asinf(inf));
+ EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::asinf(inf));
EXPECT_MATH_ERRNO(EDOM);
- EXPECT_FP_EQ_ALL_ROUNDING(aNaN, __llvm_libc::asinf(neg_inf));
+ EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::asinf(neg_inf));
EXPECT_MATH_ERRNO(EDOM);
- EXPECT_FP_EQ_ALL_ROUNDING(aNaN, __llvm_libc::asinf(2.0f));
+ EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::asinf(2.0f));
EXPECT_MATH_ERRNO(EDOM);
- EXPECT_FP_EQ_ALL_ROUNDING(aNaN, __llvm_libc::asinf(-2.0f));
+ EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::asinf(-2.0f));
EXPECT_MATH_ERRNO(EDOM);
}
diff --git a/libc/test/src/math/smoke/asinhf_test.cpp b/libc/test/src/math/smoke/asinhf_test.cpp
index 6b5f9437b4149a7..f10cf934c533af6 100644
--- a/libc/test/src/math/smoke/asinhf_test.cpp
+++ b/libc/test/src/math/smoke/asinhf_test.cpp
@@ -16,25 +16,25 @@
#include <errno.h>
#include <stdint.h>
-using FPBits_t = __llvm_libc::fputil::FPBits<float>;
+using FPBits_t = LIBC_NAMESPACE::fputil::FPBits<float>;
DECLARE_SPECIAL_CONSTANTS(float)
TEST(LlvmLibcAsinhfTest, SpecialNumbers) {
libc_errno = 0;
- EXPECT_FP_EQ_ALL_ROUNDING(aNaN, __llvm_libc::asinhf(aNaN));
+ EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::asinhf(aNaN));
EXPECT_MATH_ERRNO(0);
- EXPECT_FP_EQ_ALL_ROUNDING(0.0f, __llvm_libc::asinhf(0.0f));
+ EXPECT_FP_EQ_ALL_ROUNDING(0.0f, LIBC_NAMESPACE::asinhf(0.0f));
EXPECT_MATH_ERRNO(0);
- EXPECT_FP_EQ_ALL_ROUNDING(-0.0f, __llvm_libc::asinhf(-0.0f));
+ EXPECT_FP_EQ_ALL_ROUNDING(-0.0f, LIBC_NAMESPACE::asinhf(-0.0f));
EXPECT_MATH_ERRNO(0);
- EXPECT_FP_EQ_ALL_ROUNDING(inf, __llvm_libc::asinhf(inf));
+ EXPECT_FP_EQ_ALL_ROUNDING(inf, LIBC_NAMESPACE::asinhf(inf));
EXPECT_MATH_ERRNO(0);
- EXPECT_FP_EQ_ALL_ROUNDING(neg_inf, __llvm_libc::asinhf(neg_inf));
+ EXPECT_FP_EQ_ALL_ROUNDING(neg_inf, LIBC_NAMESPACE::asinhf(neg_inf));
EXPECT_MATH_ERRNO(0);
}
diff --git a/libc/test/src/math/smoke/atanf_test.cpp b/libc/test/src/math/smoke/atanf_test.cpp
index 7d3f38682e8c01c..6e6f854002cc500 100644
--- a/libc/test/src/math/smoke/atanf_test.cpp
+++ b/libc/test/src/math/smoke/atanf_test.cpp
@@ -16,25 +16,25 @@
#include <errno.h>
#include <stdint.h>
-using FPBits = __llvm_libc::fputil::FPBits<float>;
+using FPBits = LIBC_NAMESPACE::fputil::FPBits<float>;
DECLARE_SPECIAL_CONSTANTS(float)
TEST(LlvmLibcAtanfTest, SpecialNumbers) {
libc_errno = 0;
- __llvm_libc::fputil::clear_except(FE_ALL_EXCEPT);
- EXPECT_FP_EQ_ALL_ROUNDING(aNaN, __llvm_libc::atanf(aNaN));
+ LIBC_NAMESPACE::fputil::clear_except(FE_ALL_EXCEPT);
+ EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::atanf(aNaN));
EXPECT_FP_EXCEPTION(0);
EXPECT_MATH_ERRNO(0);
- __llvm_libc::fputil::clear_except(FE_ALL_EXCEPT);
- EXPECT_FP_EQ_ALL_ROUNDING(0.0f, __llvm_libc::atanf(0.0f));
+ LIBC_NAMESPACE::fputil::clear_except(FE_ALL_EXCEPT);
+ EXPECT_FP_EQ_ALL_ROUNDING(0.0f, LIBC_NAMESPACE::atanf(0.0f));
EXPECT_FP_EXCEPTION(0);
EXPECT_MATH_ERRNO(0);
- __llvm_libc::fputil::clear_except(FE_ALL_EXCEPT);
- EXPECT_FP_EQ_ALL_ROUNDING(-0.0f, __llvm_libc::atanf(-0.0f));
+ LIBC_NAMESPACE::fputil::clear_except(FE_ALL_EXCEPT);
+ EXPECT_FP_EQ_ALL_ROUNDING(-0.0f, LIBC_NAMESPACE::atanf(-0.0f));
EXPECT_FP_EXCEPTION(0);
EXPECT_MATH_ERRNO(0);
}
diff --git a/libc/test/src/math/smoke/atanhf_test.cpp b/libc/test/src/math/smoke/atanhf_test.cpp
index ac2d47babe4eb0d..841cb884c37fe5e 100644
--- a/libc/test/src/math/smoke/atanhf_test.cpp
+++ b/libc/test/src/math/smoke/atanhf_test.cpp
@@ -16,57 +16,57 @@
#include <errno.h>
#include <stdint.h>
-using FPBits = __llvm_libc::fputil::FPBits<float>;
+using FPBits = LIBC_NAMESPACE::fputil::FPBits<float>;
DECLARE_SPECIAL_CONSTANTS(float)
TEST(LlvmLibcAtanhfTest, SpecialNumbers) {
libc_errno = 0;
- __llvm_libc::fputil::clear_except(FE_ALL_EXCEPT);
- EXPECT_FP_EQ_ALL_ROUNDING(aNaN, __llvm_libc::atanhf(aNaN));
+ LIBC_NAMESPACE::fputil::clear_except(FE_ALL_EXCEPT);
+ EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::atanhf(aNaN));
EXPECT_FP_EXCEPTION(0);
EXPECT_MATH_ERRNO(0);
- __llvm_libc::fputil::clear_except(FE_ALL_EXCEPT);
- EXPECT_FP_EQ_ALL_ROUNDING(0.0f, __llvm_libc::atanhf(0.0f));
+ LIBC_NAMESPACE::fputil::clear_except(FE_ALL_EXCEPT);
+ EXPECT_FP_EQ_ALL_ROUNDING(0.0f, LIBC_NAMESPACE::atanhf(0.0f));
EXPECT_FP_EXCEPTION(0);
EXPECT_MATH_ERRNO(0);
- __llvm_libc::fputil::clear_except(FE_ALL_EXCEPT);
- EXPECT_FP_EQ_ALL_ROUNDING(-0.0f, __llvm_libc::atanhf(-0.0f));
+ LIBC_NAMESPACE::fputil::clear_except(FE_ALL_EXCEPT);
+ EXPECT_FP_EQ_ALL_ROUNDING(-0.0f, LIBC_NAMESPACE::atanhf(-0.0f));
EXPECT_FP_EXCEPTION(0);
EXPECT_MATH_ERRNO(0);
- EXPECT_FP_EQ_WITH_EXCEPTION(inf, __llvm_libc::atanhf(1.0f), FE_DIVBYZERO);
+ EXPECT_FP_EQ_WITH_EXCEPTION(inf, LIBC_NAMESPACE::atanhf(1.0f), FE_DIVBYZERO);
EXPECT_MATH_ERRNO(ERANGE);
- EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, __llvm_libc::atanhf(-1.0f),
+ EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, LIBC_NAMESPACE::atanhf(-1.0f),
FE_DIVBYZERO);
EXPECT_MATH_ERRNO(ERANGE);
auto bt = FPBits(1.0f);
bt.bits += 1;
- EXPECT_FP_IS_NAN_WITH_EXCEPTION(__llvm_libc::atanhf(bt.get_val()),
+ EXPECT_FP_IS_NAN_WITH_EXCEPTION(LIBC_NAMESPACE::atanhf(bt.get_val()),
FE_INVALID);
EXPECT_MATH_ERRNO(EDOM);
bt.set_sign(true);
- EXPECT_FP_IS_NAN_WITH_EXCEPTION(__llvm_libc::atanhf(bt.get_val()),
+ EXPECT_FP_IS_NAN_WITH_EXCEPTION(LIBC_NAMESPACE::atanhf(bt.get_val()),
FE_INVALID);
EXPECT_MATH_ERRNO(EDOM);
- EXPECT_FP_IS_NAN_WITH_EXCEPTION(__llvm_libc::atanhf(2.0f), FE_INVALID);
+ EXPECT_FP_IS_NAN_WITH_EXCEPTION(LIBC_NAMESPACE::atanhf(2.0f), FE_INVALID);
EXPECT_MATH_ERRNO(EDOM);
- EXPECT_FP_IS_NAN_WITH_EXCEPTION(__llvm_libc::atanhf(-2.0f), FE_INVALID);
+ EXPECT_FP_IS_NAN_WITH_EXCEPTION(LIBC_NAMESPACE::atanhf(-2.0f), FE_INVALID);
EXPECT_MATH_ERRNO(EDOM);
- EXPECT_FP_IS_NAN_WITH_EXCEPTION(__llvm_libc::atanhf(inf), FE_INVALID);
+ EXPECT_FP_IS_NAN_WITH_EXCEPTION(LIBC_NAMESPACE::atanhf(inf), FE_INVALID);
EXPECT_MATH_ERRNO(EDOM);
bt.set_sign(true);
- EXPECT_FP_IS_NAN_WITH_EXCEPTION(__llvm_libc::atanhf(neg_inf), FE_INVALID);
+ EXPECT_FP_IS_NAN_WITH_EXCEPTION(LIBC_NAMESPACE::atanhf(neg_inf), FE_INVALID);
EXPECT_MATH_ERRNO(EDOM);
}
diff --git a/libc/test/src/math/smoke/ceil_test.cpp b/libc/test/src/math/smoke/ceil_test.cpp
index 2a592e3ee85b0cc..800452a43426c7c 100644
--- a/libc/test/src/math/smoke/ceil_test.cpp
+++ b/libc/test/src/math/smoke/ceil_test.cpp
@@ -10,4 +10,4 @@
#include "src/math/ceil.h"
-LIST_CEIL_TESTS(double, __llvm_libc::ceil)
+LIST_CEIL_TESTS(double, LIBC_NAMESPACE::ceil)
diff --git a/libc/test/src/math/smoke/ceilf_test.cpp b/libc/test/src/math/smoke/ceilf_test.cpp
index cfa8cb2c5aa6dd4..2a2504228adb0ad 100644
--- a/libc/test/src/math/smoke/ceilf_test.cpp
+++ b/libc/test/src/math/smoke/ceilf_test.cpp
@@ -10,4 +10,4 @@
#include "src/math/ceilf.h"
-LIST_CEIL_TESTS(float, __llvm_libc::ceilf)
+LIST_CEIL_TESTS(float, LIBC_NAMESPACE::ceilf)
diff --git a/libc/test/src/math/smoke/ceill_test.cpp b/libc/test/src/math/smoke/ceill_test.cpp
index 6fe30465edc8574..0f766602a0f6d41 100644
--- a/libc/test/src/math/smoke/ceill_test.cpp
+++ b/libc/test/src/math/smoke/ceill_test.cpp
@@ -10,4 +10,4 @@
#include "src/math/ceill.h"
-LIST_CEIL_TESTS(long double, __llvm_libc::ceill)
+LIST_CEIL_TESTS(long double, LIBC_NAMESPACE::ceill)
diff --git a/libc/test/src/math/smoke/copysign_test.cpp b/libc/test/src/math/smoke/copysign_test.cpp
index 37bfa0d90c37896..5b3d812c02da4d1 100644
--- a/libc/test/src/math/smoke/copysign_test.cpp
+++ b/libc/test/src/math/smoke/copysign_test.cpp
@@ -10,4 +10,4 @@
#include "src/math/copysign.h"
-LIST_COPYSIGN_TESTS(double, __llvm_libc::copysign)
+LIST_COPYSIGN_TESTS(double, LIBC_NAMESPACE::copysign)
diff --git a/libc/test/src/math/smoke/copysignf_test.cpp b/libc/test/src/math/smoke/copysignf_test.cpp
index fec283ccd0c7acd..344ffee2359ec8b 100644
--- a/libc/test/src/math/smoke/copysignf_test.cpp
+++ b/libc/test/src/math/smoke/copysignf_test.cpp
@@ -10,4 +10,4 @@
#include "src/math/copysignf.h"
-LIST_COPYSIGN_TESTS(float, __llvm_libc::copysignf)
+LIST_COPYSIGN_TESTS(float, LIBC_NAMESPACE::copysignf)
diff --git a/libc/test/src/math/smoke/copysignl_test.cpp b/libc/test/src/math/smoke/copysignl_test.cpp
index d1de911196b62b7..bed60678dc161da 100644
--- a/libc/test/src/math/smoke/copysignl_test.cpp
+++ b/libc/test/src/math/smoke/copysignl_test.cpp
@@ -10,4 +10,4 @@
#include "src/math/copysignl.h"
-LIST_COPYSIGN_TESTS(long double, __llvm_libc::copysignl)
+LIST_COPYSIGN_TESTS(long double, LIBC_NAMESPACE::copysignl)
diff --git a/libc/test/src/math/smoke/cosf_test.cpp b/libc/test/src/math/smoke/cosf_test.cpp
index 4ef96677eb4d1ca..6a2c6a5b2529955 100644
--- a/libc/test/src/math/smoke/cosf_test.cpp
+++ b/libc/test/src/math/smoke/cosf_test.cpp
@@ -16,25 +16,25 @@
#include <errno.h>
#include <stdint.h>
-using FPBits = __llvm_libc::fputil::FPBits<float>;
+using FPBits = LIBC_NAMESPACE::fputil::FPBits<float>;
DECLARE_SPECIAL_CONSTANTS(float)
TEST(LlvmLibcCosfTest, SpecialNumbers) {
libc_errno = 0;
- EXPECT_FP_EQ_ALL_ROUNDING(aNaN, __llvm_libc::cosf(aNaN));
+ EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::cosf(aNaN));
EXPECT_MATH_ERRNO(0);
- EXPECT_FP_EQ_ALL_ROUNDING(1.0f, __llvm_libc::cosf(0.0f));
+ EXPECT_FP_EQ_ALL_ROUNDING(1.0f, LIBC_NAMESPACE::cosf(0.0f));
EXPECT_MATH_ERRNO(0);
- EXPECT_FP_EQ_ALL_ROUNDING(1.0f, __llvm_libc::cosf(-0.0f));
+ EXPECT_FP_EQ_ALL_ROUNDING(1.0f, LIBC_NAMESPACE::cosf(-0.0f));
EXPECT_MATH_ERRNO(0);
- EXPECT_FP_EQ_ALL_ROUNDING(aNaN, __llvm_libc::cosf(inf));
+ EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::cosf(inf));
EXPECT_MATH_ERRNO(EDOM);
- EXPECT_FP_EQ_ALL_ROUNDING(aNaN, __llvm_libc::cosf(neg_inf));
+ EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::cosf(neg_inf));
EXPECT_MATH_ERRNO(EDOM);
}
diff --git a/libc/test/src/math/smoke/coshf_test.cpp b/libc/test/src/math/smoke/coshf_test.cpp
index 7198aa266aa8d3b..dd08f1924abc38c 100644
--- a/libc/test/src/math/smoke/coshf_test.cpp
+++ b/libc/test/src/math/smoke/coshf_test.cpp
@@ -17,40 +17,40 @@
#include <errno.h>
#include <stdint.h>
-using FPBits = __llvm_libc::fputil::FPBits<float>;
+using FPBits = LIBC_NAMESPACE::fputil::FPBits<float>;
DECLARE_SPECIAL_CONSTANTS(float)
TEST(LlvmLibcCoshfTest, SpecialNumbers) {
libc_errno = 0;
- EXPECT_FP_EQ_ALL_ROUNDING(aNaN, __llvm_libc::coshf(aNaN));
+ EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::coshf(aNaN));
EXPECT_MATH_ERRNO(0);
- EXPECT_FP_EQ_ALL_ROUNDING(inf, __llvm_libc::coshf(inf));
+ EXPECT_FP_EQ_ALL_ROUNDING(inf, LIBC_NAMESPACE::coshf(inf));
EXPECT_MATH_ERRNO(0);
- EXPECT_FP_EQ_ALL_ROUNDING(inf, __llvm_libc::coshf(neg_inf));
+ EXPECT_FP_EQ_ALL_ROUNDING(inf, LIBC_NAMESPACE::coshf(neg_inf));
EXPECT_MATH_ERRNO(0);
- EXPECT_FP_EQ_ALL_ROUNDING(1.0f, __llvm_libc::coshf(0.0f));
+ EXPECT_FP_EQ_ALL_ROUNDING(1.0f, LIBC_NAMESPACE::coshf(0.0f));
EXPECT_MATH_ERRNO(0);
- EXPECT_FP_EQ_ALL_ROUNDING(1.0f, __llvm_libc::coshf(-0.0f));
+ EXPECT_FP_EQ_ALL_ROUNDING(1.0f, LIBC_NAMESPACE::coshf(-0.0f));
EXPECT_MATH_ERRNO(0);
}
TEST(LlvmLibcCoshfTest, Overflow) {
libc_errno = 0;
EXPECT_FP_EQ_WITH_EXCEPTION(
- inf, __llvm_libc::coshf(float(FPBits(0x7f7fffffU))), FE_OVERFLOW);
+ inf, LIBC_NAMESPACE::coshf(float(FPBits(0x7f7fffffU))), FE_OVERFLOW);
EXPECT_MATH_ERRNO(ERANGE);
EXPECT_FP_EQ_WITH_EXCEPTION(
- inf, __llvm_libc::coshf(float(FPBits(0x42cffff8U))), FE_OVERFLOW);
+ inf, LIBC_NAMESPACE::coshf(float(FPBits(0x42cffff8U))), FE_OVERFLOW);
EXPECT_MATH_ERRNO(ERANGE);
EXPECT_FP_EQ_WITH_EXCEPTION(
- inf, __llvm_libc::coshf(float(FPBits(0x42d00008U))), FE_OVERFLOW);
+ inf, LIBC_NAMESPACE::coshf(float(FPBits(0x42d00008U))), FE_OVERFLOW);
EXPECT_MATH_ERRNO(ERANGE);
}
diff --git a/libc/test/src/math/smoke/erff_test.cpp b/libc/test/src/math/smoke/erff_test.cpp
index c2a247b6e6672ff..9c9105167b8c711 100644
--- a/libc/test/src/math/smoke/erff_test.cpp
+++ b/libc/test/src/math/smoke/erff_test.cpp
@@ -15,14 +15,14 @@
#include <errno.h>
#include <stdint.h>
-using __llvm_libc::testing::tlog;
+using LIBC_NAMESPACE::testing::tlog;
DECLARE_SPECIAL_CONSTANTS(float)
TEST(LlvmLibcErffTest, SpecialNumbers) {
- EXPECT_FP_EQ_ALL_ROUNDING(aNaN, __llvm_libc::erff(aNaN));
- EXPECT_FP_EQ_ALL_ROUNDING(1.0f, __llvm_libc::erff(inf));
- EXPECT_FP_EQ_ALL_ROUNDING(-1.0f, __llvm_libc::erff(neg_inf));
- EXPECT_FP_EQ_ALL_ROUNDING(zero, __llvm_libc::erff(zero));
- EXPECT_FP_EQ_ALL_ROUNDING(neg_zero, __llvm_libc::erff(neg_zero));
+ EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::erff(aNaN));
+ EXPECT_FP_EQ_ALL_ROUNDING(1.0f, LIBC_NAMESPACE::erff(inf));
+ EXPECT_FP_EQ_ALL_ROUNDING(-1.0f, LIBC_NAMESPACE::erff(neg_inf));
+ EXPECT_FP_EQ_ALL_ROUNDING(zero, LIBC_NAMESPACE::erff(zero));
+ EXPECT_FP_EQ_ALL_ROUNDING(neg_zero, LIBC_NAMESPACE::erff(neg_zero));
}
diff --git a/libc/test/src/math/smoke/exp10_test.cpp b/libc/test/src/math/smoke/exp10_test.cpp
index 21ba51d32345a78..cf699bab6ebeeef 100644
--- a/libc/test/src/math/smoke/exp10_test.cpp
+++ b/libc/test/src/math/smoke/exp10_test.cpp
@@ -16,21 +16,22 @@
#include <errno.h>
#include <stdint.h>
-using __llvm_libc::testing::tlog;
+using LIBC_NAMESPACE::testing::tlog;
DECLARE_SPECIAL_CONSTANTS(double)
TEST(LlvmLibcExp10Test, SpecialNumbers) {
- EXPECT_FP_EQ(aNaN, __llvm_libc::exp10(aNaN));
- EXPECT_FP_EQ(inf, __llvm_libc::exp10(inf));
- EXPECT_FP_EQ_ALL_ROUNDING(zero, __llvm_libc::exp10(neg_inf));
- EXPECT_FP_EQ_WITH_EXCEPTION(zero, __llvm_libc::exp10(-0x1.0p20),
+ EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::exp10(aNaN));
+ EXPECT_FP_EQ(inf, LIBC_NAMESPACE::exp10(inf));
+ EXPECT_FP_EQ_ALL_ROUNDING(zero, LIBC_NAMESPACE::exp10(neg_inf));
+ EXPECT_FP_EQ_WITH_EXCEPTION(zero, LIBC_NAMESPACE::exp10(-0x1.0p20),
FE_UNDERFLOW);
- EXPECT_FP_EQ_WITH_EXCEPTION(inf, __llvm_libc::exp10(0x1.0p20), FE_OVERFLOW);
- EXPECT_FP_EQ_ALL_ROUNDING(1.0, __llvm_libc::exp10(0.0));
- EXPECT_FP_EQ_ALL_ROUNDING(1.0, __llvm_libc::exp10(-0.0));
+ EXPECT_FP_EQ_WITH_EXCEPTION(inf, LIBC_NAMESPACE::exp10(0x1.0p20),
+ FE_OVERFLOW);
+ EXPECT_FP_EQ_ALL_ROUNDING(1.0, LIBC_NAMESPACE::exp10(0.0));
+ EXPECT_FP_EQ_ALL_ROUNDING(1.0, LIBC_NAMESPACE::exp10(-0.0));
- EXPECT_FP_EQ_ALL_ROUNDING(10.0, __llvm_libc::exp10(1.0));
- EXPECT_FP_EQ_ALL_ROUNDING(100.0, __llvm_libc::exp10(2.0));
- EXPECT_FP_EQ_ALL_ROUNDING(1000.0, __llvm_libc::exp10(3.0));
+ EXPECT_FP_EQ_ALL_ROUNDING(10.0, LIBC_NAMESPACE::exp10(1.0));
+ EXPECT_FP_EQ_ALL_ROUNDING(100.0, LIBC_NAMESPACE::exp10(2.0));
+ EXPECT_FP_EQ_ALL_ROUNDING(1000.0, LIBC_NAMESPACE::exp10(3.0));
}
diff --git a/libc/test/src/math/smoke/exp10f_test.cpp b/libc/test/src/math/smoke/exp10f_test.cpp
index 4de0074ab826929..c4d3cb6002df97b 100644
--- a/libc/test/src/math/smoke/exp10f_test.cpp
+++ b/libc/test/src/math/smoke/exp10f_test.cpp
@@ -20,37 +20,37 @@ DECLARE_SPECIAL_CONSTANTS(float)
TEST(LlvmLibcExp10fTest, SpecialNumbers) {
libc_errno = 0;
- EXPECT_FP_EQ_ALL_ROUNDING(aNaN, __llvm_libc::exp10f(aNaN));
+ EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::exp10f(aNaN));
EXPECT_MATH_ERRNO(0);
- EXPECT_FP_EQ_ALL_ROUNDING(inf, __llvm_libc::exp10f(inf));
+ EXPECT_FP_EQ_ALL_ROUNDING(inf, LIBC_NAMESPACE::exp10f(inf));
EXPECT_MATH_ERRNO(0);
- EXPECT_FP_EQ_ALL_ROUNDING(0.0f, __llvm_libc::exp10f(neg_inf));
+ EXPECT_FP_EQ_ALL_ROUNDING(0.0f, LIBC_NAMESPACE::exp10f(neg_inf));
EXPECT_MATH_ERRNO(0);
- EXPECT_FP_EQ_ALL_ROUNDING(1.0f, __llvm_libc::exp10f(0.0f));
+ EXPECT_FP_EQ_ALL_ROUNDING(1.0f, LIBC_NAMESPACE::exp10f(0.0f));
EXPECT_MATH_ERRNO(0);
- EXPECT_FP_EQ_ALL_ROUNDING(1.0f, __llvm_libc::exp10f(-0.0f));
+ EXPECT_FP_EQ_ALL_ROUNDING(1.0f, LIBC_NAMESPACE::exp10f(-0.0f));
EXPECT_MATH_ERRNO(0);
- EXPECT_FP_EQ_ALL_ROUNDING(10.0f, __llvm_libc::exp10f(1.0f));
- EXPECT_FP_EQ_ALL_ROUNDING(100.0f, __llvm_libc::exp10f(2.0f));
- EXPECT_FP_EQ_ALL_ROUNDING(1000.0f, __llvm_libc::exp10f(3.0f));
+ EXPECT_FP_EQ_ALL_ROUNDING(10.0f, LIBC_NAMESPACE::exp10f(1.0f));
+ EXPECT_FP_EQ_ALL_ROUNDING(100.0f, LIBC_NAMESPACE::exp10f(2.0f));
+ EXPECT_FP_EQ_ALL_ROUNDING(1000.0f, LIBC_NAMESPACE::exp10f(3.0f));
}
TEST(LlvmLibcExp10fTest, Overflow) {
libc_errno = 0;
EXPECT_FP_EQ_WITH_EXCEPTION(
- inf, __llvm_libc::exp10f(float(FPBits(0x7f7fffffU))), FE_OVERFLOW);
+ inf, LIBC_NAMESPACE::exp10f(float(FPBits(0x7f7fffffU))), FE_OVERFLOW);
EXPECT_MATH_ERRNO(ERANGE);
EXPECT_FP_EQ_WITH_EXCEPTION(
- inf, __llvm_libc::exp10f(float(FPBits(0x43000000U))), FE_OVERFLOW);
+ inf, LIBC_NAMESPACE::exp10f(float(FPBits(0x43000000U))), FE_OVERFLOW);
EXPECT_MATH_ERRNO(ERANGE);
EXPECT_FP_EQ_WITH_EXCEPTION(
- inf, __llvm_libc::exp10f(float(FPBits(0x43000001U))), FE_OVERFLOW);
+ inf, LIBC_NAMESPACE::exp10f(float(FPBits(0x43000001U))), FE_OVERFLOW);
EXPECT_MATH_ERRNO(ERANGE);
}
diff --git a/libc/test/src/math/smoke/exp2_test.cpp b/libc/test/src/math/smoke/exp2_test.cpp
index 13b24b01261096a..ec076c15fed019a 100644
--- a/libc/test/src/math/smoke/exp2_test.cpp
+++ b/libc/test/src/math/smoke/exp2_test.cpp
@@ -16,20 +16,21 @@
#include <errno.h>
#include <stdint.h>
-using __llvm_libc::testing::tlog;
+using LIBC_NAMESPACE::testing::tlog;
DECLARE_SPECIAL_CONSTANTS(double)
TEST(LlvmLibcExp2Test, SpecialNumbers) {
- EXPECT_FP_EQ(aNaN, __llvm_libc::exp2(aNaN));
- EXPECT_FP_EQ(inf, __llvm_libc::exp2(inf));
- EXPECT_FP_EQ_ALL_ROUNDING(zero, __llvm_libc::exp2(neg_inf));
- EXPECT_FP_EQ_WITH_EXCEPTION(zero, __llvm_libc::exp2(-0x1.0p20), FE_UNDERFLOW);
- EXPECT_FP_EQ_WITH_EXCEPTION(inf, __llvm_libc::exp2(0x1.0p20), FE_OVERFLOW);
- EXPECT_FP_EQ_ALL_ROUNDING(1.0, __llvm_libc::exp2(0.0));
- EXPECT_FP_EQ_ALL_ROUNDING(1.0, __llvm_libc::exp2(-0.0));
- EXPECT_FP_EQ_ALL_ROUNDING(2.0, __llvm_libc::exp2(1.0));
- EXPECT_FP_EQ_ALL_ROUNDING(0.5, __llvm_libc::exp2(-1.0));
- EXPECT_FP_EQ_ALL_ROUNDING(4.0, __llvm_libc::exp2(2.0));
- EXPECT_FP_EQ_ALL_ROUNDING(0.25, __llvm_libc::exp2(-2.0));
+ EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::exp2(aNaN));
+ EXPECT_FP_EQ(inf, LIBC_NAMESPACE::exp2(inf));
+ EXPECT_FP_EQ_ALL_ROUNDING(zero, LIBC_NAMESPACE::exp2(neg_inf));
+ EXPECT_FP_EQ_WITH_EXCEPTION(zero, LIBC_NAMESPACE::exp2(-0x1.0p20),
+ FE_UNDERFLOW);
+ EXPECT_FP_EQ_WITH_EXCEPTION(inf, LIBC_NAMESPACE::exp2(0x1.0p20), FE_OVERFLOW);
+ EXPECT_FP_EQ_ALL_ROUNDING(1.0, LIBC_NAMESPACE::exp2(0.0));
+ EXPECT_FP_EQ_ALL_ROUNDING(1.0, LIBC_NAMESPACE::exp2(-0.0));
+ EXPECT_FP_EQ_ALL_ROUNDING(2.0, LIBC_NAMESPACE::exp2(1.0));
+ EXPECT_FP_EQ_ALL_ROUNDING(0.5, LIBC_NAMESPACE::exp2(-1.0));
+ EXPECT_FP_EQ_ALL_ROUNDING(4.0, LIBC_NAMESPACE::exp2(2.0));
+ EXPECT_FP_EQ_ALL_ROUNDING(0.25, LIBC_NAMESPACE::exp2(-2.0));
}
diff --git a/libc/test/src/math/smoke/exp2f_test.cpp b/libc/test/src/math/smoke/exp2f_test.cpp
index c22a5eb294100b4..f26f155cc870a5d 100644
--- a/libc/test/src/math/smoke/exp2f_test.cpp
+++ b/libc/test/src/math/smoke/exp2f_test.cpp
@@ -21,38 +21,38 @@ DECLARE_SPECIAL_CONSTANTS(float)
TEST(LlvmLibcExp2fTest, SpecialNumbers) {
libc_errno = 0;
- EXPECT_FP_EQ_ALL_ROUNDING(aNaN, __llvm_libc::exp2f(aNaN));
+ EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::exp2f(aNaN));
EXPECT_MATH_ERRNO(0);
- EXPECT_FP_EQ_ALL_ROUNDING(inf, __llvm_libc::exp2f(inf));
+ EXPECT_FP_EQ_ALL_ROUNDING(inf, LIBC_NAMESPACE::exp2f(inf));
EXPECT_MATH_ERRNO(0);
- EXPECT_FP_EQ_ALL_ROUNDING(0.0f, __llvm_libc::exp2f(neg_inf));
+ EXPECT_FP_EQ_ALL_ROUNDING(0.0f, LIBC_NAMESPACE::exp2f(neg_inf));
EXPECT_MATH_ERRNO(0);
- EXPECT_FP_EQ_ALL_ROUNDING(1.0f, __llvm_libc::exp2f(0.0f));
+ EXPECT_FP_EQ_ALL_ROUNDING(1.0f, LIBC_NAMESPACE::exp2f(0.0f));
EXPECT_MATH_ERRNO(0);
- EXPECT_FP_EQ_ALL_ROUNDING(1.0f, __llvm_libc::exp2f(-0.0f));
+ EXPECT_FP_EQ_ALL_ROUNDING(1.0f, LIBC_NAMESPACE::exp2f(-0.0f));
EXPECT_MATH_ERRNO(0);
- EXPECT_FP_EQ_ALL_ROUNDING(2.0f, __llvm_libc::exp2f(1.0f));
- EXPECT_FP_EQ_ALL_ROUNDING(0.5f, __llvm_libc::exp2f(-1.0f));
- EXPECT_FP_EQ_ALL_ROUNDING(4.0f, __llvm_libc::exp2f(2.0f));
- EXPECT_FP_EQ_ALL_ROUNDING(0.25f, __llvm_libc::exp2f(-2.0f));
+ EXPECT_FP_EQ_ALL_ROUNDING(2.0f, LIBC_NAMESPACE::exp2f(1.0f));
+ EXPECT_FP_EQ_ALL_ROUNDING(0.5f, LIBC_NAMESPACE::exp2f(-1.0f));
+ EXPECT_FP_EQ_ALL_ROUNDING(4.0f, LIBC_NAMESPACE::exp2f(2.0f));
+ EXPECT_FP_EQ_ALL_ROUNDING(0.25f, LIBC_NAMESPACE::exp2f(-2.0f));
}
TEST(LlvmLibcExp2fTest, Overflow) {
libc_errno = 0;
EXPECT_FP_EQ_WITH_EXCEPTION(
- inf, __llvm_libc::exp2f(float(FPBits(0x7f7fffffU))), FE_OVERFLOW);
+ inf, LIBC_NAMESPACE::exp2f(float(FPBits(0x7f7fffffU))), FE_OVERFLOW);
EXPECT_MATH_ERRNO(ERANGE);
EXPECT_FP_EQ_WITH_EXCEPTION(
- inf, __llvm_libc::exp2f(float(FPBits(0x43000000U))), FE_OVERFLOW);
+ inf, LIBC_NAMESPACE::exp2f(float(FPBits(0x43000000U))), FE_OVERFLOW);
EXPECT_MATH_ERRNO(ERANGE);
EXPECT_FP_EQ_WITH_EXCEPTION(
- inf, __llvm_libc::exp2f(float(FPBits(0x43000001U))), FE_OVERFLOW);
+ inf, LIBC_NAMESPACE::exp2f(float(FPBits(0x43000001U))), FE_OVERFLOW);
EXPECT_MATH_ERRNO(ERANGE);
}
diff --git a/libc/test/src/math/smoke/exp_test.cpp b/libc/test/src/math/smoke/exp_test.cpp
index 3406f0afd73ebe0..7973c37257c53d8 100644
--- a/libc/test/src/math/smoke/exp_test.cpp
+++ b/libc/test/src/math/smoke/exp_test.cpp
@@ -16,16 +16,17 @@
#include <errno.h>
#include <stdint.h>
-using __llvm_libc::testing::tlog;
+using LIBC_NAMESPACE::testing::tlog;
DECLARE_SPECIAL_CONSTANTS(double)
TEST(LlvmLibcExpTest, SpecialNumbers) {
- EXPECT_FP_EQ(aNaN, __llvm_libc::exp(aNaN));
- EXPECT_FP_EQ(inf, __llvm_libc::exp(inf));
- EXPECT_FP_EQ_ALL_ROUNDING(zero, __llvm_libc::exp(neg_inf));
- EXPECT_FP_EQ_WITH_EXCEPTION(zero, __llvm_libc::exp(-0x1.0p20), FE_UNDERFLOW);
- EXPECT_FP_EQ_WITH_EXCEPTION(inf, __llvm_libc::exp(0x1.0p20), FE_OVERFLOW);
- EXPECT_FP_EQ_ALL_ROUNDING(1.0, __llvm_libc::exp(0.0));
- EXPECT_FP_EQ_ALL_ROUNDING(1.0, __llvm_libc::exp(-0.0));
+ EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::exp(aNaN));
+ EXPECT_FP_EQ(inf, LIBC_NAMESPACE::exp(inf));
+ EXPECT_FP_EQ_ALL_ROUNDING(zero, LIBC_NAMESPACE::exp(neg_inf));
+ EXPECT_FP_EQ_WITH_EXCEPTION(zero, LIBC_NAMESPACE::exp(-0x1.0p20),
+ FE_UNDERFLOW);
+ EXPECT_FP_EQ_WITH_EXCEPTION(inf, LIBC_NAMESPACE::exp(0x1.0p20), FE_OVERFLOW);
+ EXPECT_FP_EQ_ALL_ROUNDING(1.0, LIBC_NAMESPACE::exp(0.0));
+ EXPECT_FP_EQ_ALL_ROUNDING(1.0, LIBC_NAMESPACE::exp(-0.0));
}
diff --git a/libc/test/src/math/smoke/expf_test.cpp b/libc/test/src/math/smoke/expf_test.cpp
index 174d58013cc0647..e5c5afbd182238d 100644
--- a/libc/test/src/math/smoke/expf_test.cpp
+++ b/libc/test/src/math/smoke/expf_test.cpp
@@ -20,33 +20,33 @@ DECLARE_SPECIAL_CONSTANTS(float)
TEST(LlvmLibcExpfTest, SpecialNumbers) {
libc_errno = 0;
- EXPECT_FP_EQ_ALL_ROUNDING(aNaN, __llvm_libc::expf(aNaN));
+ EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::expf(aNaN));
EXPECT_MATH_ERRNO(0);
- EXPECT_FP_EQ_ALL_ROUNDING(inf, __llvm_libc::expf(inf));
+ EXPECT_FP_EQ_ALL_ROUNDING(inf, LIBC_NAMESPACE::expf(inf));
EXPECT_MATH_ERRNO(0);
- EXPECT_FP_EQ_ALL_ROUNDING(0.0f, __llvm_libc::expf(neg_inf));
+ EXPECT_FP_EQ_ALL_ROUNDING(0.0f, LIBC_NAMESPACE::expf(neg_inf));
EXPECT_MATH_ERRNO(0);
- EXPECT_FP_EQ_ALL_ROUNDING(1.0f, __llvm_libc::expf(0.0f));
+ EXPECT_FP_EQ_ALL_ROUNDING(1.0f, LIBC_NAMESPACE::expf(0.0f));
EXPECT_MATH_ERRNO(0);
- EXPECT_FP_EQ_ALL_ROUNDING(1.0f, __llvm_libc::expf(-0.0f));
+ EXPECT_FP_EQ_ALL_ROUNDING(1.0f, LIBC_NAMESPACE::expf(-0.0f));
EXPECT_MATH_ERRNO(0);
}
TEST(LlvmLibcExpfTest, Overflow) {
libc_errno = 0;
EXPECT_FP_EQ_WITH_EXCEPTION(
- inf, __llvm_libc::expf(float(FPBits(0x7f7fffffU))), FE_OVERFLOW);
+ inf, LIBC_NAMESPACE::expf(float(FPBits(0x7f7fffffU))), FE_OVERFLOW);
EXPECT_MATH_ERRNO(ERANGE);
EXPECT_FP_EQ_WITH_EXCEPTION(
- inf, __llvm_libc::expf(float(FPBits(0x42cffff8U))), FE_OVERFLOW);
+ inf, LIBC_NAMESPACE::expf(float(FPBits(0x42cffff8U))), FE_OVERFLOW);
EXPECT_MATH_ERRNO(ERANGE);
EXPECT_FP_EQ_WITH_EXCEPTION(
- inf, __llvm_libc::expf(float(FPBits(0x42d00008U))), FE_OVERFLOW);
+ inf, LIBC_NAMESPACE::expf(float(FPBits(0x42d00008U))), FE_OVERFLOW);
EXPECT_MATH_ERRNO(ERANGE);
}
diff --git a/libc/test/src/math/smoke/expm1f_test.cpp b/libc/test/src/math/smoke/expm1f_test.cpp
index f34562434eb3480..03fe1413e95e12f 100644
--- a/libc/test/src/math/smoke/expm1f_test.cpp
+++ b/libc/test/src/math/smoke/expm1f_test.cpp
@@ -20,33 +20,33 @@ DECLARE_SPECIAL_CONSTANTS(float)
TEST(LlvmLibcExpm1fTest, SpecialNumbers) {
libc_errno = 0;
- EXPECT_FP_EQ_ALL_ROUNDING(aNaN, __llvm_libc::expm1f(aNaN));
+ EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::expm1f(aNaN));
EXPECT_MATH_ERRNO(0);
- EXPECT_FP_EQ_ALL_ROUNDING(inf, __llvm_libc::expm1f(inf));
+ EXPECT_FP_EQ_ALL_ROUNDING(inf, LIBC_NAMESPACE::expm1f(inf));
EXPECT_MATH_ERRNO(0);
- EXPECT_FP_EQ_ALL_ROUNDING(-1.0f, __llvm_libc::expm1f(neg_inf));
+ EXPECT_FP_EQ_ALL_ROUNDING(-1.0f, LIBC_NAMESPACE::expm1f(neg_inf));
EXPECT_MATH_ERRNO(0);
- EXPECT_FP_EQ_ALL_ROUNDING(0.0f, __llvm_libc::expm1f(0.0f));
+ EXPECT_FP_EQ_ALL_ROUNDING(0.0f, LIBC_NAMESPACE::expm1f(0.0f));
EXPECT_MATH_ERRNO(0);
- EXPECT_FP_EQ_ALL_ROUNDING(-0.0f, __llvm_libc::expm1f(-0.0f));
+ EXPECT_FP_EQ_ALL_ROUNDING(-0.0f, LIBC_NAMESPACE::expm1f(-0.0f));
EXPECT_MATH_ERRNO(0);
}
TEST(LlvmLibcExpm1fTest, Overflow) {
libc_errno = 0;
EXPECT_FP_EQ_WITH_EXCEPTION(
- inf, __llvm_libc::expm1f(float(FPBits(0x7f7fffffU))), FE_OVERFLOW);
+ inf, LIBC_NAMESPACE::expm1f(float(FPBits(0x7f7fffffU))), FE_OVERFLOW);
EXPECT_MATH_ERRNO(ERANGE);
EXPECT_FP_EQ_WITH_EXCEPTION(
- inf, __llvm_libc::expm1f(float(FPBits(0x42cffff8U))), FE_OVERFLOW);
+ inf, LIBC_NAMESPACE::expm1f(float(FPBits(0x42cffff8U))), FE_OVERFLOW);
EXPECT_MATH_ERRNO(ERANGE);
EXPECT_FP_EQ_WITH_EXCEPTION(
- inf, __llvm_libc::expm1f(float(FPBits(0x42d00008U))), FE_OVERFLOW);
+ inf, LIBC_NAMESPACE::expm1f(float(FPBits(0x42d00008U))), FE_OVERFLOW);
EXPECT_MATH_ERRNO(ERANGE);
}
diff --git a/libc/test/src/math/smoke/fabs_test.cpp b/libc/test/src/math/smoke/fabs_test.cpp
index 2bf0ddda44ade35..0447040ddae3061 100644
--- a/libc/test/src/math/smoke/fabs_test.cpp
+++ b/libc/test/src/math/smoke/fabs_test.cpp
@@ -10,4 +10,4 @@
#include "src/math/fabs.h"
-LIST_FABS_TESTS(double, __llvm_libc::fabs)
+LIST_FABS_TESTS(double, LIBC_NAMESPACE::fabs)
diff --git a/libc/test/src/math/smoke/fabsf_test.cpp b/libc/test/src/math/smoke/fabsf_test.cpp
index 6374a1018f1da42..9f1e2a66d47655c 100644
--- a/libc/test/src/math/smoke/fabsf_test.cpp
+++ b/libc/test/src/math/smoke/fabsf_test.cpp
@@ -10,4 +10,4 @@
#include "src/math/fabsf.h"
-LIST_FABS_TESTS(float, __llvm_libc::fabsf)
+LIST_FABS_TESTS(float, LIBC_NAMESPACE::fabsf)
diff --git a/libc/test/src/math/smoke/fabsl_test.cpp b/libc/test/src/math/smoke/fabsl_test.cpp
index ff1320225452a92..37d2b54a4c53e11 100644
--- a/libc/test/src/math/smoke/fabsl_test.cpp
+++ b/libc/test/src/math/smoke/fabsl_test.cpp
@@ -10,4 +10,4 @@
#include "src/math/fabsl.h"
-LIST_FABS_TESTS(long double, __llvm_libc::fabsl)
+LIST_FABS_TESTS(long double, LIBC_NAMESPACE::fabsl)
diff --git a/libc/test/src/math/smoke/fdim_test.cpp b/libc/test/src/math/smoke/fdim_test.cpp
index 80174b79b95b83c..2f00a30ad1ee6f7 100644
--- a/libc/test/src/math/smoke/fdim_test.cpp
+++ b/libc/test/src/math/smoke/fdim_test.cpp
@@ -16,16 +16,18 @@
using LlvmLibcFDimTest = FDimTestTemplate<double>;
-TEST_F(LlvmLibcFDimTest, NaNArg_fdim) { test_na_n_arg(&__llvm_libc::fdim); }
+TEST_F(LlvmLibcFDimTest, NaNArg_fdim) { test_na_n_arg(&LIBC_NAMESPACE::fdim); }
-TEST_F(LlvmLibcFDimTest, InfArg_fdim) { test_inf_arg(&__llvm_libc::fdim); }
+TEST_F(LlvmLibcFDimTest, InfArg_fdim) { test_inf_arg(&LIBC_NAMESPACE::fdim); }
TEST_F(LlvmLibcFDimTest, NegInfArg_fdim) {
- test_neg_inf_arg(&__llvm_libc::fdim);
+ test_neg_inf_arg(&LIBC_NAMESPACE::fdim);
}
-TEST_F(LlvmLibcFDimTest, BothZero_fdim) { test_both_zero(&__llvm_libc::fdim); }
+TEST_F(LlvmLibcFDimTest, BothZero_fdim) {
+ test_both_zero(&LIBC_NAMESPACE::fdim);
+}
TEST_F(LlvmLibcFDimTest, InDoubleRange_fdim) {
- test_in_range(&__llvm_libc::fdim);
+ test_in_range(&LIBC_NAMESPACE::fdim);
}
diff --git a/libc/test/src/math/smoke/fdimf_test.cpp b/libc/test/src/math/smoke/fdimf_test.cpp
index 531b89b81ffc9ed..27511baf25b6da8 100644
--- a/libc/test/src/math/smoke/fdimf_test.cpp
+++ b/libc/test/src/math/smoke/fdimf_test.cpp
@@ -16,18 +16,20 @@
using LlvmLibcFDimTest = FDimTestTemplate<float>;
-TEST_F(LlvmLibcFDimTest, NaNArg_fdimf) { test_na_n_arg(&__llvm_libc::fdimf); }
+TEST_F(LlvmLibcFDimTest, NaNArg_fdimf) {
+ test_na_n_arg(&LIBC_NAMESPACE::fdimf);
+}
-TEST_F(LlvmLibcFDimTest, InfArg_fdimf) { test_inf_arg(&__llvm_libc::fdimf); }
+TEST_F(LlvmLibcFDimTest, InfArg_fdimf) { test_inf_arg(&LIBC_NAMESPACE::fdimf); }
TEST_F(LlvmLibcFDimTest, NegInfArg_fdimf) {
- test_neg_inf_arg(&__llvm_libc::fdimf);
+ test_neg_inf_arg(&LIBC_NAMESPACE::fdimf);
}
TEST_F(LlvmLibcFDimTest, BothZero_fdimf) {
- test_both_zero(&__llvm_libc::fdimf);
+ test_both_zero(&LIBC_NAMESPACE::fdimf);
}
TEST_F(LlvmLibcFDimTest, InFloatRange_fdimf) {
- test_in_range(&__llvm_libc::fdimf);
+ test_in_range(&LIBC_NAMESPACE::fdimf);
}
diff --git a/libc/test/src/math/smoke/fdiml_test.cpp b/libc/test/src/math/smoke/fdiml_test.cpp
index bb6c54d567a0b28..45aedb0a1cdea61 100644
--- a/libc/test/src/math/smoke/fdiml_test.cpp
+++ b/libc/test/src/math/smoke/fdiml_test.cpp
@@ -16,18 +16,20 @@
using LlvmLibcFDimTest = FDimTestTemplate<long double>;
-TEST_F(LlvmLibcFDimTest, NaNArg_fdiml) { test_na_n_arg(&__llvm_libc::fdiml); }
+TEST_F(LlvmLibcFDimTest, NaNArg_fdiml) {
+ test_na_n_arg(&LIBC_NAMESPACE::fdiml);
+}
-TEST_F(LlvmLibcFDimTest, InfArg_fdiml) { test_inf_arg(&__llvm_libc::fdiml); }
+TEST_F(LlvmLibcFDimTest, InfArg_fdiml) { test_inf_arg(&LIBC_NAMESPACE::fdiml); }
TEST_F(LlvmLibcFDimTest, NegInfArg_fdiml) {
- test_neg_inf_arg(&__llvm_libc::fdiml);
+ test_neg_inf_arg(&LIBC_NAMESPACE::fdiml);
}
TEST_F(LlvmLibcFDimTest, BothZero_fdiml) {
- test_both_zero(&__llvm_libc::fdiml);
+ test_both_zero(&LIBC_NAMESPACE::fdiml);
}
TEST_F(LlvmLibcFDimTest, InLongDoubleRange_fdiml) {
- test_in_range(&__llvm_libc::fdiml);
+ test_in_range(&LIBC_NAMESPACE::fdiml);
}
diff --git a/libc/test/src/math/smoke/floor_test.cpp b/libc/test/src/math/smoke/floor_test.cpp
index e68ed3ecbb603e0..9231d07aeb7f8f4 100644
--- a/libc/test/src/math/smoke/floor_test.cpp
+++ b/libc/test/src/math/smoke/floor_test.cpp
@@ -10,4 +10,4 @@
#include "src/math/floor.h"
-LIST_FLOOR_TESTS(double, __llvm_libc::floor)
+LIST_FLOOR_TESTS(double, LIBC_NAMESPACE::floor)
diff --git a/libc/test/src/math/smoke/floorf_test.cpp b/libc/test/src/math/smoke/floorf_test.cpp
index f0538f7b97b22f4..cbb11f36f58da3c 100644
--- a/libc/test/src/math/smoke/floorf_test.cpp
+++ b/libc/test/src/math/smoke/floorf_test.cpp
@@ -10,4 +10,4 @@
#include "src/math/floorf.h"
-LIST_FLOOR_TESTS(float, __llvm_libc::floorf)
+LIST_FLOOR_TESTS(float, LIBC_NAMESPACE::floorf)
diff --git a/libc/test/src/math/smoke/floorl_test.cpp b/libc/test/src/math/smoke/floorl_test.cpp
index 1b244fd62a117be..26f6a7703ed0f6e 100644
--- a/libc/test/src/math/smoke/floorl_test.cpp
+++ b/libc/test/src/math/smoke/floorl_test.cpp
@@ -10,4 +10,4 @@
#include "src/math/floorl.h"
-LIST_FLOOR_TESTS(long double, __llvm_libc::floorl)
+LIST_FLOOR_TESTS(long double, LIBC_NAMESPACE::floorl)
diff --git a/libc/test/src/math/smoke/fma_test.cpp b/libc/test/src/math/smoke/fma_test.cpp
index f33860f65236bde..4460b80d9ad650f 100644
--- a/libc/test/src/math/smoke/fma_test.cpp
+++ b/libc/test/src/math/smoke/fma_test.cpp
@@ -13,5 +13,5 @@
using LlvmLibcFmaTest = FmaTestTemplate<double>;
TEST_F(LlvmLibcFmaTest, SpecialNumbers) {
- test_special_numbers(&__llvm_libc::fma);
+ test_special_numbers(&LIBC_NAMESPACE::fma);
}
diff --git a/libc/test/src/math/smoke/fmaf_test.cpp b/libc/test/src/math/smoke/fmaf_test.cpp
index 38c2ea35db056db..a645efb8776d0fe 100644
--- a/libc/test/src/math/smoke/fmaf_test.cpp
+++ b/libc/test/src/math/smoke/fmaf_test.cpp
@@ -13,5 +13,5 @@
using LlvmLibcFmafTest = FmaTestTemplate<float>;
TEST_F(LlvmLibcFmafTest, SpecialNumbers) {
- test_special_numbers(&__llvm_libc::fmaf);
+ test_special_numbers(&LIBC_NAMESPACE::fmaf);
}
diff --git a/libc/test/src/math/smoke/fmax_test.cpp b/libc/test/src/math/smoke/fmax_test.cpp
index 9c81c09414f0139..6800939625ebc06 100644
--- a/libc/test/src/math/smoke/fmax_test.cpp
+++ b/libc/test/src/math/smoke/fmax_test.cpp
@@ -10,4 +10,4 @@
#include "src/math/fmax.h"
-LIST_FMAX_TESTS(double, __llvm_libc::fmax)
+LIST_FMAX_TESTS(double, LIBC_NAMESPACE::fmax)
diff --git a/libc/test/src/math/smoke/fmaxf_test.cpp b/libc/test/src/math/smoke/fmaxf_test.cpp
index cf337d4f07e0307..25c6f7339e8c95e 100644
--- a/libc/test/src/math/smoke/fmaxf_test.cpp
+++ b/libc/test/src/math/smoke/fmaxf_test.cpp
@@ -10,4 +10,4 @@
#include "src/math/fmaxf.h"
-LIST_FMAX_TESTS(float, __llvm_libc::fmaxf)
+LIST_FMAX_TESTS(float, LIBC_NAMESPACE::fmaxf)
diff --git a/libc/test/src/math/smoke/fmaxl_test.cpp b/libc/test/src/math/smoke/fmaxl_test.cpp
index 636bc4208caef65..9ac986c00012a01 100644
--- a/libc/test/src/math/smoke/fmaxl_test.cpp
+++ b/libc/test/src/math/smoke/fmaxl_test.cpp
@@ -10,4 +10,4 @@
#include "src/math/fmaxl.h"
-LIST_FMAX_TESTS(long double, __llvm_libc::fmaxl)
+LIST_FMAX_TESTS(long double, LIBC_NAMESPACE::fmaxl)
diff --git a/libc/test/src/math/smoke/fmin_test.cpp b/libc/test/src/math/smoke/fmin_test.cpp
index 3515f97faca33cd..5d241519021d436 100644
--- a/libc/test/src/math/smoke/fmin_test.cpp
+++ b/libc/test/src/math/smoke/fmin_test.cpp
@@ -10,4 +10,4 @@
#include "src/math/fmin.h"
-LIST_FMIN_TESTS(double, __llvm_libc::fmin)
+LIST_FMIN_TESTS(double, LIBC_NAMESPACE::fmin)
diff --git a/libc/test/src/math/smoke/fminf_test.cpp b/libc/test/src/math/smoke/fminf_test.cpp
index 1a762478af613b1..1af5b79155b1dcd 100644
--- a/libc/test/src/math/smoke/fminf_test.cpp
+++ b/libc/test/src/math/smoke/fminf_test.cpp
@@ -10,4 +10,4 @@
#include "src/math/fminf.h"
-LIST_FMIN_TESTS(float, __llvm_libc::fminf)
+LIST_FMIN_TESTS(float, LIBC_NAMESPACE::fminf)
diff --git a/libc/test/src/math/smoke/fminl_test.cpp b/libc/test/src/math/smoke/fminl_test.cpp
index ce8b705b0385e2e..0791f8c4ad8595c 100644
--- a/libc/test/src/math/smoke/fminl_test.cpp
+++ b/libc/test/src/math/smoke/fminl_test.cpp
@@ -10,4 +10,4 @@
#include "src/math/fminl.h"
-LIST_FMIN_TESTS(long double, __llvm_libc::fminl)
+LIST_FMIN_TESTS(long double, LIBC_NAMESPACE::fminl)
diff --git a/libc/test/src/math/smoke/fmod_test.cpp b/libc/test/src/math/smoke/fmod_test.cpp
index 03790e4941e1918..ec39e0567a7ca03 100644
--- a/libc/test/src/math/smoke/fmod_test.cpp
+++ b/libc/test/src/math/smoke/fmod_test.cpp
@@ -10,4 +10,4 @@
#include "src/math/fmod.h"
-LIST_FMOD_TESTS(double, __llvm_libc::fmod)
+LIST_FMOD_TESTS(double, LIBC_NAMESPACE::fmod)
diff --git a/libc/test/src/math/smoke/fmodf_test.cpp b/libc/test/src/math/smoke/fmodf_test.cpp
index 2b13379eba25235..5c3c6286e88fef0 100644
--- a/libc/test/src/math/smoke/fmodf_test.cpp
+++ b/libc/test/src/math/smoke/fmodf_test.cpp
@@ -10,4 +10,4 @@
#include "src/math/fmodf.h"
-LIST_FMOD_TESTS(float, __llvm_libc::fmodf)
+LIST_FMOD_TESTS(float, LIBC_NAMESPACE::fmodf)
diff --git a/libc/test/src/math/smoke/frexp_test.cpp b/libc/test/src/math/smoke/frexp_test.cpp
index a44aefc7d8b4e33..4d078baffcb3937 100644
--- a/libc/test/src/math/smoke/frexp_test.cpp
+++ b/libc/test/src/math/smoke/frexp_test.cpp
@@ -10,4 +10,4 @@
#include "src/math/frexp.h"
-LIST_FREXP_TESTS(double, __llvm_libc::frexp)
+LIST_FREXP_TESTS(double, LIBC_NAMESPACE::frexp)
diff --git a/libc/test/src/math/smoke/frexpf_test.cpp b/libc/test/src/math/smoke/frexpf_test.cpp
index 5d78f94ec1e596a..577eb9609cfcc5b 100644
--- a/libc/test/src/math/smoke/frexpf_test.cpp
+++ b/libc/test/src/math/smoke/frexpf_test.cpp
@@ -10,4 +10,4 @@
#include "src/math/frexpf.h"
-LIST_FREXP_TESTS(float, __llvm_libc::frexpf)
+LIST_FREXP_TESTS(float, LIBC_NAMESPACE::frexpf)
diff --git a/libc/test/src/math/smoke/frexpl_test.cpp b/libc/test/src/math/smoke/frexpl_test.cpp
index 4904ccd14907bb8..e5184cd225bcfa9 100644
--- a/libc/test/src/math/smoke/frexpl_test.cpp
+++ b/libc/test/src/math/smoke/frexpl_test.cpp
@@ -10,4 +10,4 @@
#include "src/math/frexpl.h"
-LIST_FREXP_TESTS(long double, __llvm_libc::frexpl)
+LIST_FREXP_TESTS(long double, LIBC_NAMESPACE::frexpl)
diff --git a/libc/test/src/math/smoke/generic_sqrt_test.cpp b/libc/test/src/math/smoke/generic_sqrt_test.cpp
index cecfc0ee3de3aee..d0ab31ffd0fe63c 100644
--- a/libc/test/src/math/smoke/generic_sqrt_test.cpp
+++ b/libc/test/src/math/smoke/generic_sqrt_test.cpp
@@ -10,4 +10,4 @@
#include "src/__support/FPUtil/generic/sqrt.h"
-LIST_SQRT_TESTS(double, __llvm_libc::fputil::sqrt<double>)
+LIST_SQRT_TESTS(double, LIBC_NAMESPACE::fputil::sqrt<double>)
diff --git a/libc/test/src/math/smoke/generic_sqrtf_test.cpp b/libc/test/src/math/smoke/generic_sqrtf_test.cpp
index 64bf92133b98f3e..f22ac8829d5ac89 100644
--- a/libc/test/src/math/smoke/generic_sqrtf_test.cpp
+++ b/libc/test/src/math/smoke/generic_sqrtf_test.cpp
@@ -10,4 +10,4 @@
#include "src/__support/FPUtil/generic/sqrt.h"
-LIST_SQRT_TESTS(float, __llvm_libc::fputil::sqrt<float>)
+LIST_SQRT_TESTS(float, LIBC_NAMESPACE::fputil::sqrt<float>)
diff --git a/libc/test/src/math/smoke/generic_sqrtl_test.cpp b/libc/test/src/math/smoke/generic_sqrtl_test.cpp
index 6b68aaed9700487..ddc6a23695be430 100644
--- a/libc/test/src/math/smoke/generic_sqrtl_test.cpp
+++ b/libc/test/src/math/smoke/generic_sqrtl_test.cpp
@@ -10,4 +10,4 @@
#include "src/__support/FPUtil/generic/sqrt.h"
-LIST_SQRT_TESTS(long double, __llvm_libc::fputil::sqrt<long double>)
+LIST_SQRT_TESTS(long double, LIBC_NAMESPACE::fputil::sqrt<long double>)
diff --git a/libc/test/src/math/smoke/hypot_test.cpp b/libc/test/src/math/smoke/hypot_test.cpp
index f865b9f903e3563..dd127909fafc52f 100644
--- a/libc/test/src/math/smoke/hypot_test.cpp
+++ b/libc/test/src/math/smoke/hypot_test.cpp
@@ -13,5 +13,5 @@
using LlvmLibcHypotTest = HypotTestTemplate<double>;
TEST_F(LlvmLibcHypotTest, SpecialNumbers) {
- test_special_numbers(&__llvm_libc::hypot);
+ test_special_numbers(&LIBC_NAMESPACE::hypot);
}
diff --git a/libc/test/src/math/smoke/hypotf_test.cpp b/libc/test/src/math/smoke/hypotf_test.cpp
index 0c0ee3127cd4402..768e7f75e9d678e 100644
--- a/libc/test/src/math/smoke/hypotf_test.cpp
+++ b/libc/test/src/math/smoke/hypotf_test.cpp
@@ -13,5 +13,5 @@
using LlvmLibcHypotfTest = HypotTestTemplate<float>;
TEST_F(LlvmLibcHypotfTest, SpecialNumbers) {
- test_special_numbers(&__llvm_libc::hypotf);
+ test_special_numbers(&LIBC_NAMESPACE::hypotf);
}
diff --git a/libc/test/src/math/smoke/ilogb_test.cpp b/libc/test/src/math/smoke/ilogb_test.cpp
index a77adec4adba44d..7011c43386e66a5 100644
--- a/libc/test/src/math/smoke/ilogb_test.cpp
+++ b/libc/test/src/math/smoke/ilogb_test.cpp
@@ -16,21 +16,21 @@
#include <math.h>
TEST_F(LlvmLibcILogbTest, SpecialNumbers_ilogb) {
- test_special_numbers<double>(&__llvm_libc::ilogb);
+ test_special_numbers<double>(&LIBC_NAMESPACE::ilogb);
}
TEST_F(LlvmLibcILogbTest, PowersOfTwo_ilogb) {
- test_powers_of_two<double>(&__llvm_libc::ilogb);
+ test_powers_of_two<double>(&LIBC_NAMESPACE::ilogb);
}
TEST_F(LlvmLibcILogbTest, SomeIntegers_ilogb) {
- test_some_integers<double>(&__llvm_libc::ilogb);
+ test_some_integers<double>(&LIBC_NAMESPACE::ilogb);
}
TEST_F(LlvmLibcILogbTest, SubnormalRange_ilogb) {
- test_subnormal_range<double>(&__llvm_libc::ilogb);
+ test_subnormal_range<double>(&LIBC_NAMESPACE::ilogb);
}
TEST_F(LlvmLibcILogbTest, NormalRange_ilogb) {
- test_normal_range<double>(&__llvm_libc::ilogb);
+ test_normal_range<double>(&LIBC_NAMESPACE::ilogb);
}
diff --git a/libc/test/src/math/smoke/ilogbf_test.cpp b/libc/test/src/math/smoke/ilogbf_test.cpp
index 20904a13c98a812..dcff8eeb1518059 100644
--- a/libc/test/src/math/smoke/ilogbf_test.cpp
+++ b/libc/test/src/math/smoke/ilogbf_test.cpp
@@ -16,21 +16,21 @@
#include <math.h>
TEST_F(LlvmLibcILogbTest, SpecialNumbers_ilogbf) {
- test_special_numbers<float>(&__llvm_libc::ilogbf);
+ test_special_numbers<float>(&LIBC_NAMESPACE::ilogbf);
}
TEST_F(LlvmLibcILogbTest, PowersOfTwo_ilogbf) {
- test_powers_of_two<float>(&__llvm_libc::ilogbf);
+ test_powers_of_two<float>(&LIBC_NAMESPACE::ilogbf);
}
TEST_F(LlvmLibcILogbTest, SomeIntegers_ilogbf) {
- test_some_integers<float>(&__llvm_libc::ilogbf);
+ test_some_integers<float>(&LIBC_NAMESPACE::ilogbf);
}
TEST_F(LlvmLibcILogbTest, SubnormalRange_ilogbf) {
- test_subnormal_range<float>(&__llvm_libc::ilogbf);
+ test_subnormal_range<float>(&LIBC_NAMESPACE::ilogbf);
}
TEST_F(LlvmLibcILogbTest, NormalRange_ilogbf) {
- test_normal_range<float>(&__llvm_libc::ilogbf);
+ test_normal_range<float>(&LIBC_NAMESPACE::ilogbf);
}
diff --git a/libc/test/src/math/smoke/ilogbl_test.cpp b/libc/test/src/math/smoke/ilogbl_test.cpp
index 9647f232245dc3e..29a221ad7f08f7a 100644
--- a/libc/test/src/math/smoke/ilogbl_test.cpp
+++ b/libc/test/src/math/smoke/ilogbl_test.cpp
@@ -16,21 +16,21 @@
#include <math.h>
TEST_F(LlvmLibcILogbTest, SpecialNumbers_ilogbl) {
- test_special_numbers<long double>(&__llvm_libc::ilogbl);
+ test_special_numbers<long double>(&LIBC_NAMESPACE::ilogbl);
}
TEST_F(LlvmLibcILogbTest, PowersOfTwo_ilogbl) {
- test_powers_of_two<long double>(&__llvm_libc::ilogbl);
+ test_powers_of_two<long double>(&LIBC_NAMESPACE::ilogbl);
}
TEST_F(LlvmLibcILogbTest, SomeIntegers_ilogbl) {
- test_some_integers<long double>(&__llvm_libc::ilogbl);
+ test_some_integers<long double>(&LIBC_NAMESPACE::ilogbl);
}
TEST_F(LlvmLibcILogbTest, SubnormalRange_ilogbl) {
- test_subnormal_range<long double>(&__llvm_libc::ilogbl);
+ test_subnormal_range<long double>(&LIBC_NAMESPACE::ilogbl);
}
TEST_F(LlvmLibcILogbTest, NormalRange_ilogbl) {
- test_normal_range<long double>(&__llvm_libc::ilogbl);
+ test_normal_range<long double>(&LIBC_NAMESPACE::ilogbl);
}
diff --git a/libc/test/src/math/smoke/ldexp_test.cpp b/libc/test/src/math/smoke/ldexp_test.cpp
index c078aa4b7ef84c7..aad580f95fb99d4 100644
--- a/libc/test/src/math/smoke/ldexp_test.cpp
+++ b/libc/test/src/math/smoke/ldexp_test.cpp
@@ -10,4 +10,4 @@
#include "src/math/ldexp.h"
-LIST_LDEXP_TESTS(double, __llvm_libc::ldexp)
+LIST_LDEXP_TESTS(double, LIBC_NAMESPACE::ldexp)
diff --git a/libc/test/src/math/smoke/ldexpf_test.cpp b/libc/test/src/math/smoke/ldexpf_test.cpp
index 4fe80fc79151cd6..f4cce37b9277dc5 100644
--- a/libc/test/src/math/smoke/ldexpf_test.cpp
+++ b/libc/test/src/math/smoke/ldexpf_test.cpp
@@ -10,4 +10,4 @@
#include "src/math/ldexpf.h"
-LIST_LDEXP_TESTS(float, __llvm_libc::ldexpf)
+LIST_LDEXP_TESTS(float, LIBC_NAMESPACE::ldexpf)
diff --git a/libc/test/src/math/smoke/ldexpl_test.cpp b/libc/test/src/math/smoke/ldexpl_test.cpp
index 5e6e6e75ae0855b..405e53390e8c34d 100644
--- a/libc/test/src/math/smoke/ldexpl_test.cpp
+++ b/libc/test/src/math/smoke/ldexpl_test.cpp
@@ -10,4 +10,4 @@
#include "src/math/ldexpl.h"
-LIST_LDEXP_TESTS(long double, __llvm_libc::ldexpl)
+LIST_LDEXP_TESTS(long double, LIBC_NAMESPACE::ldexpl)
diff --git a/libc/test/src/math/smoke/llrint_test.cpp b/libc/test/src/math/smoke/llrint_test.cpp
index 8027004bd50a5dd..8cf7d92095891bf 100644
--- a/libc/test/src/math/smoke/llrint_test.cpp
+++ b/libc/test/src/math/smoke/llrint_test.cpp
@@ -10,4 +10,5 @@
#include "src/math/llrint.h"
-LIST_ROUND_TO_INTEGER_TESTS_WITH_MODES(double, long long, __llvm_libc::llrint)
+LIST_ROUND_TO_INTEGER_TESTS_WITH_MODES(double, long long,
+ LIBC_NAMESPACE::llrint)
diff --git a/libc/test/src/math/smoke/llrintf_test.cpp b/libc/test/src/math/smoke/llrintf_test.cpp
index 9ad710e4698350c..0d9d3c4111bb245 100644
--- a/libc/test/src/math/smoke/llrintf_test.cpp
+++ b/libc/test/src/math/smoke/llrintf_test.cpp
@@ -10,4 +10,5 @@
#include "src/math/llrintf.h"
-LIST_ROUND_TO_INTEGER_TESTS_WITH_MODES(float, long long, __llvm_libc::llrintf)
+LIST_ROUND_TO_INTEGER_TESTS_WITH_MODES(float, long long,
+ LIBC_NAMESPACE::llrintf)
diff --git a/libc/test/src/math/smoke/llrintl_test.cpp b/libc/test/src/math/smoke/llrintl_test.cpp
index 948e961e57bd4d0..1ceb9fecc40391f 100644
--- a/libc/test/src/math/smoke/llrintl_test.cpp
+++ b/libc/test/src/math/smoke/llrintl_test.cpp
@@ -11,4 +11,4 @@
#include "src/math/llrintl.h"
LIST_ROUND_TO_INTEGER_TESTS_WITH_MODES(long double, long long,
- __llvm_libc::llrintl)
+ LIBC_NAMESPACE::llrintl)
diff --git a/libc/test/src/math/smoke/llround_test.cpp b/libc/test/src/math/smoke/llround_test.cpp
index c86095dc9aae03b..bda2fca6e8659f3 100644
--- a/libc/test/src/math/smoke/llround_test.cpp
+++ b/libc/test/src/math/smoke/llround_test.cpp
@@ -10,4 +10,4 @@
#include "src/math/llround.h"
-LIST_ROUND_TO_INTEGER_TESTS(double, long long, __llvm_libc::llround)
+LIST_ROUND_TO_INTEGER_TESTS(double, long long, LIBC_NAMESPACE::llround)
diff --git a/libc/test/src/math/smoke/llroundf_test.cpp b/libc/test/src/math/smoke/llroundf_test.cpp
index 5e36258c246ae13..a35b5fabbac34c3 100644
--- a/libc/test/src/math/smoke/llroundf_test.cpp
+++ b/libc/test/src/math/smoke/llroundf_test.cpp
@@ -10,4 +10,4 @@
#include "src/math/llroundf.h"
-LIST_ROUND_TO_INTEGER_TESTS(float, long long, __llvm_libc::llroundf)
+LIST_ROUND_TO_INTEGER_TESTS(float, long long, LIBC_NAMESPACE::llroundf)
diff --git a/libc/test/src/math/smoke/llroundl_test.cpp b/libc/test/src/math/smoke/llroundl_test.cpp
index 8fbc840c4f2acc7..e43d49f4cbe1bf3 100644
--- a/libc/test/src/math/smoke/llroundl_test.cpp
+++ b/libc/test/src/math/smoke/llroundl_test.cpp
@@ -10,4 +10,4 @@
#include "src/math/llroundl.h"
-LIST_ROUND_TO_INTEGER_TESTS(long double, long long, __llvm_libc::llroundl)
+LIST_ROUND_TO_INTEGER_TESTS(long double, long long, LIBC_NAMESPACE::llroundl)
diff --git a/libc/test/src/math/smoke/log10_test.cpp b/libc/test/src/math/smoke/log10_test.cpp
index 8a214748fb2e0b4..be4900a6a4dd6be 100644
--- a/libc/test/src/math/smoke/log10_test.cpp
+++ b/libc/test/src/math/smoke/log10_test.cpp
@@ -16,21 +16,23 @@
#include <errno.h>
#include <stdint.h>
-using __llvm_libc::testing::tlog;
+using LIBC_NAMESPACE::testing::tlog;
DECLARE_SPECIAL_CONSTANTS(double)
TEST(LlvmLibcLog10Test, SpecialNumbers) {
- EXPECT_FP_EQ(aNaN, __llvm_libc::log10(aNaN));
- EXPECT_FP_EQ(inf, __llvm_libc::log10(inf));
- EXPECT_FP_IS_NAN_WITH_EXCEPTION(__llvm_libc::log10(neg_inf), FE_INVALID);
- EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, __llvm_libc::log10(0.0), FE_DIVBYZERO);
- EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, __llvm_libc::log10(-0.0), FE_DIVBYZERO);
- EXPECT_FP_IS_NAN_WITH_EXCEPTION(__llvm_libc::log10(-1.0), FE_INVALID);
- EXPECT_FP_EQ_ALL_ROUNDING(zero, __llvm_libc::log10(1.0));
+ EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::log10(aNaN));
+ EXPECT_FP_EQ(inf, LIBC_NAMESPACE::log10(inf));
+ EXPECT_FP_IS_NAN_WITH_EXCEPTION(LIBC_NAMESPACE::log10(neg_inf), FE_INVALID);
+ EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, LIBC_NAMESPACE::log10(0.0),
+ FE_DIVBYZERO);
+ EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, LIBC_NAMESPACE::log10(-0.0),
+ FE_DIVBYZERO);
+ EXPECT_FP_IS_NAN_WITH_EXCEPTION(LIBC_NAMESPACE::log10(-1.0), FE_INVALID);
+ EXPECT_FP_EQ_ALL_ROUNDING(zero, LIBC_NAMESPACE::log10(1.0));
double x = 1.0;
for (int i = 0; i < 11; ++i, x *= 10.0) {
- EXPECT_FP_EQ_ALL_ROUNDING(static_cast<double>(i), __llvm_libc::log10(x));
+ EXPECT_FP_EQ_ALL_ROUNDING(static_cast<double>(i), LIBC_NAMESPACE::log10(x));
}
}
diff --git a/libc/test/src/math/smoke/log10f_test.cpp b/libc/test/src/math/smoke/log10f_test.cpp
index d7838140bec27f0..2369ab0458847a2 100644
--- a/libc/test/src/math/smoke/log10f_test.cpp
+++ b/libc/test/src/math/smoke/log10f_test.cpp
@@ -18,17 +18,18 @@
DECLARE_SPECIAL_CONSTANTS(float)
TEST(LlvmLibcLog10fTest, SpecialNumbers) {
- EXPECT_FP_EQ(aNaN, __llvm_libc::log10f(aNaN));
- EXPECT_FP_EQ(inf, __llvm_libc::log10f(inf));
- EXPECT_FP_IS_NAN_WITH_EXCEPTION(__llvm_libc::log10f(neg_inf), FE_INVALID);
- EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, __llvm_libc::log10f(0.0f), FE_DIVBYZERO);
- EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, __llvm_libc::log10f(-0.0f),
+ EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::log10f(aNaN));
+ EXPECT_FP_EQ(inf, LIBC_NAMESPACE::log10f(inf));
+ EXPECT_FP_IS_NAN_WITH_EXCEPTION(LIBC_NAMESPACE::log10f(neg_inf), FE_INVALID);
+ EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, LIBC_NAMESPACE::log10f(0.0f),
FE_DIVBYZERO);
- EXPECT_FP_IS_NAN_WITH_EXCEPTION(__llvm_libc::log10f(-1.0f), FE_INVALID);
- EXPECT_FP_EQ_ALL_ROUNDING(zero, __llvm_libc::log10f(1.0f));
+ EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, LIBC_NAMESPACE::log10f(-0.0f),
+ FE_DIVBYZERO);
+ EXPECT_FP_IS_NAN_WITH_EXCEPTION(LIBC_NAMESPACE::log10f(-1.0f), FE_INVALID);
+ EXPECT_FP_EQ_ALL_ROUNDING(zero, LIBC_NAMESPACE::log10f(1.0f));
float x = 1.0f;
for (int i = 0; i < 11; ++i, x *= 10.0f) {
- EXPECT_FP_EQ_ALL_ROUNDING(static_cast<float>(i), __llvm_libc::log10f(x));
+ EXPECT_FP_EQ_ALL_ROUNDING(static_cast<float>(i), LIBC_NAMESPACE::log10f(x));
}
}
diff --git a/libc/test/src/math/smoke/log1p_test.cpp b/libc/test/src/math/smoke/log1p_test.cpp
index 14e1977e060e7e4..9cb0cf17ff797de 100644
--- a/libc/test/src/math/smoke/log1p_test.cpp
+++ b/libc/test/src/math/smoke/log1p_test.cpp
@@ -16,16 +16,17 @@
#include <errno.h>
#include <stdint.h>
-using __llvm_libc::testing::tlog;
+using LIBC_NAMESPACE::testing::tlog;
DECLARE_SPECIAL_CONSTANTS(double)
TEST(LlvmLibcLog1pTest, SpecialNumbers) {
- EXPECT_FP_EQ(aNaN, __llvm_libc::log1p(aNaN));
- EXPECT_FP_EQ(inf, __llvm_libc::log1p(inf));
- EXPECT_FP_IS_NAN_WITH_EXCEPTION(__llvm_libc::log1p(neg_inf), FE_INVALID);
- EXPECT_FP_IS_NAN_WITH_EXCEPTION(__llvm_libc::log1p(-2.0), FE_INVALID);
- EXPECT_FP_EQ(zero, __llvm_libc::log1p(0.0));
- EXPECT_FP_EQ(neg_zero, __llvm_libc::log1p(-0.0));
- EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, __llvm_libc::log1p(-1.0), FE_DIVBYZERO);
+ EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::log1p(aNaN));
+ EXPECT_FP_EQ(inf, LIBC_NAMESPACE::log1p(inf));
+ EXPECT_FP_IS_NAN_WITH_EXCEPTION(LIBC_NAMESPACE::log1p(neg_inf), FE_INVALID);
+ EXPECT_FP_IS_NAN_WITH_EXCEPTION(LIBC_NAMESPACE::log1p(-2.0), FE_INVALID);
+ EXPECT_FP_EQ(zero, LIBC_NAMESPACE::log1p(0.0));
+ EXPECT_FP_EQ(neg_zero, LIBC_NAMESPACE::log1p(-0.0));
+ EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, LIBC_NAMESPACE::log1p(-1.0),
+ FE_DIVBYZERO);
}
diff --git a/libc/test/src/math/smoke/log1pf_test.cpp b/libc/test/src/math/smoke/log1pf_test.cpp
index 22043ba6e278de0..983601024371508 100644
--- a/libc/test/src/math/smoke/log1pf_test.cpp
+++ b/libc/test/src/math/smoke/log1pf_test.cpp
@@ -19,11 +19,11 @@
DECLARE_SPECIAL_CONSTANTS(float)
TEST(LlvmLibclog1pfTest, SpecialNumbers) {
- EXPECT_FP_EQ(aNaN, __llvm_libc::log1pf(aNaN));
- EXPECT_FP_EQ(inf, __llvm_libc::log1pf(inf));
- EXPECT_FP_IS_NAN_WITH_EXCEPTION(__llvm_libc::log1pf(neg_inf), FE_INVALID);
- EXPECT_FP_EQ(zero, __llvm_libc::log1pf(0.0f));
- EXPECT_FP_EQ(neg_zero, __llvm_libc::log1pf(-0.0f));
- EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, __llvm_libc::log1pf(-1.0f),
+ EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::log1pf(aNaN));
+ EXPECT_FP_EQ(inf, LIBC_NAMESPACE::log1pf(inf));
+ EXPECT_FP_IS_NAN_WITH_EXCEPTION(LIBC_NAMESPACE::log1pf(neg_inf), FE_INVALID);
+ EXPECT_FP_EQ(zero, LIBC_NAMESPACE::log1pf(0.0f));
+ EXPECT_FP_EQ(neg_zero, LIBC_NAMESPACE::log1pf(-0.0f));
+ EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, LIBC_NAMESPACE::log1pf(-1.0f),
FE_DIVBYZERO);
}
diff --git a/libc/test/src/math/smoke/log2_test.cpp b/libc/test/src/math/smoke/log2_test.cpp
index 2726a6b1c3a7267..dab8929115d7260 100644
--- a/libc/test/src/math/smoke/log2_test.cpp
+++ b/libc/test/src/math/smoke/log2_test.cpp
@@ -16,16 +16,17 @@
#include <errno.h>
#include <stdint.h>
-using __llvm_libc::testing::tlog;
+using LIBC_NAMESPACE::testing::tlog;
DECLARE_SPECIAL_CONSTANTS(double)
TEST(LlvmLibcLog2Test, SpecialNumbers) {
- EXPECT_FP_EQ(aNaN, __llvm_libc::log2(aNaN));
- EXPECT_FP_EQ(inf, __llvm_libc::log2(inf));
- EXPECT_FP_IS_NAN_WITH_EXCEPTION(__llvm_libc::log2(neg_inf), FE_INVALID);
- EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, __llvm_libc::log2(0.0), FE_DIVBYZERO);
- EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, __llvm_libc::log2(-0.0), FE_DIVBYZERO);
- EXPECT_FP_IS_NAN_WITH_EXCEPTION(__llvm_libc::log2(-1.0), FE_INVALID);
- EXPECT_FP_EQ_ALL_ROUNDING(zero, __llvm_libc::log2(1.0));
+ EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::log2(aNaN));
+ EXPECT_FP_EQ(inf, LIBC_NAMESPACE::log2(inf));
+ EXPECT_FP_IS_NAN_WITH_EXCEPTION(LIBC_NAMESPACE::log2(neg_inf), FE_INVALID);
+ EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, LIBC_NAMESPACE::log2(0.0), FE_DIVBYZERO);
+ EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, LIBC_NAMESPACE::log2(-0.0),
+ FE_DIVBYZERO);
+ EXPECT_FP_IS_NAN_WITH_EXCEPTION(LIBC_NAMESPACE::log2(-1.0), FE_INVALID);
+ EXPECT_FP_EQ_ALL_ROUNDING(zero, LIBC_NAMESPACE::log2(1.0));
}
diff --git a/libc/test/src/math/smoke/log2f_test.cpp b/libc/test/src/math/smoke/log2f_test.cpp
index 6b05e6cc715ebe3..d388230a801591e 100644
--- a/libc/test/src/math/smoke/log2f_test.cpp
+++ b/libc/test/src/math/smoke/log2f_test.cpp
@@ -18,11 +18,13 @@
DECLARE_SPECIAL_CONSTANTS(float)
TEST(LlvmLibcLog2fTest, SpecialNumbers) {
- EXPECT_FP_EQ(aNaN, __llvm_libc::log2f(aNaN));
- EXPECT_FP_EQ(inf, __llvm_libc::log2f(inf));
- EXPECT_FP_IS_NAN_WITH_EXCEPTION(__llvm_libc::log2f(neg_inf), FE_INVALID);
- EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, __llvm_libc::log2f(0.0f), FE_DIVBYZERO);
- EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, __llvm_libc::log2f(-0.0f), FE_DIVBYZERO);
- EXPECT_FP_IS_NAN_WITH_EXCEPTION(__llvm_libc::log2f(-1.0f), FE_INVALID);
- EXPECT_FP_EQ_ALL_ROUNDING(zero, __llvm_libc::log2f(1.0f));
+ EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::log2f(aNaN));
+ EXPECT_FP_EQ(inf, LIBC_NAMESPACE::log2f(inf));
+ EXPECT_FP_IS_NAN_WITH_EXCEPTION(LIBC_NAMESPACE::log2f(neg_inf), FE_INVALID);
+ EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, LIBC_NAMESPACE::log2f(0.0f),
+ FE_DIVBYZERO);
+ EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, LIBC_NAMESPACE::log2f(-0.0f),
+ FE_DIVBYZERO);
+ EXPECT_FP_IS_NAN_WITH_EXCEPTION(LIBC_NAMESPACE::log2f(-1.0f), FE_INVALID);
+ EXPECT_FP_EQ_ALL_ROUNDING(zero, LIBC_NAMESPACE::log2f(1.0f));
}
diff --git a/libc/test/src/math/smoke/log_test.cpp b/libc/test/src/math/smoke/log_test.cpp
index 4277123214a67f4..34d608a81a14e0b 100644
--- a/libc/test/src/math/smoke/log_test.cpp
+++ b/libc/test/src/math/smoke/log_test.cpp
@@ -16,16 +16,16 @@
#include <errno.h>
#include <stdint.h>
-using __llvm_libc::testing::tlog;
+using LIBC_NAMESPACE::testing::tlog;
DECLARE_SPECIAL_CONSTANTS(double)
TEST(LlvmLibcLogTest, SpecialNumbers) {
- EXPECT_FP_EQ(aNaN, __llvm_libc::log(aNaN));
- EXPECT_FP_EQ(inf, __llvm_libc::log(inf));
- EXPECT_FP_IS_NAN_WITH_EXCEPTION(__llvm_libc::log(neg_inf), FE_INVALID);
- EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, __llvm_libc::log(0.0), FE_DIVBYZERO);
- EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, __llvm_libc::log(-0.0), FE_DIVBYZERO);
- EXPECT_FP_IS_NAN_WITH_EXCEPTION(__llvm_libc::log(-1.0), FE_INVALID);
- EXPECT_FP_EQ_ALL_ROUNDING(zero, __llvm_libc::log(1.0));
+ EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::log(aNaN));
+ EXPECT_FP_EQ(inf, LIBC_NAMESPACE::log(inf));
+ EXPECT_FP_IS_NAN_WITH_EXCEPTION(LIBC_NAMESPACE::log(neg_inf), FE_INVALID);
+ EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, LIBC_NAMESPACE::log(0.0), FE_DIVBYZERO);
+ EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, LIBC_NAMESPACE::log(-0.0), FE_DIVBYZERO);
+ EXPECT_FP_IS_NAN_WITH_EXCEPTION(LIBC_NAMESPACE::log(-1.0), FE_INVALID);
+ EXPECT_FP_EQ_ALL_ROUNDING(zero, LIBC_NAMESPACE::log(1.0));
}
diff --git a/libc/test/src/math/smoke/logb_test.cpp b/libc/test/src/math/smoke/logb_test.cpp
index b90348522aa3aa6..2dc56c2e613ccb2 100644
--- a/libc/test/src/math/smoke/logb_test.cpp
+++ b/libc/test/src/math/smoke/logb_test.cpp
@@ -10,4 +10,4 @@
#include "src/math/logb.h"
-LIST_LOGB_TESTS(double, __llvm_libc::logb)
+LIST_LOGB_TESTS(double, LIBC_NAMESPACE::logb)
diff --git a/libc/test/src/math/smoke/logbf_test.cpp b/libc/test/src/math/smoke/logbf_test.cpp
index 727eefffbb1740c..c25485ca78b065b 100644
--- a/libc/test/src/math/smoke/logbf_test.cpp
+++ b/libc/test/src/math/smoke/logbf_test.cpp
@@ -10,4 +10,4 @@
#include "src/math/logbf.h"
-LIST_LOGB_TESTS(float, __llvm_libc::logbf)
+LIST_LOGB_TESTS(float, LIBC_NAMESPACE::logbf)
diff --git a/libc/test/src/math/smoke/logbl_test.cpp b/libc/test/src/math/smoke/logbl_test.cpp
index 1c7b0d4e66e84ec..b26cee65783c420 100644
--- a/libc/test/src/math/smoke/logbl_test.cpp
+++ b/libc/test/src/math/smoke/logbl_test.cpp
@@ -10,4 +10,4 @@
#include "src/math/logbl.h"
-LIST_LOGB_TESTS(long double, __llvm_libc::logbl)
+LIST_LOGB_TESTS(long double, LIBC_NAMESPACE::logbl)
diff --git a/libc/test/src/math/smoke/logf_test.cpp b/libc/test/src/math/smoke/logf_test.cpp
index 20fa51735ad75b4..0edaa8da556e282 100644
--- a/libc/test/src/math/smoke/logf_test.cpp
+++ b/libc/test/src/math/smoke/logf_test.cpp
@@ -17,11 +17,13 @@
DECLARE_SPECIAL_CONSTANTS(float)
TEST(LlvmLibcLogfTest, SpecialNumbers) {
- EXPECT_FP_EQ(aNaN, __llvm_libc::logf(aNaN));
- EXPECT_FP_EQ(inf, __llvm_libc::logf(inf));
- EXPECT_FP_IS_NAN_WITH_EXCEPTION(__llvm_libc::logf(neg_inf), FE_INVALID);
- EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, __llvm_libc::logf(0.0f), FE_DIVBYZERO);
- EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, __llvm_libc::logf(-0.0f), FE_DIVBYZERO);
- EXPECT_FP_IS_NAN_WITH_EXCEPTION(__llvm_libc::logf(-1.0f), FE_INVALID);
- EXPECT_FP_EQ_ALL_ROUNDING(zero, __llvm_libc::logf(1.0f));
+ EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::logf(aNaN));
+ EXPECT_FP_EQ(inf, LIBC_NAMESPACE::logf(inf));
+ EXPECT_FP_IS_NAN_WITH_EXCEPTION(LIBC_NAMESPACE::logf(neg_inf), FE_INVALID);
+ EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, LIBC_NAMESPACE::logf(0.0f),
+ FE_DIVBYZERO);
+ EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, LIBC_NAMESPACE::logf(-0.0f),
+ FE_DIVBYZERO);
+ EXPECT_FP_IS_NAN_WITH_EXCEPTION(LIBC_NAMESPACE::logf(-1.0f), FE_INVALID);
+ EXPECT_FP_EQ_ALL_ROUNDING(zero, LIBC_NAMESPACE::logf(1.0f));
}
diff --git a/libc/test/src/math/smoke/lrint_test.cpp b/libc/test/src/math/smoke/lrint_test.cpp
index 0dbfa3dd466d99f..9cff2661225361a 100644
--- a/libc/test/src/math/smoke/lrint_test.cpp
+++ b/libc/test/src/math/smoke/lrint_test.cpp
@@ -10,4 +10,4 @@
#include "src/math/lrint.h"
-LIST_ROUND_TO_INTEGER_TESTS_WITH_MODES(double, long, __llvm_libc::lrint)
+LIST_ROUND_TO_INTEGER_TESTS_WITH_MODES(double, long, LIBC_NAMESPACE::lrint)
diff --git a/libc/test/src/math/smoke/lrintf_test.cpp b/libc/test/src/math/smoke/lrintf_test.cpp
index 407813aa83c0feb..9c696a39e6928cb 100644
--- a/libc/test/src/math/smoke/lrintf_test.cpp
+++ b/libc/test/src/math/smoke/lrintf_test.cpp
@@ -10,4 +10,4 @@
#include "src/math/lrintf.h"
-LIST_ROUND_TO_INTEGER_TESTS_WITH_MODES(float, long, __llvm_libc::lrintf)
+LIST_ROUND_TO_INTEGER_TESTS_WITH_MODES(float, long, LIBC_NAMESPACE::lrintf)
diff --git a/libc/test/src/math/smoke/lrintl_test.cpp b/libc/test/src/math/smoke/lrintl_test.cpp
index a4551c38de10663..e44dd30d2c6cccc 100644
--- a/libc/test/src/math/smoke/lrintl_test.cpp
+++ b/libc/test/src/math/smoke/lrintl_test.cpp
@@ -10,4 +10,5 @@
#include "src/math/lrintl.h"
-LIST_ROUND_TO_INTEGER_TESTS_WITH_MODES(long double, long, __llvm_libc::lrintl)
+LIST_ROUND_TO_INTEGER_TESTS_WITH_MODES(long double, long,
+ LIBC_NAMESPACE::lrintl)
diff --git a/libc/test/src/math/smoke/lround_test.cpp b/libc/test/src/math/smoke/lround_test.cpp
index 0ee580f316b44ac..1fb2fc71e20ccbb 100644
--- a/libc/test/src/math/smoke/lround_test.cpp
+++ b/libc/test/src/math/smoke/lround_test.cpp
@@ -10,4 +10,4 @@
#include "src/math/lround.h"
-LIST_ROUND_TO_INTEGER_TESTS(double, long, __llvm_libc::lround)
+LIST_ROUND_TO_INTEGER_TESTS(double, long, LIBC_NAMESPACE::lround)
diff --git a/libc/test/src/math/smoke/lroundf_test.cpp b/libc/test/src/math/smoke/lroundf_test.cpp
index 7a2aad20e4f664b..38fe5c7d1a52dc5 100644
--- a/libc/test/src/math/smoke/lroundf_test.cpp
+++ b/libc/test/src/math/smoke/lroundf_test.cpp
@@ -10,4 +10,4 @@
#include "src/math/lroundf.h"
-LIST_ROUND_TO_INTEGER_TESTS(float, long, __llvm_libc::lroundf)
+LIST_ROUND_TO_INTEGER_TESTS(float, long, LIBC_NAMESPACE::lroundf)
diff --git a/libc/test/src/math/smoke/lroundl_test.cpp b/libc/test/src/math/smoke/lroundl_test.cpp
index c0ea33978205236..8a29ba95a61732d 100644
--- a/libc/test/src/math/smoke/lroundl_test.cpp
+++ b/libc/test/src/math/smoke/lroundl_test.cpp
@@ -10,4 +10,4 @@
#include "src/math/lroundl.h"
-LIST_ROUND_TO_INTEGER_TESTS(long double, long, __llvm_libc::lroundl)
+LIST_ROUND_TO_INTEGER_TESTS(long double, long, LIBC_NAMESPACE::lroundl)
diff --git a/libc/test/src/math/smoke/modf_test.cpp b/libc/test/src/math/smoke/modf_test.cpp
index ff89517506b4f27..b4b03bad848de57 100644
--- a/libc/test/src/math/smoke/modf_test.cpp
+++ b/libc/test/src/math/smoke/modf_test.cpp
@@ -10,4 +10,4 @@
#include "src/math/modf.h"
-LIST_MODF_TESTS(double, __llvm_libc::modf)
+LIST_MODF_TESTS(double, LIBC_NAMESPACE::modf)
diff --git a/libc/test/src/math/smoke/modff_test.cpp b/libc/test/src/math/smoke/modff_test.cpp
index 440304ab95ac78f..068dbc3f5313590 100644
--- a/libc/test/src/math/smoke/modff_test.cpp
+++ b/libc/test/src/math/smoke/modff_test.cpp
@@ -10,4 +10,4 @@
#include "src/math/modff.h"
-LIST_MODF_TESTS(float, __llvm_libc::modff)
+LIST_MODF_TESTS(float, LIBC_NAMESPACE::modff)
diff --git a/libc/test/src/math/smoke/modfl_test.cpp b/libc/test/src/math/smoke/modfl_test.cpp
index c98678b3e9243e3..ae8a72642c5871e 100644
--- a/libc/test/src/math/smoke/modfl_test.cpp
+++ b/libc/test/src/math/smoke/modfl_test.cpp
@@ -10,4 +10,4 @@
#include "src/math/modfl.h"
-LIST_MODF_TESTS(long double, __llvm_libc::modfl)
+LIST_MODF_TESTS(long double, LIBC_NAMESPACE::modfl)
diff --git a/libc/test/src/math/smoke/nextafter_test.cpp b/libc/test/src/math/smoke/nextafter_test.cpp
index 2dde48ceb053c6c..998b19fb1dccd37 100644
--- a/libc/test/src/math/smoke/nextafter_test.cpp
+++ b/libc/test/src/math/smoke/nextafter_test.cpp
@@ -10,4 +10,4 @@
#include "src/math/nextafter.h"
-LIST_NEXTAFTER_TESTS(double, __llvm_libc::nextafter)
+LIST_NEXTAFTER_TESTS(double, LIBC_NAMESPACE::nextafter)
diff --git a/libc/test/src/math/smoke/nextafterf_test.cpp b/libc/test/src/math/smoke/nextafterf_test.cpp
index 14234c717797eb5..31770bc591ec1fa 100644
--- a/libc/test/src/math/smoke/nextafterf_test.cpp
+++ b/libc/test/src/math/smoke/nextafterf_test.cpp
@@ -10,4 +10,4 @@
#include "src/math/nextafterf.h"
-LIST_NEXTAFTER_TESTS(float, __llvm_libc::nextafterf)
+LIST_NEXTAFTER_TESTS(float, LIBC_NAMESPACE::nextafterf)
diff --git a/libc/test/src/math/smoke/nextafterl_test.cpp b/libc/test/src/math/smoke/nextafterl_test.cpp
index db85d83edc690ef..4c8577f2690a1fd 100644
--- a/libc/test/src/math/smoke/nextafterl_test.cpp
+++ b/libc/test/src/math/smoke/nextafterl_test.cpp
@@ -10,4 +10,4 @@
#include "src/math/nextafterl.h"
-LIST_NEXTAFTER_TESTS(long double, __llvm_libc::nextafterl)
+LIST_NEXTAFTER_TESTS(long double, LIBC_NAMESPACE::nextafterl)
diff --git a/libc/test/src/math/smoke/remquo_test.cpp b/libc/test/src/math/smoke/remquo_test.cpp
index 8efec397f39d33b..4358331a8f76e2b 100644
--- a/libc/test/src/math/smoke/remquo_test.cpp
+++ b/libc/test/src/math/smoke/remquo_test.cpp
@@ -10,4 +10,4 @@
#include "src/math/remquo.h"
-LIST_REMQUO_TESTS(double, __llvm_libc::remquo)
+LIST_REMQUO_TESTS(double, LIBC_NAMESPACE::remquo)
diff --git a/libc/test/src/math/smoke/remquof_test.cpp b/libc/test/src/math/smoke/remquof_test.cpp
index 1af4ba4e0153b55..590b4ffb4595fdf 100644
--- a/libc/test/src/math/smoke/remquof_test.cpp
+++ b/libc/test/src/math/smoke/remquof_test.cpp
@@ -10,4 +10,4 @@
#include "src/math/remquof.h"
-LIST_REMQUO_TESTS(float, __llvm_libc::remquof)
+LIST_REMQUO_TESTS(float, LIBC_NAMESPACE::remquof)
diff --git a/libc/test/src/math/smoke/remquol_test.cpp b/libc/test/src/math/smoke/remquol_test.cpp
index e4438e83fe18ce1..ae2db4493041054 100644
--- a/libc/test/src/math/smoke/remquol_test.cpp
+++ b/libc/test/src/math/smoke/remquol_test.cpp
@@ -10,4 +10,4 @@
#include "src/math/remquol.h"
-LIST_REMQUO_TESTS(long double, __llvm_libc::remquol)
+LIST_REMQUO_TESTS(long double, LIBC_NAMESPACE::remquol)
diff --git a/libc/test/src/math/smoke/rint_test.cpp b/libc/test/src/math/smoke/rint_test.cpp
index eafa1a7fe6119fe..9c89b7acec56d5e 100644
--- a/libc/test/src/math/smoke/rint_test.cpp
+++ b/libc/test/src/math/smoke/rint_test.cpp
@@ -10,4 +10,4 @@
#include "src/math/rint.h"
-LIST_RINT_TESTS(double, __llvm_libc::rint)
+LIST_RINT_TESTS(double, LIBC_NAMESPACE::rint)
diff --git a/libc/test/src/math/smoke/rintf_test.cpp b/libc/test/src/math/smoke/rintf_test.cpp
index c15a697fac9208c..f875bab2556cadd 100644
--- a/libc/test/src/math/smoke/rintf_test.cpp
+++ b/libc/test/src/math/smoke/rintf_test.cpp
@@ -10,4 +10,4 @@
#include "src/math/rintf.h"
-LIST_RINT_TESTS(float, __llvm_libc::rintf)
+LIST_RINT_TESTS(float, LIBC_NAMESPACE::rintf)
diff --git a/libc/test/src/math/smoke/rintl_test.cpp b/libc/test/src/math/smoke/rintl_test.cpp
index 6c50873a272d046..458ca05a985af57 100644
--- a/libc/test/src/math/smoke/rintl_test.cpp
+++ b/libc/test/src/math/smoke/rintl_test.cpp
@@ -10,4 +10,4 @@
#include "src/math/rintl.h"
-LIST_RINT_TESTS(long double, __llvm_libc::rintl)
+LIST_RINT_TESTS(long double, LIBC_NAMESPACE::rintl)
diff --git a/libc/test/src/math/smoke/round_test.cpp b/libc/test/src/math/smoke/round_test.cpp
index 87ce079e89afc29..dbcb56717e20833 100644
--- a/libc/test/src/math/smoke/round_test.cpp
+++ b/libc/test/src/math/smoke/round_test.cpp
@@ -10,4 +10,4 @@
#include "src/math/round.h"
-LIST_ROUND_TESTS(double, __llvm_libc::round)
+LIST_ROUND_TESTS(double, LIBC_NAMESPACE::round)
diff --git a/libc/test/src/math/smoke/roundf_test.cpp b/libc/test/src/math/smoke/roundf_test.cpp
index 0a182dd02deee6f..053596a16e22f6c 100644
--- a/libc/test/src/math/smoke/roundf_test.cpp
+++ b/libc/test/src/math/smoke/roundf_test.cpp
@@ -10,4 +10,4 @@
#include "src/math/roundf.h"
-LIST_ROUND_TESTS(float, __llvm_libc::roundf)
+LIST_ROUND_TESTS(float, LIBC_NAMESPACE::roundf)
diff --git a/libc/test/src/math/smoke/roundl_test.cpp b/libc/test/src/math/smoke/roundl_test.cpp
index 32cf724fb7c4f3b..2a2a213a8181cda 100644
--- a/libc/test/src/math/smoke/roundl_test.cpp
+++ b/libc/test/src/math/smoke/roundl_test.cpp
@@ -10,4 +10,4 @@
#include "src/math/roundl.h"
-LIST_ROUND_TESTS(long double, __llvm_libc::roundl)
+LIST_ROUND_TESTS(long double, LIBC_NAMESPACE::roundl)
diff --git a/libc/test/src/math/smoke/scalbn_test.cpp b/libc/test/src/math/smoke/scalbn_test.cpp
index d4d60bf8afca180..413a2395ca3c57d 100644
--- a/libc/test/src/math/smoke/scalbn_test.cpp
+++ b/libc/test/src/math/smoke/scalbn_test.cpp
@@ -10,4 +10,4 @@
#include "src/math/scalbn.h"
-LIST_SCALBN_TESTS(double, __llvm_libc::scalbn)
+LIST_SCALBN_TESTS(double, LIBC_NAMESPACE::scalbn)
diff --git a/libc/test/src/math/smoke/scalbnf_test.cpp b/libc/test/src/math/smoke/scalbnf_test.cpp
index cbf2e7e1361e10c..e97781c2b235464 100644
--- a/libc/test/src/math/smoke/scalbnf_test.cpp
+++ b/libc/test/src/math/smoke/scalbnf_test.cpp
@@ -10,4 +10,4 @@
#include "src/math/scalbnf.h"
-LIST_SCALBN_TESTS(float, __llvm_libc::scalbnf)
+LIST_SCALBN_TESTS(float, LIBC_NAMESPACE::scalbnf)
diff --git a/libc/test/src/math/smoke/scalbnl_test.cpp b/libc/test/src/math/smoke/scalbnl_test.cpp
index 197887b2448c057..b0e005379090249 100644
--- a/libc/test/src/math/smoke/scalbnl_test.cpp
+++ b/libc/test/src/math/smoke/scalbnl_test.cpp
@@ -10,4 +10,4 @@
#include "src/math/scalbnl.h"
-LIST_SCALBN_TESTS(long double, __llvm_libc::scalbnl)
+LIST_SCALBN_TESTS(long double, LIBC_NAMESPACE::scalbnl)
diff --git a/libc/test/src/math/smoke/sincosf_test.cpp b/libc/test/src/math/smoke/sincosf_test.cpp
index 102a50c428d26ac..4e2b1c69e41877e 100644
--- a/libc/test/src/math/smoke/sincosf_test.cpp
+++ b/libc/test/src/math/smoke/sincosf_test.cpp
@@ -16,7 +16,7 @@
#include <errno.h>
#include <stdint.h>
-using FPBits = __llvm_libc::fputil::FPBits<float>;
+using FPBits = LIBC_NAMESPACE::fputil::FPBits<float>;
DECLARE_SPECIAL_CONSTANTS(float)
@@ -24,27 +24,27 @@ TEST(LlvmLibcSinCosfTest, SpecialNumbers) {
libc_errno = 0;
float sin, cos;
- __llvm_libc::sincosf(aNaN, &sin, &cos);
+ LIBC_NAMESPACE::sincosf(aNaN, &sin, &cos);
EXPECT_FP_EQ(aNaN, cos);
EXPECT_FP_EQ(aNaN, sin);
EXPECT_MATH_ERRNO(0);
- __llvm_libc::sincosf(0.0f, &sin, &cos);
+ LIBC_NAMESPACE::sincosf(0.0f, &sin, &cos);
EXPECT_FP_EQ(1.0f, cos);
EXPECT_FP_EQ(0.0f, sin);
EXPECT_MATH_ERRNO(0);
- __llvm_libc::sincosf(-0.0f, &sin, &cos);
+ LIBC_NAMESPACE::sincosf(-0.0f, &sin, &cos);
EXPECT_FP_EQ(1.0f, cos);
EXPECT_FP_EQ(-0.0f, sin);
EXPECT_MATH_ERRNO(0);
- __llvm_libc::sincosf(inf, &sin, &cos);
+ LIBC_NAMESPACE::sincosf(inf, &sin, &cos);
EXPECT_FP_EQ(aNaN, cos);
EXPECT_FP_EQ(aNaN, sin);
EXPECT_MATH_ERRNO(EDOM);
- __llvm_libc::sincosf(neg_inf, &sin, &cos);
+ LIBC_NAMESPACE::sincosf(neg_inf, &sin, &cos);
EXPECT_FP_EQ(aNaN, cos);
EXPECT_FP_EQ(aNaN, sin);
EXPECT_MATH_ERRNO(EDOM);
diff --git a/libc/test/src/math/smoke/sinf_test.cpp b/libc/test/src/math/smoke/sinf_test.cpp
index e67062d74190bb9..b93011bbdc2baf7 100644
--- a/libc/test/src/math/smoke/sinf_test.cpp
+++ b/libc/test/src/math/smoke/sinf_test.cpp
@@ -16,25 +16,25 @@
#include <errno.h>
#include <stdint.h>
-using FPBits = __llvm_libc::fputil::FPBits<float>;
+using FPBits = LIBC_NAMESPACE::fputil::FPBits<float>;
DECLARE_SPECIAL_CONSTANTS(float)
TEST(LlvmLibcSinfTest, SpecialNumbers) {
libc_errno = 0;
- EXPECT_FP_EQ(aNaN, __llvm_libc::sinf(aNaN));
+ EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::sinf(aNaN));
EXPECT_MATH_ERRNO(0);
- EXPECT_FP_EQ(0.0f, __llvm_libc::sinf(0.0f));
+ EXPECT_FP_EQ(0.0f, LIBC_NAMESPACE::sinf(0.0f));
EXPECT_MATH_ERRNO(0);
- EXPECT_FP_EQ(-0.0f, __llvm_libc::sinf(-0.0f));
+ EXPECT_FP_EQ(-0.0f, LIBC_NAMESPACE::sinf(-0.0f));
EXPECT_MATH_ERRNO(0);
- EXPECT_FP_EQ(aNaN, __llvm_libc::sinf(inf));
+ EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::sinf(inf));
EXPECT_MATH_ERRNO(EDOM);
- EXPECT_FP_EQ(aNaN, __llvm_libc::sinf(neg_inf));
+ EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::sinf(neg_inf));
EXPECT_MATH_ERRNO(EDOM);
}
diff --git a/libc/test/src/math/smoke/sinhf_test.cpp b/libc/test/src/math/smoke/sinhf_test.cpp
index 5926ea647490bc2..b2b6bddf91c2a58 100644
--- a/libc/test/src/math/smoke/sinhf_test.cpp
+++ b/libc/test/src/math/smoke/sinhf_test.cpp
@@ -17,51 +17,51 @@
#include <errno.h>
#include <stdint.h>
-using FPBits = __llvm_libc::fputil::FPBits<float>;
+using FPBits = LIBC_NAMESPACE::fputil::FPBits<float>;
DECLARE_SPECIAL_CONSTANTS(float)
TEST(LlvmLibcSinhfTest, SpecialNumbers) {
libc_errno = 0;
- EXPECT_FP_EQ(aNaN, __llvm_libc::sinhf(aNaN));
+ EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::sinhf(aNaN));
EXPECT_MATH_ERRNO(0);
- EXPECT_FP_EQ(0.0f, __llvm_libc::sinhf(0.0f));
+ EXPECT_FP_EQ(0.0f, LIBC_NAMESPACE::sinhf(0.0f));
EXPECT_MATH_ERRNO(0);
- EXPECT_FP_EQ(-0.0f, __llvm_libc::sinhf(-0.0f));
+ EXPECT_FP_EQ(-0.0f, LIBC_NAMESPACE::sinhf(-0.0f));
EXPECT_MATH_ERRNO(0);
- EXPECT_FP_EQ(inf, __llvm_libc::sinhf(inf));
+ EXPECT_FP_EQ(inf, LIBC_NAMESPACE::sinhf(inf));
EXPECT_MATH_ERRNO(0);
- EXPECT_FP_EQ(neg_inf, __llvm_libc::sinhf(neg_inf));
+ EXPECT_FP_EQ(neg_inf, LIBC_NAMESPACE::sinhf(neg_inf));
EXPECT_MATH_ERRNO(0);
}
// For small values, sinh(x) is x.
TEST(LlvmLibcSinhfTest, SmallValues) {
float x = float(FPBits(uint32_t(0x17800000)));
- float result = __llvm_libc::sinhf(x);
+ float result = LIBC_NAMESPACE::sinhf(x);
EXPECT_FP_EQ(x, result);
x = float(FPBits(uint32_t(0x00400000)));
- result = __llvm_libc::sinhf(x);
+ result = LIBC_NAMESPACE::sinhf(x);
EXPECT_FP_EQ(x, result);
}
TEST(LlvmLibcSinhfTest, Overflow) {
libc_errno = 0;
EXPECT_FP_EQ_WITH_EXCEPTION(
- inf, __llvm_libc::sinhf(float(FPBits(0x7f7fffffU))), FE_OVERFLOW);
+ inf, LIBC_NAMESPACE::sinhf(float(FPBits(0x7f7fffffU))), FE_OVERFLOW);
EXPECT_MATH_ERRNO(ERANGE);
EXPECT_FP_EQ_WITH_EXCEPTION(
- inf, __llvm_libc::sinhf(float(FPBits(0x42cffff8U))), FE_OVERFLOW);
+ inf, LIBC_NAMESPACE::sinhf(float(FPBits(0x42cffff8U))), FE_OVERFLOW);
EXPECT_MATH_ERRNO(ERANGE);
EXPECT_FP_EQ_WITH_EXCEPTION(
- inf, __llvm_libc::sinhf(float(FPBits(0x42d00008U))), FE_OVERFLOW);
+ inf, LIBC_NAMESPACE::sinhf(float(FPBits(0x42d00008U))), FE_OVERFLOW);
EXPECT_MATH_ERRNO(ERANGE);
}
diff --git a/libc/test/src/math/smoke/sqrt_test.cpp b/libc/test/src/math/smoke/sqrt_test.cpp
index 237264895bbd26b..1551b31d6f715fd 100644
--- a/libc/test/src/math/smoke/sqrt_test.cpp
+++ b/libc/test/src/math/smoke/sqrt_test.cpp
@@ -10,4 +10,4 @@
#include "src/math/sqrt.h"
-LIST_SQRT_TESTS(double, __llvm_libc::sqrt)
+LIST_SQRT_TESTS(double, LIBC_NAMESPACE::sqrt)
diff --git a/libc/test/src/math/smoke/sqrtf_test.cpp b/libc/test/src/math/smoke/sqrtf_test.cpp
index c7681d01569ae73..3f2e973325bd0f2 100644
--- a/libc/test/src/math/smoke/sqrtf_test.cpp
+++ b/libc/test/src/math/smoke/sqrtf_test.cpp
@@ -10,4 +10,4 @@
#include "src/math/sqrtf.h"
-LIST_SQRT_TESTS(float, __llvm_libc::sqrtf)
+LIST_SQRT_TESTS(float, LIBC_NAMESPACE::sqrtf)
diff --git a/libc/test/src/math/smoke/sqrtl_test.cpp b/libc/test/src/math/smoke/sqrtl_test.cpp
index c48ebb08444d051..f80bcfb73607824 100644
--- a/libc/test/src/math/smoke/sqrtl_test.cpp
+++ b/libc/test/src/math/smoke/sqrtl_test.cpp
@@ -10,4 +10,4 @@
#include "src/math/sqrtl.h"
-LIST_SQRT_TESTS(long double, __llvm_libc::sqrtl)
+LIST_SQRT_TESTS(long double, LIBC_NAMESPACE::sqrtl)
diff --git a/libc/test/src/math/smoke/tanf_test.cpp b/libc/test/src/math/smoke/tanf_test.cpp
index 62cc42c0bef1a48..60444b3ad15cc0e 100644
--- a/libc/test/src/math/smoke/tanf_test.cpp
+++ b/libc/test/src/math/smoke/tanf_test.cpp
@@ -16,25 +16,25 @@
#include <errno.h>
#include <stdint.h>
-using FPBits = __llvm_libc::fputil::FPBits<float>;
+using FPBits = LIBC_NAMESPACE::fputil::FPBits<float>;
DECLARE_SPECIAL_CONSTANTS(float)
TEST(LlvmLibcTanfTest, SpecialNumbers) {
libc_errno = 0;
- EXPECT_FP_EQ(aNaN, __llvm_libc::tanf(aNaN));
+ EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::tanf(aNaN));
EXPECT_MATH_ERRNO(0);
- EXPECT_FP_EQ(0.0f, __llvm_libc::tanf(0.0f));
+ EXPECT_FP_EQ(0.0f, LIBC_NAMESPACE::tanf(0.0f));
EXPECT_MATH_ERRNO(0);
- EXPECT_FP_EQ(-0.0f, __llvm_libc::tanf(-0.0f));
+ EXPECT_FP_EQ(-0.0f, LIBC_NAMESPACE::tanf(-0.0f));
EXPECT_MATH_ERRNO(0);
- EXPECT_FP_EQ(aNaN, __llvm_libc::tanf(inf));
+ EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::tanf(inf));
EXPECT_MATH_ERRNO(EDOM);
- EXPECT_FP_EQ(aNaN, __llvm_libc::tanf(neg_inf));
+ EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::tanf(neg_inf));
EXPECT_MATH_ERRNO(EDOM);
}
diff --git a/libc/test/src/math/smoke/tanhf_test.cpp b/libc/test/src/math/smoke/tanhf_test.cpp
index 0152de2f5ea04cc..db20be724b53f4a 100644
--- a/libc/test/src/math/smoke/tanhf_test.cpp
+++ b/libc/test/src/math/smoke/tanhf_test.cpp
@@ -16,25 +16,25 @@
#include <errno.h>
#include <stdint.h>
-using FPBits = __llvm_libc::fputil::FPBits<float>;
+using FPBits = LIBC_NAMESPACE::fputil::FPBits<float>;
DECLARE_SPECIAL_CONSTANTS(float)
TEST(LlvmLibcTanhfTest, SpecialNumbers) {
libc_errno = 0;
- EXPECT_FP_EQ(aNaN, __llvm_libc::tanhf(aNaN));
+ EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::tanhf(aNaN));
EXPECT_MATH_ERRNO(0);
- EXPECT_FP_EQ(0.0f, __llvm_libc::tanhf(0.0f));
+ EXPECT_FP_EQ(0.0f, LIBC_NAMESPACE::tanhf(0.0f));
EXPECT_MATH_ERRNO(0);
- EXPECT_FP_EQ(-0.0f, __llvm_libc::tanhf(-0.0f));
+ EXPECT_FP_EQ(-0.0f, LIBC_NAMESPACE::tanhf(-0.0f));
EXPECT_MATH_ERRNO(0);
- EXPECT_FP_EQ(1.0f, __llvm_libc::tanhf(inf));
+ EXPECT_FP_EQ(1.0f, LIBC_NAMESPACE::tanhf(inf));
EXPECT_MATH_ERRNO(0);
- EXPECT_FP_EQ(-1.0f, __llvm_libc::tanhf(neg_inf));
+ EXPECT_FP_EQ(-1.0f, LIBC_NAMESPACE::tanhf(neg_inf));
EXPECT_MATH_ERRNO(0);
}
diff --git a/libc/test/src/math/smoke/trunc_test.cpp b/libc/test/src/math/smoke/trunc_test.cpp
index f0a808dcb23684c..eb71f23e02f4b20 100644
--- a/libc/test/src/math/smoke/trunc_test.cpp
+++ b/libc/test/src/math/smoke/trunc_test.cpp
@@ -10,4 +10,4 @@
#include "src/math/trunc.h"
-LIST_TRUNC_TESTS(double, __llvm_libc::trunc)
+LIST_TRUNC_TESTS(double, LIBC_NAMESPACE::trunc)
diff --git a/libc/test/src/math/smoke/truncf_test.cpp b/libc/test/src/math/smoke/truncf_test.cpp
index cbd672cfe2e21ef..9a85b8274b0e5c1 100644
--- a/libc/test/src/math/smoke/truncf_test.cpp
+++ b/libc/test/src/math/smoke/truncf_test.cpp
@@ -10,4 +10,4 @@
#include "src/math/truncf.h"
-LIST_TRUNC_TESTS(float, __llvm_libc::truncf)
+LIST_TRUNC_TESTS(float, LIBC_NAMESPACE::truncf)
diff --git a/libc/test/src/math/smoke/truncl_test.cpp b/libc/test/src/math/smoke/truncl_test.cpp
index 0cf9ab8cd5575ba..d296bfe33cb077f 100644
--- a/libc/test/src/math/smoke/truncl_test.cpp
+++ b/libc/test/src/math/smoke/truncl_test.cpp
@@ -10,4 +10,4 @@
#include "src/math/truncl.h"
-LIST_TRUNC_TESTS(long double, __llvm_libc::truncl)
+LIST_TRUNC_TESTS(long double, LIBC_NAMESPACE::truncl)
diff --git a/libc/test/src/math/sqrt_test.cpp b/libc/test/src/math/sqrt_test.cpp
index 237264895bbd26b..1551b31d6f715fd 100644
--- a/libc/test/src/math/sqrt_test.cpp
+++ b/libc/test/src/math/sqrt_test.cpp
@@ -10,4 +10,4 @@
#include "src/math/sqrt.h"
-LIST_SQRT_TESTS(double, __llvm_libc::sqrt)
+LIST_SQRT_TESTS(double, LIBC_NAMESPACE::sqrt)
diff --git a/libc/test/src/math/sqrtf_test.cpp b/libc/test/src/math/sqrtf_test.cpp
index c7681d01569ae73..3f2e973325bd0f2 100644
--- a/libc/test/src/math/sqrtf_test.cpp
+++ b/libc/test/src/math/sqrtf_test.cpp
@@ -10,4 +10,4 @@
#include "src/math/sqrtf.h"
-LIST_SQRT_TESTS(float, __llvm_libc::sqrtf)
+LIST_SQRT_TESTS(float, LIBC_NAMESPACE::sqrtf)
diff --git a/libc/test/src/math/sqrtl_test.cpp b/libc/test/src/math/sqrtl_test.cpp
index c48ebb08444d051..f80bcfb73607824 100644
--- a/libc/test/src/math/sqrtl_test.cpp
+++ b/libc/test/src/math/sqrtl_test.cpp
@@ -10,4 +10,4 @@
#include "src/math/sqrtl.h"
-LIST_SQRT_TESTS(long double, __llvm_libc::sqrtl)
+LIST_SQRT_TESTS(long double, LIBC_NAMESPACE::sqrtl)
diff --git a/libc/test/src/math/tan_test.cpp b/libc/test/src/math/tan_test.cpp
index b22d49ef5f432ad..a6f7dcb4329303e 100644
--- a/libc/test/src/math/tan_test.cpp
+++ b/libc/test/src/math/tan_test.cpp
@@ -13,7 +13,7 @@
#include <math.h>
-namespace mpfr = __llvm_libc::testing::mpfr;
+namespace mpfr = LIBC_NAMESPACE::testing::mpfr;
DECLARE_SPECIAL_CONSTANTS(double)
@@ -27,6 +27,6 @@ TEST(LlvmLibctanTest, Range) {
if (isnan(x) || isinf(x) || x > _2pi || x < -_2pi)
continue;
- ASSERT_MPFR_MATCH(mpfr::Operation::Tan, x, __llvm_libc::tan(x), 1.0);
+ ASSERT_MPFR_MATCH(mpfr::Operation::Tan, x, LIBC_NAMESPACE::tan(x), 1.0);
}
}
diff --git a/libc/test/src/math/tanf_test.cpp b/libc/test/src/math/tanf_test.cpp
index 37a1bba68412ab5..3c3694a5eb68475 100644
--- a/libc/test/src/math/tanf_test.cpp
+++ b/libc/test/src/math/tanf_test.cpp
@@ -18,29 +18,29 @@
#include <errno.h>
#include <stdint.h>
-using __llvm_libc::testing::SDCOMP26094_VALUES;
-using FPBits = __llvm_libc::fputil::FPBits<float>;
+using LIBC_NAMESPACE::testing::SDCOMP26094_VALUES;
+using FPBits = LIBC_NAMESPACE::fputil::FPBits<float>;
-namespace mpfr = __llvm_libc::testing::mpfr;
+namespace mpfr = LIBC_NAMESPACE::testing::mpfr;
DECLARE_SPECIAL_CONSTANTS(float)
TEST(LlvmLibcTanfTest, SpecialNumbers) {
libc_errno = 0;
- EXPECT_FP_EQ(aNaN, __llvm_libc::tanf(aNaN));
+ EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::tanf(aNaN));
EXPECT_MATH_ERRNO(0);
- EXPECT_FP_EQ(0.0f, __llvm_libc::tanf(0.0f));
+ EXPECT_FP_EQ(0.0f, LIBC_NAMESPACE::tanf(0.0f));
EXPECT_MATH_ERRNO(0);
- EXPECT_FP_EQ(-0.0f, __llvm_libc::tanf(-0.0f));
+ EXPECT_FP_EQ(-0.0f, LIBC_NAMESPACE::tanf(-0.0f));
EXPECT_MATH_ERRNO(0);
- EXPECT_FP_EQ(aNaN, __llvm_libc::tanf(inf));
+ EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::tanf(inf));
EXPECT_MATH_ERRNO(EDOM);
- EXPECT_FP_EQ(aNaN, __llvm_libc::tanf(neg_inf));
+ EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::tanf(neg_inf));
EXPECT_MATH_ERRNO(EDOM);
}
@@ -52,7 +52,7 @@ TEST(LlvmLibcTanfTest, InFloatRange) {
if (isnan(x) || isinf(x))
continue;
ASSERT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Tan, x,
- __llvm_libc::tanf(x), 0.5);
+ LIBC_NAMESPACE::tanf(x), 0.5);
}
}
@@ -118,9 +118,9 @@ TEST(LlvmLibcTanfTest, SpecificBitPatterns) {
for (int i = 0; i < N; ++i) {
float x = float(FPBits(INPUTS[i]));
EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Tan, x,
- __llvm_libc::tanf(x), 0.5);
+ LIBC_NAMESPACE::tanf(x), 0.5);
EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Tan, -x,
- __llvm_libc::tanf(-x), 0.5);
+ LIBC_NAMESPACE::tanf(-x), 0.5);
}
}
@@ -129,6 +129,6 @@ TEST(LlvmLibcTanfTest, SpecificBitPatterns) {
TEST(LlvmLibcTanfTest, SDCOMP_26094) {
for (uint32_t v : SDCOMP26094_VALUES) {
float x = float(FPBits(v));
- ASSERT_MPFR_MATCH(mpfr::Operation::Tan, x, __llvm_libc::tanf(x), 0.5);
+ ASSERT_MPFR_MATCH(mpfr::Operation::Tan, x, LIBC_NAMESPACE::tanf(x), 0.5);
}
}
diff --git a/libc/test/src/math/tanhf_test.cpp b/libc/test/src/math/tanhf_test.cpp
index 07afe14a263d024..06ad02c3370940c 100644
--- a/libc/test/src/math/tanhf_test.cpp
+++ b/libc/test/src/math/tanhf_test.cpp
@@ -17,28 +17,28 @@
#include <errno.h>
#include <stdint.h>
-using FPBits = __llvm_libc::fputil::FPBits<float>;
+using FPBits = LIBC_NAMESPACE::fputil::FPBits<float>;
-namespace mpfr = __llvm_libc::testing::mpfr;
+namespace mpfr = LIBC_NAMESPACE::testing::mpfr;
DECLARE_SPECIAL_CONSTANTS(float)
TEST(LlvmLibcTanhfTest, SpecialNumbers) {
libc_errno = 0;
- EXPECT_FP_EQ(aNaN, __llvm_libc::tanhf(aNaN));
+ EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::tanhf(aNaN));
EXPECT_MATH_ERRNO(0);
- EXPECT_FP_EQ(0.0f, __llvm_libc::tanhf(0.0f));
+ EXPECT_FP_EQ(0.0f, LIBC_NAMESPACE::tanhf(0.0f));
EXPECT_MATH_ERRNO(0);
- EXPECT_FP_EQ(-0.0f, __llvm_libc::tanhf(-0.0f));
+ EXPECT_FP_EQ(-0.0f, LIBC_NAMESPACE::tanhf(-0.0f));
EXPECT_MATH_ERRNO(0);
- EXPECT_FP_EQ(1.0f, __llvm_libc::tanhf(inf));
+ EXPECT_FP_EQ(1.0f, LIBC_NAMESPACE::tanhf(inf));
EXPECT_MATH_ERRNO(0);
- EXPECT_FP_EQ(-1.0f, __llvm_libc::tanhf(neg_inf));
+ EXPECT_FP_EQ(-1.0f, LIBC_NAMESPACE::tanhf(neg_inf));
EXPECT_MATH_ERRNO(0);
}
@@ -50,7 +50,7 @@ TEST(LlvmLibcTanhfTest, InFloatRange) {
if (isnan(x) || isinf(x))
continue;
ASSERT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Tanh, x,
- __llvm_libc::tanhf(x), 0.5);
+ LIBC_NAMESPACE::tanhf(x), 0.5);
}
}
@@ -66,8 +66,8 @@ TEST(LlvmLibcTanhfTest, ExceptionalValues) {
for (int i = 0; i < N; ++i) {
float x = float(FPBits(INPUTS[i]));
EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Tanh, x,
- __llvm_libc::tanhf(x), 0.5);
+ LIBC_NAMESPACE::tanhf(x), 0.5);
EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Tanh, -x,
- __llvm_libc::tanhf(-x), 0.5);
+ LIBC_NAMESPACE::tanhf(-x), 0.5);
}
}
diff --git a/libc/test/src/math/trunc_test.cpp b/libc/test/src/math/trunc_test.cpp
index f0a808dcb23684c..eb71f23e02f4b20 100644
--- a/libc/test/src/math/trunc_test.cpp
+++ b/libc/test/src/math/trunc_test.cpp
@@ -10,4 +10,4 @@
#include "src/math/trunc.h"
-LIST_TRUNC_TESTS(double, __llvm_libc::trunc)
+LIST_TRUNC_TESTS(double, LIBC_NAMESPACE::trunc)
diff --git a/libc/test/src/math/truncf_test.cpp b/libc/test/src/math/truncf_test.cpp
index cbd672cfe2e21ef..9a85b8274b0e5c1 100644
--- a/libc/test/src/math/truncf_test.cpp
+++ b/libc/test/src/math/truncf_test.cpp
@@ -10,4 +10,4 @@
#include "src/math/truncf.h"
-LIST_TRUNC_TESTS(float, __llvm_libc::truncf)
+LIST_TRUNC_TESTS(float, LIBC_NAMESPACE::truncf)
diff --git a/libc/test/src/math/truncl_test.cpp b/libc/test/src/math/truncl_test.cpp
index 0cf9ab8cd5575ba..d296bfe33cb077f 100644
--- a/libc/test/src/math/truncl_test.cpp
+++ b/libc/test/src/math/truncl_test.cpp
@@ -10,4 +10,4 @@
#include "src/math/truncl.h"
-LIST_TRUNC_TESTS(long double, __llvm_libc::truncl)
+LIST_TRUNC_TESTS(long double, LIBC_NAMESPACE::truncl)
diff --git a/libc/test/src/network/htonl_test.cpp b/libc/test/src/network/htonl_test.cpp
index a8363d20d9767b9..d3b930d0b1ea24c 100644
--- a/libc/test/src/network/htonl_test.cpp
+++ b/libc/test/src/network/htonl_test.cpp
@@ -15,14 +15,14 @@ TEST(LlvmLibcHtonl, SmokeTest) {
uint32_t original = 0x67452301;
uint32_t swapped = 0x01234567;
#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
- EXPECT_EQ(__llvm_libc::htonl(original), swapped);
+ EXPECT_EQ(LIBC_NAMESPACE::htonl(original), swapped);
#endif
#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
- EXPECT_EQ(__llvm_libc::htonl(original), original);
+ EXPECT_EQ(LIBC_NAMESPACE::htonl(original), original);
#endif
}
TEST(LlvmLibcHtonl, CompleteTest) {
uint32_t original = 0x01234567;
- EXPECT_EQ(__llvm_libc::htonl(__llvm_libc::ntohl(original)), original);
+ EXPECT_EQ(LIBC_NAMESPACE::htonl(LIBC_NAMESPACE::ntohl(original)), original);
}
diff --git a/libc/test/src/network/htons_test.cpp b/libc/test/src/network/htons_test.cpp
index f9bd77bad25d872..d38fab8153b97c7 100644
--- a/libc/test/src/network/htons_test.cpp
+++ b/libc/test/src/network/htons_test.cpp
@@ -15,14 +15,14 @@ TEST(LlvmLibcHtons, SmokeTest) {
uint16_t original = 0x2301;
uint16_t swapped = 0x0123;
#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
- EXPECT_EQ(__llvm_libc::htons(original), swapped);
+ EXPECT_EQ(LIBC_NAMESPACE::htons(original), swapped);
#endif
#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
- EXPECT_EQ(__llvm_libc::htons(original), original);
+ EXPECT_EQ(LIBC_NAMESPACE::htons(original), original);
#endif
}
TEST(LlvmLibcHtons, CompleteTest) {
uint16_t original = 0x0123;
- EXPECT_EQ(__llvm_libc::htons(__llvm_libc::ntohs(original)), original);
+ EXPECT_EQ(LIBC_NAMESPACE::htons(LIBC_NAMESPACE::ntohs(original)), original);
}
diff --git a/libc/test/src/network/ntohl_test.cpp b/libc/test/src/network/ntohl_test.cpp
index bc52a97c8767203..b06f8e19e4f45bd 100644
--- a/libc/test/src/network/ntohl_test.cpp
+++ b/libc/test/src/network/ntohl_test.cpp
@@ -15,14 +15,14 @@ TEST(LlvmLibcNtohl, SmokeTest) {
uint32_t original = 0x67452301;
uint32_t swapped = 0x01234567;
#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
- EXPECT_EQ(__llvm_libc::ntohl(original), swapped);
+ EXPECT_EQ(LIBC_NAMESPACE::ntohl(original), swapped);
#endif
#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
- EXPECT_EQ(__llvm_libc::ntohl(original), original);
+ EXPECT_EQ(LIBC_NAMESPACE::ntohl(original), original);
#endif
}
TEST(LlvmLibcNtohl, CompleteTest) {
uint32_t original = 0x01234567;
- EXPECT_EQ(__llvm_libc::ntohl(__llvm_libc::htonl(original)), original);
+ EXPECT_EQ(LIBC_NAMESPACE::ntohl(LIBC_NAMESPACE::htonl(original)), original);
}
diff --git a/libc/test/src/network/ntohs_test.cpp b/libc/test/src/network/ntohs_test.cpp
index f10c2465539325c..654a39662ac9ce1 100644
--- a/libc/test/src/network/ntohs_test.cpp
+++ b/libc/test/src/network/ntohs_test.cpp
@@ -15,14 +15,14 @@ TEST(LlvmLibcNtohs, SmokeTest) {
uint16_t original = 0x2301;
uint16_t swapped = 0x0123;
#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
- EXPECT_EQ(__llvm_libc::ntohs(original), swapped);
+ EXPECT_EQ(LIBC_NAMESPACE::ntohs(original), swapped);
#endif
#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
- EXPECT_EQ(__llvm_libc::ntohs(original), original);
+ EXPECT_EQ(LIBC_NAMESPACE::ntohs(original), original);
#endif
}
TEST(LlvmLibcNtohs, CompleteTest) {
uint16_t original = 0x0123;
- EXPECT_EQ(__llvm_libc::ntohs(__llvm_libc::htons(original)), original);
+ EXPECT_EQ(LIBC_NAMESPACE::ntohs(LIBC_NAMESPACE::htons(original)), original);
}
diff --git a/libc/test/src/pthread/pthread_attr_test.cpp b/libc/test/src/pthread/pthread_attr_test.cpp
index af9f5d07f115530..1af585a003e3b0a 100644
--- a/libc/test/src/pthread/pthread_attr_test.cpp
+++ b/libc/test/src/pthread/pthread_attr_test.cpp
@@ -25,89 +25,95 @@
TEST(LlvmLibcPThreadAttrTest, InitAndDestroy) {
pthread_attr_t attr;
- ASSERT_EQ(__llvm_libc::pthread_attr_init(&attr), 0);
+ ASSERT_EQ(LIBC_NAMESPACE::pthread_attr_init(&attr), 0);
int detachstate;
- ASSERT_EQ(__llvm_libc::pthread_attr_getdetachstate(&attr, &detachstate), 0);
+ ASSERT_EQ(LIBC_NAMESPACE::pthread_attr_getdetachstate(&attr, &detachstate),
+ 0);
ASSERT_EQ(detachstate, int(PTHREAD_CREATE_JOINABLE));
size_t guardsize;
- ASSERT_EQ(__llvm_libc::pthread_attr_getguardsize(&attr, &guardsize), 0);
+ ASSERT_EQ(LIBC_NAMESPACE::pthread_attr_getguardsize(&attr, &guardsize), 0);
ASSERT_EQ(guardsize, size_t(EXEC_PAGESIZE));
- ASSERT_EQ(__llvm_libc::pthread_attr_destroy(&attr), 0);
+ ASSERT_EQ(LIBC_NAMESPACE::pthread_attr_destroy(&attr), 0);
}
TEST(LlvmLibcPThreadattrTest, SetAndGetDetachState) {
pthread_attr_t attr;
- ASSERT_EQ(__llvm_libc::pthread_attr_init(&attr), 0);
+ ASSERT_EQ(LIBC_NAMESPACE::pthread_attr_init(&attr), 0);
int detachstate;
- __llvm_libc::pthread_attr_getdetachstate(&attr, &detachstate);
+ LIBC_NAMESPACE::pthread_attr_getdetachstate(&attr, &detachstate);
ASSERT_EQ(detachstate, int(PTHREAD_CREATE_JOINABLE));
- ASSERT_EQ(
- __llvm_libc::pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED),
- 0);
- ASSERT_EQ(__llvm_libc::pthread_attr_getdetachstate(&attr, &detachstate), 0);
+ ASSERT_EQ(LIBC_NAMESPACE::pthread_attr_setdetachstate(
+ &attr, PTHREAD_CREATE_DETACHED),
+ 0);
+ ASSERT_EQ(LIBC_NAMESPACE::pthread_attr_getdetachstate(&attr, &detachstate),
+ 0);
ASSERT_EQ(detachstate, int(PTHREAD_CREATE_DETACHED));
- ASSERT_EQ(__llvm_libc::pthread_attr_setdetachstate(&attr, 0xBAD), EINVAL);
+ ASSERT_EQ(LIBC_NAMESPACE::pthread_attr_setdetachstate(&attr, 0xBAD), EINVAL);
- ASSERT_EQ(__llvm_libc::pthread_attr_destroy(&attr), 0);
+ ASSERT_EQ(LIBC_NAMESPACE::pthread_attr_destroy(&attr), 0);
}
TEST(LlvmLibcPThreadattrTest, SetAndGetGuardSize) {
pthread_attr_t attr;
- ASSERT_EQ(__llvm_libc::pthread_attr_init(&attr), 0);
+ ASSERT_EQ(LIBC_NAMESPACE::pthread_attr_init(&attr), 0);
size_t guardsize;
- ASSERT_EQ(__llvm_libc::pthread_attr_getguardsize(&attr, &guardsize), 0);
+ ASSERT_EQ(LIBC_NAMESPACE::pthread_attr_getguardsize(&attr, &guardsize), 0);
ASSERT_EQ(guardsize, size_t(EXEC_PAGESIZE));
- ASSERT_EQ(__llvm_libc::pthread_attr_setguardsize(&attr, 2 * EXEC_PAGESIZE),
+ ASSERT_EQ(LIBC_NAMESPACE::pthread_attr_setguardsize(&attr, 2 * EXEC_PAGESIZE),
0);
- ASSERT_EQ(__llvm_libc::pthread_attr_getguardsize(&attr, &guardsize), 0);
+ ASSERT_EQ(LIBC_NAMESPACE::pthread_attr_getguardsize(&attr, &guardsize), 0);
ASSERT_EQ(guardsize, size_t(2 * EXEC_PAGESIZE));
- ASSERT_EQ(__llvm_libc::pthread_attr_setguardsize(&attr, EXEC_PAGESIZE / 2),
+ ASSERT_EQ(LIBC_NAMESPACE::pthread_attr_setguardsize(&attr, EXEC_PAGESIZE / 2),
EINVAL);
- ASSERT_EQ(__llvm_libc::pthread_attr_destroy(&attr), 0);
+ ASSERT_EQ(LIBC_NAMESPACE::pthread_attr_destroy(&attr), 0);
}
TEST(LlvmLibcPThreadattrTest, SetAndGetStackSize) {
pthread_attr_t attr;
- ASSERT_EQ(__llvm_libc::pthread_attr_init(&attr), 0);
+ ASSERT_EQ(LIBC_NAMESPACE::pthread_attr_init(&attr), 0);
size_t stacksize;
ASSERT_EQ(
- __llvm_libc::pthread_attr_setstacksize(&attr, PTHREAD_STACK_MIN << 2), 0);
- ASSERT_EQ(__llvm_libc::pthread_attr_getstacksize(&attr, &stacksize), 0);
+ LIBC_NAMESPACE::pthread_attr_setstacksize(&attr, PTHREAD_STACK_MIN << 2),
+ 0);
+ ASSERT_EQ(LIBC_NAMESPACE::pthread_attr_getstacksize(&attr, &stacksize), 0);
ASSERT_EQ(stacksize, size_t(PTHREAD_STACK_MIN << 2));
ASSERT_EQ(
- __llvm_libc::pthread_attr_setstacksize(&attr, PTHREAD_STACK_MIN / 2),
+ LIBC_NAMESPACE::pthread_attr_setstacksize(&attr, PTHREAD_STACK_MIN / 2),
EINVAL);
- ASSERT_EQ(__llvm_libc::pthread_attr_destroy(&attr), 0);
+ ASSERT_EQ(LIBC_NAMESPACE::pthread_attr_destroy(&attr), 0);
}
TEST(LlvmLibcPThreadattrTest, SetAndGetStack) {
pthread_attr_t attr;
- ASSERT_EQ(__llvm_libc::pthread_attr_init(&attr), 0);
+ ASSERT_EQ(LIBC_NAMESPACE::pthread_attr_init(&attr), 0);
void *stack;
size_t stacksize;
ASSERT_EQ(
- __llvm_libc::pthread_attr_setstack(&attr, 0, PTHREAD_STACK_MIN << 2), 0);
- ASSERT_EQ(__llvm_libc::pthread_attr_getstack(&attr, &stack, &stacksize), 0);
+ LIBC_NAMESPACE::pthread_attr_setstack(&attr, 0, PTHREAD_STACK_MIN << 2),
+ 0);
+ ASSERT_EQ(LIBC_NAMESPACE::pthread_attr_getstack(&attr, &stack, &stacksize),
+ 0);
ASSERT_EQ(stacksize, size_t(PTHREAD_STACK_MIN << 2));
ASSERT_EQ(reinterpret_cast<uintptr_t>(stack), uintptr_t(0));
- ASSERT_EQ(__llvm_libc::pthread_attr_setstack(
+ ASSERT_EQ(LIBC_NAMESPACE::pthread_attr_setstack(
&attr, reinterpret_cast<void *>(1), PTHREAD_STACK_MIN << 2),
EINVAL);
- ASSERT_EQ(__llvm_libc::pthread_attr_setstack(&attr, 0, PTHREAD_STACK_MIN / 2),
- EINVAL);
+ ASSERT_EQ(
+ LIBC_NAMESPACE::pthread_attr_setstack(&attr, 0, PTHREAD_STACK_MIN / 2),
+ EINVAL);
- ASSERT_EQ(__llvm_libc::pthread_attr_destroy(&attr), 0);
+ ASSERT_EQ(LIBC_NAMESPACE::pthread_attr_destroy(&attr), 0);
}
diff --git a/libc/test/src/pthread/pthread_mutexattr_test.cpp b/libc/test/src/pthread/pthread_mutexattr_test.cpp
index 3ecbc4f5896a465..a7acd580a6b8e55 100644
--- a/libc/test/src/pthread/pthread_mutexattr_test.cpp
+++ b/libc/test/src/pthread/pthread_mutexattr_test.cpp
@@ -21,71 +21,72 @@
TEST(LlvmLibcPThreadMutexAttrTest, InitAndDestroy) {
pthread_mutexattr_t attr;
- ASSERT_EQ(__llvm_libc::pthread_mutexattr_init(&attr), 0);
- ASSERT_EQ(__llvm_libc::pthread_mutexattr_destroy(&attr), 0);
+ ASSERT_EQ(LIBC_NAMESPACE::pthread_mutexattr_init(&attr), 0);
+ ASSERT_EQ(LIBC_NAMESPACE::pthread_mutexattr_destroy(&attr), 0);
}
TEST(LlvmLibcPThreadMutexAttrTest, SetAndGetType) {
int type;
pthread_mutexattr_t attr;
- ASSERT_EQ(__llvm_libc::pthread_mutexattr_init(&attr), 0);
- ASSERT_EQ(__llvm_libc::pthread_mutexattr_gettype(&attr, &type), 0);
+ ASSERT_EQ(LIBC_NAMESPACE::pthread_mutexattr_init(&attr), 0);
+ ASSERT_EQ(LIBC_NAMESPACE::pthread_mutexattr_gettype(&attr, &type), 0);
ASSERT_EQ(type, int(PTHREAD_MUTEX_DEFAULT));
ASSERT_EQ(
- __llvm_libc::pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE),
+ LIBC_NAMESPACE::pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE),
0);
- ASSERT_EQ(__llvm_libc::pthread_mutexattr_gettype(&attr, &type), 0);
+ ASSERT_EQ(LIBC_NAMESPACE::pthread_mutexattr_gettype(&attr, &type), 0);
ASSERT_EQ(type, int(PTHREAD_MUTEX_RECURSIVE));
- ASSERT_EQ(
- __llvm_libc::pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_ERRORCHECK),
- 0);
- ASSERT_EQ(__llvm_libc::pthread_mutexattr_gettype(&attr, &type), 0);
+ ASSERT_EQ(LIBC_NAMESPACE::pthread_mutexattr_settype(&attr,
+ PTHREAD_MUTEX_ERRORCHECK),
+ 0);
+ ASSERT_EQ(LIBC_NAMESPACE::pthread_mutexattr_gettype(&attr, &type), 0);
ASSERT_EQ(type, int(PTHREAD_MUTEX_ERRORCHECK));
- ASSERT_EQ(__llvm_libc::pthread_mutexattr_settype(&attr, 0xBAD), EINVAL);
+ ASSERT_EQ(LIBC_NAMESPACE::pthread_mutexattr_settype(&attr, 0xBAD), EINVAL);
}
TEST(LlvmLibcPThreadMutexAttrTest, SetAndGetRobust) {
int robust;
pthread_mutexattr_t attr;
- ASSERT_EQ(__llvm_libc::pthread_mutexattr_init(&attr), 0);
- ASSERT_EQ(__llvm_libc::pthread_mutexattr_getrobust(&attr, &robust), 0);
+ ASSERT_EQ(LIBC_NAMESPACE::pthread_mutexattr_init(&attr), 0);
+ ASSERT_EQ(LIBC_NAMESPACE::pthread_mutexattr_getrobust(&attr, &robust), 0);
ASSERT_EQ(robust, int(PTHREAD_MUTEX_STALLED));
ASSERT_EQ(
- __llvm_libc::pthread_mutexattr_setrobust(&attr, PTHREAD_MUTEX_ROBUST), 0);
- ASSERT_EQ(__llvm_libc::pthread_mutexattr_getrobust(&attr, &robust), 0);
+ LIBC_NAMESPACE::pthread_mutexattr_setrobust(&attr, PTHREAD_MUTEX_ROBUST),
+ 0);
+ ASSERT_EQ(LIBC_NAMESPACE::pthread_mutexattr_getrobust(&attr, &robust), 0);
ASSERT_EQ(robust, int(PTHREAD_MUTEX_ROBUST));
ASSERT_EQ(
- __llvm_libc::pthread_mutexattr_setrobust(&attr, PTHREAD_MUTEX_STALLED),
+ LIBC_NAMESPACE::pthread_mutexattr_setrobust(&attr, PTHREAD_MUTEX_STALLED),
0);
- ASSERT_EQ(__llvm_libc::pthread_mutexattr_getrobust(&attr, &robust), 0);
+ ASSERT_EQ(LIBC_NAMESPACE::pthread_mutexattr_getrobust(&attr, &robust), 0);
ASSERT_EQ(robust, int(PTHREAD_MUTEX_STALLED));
- ASSERT_EQ(__llvm_libc::pthread_mutexattr_setrobust(&attr, 0xBAD), EINVAL);
+ ASSERT_EQ(LIBC_NAMESPACE::pthread_mutexattr_setrobust(&attr, 0xBAD), EINVAL);
}
TEST(LlvmLibcPThreadMutexAttrTest, SetAndGetPShared) {
int pshared;
pthread_mutexattr_t attr;
- ASSERT_EQ(__llvm_libc::pthread_mutexattr_init(&attr), 0);
- ASSERT_EQ(__llvm_libc::pthread_mutexattr_getpshared(&attr, &pshared), 0);
+ ASSERT_EQ(LIBC_NAMESPACE::pthread_mutexattr_init(&attr), 0);
+ ASSERT_EQ(LIBC_NAMESPACE::pthread_mutexattr_getpshared(&attr, &pshared), 0);
ASSERT_EQ(pshared, int(PTHREAD_PROCESS_PRIVATE));
- ASSERT_EQ(
- __llvm_libc::pthread_mutexattr_setpshared(&attr, PTHREAD_PROCESS_SHARED),
- 0);
- ASSERT_EQ(__llvm_libc::pthread_mutexattr_getpshared(&attr, &pshared), 0);
+ ASSERT_EQ(LIBC_NAMESPACE::pthread_mutexattr_setpshared(
+ &attr, PTHREAD_PROCESS_SHARED),
+ 0);
+ ASSERT_EQ(LIBC_NAMESPACE::pthread_mutexattr_getpshared(&attr, &pshared), 0);
ASSERT_EQ(pshared, int(PTHREAD_PROCESS_SHARED));
- ASSERT_EQ(
- __llvm_libc::pthread_mutexattr_setpshared(&attr, PTHREAD_PROCESS_PRIVATE),
- 0);
- ASSERT_EQ(__llvm_libc::pthread_mutexattr_getpshared(&attr, &pshared), 0);
+ ASSERT_EQ(LIBC_NAMESPACE::pthread_mutexattr_setpshared(
+ &attr, PTHREAD_PROCESS_PRIVATE),
+ 0);
+ ASSERT_EQ(LIBC_NAMESPACE::pthread_mutexattr_getpshared(&attr, &pshared), 0);
ASSERT_EQ(pshared, int(PTHREAD_PROCESS_PRIVATE));
- ASSERT_EQ(__llvm_libc::pthread_mutexattr_setpshared(&attr, 0xBAD), EINVAL);
+ ASSERT_EQ(LIBC_NAMESPACE::pthread_mutexattr_setpshared(&attr, 0xBAD), EINVAL);
}
diff --git a/libc/test/src/sched/affinity_test.cpp b/libc/test/src/sched/affinity_test.cpp
index ca2821bc2bafefe..38433edecbd0c06 100644
--- a/libc/test/src/sched/affinity_test.cpp
+++ b/libc/test/src/sched/affinity_test.cpp
@@ -18,27 +18,29 @@
TEST(LlvmLibcSchedAffinityTest, SmokeTest) {
cpu_set_t mask;
libc_errno = 0;
- using __llvm_libc::testing::ErrnoSetterMatcher::Succeeds;
- pid_t tid = __llvm_libc::syscall_impl<pid_t>(SYS_gettid);
+ using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds;
+ pid_t tid = LIBC_NAMESPACE::syscall_impl<pid_t>(SYS_gettid);
ASSERT_GT(tid, pid_t(0));
// We just get and set the same mask.
- ASSERT_THAT(__llvm_libc::sched_getaffinity(tid, sizeof(cpu_set_t), &mask),
+ ASSERT_THAT(LIBC_NAMESPACE::sched_getaffinity(tid, sizeof(cpu_set_t), &mask),
Succeeds(0));
- ASSERT_THAT(__llvm_libc::sched_setaffinity(tid, sizeof(cpu_set_t), &mask),
+ ASSERT_THAT(LIBC_NAMESPACE::sched_setaffinity(tid, sizeof(cpu_set_t), &mask),
Succeeds(0));
}
TEST(LlvmLibcSchedAffinityTest, BadMask) {
- using __llvm_libc::testing::ErrnoSetterMatcher::Fails;
- pid_t tid = __llvm_libc::syscall_impl<pid_t>(SYS_gettid);
+ using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails;
+ pid_t tid = LIBC_NAMESPACE::syscall_impl<pid_t>(SYS_gettid);
libc_errno = 0;
- ASSERT_THAT(__llvm_libc::sched_getaffinity(tid, sizeof(cpu_set_t), nullptr),
- Fails(EFAULT));
+ ASSERT_THAT(
+ LIBC_NAMESPACE::sched_getaffinity(tid, sizeof(cpu_set_t), nullptr),
+ Fails(EFAULT));
libc_errno = 0;
- ASSERT_THAT(__llvm_libc::sched_setaffinity(tid, sizeof(cpu_set_t), nullptr),
- Fails(EFAULT));
+ ASSERT_THAT(
+ LIBC_NAMESPACE::sched_setaffinity(tid, sizeof(cpu_set_t), nullptr),
+ Fails(EFAULT));
libc_errno = 0;
}
diff --git a/libc/test/src/sched/cpu_count_test.cpp b/libc/test/src/sched/cpu_count_test.cpp
index 4c047779baed524..ca3e80818a5c149 100644
--- a/libc/test/src/sched/cpu_count_test.cpp
+++ b/libc/test/src/sched/cpu_count_test.cpp
@@ -18,15 +18,15 @@
TEST(LlvmLibcSchedCpuCountTest, SmokeTest) {
cpu_set_t mask;
libc_errno = 0;
- using __llvm_libc::testing::ErrnoSetterMatcher::Succeeds;
- pid_t tid = __llvm_libc::syscall_impl<pid_t>(SYS_gettid);
+ using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds;
+ pid_t tid = LIBC_NAMESPACE::syscall_impl<pid_t>(SYS_gettid);
ASSERT_GT(tid, pid_t(0));
- ASSERT_THAT(__llvm_libc::sched_getaffinity(tid, sizeof(cpu_set_t), &mask),
+ ASSERT_THAT(LIBC_NAMESPACE::sched_getaffinity(tid, sizeof(cpu_set_t), &mask),
Succeeds(0));
// CPU_COUNT is a macro, but it expands to an LLVM-libc internal function that
// needs to be in the appropriate namespace for the test.
- int num_cpus = __llvm_libc::CPU_COUNT(&mask);
+ int num_cpus = LIBC_NAMESPACE::CPU_COUNT(&mask);
ASSERT_GT(num_cpus, 0);
ASSERT_LE(num_cpus, int(sizeof(cpu_set_t) * sizeof(unsigned long)));
}
diff --git a/libc/test/src/sched/get_priority_test.cpp b/libc/test/src/sched/get_priority_test.cpp
index 15ee958ec16f44f..3a79a67802cf3e9 100644
--- a/libc/test/src/sched/get_priority_test.cpp
+++ b/libc/test/src/sched/get_priority_test.cpp
@@ -18,40 +18,40 @@ TEST(LlvmLibcSchedGetPriorityTest, HandleBadPolicyTest) {
// Test arbitrary values for which there is no policy.
{
int policy = -1;
- int max_priority = __llvm_libc::sched_get_priority_max(policy);
+ int max_priority = LIBC_NAMESPACE::sched_get_priority_max(policy);
ASSERT_EQ(max_priority, -1);
ASSERT_EQ(libc_errno, EINVAL);
- int min_priority = __llvm_libc::sched_get_priority_min(policy);
+ int min_priority = LIBC_NAMESPACE::sched_get_priority_min(policy);
ASSERT_EQ(min_priority, -1);
ASSERT_EQ(libc_errno, EINVAL);
}
{
int policy = 30;
- int max_priority = __llvm_libc::sched_get_priority_max(policy);
+ int max_priority = LIBC_NAMESPACE::sched_get_priority_max(policy);
ASSERT_EQ(max_priority, -1);
ASSERT_EQ(libc_errno, EINVAL);
- int min_priority = __llvm_libc::sched_get_priority_min(policy);
+ int min_priority = LIBC_NAMESPACE::sched_get_priority_min(policy);
ASSERT_EQ(min_priority, -1);
ASSERT_EQ(libc_errno, EINVAL);
}
{
int policy = 80;
- int max_priority = __llvm_libc::sched_get_priority_max(policy);
+ int max_priority = LIBC_NAMESPACE::sched_get_priority_max(policy);
ASSERT_EQ(max_priority, -1);
ASSERT_EQ(libc_errno, EINVAL);
- int min_priority = __llvm_libc::sched_get_priority_min(policy);
+ int min_priority = LIBC_NAMESPACE::sched_get_priority_min(policy);
ASSERT_EQ(min_priority, -1);
ASSERT_EQ(libc_errno, EINVAL);
}
{
int policy = 110;
- int max_priority = __llvm_libc::sched_get_priority_max(policy);
+ int max_priority = LIBC_NAMESPACE::sched_get_priority_max(policy);
ASSERT_EQ(max_priority, -1);
ASSERT_EQ(libc_errno, EINVAL);
- int min_priority = __llvm_libc::sched_get_priority_min(policy);
+ int min_priority = LIBC_NAMESPACE::sched_get_priority_min(policy);
ASSERT_EQ(min_priority, -1);
ASSERT_EQ(libc_errno, EINVAL);
}
@@ -66,10 +66,10 @@ TEST(LlvmLibcSchedGetPriorityTest, SmokeTest) {
// SCHED_BATCH, SCHED_ISO, SCHED_IDLE, SCHED_DEADLINE
{
int policy = SCHED_OTHER;
- int max_priority = __llvm_libc::sched_get_priority_max(policy);
+ int max_priority = LIBC_NAMESPACE::sched_get_priority_max(policy);
ASSERT_GE(max_priority, 0);
ASSERT_EQ(libc_errno, 0);
- int min_priority = __llvm_libc::sched_get_priority_min(policy);
+ int min_priority = LIBC_NAMESPACE::sched_get_priority_min(policy);
ASSERT_GE(min_priority, 0);
ASSERT_EQ(libc_errno, 0);
@@ -80,10 +80,10 @@ TEST(LlvmLibcSchedGetPriorityTest, SmokeTest) {
{
int policy = SCHED_FIFO;
- int max_priority = __llvm_libc::sched_get_priority_max(policy);
+ int max_priority = LIBC_NAMESPACE::sched_get_priority_max(policy);
ASSERT_GE(max_priority, 0);
ASSERT_EQ(libc_errno, 0);
- int min_priority = __llvm_libc::sched_get_priority_min(policy);
+ int min_priority = LIBC_NAMESPACE::sched_get_priority_min(policy);
ASSERT_GE(min_priority, 0);
ASSERT_EQ(libc_errno, 0);
@@ -94,10 +94,10 @@ TEST(LlvmLibcSchedGetPriorityTest, SmokeTest) {
{
int policy = SCHED_RR;
- int max_priority = __llvm_libc::sched_get_priority_max(policy);
+ int max_priority = LIBC_NAMESPACE::sched_get_priority_max(policy);
ASSERT_GE(max_priority, 0);
ASSERT_EQ(libc_errno, 0);
- int min_priority = __llvm_libc::sched_get_priority_min(policy);
+ int min_priority = LIBC_NAMESPACE::sched_get_priority_min(policy);
ASSERT_GE(min_priority, 0);
ASSERT_EQ(libc_errno, 0);
diff --git a/libc/test/src/sched/param_and_scheduler_test.cpp b/libc/test/src/sched/param_and_scheduler_test.cpp
index 2c5745432f579a2..8c6485f07897125 100644
--- a/libc/test/src/sched/param_and_scheduler_test.cpp
+++ b/libc/test/src/sched/param_and_scheduler_test.cpp
@@ -34,46 +34,46 @@
// Linux specific test could also include:
// SCHED_ISO, SCHED_DEADLINE
-class SchedTest : public __llvm_libc::testing::Test {
+class SchedTest : public LIBC_NAMESPACE::testing::Test {
public:
void testSched(int policy, bool can_set) {
libc_errno = 0;
- int init_policy = __llvm_libc::sched_getscheduler(0);
+ int init_policy = LIBC_NAMESPACE::sched_getscheduler(0);
ASSERT_GE(init_policy, 0);
ASSERT_EQ(libc_errno, 0);
- int max_priority = __llvm_libc::sched_get_priority_max(policy);
+ int max_priority = LIBC_NAMESPACE::sched_get_priority_max(policy);
ASSERT_GE(max_priority, 0);
ASSERT_EQ(libc_errno, 0);
- int min_priority = __llvm_libc::sched_get_priority_min(policy);
+ int min_priority = LIBC_NAMESPACE::sched_get_priority_min(policy);
ASSERT_GE(min_priority, 0);
ASSERT_EQ(libc_errno, 0);
struct sched_param param = {min_priority};
// Negative pid
- ASSERT_EQ(__llvm_libc::sched_setscheduler(-1, policy, ¶m), -1);
+ ASSERT_EQ(LIBC_NAMESPACE::sched_setscheduler(-1, policy, ¶m), -1);
ASSERT_EQ(libc_errno, EINVAL);
libc_errno = 0;
- ASSERT_EQ(__llvm_libc::sched_getscheduler(-1), -1);
+ ASSERT_EQ(LIBC_NAMESPACE::sched_getscheduler(-1), -1);
ASSERT_EQ(libc_errno, EINVAL);
libc_errno = 0;
// Invalid Policy
- ASSERT_EQ(__llvm_libc::sched_setscheduler(0, policy | 128, ¶m), -1);
+ ASSERT_EQ(LIBC_NAMESPACE::sched_setscheduler(0, policy | 128, ¶m), -1);
ASSERT_EQ(libc_errno, EINVAL);
libc_errno = 0;
// Out of bounds priority
param.sched_priority = min_priority - 1;
- ASSERT_EQ(__llvm_libc::sched_setscheduler(0, policy, ¶m), -1);
+ ASSERT_EQ(LIBC_NAMESPACE::sched_setscheduler(0, policy, ¶m), -1);
ASSERT_EQ(libc_errno, EINVAL);
libc_errno = 0;
param.sched_priority = max_priority + 1;
- ASSERT_EQ(__llvm_libc::sched_setscheduler(0, policy, ¶m), -1);
+ ASSERT_EQ(LIBC_NAMESPACE::sched_setscheduler(0, policy, ¶m), -1);
// A bit hard to test as depending if we are root or not we can run into
// different issues.
ASSERT_TRUE(libc_errno == EINVAL || libc_errno == EPERM);
@@ -82,57 +82,57 @@ class SchedTest : public __llvm_libc::testing::Test {
// Some sched policies require permissions, so skip
param.sched_priority = min_priority;
// Success / missing permissions.
- ASSERT_EQ(__llvm_libc::sched_setscheduler(0, policy, ¶m),
+ ASSERT_EQ(LIBC_NAMESPACE::sched_setscheduler(0, policy, ¶m),
can_set ? 0 : -1);
ASSERT_TRUE(can_set ? (libc_errno == 0)
: (libc_errno == EINVAL || libc_errno == EPERM));
libc_errno = 0;
- ASSERT_EQ(__llvm_libc::sched_getscheduler(0),
+ ASSERT_EQ(LIBC_NAMESPACE::sched_getscheduler(0),
can_set ? policy : init_policy);
ASSERT_EQ(libc_errno, 0);
// Out of bounds priority
param.sched_priority = -1;
- ASSERT_EQ(__llvm_libc::sched_setparam(0, ¶m), -1);
+ ASSERT_EQ(LIBC_NAMESPACE::sched_setparam(0, ¶m), -1);
ASSERT_EQ(libc_errno, EINVAL);
libc_errno = 0;
param.sched_priority = max_priority + 1;
- ASSERT_EQ(__llvm_libc::sched_setparam(0, ¶m), -1);
+ ASSERT_EQ(LIBC_NAMESPACE::sched_setparam(0, ¶m), -1);
ASSERT_EQ(libc_errno, EINVAL);
libc_errno = 0;
for (int priority = min_priority; priority <= max_priority; ++priority) {
- ASSERT_EQ(__llvm_libc::sched_getparam(0, ¶m), 0);
+ ASSERT_EQ(LIBC_NAMESPACE::sched_getparam(0, ¶m), 0);
ASSERT_EQ(libc_errno, 0);
int init_priority = param.sched_priority;
param.sched_priority = priority;
// Negative pid
- ASSERT_EQ(__llvm_libc::sched_setparam(-1, ¶m), -1);
+ ASSERT_EQ(LIBC_NAMESPACE::sched_setparam(-1, ¶m), -1);
ASSERT_EQ(libc_errno, EINVAL);
libc_errno = 0;
- ASSERT_EQ(__llvm_libc::sched_getparam(-1, ¶m), -1);
+ ASSERT_EQ(LIBC_NAMESPACE::sched_getparam(-1, ¶m), -1);
ASSERT_EQ(libc_errno, EINVAL);
libc_errno = 0;
// Success / missing permissions
- ASSERT_EQ(__llvm_libc::sched_setparam(0, ¶m), can_set ? 0 : -1);
+ ASSERT_EQ(LIBC_NAMESPACE::sched_setparam(0, ¶m), can_set ? 0 : -1);
ASSERT_TRUE(can_set ? (libc_errno == 0)
: (libc_errno == EINVAL || libc_errno == EPERM));
libc_errno = 0;
- ASSERT_EQ(__llvm_libc::sched_getparam(0, ¶m), 0);
+ ASSERT_EQ(LIBC_NAMESPACE::sched_getparam(0, ¶m), 0);
ASSERT_EQ(libc_errno, 0);
ASSERT_EQ(param.sched_priority, can_set ? priority : init_priority);
}
// Null test
- ASSERT_EQ(__llvm_libc::sched_setscheduler(0, policy, nullptr), -1);
+ ASSERT_EQ(LIBC_NAMESPACE::sched_setscheduler(0, policy, nullptr), -1);
ASSERT_EQ(libc_errno, EINVAL);
libc_errno = 0;
}
@@ -143,8 +143,8 @@ class SchedTest : public __llvm_libc::testing::Test {
TEST_F(LlvmLibcSchedTest, Sched_##policy) { testSched(policy, can_set); }
// Root is required to set these policies.
-LIST_SCHED_TESTS(SCHED_FIFO, __llvm_libc::getuid() == 0)
-LIST_SCHED_TESTS(SCHED_RR, __llvm_libc::getuid() == 0)
+LIST_SCHED_TESTS(SCHED_FIFO, LIBC_NAMESPACE::getuid() == 0)
+LIST_SCHED_TESTS(SCHED_RR, LIBC_NAMESPACE::getuid() == 0)
// No root is required to set these policies.
LIST_SCHED_TESTS(SCHED_OTHER, true)
@@ -154,11 +154,11 @@ LIST_SCHED_TESTS(SCHED_IDLE, true)
TEST(LlvmLibcSchedParamAndSchedulerTest, NullParamTest) {
libc_errno = 0;
- ASSERT_EQ(__llvm_libc::sched_setparam(0, nullptr), -1);
+ ASSERT_EQ(LIBC_NAMESPACE::sched_setparam(0, nullptr), -1);
ASSERT_EQ(libc_errno, EINVAL);
libc_errno = 0;
- ASSERT_EQ(__llvm_libc::sched_getparam(0, nullptr), -1);
+ ASSERT_EQ(LIBC_NAMESPACE::sched_getparam(0, nullptr), -1);
ASSERT_EQ(libc_errno, EINVAL);
libc_errno = 0;
}
diff --git a/libc/test/src/sched/sched_rr_get_interval_test.cpp b/libc/test/src/sched/sched_rr_get_interval_test.cpp
index 160ccd5025967e3..100100079504165 100644
--- a/libc/test/src/sched/sched_rr_get_interval_test.cpp
+++ b/libc/test/src/sched/sched_rr_get_interval_test.cpp
@@ -19,12 +19,12 @@
TEST(LlvmLibcSchedRRGetIntervalTest, SmokeTest) {
libc_errno = 0;
auto SetSched = [&](int policy) {
- int min_priority = __llvm_libc::sched_get_priority_min(policy);
+ int min_priority = LIBC_NAMESPACE::sched_get_priority_min(policy);
ASSERT_GE(min_priority, 0);
ASSERT_EQ(libc_errno, 0);
struct sched_param param;
param.sched_priority = min_priority;
- ASSERT_EQ(__llvm_libc::sched_setscheduler(0, policy, ¶m), 0);
+ ASSERT_EQ(LIBC_NAMESPACE::sched_setscheduler(0, policy, ¶m), 0);
ASSERT_EQ(libc_errno, 0);
};
@@ -36,17 +36,17 @@ TEST(LlvmLibcSchedRRGetIntervalTest, SmokeTest) {
struct timespec ts;
// We can only set SCHED_RR with CAP_SYS_ADMIN
- if (__llvm_libc::getuid() == 0)
+ if (LIBC_NAMESPACE::getuid() == 0)
SetSched(SCHED_RR);
- int cur_policy = __llvm_libc::sched_getscheduler(0);
+ int cur_policy = LIBC_NAMESPACE::sched_getscheduler(0);
ASSERT_GE(cur_policy, 0);
ASSERT_EQ(libc_errno, 0);
// We can actually run meaningful tests.
if (cur_policy == SCHED_RR) {
// Success
- ASSERT_EQ(__llvm_libc::sched_rr_get_interval(0, &ts), 0);
+ ASSERT_EQ(LIBC_NAMESPACE::sched_rr_get_interval(0, &ts), 0);
ASSERT_EQ(libc_errno, 0);
// Check that numbers make sense (liberal bound of 10ns - 30sec)
@@ -56,19 +56,19 @@ TEST(LlvmLibcSchedRRGetIntervalTest, SmokeTest) {
ASSERT_LT(TimespecToNs(ts), thirstyS);
// Null timespec
- ASSERT_EQ(__llvm_libc::sched_rr_get_interval(0, nullptr), -1);
+ ASSERT_EQ(LIBC_NAMESPACE::sched_rr_get_interval(0, nullptr), -1);
ASSERT_EQ(libc_errno, EFAULT);
libc_errno = 0;
// Negative pid
- ASSERT_EQ(__llvm_libc::sched_rr_get_interval(-1, &ts), -1);
+ ASSERT_EQ(LIBC_NAMESPACE::sched_rr_get_interval(-1, &ts), -1);
ASSERT_EQ(libc_errno, EINVAL);
libc_errno = 0;
}
// Negative tests don't have SCHED_RR set
SetSched(SCHED_OTHER);
- ASSERT_EQ(__llvm_libc::sched_rr_get_interval(0, &ts), 0);
+ ASSERT_EQ(LIBC_NAMESPACE::sched_rr_get_interval(0, &ts), 0);
ASSERT_EQ(libc_errno, 0);
libc_errno = 0;
diff --git a/libc/test/src/sched/yield_test.cpp b/libc/test/src/sched/yield_test.cpp
index ffa7f667cadffb8..45b7a7d2d81e47a 100644
--- a/libc/test/src/sched/yield_test.cpp
+++ b/libc/test/src/sched/yield_test.cpp
@@ -14,6 +14,6 @@ TEST(LlvmLibcSchedYieldTest, SmokeTest) {
libc_errno = 0;
// sched_yield() always succeeds, just do a basic test that errno/ret are
// properly 0.
- ASSERT_EQ(__llvm_libc::sched_yield(), 0);
+ ASSERT_EQ(LIBC_NAMESPACE::sched_yield(), 0);
ASSERT_EQ(libc_errno, 0);
}
diff --git a/libc/test/src/setjmp/setjmp_test.cpp b/libc/test/src/setjmp/setjmp_test.cpp
index 3a8e22a68deda34..9e5f74a1734b353 100644
--- a/libc/test/src/setjmp/setjmp_test.cpp
+++ b/libc/test/src/setjmp/setjmp_test.cpp
@@ -15,7 +15,7 @@ int longjmp_called = 0;
void jump_back(jmp_buf buf, int n) {
longjmp_called++;
- __llvm_libc::longjmp(buf, n); // Will return |n| out of setjmp
+ LIBC_NAMESPACE::longjmp(buf, n); // Will return |n| out of setjmp
}
TEST(LlvmLibcSetJmpTest, SetAndJumpBack) {
@@ -26,7 +26,7 @@ TEST(LlvmLibcSetJmpTest, SetAndJumpBack) {
volatile int n = 0;
// The first time setjmp is called, it should return 0.
// Subsequent calls will return the value passed to jump_back below.
- if (__llvm_libc::setjmp(buf) <= MAX_LOOP) {
+ if (LIBC_NAMESPACE::setjmp(buf) <= MAX_LOOP) {
++n;
jump_back(buf, n);
}
@@ -38,7 +38,7 @@ TEST(LlvmLibcSetJmpTest, SetAndJumpBackValOne) {
jmp_buf buf;
longjmp_called = 0;
- int val = __llvm_libc::setjmp(buf);
+ int val = LIBC_NAMESPACE::setjmp(buf);
if (val == 0)
jump_back(buf, val);
diff --git a/libc/test/src/signal/kill_test.cpp b/libc/test/src/signal/kill_test.cpp
index ea98724dd09682e..2033543c97a2b49 100644
--- a/libc/test/src/signal/kill_test.cpp
+++ b/libc/test/src/signal/kill_test.cpp
@@ -15,16 +15,16 @@
#include <signal.h>
#include <sys/syscall.h> // For syscall numbers.
-using __llvm_libc::testing::ErrnoSetterMatcher::Succeeds;
+using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds;
TEST(LlvmLibcKillTest, TargetSelf) {
- pid_t parent_pid = __llvm_libc::syscall_impl<pid_t>(SYS_getpid);
- ASSERT_THAT(__llvm_libc::kill(parent_pid, 0), Succeeds(0));
+ pid_t parent_pid = LIBC_NAMESPACE::syscall_impl<pid_t>(SYS_getpid);
+ ASSERT_THAT(LIBC_NAMESPACE::kill(parent_pid, 0), Succeeds(0));
EXPECT_DEATH(
[] {
- pid_t child_pid = __llvm_libc::syscall_impl<pid_t>(SYS_getpid);
- __llvm_libc::kill(child_pid, SIGKILL);
+ pid_t child_pid = LIBC_NAMESPACE::syscall_impl<pid_t>(SYS_getpid);
+ LIBC_NAMESPACE::kill(child_pid, SIGKILL);
},
WITH_SIGNAL(SIGKILL));
}
diff --git a/libc/test/src/signal/raise_test.cpp b/libc/test/src/signal/raise_test.cpp
index 080541ff2445a09..a114ac5e8379c86 100644
--- a/libc/test/src/signal/raise_test.cpp
+++ b/libc/test/src/signal/raise_test.cpp
@@ -15,9 +15,9 @@
TEST(LlvmLibcSignalTest, Raise) {
// SIGCONT is ingored unless stopped, so we can use it to check the return
// value of raise without needing to block.
- EXPECT_EQ(__llvm_libc::raise(SIGCONT), 0);
+ EXPECT_EQ(LIBC_NAMESPACE::raise(SIGCONT), 0);
// SIGKILL is chosen because other fatal signals could be caught by sanitizers
// for example and incorrectly report test failure.
- EXPECT_DEATH([] { __llvm_libc::raise(SIGKILL); }, WITH_SIGNAL(SIGKILL));
+ EXPECT_DEATH([] { LIBC_NAMESPACE::raise(SIGKILL); }, WITH_SIGNAL(SIGKILL));
}
diff --git a/libc/test/src/signal/sigaction_test.cpp b/libc/test/src/signal/sigaction_test.cpp
index 36160f9a37cef47..262469c7600e3fc 100644
--- a/libc/test/src/signal/sigaction_test.cpp
+++ b/libc/test/src/signal/sigaction_test.cpp
@@ -15,19 +15,20 @@
#include <errno.h>
#include <signal.h>
-using __llvm_libc::testing::ErrnoSetterMatcher::Fails;
-using __llvm_libc::testing::ErrnoSetterMatcher::Succeeds;
+using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails;
+using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds;
TEST(LlvmLibcSigaction, Invalid) {
// -1 is a much larger signal that NSIG, so this should fail.
- EXPECT_THAT(__llvm_libc::sigaction(-1, nullptr, nullptr), Fails(EINVAL));
+ EXPECT_THAT(LIBC_NAMESPACE::sigaction(-1, nullptr, nullptr), Fails(EINVAL));
}
// SIGKILL cannot have its action changed, but it can be examined.
TEST(LlvmLibcSigaction, Sigkill) {
struct sigaction action;
- EXPECT_THAT(__llvm_libc::sigaction(SIGKILL, nullptr, &action), Succeeds());
- EXPECT_THAT(__llvm_libc::sigaction(SIGKILL, &action, nullptr), Fails(EINVAL));
+ EXPECT_THAT(LIBC_NAMESPACE::sigaction(SIGKILL, nullptr, &action), Succeeds());
+ EXPECT_THAT(LIBC_NAMESPACE::sigaction(SIGKILL, &action, nullptr),
+ Fails(EINVAL));
}
static int sigusr1Count;
@@ -38,29 +39,29 @@ TEST(LlvmLibcSigaction, CustomAction) {
sigusr1Count = 0;
struct sigaction action;
- EXPECT_THAT(__llvm_libc::sigaction(SIGUSR1, nullptr, &action), Succeeds());
+ EXPECT_THAT(LIBC_NAMESPACE::sigaction(SIGUSR1, nullptr, &action), Succeeds());
action.sa_handler = +[](int signal) {
correctSignal = signal == SIGUSR1;
sigusr1Count++;
};
- EXPECT_THAT(__llvm_libc::sigaction(SIGUSR1, &action, nullptr), Succeeds());
+ EXPECT_THAT(LIBC_NAMESPACE::sigaction(SIGUSR1, &action, nullptr), Succeeds());
- __llvm_libc::raise(SIGUSR1);
+ LIBC_NAMESPACE::raise(SIGUSR1);
EXPECT_EQ(sigusr1Count, 1);
EXPECT_TRUE(correctSignal);
action.sa_handler = SIG_DFL;
- EXPECT_THAT(__llvm_libc::sigaction(SIGUSR1, &action, nullptr), Succeeds());
+ EXPECT_THAT(LIBC_NAMESPACE::sigaction(SIGUSR1, &action, nullptr), Succeeds());
- EXPECT_DEATH([] { __llvm_libc::raise(SIGUSR1); }, WITH_SIGNAL(SIGUSR1));
+ EXPECT_DEATH([] { LIBC_NAMESPACE::raise(SIGUSR1); }, WITH_SIGNAL(SIGUSR1));
}
TEST(LlvmLibcSigaction, Ignore) {
struct sigaction action;
- EXPECT_THAT(__llvm_libc::sigaction(SIGUSR1, nullptr, &action), Succeeds());
+ EXPECT_THAT(LIBC_NAMESPACE::sigaction(SIGUSR1, nullptr, &action), Succeeds());
action.sa_handler = SIG_IGN;
- EXPECT_THAT(__llvm_libc::sigaction(SIGUSR1, &action, nullptr), Succeeds());
+ EXPECT_THAT(LIBC_NAMESPACE::sigaction(SIGUSR1, &action, nullptr), Succeeds());
- EXPECT_EXITS([] { __llvm_libc::raise(SIGUSR1); }, 0);
+ EXPECT_EXITS([] { LIBC_NAMESPACE::raise(SIGUSR1); }, 0);
}
diff --git a/libc/test/src/signal/sigaddset_test.cpp b/libc/test/src/signal/sigaddset_test.cpp
index dbc0a617f4208ee..ac9334f4ff68c0e 100644
--- a/libc/test/src/signal/sigaddset_test.cpp
+++ b/libc/test/src/signal/sigaddset_test.cpp
@@ -16,19 +16,19 @@
// This tests invalid inputs and ensures errno is properly set.
TEST(LlvmLibcSignalTest, SigaddsetInvalid) {
- using __llvm_libc::testing::ErrnoSetterMatcher::Fails;
- using __llvm_libc::testing::ErrnoSetterMatcher::Succeeds;
- EXPECT_THAT(__llvm_libc::sigaddset(nullptr, SIGSEGV), Fails(EINVAL));
+ using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails;
+ using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds;
+ EXPECT_THAT(LIBC_NAMESPACE::sigaddset(nullptr, SIGSEGV), Fails(EINVAL));
sigset_t sigset;
- EXPECT_THAT(__llvm_libc::sigaddset(&sigset, -1), Fails(EINVAL));
+ EXPECT_THAT(LIBC_NAMESPACE::sigaddset(&sigset, -1), Fails(EINVAL));
- // This doesn't use NSIG because __llvm_libc::sigaddset error checking is
+ // This doesn't use NSIG because LIBC_NAMESPACE::sigaddset error checking is
// against sizeof(sigset_t) not NSIG.
constexpr int bitsInSigsetT = 8 * sizeof(sigset_t);
- EXPECT_THAT(__llvm_libc::sigaddset(&sigset, bitsInSigsetT + 1),
+ EXPECT_THAT(LIBC_NAMESPACE::sigaddset(&sigset, bitsInSigsetT + 1),
Fails(EINVAL));
- EXPECT_THAT(__llvm_libc::sigaddset(&sigset, 0), Fails(EINVAL));
- EXPECT_THAT(__llvm_libc::sigaddset(&sigset, bitsInSigsetT), Succeeds());
+ EXPECT_THAT(LIBC_NAMESPACE::sigaddset(&sigset, 0), Fails(EINVAL));
+ EXPECT_THAT(LIBC_NAMESPACE::sigaddset(&sigset, bitsInSigsetT), Succeeds());
}
diff --git a/libc/test/src/signal/sigaltstack_test.cpp b/libc/test/src/signal/sigaltstack_test.cpp
index e52b3db59ddb0b8..5e1a3a4e2062c35 100644
--- a/libc/test/src/signal/sigaltstack_test.cpp
+++ b/libc/test/src/signal/sigaltstack_test.cpp
@@ -24,8 +24,8 @@ constexpr int LOCAL_VAR_SIZE = 512;
constexpr int ALT_STACK_SIZE = SIGSTKSZ + LOCAL_VAR_SIZE * 2;
static uint8_t alt_stack[ALT_STACK_SIZE];
-using __llvm_libc::testing::ErrnoSetterMatcher::Fails;
-using __llvm_libc::testing::ErrnoSetterMatcher::Succeeds;
+using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails;
+using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds;
static bool good_stack;
static void handler(int) {
@@ -48,21 +48,23 @@ static void handler(int) {
TEST(LlvmLibcSignalTest, SigaltstackRunOnAltStack) {
struct sigaction action;
libc_errno = 0;
- ASSERT_THAT(__llvm_libc::sigaction(SIGUSR1, nullptr, &action), Succeeds(0));
+ ASSERT_THAT(LIBC_NAMESPACE::sigaction(SIGUSR1, nullptr, &action),
+ Succeeds(0));
action.sa_handler = handler;
// Indicate that the signal should be delivered on an alternate stack.
action.sa_flags = SA_ONSTACK;
- ASSERT_THAT(__llvm_libc::sigaction(SIGUSR1, &action, nullptr), Succeeds(0));
+ ASSERT_THAT(LIBC_NAMESPACE::sigaction(SIGUSR1, &action, nullptr),
+ Succeeds(0));
stack_t ss;
ss.ss_sp = alt_stack;
ss.ss_size = ALT_STACK_SIZE;
ss.ss_flags = 0;
// Setup the alternate stack.
- ASSERT_THAT(__llvm_libc::sigaltstack(&ss, nullptr), Succeeds(0));
+ ASSERT_THAT(LIBC_NAMESPACE::sigaltstack(&ss, nullptr), Succeeds(0));
good_stack = false;
- __llvm_libc::raise(SIGUSR1);
+ LIBC_NAMESPACE::raise(SIGUSR1);
EXPECT_TRUE(good_stack);
}
@@ -72,8 +74,8 @@ TEST(LlvmLibcSignalTest, SigaltstackInvalidStack) {
ss.ss_sp = alt_stack;
ss.ss_size = 0;
ss.ss_flags = SS_ONSTACK;
- ASSERT_THAT(__llvm_libc::sigaltstack(&ss, nullptr), Fails(EINVAL));
+ ASSERT_THAT(LIBC_NAMESPACE::sigaltstack(&ss, nullptr), Fails(EINVAL));
ss.ss_flags = 0;
- ASSERT_THAT(__llvm_libc::sigaltstack(&ss, nullptr), Fails(ENOMEM));
+ ASSERT_THAT(LIBC_NAMESPACE::sigaltstack(&ss, nullptr), Fails(ENOMEM));
}
diff --git a/libc/test/src/signal/sigdelset_test.cpp b/libc/test/src/signal/sigdelset_test.cpp
index 80f2459e223a618..aeae66f86bf8863 100644
--- a/libc/test/src/signal/sigdelset_test.cpp
+++ b/libc/test/src/signal/sigdelset_test.cpp
@@ -18,20 +18,21 @@
#include <signal.h>
TEST(LlvmLibcSigdelset, Invalid) {
- using __llvm_libc::testing::ErrnoSetterMatcher::Fails;
+ using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails;
// Invalid set.
- EXPECT_THAT(__llvm_libc::sigdelset(nullptr, SIGUSR1), Fails(EINVAL));
+ EXPECT_THAT(LIBC_NAMESPACE::sigdelset(nullptr, SIGUSR1), Fails(EINVAL));
sigset_t set;
// Valid set, invalid signum.
- EXPECT_THAT(__llvm_libc::sigdelset(&set, -1), Fails(EINVAL));
+ EXPECT_THAT(LIBC_NAMESPACE::sigdelset(&set, -1), Fails(EINVAL));
}
TEST(LlvmLibcSigdelset, UnblockOne) {
- using __llvm_libc::testing::ErrnoSetterMatcher::Succeeds;
+ using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds;
sigset_t set;
- EXPECT_THAT(__llvm_libc::sigfillset(&set), Succeeds());
- EXPECT_THAT(__llvm_libc::sigdelset(&set, SIGUSR1), Succeeds());
- EXPECT_THAT(__llvm_libc::sigprocmask(SIG_SETMASK, &set, nullptr), Succeeds());
- EXPECT_DEATH([] { __llvm_libc::raise(SIGUSR1); }, WITH_SIGNAL(SIGUSR1));
+ EXPECT_THAT(LIBC_NAMESPACE::sigfillset(&set), Succeeds());
+ EXPECT_THAT(LIBC_NAMESPACE::sigdelset(&set, SIGUSR1), Succeeds());
+ EXPECT_THAT(LIBC_NAMESPACE::sigprocmask(SIG_SETMASK, &set, nullptr),
+ Succeeds());
+ EXPECT_DEATH([] { LIBC_NAMESPACE::raise(SIGUSR1); }, WITH_SIGNAL(SIGUSR1));
}
diff --git a/libc/test/src/signal/sigfillset_test.cpp b/libc/test/src/signal/sigfillset_test.cpp
index 52f1e27aa329030..7922b3a4e119020 100644
--- a/libc/test/src/signal/sigfillset_test.cpp
+++ b/libc/test/src/signal/sigfillset_test.cpp
@@ -17,14 +17,15 @@
#include <signal.h>
TEST(LlvmLibcSigfillset, Invalid) {
- using __llvm_libc::testing::ErrnoSetterMatcher::Fails;
- EXPECT_THAT(__llvm_libc::sigfillset(nullptr), Fails(EINVAL));
+ using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails;
+ EXPECT_THAT(LIBC_NAMESPACE::sigfillset(nullptr), Fails(EINVAL));
}
TEST(LlvmLibcSigfillset, BlocksAll) {
- using __llvm_libc::testing::ErrnoSetterMatcher::Succeeds;
+ using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds;
sigset_t set;
- EXPECT_THAT(__llvm_libc::sigfillset(&set), Succeeds());
- EXPECT_THAT(__llvm_libc::sigprocmask(SIG_SETMASK, &set, nullptr), Succeeds());
- EXPECT_EXITS([] { __llvm_libc::raise(SIGUSR1); }, 0);
+ EXPECT_THAT(LIBC_NAMESPACE::sigfillset(&set), Succeeds());
+ EXPECT_THAT(LIBC_NAMESPACE::sigprocmask(SIG_SETMASK, &set, nullptr),
+ Succeeds());
+ EXPECT_EXITS([] { LIBC_NAMESPACE::raise(SIGUSR1); }, 0);
}
diff --git a/libc/test/src/signal/signal_test.cpp b/libc/test/src/signal/signal_test.cpp
index 999933c2f8a424c..78f8bfbd719b1d0 100644
--- a/libc/test/src/signal/signal_test.cpp
+++ b/libc/test/src/signal/signal_test.cpp
@@ -15,15 +15,15 @@
#include <signal.h>
-using __llvm_libc::testing::ErrnoSetterMatcher::Fails;
-using __llvm_libc::testing::ErrnoSetterMatcher::Succeeds;
+using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails;
+using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds;
TEST(LlvmLibcSignal, Invalid) {
libc_errno = 0;
- __llvm_libc::sighandler_t valid = +[](int) {};
- EXPECT_THAT((void *)__llvm_libc::signal(0, valid),
+ LIBC_NAMESPACE::sighandler_t valid = +[](int) {};
+ EXPECT_THAT((void *)LIBC_NAMESPACE::signal(0, valid),
Fails(EINVAL, (void *)SIG_ERR));
- EXPECT_THAT((void *)__llvm_libc::signal(65, valid),
+ EXPECT_THAT((void *)LIBC_NAMESPACE::signal(65, valid),
Fails(EINVAL, (void *)SIG_ERR));
}
@@ -31,11 +31,12 @@ static int sum;
TEST(LlvmLibcSignal, Basic) {
// In case test get run multiple times.
sum = 0;
- ASSERT_NE(__llvm_libc::signal(SIGUSR1, +[](int) { sum++; }),
+ ASSERT_NE(LIBC_NAMESPACE::signal(
+ SIGUSR1, +[](int) { sum++; }),
SIG_ERR);
- ASSERT_THAT(__llvm_libc::raise(SIGUSR1), Succeeds());
+ ASSERT_THAT(LIBC_NAMESPACE::raise(SIGUSR1), Succeeds());
EXPECT_EQ(sum, 1);
for (int i = 0; i < 10; i++)
- ASSERT_THAT(__llvm_libc::raise(SIGUSR1), Succeeds());
+ ASSERT_THAT(LIBC_NAMESPACE::raise(SIGUSR1), Succeeds());
EXPECT_EQ(sum, 11);
}
diff --git a/libc/test/src/signal/sigprocmask_test.cpp b/libc/test/src/signal/sigprocmask_test.cpp
index 3c334642ce0d380..3e7e3a5c62db273 100644
--- a/libc/test/src/signal/sigprocmask_test.cpp
+++ b/libc/test/src/signal/sigprocmask_test.cpp
@@ -17,19 +17,19 @@
#include <signal.h>
-class LlvmLibcSignalTest : public __llvm_libc::testing::Test {
+class LlvmLibcSignalTest : public LIBC_NAMESPACE::testing::Test {
sigset_t oldSet;
public:
- void SetUp() override { __llvm_libc::sigprocmask(0, nullptr, &oldSet); }
+ void SetUp() override { LIBC_NAMESPACE::sigprocmask(0, nullptr, &oldSet); }
void TearDown() override {
- __llvm_libc::sigprocmask(SIG_SETMASK, &oldSet, nullptr);
+ LIBC_NAMESPACE::sigprocmask(SIG_SETMASK, &oldSet, nullptr);
}
};
-using __llvm_libc::testing::ErrnoSetterMatcher::Fails;
-using __llvm_libc::testing::ErrnoSetterMatcher::Succeeds;
+using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails;
+using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds;
// This tests for invalid input.
TEST_F(LlvmLibcSignalTest, SigprocmaskInvalid) {
@@ -37,24 +37,24 @@ TEST_F(LlvmLibcSignalTest, SigprocmaskInvalid) {
sigset_t valid;
// 17 and -4 are out of the range for sigprocmask's how paramater.
- EXPECT_THAT(__llvm_libc::sigprocmask(17, &valid, nullptr), Fails(EINVAL));
- EXPECT_THAT(__llvm_libc::sigprocmask(-4, &valid, nullptr), Fails(EINVAL));
+ EXPECT_THAT(LIBC_NAMESPACE::sigprocmask(17, &valid, nullptr), Fails(EINVAL));
+ EXPECT_THAT(LIBC_NAMESPACE::sigprocmask(-4, &valid, nullptr), Fails(EINVAL));
// This pointer is out of this processes address range.
sigset_t *invalid = reinterpret_cast<sigset_t *>(-1);
- EXPECT_THAT(__llvm_libc::sigprocmask(SIG_SETMASK, invalid, nullptr),
+ EXPECT_THAT(LIBC_NAMESPACE::sigprocmask(SIG_SETMASK, invalid, nullptr),
Fails(EFAULT));
- EXPECT_THAT(__llvm_libc::sigprocmask(-4, nullptr, invalid), Fails(EFAULT));
+ EXPECT_THAT(LIBC_NAMESPACE::sigprocmask(-4, nullptr, invalid), Fails(EFAULT));
}
// This tests that when nothing is blocked, a process gets killed and alse tests
// that when signals are blocked they are not delivered to the process.
TEST_F(LlvmLibcSignalTest, BlockUnblock) {
sigset_t sigset;
- EXPECT_EQ(__llvm_libc::sigemptyset(&sigset), 0);
- EXPECT_EQ(__llvm_libc::sigprocmask(SIG_SETMASK, &sigset, nullptr), 0);
- EXPECT_DEATH([] { __llvm_libc::raise(SIGUSR1); }, WITH_SIGNAL(SIGUSR1));
- EXPECT_EQ(__llvm_libc::sigaddset(&sigset, SIGUSR1), 0);
- EXPECT_EQ(__llvm_libc::sigprocmask(SIG_SETMASK, &sigset, nullptr), 0);
- EXPECT_EXITS([] { __llvm_libc::raise(SIGUSR1); }, 0);
+ EXPECT_EQ(LIBC_NAMESPACE::sigemptyset(&sigset), 0);
+ EXPECT_EQ(LIBC_NAMESPACE::sigprocmask(SIG_SETMASK, &sigset, nullptr), 0);
+ EXPECT_DEATH([] { LIBC_NAMESPACE::raise(SIGUSR1); }, WITH_SIGNAL(SIGUSR1));
+ EXPECT_EQ(LIBC_NAMESPACE::sigaddset(&sigset, SIGUSR1), 0);
+ EXPECT_EQ(LIBC_NAMESPACE::sigprocmask(SIG_SETMASK, &sigset, nullptr), 0);
+ EXPECT_EXITS([] { LIBC_NAMESPACE::raise(SIGUSR1); }, 0);
}
diff --git a/libc/test/src/spawn/posix_spawn_file_actions_test.cpp b/libc/test/src/spawn/posix_spawn_file_actions_test.cpp
index abd2d78fdd5bb15..a343710829f10b5 100644
--- a/libc/test/src/spawn/posix_spawn_file_actions_test.cpp
+++ b/libc/test/src/spawn/posix_spawn_file_actions_test.cpp
@@ -20,56 +20,58 @@
TEST(LlvmLibcPosixSpawnFileActionsTest, AddActions) {
posix_spawn_file_actions_t actions;
- ASSERT_EQ(__llvm_libc::posix_spawn_file_actions_init(&actions), 0);
+ ASSERT_EQ(LIBC_NAMESPACE::posix_spawn_file_actions_init(&actions), 0);
ASSERT_EQ(uintptr_t(actions.__front), uintptr_t(nullptr));
ASSERT_EQ(uintptr_t(actions.__back), uintptr_t(nullptr));
- ASSERT_EQ(__llvm_libc::posix_spawn_file_actions_addclose(&actions, 10), 0);
+ ASSERT_EQ(LIBC_NAMESPACE::posix_spawn_file_actions_addclose(&actions, 10), 0);
ASSERT_NE(uintptr_t(actions.__front), uintptr_t(nullptr));
ASSERT_NE(uintptr_t(actions.__back), uintptr_t(nullptr));
- ASSERT_EQ(__llvm_libc::posix_spawn_file_actions_adddup2(&actions, 11, 12), 0);
- ASSERT_EQ(__llvm_libc::posix_spawn_file_actions_addopen(&actions, 13,
- "path/to/file", 0, 0),
+ ASSERT_EQ(LIBC_NAMESPACE::posix_spawn_file_actions_adddup2(&actions, 11, 12),
+ 0);
+ ASSERT_EQ(LIBC_NAMESPACE::posix_spawn_file_actions_addopen(
+ &actions, 13, "path/to/file", 0, 0),
0);
- __llvm_libc::BaseSpawnFileAction *act =
- reinterpret_cast<__llvm_libc::BaseSpawnFileAction *>(actions.__front);
+ LIBC_NAMESPACE::BaseSpawnFileAction *act =
+ reinterpret_cast<LIBC_NAMESPACE::BaseSpawnFileAction *>(actions.__front);
int action_count = 0;
while (act != nullptr) {
++action_count;
if (action_count == 1)
- ASSERT_EQ(act->type, __llvm_libc::BaseSpawnFileAction::CLOSE);
+ ASSERT_EQ(act->type, LIBC_NAMESPACE::BaseSpawnFileAction::CLOSE);
if (action_count == 2)
- ASSERT_EQ(act->type, __llvm_libc::BaseSpawnFileAction::DUP2);
+ ASSERT_EQ(act->type, LIBC_NAMESPACE::BaseSpawnFileAction::DUP2);
if (action_count == 3)
- ASSERT_EQ(act->type, __llvm_libc::BaseSpawnFileAction::OPEN);
+ ASSERT_EQ(act->type, LIBC_NAMESPACE::BaseSpawnFileAction::OPEN);
act = act->next;
}
ASSERT_EQ(action_count, 3);
- ASSERT_EQ(__llvm_libc::posix_spawn_file_actions_destroy(&actions), 0);
+ ASSERT_EQ(LIBC_NAMESPACE::posix_spawn_file_actions_destroy(&actions), 0);
}
TEST(LlvmLibcPosixSpawnFileActionsTest, InvalidActions) {
- ASSERT_EQ(__llvm_libc::posix_spawn_file_actions_addclose(nullptr, 1), EINVAL);
- ASSERT_EQ(__llvm_libc::posix_spawn_file_actions_adddup2(nullptr, 1, 2),
+ ASSERT_EQ(LIBC_NAMESPACE::posix_spawn_file_actions_addclose(nullptr, 1),
+ EINVAL);
+ ASSERT_EQ(LIBC_NAMESPACE::posix_spawn_file_actions_adddup2(nullptr, 1, 2),
+ EINVAL);
+ ASSERT_EQ(LIBC_NAMESPACE::posix_spawn_file_actions_addopen(nullptr, 1,
+ nullptr, 0, 0),
EINVAL);
- ASSERT_EQ(
- __llvm_libc::posix_spawn_file_actions_addopen(nullptr, 1, nullptr, 0, 0),
- EINVAL);
- ASSERT_EQ(__llvm_libc::posix_spawn_file_actions_destroy(nullptr), EINVAL);
+ ASSERT_EQ(LIBC_NAMESPACE::posix_spawn_file_actions_destroy(nullptr), EINVAL);
posix_spawn_file_actions_t actions;
- ASSERT_EQ(__llvm_libc::posix_spawn_file_actions_init(&actions), 0);
- ASSERT_EQ(__llvm_libc::posix_spawn_file_actions_addclose(&actions, -1),
+ ASSERT_EQ(LIBC_NAMESPACE::posix_spawn_file_actions_init(&actions), 0);
+ ASSERT_EQ(LIBC_NAMESPACE::posix_spawn_file_actions_addclose(&actions, -1),
EBADF);
- ASSERT_EQ(__llvm_libc::posix_spawn_file_actions_adddup2(&actions, -1, 2),
+ ASSERT_EQ(LIBC_NAMESPACE::posix_spawn_file_actions_adddup2(&actions, -1, 2),
EBADF);
- ASSERT_EQ(__llvm_libc::posix_spawn_file_actions_adddup2(&actions, 1, -2),
+ ASSERT_EQ(LIBC_NAMESPACE::posix_spawn_file_actions_adddup2(&actions, 1, -2),
EBADF);
- ASSERT_EQ(__llvm_libc::posix_spawn_file_actions_addopen(&actions, -1, nullptr,
- 0, 0),
+ ASSERT_EQ(LIBC_NAMESPACE::posix_spawn_file_actions_addopen(&actions, -1,
+ nullptr, 0, 0),
EBADF);
- ASSERT_EQ(__llvm_libc::posix_spawn_file_actions_destroy(&actions), 0);
+ ASSERT_EQ(LIBC_NAMESPACE::posix_spawn_file_actions_destroy(&actions), 0);
}
diff --git a/libc/test/src/stdio/fgetc_test.cpp b/libc/test/src/stdio/fgetc_test.cpp
index b262dda9325da5d..6e6c0ed9b26bf6c 100644
--- a/libc/test/src/stdio/fgetc_test.cpp
+++ b/libc/test/src/stdio/fgetc_test.cpp
@@ -19,25 +19,25 @@
#include "src/errno/libc_errno.h"
#include <stdio.h>
-class LlvmLibcGetcTest : public __llvm_libc::testing::Test {
+class LlvmLibcGetcTest : public LIBC_NAMESPACE::testing::Test {
public:
using GetcFunc = int(FILE *);
void test_with_func(GetcFunc *func, const char *filename) {
- ::FILE *file = __llvm_libc::fopen(filename, "w");
+ ::FILE *file = LIBC_NAMESPACE::fopen(filename, "w");
ASSERT_FALSE(file == nullptr);
constexpr char CONTENT[] = "123456789";
constexpr size_t WRITE_SIZE = sizeof(CONTENT) - 1;
- ASSERT_EQ(WRITE_SIZE, __llvm_libc::fwrite(CONTENT, 1, WRITE_SIZE, file));
+ ASSERT_EQ(WRITE_SIZE, LIBC_NAMESPACE::fwrite(CONTENT, 1, WRITE_SIZE, file));
// This is a write-only file so reads should fail.
ASSERT_EQ(func(file), EOF);
// This is an error and not a real EOF.
- ASSERT_EQ(__llvm_libc::feof(file), 0);
- ASSERT_NE(__llvm_libc::ferror(file), 0);
+ ASSERT_EQ(LIBC_NAMESPACE::feof(file), 0);
+ ASSERT_NE(LIBC_NAMESPACE::ferror(file), 0);
libc_errno = 0;
- ASSERT_EQ(0, __llvm_libc::fclose(file));
+ ASSERT_EQ(0, LIBC_NAMESPACE::fclose(file));
- file = __llvm_libc::fopen(filename, "r");
+ file = LIBC_NAMESPACE::fopen(filename, "r");
ASSERT_FALSE(file == nullptr);
for (size_t i = 0; i < WRITE_SIZE; ++i) {
@@ -46,17 +46,17 @@ class LlvmLibcGetcTest : public __llvm_libc::testing::Test {
}
// Reading more should return EOF but not set error.
ASSERT_EQ(func(file), EOF);
- ASSERT_NE(__llvm_libc::feof(file), 0);
- ASSERT_EQ(__llvm_libc::ferror(file), 0);
+ ASSERT_NE(LIBC_NAMESPACE::feof(file), 0);
+ ASSERT_EQ(LIBC_NAMESPACE::ferror(file), 0);
- ASSERT_EQ(0, __llvm_libc::fclose(file));
+ ASSERT_EQ(0, LIBC_NAMESPACE::fclose(file));
}
};
TEST_F(LlvmLibcGetcTest, WriteAndReadCharactersWithFgetc) {
- test_with_func(&__llvm_libc::fgetc, "testdata/fgetc.test");
+ test_with_func(&LIBC_NAMESPACE::fgetc, "testdata/fgetc.test");
}
TEST_F(LlvmLibcGetcTest, WriteAndReadCharactersWithGetc) {
- test_with_func(&__llvm_libc::getc, "testdata/getc.test");
+ test_with_func(&LIBC_NAMESPACE::getc, "testdata/getc.test");
}
diff --git a/libc/test/src/stdio/fgetc_unlocked_test.cpp b/libc/test/src/stdio/fgetc_unlocked_test.cpp
index 4608be3ee35da91..0d704ecee750c02 100644
--- a/libc/test/src/stdio/fgetc_unlocked_test.cpp
+++ b/libc/test/src/stdio/fgetc_unlocked_test.cpp
@@ -22,46 +22,47 @@
#include "src/errno/libc_errno.h"
#include <stdio.h>
-class LlvmLibcGetcTest : public __llvm_libc::testing::Test {
+class LlvmLibcGetcTest : public LIBC_NAMESPACE::testing::Test {
public:
using GetcFunc = int(FILE *);
void test_with_func(GetcFunc *func, const char *filename) {
- ::FILE *file = __llvm_libc::fopen(filename, "w");
+ ::FILE *file = LIBC_NAMESPACE::fopen(filename, "w");
ASSERT_FALSE(file == nullptr);
constexpr char CONTENT[] = "123456789";
constexpr size_t WRITE_SIZE = sizeof(CONTENT) - 1;
- ASSERT_EQ(WRITE_SIZE, __llvm_libc::fwrite(CONTENT, 1, WRITE_SIZE, file));
+ ASSERT_EQ(WRITE_SIZE, LIBC_NAMESPACE::fwrite(CONTENT, 1, WRITE_SIZE, file));
// This is a write-only file so reads should fail.
ASSERT_EQ(func(file), EOF);
// This is an error and not a real EOF.
- ASSERT_EQ(__llvm_libc::feof(file), 0);
- ASSERT_NE(__llvm_libc::ferror(file), 0);
+ ASSERT_EQ(LIBC_NAMESPACE::feof(file), 0);
+ ASSERT_NE(LIBC_NAMESPACE::ferror(file), 0);
libc_errno = 0;
- ASSERT_EQ(0, __llvm_libc::fclose(file));
+ ASSERT_EQ(0, LIBC_NAMESPACE::fclose(file));
- file = __llvm_libc::fopen(filename, "r");
+ file = LIBC_NAMESPACE::fopen(filename, "r");
ASSERT_FALSE(file == nullptr);
- __llvm_libc::flockfile(file);
+ LIBC_NAMESPACE::flockfile(file);
for (size_t i = 0; i < WRITE_SIZE; ++i) {
int c = func(file);
ASSERT_EQ(c, int('1' + i));
}
// Reading more should return EOF but not set error.
ASSERT_EQ(func(file), EOF);
- ASSERT_NE(__llvm_libc::feof_unlocked(file), 0);
- ASSERT_EQ(__llvm_libc::ferror_unlocked(file), 0);
+ ASSERT_NE(LIBC_NAMESPACE::feof_unlocked(file), 0);
+ ASSERT_EQ(LIBC_NAMESPACE::ferror_unlocked(file), 0);
- __llvm_libc::funlockfile(file);
- ASSERT_EQ(0, __llvm_libc::fclose(file));
+ LIBC_NAMESPACE::funlockfile(file);
+ ASSERT_EQ(0, LIBC_NAMESPACE::fclose(file));
}
};
TEST_F(LlvmLibcGetcTest, WriteAndReadCharactersWithFgetcUnlocked) {
- test_with_func(&__llvm_libc::fgetc_unlocked, "testdata/fgetc_unlocked.test");
+ test_with_func(&LIBC_NAMESPACE::fgetc_unlocked,
+ "testdata/fgetc_unlocked.test");
}
TEST_F(LlvmLibcGetcTest, WriteAndReadCharactersWithGetcUnlocked) {
- test_with_func(&__llvm_libc::getc_unlocked, "testdata/getc_unlocked.test");
+ test_with_func(&LIBC_NAMESPACE::getc_unlocked, "testdata/getc_unlocked.test");
}
diff --git a/libc/test/src/stdio/fgets_test.cpp b/libc/test/src/stdio/fgets_test.cpp
index 150a9dd5d867d76..9f9841c901f4edc 100644
--- a/libc/test/src/stdio/fgets_test.cpp
+++ b/libc/test/src/stdio/fgets_test.cpp
@@ -19,7 +19,7 @@
TEST(LlvmLibcFgetsTest, WriteAndReadCharacters) {
constexpr char FILENAME[] = "testdata/fgets.test";
- ::FILE *file = __llvm_libc::fopen(FILENAME, "w");
+ ::FILE *file = LIBC_NAMESPACE::fopen(FILENAME, "w");
ASSERT_FALSE(file == nullptr);
constexpr char CONTENT[] = "123456789\n"
"1234567\n"
@@ -30,29 +30,29 @@ TEST(LlvmLibcFgetsTest, WriteAndReadCharacters) {
char buff[8];
char *output;
- ASSERT_EQ(WRITE_SIZE, __llvm_libc::fwrite(CONTENT, 1, WRITE_SIZE, file));
+ ASSERT_EQ(WRITE_SIZE, LIBC_NAMESPACE::fwrite(CONTENT, 1, WRITE_SIZE, file));
// This is a write-only file so reads should fail.
- ASSERT_TRUE(__llvm_libc::fgets(buff, 8, file) == nullptr);
+ ASSERT_TRUE(LIBC_NAMESPACE::fgets(buff, 8, file) == nullptr);
// This is an error and not a real EOF.
- ASSERT_EQ(__llvm_libc::feof(file), 0);
- ASSERT_NE(__llvm_libc::ferror(file), 0);
+ ASSERT_EQ(LIBC_NAMESPACE::feof(file), 0);
+ ASSERT_NE(LIBC_NAMESPACE::ferror(file), 0);
libc_errno = 0;
- ASSERT_EQ(0, __llvm_libc::fclose(file));
+ ASSERT_EQ(0, LIBC_NAMESPACE::fclose(file));
- file = __llvm_libc::fopen(FILENAME, "r");
+ file = LIBC_NAMESPACE::fopen(FILENAME, "r");
ASSERT_FALSE(file == nullptr);
// If we request just 1 byte, it should return just a null byte and not
// advance the read head. This is implementation defined.
- output = __llvm_libc::fgets(buff, 1, file);
+ output = LIBC_NAMESPACE::fgets(buff, 1, file);
ASSERT_TRUE(output == buff);
ASSERT_EQ(buff[0], '\0');
ASSERT_EQ(libc_errno, 0);
// If we request less than 1 byte, it should do nothing and return nullptr.
// This is also implementation defined.
- output = __llvm_libc::fgets(buff, 0, file);
+ output = LIBC_NAMESPACE::fgets(buff, 0, file);
ASSERT_TRUE(output == nullptr);
const char *output_arr[] = {
@@ -62,27 +62,27 @@ TEST(LlvmLibcFgetsTest, WriteAndReadCharacters) {
constexpr size_t ARR_SIZE = sizeof(output_arr) / sizeof(char *);
for (size_t i = 0; i < ARR_SIZE; ++i) {
- output = __llvm_libc::fgets(buff, 8, file);
+ output = LIBC_NAMESPACE::fgets(buff, 8, file);
// This pointer comparison is intentional, fgets should return a pointer to
// buff when it succeeds.
ASSERT_TRUE(output == buff);
- ASSERT_EQ(__llvm_libc::ferror(file), 0);
+ ASSERT_EQ(LIBC_NAMESPACE::ferror(file), 0);
EXPECT_STREQ(buff, output_arr[i]);
}
// This should have hit the end of the file, but that isn't an error unless it
// fails to read anything.
- ASSERT_NE(__llvm_libc::feof(file), 0);
- ASSERT_EQ(__llvm_libc::ferror(file), 0);
+ ASSERT_NE(LIBC_NAMESPACE::feof(file), 0);
+ ASSERT_EQ(LIBC_NAMESPACE::ferror(file), 0);
ASSERT_EQ(libc_errno, 0);
// Reading more should be an EOF, but not an error.
- output = __llvm_libc::fgets(buff, 8, file);
+ output = LIBC_NAMESPACE::fgets(buff, 8, file);
ASSERT_TRUE(output == nullptr);
- ASSERT_NE(__llvm_libc::feof(file), 0);
+ ASSERT_NE(LIBC_NAMESPACE::feof(file), 0);
ASSERT_EQ(libc_errno, 0);
- ASSERT_EQ(0, __llvm_libc::fclose(file));
+ ASSERT_EQ(0, LIBC_NAMESPACE::fclose(file));
}
diff --git a/libc/test/src/stdio/fileop_test.cpp b/libc/test/src/stdio/fileop_test.cpp
index 989de2963cf9cc6..3aa7f34512e73c1 100644
--- a/libc/test/src/stdio/fileop_test.cpp
+++ b/libc/test/src/stdio/fileop_test.cpp
@@ -23,130 +23,132 @@
TEST(LlvmLibcFILETest, SimpleFileOperations) {
constexpr char FILENAME[] = "testdata/simple_operations.test";
- ::FILE *file = __llvm_libc::fopen(FILENAME, "w");
+ ::FILE *file = LIBC_NAMESPACE::fopen(FILENAME, "w");
ASSERT_FALSE(file == nullptr);
constexpr char CONTENT[] = "1234567890987654321";
ASSERT_EQ(sizeof(CONTENT) - 1,
- __llvm_libc::fwrite(CONTENT, 1, sizeof(CONTENT) - 1, file));
+ LIBC_NAMESPACE::fwrite(CONTENT, 1, sizeof(CONTENT) - 1, file));
// This is not a readable file.
char read_data[sizeof(CONTENT)];
- ASSERT_EQ(__llvm_libc::fread(read_data, 1, sizeof(CONTENT), file), size_t(0));
- ASSERT_NE(__llvm_libc::ferror(file), 0);
+ ASSERT_EQ(LIBC_NAMESPACE::fread(read_data, 1, sizeof(CONTENT), file),
+ size_t(0));
+ ASSERT_NE(LIBC_NAMESPACE::ferror(file), 0);
EXPECT_NE(libc_errno, 0);
libc_errno = 0;
- __llvm_libc::clearerr(file);
- ASSERT_EQ(__llvm_libc::ferror(file), 0);
+ LIBC_NAMESPACE::clearerr(file);
+ ASSERT_EQ(LIBC_NAMESPACE::ferror(file), 0);
- ASSERT_EQ(0, __llvm_libc::fclose(file));
+ ASSERT_EQ(0, LIBC_NAMESPACE::fclose(file));
- file = __llvm_libc::fopen(FILENAME, "r");
+ file = LIBC_NAMESPACE::fopen(FILENAME, "r");
ASSERT_FALSE(file == nullptr);
constexpr size_t READ_SIZE = 5;
char data[READ_SIZE];
data[READ_SIZE - 1] = '\0';
- ASSERT_EQ(__llvm_libc::fread(data, 1, READ_SIZE - 1, file), READ_SIZE - 1);
+ ASSERT_EQ(LIBC_NAMESPACE::fread(data, 1, READ_SIZE - 1, file), READ_SIZE - 1);
ASSERT_STREQ(data, "1234");
- ASSERT_EQ(__llvm_libc::fseek(file, 5, SEEK_CUR), 0);
- ASSERT_EQ(__llvm_libc::fread(data, 1, READ_SIZE - 1, file), READ_SIZE - 1);
+ ASSERT_EQ(LIBC_NAMESPACE::fseek(file, 5, SEEK_CUR), 0);
+ ASSERT_EQ(LIBC_NAMESPACE::fread(data, 1, READ_SIZE - 1, file), READ_SIZE - 1);
ASSERT_STREQ(data, "0987");
- ASSERT_EQ(__llvm_libc::fseek(file, -5, SEEK_CUR), 0);
- ASSERT_EQ(__llvm_libc::fread(data, 1, READ_SIZE - 1, file), READ_SIZE - 1);
+ ASSERT_EQ(LIBC_NAMESPACE::fseek(file, -5, SEEK_CUR), 0);
+ ASSERT_EQ(LIBC_NAMESPACE::fread(data, 1, READ_SIZE - 1, file), READ_SIZE - 1);
ASSERT_STREQ(data, "9098");
// Reading another time should trigger eof.
ASSERT_NE(sizeof(CONTENT),
- __llvm_libc::fread(read_data, 1, sizeof(CONTENT), file));
- ASSERT_NE(__llvm_libc::feof(file), 0);
+ LIBC_NAMESPACE::fread(read_data, 1, sizeof(CONTENT), file));
+ ASSERT_NE(LIBC_NAMESPACE::feof(file), 0);
// Should be an error to write.
- ASSERT_EQ(size_t(0), __llvm_libc::fwrite(CONTENT, 1, sizeof(CONTENT), file));
- ASSERT_NE(__llvm_libc::ferror(file), 0);
+ ASSERT_EQ(size_t(0),
+ LIBC_NAMESPACE::fwrite(CONTENT, 1, sizeof(CONTENT), file));
+ ASSERT_NE(LIBC_NAMESPACE::ferror(file), 0);
ASSERT_NE(libc_errno, 0);
libc_errno = 0;
- __llvm_libc::clearerr(file);
+ LIBC_NAMESPACE::clearerr(file);
// Should be an error to puts.
- ASSERT_EQ(EOF, __llvm_libc::fputs(CONTENT, file));
- ASSERT_NE(__llvm_libc::ferror(file), 0);
+ ASSERT_EQ(EOF, LIBC_NAMESPACE::fputs(CONTENT, file));
+ ASSERT_NE(LIBC_NAMESPACE::ferror(file), 0);
ASSERT_NE(libc_errno, 0);
libc_errno = 0;
- __llvm_libc::clearerr(file);
- ASSERT_EQ(__llvm_libc::ferror(file), 0);
+ LIBC_NAMESPACE::clearerr(file);
+ ASSERT_EQ(LIBC_NAMESPACE::ferror(file), 0);
libc_errno = 0;
- ASSERT_EQ(__llvm_libc::fwrite("nothing", 1, 1, file), size_t(0));
+ ASSERT_EQ(LIBC_NAMESPACE::fwrite("nothing", 1, 1, file), size_t(0));
ASSERT_NE(libc_errno, 0);
libc_errno = 0;
- ASSERT_EQ(__llvm_libc::fclose(file), 0);
+ ASSERT_EQ(LIBC_NAMESPACE::fclose(file), 0);
// Now try puts.
- file = __llvm_libc::fopen(FILENAME, "w");
+ file = LIBC_NAMESPACE::fopen(FILENAME, "w");
ASSERT_FALSE(file == nullptr);
// fputs returns a negative value on error (EOF) or any non-negative value on
// success. This assert checks that the return value is non-negative.
- ASSERT_GE(__llvm_libc::fputs(CONTENT, file), 0);
+ ASSERT_GE(LIBC_NAMESPACE::fputs(CONTENT, file), 0);
- __llvm_libc::clearerr(file);
- ASSERT_EQ(__llvm_libc::ferror(file), 0);
+ LIBC_NAMESPACE::clearerr(file);
+ ASSERT_EQ(LIBC_NAMESPACE::ferror(file), 0);
// This is not a readable file.
libc_errno = 0;
- ASSERT_EQ(__llvm_libc::fread(data, 1, 1, file), size_t(0));
+ ASSERT_EQ(LIBC_NAMESPACE::fread(data, 1, 1, file), size_t(0));
ASSERT_NE(libc_errno, 0);
libc_errno = 0;
- ASSERT_EQ(0, __llvm_libc::fclose(file));
+ ASSERT_EQ(0, LIBC_NAMESPACE::fclose(file));
- file = __llvm_libc::fopen(FILENAME, "r");
+ file = LIBC_NAMESPACE::fopen(FILENAME, "r");
ASSERT_FALSE(file == nullptr);
- ASSERT_EQ(__llvm_libc::fread(read_data, 1, sizeof(CONTENT) - 1, file),
+ ASSERT_EQ(LIBC_NAMESPACE::fread(read_data, 1, sizeof(CONTENT) - 1, file),
sizeof(CONTENT) - 1);
read_data[sizeof(CONTENT) - 1] = '\0';
ASSERT_STREQ(read_data, CONTENT);
- ASSERT_EQ(__llvm_libc::fclose(file), 0);
+ ASSERT_EQ(LIBC_NAMESPACE::fclose(file), 0);
// Check that the other functions correctly set libc_errno.
// libc_errno = 0;
- // ASSERT_NE(__llvm_libc::fseek(file, 0, SEEK_SET), 0);
+ // ASSERT_NE(LIBC_NAMESPACE::fseek(file, 0, SEEK_SET), 0);
// EXPECT_NE(libc_errno, 0);
// libc_errno = 0;
- // ASSERT_NE(__llvm_libc::fclose(file), 0);
+ // ASSERT_NE(LIBC_NAMESPACE::fclose(file), 0);
// EXPECT_NE(libc_errno, 0);
// libc_errno = 0;
- // ASSERT_EQ(__llvm_libc::fopen("INVALID FILE NAME", "r"),
+ // ASSERT_EQ(LIBC_NAMESPACE::fopen("INVALID FILE NAME", "r"),
// static_cast<FILE *>(nullptr));
// EXPECT_NE(libc_errno, 0);
}
TEST(LlvmLibcFILETest, FFlush) {
constexpr char FILENAME[] = "testdata/fflush.test";
- ::FILE *file = __llvm_libc::fopen(FILENAME, "w+");
+ ::FILE *file = LIBC_NAMESPACE::fopen(FILENAME, "w+");
ASSERT_FALSE(file == nullptr);
constexpr char CONTENT[] = "1234567890987654321";
ASSERT_EQ(sizeof(CONTENT),
- __llvm_libc::fwrite(CONTENT, 1, sizeof(CONTENT), file));
+ LIBC_NAMESPACE::fwrite(CONTENT, 1, sizeof(CONTENT), file));
// Flushing at this point should write the data to disk. So, we should be
// able to read it back.
- ASSERT_EQ(0, __llvm_libc::fflush(file));
+ ASSERT_EQ(0, LIBC_NAMESPACE::fflush(file));
char data[sizeof(CONTENT)];
- ASSERT_EQ(__llvm_libc::fseek(file, 0, SEEK_SET), 0);
- ASSERT_EQ(__llvm_libc::fread(data, 1, sizeof(CONTENT), file),
+ ASSERT_EQ(LIBC_NAMESPACE::fseek(file, 0, SEEK_SET), 0);
+ ASSERT_EQ(LIBC_NAMESPACE::fread(data, 1, sizeof(CONTENT), file),
sizeof(CONTENT));
ASSERT_STREQ(data, CONTENT);
- ASSERT_EQ(__llvm_libc::fclose(file), 0);
+ ASSERT_EQ(LIBC_NAMESPACE::fclose(file), 0);
}
TEST(LlvmLibcFILETest, FOpenFWriteSizeGreaterThanOne) {
@@ -159,28 +161,28 @@ TEST(LlvmLibcFILETest, FOpenFWriteSizeGreaterThanOne) {
constexpr char FILENAME[] = "testdata/fread_fwrite.test";
libc_errno = 0;
- FILE *file = __llvm_libc::fopen(FILENAME, "w");
+ FILE *file = LIBC_NAMESPACE::fopen(FILENAME, "w");
ASSERT_FALSE(file == nullptr);
- ASSERT_EQ(size_t(0), __llvm_libc::fwrite(WRITE_DATA, 0, 1, file));
- ASSERT_EQ(WRITE_NMEMB, __llvm_libc::fwrite(WRITE_DATA, sizeof(MyStruct),
- WRITE_NMEMB, file));
+ ASSERT_EQ(size_t(0), LIBC_NAMESPACE::fwrite(WRITE_DATA, 0, 1, file));
+ ASSERT_EQ(WRITE_NMEMB, LIBC_NAMESPACE::fwrite(WRITE_DATA, sizeof(MyStruct),
+ WRITE_NMEMB, file));
EXPECT_EQ(libc_errno, 0);
- ASSERT_EQ(__llvm_libc::fclose(file), 0);
+ ASSERT_EQ(LIBC_NAMESPACE::fclose(file), 0);
- file = __llvm_libc::fopen(FILENAME, "r");
+ file = LIBC_NAMESPACE::fopen(FILENAME, "r");
ASSERT_FALSE(file == nullptr);
MyStruct read_data[WRITE_NMEMB];
- ASSERT_EQ(size_t(0), __llvm_libc::fread(read_data, 0, 1, file));
- ASSERT_EQ(WRITE_NMEMB,
- __llvm_libc::fread(read_data, sizeof(MyStruct), WRITE_NMEMB, file));
+ ASSERT_EQ(size_t(0), LIBC_NAMESPACE::fread(read_data, 0, 1, file));
+ ASSERT_EQ(WRITE_NMEMB, LIBC_NAMESPACE::fread(read_data, sizeof(MyStruct),
+ WRITE_NMEMB, file));
EXPECT_EQ(libc_errno, 0);
// Trying to read more should fetch nothing.
- ASSERT_EQ(size_t(0),
- __llvm_libc::fread(read_data, sizeof(MyStruct), WRITE_NMEMB, file));
+ ASSERT_EQ(size_t(0), LIBC_NAMESPACE::fread(read_data, sizeof(MyStruct),
+ WRITE_NMEMB, file));
EXPECT_EQ(libc_errno, 0);
- EXPECT_NE(__llvm_libc::feof(file), 0);
- EXPECT_EQ(__llvm_libc::ferror(file), 0);
- ASSERT_EQ(__llvm_libc::fclose(file), 0);
+ EXPECT_NE(LIBC_NAMESPACE::feof(file), 0);
+ EXPECT_EQ(LIBC_NAMESPACE::ferror(file), 0);
+ ASSERT_EQ(LIBC_NAMESPACE::fclose(file), 0);
// Verify that the data which was read is correct.
for (size_t i = 0; i < WRITE_NMEMB; ++i) {
ASSERT_EQ(read_data[i].c, WRITE_DATA[i].c);
diff --git a/libc/test/src/stdio/fopen_test.cpp b/libc/test/src/stdio/fopen_test.cpp
index f0de8caf673cc7e..42e7c57cffe04b6 100644
--- a/libc/test/src/stdio/fopen_test.cpp
+++ b/libc/test/src/stdio/fopen_test.cpp
@@ -17,23 +17,23 @@
TEST(LlvmLibcFOpenTest, PrintToFile) {
int result;
- FILE *file = __llvm_libc::fopen("./testdata/test_data.txt", "w");
+ FILE *file = LIBC_NAMESPACE::fopen("./testdata/test_data.txt", "w");
ASSERT_FALSE(file == nullptr);
static constexpr char STRING[] = "A simple string written to a file\n";
- result = __llvm_libc::fwrite(STRING, 1, sizeof(STRING) - 1, file);
+ result = LIBC_NAMESPACE::fwrite(STRING, 1, sizeof(STRING) - 1, file);
EXPECT_GE(result, 0);
- ASSERT_EQ(0, __llvm_libc::fclose(file));
+ ASSERT_EQ(0, LIBC_NAMESPACE::fclose(file));
- FILE *new_file = __llvm_libc::fopen("./testdata/test_data.txt", "r");
+ FILE *new_file = LIBC_NAMESPACE::fopen("./testdata/test_data.txt", "r");
ASSERT_FALSE(new_file == nullptr);
static char data[64] = {0};
- ASSERT_EQ(__llvm_libc::fread(data, 1, sizeof(STRING) - 1, new_file),
+ ASSERT_EQ(LIBC_NAMESPACE::fread(data, 1, sizeof(STRING) - 1, new_file),
sizeof(STRING) - 1);
data[sizeof(STRING) - 1] = '\0';
ASSERT_STREQ(data, STRING);
- ASSERT_EQ(0, __llvm_libc::fclose(new_file));
+ ASSERT_EQ(0, LIBC_NAMESPACE::fclose(new_file));
}
diff --git a/libc/test/src/stdio/fopencookie_test.cpp b/libc/test/src/stdio/fopencookie_test.cpp
index cfdaef2149f5b01..6f3c2910cfd8235 100644
--- a/libc/test/src/stdio/fopencookie_test.cpp
+++ b/libc/test/src/stdio/fopencookie_test.cpp
@@ -22,7 +22,7 @@
#include <stdio.h>
#include <stdlib.h>
-using MemoryView = __llvm_libc::testing::MemoryView;
+using MemoryView = LIBC_NAMESPACE::testing::MemoryView;
struct StringStream {
char *buf;
@@ -98,29 +98,29 @@ TEST(LlvmLibcFOpenCookie, ReadOnlyCookieTest) {
for (size_t i = 0; i < sizeof(CONTENT); ++i)
ss->buf[i] = CONTENT[i];
- ::FILE *f = __llvm_libc::fopencookie(ss, "r", STRING_STREAM_FUNCS);
+ ::FILE *f = LIBC_NAMESPACE::fopencookie(ss, "r", STRING_STREAM_FUNCS);
ASSERT_TRUE(f != nullptr);
char read_data[sizeof(CONTENT)];
ASSERT_EQ(sizeof(CONTENT),
- __llvm_libc::fread(read_data, 1, sizeof(CONTENT), f));
+ LIBC_NAMESPACE::fread(read_data, 1, sizeof(CONTENT), f));
ASSERT_STREQ(read_data, CONTENT);
// Reading another time should trigger eof.
ASSERT_NE(sizeof(CONTENT),
- __llvm_libc::fread(read_data, 1, sizeof(CONTENT), f));
- ASSERT_NE(__llvm_libc::feof(f), 0);
+ LIBC_NAMESPACE::fread(read_data, 1, sizeof(CONTENT), f));
+ ASSERT_NE(LIBC_NAMESPACE::feof(f), 0);
- ASSERT_EQ(0, __llvm_libc::fseek(f, 0, SEEK_SET));
+ ASSERT_EQ(0, LIBC_NAMESPACE::fseek(f, 0, SEEK_SET));
// Should be an error to write.
- ASSERT_EQ(size_t(0), __llvm_libc::fwrite(CONTENT, 1, sizeof(CONTENT), f));
- ASSERT_NE(__llvm_libc::ferror(f), 0);
+ ASSERT_EQ(size_t(0), LIBC_NAMESPACE::fwrite(CONTENT, 1, sizeof(CONTENT), f));
+ ASSERT_NE(LIBC_NAMESPACE::ferror(f), 0);
ASSERT_NE(libc_errno, 0);
libc_errno = 0;
- __llvm_libc::clearerr(f);
- ASSERT_EQ(__llvm_libc::ferror(f), 0);
+ LIBC_NAMESPACE::clearerr(f);
+ ASSERT_EQ(LIBC_NAMESPACE::ferror(f), 0);
- ASSERT_EQ(0, __llvm_libc::fclose(f));
+ ASSERT_EQ(0, LIBC_NAMESPACE::fclose(f));
free(ss);
}
@@ -132,28 +132,29 @@ TEST(LlvmLibcFOpenCookie, WriteOnlyCookieTest) {
ss->offset = 0;
ss->endpos = 0;
- ::FILE *f = __llvm_libc::fopencookie(ss, "w", STRING_STREAM_FUNCS);
+ ::FILE *f = LIBC_NAMESPACE::fopencookie(ss, "w", STRING_STREAM_FUNCS);
ASSERT_TRUE(f != nullptr);
constexpr char WRITE_DATA[] = "Hello,writeonly!";
ASSERT_EQ(sizeof(WRITE_DATA),
- __llvm_libc::fwrite(WRITE_DATA, 1, sizeof(WRITE_DATA), f));
+ LIBC_NAMESPACE::fwrite(WRITE_DATA, 1, sizeof(WRITE_DATA), f));
// Flushing will ensure the data to be written to the string stream.
- ASSERT_EQ(0, __llvm_libc::fflush(f));
+ ASSERT_EQ(0, LIBC_NAMESPACE::fflush(f));
ASSERT_STREQ(WRITE_DATA, ss->buf);
- ASSERT_EQ(0, __llvm_libc::fseek(f, 0, SEEK_SET));
+ ASSERT_EQ(0, LIBC_NAMESPACE::fseek(f, 0, SEEK_SET));
char read_data[sizeof(WRITE_DATA)];
// Should be an error to read.
- ASSERT_EQ(size_t(0), __llvm_libc::fread(read_data, 1, sizeof(WRITE_DATA), f));
- ASSERT_NE(__llvm_libc::ferror(f), 0);
+ ASSERT_EQ(size_t(0),
+ LIBC_NAMESPACE::fread(read_data, 1, sizeof(WRITE_DATA), f));
+ ASSERT_NE(LIBC_NAMESPACE::ferror(f), 0);
ASSERT_EQ(libc_errno, EBADF);
libc_errno = 0;
- __llvm_libc::clearerr(f);
- ASSERT_EQ(__llvm_libc::ferror(f), 0);
+ LIBC_NAMESPACE::clearerr(f);
+ ASSERT_EQ(LIBC_NAMESPACE::ferror(f), 0);
- ASSERT_EQ(0, __llvm_libc::fclose(f));
+ ASSERT_EQ(0, LIBC_NAMESPACE::fclose(f));
free(ss);
}
@@ -168,26 +169,26 @@ TEST(LlvmLibcFOpenCookie, AppendOnlyCookieTest) {
for (size_t i = 0; i < sizeof(INITIAL_CONTENT); ++i)
ss->buf[i] = INITIAL_CONTENT[i];
- ::FILE *f = __llvm_libc::fopencookie(ss, "a", STRING_STREAM_FUNCS);
+ ::FILE *f = LIBC_NAMESPACE::fopencookie(ss, "a", STRING_STREAM_FUNCS);
ASSERT_TRUE(f != nullptr);
constexpr size_t READ_SIZE = 5;
char read_data[READ_SIZE];
// This is not a readable file.
- ASSERT_EQ(__llvm_libc::fread(read_data, 1, READ_SIZE, f), size_t(0));
- ASSERT_NE(__llvm_libc::ferror(f), 0);
+ ASSERT_EQ(LIBC_NAMESPACE::fread(read_data, 1, READ_SIZE, f), size_t(0));
+ ASSERT_NE(LIBC_NAMESPACE::ferror(f), 0);
EXPECT_NE(libc_errno, 0);
libc_errno = 0;
- __llvm_libc::clearerr(f);
- ASSERT_EQ(__llvm_libc::ferror(f), 0);
+ LIBC_NAMESPACE::clearerr(f);
+ ASSERT_EQ(LIBC_NAMESPACE::ferror(f), 0);
- ASSERT_EQ(__llvm_libc::fwrite(WRITE_DATA, 1, sizeof(WRITE_DATA), f),
+ ASSERT_EQ(LIBC_NAMESPACE::fwrite(WRITE_DATA, 1, sizeof(WRITE_DATA), f),
sizeof(WRITE_DATA));
- EXPECT_EQ(__llvm_libc::fflush(f), 0);
+ EXPECT_EQ(LIBC_NAMESPACE::fflush(f), 0);
EXPECT_EQ(ss->endpos, sizeof(WRITE_DATA) + sizeof(INITIAL_CONTENT));
- ASSERT_EQ(__llvm_libc::fclose(f), 0);
+ ASSERT_EQ(LIBC_NAMESPACE::fclose(f), 0);
free(ss);
}
@@ -201,24 +202,24 @@ TEST(LlvmLibcFOpenCookie, ReadUpdateCookieTest) {
for (size_t i = 0; i < sizeof(INITIAL_CONTENT); ++i)
ss->buf[i] = INITIAL_CONTENT[i];
- ::FILE *f = __llvm_libc::fopencookie(ss, "r+", STRING_STREAM_FUNCS);
+ ::FILE *f = LIBC_NAMESPACE::fopencookie(ss, "r+", STRING_STREAM_FUNCS);
ASSERT_TRUE(f != nullptr);
constexpr size_t READ_SIZE = sizeof(INITIAL_CONTENT) / 2;
char read_data[READ_SIZE];
- ASSERT_EQ(READ_SIZE, __llvm_libc::fread(read_data, 1, READ_SIZE, f));
+ ASSERT_EQ(READ_SIZE, LIBC_NAMESPACE::fread(read_data, 1, READ_SIZE, f));
MemoryView src1(INITIAL_CONTENT, READ_SIZE), dst1(read_data, READ_SIZE);
EXPECT_MEM_EQ(src1, dst1);
- ASSERT_EQ(__llvm_libc::fseek(f, 0, SEEK_SET), 0);
+ ASSERT_EQ(LIBC_NAMESPACE::fseek(f, 0, SEEK_SET), 0);
constexpr char WRITE_DATA[] = "hello, file";
ASSERT_EQ(sizeof(WRITE_DATA),
- __llvm_libc::fwrite(WRITE_DATA, 1, sizeof(WRITE_DATA), f));
- ASSERT_EQ(__llvm_libc::fflush(f), 0);
+ LIBC_NAMESPACE::fwrite(WRITE_DATA, 1, sizeof(WRITE_DATA), f));
+ ASSERT_EQ(LIBC_NAMESPACE::fflush(f), 0);
EXPECT_STREQ(ss->buf, WRITE_DATA);
- ASSERT_EQ(__llvm_libc::fclose(f), 0);
+ ASSERT_EQ(LIBC_NAMESPACE::fclose(f), 0);
free(ss);
}
@@ -230,19 +231,19 @@ TEST(LlvmLibcFOpenCookie, WriteUpdateCookieTest) {
ss->offset = 0;
ss->endpos = 0;
- ::FILE *f = __llvm_libc::fopencookie(ss, "w+", STRING_STREAM_FUNCS);
+ ::FILE *f = LIBC_NAMESPACE::fopencookie(ss, "w+", STRING_STREAM_FUNCS);
ASSERT_TRUE(f != nullptr);
ASSERT_EQ(sizeof(WRITE_DATA),
- __llvm_libc::fwrite(WRITE_DATA, 1, sizeof(WRITE_DATA), f));
+ LIBC_NAMESPACE::fwrite(WRITE_DATA, 1, sizeof(WRITE_DATA), f));
- ASSERT_EQ(__llvm_libc::fseek(f, 0, SEEK_SET), 0);
+ ASSERT_EQ(LIBC_NAMESPACE::fseek(f, 0, SEEK_SET), 0);
char read_data[sizeof(WRITE_DATA)];
- ASSERT_EQ(__llvm_libc::fread(read_data, 1, sizeof(read_data), f),
+ ASSERT_EQ(LIBC_NAMESPACE::fread(read_data, 1, sizeof(read_data), f),
sizeof(read_data));
EXPECT_STREQ(read_data, WRITE_DATA);
- ASSERT_EQ(__llvm_libc::fclose(f), 0);
+ ASSERT_EQ(LIBC_NAMESPACE::fclose(f), 0);
free(ss);
}
diff --git a/libc/test/src/stdio/fprintf_test.cpp b/libc/test/src/stdio/fprintf_test.cpp
index a521bb47eb1362a..5370e0ec288b63b 100644
--- a/libc/test/src/stdio/fprintf_test.cpp
+++ b/libc/test/src/stdio/fprintf_test.cpp
@@ -21,10 +21,10 @@
namespace printf_test {
#ifndef LIBC_COPT_PRINTF_USE_SYSTEM_FILE
-using __llvm_libc::fclose;
-using __llvm_libc::ferror;
-using __llvm_libc::fopen;
-using __llvm_libc::fread;
+using LIBC_NAMESPACE::fclose;
+using LIBC_NAMESPACE::ferror;
+using LIBC_NAMESPACE::fopen;
+using LIBC_NAMESPACE::fread;
#else // defined(LIBC_COPT_PRINTF_USE_SYSTEM_FILE)
using ::fclose;
using ::ferror;
@@ -43,16 +43,16 @@ TEST(LlvmLibcFPrintfTest, WriteToFile) {
int written;
constexpr char simple[] = "A simple string with no conversions.\n";
- written = __llvm_libc::fprintf(file, simple);
+ written = LIBC_NAMESPACE::fprintf(file, simple);
EXPECT_EQ(written, 37);
constexpr char numbers[] = "1234567890\n";
- written = __llvm_libc::fprintf(file, "%s", numbers);
+ written = LIBC_NAMESPACE::fprintf(file, "%s", numbers);
EXPECT_EQ(written, 11);
constexpr char format_more[] = "%s and more\n";
constexpr char short_numbers[] = "1234";
- written = __llvm_libc::fprintf(file, format_more, short_numbers);
+ written = LIBC_NAMESPACE::fprintf(file, format_more, short_numbers);
EXPECT_EQ(written, 14);
ASSERT_EQ(0, printf_test::fclose(file));
@@ -78,7 +78,7 @@ TEST(LlvmLibcFPrintfTest, WriteToFile) {
ASSERT_EQ(printf_test::ferror(file), 0);
written =
- __llvm_libc::fprintf(file, "Writing to a read only file should fail.");
+ LIBC_NAMESPACE::fprintf(file, "Writing to a read only file should fail.");
EXPECT_LT(written, 0);
ASSERT_EQ(printf_test::fclose(file), 0);
diff --git a/libc/test/src/stdio/fputc_test.cpp b/libc/test/src/stdio/fputc_test.cpp
index e5aa7c713463bf2..578403fc374b018 100644
--- a/libc/test/src/stdio/fputc_test.cpp
+++ b/libc/test/src/stdio/fputc_test.cpp
@@ -17,14 +17,14 @@ TEST(LlvmLibcPutcTest, PrintOut) {
constexpr char simple[] = "A simple string written to stdout\n";
for (const char &c : simple) {
- result = __llvm_libc::putchar(c);
+ result = LIBC_NAMESPACE::putchar(c);
EXPECT_GE(result, 0);
}
constexpr char more[] = "A simple string written to stderr\n";
for (const char &c : simple) {
- result =
- __llvm_libc::fputc(c, reinterpret_cast<FILE *>(__llvm_libc::stderr));
+ result = LIBC_NAMESPACE::fputc(
+ c, reinterpret_cast<FILE *>(LIBC_NAMESPACE::stderr));
}
EXPECT_GE(result, 0);
}
diff --git a/libc/test/src/stdio/fputs_test.cpp b/libc/test/src/stdio/fputs_test.cpp
index 8c206966b954a6a..6583738acb94c1c 100644
--- a/libc/test/src/stdio/fputs_test.cpp
+++ b/libc/test/src/stdio/fputs_test.cpp
@@ -15,12 +15,12 @@ TEST(LlvmLibcPutsTest, PrintOut) {
int result;
constexpr char simple[] = "A simple string written to stdout\n";
- result =
- __llvm_libc::fputs(simple, reinterpret_cast<FILE *>(__llvm_libc::stdout));
+ result = LIBC_NAMESPACE::fputs(
+ simple, reinterpret_cast<FILE *>(LIBC_NAMESPACE::stdout));
EXPECT_GE(result, 0);
constexpr char more[] = "A simple string written to stderr\n";
- result =
- __llvm_libc::fputs(more, reinterpret_cast<FILE *>(__llvm_libc::stderr));
+ result = LIBC_NAMESPACE::fputs(
+ more, reinterpret_cast<FILE *>(LIBC_NAMESPACE::stderr));
EXPECT_GE(result, 0);
}
diff --git a/libc/test/src/stdio/fscanf_test.cpp b/libc/test/src/stdio/fscanf_test.cpp
index 71402f0e7c75b4e..039745bc8b0163b 100644
--- a/libc/test/src/stdio/fscanf_test.cpp
+++ b/libc/test/src/stdio/fscanf_test.cpp
@@ -20,7 +20,7 @@
TEST(LlvmLibcFScanfTest, WriteToFile) {
constexpr char FILENAME[] = "testdata/fscanf_output.test";
- ::FILE *file = __llvm_libc::fopen(FILENAME, "w");
+ ::FILE *file = LIBC_NAMESPACE::fopen(FILENAME, "w");
ASSERT_FALSE(file == nullptr);
int read;
@@ -28,45 +28,46 @@ TEST(LlvmLibcFScanfTest, WriteToFile) {
constexpr char simple[] = "A simple string with no conversions.\n";
ASSERT_EQ(sizeof(simple) - 1,
- __llvm_libc::fwrite(simple, 1, sizeof(simple) - 1, file));
+ LIBC_NAMESPACE::fwrite(simple, 1, sizeof(simple) - 1, file));
constexpr char numbers[] = "1234567890\n";
ASSERT_EQ(sizeof(numbers) - 1,
- __llvm_libc::fwrite(numbers, 1, sizeof(numbers) - 1, file));
+ LIBC_NAMESPACE::fwrite(numbers, 1, sizeof(numbers) - 1, file));
constexpr char numbers_and_more[] = "1234 and more\n";
ASSERT_EQ(sizeof(numbers_and_more) - 1,
- __llvm_libc::fwrite(numbers_and_more, 1,
- sizeof(numbers_and_more) - 1, file));
+ LIBC_NAMESPACE::fwrite(numbers_and_more, 1,
+ sizeof(numbers_and_more) - 1, file));
- read =
- __llvm_libc::fscanf(file, "Reading from a write-only file should fail.");
+ read = LIBC_NAMESPACE::fscanf(file,
+ "Reading from a write-only file should fail.");
EXPECT_LT(read, 0);
- ASSERT_EQ(0, __llvm_libc::fclose(file));
+ ASSERT_EQ(0, LIBC_NAMESPACE::fclose(file));
- file = __llvm_libc::fopen(FILENAME, "r");
+ file = LIBC_NAMESPACE::fopen(FILENAME, "r");
ASSERT_FALSE(file == nullptr);
char data[50];
- read = __llvm_libc::fscanf(file, "%[A-Za-z .\n]", data);
+ read = LIBC_NAMESPACE::fscanf(file, "%[A-Za-z .\n]", data);
ASSERT_EQ(read, 1);
ASSERT_STREQ(simple, data);
- read = __llvm_libc::fscanf(file, "%s", data);
+ read = LIBC_NAMESPACE::fscanf(file, "%s", data);
ASSERT_EQ(read, 1);
- ASSERT_EQ(__llvm_libc::cpp::string_view(numbers, 10),
- __llvm_libc::cpp::string_view(data));
+ ASSERT_EQ(LIBC_NAMESPACE::cpp::string_view(numbers, 10),
+ LIBC_NAMESPACE::cpp::string_view(data));
// The format string starts with a space to handle the fact that the %s leaves
// a trailing \n and %c doesn't strip leading whitespace.
- read = __llvm_libc::fscanf(file, " %50c", data);
+ read = LIBC_NAMESPACE::fscanf(file, " %50c", data);
ASSERT_EQ(read, 1);
- ASSERT_EQ(__llvm_libc::cpp::string_view(numbers_and_more),
- __llvm_libc::cpp::string_view(data, sizeof(numbers_and_more) - 1));
+ ASSERT_EQ(
+ LIBC_NAMESPACE::cpp::string_view(numbers_and_more),
+ LIBC_NAMESPACE::cpp::string_view(data, sizeof(numbers_and_more) - 1));
- ASSERT_EQ(__llvm_libc::ferror(file), 0);
- ASSERT_EQ(__llvm_libc::fclose(file), 0);
+ ASSERT_EQ(LIBC_NAMESPACE::ferror(file), 0);
+ ASSERT_EQ(LIBC_NAMESPACE::fclose(file), 0);
}
diff --git a/libc/test/src/stdio/ftell_test.cpp b/libc/test/src/stdio/ftell_test.cpp
index fec881db4d888b6..61b626f53cd26ec 100644
--- a/libc/test/src/stdio/ftell_test.cpp
+++ b/libc/test/src/stdio/ftell_test.cpp
@@ -17,41 +17,41 @@
#include <stdio.h>
-class LlvmLibcFTellTest : public __llvm_libc::testing::Test {
+class LlvmLibcFTellTest : public LIBC_NAMESPACE::testing::Test {
protected:
void test_with_bufmode(int bufmode) {
constexpr char FILENAME[] = "testdata/ftell.test";
// We will set a special buffer to the file so that we guarantee buffering.
constexpr size_t BUFFER_SIZE = 1024;
char buffer[BUFFER_SIZE];
- ::FILE *file = __llvm_libc::fopen(FILENAME, "w+");
+ ::FILE *file = LIBC_NAMESPACE::fopen(FILENAME, "w+");
ASSERT_FALSE(file == nullptr);
- ASSERT_EQ(__llvm_libc::setvbuf(file, buffer, bufmode, BUFFER_SIZE), 0);
+ ASSERT_EQ(LIBC_NAMESPACE::setvbuf(file, buffer, bufmode, BUFFER_SIZE), 0);
// Include few '\n' chars to test when |bufmode| is _IOLBF.
constexpr char CONTENT[] = "12\n345\n6789";
constexpr size_t WRITE_SIZE = sizeof(CONTENT) - 1;
- ASSERT_EQ(WRITE_SIZE, __llvm_libc::fwrite(CONTENT, 1, WRITE_SIZE, file));
+ ASSERT_EQ(WRITE_SIZE, LIBC_NAMESPACE::fwrite(CONTENT, 1, WRITE_SIZE, file));
// The above write should have buffered the written data and not have
// trasferred it to the underlying stream. But, ftell operation should
// still return the correct effective offset.
- ASSERT_EQ(size_t(__llvm_libc::ftell(file)), WRITE_SIZE);
+ ASSERT_EQ(size_t(LIBC_NAMESPACE::ftell(file)), WRITE_SIZE);
long offset = 5;
- ASSERT_EQ(0, __llvm_libc::fseek(file, offset, SEEK_SET));
- ASSERT_EQ(__llvm_libc::ftell(file), offset);
- ASSERT_EQ(0, __llvm_libc::fseek(file, -offset, SEEK_END));
- ASSERT_EQ(size_t(__llvm_libc::ftell(file)), size_t(WRITE_SIZE - offset));
+ ASSERT_EQ(0, LIBC_NAMESPACE::fseek(file, offset, SEEK_SET));
+ ASSERT_EQ(LIBC_NAMESPACE::ftell(file), offset);
+ ASSERT_EQ(0, LIBC_NAMESPACE::fseek(file, -offset, SEEK_END));
+ ASSERT_EQ(size_t(LIBC_NAMESPACE::ftell(file)), size_t(WRITE_SIZE - offset));
- ASSERT_EQ(0, __llvm_libc::fseek(file, 0, SEEK_SET));
+ ASSERT_EQ(0, LIBC_NAMESPACE::fseek(file, 0, SEEK_SET));
constexpr size_t READ_SIZE = WRITE_SIZE / 2;
char data[READ_SIZE];
// Reading a small amount will actually read out much more data and
// buffer it. But, ftell should return the correct effective offset.
- ASSERT_EQ(READ_SIZE, __llvm_libc::fread(data, 1, READ_SIZE, file));
- ASSERT_EQ(size_t(__llvm_libc::ftell(file)), READ_SIZE);
+ ASSERT_EQ(READ_SIZE, LIBC_NAMESPACE::fread(data, 1, READ_SIZE, file));
+ ASSERT_EQ(size_t(LIBC_NAMESPACE::ftell(file)), READ_SIZE);
- ASSERT_EQ(0, __llvm_libc::fclose(file));
+ ASSERT_EQ(0, LIBC_NAMESPACE::fclose(file));
}
};
diff --git a/libc/test/src/stdio/printf_core/converter_test.cpp b/libc/test/src/stdio/printf_core/converter_test.cpp
index 69860d627f800dc..8404ef6ec7db4db 100644
--- a/libc/test/src/stdio/printf_core/converter_test.cpp
+++ b/libc/test/src/stdio/printf_core/converter_test.cpp
@@ -12,24 +12,24 @@
#include "test/UnitTest/Test.h"
-class LlvmLibcPrintfConverterTest : public __llvm_libc::testing::Test {
+class LlvmLibcPrintfConverterTest : public LIBC_NAMESPACE::testing::Test {
protected:
// void SetUp() override {}
// void TearDown() override {}
char str[60];
- __llvm_libc::printf_core::WriteBuffer wb =
- __llvm_libc::printf_core::WriteBuffer(str, sizeof(str) - 1);
- __llvm_libc::printf_core::Writer writer =
- __llvm_libc::printf_core::Writer(&wb);
+ LIBC_NAMESPACE::printf_core::WriteBuffer wb =
+ LIBC_NAMESPACE::printf_core::WriteBuffer(str, sizeof(str) - 1);
+ LIBC_NAMESPACE::printf_core::Writer writer =
+ LIBC_NAMESPACE::printf_core::Writer(&wb);
};
TEST_F(LlvmLibcPrintfConverterTest, SimpleRawConversion) {
- __llvm_libc::printf_core::FormatSection raw_section;
+ LIBC_NAMESPACE::printf_core::FormatSection raw_section;
raw_section.has_conv = false;
raw_section.raw_string = "abc";
- __llvm_libc::printf_core::convert(&writer, raw_section);
+ LIBC_NAMESPACE::printf_core::convert(&writer, raw_section);
wb.buff[wb.buff_cur] = '\0';
@@ -38,12 +38,12 @@ TEST_F(LlvmLibcPrintfConverterTest, SimpleRawConversion) {
}
TEST_F(LlvmLibcPrintfConverterTest, PercentConversion) {
- __llvm_libc::printf_core::FormatSection simple_conv;
+ LIBC_NAMESPACE::printf_core::FormatSection simple_conv;
simple_conv.has_conv = true;
simple_conv.raw_string = "%%";
simple_conv.conv_name = '%';
- __llvm_libc::printf_core::convert(&writer, simple_conv);
+ LIBC_NAMESPACE::printf_core::convert(&writer, simple_conv);
wb.buff[wb.buff_cur] = '\0';
@@ -52,7 +52,7 @@ TEST_F(LlvmLibcPrintfConverterTest, PercentConversion) {
}
TEST_F(LlvmLibcPrintfConverterTest, CharConversionSimple) {
- __llvm_libc::printf_core::FormatSection simple_conv;
+ LIBC_NAMESPACE::printf_core::FormatSection simple_conv;
simple_conv.has_conv = true;
// If has_conv is true, the raw string is ignored. They are not being parsed
// and match the actual conversion taking place so that you can compare these
@@ -61,7 +61,7 @@ TEST_F(LlvmLibcPrintfConverterTest, CharConversionSimple) {
simple_conv.conv_name = 'c';
simple_conv.conv_val_raw = 'D';
- __llvm_libc::printf_core::convert(&writer, simple_conv);
+ LIBC_NAMESPACE::printf_core::convert(&writer, simple_conv);
wb.buff[wb.buff_cur] = '\0';
@@ -70,13 +70,13 @@ TEST_F(LlvmLibcPrintfConverterTest, CharConversionSimple) {
}
TEST_F(LlvmLibcPrintfConverterTest, CharConversionRightJustified) {
- __llvm_libc::printf_core::FormatSection right_justified_conv;
+ LIBC_NAMESPACE::printf_core::FormatSection right_justified_conv;
right_justified_conv.has_conv = true;
right_justified_conv.raw_string = "%4c";
right_justified_conv.conv_name = 'c';
right_justified_conv.min_width = 4;
right_justified_conv.conv_val_raw = 'E';
- __llvm_libc::printf_core::convert(&writer, right_justified_conv);
+ LIBC_NAMESPACE::printf_core::convert(&writer, right_justified_conv);
wb.buff[wb.buff_cur] = '\0';
@@ -85,15 +85,15 @@ TEST_F(LlvmLibcPrintfConverterTest, CharConversionRightJustified) {
}
TEST_F(LlvmLibcPrintfConverterTest, CharConversionLeftJustified) {
- __llvm_libc::printf_core::FormatSection left_justified_conv;
+ LIBC_NAMESPACE::printf_core::FormatSection left_justified_conv;
left_justified_conv.has_conv = true;
left_justified_conv.raw_string = "%-4c";
left_justified_conv.conv_name = 'c';
left_justified_conv.flags =
- __llvm_libc::printf_core::FormatFlags::LEFT_JUSTIFIED;
+ LIBC_NAMESPACE::printf_core::FormatFlags::LEFT_JUSTIFIED;
left_justified_conv.min_width = 4;
left_justified_conv.conv_val_raw = 'F';
- __llvm_libc::printf_core::convert(&writer, left_justified_conv);
+ LIBC_NAMESPACE::printf_core::convert(&writer, left_justified_conv);
wb.buff[wb.buff_cur] = '\0';
@@ -103,13 +103,13 @@ TEST_F(LlvmLibcPrintfConverterTest, CharConversionLeftJustified) {
TEST_F(LlvmLibcPrintfConverterTest, StringConversionSimple) {
- __llvm_libc::printf_core::FormatSection simple_conv;
+ LIBC_NAMESPACE::printf_core::FormatSection simple_conv;
simple_conv.has_conv = true;
simple_conv.raw_string = "%s";
simple_conv.conv_name = 's';
simple_conv.conv_val_ptr = const_cast<char *>("DEF");
- __llvm_libc::printf_core::convert(&writer, simple_conv);
+ LIBC_NAMESPACE::printf_core::convert(&writer, simple_conv);
wb.buff[wb.buff_cur] = '\0';
@@ -118,13 +118,13 @@ TEST_F(LlvmLibcPrintfConverterTest, StringConversionSimple) {
}
TEST_F(LlvmLibcPrintfConverterTest, StringConversionPrecisionHigh) {
- __llvm_libc::printf_core::FormatSection high_precision_conv;
+ LIBC_NAMESPACE::printf_core::FormatSection high_precision_conv;
high_precision_conv.has_conv = true;
high_precision_conv.raw_string = "%4s";
high_precision_conv.conv_name = 's';
high_precision_conv.precision = 4;
high_precision_conv.conv_val_ptr = const_cast<char *>("456");
- __llvm_libc::printf_core::convert(&writer, high_precision_conv);
+ LIBC_NAMESPACE::printf_core::convert(&writer, high_precision_conv);
wb.buff[wb.buff_cur] = '\0';
@@ -133,13 +133,13 @@ TEST_F(LlvmLibcPrintfConverterTest, StringConversionPrecisionHigh) {
}
TEST_F(LlvmLibcPrintfConverterTest, StringConversionPrecisionLow) {
- __llvm_libc::printf_core::FormatSection low_precision_conv;
+ LIBC_NAMESPACE::printf_core::FormatSection low_precision_conv;
low_precision_conv.has_conv = true;
low_precision_conv.raw_string = "%.2s";
low_precision_conv.conv_name = 's';
low_precision_conv.precision = 2;
low_precision_conv.conv_val_ptr = const_cast<char *>("xyz");
- __llvm_libc::printf_core::convert(&writer, low_precision_conv);
+ LIBC_NAMESPACE::printf_core::convert(&writer, low_precision_conv);
wb.buff[wb.buff_cur] = '\0';
@@ -148,13 +148,13 @@ TEST_F(LlvmLibcPrintfConverterTest, StringConversionPrecisionLow) {
}
TEST_F(LlvmLibcPrintfConverterTest, StringConversionRightJustified) {
- __llvm_libc::printf_core::FormatSection right_justified_conv;
+ LIBC_NAMESPACE::printf_core::FormatSection right_justified_conv;
right_justified_conv.has_conv = true;
right_justified_conv.raw_string = "%4s";
right_justified_conv.conv_name = 's';
right_justified_conv.min_width = 4;
right_justified_conv.conv_val_ptr = const_cast<char *>("789");
- __llvm_libc::printf_core::convert(&writer, right_justified_conv);
+ LIBC_NAMESPACE::printf_core::convert(&writer, right_justified_conv);
wb.buff[wb.buff_cur] = '\0';
@@ -163,15 +163,15 @@ TEST_F(LlvmLibcPrintfConverterTest, StringConversionRightJustified) {
}
TEST_F(LlvmLibcPrintfConverterTest, StringConversionLeftJustified) {
- __llvm_libc::printf_core::FormatSection left_justified_conv;
+ LIBC_NAMESPACE::printf_core::FormatSection left_justified_conv;
left_justified_conv.has_conv = true;
left_justified_conv.raw_string = "%-4s";
left_justified_conv.conv_name = 's';
left_justified_conv.flags =
- __llvm_libc::printf_core::FormatFlags::LEFT_JUSTIFIED;
+ LIBC_NAMESPACE::printf_core::FormatFlags::LEFT_JUSTIFIED;
left_justified_conv.min_width = 4;
left_justified_conv.conv_val_ptr = const_cast<char *>("ghi");
- __llvm_libc::printf_core::convert(&writer, left_justified_conv);
+ LIBC_NAMESPACE::printf_core::convert(&writer, left_justified_conv);
wb.buff[wb.buff_cur] = '\0';
@@ -180,12 +180,12 @@ TEST_F(LlvmLibcPrintfConverterTest, StringConversionLeftJustified) {
}
TEST_F(LlvmLibcPrintfConverterTest, IntConversionSimple) {
- __llvm_libc::printf_core::FormatSection section;
+ LIBC_NAMESPACE::printf_core::FormatSection section;
section.has_conv = true;
section.raw_string = "%d";
section.conv_name = 'd';
section.conv_val_raw = 12345;
- __llvm_libc::printf_core::convert(&writer, section);
+ LIBC_NAMESPACE::printf_core::convert(&writer, section);
wb.buff[wb.buff_cur] = '\0';
@@ -194,16 +194,16 @@ TEST_F(LlvmLibcPrintfConverterTest, IntConversionSimple) {
}
TEST_F(LlvmLibcPrintfConverterTest, HexConversion) {
- __llvm_libc::printf_core::FormatSection section;
+ LIBC_NAMESPACE::printf_core::FormatSection section;
section.has_conv = true;
section.raw_string = "%#018x";
section.conv_name = 'x';
- section.flags = static_cast<__llvm_libc::printf_core::FormatFlags>(
- __llvm_libc::printf_core::FormatFlags::ALTERNATE_FORM |
- __llvm_libc::printf_core::FormatFlags::LEADING_ZEROES);
+ section.flags = static_cast<LIBC_NAMESPACE::printf_core::FormatFlags>(
+ LIBC_NAMESPACE::printf_core::FormatFlags::ALTERNATE_FORM |
+ LIBC_NAMESPACE::printf_core::FormatFlags::LEADING_ZEROES);
section.min_width = 18;
section.conv_val_raw = 0x123456ab;
- __llvm_libc::printf_core::convert(&writer, section);
+ LIBC_NAMESPACE::printf_core::convert(&writer, section);
wb.buff[wb.buff_cur] = '\0';
ASSERT_STREQ(str, "0x00000000123456ab");
@@ -212,12 +212,12 @@ TEST_F(LlvmLibcPrintfConverterTest, HexConversion) {
TEST_F(LlvmLibcPrintfConverterTest, PointerConversion) {
- __llvm_libc::printf_core::FormatSection section;
+ LIBC_NAMESPACE::printf_core::FormatSection section;
section.has_conv = true;
section.raw_string = "%p";
section.conv_name = 'p';
section.conv_val_ptr = (void *)(0x123456ab);
- __llvm_libc::printf_core::convert(&writer, section);
+ LIBC_NAMESPACE::printf_core::convert(&writer, section);
wb.buff[wb.buff_cur] = '\0';
ASSERT_STREQ(str, "0x123456ab");
@@ -226,12 +226,12 @@ TEST_F(LlvmLibcPrintfConverterTest, PointerConversion) {
TEST_F(LlvmLibcPrintfConverterTest, OctConversion) {
- __llvm_libc::printf_core::FormatSection section;
+ LIBC_NAMESPACE::printf_core::FormatSection section;
section.has_conv = true;
section.raw_string = "%o";
section.conv_name = 'o';
section.conv_val_raw = 01234;
- __llvm_libc::printf_core::convert(&writer, section);
+ LIBC_NAMESPACE::printf_core::convert(&writer, section);
wb.buff[wb.buff_cur] = '\0';
ASSERT_STREQ(str, "1234");
diff --git a/libc/test/src/stdio/printf_core/parser_test.cpp b/libc/test/src/stdio/printf_core/parser_test.cpp
index 61f8c7cbe580e74..ae86ea1cc9d4a79 100644
--- a/libc/test/src/stdio/printf_core/parser_test.cpp
+++ b/libc/test/src/stdio/printf_core/parser_test.cpp
@@ -16,25 +16,25 @@
#include "test/UnitTest/PrintfMatcher.h"
#include "test/UnitTest/Test.h"
-using __llvm_libc::cpp::string_view;
+using LIBC_NAMESPACE::cpp::string_view;
void init(const char *__restrict str, ...) {
va_list vlist;
va_start(vlist, str);
- __llvm_libc::internal::ArgList v(vlist);
+ LIBC_NAMESPACE::internal::ArgList v(vlist);
va_end(vlist);
- __llvm_libc::printf_core::Parser parser(str, v);
+ LIBC_NAMESPACE::printf_core::Parser parser(str, v);
}
-void evaluate(__llvm_libc::printf_core::FormatSection *format_arr,
+void evaluate(LIBC_NAMESPACE::printf_core::FormatSection *format_arr,
const char *__restrict str, ...) {
va_list vlist;
va_start(vlist, str);
- __llvm_libc::internal::ArgList v(vlist);
+ LIBC_NAMESPACE::internal::ArgList v(vlist);
va_end(vlist);
- __llvm_libc::printf_core::Parser parser(str, v);
+ LIBC_NAMESPACE::printf_core::Parser parser(str, v);
for (auto cur_section = parser.get_next_section();
!cur_section.raw_string.empty();
@@ -47,11 +47,11 @@ void evaluate(__llvm_libc::printf_core::FormatSection *format_arr,
TEST(LlvmLibcPrintfParserTest, Constructor) { init("test", 1, 2); }
TEST(LlvmLibcPrintfParserTest, EvalRaw) {
- __llvm_libc::printf_core::FormatSection format_arr[10];
+ LIBC_NAMESPACE::printf_core::FormatSection format_arr[10];
const char *str = "test";
evaluate(format_arr, str);
- __llvm_libc::printf_core::FormatSection expected;
+ LIBC_NAMESPACE::printf_core::FormatSection expected;
expected.has_conv = false;
expected.raw_string = {str, 4};
@@ -61,11 +61,11 @@ TEST(LlvmLibcPrintfParserTest, EvalRaw) {
}
TEST(LlvmLibcPrintfParserTest, EvalSimple) {
- __llvm_libc::printf_core::FormatSection format_arr[10];
+ LIBC_NAMESPACE::printf_core::FormatSection format_arr[10];
const char *str = "test %% test";
evaluate(format_arr, str);
- __llvm_libc::printf_core::FormatSection expected0, expected1, expected2;
+ LIBC_NAMESPACE::printf_core::FormatSection expected0, expected1, expected2;
expected0.has_conv = false;
expected0.raw_string = {str, 5};
@@ -87,12 +87,12 @@ TEST(LlvmLibcPrintfParserTest, EvalSimple) {
}
TEST(LlvmLibcPrintfParserTest, EvalOneArg) {
- __llvm_libc::printf_core::FormatSection format_arr[10];
+ LIBC_NAMESPACE::printf_core::FormatSection format_arr[10];
const char *str = "%d";
int arg1 = 12345;
evaluate(format_arr, str, arg1);
- __llvm_libc::printf_core::FormatSection expected;
+ LIBC_NAMESPACE::printf_core::FormatSection expected;
expected.has_conv = true;
expected.raw_string = {str, 2};
@@ -103,12 +103,12 @@ TEST(LlvmLibcPrintfParserTest, EvalOneArg) {
}
TEST(LlvmLibcPrintfParserTest, EvalBadArg) {
- __llvm_libc::printf_core::FormatSection format_arr[10];
+ LIBC_NAMESPACE::printf_core::FormatSection format_arr[10];
const char *str = "%\0abc";
int arg1 = 12345;
evaluate(format_arr, str, arg1);
- __llvm_libc::printf_core::FormatSection expected;
+ LIBC_NAMESPACE::printf_core::FormatSection expected;
expected.has_conv = false;
expected.raw_string = {str, 1};
@@ -116,21 +116,21 @@ TEST(LlvmLibcPrintfParserTest, EvalBadArg) {
}
TEST(LlvmLibcPrintfParserTest, EvalOneArgWithFlags) {
- __llvm_libc::printf_core::FormatSection format_arr[10];
+ LIBC_NAMESPACE::printf_core::FormatSection format_arr[10];
const char *str = "%+-0 #d";
int arg1 = 12345;
evaluate(format_arr, str, arg1);
- __llvm_libc::printf_core::FormatSection expected;
+ LIBC_NAMESPACE::printf_core::FormatSection expected;
expected.has_conv = true;
expected.raw_string = {str, 7};
- expected.flags = static_cast<__llvm_libc::printf_core::FormatFlags>(
- __llvm_libc::printf_core::FormatFlags::FORCE_SIGN |
- __llvm_libc::printf_core::FormatFlags::LEFT_JUSTIFIED |
- __llvm_libc::printf_core::FormatFlags::LEADING_ZEROES |
- __llvm_libc::printf_core::FormatFlags::SPACE_PREFIX |
- __llvm_libc::printf_core::FormatFlags::ALTERNATE_FORM);
+ expected.flags = static_cast<LIBC_NAMESPACE::printf_core::FormatFlags>(
+ LIBC_NAMESPACE::printf_core::FormatFlags::FORCE_SIGN |
+ LIBC_NAMESPACE::printf_core::FormatFlags::LEFT_JUSTIFIED |
+ LIBC_NAMESPACE::printf_core::FormatFlags::LEADING_ZEROES |
+ LIBC_NAMESPACE::printf_core::FormatFlags::SPACE_PREFIX |
+ LIBC_NAMESPACE::printf_core::FormatFlags::ALTERNATE_FORM);
expected.conv_val_raw = arg1;
expected.conv_name = 'd';
@@ -138,12 +138,12 @@ TEST(LlvmLibcPrintfParserTest, EvalOneArgWithFlags) {
}
TEST(LlvmLibcPrintfParserTest, EvalOneArgWithWidth) {
- __llvm_libc::printf_core::FormatSection format_arr[10];
+ LIBC_NAMESPACE::printf_core::FormatSection format_arr[10];
const char *str = "%12d";
int arg1 = 12345;
evaluate(format_arr, str, arg1);
- __llvm_libc::printf_core::FormatSection expected;
+ LIBC_NAMESPACE::printf_core::FormatSection expected;
expected.has_conv = true;
expected.raw_string = {str, 4};
@@ -155,12 +155,12 @@ TEST(LlvmLibcPrintfParserTest, EvalOneArgWithWidth) {
}
TEST(LlvmLibcPrintfParserTest, EvalOneArgWithPrecision) {
- __llvm_libc::printf_core::FormatSection format_arr[10];
+ LIBC_NAMESPACE::printf_core::FormatSection format_arr[10];
const char *str = "%.34d";
int arg1 = 12345;
evaluate(format_arr, str, arg1);
- __llvm_libc::printf_core::FormatSection expected;
+ LIBC_NAMESPACE::printf_core::FormatSection expected;
expected.has_conv = true;
expected.raw_string = {str, 5};
@@ -172,12 +172,12 @@ TEST(LlvmLibcPrintfParserTest, EvalOneArgWithPrecision) {
}
TEST(LlvmLibcPrintfParserTest, EvalOneArgWithTrivialPrecision) {
- __llvm_libc::printf_core::FormatSection format_arr[10];
+ LIBC_NAMESPACE::printf_core::FormatSection format_arr[10];
const char *str = "%.d";
int arg1 = 12345;
evaluate(format_arr, str, arg1);
- __llvm_libc::printf_core::FormatSection expected;
+ LIBC_NAMESPACE::printf_core::FormatSection expected;
expected.has_conv = true;
expected.raw_string = {str, 3};
@@ -189,16 +189,16 @@ TEST(LlvmLibcPrintfParserTest, EvalOneArgWithTrivialPrecision) {
}
TEST(LlvmLibcPrintfParserTest, EvalOneArgWithShortLengthModifier) {
- __llvm_libc::printf_core::FormatSection format_arr[10];
+ LIBC_NAMESPACE::printf_core::FormatSection format_arr[10];
const char *str = "%hd";
int arg1 = 12345;
evaluate(format_arr, str, arg1);
- __llvm_libc::printf_core::FormatSection expected;
+ LIBC_NAMESPACE::printf_core::FormatSection expected;
expected.has_conv = true;
expected.raw_string = {str, 3};
- expected.length_modifier = __llvm_libc::printf_core::LengthModifier::h;
+ expected.length_modifier = LIBC_NAMESPACE::printf_core::LengthModifier::h;
expected.conv_val_raw = arg1;
expected.conv_name = 'd';
@@ -206,16 +206,16 @@ TEST(LlvmLibcPrintfParserTest, EvalOneArgWithShortLengthModifier) {
}
TEST(LlvmLibcPrintfParserTest, EvalOneArgWithLongLengthModifier) {
- __llvm_libc::printf_core::FormatSection format_arr[10];
+ LIBC_NAMESPACE::printf_core::FormatSection format_arr[10];
const char *str = "%lld";
long long arg1 = 12345;
evaluate(format_arr, str, arg1);
- __llvm_libc::printf_core::FormatSection expected;
+ LIBC_NAMESPACE::printf_core::FormatSection expected;
expected.has_conv = true;
expected.raw_string = {str, 4};
- expected.length_modifier = __llvm_libc::printf_core::LengthModifier::ll;
+ expected.length_modifier = LIBC_NAMESPACE::printf_core::LengthModifier::ll;
expected.conv_val_raw = arg1;
expected.conv_name = 'd';
@@ -223,22 +223,22 @@ TEST(LlvmLibcPrintfParserTest, EvalOneArgWithLongLengthModifier) {
}
TEST(LlvmLibcPrintfParserTest, EvalOneArgWithAllOptions) {
- __llvm_libc::printf_core::FormatSection format_arr[10];
+ LIBC_NAMESPACE::printf_core::FormatSection format_arr[10];
const char *str = "% -056.78jd";
intmax_t arg1 = 12345;
evaluate(format_arr, str, arg1);
- __llvm_libc::printf_core::FormatSection expected;
+ LIBC_NAMESPACE::printf_core::FormatSection expected;
expected.has_conv = true;
expected.raw_string = {str, 11};
- expected.flags = static_cast<__llvm_libc::printf_core::FormatFlags>(
- __llvm_libc::printf_core::FormatFlags::LEFT_JUSTIFIED |
- __llvm_libc::printf_core::FormatFlags::LEADING_ZEROES |
- __llvm_libc::printf_core::FormatFlags::SPACE_PREFIX);
+ expected.flags = static_cast<LIBC_NAMESPACE::printf_core::FormatFlags>(
+ LIBC_NAMESPACE::printf_core::FormatFlags::LEFT_JUSTIFIED |
+ LIBC_NAMESPACE::printf_core::FormatFlags::LEADING_ZEROES |
+ LIBC_NAMESPACE::printf_core::FormatFlags::SPACE_PREFIX);
expected.min_width = 56;
expected.precision = 78;
- expected.length_modifier = __llvm_libc::printf_core::LengthModifier::j;
+ expected.length_modifier = LIBC_NAMESPACE::printf_core::LengthModifier::j;
expected.conv_val_raw = arg1;
expected.conv_name = 'd';
@@ -246,14 +246,14 @@ TEST(LlvmLibcPrintfParserTest, EvalOneArgWithAllOptions) {
}
TEST(LlvmLibcPrintfParserTest, EvalThreeArgs) {
- __llvm_libc::printf_core::FormatSection format_arr[10];
+ LIBC_NAMESPACE::printf_core::FormatSection format_arr[10];
const char *str = "%d%f%s";
int arg1 = 12345;
double arg2 = 123.45;
const char *arg3 = "12345";
evaluate(format_arr, str, arg1, arg2, arg3);
- __llvm_libc::printf_core::FormatSection expected0, expected1, expected2;
+ LIBC_NAMESPACE::printf_core::FormatSection expected0, expected1, expected2;
expected0.has_conv = true;
expected0.raw_string = {str, 2};
@@ -265,7 +265,7 @@ TEST(LlvmLibcPrintfParserTest, EvalThreeArgs) {
expected1.has_conv = true;
expected1.raw_string = {str + 2, 2};
- expected1.conv_val_raw = __llvm_libc::cpp::bit_cast<uint64_t>(arg2);
+ expected1.conv_val_raw = LIBC_NAMESPACE::cpp::bit_cast<uint64_t>(arg2);
expected1.conv_name = 'f';
ASSERT_PFORMAT_EQ(expected1, format_arr[1]);
@@ -282,12 +282,12 @@ TEST(LlvmLibcPrintfParserTest, EvalThreeArgs) {
#ifndef LIBC_COPT_PRINTF_DISABLE_INDEX_MODE
TEST(LlvmLibcPrintfParserTest, IndexModeOneArg) {
- __llvm_libc::printf_core::FormatSection format_arr[10];
+ LIBC_NAMESPACE::printf_core::FormatSection format_arr[10];
const char *str = "%1$d";
int arg1 = 12345;
evaluate(format_arr, str, arg1);
- __llvm_libc::printf_core::FormatSection expected;
+ LIBC_NAMESPACE::printf_core::FormatSection expected;
expected.has_conv = true;
expected.raw_string = {str, 4};
@@ -298,14 +298,14 @@ TEST(LlvmLibcPrintfParserTest, IndexModeOneArg) {
}
TEST(LlvmLibcPrintfParserTest, IndexModeThreeArgsSequential) {
- __llvm_libc::printf_core::FormatSection format_arr[10];
+ LIBC_NAMESPACE::printf_core::FormatSection format_arr[10];
const char *str = "%1$d%2$f%3$s";
int arg1 = 12345;
double arg2 = 123.45;
const char *arg3 = "12345";
evaluate(format_arr, str, arg1, arg2, arg3);
- __llvm_libc::printf_core::FormatSection expected0, expected1, expected2;
+ LIBC_NAMESPACE::printf_core::FormatSection expected0, expected1, expected2;
expected0.has_conv = true;
expected0.raw_string = {str, 4};
@@ -317,7 +317,7 @@ TEST(LlvmLibcPrintfParserTest, IndexModeThreeArgsSequential) {
expected1.has_conv = true;
expected1.raw_string = {str + 4, 4};
- expected1.conv_val_raw = __llvm_libc::cpp::bit_cast<uint64_t>(arg2);
+ expected1.conv_val_raw = LIBC_NAMESPACE::cpp::bit_cast<uint64_t>(arg2);
expected1.conv_name = 'f';
ASSERT_PFORMAT_EQ(expected1, format_arr[1]);
@@ -332,14 +332,14 @@ TEST(LlvmLibcPrintfParserTest, IndexModeThreeArgsSequential) {
}
TEST(LlvmLibcPrintfParserTest, IndexModeThreeArgsReverse) {
- __llvm_libc::printf_core::FormatSection format_arr[10];
+ LIBC_NAMESPACE::printf_core::FormatSection format_arr[10];
const char *str = "%3$d%2$f%1$s";
int arg1 = 12345;
double arg2 = 123.45;
const char *arg3 = "12345";
evaluate(format_arr, str, arg3, arg2, arg1);
- __llvm_libc::printf_core::FormatSection expected0, expected1, expected2;
+ LIBC_NAMESPACE::printf_core::FormatSection expected0, expected1, expected2;
expected0.has_conv = true;
expected0.raw_string = {str, 4};
@@ -351,7 +351,7 @@ TEST(LlvmLibcPrintfParserTest, IndexModeThreeArgsReverse) {
expected1.has_conv = true;
expected1.raw_string = {str + 4, 4};
- expected1.conv_val_raw = __llvm_libc::cpp::bit_cast<uint64_t>(arg2);
+ expected1.conv_val_raw = LIBC_NAMESPACE::cpp::bit_cast<uint64_t>(arg2);
expected1.conv_name = 'f';
ASSERT_PFORMAT_EQ(expected1, format_arr[1]);
@@ -366,14 +366,14 @@ TEST(LlvmLibcPrintfParserTest, IndexModeThreeArgsReverse) {
}
TEST(LlvmLibcPrintfParserTest, IndexModeTenArgsRandom) {
- __llvm_libc::printf_core::FormatSection format_arr[10];
+ LIBC_NAMESPACE::printf_core::FormatSection format_arr[10];
const char *str = "%6$d%3$d%7$d%2$d%8$d%1$d%4$d%9$d%5$d%10$d";
int args[10] = {6, 4, 2, 7, 9, 1, 3, 5, 8, 10};
evaluate(format_arr, str, args[0], args[1], args[2], args[3], args[4],
args[5], args[6], args[7], args[8], args[9]);
for (size_t i = 0; i < 10; ++i) {
- __llvm_libc::printf_core::FormatSection expected;
+ LIBC_NAMESPACE::printf_core::FormatSection expected;
expected.has_conv = true;
expected.raw_string = {str + (4 * i),
@@ -385,7 +385,7 @@ TEST(LlvmLibcPrintfParserTest, IndexModeTenArgsRandom) {
}
TEST(LlvmLibcPrintfParserTest, IndexModeComplexParsing) {
- __llvm_libc::printf_core::FormatSection format_arr[10];
+ LIBC_NAMESPACE::printf_core::FormatSection format_arr[10];
const char *str = "normal text %3$llu %% %2$ *4$f %2$ .*4$f %1$1.1c";
char arg1 = '1';
double arg2 = 123.45;
@@ -393,7 +393,7 @@ TEST(LlvmLibcPrintfParserTest, IndexModeComplexParsing) {
int arg4 = 10;
evaluate(format_arr, str, arg1, arg2, arg3, arg4);
- __llvm_libc::printf_core::FormatSection expected0, expected1, expected2,
+ LIBC_NAMESPACE::printf_core::FormatSection expected0, expected1, expected2,
expected3, expected4, expected5, expected6, expected7, expected8,
expected9;
@@ -406,7 +406,7 @@ TEST(LlvmLibcPrintfParserTest, IndexModeComplexParsing) {
expected1.has_conv = true;
expected1.raw_string = {str + 12, 6};
- expected1.length_modifier = __llvm_libc::printf_core::LengthModifier::ll;
+ expected1.length_modifier = LIBC_NAMESPACE::printf_core::LengthModifier::ll;
expected1.conv_val_raw = arg3;
expected1.conv_name = 'u';
@@ -434,9 +434,9 @@ TEST(LlvmLibcPrintfParserTest, IndexModeComplexParsing) {
expected5.has_conv = true;
expected5.raw_string = {str + 22, 8};
- expected5.flags = __llvm_libc::printf_core::FormatFlags::SPACE_PREFIX;
+ expected5.flags = LIBC_NAMESPACE::printf_core::FormatFlags::SPACE_PREFIX;
expected5.min_width = arg4;
- expected5.conv_val_raw = __llvm_libc::cpp::bit_cast<uint64_t>(arg2);
+ expected5.conv_val_raw = LIBC_NAMESPACE::cpp::bit_cast<uint64_t>(arg2);
expected5.conv_name = 'f';
EXPECT_PFORMAT_EQ(expected5, format_arr[5]);
@@ -450,9 +450,9 @@ TEST(LlvmLibcPrintfParserTest, IndexModeComplexParsing) {
expected7.has_conv = true;
expected7.raw_string = {str + 31, 9};
- expected7.flags = __llvm_libc::printf_core::FormatFlags::SPACE_PREFIX;
+ expected7.flags = LIBC_NAMESPACE::printf_core::FormatFlags::SPACE_PREFIX;
expected7.precision = arg4;
- expected7.conv_val_raw = __llvm_libc::cpp::bit_cast<uint64_t>(arg2);
+ expected7.conv_val_raw = LIBC_NAMESPACE::cpp::bit_cast<uint64_t>(arg2);
expected7.conv_name = 'f';
EXPECT_PFORMAT_EQ(expected7, format_arr[7]);
@@ -475,7 +475,7 @@ TEST(LlvmLibcPrintfParserTest, IndexModeComplexParsing) {
}
TEST(LlvmLibcPrintfParserTest, IndexModeGapCheck) {
- __llvm_libc::printf_core::FormatSection format_arr[10];
+ LIBC_NAMESPACE::printf_core::FormatSection format_arr[10];
const char *str = "%1$d%2$d%4$d";
int arg1 = 1;
int arg2 = 2;
@@ -484,7 +484,7 @@ TEST(LlvmLibcPrintfParserTest, IndexModeGapCheck) {
evaluate(format_arr, str, arg1, arg2, arg3, arg4);
- __llvm_libc::printf_core::FormatSection expected0, expected1, expected2;
+ LIBC_NAMESPACE::printf_core::FormatSection expected0, expected1, expected2;
expected0.has_conv = true;
expected0.raw_string = {str, 4};
@@ -507,11 +507,11 @@ TEST(LlvmLibcPrintfParserTest, IndexModeGapCheck) {
}
TEST(LlvmLibcPrintfParserTest, IndexModeTrailingPercentCrash) {
- __llvm_libc::printf_core::FormatSection format_arr[10];
+ LIBC_NAMESPACE::printf_core::FormatSection format_arr[10];
const char *str = "%2$d%";
evaluate(format_arr, str, 1, 2);
- __llvm_libc::printf_core::FormatSection expected0, expected1;
+ LIBC_NAMESPACE::printf_core::FormatSection expected0, expected1;
expected0.has_conv = false;
expected0.raw_string = {str, 4};
@@ -524,7 +524,7 @@ TEST(LlvmLibcPrintfParserTest, IndexModeTrailingPercentCrash) {
}
TEST(LlvmLibcPrintfParserTest, DoublePercentIsAllowedInvalidIndex) {
- __llvm_libc::printf_core::FormatSection format_arr[10];
+ LIBC_NAMESPACE::printf_core::FormatSection format_arr[10];
// Normally this conversion specifier would be raw (due to having a width
// defined as an invalid argument) but since it's a % conversion it's allowed
@@ -540,7 +540,7 @@ TEST(LlvmLibcPrintfParserTest, DoublePercentIsAllowedInvalidIndex) {
evaluate(format_arr, str, 1, 2);
- __llvm_libc::printf_core::FormatSection expected0;
+ LIBC_NAMESPACE::printf_core::FormatSection expected0;
expected0.has_conv = true;
expected0.raw_string = str;
diff --git a/libc/test/src/stdio/printf_core/writer_test.cpp b/libc/test/src/stdio/printf_core/writer_test.cpp
index f31ff91d64960e8..4fe5ffb4aa98912 100644
--- a/libc/test/src/stdio/printf_core/writer_test.cpp
+++ b/libc/test/src/stdio/printf_core/writer_test.cpp
@@ -13,9 +13,9 @@
#include "test/UnitTest/Test.h"
-using __llvm_libc::cpp::string_view;
-using __llvm_libc::printf_core::WriteBuffer;
-using __llvm_libc::printf_core::Writer;
+using LIBC_NAMESPACE::cpp::string_view;
+using LIBC_NAMESPACE::printf_core::WriteBuffer;
+using LIBC_NAMESPACE::printf_core::Writer;
TEST(LlvmLibcPrintfWriterTest, Constructor) {
char str[10];
@@ -200,8 +200,8 @@ int copy_to_out(string_view new_str, void *raw_out_buff) {
OutBuff *out_buff = reinterpret_cast<OutBuff *>(raw_out_buff);
- __llvm_libc::inline_memcpy(out_buff->out_str + out_buff->cur_pos,
- new_str.data(), new_str.size());
+ LIBC_NAMESPACE::inline_memcpy(out_buff->out_str + out_buff->cur_pos,
+ new_str.data(), new_str.size());
out_buff->cur_pos += new_str.size();
return 0;
diff --git a/libc/test/src/stdio/printf_test.cpp b/libc/test/src/stdio/printf_test.cpp
index e2e3675d443dd71..147d17bb4271f17 100644
--- a/libc/test/src/stdio/printf_test.cpp
+++ b/libc/test/src/stdio/printf_test.cpp
@@ -14,16 +14,16 @@ TEST(LlvmLibcPrintfTest, PrintOut) {
int written;
constexpr char simple[] = "A simple string with no conversions.\n";
- written = __llvm_libc::printf(simple);
+ written = LIBC_NAMESPACE::printf(simple);
EXPECT_EQ(written, static_cast<int>(sizeof(simple) - 1));
constexpr char numbers[] = "1234567890\n";
- written = __llvm_libc::printf("%s", numbers);
+ written = LIBC_NAMESPACE::printf("%s", numbers);
EXPECT_EQ(written, static_cast<int>(sizeof(numbers) - 1));
constexpr char format_more[] = "%s and more\n";
constexpr char short_numbers[] = "1234";
- written = __llvm_libc::printf(format_more, short_numbers);
+ written = LIBC_NAMESPACE::printf(format_more, short_numbers);
EXPECT_EQ(written,
static_cast<int>(sizeof(format_more) + sizeof(short_numbers) - 4));
}
diff --git a/libc/test/src/stdio/putc_test.cpp b/libc/test/src/stdio/putc_test.cpp
index 0bd3acc70ed85ca..7349a97d80e19dc 100644
--- a/libc/test/src/stdio/putc_test.cpp
+++ b/libc/test/src/stdio/putc_test.cpp
@@ -19,28 +19,28 @@
TEST(LlvmLibcPutcTest, WriteToFile) {
constexpr char FILENAME[] = "testdata/putc_output.test";
- ::FILE *file = __llvm_libc::fopen(FILENAME, "w");
+ ::FILE *file = LIBC_NAMESPACE::fopen(FILENAME, "w");
ASSERT_FALSE(file == nullptr);
constexpr char simple[] = "simple letters";
for (size_t i = 0; i < sizeof(simple); ++i) {
- ASSERT_EQ(__llvm_libc::putc(simple[i], file), 0);
+ ASSERT_EQ(LIBC_NAMESPACE::putc(simple[i], file), 0);
}
- ASSERT_EQ(0, __llvm_libc::fclose(file));
+ ASSERT_EQ(0, LIBC_NAMESPACE::fclose(file));
- file = __llvm_libc::fopen(FILENAME, "r");
+ file = LIBC_NAMESPACE::fopen(FILENAME, "r");
ASSERT_FALSE(file == nullptr);
char data[50];
- ASSERT_EQ(__llvm_libc::fread(data, 1, sizeof(simple) - 1, file),
+ ASSERT_EQ(LIBC_NAMESPACE::fread(data, 1, sizeof(simple) - 1, file),
sizeof(simple) - 1);
data[sizeof(simple) - 1] = '\0';
ASSERT_STREQ(data, simple);
- ASSERT_EQ(__llvm_libc::ferror(file), 0);
- EXPECT_LT(__llvm_libc::putc('L', file), 0);
+ ASSERT_EQ(LIBC_NAMESPACE::ferror(file), 0);
+ EXPECT_LT(LIBC_NAMESPACE::putc('L', file), 0);
- ASSERT_EQ(__llvm_libc::fclose(file), 0);
+ ASSERT_EQ(LIBC_NAMESPACE::fclose(file), 0);
}
diff --git a/libc/test/src/stdio/puts_test.cpp b/libc/test/src/stdio/puts_test.cpp
index a9fe1717783fd34..e9ce46eaa3190a8 100644
--- a/libc/test/src/stdio/puts_test.cpp
+++ b/libc/test/src/stdio/puts_test.cpp
@@ -14,15 +14,15 @@ TEST(LlvmLibcPutsTest, PrintOut) {
int result;
constexpr char simple[] = "A simple string";
- result = __llvm_libc::puts(simple);
+ result = LIBC_NAMESPACE::puts(simple);
EXPECT_GE(result, 0);
// check that it appends a second newline at the end.
constexpr char numbers[] = "1234567890\n";
- result = __llvm_libc::puts(numbers);
+ result = LIBC_NAMESPACE::puts(numbers);
EXPECT_GE(result, 0);
constexpr char more[] = "1234 and more\n6789 and rhyme";
- result = __llvm_libc::puts(more);
+ result = LIBC_NAMESPACE::puts(more);
EXPECT_GE(result, 0);
}
diff --git a/libc/test/src/stdio/remove_test.cpp b/libc/test/src/stdio/remove_test.cpp
index dab1c80943f2117..ce4a1352d1cc1a5 100644
--- a/libc/test/src/stdio/remove_test.cpp
+++ b/libc/test/src/stdio/remove_test.cpp
@@ -21,34 +21,35 @@ TEST(LlvmLibcRemoveTest, CreateAndRemoveFile) {
// The test strategy is to create a file and remove it, and also verify that
// it was removed.
libc_errno = 0;
- using __llvm_libc::testing::ErrnoSetterMatcher::Fails;
- using __llvm_libc::testing::ErrnoSetterMatcher::Succeeds;
+ using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails;
+ using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds;
constexpr const char *TEST_FILE = "testdata/remove.test.file";
- int fd = __llvm_libc::open(TEST_FILE, O_WRONLY | O_CREAT, S_IRWXU);
+ int fd = LIBC_NAMESPACE::open(TEST_FILE, O_WRONLY | O_CREAT, S_IRWXU);
ASSERT_EQ(libc_errno, 0);
ASSERT_GT(fd, 0);
- ASSERT_THAT(__llvm_libc::close(fd), Succeeds(0));
+ ASSERT_THAT(LIBC_NAMESPACE::close(fd), Succeeds(0));
- ASSERT_THAT(__llvm_libc::access(TEST_FILE, F_OK), Succeeds(0));
- ASSERT_THAT(__llvm_libc::remove(TEST_FILE), Succeeds(0));
- ASSERT_THAT(__llvm_libc::access(TEST_FILE, F_OK), Fails(ENOENT));
+ ASSERT_THAT(LIBC_NAMESPACE::access(TEST_FILE, F_OK), Succeeds(0));
+ ASSERT_THAT(LIBC_NAMESPACE::remove(TEST_FILE), Succeeds(0));
+ ASSERT_THAT(LIBC_NAMESPACE::access(TEST_FILE, F_OK), Fails(ENOENT));
}
TEST(LlvmLibcRemoveTest, CreateAndRemoveDir) {
// The test strategy is to create a dir and remove it, and also verify that
// it was removed.
libc_errno = 0;
- using __llvm_libc::testing::ErrnoSetterMatcher::Fails;
- using __llvm_libc::testing::ErrnoSetterMatcher::Succeeds;
+ using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails;
+ using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds;
constexpr const char *TEST_DIR = "testdata/remove.test.dir";
- ASSERT_THAT(__llvm_libc::mkdirat(AT_FDCWD, TEST_DIR, S_IRWXU), Succeeds(0));
+ ASSERT_THAT(LIBC_NAMESPACE::mkdirat(AT_FDCWD, TEST_DIR, S_IRWXU),
+ Succeeds(0));
- ASSERT_THAT(__llvm_libc::access(TEST_DIR, F_OK), Succeeds(0));
- ASSERT_THAT(__llvm_libc::remove(TEST_DIR), Succeeds(0));
- ASSERT_THAT(__llvm_libc::access(TEST_DIR, F_OK), Fails(ENOENT));
+ ASSERT_THAT(LIBC_NAMESPACE::access(TEST_DIR, F_OK), Succeeds(0));
+ ASSERT_THAT(LIBC_NAMESPACE::remove(TEST_DIR), Succeeds(0));
+ ASSERT_THAT(LIBC_NAMESPACE::access(TEST_DIR, F_OK), Fails(ENOENT));
}
TEST(LlvmLibcRemoveTest, RemoveNonExistent) {
- using __llvm_libc::testing::ErrnoSetterMatcher::Fails;
- ASSERT_THAT(__llvm_libc::remove("testdata/non-existent"), Fails(ENOENT));
+ using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails;
+ ASSERT_THAT(LIBC_NAMESPACE::remove("testdata/non-existent"), Fails(ENOENT));
}
diff --git a/libc/test/src/stdio/scanf_core/converter_test.cpp b/libc/test/src/stdio/scanf_core/converter_test.cpp
index 97cb77e91c9b2c6..c760debc1af4380 100644
--- a/libc/test/src/stdio/scanf_core/converter_test.cpp
+++ b/libc/test/src/stdio/scanf_core/converter_test.cpp
@@ -16,159 +16,159 @@
TEST(LlvmLibcScanfConverterTest, RawMatchBasic) {
const char *str = "abcdef";
- __llvm_libc::scanf_core::StringReader str_reader(str);
- __llvm_libc::scanf_core::Reader reader(&str_reader);
+ LIBC_NAMESPACE::scanf_core::StringReader str_reader(str);
+ LIBC_NAMESPACE::scanf_core::Reader reader(&str_reader);
// Reading "abc" should succeed.
- ASSERT_EQ(__llvm_libc::scanf_core::raw_match(&reader, "abc"),
- static_cast<int>(__llvm_libc::scanf_core::READ_OK));
+ ASSERT_EQ(LIBC_NAMESPACE::scanf_core::raw_match(&reader, "abc"),
+ static_cast<int>(LIBC_NAMESPACE::scanf_core::READ_OK));
ASSERT_EQ(reader.chars_read(), size_t(3));
// Reading nothing should succeed and not advance.
- ASSERT_EQ(__llvm_libc::scanf_core::raw_match(&reader, ""),
- static_cast<int>(__llvm_libc::scanf_core::READ_OK));
+ ASSERT_EQ(LIBC_NAMESPACE::scanf_core::raw_match(&reader, ""),
+ static_cast<int>(LIBC_NAMESPACE::scanf_core::READ_OK));
ASSERT_EQ(reader.chars_read(), size_t(3));
// Reading a space where there is none should succeed and not advance.
- ASSERT_EQ(__llvm_libc::scanf_core::raw_match(&reader, " "),
- static_cast<int>(__llvm_libc::scanf_core::READ_OK));
+ ASSERT_EQ(LIBC_NAMESPACE::scanf_core::raw_match(&reader, " "),
+ static_cast<int>(LIBC_NAMESPACE::scanf_core::READ_OK));
ASSERT_EQ(reader.chars_read(), size_t(3));
// Reading "d" should succeed and advance by 1.
- ASSERT_EQ(__llvm_libc::scanf_core::raw_match(&reader, "d"),
- static_cast<int>(__llvm_libc::scanf_core::READ_OK));
+ ASSERT_EQ(LIBC_NAMESPACE::scanf_core::raw_match(&reader, "d"),
+ static_cast<int>(LIBC_NAMESPACE::scanf_core::READ_OK));
ASSERT_EQ(reader.chars_read(), size_t(4));
// Reading "z" should fail and not advance.
- ASSERT_EQ(__llvm_libc::scanf_core::raw_match(&reader, "z"),
- static_cast<int>(__llvm_libc::scanf_core::MATCHING_FAILURE));
+ ASSERT_EQ(LIBC_NAMESPACE::scanf_core::raw_match(&reader, "z"),
+ static_cast<int>(LIBC_NAMESPACE::scanf_core::MATCHING_FAILURE));
ASSERT_EQ(reader.chars_read(), size_t(4));
// Reading "efgh" should fail but advance to the end.
- ASSERT_EQ(__llvm_libc::scanf_core::raw_match(&reader, "efgh"),
- static_cast<int>(__llvm_libc::scanf_core::MATCHING_FAILURE));
+ ASSERT_EQ(LIBC_NAMESPACE::scanf_core::raw_match(&reader, "efgh"),
+ static_cast<int>(LIBC_NAMESPACE::scanf_core::MATCHING_FAILURE));
ASSERT_EQ(reader.chars_read(), size_t(6));
}
TEST(LlvmLibcScanfConverterTest, RawMatchSpaces) {
const char *str = " a \t\n b cd";
- __llvm_libc::scanf_core::StringReader str_reader(str);
- __llvm_libc::scanf_core::Reader reader(&str_reader);
+ LIBC_NAMESPACE::scanf_core::StringReader str_reader(str);
+ LIBC_NAMESPACE::scanf_core::Reader reader(&str_reader);
// Reading "a" should fail and not advance.
// Since there's nothing in the format string (the second argument to
// raw_match) to match the space in the buffer it isn't consumed.
- ASSERT_EQ(__llvm_libc::scanf_core::raw_match(&reader, "a"),
- static_cast<int>(__llvm_libc::scanf_core::MATCHING_FAILURE));
+ ASSERT_EQ(LIBC_NAMESPACE::scanf_core::raw_match(&reader, "a"),
+ static_cast<int>(LIBC_NAMESPACE::scanf_core::MATCHING_FAILURE));
ASSERT_EQ(reader.chars_read(), size_t(0));
// Reading " \t\n " should succeed and advance past the space.
// Any number of space characters in the format string match 0 or more space
// characters in the buffer.
- ASSERT_EQ(__llvm_libc::scanf_core::raw_match(&reader, " \t\n "),
- static_cast<int>(__llvm_libc::scanf_core::READ_OK));
+ ASSERT_EQ(LIBC_NAMESPACE::scanf_core::raw_match(&reader, " \t\n "),
+ static_cast<int>(LIBC_NAMESPACE::scanf_core::READ_OK));
ASSERT_EQ(reader.chars_read(), size_t(1));
// Reading "ab" should fail and only advance past the a
// The a characters match, but the format string doesn't have anything to
// consume the spaces in the buffer, so it fails.
- ASSERT_EQ(__llvm_libc::scanf_core::raw_match(&reader, "ab"),
- static_cast<int>(__llvm_libc::scanf_core::MATCHING_FAILURE));
+ ASSERT_EQ(LIBC_NAMESPACE::scanf_core::raw_match(&reader, "ab"),
+ static_cast<int>(LIBC_NAMESPACE::scanf_core::MATCHING_FAILURE));
ASSERT_EQ(reader.chars_read(), size_t(2));
// Reading " b" should succeed and advance past the b
// Any number of space characters in the format string matches 0 or more space
// characters in the buffer.
- ASSERT_EQ(__llvm_libc::scanf_core::raw_match(&reader, " b"),
- static_cast<int>(__llvm_libc::scanf_core::READ_OK));
+ ASSERT_EQ(LIBC_NAMESPACE::scanf_core::raw_match(&reader, " b"),
+ static_cast<int>(LIBC_NAMESPACE::scanf_core::READ_OK));
ASSERT_EQ(reader.chars_read(), size_t(7));
// Reading "\t" should succeed and advance past the spaces to the c
- ASSERT_EQ(__llvm_libc::scanf_core::raw_match(&reader, "\t"),
- static_cast<int>(__llvm_libc::scanf_core::READ_OK));
+ ASSERT_EQ(LIBC_NAMESPACE::scanf_core::raw_match(&reader, "\t"),
+ static_cast<int>(LIBC_NAMESPACE::scanf_core::READ_OK));
ASSERT_EQ(reader.chars_read(), size_t(10));
// Reading "c d" should succeed and advance past the d.
// Here the space character in the format string is matching 0 space
// characters in the buffer.
- ASSERT_EQ(__llvm_libc::scanf_core::raw_match(&reader, "c d"),
- static_cast<int>(__llvm_libc::scanf_core::READ_OK));
+ ASSERT_EQ(LIBC_NAMESPACE::scanf_core::raw_match(&reader, "c d"),
+ static_cast<int>(LIBC_NAMESPACE::scanf_core::READ_OK));
ASSERT_EQ(reader.chars_read(), size_t(12));
}
TEST(LlvmLibcScanfConverterTest, StringConvSimple) {
const char *str = "abcDEF123 654LKJihg";
char result[20];
- __llvm_libc::scanf_core::StringReader str_reader(str);
- __llvm_libc::scanf_core::Reader reader(&str_reader);
+ LIBC_NAMESPACE::scanf_core::StringReader str_reader(str);
+ LIBC_NAMESPACE::scanf_core::Reader reader(&str_reader);
- __llvm_libc::scanf_core::FormatSection conv;
+ LIBC_NAMESPACE::scanf_core::FormatSection conv;
conv.has_conv = true;
conv.conv_name = 's';
conv.output_ptr = result;
- ASSERT_EQ(__llvm_libc::scanf_core::convert(&reader, conv),
- static_cast<int>(__llvm_libc::scanf_core::READ_OK));
+ ASSERT_EQ(LIBC_NAMESPACE::scanf_core::convert(&reader, conv),
+ static_cast<int>(LIBC_NAMESPACE::scanf_core::READ_OK));
ASSERT_EQ(reader.chars_read(), size_t(9));
ASSERT_STREQ(result, "abcDEF123");
//%s skips all spaces before beginning to read.
- ASSERT_EQ(__llvm_libc::scanf_core::convert(&reader, conv),
- static_cast<int>(__llvm_libc::scanf_core::READ_OK));
+ ASSERT_EQ(LIBC_NAMESPACE::scanf_core::convert(&reader, conv),
+ static_cast<int>(LIBC_NAMESPACE::scanf_core::READ_OK));
ASSERT_EQ(reader.chars_read(), size_t(19));
ASSERT_STREQ(result, "654LKJihg");
}
TEST(LlvmLibcScanfConverterTest, StringConvNoWrite) {
const char *str = "abcDEF123 654LKJihg";
- __llvm_libc::scanf_core::StringReader str_reader(str);
- __llvm_libc::scanf_core::Reader reader(&str_reader);
+ LIBC_NAMESPACE::scanf_core::StringReader str_reader(str);
+ LIBC_NAMESPACE::scanf_core::Reader reader(&str_reader);
- __llvm_libc::scanf_core::FormatSection conv;
+ LIBC_NAMESPACE::scanf_core::FormatSection conv;
conv.has_conv = true;
conv.conv_name = 's';
- conv.flags = __llvm_libc::scanf_core::NO_WRITE;
+ conv.flags = LIBC_NAMESPACE::scanf_core::NO_WRITE;
- ASSERT_EQ(__llvm_libc::scanf_core::convert(&reader, conv),
- static_cast<int>(__llvm_libc::scanf_core::READ_OK));
+ ASSERT_EQ(LIBC_NAMESPACE::scanf_core::convert(&reader, conv),
+ static_cast<int>(LIBC_NAMESPACE::scanf_core::READ_OK));
ASSERT_EQ(reader.chars_read(), size_t(9));
//%s skips all spaces before beginning to read.
- ASSERT_EQ(__llvm_libc::scanf_core::convert(&reader, conv),
- static_cast<int>(__llvm_libc::scanf_core::READ_OK));
+ ASSERT_EQ(LIBC_NAMESPACE::scanf_core::convert(&reader, conv),
+ static_cast<int>(LIBC_NAMESPACE::scanf_core::READ_OK));
ASSERT_EQ(reader.chars_read(), size_t(19));
}
TEST(LlvmLibcScanfConverterTest, StringConvWidth) {
const char *str = "abcDEF123 654LKJihg";
char result[6];
- __llvm_libc::scanf_core::StringReader str_reader(str);
- __llvm_libc::scanf_core::Reader reader(&str_reader);
+ LIBC_NAMESPACE::scanf_core::StringReader str_reader(str);
+ LIBC_NAMESPACE::scanf_core::Reader reader(&str_reader);
- __llvm_libc::scanf_core::FormatSection conv;
+ LIBC_NAMESPACE::scanf_core::FormatSection conv;
conv.has_conv = true;
conv.conv_name = 's';
conv.max_width = 5; // this means the result takes up 6 characters (with \0).
conv.output_ptr = result;
- ASSERT_EQ(__llvm_libc::scanf_core::convert(&reader, conv),
- static_cast<int>(__llvm_libc::scanf_core::READ_OK));
+ ASSERT_EQ(LIBC_NAMESPACE::scanf_core::convert(&reader, conv),
+ static_cast<int>(LIBC_NAMESPACE::scanf_core::READ_OK));
ASSERT_EQ(reader.chars_read(), size_t(5));
ASSERT_STREQ(result, "abcDE");
- ASSERT_EQ(__llvm_libc::scanf_core::convert(&reader, conv),
- static_cast<int>(__llvm_libc::scanf_core::READ_OK));
+ ASSERT_EQ(LIBC_NAMESPACE::scanf_core::convert(&reader, conv),
+ static_cast<int>(LIBC_NAMESPACE::scanf_core::READ_OK));
ASSERT_EQ(reader.chars_read(), size_t(9));
ASSERT_STREQ(result, "F123");
//%s skips all spaces before beginning to read.
- ASSERT_EQ(__llvm_libc::scanf_core::convert(&reader, conv),
- static_cast<int>(__llvm_libc::scanf_core::READ_OK));
+ ASSERT_EQ(LIBC_NAMESPACE::scanf_core::convert(&reader, conv),
+ static_cast<int>(LIBC_NAMESPACE::scanf_core::READ_OK));
ASSERT_EQ(reader.chars_read(), size_t(15));
ASSERT_STREQ(result, "654LK");
- ASSERT_EQ(__llvm_libc::scanf_core::convert(&reader, conv),
- static_cast<int>(__llvm_libc::scanf_core::READ_OK));
+ ASSERT_EQ(LIBC_NAMESPACE::scanf_core::convert(&reader, conv),
+ static_cast<int>(LIBC_NAMESPACE::scanf_core::READ_OK));
ASSERT_EQ(reader.chars_read(), size_t(19));
ASSERT_STREQ(result, "Jihg");
}
@@ -176,70 +176,70 @@ TEST(LlvmLibcScanfConverterTest, StringConvWidth) {
TEST(LlvmLibcScanfConverterTest, CharsConv) {
const char *str = "abcDEF123 654LKJihg MNOpqr&*(";
char result[20];
- __llvm_libc::scanf_core::StringReader str_reader(str);
- __llvm_libc::scanf_core::Reader reader(&str_reader);
+ LIBC_NAMESPACE::scanf_core::StringReader str_reader(str);
+ LIBC_NAMESPACE::scanf_core::Reader reader(&str_reader);
- __llvm_libc::scanf_core::FormatSection conv;
+ LIBC_NAMESPACE::scanf_core::FormatSection conv;
conv.has_conv = true;
conv.conv_name = 'c';
conv.output_ptr = result;
- ASSERT_EQ(__llvm_libc::scanf_core::convert(&reader, conv),
- static_cast<int>(__llvm_libc::scanf_core::READ_OK));
+ ASSERT_EQ(LIBC_NAMESPACE::scanf_core::convert(&reader, conv),
+ static_cast<int>(LIBC_NAMESPACE::scanf_core::READ_OK));
ASSERT_EQ(reader.chars_read(), size_t(1));
ASSERT_EQ(result[0], 'a');
- ASSERT_EQ(__llvm_libc::scanf_core::convert(&reader, conv),
- static_cast<int>(__llvm_libc::scanf_core::READ_OK));
+ ASSERT_EQ(LIBC_NAMESPACE::scanf_core::convert(&reader, conv),
+ static_cast<int>(LIBC_NAMESPACE::scanf_core::READ_OK));
ASSERT_EQ(reader.chars_read(), size_t(2));
ASSERT_EQ(result[0], 'b');
- ASSERT_EQ(__llvm_libc::scanf_core::convert(&reader, conv),
- static_cast<int>(__llvm_libc::scanf_core::READ_OK));
+ ASSERT_EQ(LIBC_NAMESPACE::scanf_core::convert(&reader, conv),
+ static_cast<int>(LIBC_NAMESPACE::scanf_core::READ_OK));
ASSERT_EQ(reader.chars_read(), size_t(3));
ASSERT_EQ(result[0], 'c');
// Switch from character by character to 8 at a time.
conv.max_width = 8;
- __llvm_libc::cpp::string_view result_view(result, 8);
+ LIBC_NAMESPACE::cpp::string_view result_view(result, 8);
//%c doesn't stop on spaces.
- ASSERT_EQ(__llvm_libc::scanf_core::convert(&reader, conv),
- static_cast<int>(__llvm_libc::scanf_core::READ_OK));
+ ASSERT_EQ(LIBC_NAMESPACE::scanf_core::convert(&reader, conv),
+ static_cast<int>(LIBC_NAMESPACE::scanf_core::READ_OK));
ASSERT_EQ(reader.chars_read(), size_t(11));
- ASSERT_EQ(result_view, __llvm_libc::cpp::string_view("DEF123 6", 8));
+ ASSERT_EQ(result_view, LIBC_NAMESPACE::cpp::string_view("DEF123 6", 8));
- ASSERT_EQ(__llvm_libc::scanf_core::convert(&reader, conv),
- static_cast<int>(__llvm_libc::scanf_core::READ_OK));
+ ASSERT_EQ(LIBC_NAMESPACE::scanf_core::convert(&reader, conv),
+ static_cast<int>(LIBC_NAMESPACE::scanf_core::READ_OK));
ASSERT_EQ(reader.chars_read(), size_t(19));
- ASSERT_EQ(result_view, __llvm_libc::cpp::string_view("54LKJihg", 8));
+ ASSERT_EQ(result_view, LIBC_NAMESPACE::cpp::string_view("54LKJihg", 8));
//%c also doesn't skip spaces at the start.
- ASSERT_EQ(__llvm_libc::scanf_core::convert(&reader, conv),
- static_cast<int>(__llvm_libc::scanf_core::READ_OK));
+ ASSERT_EQ(LIBC_NAMESPACE::scanf_core::convert(&reader, conv),
+ static_cast<int>(LIBC_NAMESPACE::scanf_core::READ_OK));
ASSERT_EQ(reader.chars_read(), size_t(27));
- ASSERT_EQ(result_view, __llvm_libc::cpp::string_view(" MNOpqr&", 8));
+ ASSERT_EQ(result_view, LIBC_NAMESPACE::cpp::string_view(" MNOpqr&", 8));
//%c will stop on a null byte though.
- ASSERT_EQ(__llvm_libc::scanf_core::convert(&reader, conv),
- static_cast<int>(__llvm_libc::scanf_core::READ_OK));
+ ASSERT_EQ(LIBC_NAMESPACE::scanf_core::convert(&reader, conv),
+ static_cast<int>(LIBC_NAMESPACE::scanf_core::READ_OK));
ASSERT_EQ(reader.chars_read(), size_t(29));
- ASSERT_EQ(__llvm_libc::cpp::string_view(result, 2),
- __llvm_libc::cpp::string_view("*(", 2));
+ ASSERT_EQ(LIBC_NAMESPACE::cpp::string_view(result, 2),
+ LIBC_NAMESPACE::cpp::string_view("*(", 2));
}
TEST(LlvmLibcScanfConverterTest, ScansetConv) {
const char *str = "abcDEF[123] 654LKJihg";
char result[20];
- __llvm_libc::scanf_core::StringReader str_reader(str);
- __llvm_libc::scanf_core::Reader reader(&str_reader);
+ LIBC_NAMESPACE::scanf_core::StringReader str_reader(str);
+ LIBC_NAMESPACE::scanf_core::Reader reader(&str_reader);
- __llvm_libc::scanf_core::FormatSection conv;
+ LIBC_NAMESPACE::scanf_core::FormatSection conv;
conv.has_conv = true;
conv.conv_name = '[';
conv.output_ptr = result;
- __llvm_libc::cpp::bitset<256> bitset1;
+ LIBC_NAMESPACE::cpp::bitset<256> bitset1;
bitset1.set_range('a', 'c');
bitset1.set_range('D', 'F');
bitset1.set_range('1', '6');
@@ -248,48 +248,48 @@ TEST(LlvmLibcScanfConverterTest, ScansetConv) {
conv.scan_set = bitset1;
- ASSERT_EQ(__llvm_libc::scanf_core::convert(&reader, conv),
- static_cast<int>(__llvm_libc::scanf_core::READ_OK));
+ ASSERT_EQ(LIBC_NAMESPACE::scanf_core::convert(&reader, conv),
+ static_cast<int>(LIBC_NAMESPACE::scanf_core::READ_OK));
ASSERT_EQ(reader.chars_read(), size_t(11));
- ASSERT_EQ(__llvm_libc::cpp::string_view(result, 11),
- __llvm_libc::cpp::string_view("abcDEF[123]", 11));
+ ASSERT_EQ(LIBC_NAMESPACE::cpp::string_view(result, 11),
+ LIBC_NAMESPACE::cpp::string_view("abcDEF[123]", 11));
// The scanset conversion doesn't consume leading spaces. If it did it would
// return "654" here.
- ASSERT_EQ(__llvm_libc::scanf_core::convert(&reader, conv),
- static_cast<int>(__llvm_libc::scanf_core::MATCHING_FAILURE));
+ ASSERT_EQ(LIBC_NAMESPACE::scanf_core::convert(&reader, conv),
+ static_cast<int>(LIBC_NAMESPACE::scanf_core::MATCHING_FAILURE));
ASSERT_EQ(reader.chars_read(), size_t(11));
// This set is everything except for a-g.
- __llvm_libc::cpp::bitset<256> bitset2;
+ LIBC_NAMESPACE::cpp::bitset<256> bitset2;
bitset2.set_range('a', 'g');
bitset2.flip();
conv.scan_set = bitset2;
conv.max_width = 5;
- ASSERT_EQ(__llvm_libc::scanf_core::convert(&reader, conv),
- static_cast<int>(__llvm_libc::scanf_core::READ_OK));
+ ASSERT_EQ(LIBC_NAMESPACE::scanf_core::convert(&reader, conv),
+ static_cast<int>(LIBC_NAMESPACE::scanf_core::READ_OK));
ASSERT_EQ(reader.chars_read(), size_t(16));
- ASSERT_EQ(__llvm_libc::cpp::string_view(result, 5),
- __llvm_libc::cpp::string_view(" 654L", 5));
+ ASSERT_EQ(LIBC_NAMESPACE::cpp::string_view(result, 5),
+ LIBC_NAMESPACE::cpp::string_view(" 654L", 5));
- ASSERT_EQ(__llvm_libc::scanf_core::convert(&reader, conv),
- static_cast<int>(__llvm_libc::scanf_core::READ_OK));
+ ASSERT_EQ(LIBC_NAMESPACE::scanf_core::convert(&reader, conv),
+ static_cast<int>(LIBC_NAMESPACE::scanf_core::READ_OK));
ASSERT_EQ(reader.chars_read(), size_t(20));
- ASSERT_EQ(__llvm_libc::cpp::string_view(result, 4),
- __llvm_libc::cpp::string_view("KJih", 4));
+ ASSERT_EQ(LIBC_NAMESPACE::cpp::string_view(result, 4),
+ LIBC_NAMESPACE::cpp::string_view("KJih", 4));
// This set is g and '\0'.
- __llvm_libc::cpp::bitset<256> bitset3;
+ LIBC_NAMESPACE::cpp::bitset<256> bitset3;
bitset3.set('g');
bitset3.set('\0');
conv.scan_set = bitset3;
// Even though '\0' is in the scanset, it should still stop on it.
- ASSERT_EQ(__llvm_libc::scanf_core::convert(&reader, conv),
- static_cast<int>(__llvm_libc::scanf_core::READ_OK));
+ ASSERT_EQ(LIBC_NAMESPACE::scanf_core::convert(&reader, conv),
+ static_cast<int>(LIBC_NAMESPACE::scanf_core::READ_OK));
ASSERT_EQ(reader.chars_read(), size_t(21));
- ASSERT_EQ(__llvm_libc::cpp::string_view(result, 1),
- __llvm_libc::cpp::string_view("g", 1));
+ ASSERT_EQ(LIBC_NAMESPACE::cpp::string_view(result, 1),
+ LIBC_NAMESPACE::cpp::string_view("g", 1));
}
diff --git a/libc/test/src/stdio/scanf_core/parser_test.cpp b/libc/test/src/stdio/scanf_core/parser_test.cpp
index 2ccaf84c6755233..899082dc49add34 100644
--- a/libc/test/src/stdio/scanf_core/parser_test.cpp
+++ b/libc/test/src/stdio/scanf_core/parser_test.cpp
@@ -17,25 +17,25 @@
#include "test/UnitTest/ScanfMatcher.h"
#include "test/UnitTest/Test.h"
-using __llvm_libc::cpp::string_view;
+using LIBC_NAMESPACE::cpp::string_view;
void init(const char *__restrict str, ...) {
va_list vlist;
va_start(vlist, str);
- __llvm_libc::internal::ArgList v(vlist);
+ LIBC_NAMESPACE::internal::ArgList v(vlist);
va_end(vlist);
- __llvm_libc::scanf_core::Parser parser(str, v);
+ LIBC_NAMESPACE::scanf_core::Parser parser(str, v);
}
-void evaluate(__llvm_libc::scanf_core::FormatSection *format_arr,
+void evaluate(LIBC_NAMESPACE::scanf_core::FormatSection *format_arr,
const char *__restrict str, ...) {
va_list vlist;
va_start(vlist, str);
- __llvm_libc::internal::ArgList v(vlist);
+ LIBC_NAMESPACE::internal::ArgList v(vlist);
va_end(vlist);
- __llvm_libc::scanf_core::Parser parser(str, v);
+ LIBC_NAMESPACE::scanf_core::Parser parser(str, v);
for (auto cur_section = parser.get_next_section();
!cur_section.raw_string.empty();
@@ -48,11 +48,11 @@ void evaluate(__llvm_libc::scanf_core::FormatSection *format_arr,
TEST(LlvmLibcScanfParserTest, Constructor) { init("test", 1, 2); }
TEST(LlvmLibcScanfParserTest, EvalRaw) {
- __llvm_libc::scanf_core::FormatSection format_arr[10];
+ LIBC_NAMESPACE::scanf_core::FormatSection format_arr[10];
const char *str = "test";
evaluate(format_arr, str);
- __llvm_libc::scanf_core::FormatSection expected;
+ LIBC_NAMESPACE::scanf_core::FormatSection expected;
expected.has_conv = false;
expected.raw_string = str;
@@ -62,11 +62,11 @@ TEST(LlvmLibcScanfParserTest, EvalRaw) {
}
TEST(LlvmLibcScanfParserTest, EvalSimple) {
- __llvm_libc::scanf_core::FormatSection format_arr[10];
+ LIBC_NAMESPACE::scanf_core::FormatSection format_arr[10];
const char *str = "test %% test";
evaluate(format_arr, str);
- __llvm_libc::scanf_core::FormatSection expected0, expected1, expected2;
+ LIBC_NAMESPACE::scanf_core::FormatSection expected0, expected1, expected2;
expected0.has_conv = false;
expected0.raw_string = {str, 5};
@@ -88,12 +88,12 @@ TEST(LlvmLibcScanfParserTest, EvalSimple) {
}
TEST(LlvmLibcScanfParserTest, EvalOneArg) {
- __llvm_libc::scanf_core::FormatSection format_arr[10];
+ LIBC_NAMESPACE::scanf_core::FormatSection format_arr[10];
const char *str = "%d";
int arg1 = 12345;
evaluate(format_arr, str, &arg1);
- __llvm_libc::scanf_core::FormatSection expected;
+ LIBC_NAMESPACE::scanf_core::FormatSection expected;
expected.has_conv = true;
expected.raw_string = str;
@@ -104,12 +104,12 @@ TEST(LlvmLibcScanfParserTest, EvalOneArg) {
}
TEST(LlvmLibcScanfParserTest, EvalBadArg) {
- __llvm_libc::scanf_core::FormatSection format_arr[10];
+ LIBC_NAMESPACE::scanf_core::FormatSection format_arr[10];
const char *str = "%\0abc";
int arg1 = 12345;
evaluate(format_arr, str, &arg1);
- __llvm_libc::scanf_core::FormatSection expected;
+ LIBC_NAMESPACE::scanf_core::FormatSection expected;
expected.has_conv = false;
expected.raw_string = {str, 1};
@@ -117,7 +117,7 @@ TEST(LlvmLibcScanfParserTest, EvalBadArg) {
}
TEST(LlvmLibcScanfParserTest, EvalOneArgWithFlag) {
- __llvm_libc::scanf_core::FormatSection format_arr[10];
+ LIBC_NAMESPACE::scanf_core::FormatSection format_arr[10];
const char *str = "%*d";
// Since NO_WRITE is set, the argument shouldn't be used, but I've included
// one anyways because in the case that it doesn't work it's better for it to
@@ -125,11 +125,11 @@ TEST(LlvmLibcScanfParserTest, EvalOneArgWithFlag) {
int arg1 = 12345;
evaluate(format_arr, str, &arg1);
- __llvm_libc::scanf_core::FormatSection expected;
+ LIBC_NAMESPACE::scanf_core::FormatSection expected;
expected.has_conv = true;
expected.raw_string = str;
- expected.flags = __llvm_libc::scanf_core::FormatFlags::NO_WRITE;
+ expected.flags = LIBC_NAMESPACE::scanf_core::FormatFlags::NO_WRITE;
expected.conv_name = 'd';
ASSERT_SFORMAT_EQ(expected, format_arr[0]);
@@ -141,12 +141,12 @@ TEST(LlvmLibcScanfParserTest, EvalOneArgWithFlag) {
}
TEST(LlvmLibcScanfParserTest, EvalOneArgWithWidth) {
- __llvm_libc::scanf_core::FormatSection format_arr[10];
+ LIBC_NAMESPACE::scanf_core::FormatSection format_arr[10];
const char *str = "%12d";
int arg1 = 12345;
evaluate(format_arr, str, &arg1);
- __llvm_libc::scanf_core::FormatSection expected;
+ LIBC_NAMESPACE::scanf_core::FormatSection expected;
expected.has_conv = true;
expected.raw_string = str;
@@ -158,16 +158,16 @@ TEST(LlvmLibcScanfParserTest, EvalOneArgWithWidth) {
}
TEST(LlvmLibcScanfParserTest, EvalOneArgWithShortLengthModifier) {
- __llvm_libc::scanf_core::FormatSection format_arr[10];
+ LIBC_NAMESPACE::scanf_core::FormatSection format_arr[10];
const char *str = "%hd";
int arg1 = 12345;
evaluate(format_arr, str, &arg1);
- __llvm_libc::scanf_core::FormatSection expected;
+ LIBC_NAMESPACE::scanf_core::FormatSection expected;
expected.has_conv = true;
expected.raw_string = str;
- expected.length_modifier = __llvm_libc::scanf_core::LengthModifier::h;
+ expected.length_modifier = LIBC_NAMESPACE::scanf_core::LengthModifier::h;
expected.output_ptr = &arg1;
expected.conv_name = 'd';
@@ -175,16 +175,16 @@ TEST(LlvmLibcScanfParserTest, EvalOneArgWithShortLengthModifier) {
}
TEST(LlvmLibcScanfParserTest, EvalOneArgWithLongLengthModifier) {
- __llvm_libc::scanf_core::FormatSection format_arr[10];
+ LIBC_NAMESPACE::scanf_core::FormatSection format_arr[10];
const char *str = "%lld";
long long arg1 = 12345;
evaluate(format_arr, str, &arg1);
- __llvm_libc::scanf_core::FormatSection expected;
+ LIBC_NAMESPACE::scanf_core::FormatSection expected;
expected.has_conv = true;
expected.raw_string = str;
- expected.length_modifier = __llvm_libc::scanf_core::LengthModifier::ll;
+ expected.length_modifier = LIBC_NAMESPACE::scanf_core::LengthModifier::ll;
expected.output_ptr = &arg1;
expected.conv_name = 'd';
@@ -192,37 +192,37 @@ TEST(LlvmLibcScanfParserTest, EvalOneArgWithLongLengthModifier) {
}
TEST(LlvmLibcScanfParserTest, EvalOneArgWithAllOptions) {
- __llvm_libc::scanf_core::FormatSection format_arr[10];
+ LIBC_NAMESPACE::scanf_core::FormatSection format_arr[10];
const char *str = "%*56jd";
intmax_t arg1 = 12345;
evaluate(format_arr, str, &arg1);
- __llvm_libc::scanf_core::FormatSection expected;
+ LIBC_NAMESPACE::scanf_core::FormatSection expected;
expected.has_conv = true;
expected.raw_string = str;
- expected.flags = __llvm_libc::scanf_core::FormatFlags::NO_WRITE;
+ expected.flags = LIBC_NAMESPACE::scanf_core::FormatFlags::NO_WRITE;
expected.max_width = 56;
- expected.length_modifier = __llvm_libc::scanf_core::LengthModifier::j;
+ expected.length_modifier = LIBC_NAMESPACE::scanf_core::LengthModifier::j;
expected.conv_name = 'd';
ASSERT_SFORMAT_EQ(expected, format_arr[0]);
}
TEST(LlvmLibcScanfParserTest, EvalSimpleBracketArg) {
- __llvm_libc::scanf_core::FormatSection format_arr[10];
+ LIBC_NAMESPACE::scanf_core::FormatSection format_arr[10];
const char *str = "%[abc]";
char arg1 = 'a';
evaluate(format_arr, str, &arg1);
- __llvm_libc::scanf_core::FormatSection expected;
+ LIBC_NAMESPACE::scanf_core::FormatSection expected;
expected.has_conv = true;
expected.raw_string = str;
expected.conv_name = '[';
expected.output_ptr = &arg1;
- __llvm_libc::cpp::bitset<256> scan_set;
+ LIBC_NAMESPACE::cpp::bitset<256> scan_set;
scan_set.set('a');
scan_set.set('b');
@@ -234,19 +234,19 @@ TEST(LlvmLibcScanfParserTest, EvalSimpleBracketArg) {
}
TEST(LlvmLibcScanfParserTest, EvalBracketArgRange) {
- __llvm_libc::scanf_core::FormatSection format_arr[10];
+ LIBC_NAMESPACE::scanf_core::FormatSection format_arr[10];
const char *str = "%[A-D]";
char arg1 = 'a';
evaluate(format_arr, str, &arg1);
- __llvm_libc::scanf_core::FormatSection expected;
+ LIBC_NAMESPACE::scanf_core::FormatSection expected;
expected.has_conv = true;
expected.raw_string = str;
expected.conv_name = '[';
expected.output_ptr = &arg1;
- __llvm_libc::cpp::bitset<256> scan_set;
+ LIBC_NAMESPACE::cpp::bitset<256> scan_set;
scan_set.set('A');
scan_set.set('B');
@@ -259,19 +259,19 @@ TEST(LlvmLibcScanfParserTest, EvalBracketArgRange) {
}
TEST(LlvmLibcScanfParserTest, EvalBracketArgTwoRanges) {
- __llvm_libc::scanf_core::FormatSection format_arr[10];
+ LIBC_NAMESPACE::scanf_core::FormatSection format_arr[10];
const char *str = "%[A-De-g]";
char arg1 = 'a';
evaluate(format_arr, str, &arg1);
- __llvm_libc::scanf_core::FormatSection expected;
+ LIBC_NAMESPACE::scanf_core::FormatSection expected;
expected.has_conv = true;
expected.raw_string = str;
expected.conv_name = '[';
expected.output_ptr = &arg1;
- __llvm_libc::cpp::bitset<256> scan_set;
+ LIBC_NAMESPACE::cpp::bitset<256> scan_set;
scan_set.set('A');
scan_set.set('B');
@@ -285,19 +285,19 @@ TEST(LlvmLibcScanfParserTest, EvalBracketArgTwoRanges) {
}
TEST(LlvmLibcScanfParserTest, EvalBracketArgJustHyphen) {
- __llvm_libc::scanf_core::FormatSection format_arr[10];
+ LIBC_NAMESPACE::scanf_core::FormatSection format_arr[10];
const char *str = "%[-]";
char arg1 = 'a';
evaluate(format_arr, str, &arg1);
- __llvm_libc::scanf_core::FormatSection expected;
+ LIBC_NAMESPACE::scanf_core::FormatSection expected;
expected.has_conv = true;
expected.raw_string = str;
expected.conv_name = '[';
expected.output_ptr = &arg1;
- __llvm_libc::cpp::bitset<256> scan_set;
+ LIBC_NAMESPACE::cpp::bitset<256> scan_set;
scan_set.set('-');
@@ -307,19 +307,19 @@ TEST(LlvmLibcScanfParserTest, EvalBracketArgJustHyphen) {
}
TEST(LlvmLibcScanfParserTest, EvalBracketArgLeftHyphen) {
- __llvm_libc::scanf_core::FormatSection format_arr[10];
+ LIBC_NAMESPACE::scanf_core::FormatSection format_arr[10];
const char *str = "%[-A]";
char arg1 = 'a';
evaluate(format_arr, str, &arg1);
- __llvm_libc::scanf_core::FormatSection expected;
+ LIBC_NAMESPACE::scanf_core::FormatSection expected;
expected.has_conv = true;
expected.raw_string = str;
expected.conv_name = '[';
expected.output_ptr = &arg1;
- __llvm_libc::cpp::bitset<256> scan_set;
+ LIBC_NAMESPACE::cpp::bitset<256> scan_set;
scan_set.set('-');
scan_set.set('A');
@@ -330,19 +330,19 @@ TEST(LlvmLibcScanfParserTest, EvalBracketArgLeftHyphen) {
}
TEST(LlvmLibcScanfParserTest, EvalBracketArgRightHyphen) {
- __llvm_libc::scanf_core::FormatSection format_arr[10];
+ LIBC_NAMESPACE::scanf_core::FormatSection format_arr[10];
const char *str = "%[Z-]";
char arg1 = 'a';
evaluate(format_arr, str, &arg1);
- __llvm_libc::scanf_core::FormatSection expected;
+ LIBC_NAMESPACE::scanf_core::FormatSection expected;
expected.has_conv = true;
expected.raw_string = str;
expected.conv_name = '[';
expected.output_ptr = &arg1;
- __llvm_libc::cpp::bitset<256> scan_set;
+ LIBC_NAMESPACE::cpp::bitset<256> scan_set;
scan_set.set('-');
scan_set.set('Z');
@@ -353,19 +353,19 @@ TEST(LlvmLibcScanfParserTest, EvalBracketArgRightHyphen) {
}
TEST(LlvmLibcScanfParserTest, EvalBracketArgInvertSimple) {
- __llvm_libc::scanf_core::FormatSection format_arr[10];
+ LIBC_NAMESPACE::scanf_core::FormatSection format_arr[10];
const char *str = "%[^abc]";
char arg1 = 'a';
evaluate(format_arr, str, &arg1);
- __llvm_libc::scanf_core::FormatSection expected;
+ LIBC_NAMESPACE::scanf_core::FormatSection expected;
expected.has_conv = true;
expected.raw_string = str;
expected.conv_name = '[';
expected.output_ptr = &arg1;
- __llvm_libc::cpp::bitset<256> scan_set;
+ LIBC_NAMESPACE::cpp::bitset<256> scan_set;
scan_set.set('a');
scan_set.set('b');
@@ -378,19 +378,19 @@ TEST(LlvmLibcScanfParserTest, EvalBracketArgInvertSimple) {
}
TEST(LlvmLibcScanfParserTest, EvalBracketArgInvertRange) {
- __llvm_libc::scanf_core::FormatSection format_arr[10];
+ LIBC_NAMESPACE::scanf_core::FormatSection format_arr[10];
const char *str = "%[^0-9]";
char arg1 = 'a';
evaluate(format_arr, str, &arg1);
- __llvm_libc::scanf_core::FormatSection expected;
+ LIBC_NAMESPACE::scanf_core::FormatSection expected;
expected.has_conv = true;
expected.raw_string = str;
expected.conv_name = '[';
expected.output_ptr = &arg1;
- __llvm_libc::cpp::bitset<256> scan_set;
+ LIBC_NAMESPACE::cpp::bitset<256> scan_set;
scan_set.set_range('0', '9');
scan_set.flip();
@@ -401,19 +401,19 @@ TEST(LlvmLibcScanfParserTest, EvalBracketArgInvertRange) {
}
TEST(LlvmLibcScanfParserTest, EvalBracketArgRightBracket) {
- __llvm_libc::scanf_core::FormatSection format_arr[10];
+ LIBC_NAMESPACE::scanf_core::FormatSection format_arr[10];
const char *str = "%[]]";
char arg1 = 'a';
evaluate(format_arr, str, &arg1);
- __llvm_libc::scanf_core::FormatSection expected;
+ LIBC_NAMESPACE::scanf_core::FormatSection expected;
expected.has_conv = true;
expected.raw_string = str;
expected.conv_name = '[';
expected.output_ptr = &arg1;
- __llvm_libc::cpp::bitset<256> scan_set;
+ LIBC_NAMESPACE::cpp::bitset<256> scan_set;
scan_set.set(']');
@@ -423,19 +423,19 @@ TEST(LlvmLibcScanfParserTest, EvalBracketArgRightBracket) {
}
TEST(LlvmLibcScanfParserTest, EvalBracketArgRightBracketRange) {
- __llvm_libc::scanf_core::FormatSection format_arr[10];
+ LIBC_NAMESPACE::scanf_core::FormatSection format_arr[10];
const char *str = "%[]-a]";
char arg1 = 'a';
evaluate(format_arr, str, &arg1);
- __llvm_libc::scanf_core::FormatSection expected;
+ LIBC_NAMESPACE::scanf_core::FormatSection expected;
expected.has_conv = true;
expected.raw_string = str;
expected.conv_name = '[';
expected.output_ptr = &arg1;
- __llvm_libc::cpp::bitset<256> scan_set;
+ LIBC_NAMESPACE::cpp::bitset<256> scan_set;
scan_set.set_range(']', 'a');
@@ -445,19 +445,19 @@ TEST(LlvmLibcScanfParserTest, EvalBracketArgRightBracketRange) {
}
TEST(LlvmLibcScanfParserTest, EvalBracketArgRightBracketInvert) {
- __llvm_libc::scanf_core::FormatSection format_arr[10];
+ LIBC_NAMESPACE::scanf_core::FormatSection format_arr[10];
const char *str = "%[^]]";
char arg1 = 'a';
evaluate(format_arr, str, &arg1);
- __llvm_libc::scanf_core::FormatSection expected;
+ LIBC_NAMESPACE::scanf_core::FormatSection expected;
expected.has_conv = true;
expected.raw_string = str;
expected.conv_name = '[';
expected.output_ptr = &arg1;
- __llvm_libc::cpp::bitset<256> scan_set;
+ LIBC_NAMESPACE::cpp::bitset<256> scan_set;
scan_set.set(']');
scan_set.flip();
@@ -468,19 +468,19 @@ TEST(LlvmLibcScanfParserTest, EvalBracketArgRightBracketInvert) {
}
TEST(LlvmLibcScanfParserTest, EvalBracketArgRightBracketInvertRange) {
- __llvm_libc::scanf_core::FormatSection format_arr[10];
+ LIBC_NAMESPACE::scanf_core::FormatSection format_arr[10];
const char *str = "%[^]-^]";
char arg1 = 'a';
evaluate(format_arr, str, &arg1);
- __llvm_libc::scanf_core::FormatSection expected;
+ LIBC_NAMESPACE::scanf_core::FormatSection expected;
expected.has_conv = true;
expected.raw_string = str;
expected.conv_name = '[';
expected.output_ptr = &arg1;
- __llvm_libc::cpp::bitset<256> scan_set;
+ LIBC_NAMESPACE::cpp::bitset<256> scan_set;
scan_set.set_range(']', '^');
scan_set.flip();
@@ -494,19 +494,19 @@ TEST(LlvmLibcScanfParserTest, EvalBracketArgRightBracketInvertRange) {
// implementation defined, and I have defined it such that it will capture the
// correct range regardless of the order of the characters.
TEST(LlvmLibcScanfParserTest, EvalBracketArgBackwardsRange) {
- __llvm_libc::scanf_core::FormatSection format_arr[10];
+ LIBC_NAMESPACE::scanf_core::FormatSection format_arr[10];
const char *str = "%[9-0]";
char arg1 = 'a';
evaluate(format_arr, str, &arg1);
- __llvm_libc::scanf_core::FormatSection expected;
+ LIBC_NAMESPACE::scanf_core::FormatSection expected;
expected.has_conv = true;
expected.raw_string = str;
expected.conv_name = '[';
expected.output_ptr = &arg1;
- __llvm_libc::cpp::bitset<256> scan_set;
+ LIBC_NAMESPACE::cpp::bitset<256> scan_set;
scan_set.set_range('0', '9');
@@ -516,14 +516,14 @@ TEST(LlvmLibcScanfParserTest, EvalBracketArgBackwardsRange) {
}
TEST(LlvmLibcScanfParserTest, EvalThreeArgs) {
- __llvm_libc::scanf_core::FormatSection format_arr[10];
+ LIBC_NAMESPACE::scanf_core::FormatSection format_arr[10];
const char *str = "%d%f%s";
int arg1 = 12345;
double arg2 = 123.45;
const char *arg3 = "12345";
evaluate(format_arr, str, &arg1, &arg2, &arg3);
- __llvm_libc::scanf_core::FormatSection expected0, expected1, expected2;
+ LIBC_NAMESPACE::scanf_core::FormatSection expected0, expected1, expected2;
expected0.has_conv = true;
expected0.raw_string = {str, 2};
@@ -552,12 +552,12 @@ TEST(LlvmLibcScanfParserTest, EvalThreeArgs) {
#ifndef LIBC_COPT_SCANF_DISABLE_INDEX_MODE
TEST(LlvmLibcScanfParserTest, IndexModeOneArg) {
- __llvm_libc::scanf_core::FormatSection format_arr[10];
+ LIBC_NAMESPACE::scanf_core::FormatSection format_arr[10];
const char *str = "%1$d";
int arg1 = 12345;
evaluate(format_arr, str, &arg1);
- __llvm_libc::scanf_core::FormatSection expected;
+ LIBC_NAMESPACE::scanf_core::FormatSection expected;
expected.has_conv = true;
expected.raw_string = {str, 4};
@@ -568,14 +568,14 @@ TEST(LlvmLibcScanfParserTest, IndexModeOneArg) {
}
TEST(LlvmLibcScanfParserTest, IndexModeThreeArgsSequential) {
- __llvm_libc::scanf_core::FormatSection format_arr[10];
+ LIBC_NAMESPACE::scanf_core::FormatSection format_arr[10];
const char *str = "%1$d%2$f%3$s";
int arg1 = 12345;
double arg2 = 123.45;
const char *arg3 = "12345";
evaluate(format_arr, str, &arg1, &arg2, &arg3);
- __llvm_libc::scanf_core::FormatSection expected0, expected1, expected2;
+ LIBC_NAMESPACE::scanf_core::FormatSection expected0, expected1, expected2;
expected0.has_conv = true;
expected0.raw_string = {str, 4};
@@ -602,14 +602,14 @@ TEST(LlvmLibcScanfParserTest, IndexModeThreeArgsSequential) {
}
TEST(LlvmLibcScanfParserTest, IndexModeThreeArgsReverse) {
- __llvm_libc::scanf_core::FormatSection format_arr[10];
+ LIBC_NAMESPACE::scanf_core::FormatSection format_arr[10];
const char *str = "%3$d%2$f%1$s";
int arg1 = 12345;
double arg2 = 123.45;
const char *arg3 = "12345";
evaluate(format_arr, str, &arg3, &arg2, &arg1);
- __llvm_libc::scanf_core::FormatSection expected0, expected1, expected2;
+ LIBC_NAMESPACE::scanf_core::FormatSection expected0, expected1, expected2;
expected0.has_conv = true;
expected0.raw_string = {str, 4};
@@ -636,14 +636,14 @@ TEST(LlvmLibcScanfParserTest, IndexModeThreeArgsReverse) {
}
TEST(LlvmLibcScanfParserTest, IndexModeTenArgsRandom) {
- __llvm_libc::scanf_core::FormatSection format_arr[10];
+ LIBC_NAMESPACE::scanf_core::FormatSection format_arr[10];
const char *str = "%6$d%3$d%7$d%2$d%8$d%1$d%4$d%9$d%5$d%10$d";
uintptr_t args[10] = {6, 4, 2, 7, 9, 1, 3, 5, 8, 10};
evaluate(format_arr, str, args[0], args[1], args[2], args[3], args[4],
args[5], args[6], args[7], args[8], args[9]);
for (size_t i = 0; i < 10; ++i) {
- __llvm_libc::scanf_core::FormatSection expected;
+ LIBC_NAMESPACE::scanf_core::FormatSection expected;
expected.has_conv = true;
expected.raw_string = {str + (4 * i),
@@ -655,7 +655,7 @@ TEST(LlvmLibcScanfParserTest, IndexModeTenArgsRandom) {
}
TEST(LlvmLibcScanfParserTest, IndexModeComplexParsing) {
- __llvm_libc::scanf_core::FormatSection format_arr[11];
+ LIBC_NAMESPACE::scanf_core::FormatSection format_arr[11];
const char *str = "normal text %3$llu %% %2$*f %4$d %1$1c%5$[123]";
char arg1 = '1';
double arg2 = 123.45;
@@ -664,7 +664,7 @@ TEST(LlvmLibcScanfParserTest, IndexModeComplexParsing) {
char arg5 = 'A';
evaluate(format_arr, str, &arg1, &arg2, &arg3, &arg4, &arg5);
- __llvm_libc::scanf_core::FormatSection expected0, expected1, expected2,
+ LIBC_NAMESPACE::scanf_core::FormatSection expected0, expected1, expected2,
expected3, expected4, expected5, expected6, expected7, expected8,
expected9, expected10;
@@ -678,7 +678,7 @@ TEST(LlvmLibcScanfParserTest, IndexModeComplexParsing) {
expected1.has_conv = true;
// "%3$llu"
expected1.raw_string = {str + 12, 6};
- expected1.length_modifier = __llvm_libc::scanf_core::LengthModifier::ll;
+ expected1.length_modifier = LIBC_NAMESPACE::scanf_core::LengthModifier::ll;
expected1.output_ptr = &arg3;
expected1.conv_name = 'u';
@@ -706,7 +706,7 @@ TEST(LlvmLibcScanfParserTest, IndexModeComplexParsing) {
expected5.has_conv = true;
// "%2$*f"
expected5.raw_string = {str + 22, 5};
- expected5.flags = __llvm_libc::scanf_core::FormatFlags::NO_WRITE;
+ expected5.flags = LIBC_NAMESPACE::scanf_core::FormatFlags::NO_WRITE;
expected5.conv_name = 'f';
EXPECT_SFORMAT_EQ(expected5, format_arr[5]);
@@ -747,7 +747,7 @@ TEST(LlvmLibcScanfParserTest, IndexModeComplexParsing) {
expected10.output_ptr = &arg5;
expected10.conv_name = '[';
- __llvm_libc::cpp::bitset<256> scan_set;
+ LIBC_NAMESPACE::cpp::bitset<256> scan_set;
scan_set.set_range('1', '3');
diff --git a/libc/test/src/stdio/scanf_core/string_reader_test.cpp b/libc/test/src/stdio/scanf_core/string_reader_test.cpp
index 4b3d14855d5174b..4e2c576709ad4f0 100644
--- a/libc/test/src/stdio/scanf_core/string_reader_test.cpp
+++ b/libc/test/src/stdio/scanf_core/string_reader_test.cpp
@@ -14,14 +14,14 @@
TEST(LlvmLibcScanfStringReaderTest, Constructor) {
char str[10];
- __llvm_libc::scanf_core::StringReader str_reader(str);
- __llvm_libc::scanf_core::Reader reader(&str_reader);
+ LIBC_NAMESPACE::scanf_core::StringReader str_reader(str);
+ LIBC_NAMESPACE::scanf_core::Reader reader(&str_reader);
}
TEST(LlvmLibcScanfStringReaderTest, SimpleRead) {
const char *str = "abc";
- __llvm_libc::scanf_core::StringReader str_reader(str);
- __llvm_libc::scanf_core::Reader reader(&str_reader);
+ LIBC_NAMESPACE::scanf_core::StringReader str_reader(str);
+ LIBC_NAMESPACE::scanf_core::Reader reader(&str_reader);
for (size_t i = 0; i < sizeof("abc"); ++i) {
ASSERT_EQ(str[i], reader.getc());
@@ -30,8 +30,8 @@ TEST(LlvmLibcScanfStringReaderTest, SimpleRead) {
TEST(LlvmLibcScanfStringReaderTest, ReadAndReverse) {
const char *str = "abcDEF123";
- __llvm_libc::scanf_core::StringReader str_reader(str);
- __llvm_libc::scanf_core::Reader reader(&str_reader);
+ LIBC_NAMESPACE::scanf_core::StringReader str_reader(str);
+ LIBC_NAMESPACE::scanf_core::Reader reader(&str_reader);
for (size_t i = 0; i < 5; ++i) {
ASSERT_EQ(str[i], reader.getc());
diff --git a/libc/test/src/stdio/setbuf_test.cpp b/libc/test/src/stdio/setbuf_test.cpp
index 3c2bb379cad2845..b0abca4acf731bf 100644
--- a/libc/test/src/stdio/setbuf_test.cpp
+++ b/libc/test/src/stdio/setbuf_test.cpp
@@ -20,49 +20,51 @@ TEST(LlvmLibcSetbufTest, DefaultBufsize) {
// The idea in this test is to change the buffer after opening a file and
// ensure that read and write work as expected.
constexpr char FILENAME[] = "testdata/setbuf_test_default_bufsize.test";
- ::FILE *file = __llvm_libc::fopen(FILENAME, "w");
+ ::FILE *file = LIBC_NAMESPACE::fopen(FILENAME, "w");
ASSERT_FALSE(file == nullptr);
char buffer[BUFSIZ];
- __llvm_libc::setbuf(file, buffer);
+ LIBC_NAMESPACE::setbuf(file, buffer);
constexpr char CONTENT[] = "abcdef";
constexpr size_t CONTENT_SIZE = sizeof(CONTENT);
- ASSERT_EQ(CONTENT_SIZE, __llvm_libc::fwrite(CONTENT, 1, CONTENT_SIZE, file));
- ASSERT_EQ(0, __llvm_libc::fclose(file));
+ ASSERT_EQ(CONTENT_SIZE,
+ LIBC_NAMESPACE::fwrite(CONTENT, 1, CONTENT_SIZE, file));
+ ASSERT_EQ(0, LIBC_NAMESPACE::fclose(file));
- file = __llvm_libc::fopen(FILENAME, "r");
- __llvm_libc::setbuf(file, buffer);
+ file = LIBC_NAMESPACE::fopen(FILENAME, "r");
+ LIBC_NAMESPACE::setbuf(file, buffer);
ASSERT_FALSE(file == nullptr);
char data[CONTENT_SIZE];
- ASSERT_EQ(__llvm_libc::fread(&data, 1, CONTENT_SIZE, file), CONTENT_SIZE);
+ ASSERT_EQ(LIBC_NAMESPACE::fread(&data, 1, CONTENT_SIZE, file), CONTENT_SIZE);
ASSERT_STREQ(CONTENT, data);
- ASSERT_EQ(0, __llvm_libc::fclose(file));
+ ASSERT_EQ(0, LIBC_NAMESPACE::fclose(file));
}
TEST(LlvmLibcSetbufTest, NullBuffer) {
// The idea in this test is that we set a null buffer and ensure that
// everything works correctly.
constexpr char FILENAME[] = "testdata/setbuf_test_null_buffer.test";
- ::FILE *file = __llvm_libc::fopen(FILENAME, "w");
+ ::FILE *file = LIBC_NAMESPACE::fopen(FILENAME, "w");
ASSERT_FALSE(file == nullptr);
- __llvm_libc::setbuf(file, nullptr);
+ LIBC_NAMESPACE::setbuf(file, nullptr);
constexpr char CONTENT[] = "abcdef";
constexpr size_t CONTENT_SIZE = sizeof(CONTENT);
- ASSERT_EQ(CONTENT_SIZE, __llvm_libc::fwrite(CONTENT, 1, CONTENT_SIZE, file));
- ASSERT_EQ(0, __llvm_libc::fclose(file));
+ ASSERT_EQ(CONTENT_SIZE,
+ LIBC_NAMESPACE::fwrite(CONTENT, 1, CONTENT_SIZE, file));
+ ASSERT_EQ(0, LIBC_NAMESPACE::fclose(file));
- file = __llvm_libc::fopen(FILENAME, "r");
- __llvm_libc::setbuf(file, nullptr);
+ file = LIBC_NAMESPACE::fopen(FILENAME, "r");
+ LIBC_NAMESPACE::setbuf(file, nullptr);
ASSERT_FALSE(file == nullptr);
char data[CONTENT_SIZE];
- ASSERT_EQ(__llvm_libc::fread(&data, 1, CONTENT_SIZE, file), CONTENT_SIZE);
+ ASSERT_EQ(LIBC_NAMESPACE::fread(&data, 1, CONTENT_SIZE, file), CONTENT_SIZE);
ASSERT_STREQ(CONTENT, data);
// Ensure that ungetc also works.
char unget_char = 'z';
- ASSERT_EQ(int(unget_char), __llvm_libc::ungetc(unget_char, file));
+ ASSERT_EQ(int(unget_char), LIBC_NAMESPACE::ungetc(unget_char, file));
char c;
- ASSERT_EQ(__llvm_libc::fread(&c, 1, 1, file), size_t(1));
+ ASSERT_EQ(LIBC_NAMESPACE::fread(&c, 1, 1, file), size_t(1));
ASSERT_EQ(c, unget_char);
- ASSERT_EQ(0, __llvm_libc::fclose(file));
+ ASSERT_EQ(0, LIBC_NAMESPACE::fclose(file));
}
diff --git a/libc/test/src/stdio/setvbuf_test.cpp b/libc/test/src/stdio/setvbuf_test.cpp
index 6b44f6b73b20fc8..2faa01a15ec108f 100644
--- a/libc/test/src/stdio/setvbuf_test.cpp
+++ b/libc/test/src/stdio/setvbuf_test.cpp
@@ -23,33 +23,33 @@ TEST(LlvmLibcSetvbufTest, SetNBFBuffer) {
// handle.
constexpr char FILENAME[] = "testdata/setvbuf_nbf.test";
- ::FILE *fw = __llvm_libc::fopen(FILENAME, "w");
+ ::FILE *fw = LIBC_NAMESPACE::fopen(FILENAME, "w");
ASSERT_FALSE(fw == nullptr);
char buffer[BUFSIZ];
- ASSERT_EQ(__llvm_libc::setvbuf(fw, buffer, _IONBF, BUFSIZ), 0);
+ ASSERT_EQ(LIBC_NAMESPACE::setvbuf(fw, buffer, _IONBF, BUFSIZ), 0);
- ::FILE *fr = __llvm_libc::fopen(FILENAME, "r");
+ ::FILE *fr = LIBC_NAMESPACE::fopen(FILENAME, "r");
ASSERT_FALSE(fr == nullptr);
constexpr char CONTENT[] = "abcdef";
constexpr size_t CONTENT_SIZE = sizeof(CONTENT);
for (size_t i = 0; i < CONTENT_SIZE; ++i) {
- ASSERT_EQ(size_t(1), __llvm_libc::fwrite(CONTENT + i, 1, 1, fw));
+ ASSERT_EQ(size_t(1), LIBC_NAMESPACE::fwrite(CONTENT + i, 1, 1, fw));
char c;
- ASSERT_EQ(size_t(1), __llvm_libc::fread(&c, 1, 1, fr));
+ ASSERT_EQ(size_t(1), LIBC_NAMESPACE::fread(&c, 1, 1, fr));
ASSERT_EQ(c, CONTENT[i]);
}
- ASSERT_EQ(0, __llvm_libc::fclose(fw));
- ASSERT_EQ(0, __llvm_libc::fclose(fr));
+ ASSERT_EQ(0, LIBC_NAMESPACE::fclose(fw));
+ ASSERT_EQ(0, LIBC_NAMESPACE::fclose(fr));
// Make sure NBF buffer has no effect for reading.
- fr = __llvm_libc::fopen(FILENAME, "r");
+ fr = LIBC_NAMESPACE::fopen(FILENAME, "r");
char data[CONTENT_SIZE];
- ASSERT_EQ(__llvm_libc::setvbuf(fr, buffer, _IONBF, BUFSIZ), 0);
- ASSERT_EQ(CONTENT_SIZE, __llvm_libc::fread(data, 1, CONTENT_SIZE, fr));
+ ASSERT_EQ(LIBC_NAMESPACE::setvbuf(fr, buffer, _IONBF, BUFSIZ), 0);
+ ASSERT_EQ(CONTENT_SIZE, LIBC_NAMESPACE::fread(data, 1, CONTENT_SIZE, fr));
ASSERT_STREQ(CONTENT, data);
- ASSERT_EQ(0, __llvm_libc::fclose(fr));
+ ASSERT_EQ(0, LIBC_NAMESPACE::fclose(fr));
}
TEST(LlvmLibcSetvbufTest, SetLBFBuffer) {
@@ -59,48 +59,49 @@ TEST(LlvmLibcSetvbufTest, SetLBFBuffer) {
// written.
constexpr char FILENAME[] = "testdata/setvbuf_lbf.test";
- ::FILE *fw = __llvm_libc::fopen(FILENAME, "w");
+ ::FILE *fw = LIBC_NAMESPACE::fopen(FILENAME, "w");
ASSERT_FALSE(fw == nullptr);
char buffer[BUFSIZ];
- ASSERT_EQ(__llvm_libc::setvbuf(fw, buffer, _IOLBF, BUFSIZ), 0);
+ ASSERT_EQ(LIBC_NAMESPACE::setvbuf(fw, buffer, _IOLBF, BUFSIZ), 0);
- ::FILE *fr = __llvm_libc::fopen(FILENAME, "r");
+ ::FILE *fr = LIBC_NAMESPACE::fopen(FILENAME, "r");
ASSERT_FALSE(fr == nullptr);
constexpr char CONTENT[] = "abcdef\n";
constexpr size_t CONTENT_SIZE = sizeof(CONTENT);
- ASSERT_EQ(CONTENT_SIZE, __llvm_libc::fwrite(CONTENT, 1, CONTENT_SIZE, fw));
+ ASSERT_EQ(CONTENT_SIZE, LIBC_NAMESPACE::fwrite(CONTENT, 1, CONTENT_SIZE, fw));
// Note that CONTENT_SIZE worth of data written also includes the
// null-terminator '\0'. But, since it is after the new line character,
// it should not be availabe for reading.
char data[CONTENT_SIZE];
- ASSERT_EQ(CONTENT_SIZE - 1, __llvm_libc::fread(data, 1, CONTENT_SIZE, fr));
+ ASSERT_EQ(CONTENT_SIZE - 1, LIBC_NAMESPACE::fread(data, 1, CONTENT_SIZE, fr));
char c;
- ASSERT_EQ(size_t(0), __llvm_libc::fread(&c, 1, 1, fr));
+ ASSERT_EQ(size_t(0), LIBC_NAMESPACE::fread(&c, 1, 1, fr));
data[CONTENT_SIZE - 1] = '\0';
ASSERT_STREQ(CONTENT, data);
- ASSERT_EQ(0, __llvm_libc::fclose(fw));
- ASSERT_EQ(0, __llvm_libc::fclose(fr));
+ ASSERT_EQ(0, LIBC_NAMESPACE::fclose(fw));
+ ASSERT_EQ(0, LIBC_NAMESPACE::fclose(fr));
// Make sure LBF buffer has no effect for reading.
- fr = __llvm_libc::fopen(FILENAME, "r");
- ASSERT_EQ(__llvm_libc::setvbuf(fr, buffer, _IOLBF, BUFSIZ), 0);
- ASSERT_EQ(CONTENT_SIZE, __llvm_libc::fread(data, 1, CONTENT_SIZE, fr));
+ fr = LIBC_NAMESPACE::fopen(FILENAME, "r");
+ ASSERT_EQ(LIBC_NAMESPACE::setvbuf(fr, buffer, _IOLBF, BUFSIZ), 0);
+ ASSERT_EQ(CONTENT_SIZE, LIBC_NAMESPACE::fread(data, 1, CONTENT_SIZE, fr));
ASSERT_STREQ(CONTENT, data);
- ASSERT_EQ(0, __llvm_libc::fclose(fr));
+ ASSERT_EQ(0, LIBC_NAMESPACE::fclose(fr));
}
TEST(LlvmLibcSetbufTest, InvalidBufferMode) {
constexpr char FILENAME[] = "testdata/setvbuf_invalid_bufmode.test";
- ::FILE *f = __llvm_libc::fopen(FILENAME, "w");
+ ::FILE *f = LIBC_NAMESPACE::fopen(FILENAME, "w");
ASSERT_FALSE(f == nullptr);
char buf[BUFSIZ];
- ASSERT_NE(__llvm_libc::setvbuf(f, buf, _IOFBF + _IOLBF + _IONBF, BUFSIZ), 0);
+ ASSERT_NE(LIBC_NAMESPACE::setvbuf(f, buf, _IOFBF + _IOLBF + _IONBF, BUFSIZ),
+ 0);
ASSERT_EQ(libc_errno, EINVAL);
libc_errno = 0;
- ASSERT_EQ(0, __llvm_libc::fclose(f));
+ ASSERT_EQ(0, LIBC_NAMESPACE::fclose(f));
}
diff --git a/libc/test/src/stdio/snprintf_test.cpp b/libc/test/src/stdio/snprintf_test.cpp
index 764be9a9ba48b41..d898f2b80a86f9f 100644
--- a/libc/test/src/stdio/snprintf_test.cpp
+++ b/libc/test/src/stdio/snprintf_test.cpp
@@ -17,16 +17,16 @@ TEST(LlvmLibcSNPrintfTest, CutOff) {
char buff[100];
int written;
- written =
- __llvm_libc::snprintf(buff, 16, "A simple string with no conversions.");
+ written = LIBC_NAMESPACE::snprintf(buff, 16,
+ "A simple string with no conversions.");
EXPECT_EQ(written, 36);
ASSERT_STREQ(buff, "A simple string");
- written = __llvm_libc::snprintf(buff, 5, "%s", "1234567890");
+ written = LIBC_NAMESPACE::snprintf(buff, 5, "%s", "1234567890");
EXPECT_EQ(written, 10);
ASSERT_STREQ(buff, "1234");
- written = __llvm_libc::snprintf(buff, 67, "%-101c", 'a');
+ written = LIBC_NAMESPACE::snprintf(buff, 67, "%-101c", 'a');
EXPECT_EQ(written, 101);
ASSERT_STREQ(buff, "a "
" " // Each of these is 8 spaces, and there are 8.
@@ -39,7 +39,7 @@ TEST(LlvmLibcSNPrintfTest, CutOff) {
" ");
// passing null as the output pointer is allowed as long as buffsz is 0.
- written = __llvm_libc::snprintf(nullptr, 0, "%s and more", "1234567890");
+ written = LIBC_NAMESPACE::snprintf(nullptr, 0, "%s and more", "1234567890");
EXPECT_EQ(written, 19);
}
@@ -47,12 +47,12 @@ TEST(LlvmLibcSNPrintfTest, NoCutOff) {
char buff[64];
int written;
- written =
- __llvm_libc::snprintf(buff, 37, "A simple string with no conversions.");
+ written = LIBC_NAMESPACE::snprintf(buff, 37,
+ "A simple string with no conversions.");
EXPECT_EQ(written, 36);
ASSERT_STREQ(buff, "A simple string with no conversions.");
- written = __llvm_libc::snprintf(buff, 20, "%s", "1234567890");
+ written = LIBC_NAMESPACE::snprintf(buff, 20, "%s", "1234567890");
EXPECT_EQ(written, 10);
ASSERT_STREQ(buff, "1234567890");
}
diff --git a/libc/test/src/stdio/sprintf_test.cpp b/libc/test/src/stdio/sprintf_test.cpp
index 68fbe6e460207f7..9e690abcb982e0d 100644
--- a/libc/test/src/stdio/sprintf_test.cpp
+++ b/libc/test/src/stdio/sprintf_test.cpp
@@ -16,18 +16,18 @@
// TODO: Add a comment here explaining the printf format string.
// #include <stdio.h>
-// namespace __llvm_libc {
+// namespace LIBC_NAMESPACE {
// using ::sprintf;
// }
-class LlvmLibcSPrintfTest : public __llvm_libc::testing::Test {
+class LlvmLibcSPrintfTest : public LIBC_NAMESPACE::testing::Test {
protected:
char buff[1000];
int written;
};
-using __llvm_libc::fputil::testing::ForceRoundingMode;
-using __llvm_libc::fputil::testing::RoundingMode;
+using LIBC_NAMESPACE::fputil::testing::ForceRoundingMode;
+using LIBC_NAMESPACE::fputil::testing::RoundingMode;
// Subtract 1 from sizeof(expected_str) to account for the null byte.
#define ASSERT_STREQ_LEN(actual_written, actual_str, expected_str) \
@@ -38,7 +38,8 @@ TEST(LlvmLibcSPrintfTest, SimpleNoConv) {
char buff[64];
int written;
- written = __llvm_libc::sprintf(buff, "A simple string with no conversions.");
+ written =
+ LIBC_NAMESPACE::sprintf(buff, "A simple string with no conversions.");
EXPECT_EQ(written, 36);
ASSERT_STREQ(buff, "A simple string with no conversions.");
}
@@ -47,15 +48,15 @@ TEST(LlvmLibcSPrintfTest, PercentConv) {
char buff[64];
int written;
- written = __llvm_libc::sprintf(buff, "%%");
+ written = LIBC_NAMESPACE::sprintf(buff, "%%");
EXPECT_EQ(written, 1);
ASSERT_STREQ(buff, "%");
- written = __llvm_libc::sprintf(buff, "abc %% def");
+ written = LIBC_NAMESPACE::sprintf(buff, "abc %% def");
EXPECT_EQ(written, 9);
ASSERT_STREQ(buff, "abc % def");
- written = __llvm_libc::sprintf(buff, "%%%%%%");
+ written = LIBC_NAMESPACE::sprintf(buff, "%%%%%%");
EXPECT_EQ(written, 3);
ASSERT_STREQ(buff, "%%%");
}
@@ -64,15 +65,15 @@ TEST(LlvmLibcSPrintfTest, CharConv) {
char buff[64];
int written;
- written = __llvm_libc::sprintf(buff, "%c", 'a');
+ written = LIBC_NAMESPACE::sprintf(buff, "%c", 'a');
EXPECT_EQ(written, 1);
ASSERT_STREQ(buff, "a");
- written = __llvm_libc::sprintf(buff, "%3c %-3c", '1', '2');
+ written = LIBC_NAMESPACE::sprintf(buff, "%3c %-3c", '1', '2');
EXPECT_EQ(written, 7);
ASSERT_STREQ(buff, " 1 2 ");
- written = __llvm_libc::sprintf(buff, "%*c", 2, '3');
+ written = LIBC_NAMESPACE::sprintf(buff, "%*c", 2, '3');
EXPECT_EQ(written, 2);
ASSERT_STREQ(buff, " 3");
}
@@ -81,26 +82,26 @@ TEST(LlvmLibcSPrintfTest, StringConv) {
char buff[64];
int written;
- written = __llvm_libc::sprintf(buff, "%s", "abcDEF123");
+ written = LIBC_NAMESPACE::sprintf(buff, "%s", "abcDEF123");
EXPECT_EQ(written, 9);
ASSERT_STREQ(buff, "abcDEF123");
- written = __llvm_libc::sprintf(buff, "%10s %-10s", "centered", "title");
+ written = LIBC_NAMESPACE::sprintf(buff, "%10s %-10s", "centered", "title");
EXPECT_EQ(written, 21);
ASSERT_STREQ(buff, " centered title ");
- written = __llvm_libc::sprintf(buff, "%-5.4s%-4.4s", "words can describe",
- "soups most delicious");
+ written = LIBC_NAMESPACE::sprintf(buff, "%-5.4s%-4.4s", "words can describe",
+ "soups most delicious");
EXPECT_EQ(written, 9);
ASSERT_STREQ(buff, "word soup");
- written = __llvm_libc::sprintf(buff, "%*s %.*s %*.*s", 10, "beginning", 2,
- "isn't", 12, 10, "important. Ever.");
+ written = LIBC_NAMESPACE::sprintf(buff, "%*s %.*s %*.*s", 10, "beginning", 2,
+ "isn't", 12, 10, "important. Ever.");
EXPECT_EQ(written, 26);
ASSERT_STREQ(buff, " beginning is important.");
#ifndef LIBC_COPT_PRINTF_NO_NULLPTR_CHECKS
- written = __llvm_libc::sprintf(buff, "%s", nullptr);
+ written = LIBC_NAMESPACE::sprintf(buff, "%s", nullptr);
EXPECT_EQ(written, 4);
ASSERT_STREQ(buff, "null");
#endif // LIBC_COPT_PRINTF_NO_NULLPTR_CHECKS
@@ -112,31 +113,31 @@ TEST(LlvmLibcSPrintfTest, IntConv) {
// Basic Tests.
- written = __llvm_libc::sprintf(buff, "%d", 123);
+ written = LIBC_NAMESPACE::sprintf(buff, "%d", 123);
EXPECT_EQ(written, 3);
ASSERT_STREQ(buff, "123");
- written = __llvm_libc::sprintf(buff, "%i", -456);
+ written = LIBC_NAMESPACE::sprintf(buff, "%i", -456);
EXPECT_EQ(written, 4);
ASSERT_STREQ(buff, "-456");
// Length Modifier Tests.
- written = __llvm_libc::sprintf(buff, "%hhu", 257); // 0x101
+ written = LIBC_NAMESPACE::sprintf(buff, "%hhu", 257); // 0x101
EXPECT_EQ(written, 1);
ASSERT_STREQ(buff, "1");
- written = __llvm_libc::sprintf(buff, "%llu", 18446744073709551615ull);
+ written = LIBC_NAMESPACE::sprintf(buff, "%llu", 18446744073709551615ull);
EXPECT_EQ(written, 20);
ASSERT_STREQ(buff, "18446744073709551615"); // ull max
- written = __llvm_libc::sprintf(buff, "%u", ~0);
+ written = LIBC_NAMESPACE::sprintf(buff, "%u", ~0);
if (sizeof(int) == 4) {
EXPECT_EQ(written, 10);
ASSERT_STREQ(buff, "4294967295");
}
- written = __llvm_libc::sprintf(buff, "%tu", ~ptrdiff_t(0));
+ written = LIBC_NAMESPACE::sprintf(buff, "%tu", ~ptrdiff_t(0));
if (sizeof(ptrdiff_t) == 8) {
EXPECT_EQ(written, 20);
ASSERT_STREQ(buff, "18446744073709551615");
@@ -145,114 +146,114 @@ TEST(LlvmLibcSPrintfTest, IntConv) {
ASSERT_STREQ(buff, "4294967295");
}
- written = __llvm_libc::sprintf(buff, "%lld", -9223372036854775807ll - 1ll);
+ written = LIBC_NAMESPACE::sprintf(buff, "%lld", -9223372036854775807ll - 1ll);
EXPECT_EQ(written, 20);
ASSERT_STREQ(buff, "-9223372036854775808"); // ll min
// Min Width Tests.
- written = __llvm_libc::sprintf(buff, "%4d", 789);
+ written = LIBC_NAMESPACE::sprintf(buff, "%4d", 789);
EXPECT_EQ(written, 4);
ASSERT_STREQ(buff, " 789");
- written = __llvm_libc::sprintf(buff, "%2d", 987);
+ written = LIBC_NAMESPACE::sprintf(buff, "%2d", 987);
EXPECT_EQ(written, 3);
ASSERT_STREQ(buff, "987");
// Precision Tests.
- written = __llvm_libc::sprintf(buff, "%d", 0);
+ written = LIBC_NAMESPACE::sprintf(buff, "%d", 0);
EXPECT_EQ(written, 1);
ASSERT_STREQ(buff, "0");
- written = __llvm_libc::sprintf(buff, "%.0d", 0);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.0d", 0);
EXPECT_EQ(written, 0);
ASSERT_STREQ(buff, "");
- written = __llvm_libc::sprintf(buff, "%.5d", 654);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.5d", 654);
EXPECT_EQ(written, 5);
ASSERT_STREQ(buff, "00654");
- written = __llvm_libc::sprintf(buff, "%.5d", -321);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.5d", -321);
EXPECT_EQ(written, 6);
ASSERT_STREQ(buff, "-00321");
- written = __llvm_libc::sprintf(buff, "%.2d", 135);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.2d", 135);
EXPECT_EQ(written, 3);
ASSERT_STREQ(buff, "135");
// Flag Tests.
- written = __llvm_libc::sprintf(buff, "%.5d", -321);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.5d", -321);
EXPECT_EQ(written, 6);
ASSERT_STREQ(buff, "-00321");
- written = __llvm_libc::sprintf(buff, "%-5d", 246);
+ written = LIBC_NAMESPACE::sprintf(buff, "%-5d", 246);
EXPECT_EQ(written, 5);
ASSERT_STREQ(buff, "246 ");
- written = __llvm_libc::sprintf(buff, "%-5d", -147);
+ written = LIBC_NAMESPACE::sprintf(buff, "%-5d", -147);
EXPECT_EQ(written, 5);
ASSERT_STREQ(buff, "-147 ");
- written = __llvm_libc::sprintf(buff, "%+d", 258);
+ written = LIBC_NAMESPACE::sprintf(buff, "%+d", 258);
EXPECT_EQ(written, 4);
ASSERT_STREQ(buff, "+258");
- written = __llvm_libc::sprintf(buff, "% d", 369);
+ written = LIBC_NAMESPACE::sprintf(buff, "% d", 369);
EXPECT_EQ(written, 4);
ASSERT_STREQ(buff, " 369");
- written = __llvm_libc::sprintf(buff, "%05d", 470);
+ written = LIBC_NAMESPACE::sprintf(buff, "%05d", 470);
EXPECT_EQ(written, 5);
ASSERT_STREQ(buff, "00470");
- written = __llvm_libc::sprintf(buff, "%05d", -581);
+ written = LIBC_NAMESPACE::sprintf(buff, "%05d", -581);
EXPECT_EQ(written, 5);
ASSERT_STREQ(buff, "-0581");
// Combined Tests.
- written = __llvm_libc::sprintf(buff, "%+ u", 692);
+ written = LIBC_NAMESPACE::sprintf(buff, "%+ u", 692);
EXPECT_EQ(written, 3);
ASSERT_STREQ(buff, "692");
- written = __llvm_libc::sprintf(buff, "%+ -05d", 703);
+ written = LIBC_NAMESPACE::sprintf(buff, "%+ -05d", 703);
EXPECT_EQ(written, 5);
ASSERT_STREQ(buff, "+703 ");
- written = __llvm_libc::sprintf(buff, "%7.5d", 814);
+ written = LIBC_NAMESPACE::sprintf(buff, "%7.5d", 814);
EXPECT_EQ(written, 7);
ASSERT_STREQ(buff, " 00814");
- written = __llvm_libc::sprintf(buff, "%7.5d", -925);
+ written = LIBC_NAMESPACE::sprintf(buff, "%7.5d", -925);
EXPECT_EQ(written, 7);
ASSERT_STREQ(buff, " -00925");
- written = __llvm_libc::sprintf(buff, "%7.5d", 159);
+ written = LIBC_NAMESPACE::sprintf(buff, "%7.5d", 159);
EXPECT_EQ(written, 7);
ASSERT_STREQ(buff, " 00159");
- written = __llvm_libc::sprintf(buff, "% -7.5d", 260);
+ written = LIBC_NAMESPACE::sprintf(buff, "% -7.5d", 260);
EXPECT_EQ(written, 7);
ASSERT_STREQ(buff, " 00260 ");
- written = __llvm_libc::sprintf(buff, "%5.4d", 10000);
+ written = LIBC_NAMESPACE::sprintf(buff, "%5.4d", 10000);
EXPECT_EQ(written, 5);
ASSERT_STREQ(buff, "10000");
// Multiple Conversion Tests.
- written = __llvm_libc::sprintf(buff, "%10d %-10d", 456, -789);
+ written = LIBC_NAMESPACE::sprintf(buff, "%10d %-10d", 456, -789);
EXPECT_EQ(written, 21);
ASSERT_STREQ(buff, " 456 -789 ");
- written = __llvm_libc::sprintf(buff, "%-5.4d%+.4u", 75, 25);
+ written = LIBC_NAMESPACE::sprintf(buff, "%-5.4d%+.4u", 75, 25);
EXPECT_EQ(written, 9);
ASSERT_STREQ(buff, "0075 0025");
- written = __llvm_libc::sprintf(buff, "% 05hhi %+-0.5llu %-+ 06.3zd",
- 256 + 127, 68719476736ll, size_t(2));
+ written = LIBC_NAMESPACE::sprintf(buff, "% 05hhi %+-0.5llu %-+ 06.3zd",
+ 256 + 127, 68719476736ll, size_t(2));
EXPECT_EQ(written, 24);
ASSERT_STREQ(buff, " 0127 68719476736 +002 ");
}
@@ -263,25 +264,25 @@ TEST(LlvmLibcSPrintfTest, HexConv) {
// Basic Tests.
- written = __llvm_libc::sprintf(buff, "%x", 0x123a);
+ written = LIBC_NAMESPACE::sprintf(buff, "%x", 0x123a);
EXPECT_EQ(written, 4);
ASSERT_STREQ(buff, "123a");
- written = __llvm_libc::sprintf(buff, "%X", 0x456b);
+ written = LIBC_NAMESPACE::sprintf(buff, "%X", 0x456b);
EXPECT_EQ(written, 4);
ASSERT_STREQ(buff, "456B");
// Length Modifier Tests.
- written = __llvm_libc::sprintf(buff, "%hhx", 0x10001);
+ written = LIBC_NAMESPACE::sprintf(buff, "%hhx", 0x10001);
EXPECT_EQ(written, 1);
ASSERT_STREQ(buff, "1");
- written = __llvm_libc::sprintf(buff, "%llx", 0xffffffffffffffffull);
+ written = LIBC_NAMESPACE::sprintf(buff, "%llx", 0xffffffffffffffffull);
EXPECT_EQ(written, 16);
ASSERT_STREQ(buff, "ffffffffffffffff"); // ull max
- written = __llvm_libc::sprintf(buff, "%tX", ~ptrdiff_t(0));
+ written = LIBC_NAMESPACE::sprintf(buff, "%tX", ~ptrdiff_t(0));
if (sizeof(ptrdiff_t) == 8) {
EXPECT_EQ(written, 16);
ASSERT_STREQ(buff, "FFFFFFFFFFFFFFFF");
@@ -292,92 +293,92 @@ TEST(LlvmLibcSPrintfTest, HexConv) {
// Min Width Tests.
- written = __llvm_libc::sprintf(buff, "%4x", 0x789);
+ written = LIBC_NAMESPACE::sprintf(buff, "%4x", 0x789);
EXPECT_EQ(written, 4);
ASSERT_STREQ(buff, " 789");
- written = __llvm_libc::sprintf(buff, "%2X", 0x987);
+ written = LIBC_NAMESPACE::sprintf(buff, "%2X", 0x987);
EXPECT_EQ(written, 3);
ASSERT_STREQ(buff, "987");
// Precision Tests.
- written = __llvm_libc::sprintf(buff, "%x", 0);
+ written = LIBC_NAMESPACE::sprintf(buff, "%x", 0);
EXPECT_EQ(written, 1);
ASSERT_STREQ(buff, "0");
- written = __llvm_libc::sprintf(buff, "%.0x", 0);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.0x", 0);
EXPECT_EQ(written, 0);
ASSERT_STREQ(buff, "");
- written = __llvm_libc::sprintf(buff, "%.5x", 0x1F3);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.5x", 0x1F3);
EXPECT_EQ(written, 5);
ASSERT_STREQ(buff, "001f3");
- written = __llvm_libc::sprintf(buff, "%.2x", 0x135);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.2x", 0x135);
EXPECT_EQ(written, 3);
ASSERT_STREQ(buff, "135");
// Flag Tests.
- written = __llvm_libc::sprintf(buff, "%-5x", 0x246);
+ written = LIBC_NAMESPACE::sprintf(buff, "%-5x", 0x246);
EXPECT_EQ(written, 5);
ASSERT_STREQ(buff, "246 ");
- written = __llvm_libc::sprintf(buff, "%#x", 0xd3f);
+ written = LIBC_NAMESPACE::sprintf(buff, "%#x", 0xd3f);
EXPECT_EQ(written, 5);
ASSERT_STREQ(buff, "0xd3f");
- written = __llvm_libc::sprintf(buff, "%#X", 0xE40);
+ written = LIBC_NAMESPACE::sprintf(buff, "%#X", 0xE40);
EXPECT_EQ(written, 5);
ASSERT_STREQ(buff, "0XE40");
- written = __llvm_libc::sprintf(buff, "%05x", 0x470);
+ written = LIBC_NAMESPACE::sprintf(buff, "%05x", 0x470);
EXPECT_EQ(written, 5);
ASSERT_STREQ(buff, "00470");
- written = __llvm_libc::sprintf(buff, "%0#6x", 0x8c3);
+ written = LIBC_NAMESPACE::sprintf(buff, "%0#6x", 0x8c3);
EXPECT_EQ(written, 6);
ASSERT_STREQ(buff, "0x08c3");
- written = __llvm_libc::sprintf(buff, "%-#6x", 0x5f0);
+ written = LIBC_NAMESPACE::sprintf(buff, "%-#6x", 0x5f0);
EXPECT_EQ(written, 6);
ASSERT_STREQ(buff, "0x5f0 ");
// Combined Tests.
- written = __llvm_libc::sprintf(buff, "%#-07x", 0x703);
+ written = LIBC_NAMESPACE::sprintf(buff, "%#-07x", 0x703);
EXPECT_EQ(written, 7);
ASSERT_STREQ(buff, "0x703 ");
- written = __llvm_libc::sprintf(buff, "%7.5x", 0x814);
+ written = LIBC_NAMESPACE::sprintf(buff, "%7.5x", 0x814);
EXPECT_EQ(written, 7);
ASSERT_STREQ(buff, " 00814");
- written = __llvm_libc::sprintf(buff, "%#9.5X", 0x9d4);
+ written = LIBC_NAMESPACE::sprintf(buff, "%#9.5X", 0x9d4);
EXPECT_EQ(written, 9);
ASSERT_STREQ(buff, " 0X009D4");
- written = __llvm_libc::sprintf(buff, "%-7.5x", 0x260);
+ written = LIBC_NAMESPACE::sprintf(buff, "%-7.5x", 0x260);
EXPECT_EQ(written, 7);
ASSERT_STREQ(buff, "00260 ");
- written = __llvm_libc::sprintf(buff, "%5.4x", 0x10000);
+ written = LIBC_NAMESPACE::sprintf(buff, "%5.4x", 0x10000);
EXPECT_EQ(written, 5);
ASSERT_STREQ(buff, "10000");
// Multiple Conversion Tests.
- written = __llvm_libc::sprintf(buff, "%10X %-#10x", 0x45b, 0x789);
+ written = LIBC_NAMESPACE::sprintf(buff, "%10X %-#10x", 0x45b, 0x789);
EXPECT_EQ(written, 21);
ASSERT_STREQ(buff, " 45B 0x789 ");
- written = __llvm_libc::sprintf(buff, "%-5.4x%#.4x", 0x75, 0x25);
+ written = LIBC_NAMESPACE::sprintf(buff, "%-5.4x%#.4x", 0x75, 0x25);
EXPECT_EQ(written, 11);
ASSERT_STREQ(buff, "0075 0x0025");
- written = __llvm_libc::sprintf(buff, "%04hhX %#.5llx %-6.3zX", 256 + 0x7f,
- 0x1000000000ll, size_t(2));
+ written = LIBC_NAMESPACE::sprintf(buff, "%04hhX %#.5llx %-6.3zX", 256 + 0x7f,
+ 0x1000000000ll, size_t(2));
EXPECT_EQ(written, 24);
ASSERT_STREQ(buff, "007F 0x1000000000 002 ");
}
@@ -386,46 +387,46 @@ TEST(LlvmLibcSPrintfTest, PointerConv) {
char buff[64];
int written;
- written = __llvm_libc::sprintf(buff, "%p", nullptr);
+ written = LIBC_NAMESPACE::sprintf(buff, "%p", nullptr);
EXPECT_EQ(written, 9);
ASSERT_STREQ(buff, "(nullptr)");
- written = __llvm_libc::sprintf(buff, "%p", 0x1a2b3c4d);
+ written = LIBC_NAMESPACE::sprintf(buff, "%p", 0x1a2b3c4d);
EXPECT_EQ(written, 10);
ASSERT_STREQ(buff, "0x1a2b3c4d");
if constexpr (sizeof(void *) > 4) {
- written = __llvm_libc::sprintf(buff, "%p", 0x1a2b3c4d5e6f7081);
+ written = LIBC_NAMESPACE::sprintf(buff, "%p", 0x1a2b3c4d5e6f7081);
EXPECT_EQ(written, 18);
ASSERT_STREQ(buff, "0x1a2b3c4d5e6f7081");
}
- written = __llvm_libc::sprintf(buff, "%p", buff);
+ written = LIBC_NAMESPACE::sprintf(buff, "%p", buff);
EXPECT_GT(written, 0);
// Width tests:
- written = __llvm_libc::sprintf(buff, "%20p", nullptr);
+ written = LIBC_NAMESPACE::sprintf(buff, "%20p", nullptr);
EXPECT_EQ(written, 20);
ASSERT_STREQ(buff, " (nullptr)");
- written = __llvm_libc::sprintf(buff, "%20p", 0x1a2b3c4d);
+ written = LIBC_NAMESPACE::sprintf(buff, "%20p", 0x1a2b3c4d);
EXPECT_EQ(written, 20);
ASSERT_STREQ(buff, " 0x1a2b3c4d");
// Flag tests:
- written = __llvm_libc::sprintf(buff, "%-20p", nullptr);
+ written = LIBC_NAMESPACE::sprintf(buff, "%-20p", nullptr);
EXPECT_EQ(written, 20);
ASSERT_STREQ(buff, "(nullptr) ");
- written = __llvm_libc::sprintf(buff, "%-20p", 0x1a2b3c4d);
+ written = LIBC_NAMESPACE::sprintf(buff, "%-20p", 0x1a2b3c4d);
EXPECT_EQ(written, 20);
ASSERT_STREQ(buff, "0x1a2b3c4d ");
// Using the 0 flag is technically undefined, but here we're following the
// convention of matching the behavior of %#x.
- written = __llvm_libc::sprintf(buff, "%020p", 0x1a2b3c4d);
+ written = LIBC_NAMESPACE::sprintf(buff, "%020p", 0x1a2b3c4d);
EXPECT_EQ(written, 20);
ASSERT_STREQ(buff, "0x00000000001a2b3c4d");
@@ -433,13 +434,13 @@ TEST(LlvmLibcSPrintfTest, PointerConv) {
// These are all undefined behavior. The precision option is undefined for %p.
// Precision specifies the number of characters for a string conversion.
- written = __llvm_libc::sprintf(buff, "%.5p", nullptr);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.5p", nullptr);
EXPECT_EQ(written, 5);
ASSERT_STREQ(buff, "(null");
// Precision specifies the number of digits to be written for %x conversions,
// and the "0x" doesn't count as part of the digits.
- written = __llvm_libc::sprintf(buff, "%.20p", 0x1a2b3c4d);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.20p", 0x1a2b3c4d);
EXPECT_EQ(written, 22);
ASSERT_STREQ(buff, "0x0000000000001a2b3c4d");
}
@@ -450,25 +451,25 @@ TEST(LlvmLibcSPrintfTest, OctConv) {
// Basic Tests.
- written = __llvm_libc::sprintf(buff, "%o", 01234);
+ written = LIBC_NAMESPACE::sprintf(buff, "%o", 01234);
EXPECT_EQ(written, 4);
ASSERT_STREQ(buff, "1234");
- written = __llvm_libc::sprintf(buff, "%o", 04567);
+ written = LIBC_NAMESPACE::sprintf(buff, "%o", 04567);
EXPECT_EQ(written, 4);
ASSERT_STREQ(buff, "4567");
// Length Modifier Tests.
- written = __llvm_libc::sprintf(buff, "%hho", 0401);
+ written = LIBC_NAMESPACE::sprintf(buff, "%hho", 0401);
EXPECT_EQ(written, 1);
ASSERT_STREQ(buff, "1");
- written = __llvm_libc::sprintf(buff, "%llo", 01777777777777777777777ull);
+ written = LIBC_NAMESPACE::sprintf(buff, "%llo", 01777777777777777777777ull);
EXPECT_EQ(written, 22);
ASSERT_STREQ(buff, "1777777777777777777777"); // ull max
- written = __llvm_libc::sprintf(buff, "%to", ~ptrdiff_t(0));
+ written = LIBC_NAMESPACE::sprintf(buff, "%to", ~ptrdiff_t(0));
if (sizeof(ptrdiff_t) == 8) {
EXPECT_EQ(written, 22);
ASSERT_STREQ(buff, "1777777777777777777777");
@@ -479,88 +480,88 @@ TEST(LlvmLibcSPrintfTest, OctConv) {
// Min Width Tests.
- written = __llvm_libc::sprintf(buff, "%4o", 0701);
+ written = LIBC_NAMESPACE::sprintf(buff, "%4o", 0701);
EXPECT_EQ(written, 4);
ASSERT_STREQ(buff, " 701");
- written = __llvm_libc::sprintf(buff, "%2o", 0107);
+ written = LIBC_NAMESPACE::sprintf(buff, "%2o", 0107);
EXPECT_EQ(written, 3);
ASSERT_STREQ(buff, "107");
// Precision Tests.
- written = __llvm_libc::sprintf(buff, "%o", 0);
+ written = LIBC_NAMESPACE::sprintf(buff, "%o", 0);
EXPECT_EQ(written, 1);
ASSERT_STREQ(buff, "0");
- written = __llvm_libc::sprintf(buff, "%.0o", 0);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.0o", 0);
EXPECT_EQ(written, 0);
ASSERT_STREQ(buff, "");
- written = __llvm_libc::sprintf(buff, "%.5o", 0153);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.5o", 0153);
EXPECT_EQ(written, 5);
ASSERT_STREQ(buff, "00153");
- written = __llvm_libc::sprintf(buff, "%.2o", 0135);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.2o", 0135);
EXPECT_EQ(written, 3);
ASSERT_STREQ(buff, "135");
// Flag Tests.
- written = __llvm_libc::sprintf(buff, "%-5o", 0246);
+ written = LIBC_NAMESPACE::sprintf(buff, "%-5o", 0246);
EXPECT_EQ(written, 5);
ASSERT_STREQ(buff, "246 ");
- written = __llvm_libc::sprintf(buff, "%#o", 0234);
+ written = LIBC_NAMESPACE::sprintf(buff, "%#o", 0234);
EXPECT_EQ(written, 4);
ASSERT_STREQ(buff, "0234");
- written = __llvm_libc::sprintf(buff, "%05o", 0470);
+ written = LIBC_NAMESPACE::sprintf(buff, "%05o", 0470);
EXPECT_EQ(written, 5);
ASSERT_STREQ(buff, "00470");
- written = __llvm_libc::sprintf(buff, "%0#6o", 0753);
+ written = LIBC_NAMESPACE::sprintf(buff, "%0#6o", 0753);
EXPECT_EQ(written, 6);
ASSERT_STREQ(buff, "000753");
- written = __llvm_libc::sprintf(buff, "%-#6o", 0642);
+ written = LIBC_NAMESPACE::sprintf(buff, "%-#6o", 0642);
EXPECT_EQ(written, 6);
ASSERT_STREQ(buff, "0642 ");
// Combined Tests.
- written = __llvm_libc::sprintf(buff, "%#-07o", 0703);
+ written = LIBC_NAMESPACE::sprintf(buff, "%#-07o", 0703);
EXPECT_EQ(written, 7);
ASSERT_STREQ(buff, "0703 ");
- written = __llvm_libc::sprintf(buff, "%7.5o", 0314);
+ written = LIBC_NAMESPACE::sprintf(buff, "%7.5o", 0314);
EXPECT_EQ(written, 7);
ASSERT_STREQ(buff, " 00314");
- written = __llvm_libc::sprintf(buff, "%#9.5o", 0234);
+ written = LIBC_NAMESPACE::sprintf(buff, "%#9.5o", 0234);
EXPECT_EQ(written, 9);
ASSERT_STREQ(buff, " 00234");
- written = __llvm_libc::sprintf(buff, "%-7.5o", 0260);
+ written = LIBC_NAMESPACE::sprintf(buff, "%-7.5o", 0260);
EXPECT_EQ(written, 7);
ASSERT_STREQ(buff, "00260 ");
- written = __llvm_libc::sprintf(buff, "%5.4o", 010000);
+ written = LIBC_NAMESPACE::sprintf(buff, "%5.4o", 010000);
EXPECT_EQ(written, 5);
ASSERT_STREQ(buff, "10000");
// Multiple Conversion Tests.
- written = __llvm_libc::sprintf(buff, "%10o %-#10o", 0456, 0123);
+ written = LIBC_NAMESPACE::sprintf(buff, "%10o %-#10o", 0456, 0123);
EXPECT_EQ(written, 21);
ASSERT_STREQ(buff, " 456 0123 ");
- written = __llvm_libc::sprintf(buff, "%-5.4o%#.4o", 075, 025);
+ written = LIBC_NAMESPACE::sprintf(buff, "%-5.4o%#.4o", 075, 025);
EXPECT_EQ(written, 9);
ASSERT_STREQ(buff, "0075 0025");
- written = __llvm_libc::sprintf(buff, "%04hho %#.5llo %-6.3zo", 256 + 077,
- 01000000000000ll, size_t(2));
+ written = LIBC_NAMESPACE::sprintf(buff, "%04hho %#.5llo %-6.3zo", 256 + 077,
+ 01000000000000ll, size_t(2));
EXPECT_EQ(written, 26);
ASSERT_STREQ(buff, "0077 01000000000000 002 ");
}
@@ -569,64 +570,64 @@ TEST(LlvmLibcSPrintfTest, OctConv) {
TEST_F(LlvmLibcSPrintfTest, FloatHexExpConv) {
ForceRoundingMode r(RoundingMode::Nearest);
- double inf = __llvm_libc::fputil::FPBits<double>::inf().get_val();
- double nan = __llvm_libc::fputil::FPBits<double>::build_nan(1);
+ double inf = LIBC_NAMESPACE::fputil::FPBits<double>::inf().get_val();
+ double nan = LIBC_NAMESPACE::fputil::FPBits<double>::build_nan(1);
- written = __llvm_libc::sprintf(buff, "%a", 1.0);
+ written = LIBC_NAMESPACE::sprintf(buff, "%a", 1.0);
ASSERT_STREQ_LEN(written, buff, "0x1p+0");
- written = __llvm_libc::sprintf(buff, "%A", -1.0);
+ written = LIBC_NAMESPACE::sprintf(buff, "%A", -1.0);
ASSERT_STREQ_LEN(written, buff, "-0X1P+0");
- written = __llvm_libc::sprintf(buff, "%a", -0x1.abcdef12345p0);
+ written = LIBC_NAMESPACE::sprintf(buff, "%a", -0x1.abcdef12345p0);
ASSERT_STREQ_LEN(written, buff, "-0x1.abcdef12345p+0");
- written = __llvm_libc::sprintf(buff, "%A", 0x1.abcdef12345p0);
+ written = LIBC_NAMESPACE::sprintf(buff, "%A", 0x1.abcdef12345p0);
ASSERT_STREQ_LEN(written, buff, "0X1.ABCDEF12345P+0");
- written = __llvm_libc::sprintf(buff, "%a", 0.0);
+ written = LIBC_NAMESPACE::sprintf(buff, "%a", 0.0);
ASSERT_STREQ_LEN(written, buff, "0x0p+0");
- written = __llvm_libc::sprintf(buff, "%a", 1.0e100);
+ written = LIBC_NAMESPACE::sprintf(buff, "%a", 1.0e100);
ASSERT_STREQ_LEN(written, buff, "0x1.249ad2594c37dp+332");
- written = __llvm_libc::sprintf(buff, "%a", 0.1);
+ written = LIBC_NAMESPACE::sprintf(buff, "%a", 0.1);
ASSERT_STREQ_LEN(written, buff, "0x1.999999999999ap-4");
// Subnormal Tests.
- written = __llvm_libc::sprintf(buff, "%a", 0x1.0p-1027);
+ written = LIBC_NAMESPACE::sprintf(buff, "%a", 0x1.0p-1027);
ASSERT_STREQ_LEN(written, buff, "0x0.08p-1022");
- written = __llvm_libc::sprintf(buff, "%a", 0x1.0p-1025);
+ written = LIBC_NAMESPACE::sprintf(buff, "%a", 0x1.0p-1025);
ASSERT_STREQ_LEN(written, buff, "0x0.2p-1022");
- written = __llvm_libc::sprintf(buff, "%a", 0x1.0p-1023);
+ written = LIBC_NAMESPACE::sprintf(buff, "%a", 0x1.0p-1023);
ASSERT_STREQ_LEN(written, buff, "0x0.8p-1022");
- written = __llvm_libc::sprintf(buff, "%a", 0x1.0p-1022);
+ written = LIBC_NAMESPACE::sprintf(buff, "%a", 0x1.0p-1022);
ASSERT_STREQ_LEN(written, buff, "0x1p-1022");
- written = __llvm_libc::sprintf(buff, "%a", 0x1.0p-1074);
+ written = LIBC_NAMESPACE::sprintf(buff, "%a", 0x1.0p-1074);
ASSERT_STREQ_LEN(written, buff, "0x0.0000000000001p-1022");
// Inf/Nan Tests.
- written = __llvm_libc::sprintf(buff, "%a", inf);
+ written = LIBC_NAMESPACE::sprintf(buff, "%a", inf);
ASSERT_STREQ_LEN(written, buff, "inf");
- written = __llvm_libc::sprintf(buff, "%A", -inf);
+ written = LIBC_NAMESPACE::sprintf(buff, "%A", -inf);
ASSERT_STREQ_LEN(written, buff, "-INF");
- written = __llvm_libc::sprintf(buff, "%a", nan);
+ written = LIBC_NAMESPACE::sprintf(buff, "%a", nan);
ASSERT_STREQ_LEN(written, buff, "nan");
- written = __llvm_libc::sprintf(buff, "%A", -nan);
+ written = LIBC_NAMESPACE::sprintf(buff, "%A", -nan);
ASSERT_STREQ_LEN(written, buff, "-NAN");
// Length Modifier Tests.
- written = __llvm_libc::sprintf(buff, "%La", 0.1L);
+ written = LIBC_NAMESPACE::sprintf(buff, "%La", 0.1L);
#if defined(SPECIAL_X86_LONG_DOUBLE)
ASSERT_STREQ_LEN(written, buff, "0xc.ccccccccccccccdp-7");
#elif defined(LONG_DOUBLE_IS_DOUBLE)
@@ -635,7 +636,7 @@ TEST_F(LlvmLibcSPrintfTest, FloatHexExpConv) {
ASSERT_STREQ_LEN(written, buff, "0x1.999999999999999999999999999ap-4");
#endif
- written = __llvm_libc::sprintf(buff, "%La", 1.0e1000L);
+ written = LIBC_NAMESPACE::sprintf(buff, "%La", 1.0e1000L);
#if defined(SPECIAL_X86_LONG_DOUBLE)
ASSERT_STREQ_LEN(written, buff, "0xf.38db1f9dd3dac05p+3318");
#elif defined(LONG_DOUBLE_IS_DOUBLE)
@@ -644,7 +645,7 @@ TEST_F(LlvmLibcSPrintfTest, FloatHexExpConv) {
ASSERT_STREQ_LEN(written, buff, "0x1.e71b63f3ba7b580af1a52d2a7379p+3321");
#endif
- written = __llvm_libc::sprintf(buff, "%La", 1.0e-1000L);
+ written = LIBC_NAMESPACE::sprintf(buff, "%La", 1.0e-1000L);
#if defined(SPECIAL_X86_LONG_DOUBLE)
ASSERT_STREQ_LEN(written, buff, "0x8.68a9188a89e1467p-3325");
#elif defined(LONG_DOUBLE_IS_DOUBLE)
@@ -655,99 +656,99 @@ TEST_F(LlvmLibcSPrintfTest, FloatHexExpConv) {
// Min Width Tests.
- written = __llvm_libc::sprintf(buff, "%15a", 1.0);
+ written = LIBC_NAMESPACE::sprintf(buff, "%15a", 1.0);
ASSERT_STREQ_LEN(written, buff, " 0x1p+0");
- written = __llvm_libc::sprintf(buff, "%15a", -1.0);
+ written = LIBC_NAMESPACE::sprintf(buff, "%15a", -1.0);
ASSERT_STREQ_LEN(written, buff, " -0x1p+0");
- written = __llvm_libc::sprintf(buff, "%15a", 1.0e10);
+ written = LIBC_NAMESPACE::sprintf(buff, "%15a", 1.0e10);
ASSERT_STREQ_LEN(written, buff, " 0x1.2a05f2p+33");
- written = __llvm_libc::sprintf(buff, "%15a", -1.0e10);
+ written = LIBC_NAMESPACE::sprintf(buff, "%15a", -1.0e10);
ASSERT_STREQ_LEN(written, buff, "-0x1.2a05f2p+33");
- written = __llvm_libc::sprintf(buff, "%10a", 1.0e10);
+ written = LIBC_NAMESPACE::sprintf(buff, "%10a", 1.0e10);
ASSERT_STREQ_LEN(written, buff, "0x1.2a05f2p+33");
- written = __llvm_libc::sprintf(buff, "%5a", inf);
+ written = LIBC_NAMESPACE::sprintf(buff, "%5a", inf);
ASSERT_STREQ_LEN(written, buff, " inf");
- written = __llvm_libc::sprintf(buff, "%5a", -nan);
+ written = LIBC_NAMESPACE::sprintf(buff, "%5a", -nan);
ASSERT_STREQ_LEN(written, buff, " -nan");
// Precision Tests.
- written = __llvm_libc::sprintf(buff, "%.1a", 1.0);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1a", 1.0);
ASSERT_STREQ_LEN(written, buff, "0x1.0p+0");
- written = __llvm_libc::sprintf(buff, "%.1a", 0.0);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1a", 0.0);
ASSERT_STREQ_LEN(written, buff, "0x0.0p+0");
- written = __llvm_libc::sprintf(buff, "%.1a", 0.1);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1a", 0.1);
ASSERT_STREQ_LEN(written, buff, "0x1.ap-4");
- written = __llvm_libc::sprintf(buff, "%.1a", 0x1.0fp0);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1a", 0x1.0fp0);
ASSERT_STREQ_LEN(written, buff, "0x1.1p+0");
- written = __llvm_libc::sprintf(buff, "%.1a", 0x1.07p0);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1a", 0x1.07p0);
ASSERT_STREQ_LEN(written, buff, "0x1.0p+0");
- written = __llvm_libc::sprintf(buff, "%.1a", 0x1.08p0);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1a", 0x1.08p0);
ASSERT_STREQ_LEN(written, buff, "0x1.0p+0");
- written = __llvm_libc::sprintf(buff, "%.1a", 0x1.18p0);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1a", 0x1.18p0);
ASSERT_STREQ_LEN(written, buff, "0x1.2p+0");
- written = __llvm_libc::sprintf(buff, "%.1a", 0x1.ffp0);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1a", 0x1.ffp0);
ASSERT_STREQ_LEN(written, buff, "0x2.0p+0");
- written = __llvm_libc::sprintf(buff, "%.5a", 1.25);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.5a", 1.25);
ASSERT_STREQ_LEN(written, buff, "0x1.40000p+0");
- written = __llvm_libc::sprintf(buff, "%.0a", 1.25);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.0a", 1.25);
ASSERT_STREQ_LEN(written, buff, "0x1p+0");
- written = __llvm_libc::sprintf(buff, "%.0a", 1.75);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.0a", 1.75);
ASSERT_STREQ_LEN(written, buff, "0x2p+0");
- written = __llvm_libc::sprintf(buff, "%.1a", 0x1.0p-1023);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1a", 0x1.0p-1023);
ASSERT_STREQ_LEN(written, buff, "0x0.8p-1022");
- written = __llvm_libc::sprintf(buff, "%.1a", 0x1.8p-1023);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1a", 0x1.8p-1023);
ASSERT_STREQ_LEN(written, buff, "0x0.cp-1022");
- written = __llvm_libc::sprintf(buff, "%.1a", 0x1.0p-1024);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1a", 0x1.0p-1024);
ASSERT_STREQ_LEN(written, buff, "0x0.4p-1022");
- written = __llvm_libc::sprintf(buff, "%.0a", 0x1.0p-1023);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.0a", 0x1.0p-1023);
ASSERT_STREQ_LEN(written, buff, "0x0p-1022");
- written = __llvm_libc::sprintf(buff, "%.0a", 0x1.8p-1023);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.0a", 0x1.8p-1023);
ASSERT_STREQ_LEN(written, buff, "0x1p-1022");
- written = __llvm_libc::sprintf(buff, "%.0a", 0x1.0p-1024);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.0a", 0x1.0p-1024);
ASSERT_STREQ_LEN(written, buff, "0x0p-1022");
- written = __llvm_libc::sprintf(buff, "%.2a", 0x1.0p-1027);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.2a", 0x1.0p-1027);
ASSERT_STREQ_LEN(written, buff, "0x0.08p-1022");
- written = __llvm_libc::sprintf(buff, "%.1a", 0x1.0p-1027);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1a", 0x1.0p-1027);
ASSERT_STREQ_LEN(written, buff, "0x0.0p-1022");
- written = __llvm_libc::sprintf(buff, "%.5a", 0.0);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.5a", 0.0);
ASSERT_STREQ_LEN(written, buff, "0x0.00000p+0");
- written = __llvm_libc::sprintf(buff, "%.5a", 0x1.008p0);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.5a", 0x1.008p0);
ASSERT_STREQ_LEN(written, buff, "0x1.00800p+0");
- written = __llvm_libc::sprintf(buff, "%.5a", 0x1.008p10);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.5a", 0x1.008p10);
ASSERT_STREQ_LEN(written, buff, "0x1.00800p+10");
- written = __llvm_libc::sprintf(buff, "%.5a", nan);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.5a", nan);
ASSERT_STREQ_LEN(written, buff, "nan");
- written = __llvm_libc::sprintf(buff, "%.1La", 0.1L);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1La", 0.1L);
#if defined(SPECIAL_X86_LONG_DOUBLE)
ASSERT_STREQ_LEN(written, buff, "0xc.dp-7");
#elif defined(LONG_DOUBLE_IS_DOUBLE)
@@ -756,7 +757,7 @@ TEST_F(LlvmLibcSPrintfTest, FloatHexExpConv) {
ASSERT_STREQ_LEN(written, buff, "0x1.ap-4");
#endif
- written = __llvm_libc::sprintf(buff, "%.1La", 0xf.fffffffffffffffp16380L);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1La", 0xf.fffffffffffffffp16380L);
#if defined(SPECIAL_X86_LONG_DOUBLE)
ASSERT_STREQ_LEN(written, buff, "0x1.0p+16384");
#elif defined(LONG_DOUBLE_IS_DOUBLE)
@@ -768,162 +769,162 @@ TEST_F(LlvmLibcSPrintfTest, FloatHexExpConv) {
// Rounding Mode Tests.
if (ForceRoundingMode r(RoundingMode::Nearest); r.success) {
- written = __llvm_libc::sprintf(buff, "%.1a", 0x1.08p0);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1a", 0x1.08p0);
ASSERT_STREQ_LEN(written, buff, "0x1.0p+0");
- written = __llvm_libc::sprintf(buff, "%.1a", 0x1.18p0);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1a", 0x1.18p0);
ASSERT_STREQ_LEN(written, buff, "0x1.2p+0");
- written = __llvm_libc::sprintf(buff, "%.1a", 0x1.04p0);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1a", 0x1.04p0);
ASSERT_STREQ_LEN(written, buff, "0x1.0p+0");
- written = __llvm_libc::sprintf(buff, "%.1a", 0x1.14p0);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1a", 0x1.14p0);
ASSERT_STREQ_LEN(written, buff, "0x1.1p+0");
- written = __llvm_libc::sprintf(buff, "%.1a", -0x1.08p0);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1a", -0x1.08p0);
ASSERT_STREQ_LEN(written, buff, "-0x1.0p+0");
- written = __llvm_libc::sprintf(buff, "%.1a", -0x1.18p0);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1a", -0x1.18p0);
ASSERT_STREQ_LEN(written, buff, "-0x1.2p+0");
- written = __llvm_libc::sprintf(buff, "%.1a", -0x1.04p0);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1a", -0x1.04p0);
ASSERT_STREQ_LEN(written, buff, "-0x1.0p+0");
- written = __llvm_libc::sprintf(buff, "%.1a", -0x1.14p0);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1a", -0x1.14p0);
ASSERT_STREQ_LEN(written, buff, "-0x1.1p+0");
}
if (ForceRoundingMode r(RoundingMode::Upward); r.success) {
- written = __llvm_libc::sprintf(buff, "%.1a", 0x1.08p0);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1a", 0x1.08p0);
ASSERT_STREQ_LEN(written, buff, "0x1.1p+0");
- written = __llvm_libc::sprintf(buff, "%.1a", 0x1.18p0);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1a", 0x1.18p0);
ASSERT_STREQ_LEN(written, buff, "0x1.2p+0");
- written = __llvm_libc::sprintf(buff, "%.1a", 0x1.04p0);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1a", 0x1.04p0);
ASSERT_STREQ_LEN(written, buff, "0x1.1p+0");
- written = __llvm_libc::sprintf(buff, "%.1a", 0x1.14p0);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1a", 0x1.14p0);
ASSERT_STREQ_LEN(written, buff, "0x1.2p+0");
- written = __llvm_libc::sprintf(buff, "%.1a", -0x1.08p0);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1a", -0x1.08p0);
ASSERT_STREQ_LEN(written, buff, "-0x1.0p+0");
- written = __llvm_libc::sprintf(buff, "%.1a", -0x1.18p0);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1a", -0x1.18p0);
ASSERT_STREQ_LEN(written, buff, "-0x1.1p+0");
- written = __llvm_libc::sprintf(buff, "%.1a", -0x1.04p0);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1a", -0x1.04p0);
ASSERT_STREQ_LEN(written, buff, "-0x1.0p+0");
- written = __llvm_libc::sprintf(buff, "%.1a", -0x1.14p0);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1a", -0x1.14p0);
ASSERT_STREQ_LEN(written, buff, "-0x1.1p+0");
}
if (ForceRoundingMode r(RoundingMode::Downward); r.success) {
- written = __llvm_libc::sprintf(buff, "%.1a", 0x1.08p0);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1a", 0x1.08p0);
ASSERT_STREQ_LEN(written, buff, "0x1.0p+0");
- written = __llvm_libc::sprintf(buff, "%.1a", 0x1.18p0);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1a", 0x1.18p0);
ASSERT_STREQ_LEN(written, buff, "0x1.1p+0");
- written = __llvm_libc::sprintf(buff, "%.1a", 0x1.04p0);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1a", 0x1.04p0);
ASSERT_STREQ_LEN(written, buff, "0x1.0p+0");
- written = __llvm_libc::sprintf(buff, "%.1a", 0x1.14p0);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1a", 0x1.14p0);
ASSERT_STREQ_LEN(written, buff, "0x1.1p+0");
- written = __llvm_libc::sprintf(buff, "%.1a", -0x1.08p0);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1a", -0x1.08p0);
ASSERT_STREQ_LEN(written, buff, "-0x1.1p+0");
- written = __llvm_libc::sprintf(buff, "%.1a", -0x1.18p0);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1a", -0x1.18p0);
ASSERT_STREQ_LEN(written, buff, "-0x1.2p+0");
- written = __llvm_libc::sprintf(buff, "%.1a", -0x1.04p0);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1a", -0x1.04p0);
ASSERT_STREQ_LEN(written, buff, "-0x1.1p+0");
- written = __llvm_libc::sprintf(buff, "%.1a", -0x1.14p0);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1a", -0x1.14p0);
ASSERT_STREQ_LEN(written, buff, "-0x1.2p+0");
}
if (ForceRoundingMode r(RoundingMode::TowardZero); r.success) {
- written = __llvm_libc::sprintf(buff, "%.1a", 0x1.08p0);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1a", 0x1.08p0);
ASSERT_STREQ_LEN(written, buff, "0x1.0p+0");
- written = __llvm_libc::sprintf(buff, "%.1a", 0x1.18p0);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1a", 0x1.18p0);
ASSERT_STREQ_LEN(written, buff, "0x1.1p+0");
- written = __llvm_libc::sprintf(buff, "%.1a", 0x1.04p0);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1a", 0x1.04p0);
ASSERT_STREQ_LEN(written, buff, "0x1.0p+0");
- written = __llvm_libc::sprintf(buff, "%.1a", 0x1.14p0);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1a", 0x1.14p0);
ASSERT_STREQ_LEN(written, buff, "0x1.1p+0");
- written = __llvm_libc::sprintf(buff, "%.1a", -0x1.08p0);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1a", -0x1.08p0);
ASSERT_STREQ_LEN(written, buff, "-0x1.0p+0");
- written = __llvm_libc::sprintf(buff, "%.1a", -0x1.18p0);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1a", -0x1.18p0);
ASSERT_STREQ_LEN(written, buff, "-0x1.1p+0");
- written = __llvm_libc::sprintf(buff, "%.1a", -0x1.04p0);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1a", -0x1.04p0);
ASSERT_STREQ_LEN(written, buff, "-0x1.0p+0");
- written = __llvm_libc::sprintf(buff, "%.1a", -0x1.14p0);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1a", -0x1.14p0);
ASSERT_STREQ_LEN(written, buff, "-0x1.1p+0");
}
// Flag Tests.
- written = __llvm_libc::sprintf(buff, "%+a", nan);
+ written = LIBC_NAMESPACE::sprintf(buff, "%+a", nan);
ASSERT_STREQ_LEN(written, buff, "+nan");
- written = __llvm_libc::sprintf(buff, "% A", inf);
+ written = LIBC_NAMESPACE::sprintf(buff, "% A", inf);
ASSERT_STREQ_LEN(written, buff, " INF");
- written = __llvm_libc::sprintf(buff, "%-5a", inf);
+ written = LIBC_NAMESPACE::sprintf(buff, "%-5a", inf);
ASSERT_STREQ_LEN(written, buff, "inf ");
- written = __llvm_libc::sprintf(buff, "%+-5A", nan);
+ written = LIBC_NAMESPACE::sprintf(buff, "%+-5A", nan);
ASSERT_STREQ_LEN(written, buff, "+NAN ");
- written = __llvm_libc::sprintf(buff, "%+a", 1.0);
+ written = LIBC_NAMESPACE::sprintf(buff, "%+a", 1.0);
ASSERT_STREQ_LEN(written, buff, "+0x1p+0");
- written = __llvm_libc::sprintf(buff, "% a", 0.0);
+ written = LIBC_NAMESPACE::sprintf(buff, "% a", 0.0);
ASSERT_STREQ_LEN(written, buff, " 0x0p+0");
- written = __llvm_libc::sprintf(buff, "%-10a", 1.5);
+ written = LIBC_NAMESPACE::sprintf(buff, "%-10a", 1.5);
ASSERT_STREQ_LEN(written, buff, "0x1.8p+0 ");
- written = __llvm_libc::sprintf(buff, "%#a", 1.0);
+ written = LIBC_NAMESPACE::sprintf(buff, "%#a", 1.0);
ASSERT_STREQ_LEN(written, buff, "0x1.p+0");
- written = __llvm_libc::sprintf(buff, "%#.0a", 1.5);
+ written = LIBC_NAMESPACE::sprintf(buff, "%#.0a", 1.5);
ASSERT_STREQ_LEN(written, buff, "0x2.p+0");
- written = __llvm_libc::sprintf(buff, "%010a", 1.5);
+ written = LIBC_NAMESPACE::sprintf(buff, "%010a", 1.5);
ASSERT_STREQ_LEN(written, buff, "0x001.8p+0");
- written = __llvm_libc::sprintf(buff, "%+- #0a", 0.0);
+ written = LIBC_NAMESPACE::sprintf(buff, "%+- #0a", 0.0);
ASSERT_STREQ_LEN(written, buff, "+0x0.p+0");
// Combined Tests.
- written = __llvm_libc::sprintf(buff, "%12.3a %-12.3A", 0.1, 256.0);
+ written = LIBC_NAMESPACE::sprintf(buff, "%12.3a %-12.3A", 0.1, 256.0);
ASSERT_STREQ_LEN(written, buff, " 0x1.99ap-4 0X1.000P+8 ");
- written = __llvm_libc::sprintf(buff, "%+-#12.3a % 012.3a", 0.1256, 1256.0);
+ written = LIBC_NAMESPACE::sprintf(buff, "%+-#12.3a % 012.3a", 0.1256, 1256.0);
ASSERT_STREQ_LEN(written, buff, "+0x1.014p-3 0x1.3a0p+10");
// These tests check that the padding is properly calculated based on the
// min_width field. Specifically, they check that the extra zeroes added by
// the high precision are accounted for correctly.
- written = __llvm_libc::sprintf(buff, "%50.50a", 0x1.0p0);
+ written = LIBC_NAMESPACE::sprintf(buff, "%50.50a", 0x1.0p0);
ASSERT_STREQ_LEN(written, buff,
"0x1.00000000000000000000000000000000000000000000000000p+0");
// The difference with this test is that the formatted number is exactly 57
// characters, so padding to 58 adds a space.
- written = __llvm_libc::sprintf(buff, "%58.50a", 0x1.0p0);
+ written = LIBC_NAMESPACE::sprintf(buff, "%58.50a", 0x1.0p0);
ASSERT_STREQ_LEN(
written, buff,
" 0x1.00000000000000000000000000000000000000000000000000p+0");
@@ -931,28 +932,28 @@ TEST_F(LlvmLibcSPrintfTest, FloatHexExpConv) {
TEST_F(LlvmLibcSPrintfTest, FloatDecimalConv) {
ForceRoundingMode r(RoundingMode::Nearest);
- double inf = __llvm_libc::fputil::FPBits<double>::inf().get_val();
- double nan = __llvm_libc::fputil::FPBits<double>::build_nan(1);
+ double inf = LIBC_NAMESPACE::fputil::FPBits<double>::inf().get_val();
+ double nan = LIBC_NAMESPACE::fputil::FPBits<double>::build_nan(1);
char big_buff[10000]; // Used for long doubles and other extremely wide
// numbers.
- written = __llvm_libc::sprintf(buff, "%f", 1.0);
+ written = LIBC_NAMESPACE::sprintf(buff, "%f", 1.0);
ASSERT_STREQ_LEN(written, buff, "1.000000");
- written = __llvm_libc::sprintf(buff, "%F", -1.0);
+ written = LIBC_NAMESPACE::sprintf(buff, "%F", -1.0);
ASSERT_STREQ_LEN(written, buff, "-1.000000");
- written = __llvm_libc::sprintf(buff, "%f", -1.234567);
+ written = LIBC_NAMESPACE::sprintf(buff, "%f", -1.234567);
ASSERT_STREQ_LEN(written, buff, "-1.234567");
- written = __llvm_libc::sprintf(buff, "%f", 0.0);
+ written = LIBC_NAMESPACE::sprintf(buff, "%f", 0.0);
ASSERT_STREQ_LEN(written, buff, "0.000000");
- written = __llvm_libc::sprintf(buff, "%f", 1.5);
+ written = LIBC_NAMESPACE::sprintf(buff, "%f", 1.5);
ASSERT_STREQ_LEN(written, buff, "1.500000");
- written = __llvm_libc::sprintf(buff, "%f", 1e300);
+ written = LIBC_NAMESPACE::sprintf(buff, "%f", 1e300);
ASSERT_STREQ_LEN(
written, buff,
"100000000000000005250476025520442024870446858110815915491585411551180245"
@@ -961,35 +962,35 @@ TEST_F(LlvmLibcSPrintfTest, FloatDecimalConv) {
"111903896764088007465274278014249457925878882005684283811566947219638686"
"5459400540160.000000");
- written = __llvm_libc::sprintf(buff, "%f", 0.1);
+ written = LIBC_NAMESPACE::sprintf(buff, "%f", 0.1);
ASSERT_STREQ_LEN(written, buff, "0.100000");
- written = __llvm_libc::sprintf(buff, "%f", 1234567890123456789.0);
+ written = LIBC_NAMESPACE::sprintf(buff, "%f", 1234567890123456789.0);
ASSERT_STREQ_LEN(written, buff, "1234567890123456768.000000");
- written = __llvm_libc::sprintf(buff, "%f", 9999999999999.99);
+ written = LIBC_NAMESPACE::sprintf(buff, "%f", 9999999999999.99);
ASSERT_STREQ_LEN(written, buff, "9999999999999.990234");
// Simple Subnormal Tests.
- written = __llvm_libc::sprintf(buff, "%f", 0x1.0p-1027);
+ written = LIBC_NAMESPACE::sprintf(buff, "%f", 0x1.0p-1027);
ASSERT_STREQ_LEN(written, buff, "0.000000");
- written = __llvm_libc::sprintf(buff, "%f", 0x1.0p-1074);
+ written = LIBC_NAMESPACE::sprintf(buff, "%f", 0x1.0p-1074);
ASSERT_STREQ_LEN(written, buff, "0.000000");
// Inf/Nan Tests.
- written = __llvm_libc::sprintf(buff, "%f", inf);
+ written = LIBC_NAMESPACE::sprintf(buff, "%f", inf);
ASSERT_STREQ_LEN(written, buff, "inf");
- written = __llvm_libc::sprintf(buff, "%F", -inf);
+ written = LIBC_NAMESPACE::sprintf(buff, "%F", -inf);
ASSERT_STREQ_LEN(written, buff, "-INF");
- written = __llvm_libc::sprintf(buff, "%f", nan);
+ written = LIBC_NAMESPACE::sprintf(buff, "%f", nan);
ASSERT_STREQ_LEN(written, buff, "nan");
- written = __llvm_libc::sprintf(buff, "%F", -nan);
+ written = LIBC_NAMESPACE::sprintf(buff, "%F", -nan);
ASSERT_STREQ_LEN(written, buff, "-NAN");
// Length Modifier Tests.
@@ -999,17 +1000,17 @@ TEST_F(LlvmLibcSPrintfTest, FloatDecimalConv) {
// TODO(michaelrj): Fix the tests to only depend on the digits the long double
// is accurate for.
- written = __llvm_libc::sprintf(buff, "%Lf", 1.0L);
+ written = LIBC_NAMESPACE::sprintf(buff, "%Lf", 1.0L);
ASSERT_STREQ_LEN(written, buff, "1.000000");
#if defined(SPECIAL_X86_LONG_DOUBLE)
- written = __llvm_libc::sprintf(buff, "%Lf", 1e100L);
+ written = LIBC_NAMESPACE::sprintf(buff, "%Lf", 1e100L);
ASSERT_STREQ_LEN(written, buff,
"99999999999999999996693535322073426194986990198284960792713"
"91541752018669482644324418977840117055488.000000");
- written = __llvm_libc::sprintf(big_buff, "%Lf", 1e1000L);
+ written = LIBC_NAMESPACE::sprintf(big_buff, "%Lf", 1e1000L);
ASSERT_STREQ_LEN(
written, big_buff,
"999999999999999999973107317669562353428234857594552594925899449376328728"
@@ -1028,7 +1029,7 @@ TEST_F(LlvmLibcSPrintfTest, FloatDecimalConv) {
"2431457550909271560663602154947063707982236377366647567795879936."
"000000");
- written = __llvm_libc::sprintf(big_buff, "%Lf", 1e4900L);
+ written = LIBC_NAMESPACE::sprintf(big_buff, "%Lf", 1e4900L);
ASSERT_STREQ_LEN(
written, big_buff,
"100000000000000000002708312230690349833224052504078834346502930111959028"
@@ -1101,10 +1102,10 @@ TEST_F(LlvmLibcSPrintfTest, FloatDecimalConv) {
"231934194956788626761834746430104077432547436359522462253411168467463134"
"24896.000000");
- written = __llvm_libc::sprintf(big_buff, "%.10Lf", 1e-10L);
+ written = LIBC_NAMESPACE::sprintf(big_buff, "%.10Lf", 1e-10L);
ASSERT_STREQ_LEN(written, big_buff, "0.0000000001");
- written = __llvm_libc::sprintf(big_buff, "%.7500Lf", 1e-4900L);
+ written = LIBC_NAMESPACE::sprintf(big_buff, "%.7500Lf", 1e-4900L);
ASSERT_STREQ_LEN(
written, big_buff,
"0."
@@ -1216,7 +1217,7 @@ TEST_F(LlvmLibcSPrintfTest, FloatDecimalConv) {
#endif // SPECIAL_X86_LONG_DOUBLE
/*
- written = __llvm_libc::sprintf(buff, "%La", 0.1L);
+ written = LIBC_NAMESPACE::sprintf(buff, "%La", 0.1L);
#if defined(SPECIAL_X86_LONG_DOUBLE)
ASSERT_STREQ_LEN(written, buff, "0xc.ccccccccccccccdp-7");
#elif defined(LONG_DOUBLE_IS_DOUBLE)
@@ -1225,7 +1226,7 @@ TEST_F(LlvmLibcSPrintfTest, FloatDecimalConv) {
ASSERT_STREQ_LEN(written, buff, "0x1.999999999999999999999999999ap-4");
#endif
- written = __llvm_libc::sprintf(buff, "%La", 1.0e1000L);
+ written = LIBC_NAMESPACE::sprintf(buff, "%La", 1.0e1000L);
#if defined(SPECIAL_X86_LONG_DOUBLE)
ASSERT_STREQ_LEN(written, buff, "0xf.38db1f9dd3dac05p+3318");
#elif defined(LONG_DOUBLE_IS_DOUBLE)
@@ -1234,7 +1235,7 @@ TEST_F(LlvmLibcSPrintfTest, FloatDecimalConv) {
ASSERT_STREQ_LEN(written, buff, "0x1.e71b63f3ba7b580af1a52d2a7379p+3321");
#endif
- written = __llvm_libc::sprintf(buff, "%La", 1.0e-1000L);
+ written = LIBC_NAMESPACE::sprintf(buff, "%La", 1.0e-1000L);
#if defined(SPECIAL_X86_LONG_DOUBLE)
ASSERT_STREQ_LEN(written, buff, "0x8.68a9188a89e1467p-3325");
#elif defined(LONG_DOUBLE_IS_DOUBLE)
@@ -1246,88 +1247,88 @@ TEST_F(LlvmLibcSPrintfTest, FloatDecimalConv) {
// Min Width Tests.
- written = __llvm_libc::sprintf(buff, "%15f", 1.0);
+ written = LIBC_NAMESPACE::sprintf(buff, "%15f", 1.0);
ASSERT_STREQ_LEN(written, buff, " 1.000000");
- written = __llvm_libc::sprintf(buff, "%15f", -1.0);
+ written = LIBC_NAMESPACE::sprintf(buff, "%15f", -1.0);
ASSERT_STREQ_LEN(written, buff, " -1.000000");
- written = __llvm_libc::sprintf(buff, "%15f", 1.0e5);
+ written = LIBC_NAMESPACE::sprintf(buff, "%15f", 1.0e5);
ASSERT_STREQ_LEN(written, buff, " 100000.000000");
- written = __llvm_libc::sprintf(buff, "%15f", -1.0e5);
+ written = LIBC_NAMESPACE::sprintf(buff, "%15f", -1.0e5);
ASSERT_STREQ_LEN(written, buff, " -100000.000000");
- written = __llvm_libc::sprintf(buff, "%10f", 1.0e5);
+ written = LIBC_NAMESPACE::sprintf(buff, "%10f", 1.0e5);
ASSERT_STREQ_LEN(written, buff, "100000.000000");
// Precision Tests.
- written = __llvm_libc::sprintf(buff, "%.1f", 1.0);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1f", 1.0);
ASSERT_STREQ_LEN(written, buff, "1.0");
- written = __llvm_libc::sprintf(buff, "%.1f", 0.0);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1f", 0.0);
ASSERT_STREQ_LEN(written, buff, "0.0");
- written = __llvm_libc::sprintf(buff, "%.0f", 0.0);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.0f", 0.0);
ASSERT_STREQ_LEN(written, buff, "0");
- written = __llvm_libc::sprintf(buff, "%.1f", 0.1);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1f", 0.1);
ASSERT_STREQ_LEN(written, buff, "0.1");
- written = __llvm_libc::sprintf(buff, "%.1f", 1.09);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1f", 1.09);
ASSERT_STREQ_LEN(written, buff, "1.1");
- written = __llvm_libc::sprintf(buff, "%.1f", 1.04);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1f", 1.04);
ASSERT_STREQ_LEN(written, buff, "1.0");
- written = __llvm_libc::sprintf(buff, "%.1f", 1.19);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1f", 1.19);
ASSERT_STREQ_LEN(written, buff, "1.2");
- written = __llvm_libc::sprintf(buff, "%.1f", 1.99);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1f", 1.99);
ASSERT_STREQ_LEN(written, buff, "2.0");
- written = __llvm_libc::sprintf(buff, "%.1f", 9.99);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1f", 9.99);
ASSERT_STREQ_LEN(written, buff, "10.0");
- written = __llvm_libc::sprintf(buff, "%.2f", 9999999999999.99);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.2f", 9999999999999.99);
ASSERT_STREQ_LEN(written, buff, "9999999999999.99");
- written = __llvm_libc::sprintf(buff, "%.1f", 9999999999999.99);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1f", 9999999999999.99);
ASSERT_STREQ_LEN(written, buff, "10000000000000.0");
- written = __llvm_libc::sprintf(buff, "%.5f", 1.25);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.5f", 1.25);
ASSERT_STREQ_LEN(written, buff, "1.25000");
- written = __llvm_libc::sprintf(buff, "%.0f", 1.25);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.0f", 1.25);
ASSERT_STREQ_LEN(written, buff, "1");
- written = __llvm_libc::sprintf(buff, "%.0f", 1.75);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.0f", 1.75);
ASSERT_STREQ_LEN(written, buff, "2");
- written = __llvm_libc::sprintf(buff, "%.20f", 1.234e-10);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.20f", 1.234e-10);
ASSERT_STREQ_LEN(written, buff, "0.00000000012340000000");
- written = __llvm_libc::sprintf(buff, "%.2f", -9.99);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.2f", -9.99);
ASSERT_STREQ_LEN(written, buff, "-9.99");
- written = __llvm_libc::sprintf(buff, "%.1f", -9.99);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1f", -9.99);
ASSERT_STREQ_LEN(written, buff, "-10.0");
- written = __llvm_libc::sprintf(buff, "%.5f", 0.0);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.5f", 0.0);
ASSERT_STREQ_LEN(written, buff, "0.00000");
- written = __llvm_libc::sprintf(buff, "%.5f", 1.008);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.5f", 1.008);
ASSERT_STREQ_LEN(written, buff, "1.00800");
- written = __llvm_libc::sprintf(buff, "%.5f", 1.008e3);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.5f", 1.008e3);
ASSERT_STREQ_LEN(written, buff, "1008.00000");
// Found with the help of Fred Tydeman's tbin2dec test.
- written = __llvm_libc::sprintf(buff, "%.1f", 0x1.1000000000006p+3);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1f", 0x1.1000000000006p+3);
ASSERT_STREQ_LEN(written, buff, "8.5");
- written = __llvm_libc::sprintf(buff, "%.0f", 0x1.1000000000006p+3);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.0f", 0x1.1000000000006p+3);
ASSERT_STREQ_LEN(written, buff, "9");
// Most of these tests are checking rounding behavior when the precision is
@@ -1337,13 +1338,13 @@ TEST_F(LlvmLibcSPrintfTest, FloatDecimalConv) {
// since when printing the floating point numbers are broken up into "blocks"
// of 9 digits. They often also have a 5 after the end of what's printed,
// since in round to nearest mode, that requires checking additional digits.
- written = __llvm_libc::sprintf(buff, "%.9f", 1.9999999999999514);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.9f", 1.9999999999999514);
ASSERT_STREQ_LEN(written, buff, "2.000000000");
// The number continues after the literal because floating point numbers can't
// represent every value. The printed value is the closest value a double can
// represent, rounded to the requested precision.
- written = __llvm_libc::sprintf(buff, "%.238f", 1.131959884853339E-72);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.238f", 1.131959884853339E-72);
ASSERT_STREQ_LEN(
written, buff,
"0."
@@ -1352,10 +1353,11 @@ TEST_F(LlvmLibcSPrintfTest, FloatDecimalConv) {
"824105639342441431495119762431744054912109728706985341609159156917030486"
"5110665559768676757812");
- written = __llvm_libc::sprintf(buff, "%.36f", 9.9e-77);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.36f", 9.9e-77);
ASSERT_STREQ_LEN(written, buff, "0.000000000000000000000000000000000000");
- written = __llvm_libc::sprintf(big_buff, "%.1071f", 2.0226568751604562E-314);
+ written =
+ LIBC_NAMESPACE::sprintf(big_buff, "%.1071f", 2.0226568751604562E-314);
ASSERT_STREQ_LEN(
written, big_buff,
"0."
@@ -1376,12 +1378,12 @@ TEST_F(LlvmLibcSPrintfTest, FloatDecimalConv) {
"750016448075109469332839157162950982637994457036256790161132812");
// If no precision is specified it defaults to 6 for %f.
- written = __llvm_libc::sprintf(buff, "%f", 2325885.4901960781);
+ written = LIBC_NAMESPACE::sprintf(buff, "%f", 2325885.4901960781);
ASSERT_STREQ_LEN(written, buff, "2325885.490196");
// Subnormal Precision Tests
- written = __llvm_libc::sprintf(buff, "%.310f", 0x1.0p-1022);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.310f", 0x1.0p-1022);
ASSERT_STREQ_LEN(
written, buff,
"0."
@@ -1391,7 +1393,7 @@ TEST_F(LlvmLibcSPrintfTest, FloatDecimalConv) {
"000000000000000000000000000000000000000000000000000000000000000000000000"
"0000000000000000000223");
- written = __llvm_libc::sprintf(buff, "%.310f", 0x1.0p-1023);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.310f", 0x1.0p-1023);
ASSERT_STREQ_LEN(
written, buff,
"0."
@@ -1401,7 +1403,7 @@ TEST_F(LlvmLibcSPrintfTest, FloatDecimalConv) {
"000000000000000000000000000000000000000000000000000000000000000000000000"
"0000000000000000000111");
- written = __llvm_libc::sprintf(buff, "%.315f", 9.99999e-310);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.315f", 9.99999e-310);
ASSERT_STREQ_LEN(
written, buff,
"0."
@@ -1411,7 +1413,7 @@ TEST_F(LlvmLibcSPrintfTest, FloatDecimalConv) {
"000000000000000000000000000000000000000000000000000000000000000000000000"
"000000000000000000000999999");
- written = __llvm_libc::sprintf(buff, "%.314f", 9.99999e-310);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.314f", 9.99999e-310);
ASSERT_STREQ_LEN(
written, buff,
"0."
@@ -1421,7 +1423,7 @@ TEST_F(LlvmLibcSPrintfTest, FloatDecimalConv) {
"000000000000000000000000000000000000000000000000000000000000000000000000"
"00000000000000000000100000");
- written = __llvm_libc::sprintf(buff, "%.330f", 0x1.0p-1074);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.330f", 0x1.0p-1074);
ASSERT_STREQ_LEN(
written, buff,
"0."
@@ -1432,7 +1434,7 @@ TEST_F(LlvmLibcSPrintfTest, FloatDecimalConv) {
"000000000000000000000000000000000004940656");
/*
- written = __llvm_libc::sprintf(buff, "%.1La", 0.1L);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1La", 0.1L);
#if defined(SPECIAL_X86_LONG_DOUBLE)
ASSERT_STREQ_LEN(written, buff, "0xc.dp-7");
#elif defined(LONG_DOUBLE_IS_DOUBLE)
@@ -1441,8 +1443,8 @@ TEST_F(LlvmLibcSPrintfTest, FloatDecimalConv) {
ASSERT_STREQ_LEN(written, buff, "0x1.ap-4");
#endif
- written = __llvm_libc::sprintf(buff, "%.1La", 0xf.fffffffffffffffp16380L);
- #if defined(SPECIAL_X86_LONG_DOUBLE)
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1La",
+ 0xf.fffffffffffffffp16380L); #if defined(SPECIAL_X86_LONG_DOUBLE)
ASSERT_STREQ_LEN(written, buff, "0x1.0p+16384");
#elif defined(LONG_DOUBLE_IS_DOUBLE)
ASSERT_STREQ_LEN(written, buff, "inf");
@@ -1454,316 +1456,316 @@ TEST_F(LlvmLibcSPrintfTest, FloatDecimalConv) {
// Rounding Mode Tests.
if (ForceRoundingMode r(RoundingMode::Nearest); r.success) {
- written = __llvm_libc::sprintf(buff, "%.1f", 1.75);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1f", 1.75);
ASSERT_STREQ_LEN(written, buff, "1.8");
- written = __llvm_libc::sprintf(buff, "%.1f", 1.25);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1f", 1.25);
ASSERT_STREQ_LEN(written, buff, "1.2");
- written = __llvm_libc::sprintf(buff, "%.1f", 1.125);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1f", 1.125);
ASSERT_STREQ_LEN(written, buff, "1.1");
- written = __llvm_libc::sprintf(buff, "%.1f", 1.625);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1f", 1.625);
ASSERT_STREQ_LEN(written, buff, "1.6");
- written = __llvm_libc::sprintf(buff, "%.1f", 1.375);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1f", 1.375);
ASSERT_STREQ_LEN(written, buff, "1.4");
- written = __llvm_libc::sprintf(buff, "%.1f", 1.875);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1f", 1.875);
ASSERT_STREQ_LEN(written, buff, "1.9");
- written = __llvm_libc::sprintf(buff, "%.1f", -1.75);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1f", -1.75);
ASSERT_STREQ_LEN(written, buff, "-1.8");
- written = __llvm_libc::sprintf(buff, "%.1f", -1.25);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1f", -1.25);
ASSERT_STREQ_LEN(written, buff, "-1.2");
- written = __llvm_libc::sprintf(buff, "%.1f", -1.125);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1f", -1.125);
ASSERT_STREQ_LEN(written, buff, "-1.1");
- written = __llvm_libc::sprintf(buff, "%.1f", -1.625);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1f", -1.625);
ASSERT_STREQ_LEN(written, buff, "-1.6");
- written = __llvm_libc::sprintf(buff, "%.1f", -1.375);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1f", -1.375);
ASSERT_STREQ_LEN(written, buff, "-1.4");
- written = __llvm_libc::sprintf(buff, "%.1f", -1.875);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1f", -1.875);
ASSERT_STREQ_LEN(written, buff, "-1.9");
}
if (ForceRoundingMode r(RoundingMode::Upward); r.success) {
- written = __llvm_libc::sprintf(buff, "%.1f", 1.75);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1f", 1.75);
ASSERT_STREQ_LEN(written, buff, "1.8");
- written = __llvm_libc::sprintf(buff, "%.1f", 1.25);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1f", 1.25);
ASSERT_STREQ_LEN(written, buff, "1.3");
- written = __llvm_libc::sprintf(buff, "%.1f", 1.125);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1f", 1.125);
ASSERT_STREQ_LEN(written, buff, "1.2");
- written = __llvm_libc::sprintf(buff, "%.1f", 1.625);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1f", 1.625);
ASSERT_STREQ_LEN(written, buff, "1.7");
- written = __llvm_libc::sprintf(buff, "%.1f", 1.375);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1f", 1.375);
ASSERT_STREQ_LEN(written, buff, "1.4");
- written = __llvm_libc::sprintf(buff, "%.1f", 1.875);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1f", 1.875);
ASSERT_STREQ_LEN(written, buff, "1.9");
- written = __llvm_libc::sprintf(buff, "%.1f", -1.75);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1f", -1.75);
ASSERT_STREQ_LEN(written, buff, "-1.7");
- written = __llvm_libc::sprintf(buff, "%.1f", -1.25);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1f", -1.25);
ASSERT_STREQ_LEN(written, buff, "-1.2");
- written = __llvm_libc::sprintf(buff, "%.1f", -1.125);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1f", -1.125);
ASSERT_STREQ_LEN(written, buff, "-1.1");
- written = __llvm_libc::sprintf(buff, "%.1f", -1.625);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1f", -1.625);
ASSERT_STREQ_LEN(written, buff, "-1.6");
- written = __llvm_libc::sprintf(buff, "%.1f", -1.375);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1f", -1.375);
ASSERT_STREQ_LEN(written, buff, "-1.3");
- written = __llvm_libc::sprintf(buff, "%.1f", -1.875);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1f", -1.875);
ASSERT_STREQ_LEN(written, buff, "-1.8");
}
if (ForceRoundingMode r(RoundingMode::Downward); r.success) {
- written = __llvm_libc::sprintf(buff, "%.1f", 1.75);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1f", 1.75);
ASSERT_STREQ_LEN(written, buff, "1.7");
- written = __llvm_libc::sprintf(buff, "%.1f", 1.25);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1f", 1.25);
ASSERT_STREQ_LEN(written, buff, "1.2");
- written = __llvm_libc::sprintf(buff, "%.1f", 1.125);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1f", 1.125);
ASSERT_STREQ_LEN(written, buff, "1.1");
- written = __llvm_libc::sprintf(buff, "%.1f", 1.625);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1f", 1.625);
ASSERT_STREQ_LEN(written, buff, "1.6");
- written = __llvm_libc::sprintf(buff, "%.1f", 1.375);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1f", 1.375);
ASSERT_STREQ_LEN(written, buff, "1.3");
- written = __llvm_libc::sprintf(buff, "%.1f", 1.875);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1f", 1.875);
ASSERT_STREQ_LEN(written, buff, "1.8");
- written = __llvm_libc::sprintf(buff, "%.1f", -1.75);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1f", -1.75);
ASSERT_STREQ_LEN(written, buff, "-1.8");
- written = __llvm_libc::sprintf(buff, "%.1f", -1.25);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1f", -1.25);
ASSERT_STREQ_LEN(written, buff, "-1.3");
- written = __llvm_libc::sprintf(buff, "%.1f", -1.125);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1f", -1.125);
ASSERT_STREQ_LEN(written, buff, "-1.2");
- written = __llvm_libc::sprintf(buff, "%.1f", -1.625);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1f", -1.625);
ASSERT_STREQ_LEN(written, buff, "-1.7");
- written = __llvm_libc::sprintf(buff, "%.1f", -1.375);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1f", -1.375);
ASSERT_STREQ_LEN(written, buff, "-1.4");
- written = __llvm_libc::sprintf(buff, "%.1f", -1.875);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1f", -1.875);
ASSERT_STREQ_LEN(written, buff, "-1.9");
}
if (ForceRoundingMode r(RoundingMode::TowardZero); r.success) {
- written = __llvm_libc::sprintf(buff, "%.1f", 1.75);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1f", 1.75);
ASSERT_STREQ_LEN(written, buff, "1.7");
- written = __llvm_libc::sprintf(buff, "%.1f", 1.25);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1f", 1.25);
ASSERT_STREQ_LEN(written, buff, "1.2");
- written = __llvm_libc::sprintf(buff, "%.1f", 1.125);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1f", 1.125);
ASSERT_STREQ_LEN(written, buff, "1.1");
- written = __llvm_libc::sprintf(buff, "%.1f", 1.625);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1f", 1.625);
ASSERT_STREQ_LEN(written, buff, "1.6");
- written = __llvm_libc::sprintf(buff, "%.1f", 1.375);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1f", 1.375);
ASSERT_STREQ_LEN(written, buff, "1.3");
- written = __llvm_libc::sprintf(buff, "%.1f", 1.875);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1f", 1.875);
ASSERT_STREQ_LEN(written, buff, "1.8");
- written = __llvm_libc::sprintf(buff, "%.1f", -1.75);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1f", -1.75);
ASSERT_STREQ_LEN(written, buff, "-1.7");
- written = __llvm_libc::sprintf(buff, "%.1f", -1.25);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1f", -1.25);
ASSERT_STREQ_LEN(written, buff, "-1.2");
- written = __llvm_libc::sprintf(buff, "%.1f", -1.125);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1f", -1.125);
ASSERT_STREQ_LEN(written, buff, "-1.1");
- written = __llvm_libc::sprintf(buff, "%.1f", -1.625);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1f", -1.625);
ASSERT_STREQ_LEN(written, buff, "-1.6");
- written = __llvm_libc::sprintf(buff, "%.1f", -1.375);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1f", -1.375);
ASSERT_STREQ_LEN(written, buff, "-1.3");
- written = __llvm_libc::sprintf(buff, "%.1f", -1.875);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1f", -1.875);
ASSERT_STREQ_LEN(written, buff, "-1.8");
}
// Flag Tests.
- written = __llvm_libc::sprintf(buff, "%+f", 1.0);
+ written = LIBC_NAMESPACE::sprintf(buff, "%+f", 1.0);
ASSERT_STREQ_LEN(written, buff, "+1.000000");
- written = __llvm_libc::sprintf(buff, "%+f", -1.0);
+ written = LIBC_NAMESPACE::sprintf(buff, "%+f", -1.0);
ASSERT_STREQ_LEN(written, buff, "-1.000000");
- written = __llvm_libc::sprintf(buff, "% f", 1.0);
+ written = LIBC_NAMESPACE::sprintf(buff, "% f", 1.0);
ASSERT_STREQ_LEN(written, buff, " 1.000000");
- written = __llvm_libc::sprintf(buff, "% f", -1.0);
+ written = LIBC_NAMESPACE::sprintf(buff, "% f", -1.0);
ASSERT_STREQ_LEN(written, buff, "-1.000000");
- written = __llvm_libc::sprintf(buff, "%-10f", 1.5);
+ written = LIBC_NAMESPACE::sprintf(buff, "%-10f", 1.5);
ASSERT_STREQ_LEN(written, buff, "1.500000 ");
- written = __llvm_libc::sprintf(buff, "%#.f", 1.0);
+ written = LIBC_NAMESPACE::sprintf(buff, "%#.f", 1.0);
ASSERT_STREQ_LEN(written, buff, "1.");
- written = __llvm_libc::sprintf(buff, "%#.0f", 1.5);
+ written = LIBC_NAMESPACE::sprintf(buff, "%#.0f", 1.5);
ASSERT_STREQ_LEN(written, buff, "2.");
- written = __llvm_libc::sprintf(buff, "%010f", 1.5);
+ written = LIBC_NAMESPACE::sprintf(buff, "%010f", 1.5);
ASSERT_STREQ_LEN(written, buff, "001.500000");
- written = __llvm_libc::sprintf(buff, "%010f", -1.5);
+ written = LIBC_NAMESPACE::sprintf(buff, "%010f", -1.5);
ASSERT_STREQ_LEN(written, buff, "-01.500000");
- written = __llvm_libc::sprintf(buff, "%+- #0f", 0.0);
+ written = LIBC_NAMESPACE::sprintf(buff, "%+- #0f", 0.0);
ASSERT_STREQ_LEN(written, buff, "+0.000000");
// Combined Tests.
- written = __llvm_libc::sprintf(buff, "%10.2f", 9.99);
+ written = LIBC_NAMESPACE::sprintf(buff, "%10.2f", 9.99);
ASSERT_STREQ_LEN(written, buff, " 9.99");
- written = __llvm_libc::sprintf(buff, "%5.1f", 9.99);
+ written = LIBC_NAMESPACE::sprintf(buff, "%5.1f", 9.99);
ASSERT_STREQ_LEN(written, buff, " 10.0");
- written = __llvm_libc::sprintf(buff, "%-10.2f", 9.99);
+ written = LIBC_NAMESPACE::sprintf(buff, "%-10.2f", 9.99);
ASSERT_STREQ_LEN(written, buff, "9.99 ");
- written = __llvm_libc::sprintf(buff, "%-5.1f", 9.99);
+ written = LIBC_NAMESPACE::sprintf(buff, "%-5.1f", 9.99);
ASSERT_STREQ_LEN(written, buff, "10.0 ");
- written = __llvm_libc::sprintf(buff, "%-5.1f", 1.0e-50);
+ written = LIBC_NAMESPACE::sprintf(buff, "%-5.1f", 1.0e-50);
ASSERT_STREQ_LEN(written, buff, "0.0 ");
- written = __llvm_libc::sprintf(buff, "%30f", 1234567890123456789.0);
+ written = LIBC_NAMESPACE::sprintf(buff, "%30f", 1234567890123456789.0);
ASSERT_STREQ_LEN(written, buff, " 1234567890123456768.000000");
- written = __llvm_libc::sprintf(buff, "%-30f", 1234567890123456789.0);
+ written = LIBC_NAMESPACE::sprintf(buff, "%-30f", 1234567890123456789.0);
ASSERT_STREQ_LEN(written, buff, "1234567890123456768.000000 ");
- written = __llvm_libc::sprintf(buff, "%20.2f", 9999999999999.99);
+ written = LIBC_NAMESPACE::sprintf(buff, "%20.2f", 9999999999999.99);
ASSERT_STREQ_LEN(written, buff, " 9999999999999.99");
- written = __llvm_libc::sprintf(buff, "%20.1f", 9999999999999.99);
+ written = LIBC_NAMESPACE::sprintf(buff, "%20.1f", 9999999999999.99);
ASSERT_STREQ_LEN(written, buff, " 10000000000000.0");
- written = __llvm_libc::sprintf(buff, "%12.3f %-12.3f", 0.1, 256.0);
+ written = LIBC_NAMESPACE::sprintf(buff, "%12.3f %-12.3f", 0.1, 256.0);
ASSERT_STREQ_LEN(written, buff, " 0.100 256.000 ");
- written = __llvm_libc::sprintf(buff, "%+-#12.3f % 012.3f", 0.1256, 1256.0);
+ written = LIBC_NAMESPACE::sprintf(buff, "%+-#12.3f % 012.3f", 0.1256, 1256.0);
ASSERT_STREQ_LEN(written, buff, "+0.126 0001256.000");
}
TEST_F(LlvmLibcSPrintfTest, FloatExponentConv) {
ForceRoundingMode r(RoundingMode::Nearest);
- double inf = __llvm_libc::fputil::FPBits<double>::inf().get_val();
- double nan = __llvm_libc::fputil::FPBits<double>::build_nan(1);
+ double inf = LIBC_NAMESPACE::fputil::FPBits<double>::inf().get_val();
+ double nan = LIBC_NAMESPACE::fputil::FPBits<double>::build_nan(1);
- written = __llvm_libc::sprintf(buff, "%e", 1.0);
+ written = LIBC_NAMESPACE::sprintf(buff, "%e", 1.0);
ASSERT_STREQ_LEN(written, buff, "1.000000e+00");
- written = __llvm_libc::sprintf(buff, "%E", -1.0);
+ written = LIBC_NAMESPACE::sprintf(buff, "%E", -1.0);
ASSERT_STREQ_LEN(written, buff, "-1.000000E+00");
- written = __llvm_libc::sprintf(buff, "%e", -1.234567);
+ written = LIBC_NAMESPACE::sprintf(buff, "%e", -1.234567);
ASSERT_STREQ_LEN(written, buff, "-1.234567e+00");
- written = __llvm_libc::sprintf(buff, "%e", 0.0);
+ written = LIBC_NAMESPACE::sprintf(buff, "%e", 0.0);
ASSERT_STREQ_LEN(written, buff, "0.000000e+00");
- written = __llvm_libc::sprintf(buff, "%e", 1.5);
+ written = LIBC_NAMESPACE::sprintf(buff, "%e", 1.5);
ASSERT_STREQ_LEN(written, buff, "1.500000e+00");
- written = __llvm_libc::sprintf(buff, "%e", 1e300);
+ written = LIBC_NAMESPACE::sprintf(buff, "%e", 1e300);
ASSERT_STREQ_LEN(written, buff, "1.000000e+300");
- written = __llvm_libc::sprintf(buff, "%e", 0.1);
+ written = LIBC_NAMESPACE::sprintf(buff, "%e", 0.1);
ASSERT_STREQ_LEN(written, buff, "1.000000e-01");
- written = __llvm_libc::sprintf(buff, "%e", 0.001);
+ written = LIBC_NAMESPACE::sprintf(buff, "%e", 0.001);
ASSERT_STREQ_LEN(written, buff, "1.000000e-03");
- written = __llvm_libc::sprintf(buff, "%e", 0.00001);
+ written = LIBC_NAMESPACE::sprintf(buff, "%e", 0.00001);
ASSERT_STREQ_LEN(written, buff, "1.000000e-05");
- written = __llvm_libc::sprintf(buff, "%e", 0.0000001);
+ written = LIBC_NAMESPACE::sprintf(buff, "%e", 0.0000001);
ASSERT_STREQ_LEN(written, buff, "1.000000e-07");
- written = __llvm_libc::sprintf(buff, "%e", 0.000000001);
+ written = LIBC_NAMESPACE::sprintf(buff, "%e", 0.000000001);
ASSERT_STREQ_LEN(written, buff, "1.000000e-09");
- written = __llvm_libc::sprintf(buff, "%e", 1.0e-20);
+ written = LIBC_NAMESPACE::sprintf(buff, "%e", 1.0e-20);
ASSERT_STREQ_LEN(written, buff, "1.000000e-20");
- written = __llvm_libc::sprintf(buff, "%e", 1234567890123456789.0);
+ written = LIBC_NAMESPACE::sprintf(buff, "%e", 1234567890123456789.0);
ASSERT_STREQ_LEN(written, buff, "1.234568e+18");
- written = __llvm_libc::sprintf(buff, "%e", 9999999000000.00);
+ written = LIBC_NAMESPACE::sprintf(buff, "%e", 9999999000000.00);
ASSERT_STREQ_LEN(written, buff, "9.999999e+12");
// Simple Subnormal Tests.
- written = __llvm_libc::sprintf(buff, "%e", 0x1.0p-1027);
+ written = LIBC_NAMESPACE::sprintf(buff, "%e", 0x1.0p-1027);
ASSERT_STREQ_LEN(written, buff, "6.953356e-310");
- written = __llvm_libc::sprintf(buff, "%e", 0x1.0p-1074);
+ written = LIBC_NAMESPACE::sprintf(buff, "%e", 0x1.0p-1074);
ASSERT_STREQ_LEN(written, buff, "4.940656e-324");
// Inf/Nan Tests.
- written = __llvm_libc::sprintf(buff, "%e", inf);
+ written = LIBC_NAMESPACE::sprintf(buff, "%e", inf);
ASSERT_STREQ_LEN(written, buff, "inf");
- written = __llvm_libc::sprintf(buff, "%E", -inf);
+ written = LIBC_NAMESPACE::sprintf(buff, "%E", -inf);
ASSERT_STREQ_LEN(written, buff, "-INF");
- written = __llvm_libc::sprintf(buff, "%e", nan);
+ written = LIBC_NAMESPACE::sprintf(buff, "%e", nan);
ASSERT_STREQ_LEN(written, buff, "nan");
- written = __llvm_libc::sprintf(buff, "%E", -nan);
+ written = LIBC_NAMESPACE::sprintf(buff, "%E", -nan);
ASSERT_STREQ_LEN(written, buff, "-NAN");
// Length Modifier Tests.
#if defined(SPECIAL_X86_LONG_DOUBLE)
- written = __llvm_libc::sprintf(buff, "%.9Le", 1000000000500000000.1L);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.9Le", 1000000000500000000.1L);
ASSERT_STREQ_LEN(written, buff, "1.000000001e+18");
- written = __llvm_libc::sprintf(buff, "%.9Le", 1000000000500000000.0L);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.9Le", 1000000000500000000.0L);
ASSERT_STREQ_LEN(written, buff, "1.000000000e+18");
#endif
// TODO: Fix long doubles (needs bigger table or alternate algorithm.)
// Currently the table values are generated, which is very slow.
/*
- written = __llvm_libc::sprintf(buff, "%Lf", 1e100L);
+ written = LIBC_NAMESPACE::sprintf(buff, "%Lf", 1e100L);
ASSERT_STREQ_LEN(written, buff,
"99999999999999999996693535322073426194986990198284960792713"
"91541752018669482644324418977840117055488.000000");
- written = __llvm_libc::sprintf(buff, "%Lf", 1.0L);
+ written = LIBC_NAMESPACE::sprintf(buff, "%Lf", 1.0L);
ASSERT_STREQ_LEN(written, buff, "1.000000");
char big_buff[10000];
- written = __llvm_libc::sprintf(big_buff, "%Lf", 1e1000L);
+ written = LIBC_NAMESPACE::sprintf(big_buff, "%Lf", 1e1000L);
ASSERT_STREQ_LEN(
written, big_buff,
"999999999999999999973107317669562353428234857594552594925899449376328728"
@@ -1782,7 +1784,7 @@ TEST_F(LlvmLibcSPrintfTest, FloatExponentConv) {
"2431457550909271560663602154947063707982236377366647567795879936."
"000000");
- written = __llvm_libc::sprintf(big_buff, "%Lf", 1e4900L);
+ written = LIBC_NAMESPACE::sprintf(big_buff, "%Lf", 1e4900L);
ASSERT_STREQ_LEN(
written, big_buff,
"100000000000000000002708312230690349833224052504078834346502930111959028"
@@ -1856,7 +1858,7 @@ TEST_F(LlvmLibcSPrintfTest, FloatExponentConv) {
"24896.000000");
*/
/*
- written = __llvm_libc::sprintf(buff, "%La", 0.1L);
+ written = LIBC_NAMESPACE::sprintf(buff, "%La", 0.1L);
#if defined(SPECIAL_X86_LONG_DOUBLE)
ASSERT_STREQ_LEN(written, buff, "0xc.ccccccccccccccdp-7");
#elif defined(LONG_DOUBLE_IS_DOUBLE)
@@ -1865,7 +1867,7 @@ TEST_F(LlvmLibcSPrintfTest, FloatExponentConv) {
ASSERT_STREQ_LEN(written, buff, "0x1.999999999999999999999999999ap-4");
#endif
- written = __llvm_libc::sprintf(buff, "%La", 1.0e1000L);
+ written = LIBC_NAMESPACE::sprintf(buff, "%La", 1.0e1000L);
#if defined(SPECIAL_X86_LONG_DOUBLE)
ASSERT_STREQ_LEN(written, buff, "0xf.38db1f9dd3dac05p+3318");
#elif defined(LONG_DOUBLE_IS_DOUBLE)
@@ -1874,7 +1876,7 @@ TEST_F(LlvmLibcSPrintfTest, FloatExponentConv) {
ASSERT_STREQ_LEN(written, buff, "0x1.e71b63f3ba7b580af1a52d2a7379p+3321");
#endif
- written = __llvm_libc::sprintf(buff, "%La", 1.0e-1000L);
+ written = LIBC_NAMESPACE::sprintf(buff, "%La", 1.0e-1000L);
#if defined(SPECIAL_X86_LONG_DOUBLE)
ASSERT_STREQ_LEN(written, buff, "0x8.68a9188a89e1467p-3325");
#elif defined(LONG_DOUBLE_IS_DOUBLE)
@@ -1886,81 +1888,81 @@ TEST_F(LlvmLibcSPrintfTest, FloatExponentConv) {
// Min Width Tests.
- written = __llvm_libc::sprintf(buff, "%15e", 1.0);
+ written = LIBC_NAMESPACE::sprintf(buff, "%15e", 1.0);
ASSERT_STREQ_LEN(written, buff, " 1.000000e+00");
- written = __llvm_libc::sprintf(buff, "%15e", -1.0);
+ written = LIBC_NAMESPACE::sprintf(buff, "%15e", -1.0);
ASSERT_STREQ_LEN(written, buff, " -1.000000e+00");
- written = __llvm_libc::sprintf(buff, "%15e", 1.0e5);
+ written = LIBC_NAMESPACE::sprintf(buff, "%15e", 1.0e5);
ASSERT_STREQ_LEN(written, buff, " 1.000000e+05");
- written = __llvm_libc::sprintf(buff, "%15e", -1.0e5);
+ written = LIBC_NAMESPACE::sprintf(buff, "%15e", -1.0e5);
ASSERT_STREQ_LEN(written, buff, " -1.000000e+05");
- written = __llvm_libc::sprintf(buff, "%10e", 1.0e-5);
+ written = LIBC_NAMESPACE::sprintf(buff, "%10e", 1.0e-5);
ASSERT_STREQ_LEN(written, buff, "1.000000e-05");
// Precision Tests.
- written = __llvm_libc::sprintf(buff, "%.1e", 1.0);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1e", 1.0);
ASSERT_STREQ_LEN(written, buff, "1.0e+00");
- written = __llvm_libc::sprintf(buff, "%.1e", 0.0);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1e", 0.0);
ASSERT_STREQ_LEN(written, buff, "0.0e+00");
- written = __llvm_libc::sprintf(buff, "%.0e", 0.0);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.0e", 0.0);
ASSERT_STREQ_LEN(written, buff, "0e+00");
- written = __llvm_libc::sprintf(buff, "%.1e", 0.1);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1e", 0.1);
ASSERT_STREQ_LEN(written, buff, "1.0e-01");
- written = __llvm_libc::sprintf(buff, "%.1e", 1.09);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1e", 1.09);
ASSERT_STREQ_LEN(written, buff, "1.1e+00");
- written = __llvm_libc::sprintf(buff, "%.1e", 1.04);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1e", 1.04);
ASSERT_STREQ_LEN(written, buff, "1.0e+00");
- written = __llvm_libc::sprintf(buff, "%.1e", 1.19);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1e", 1.19);
ASSERT_STREQ_LEN(written, buff, "1.2e+00");
- written = __llvm_libc::sprintf(buff, "%.1e", 1.99);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1e", 1.99);
ASSERT_STREQ_LEN(written, buff, "2.0e+00");
- written = __llvm_libc::sprintf(buff, "%.1e", 9.99);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1e", 9.99);
ASSERT_STREQ_LEN(written, buff, "1.0e+01");
- written = __llvm_libc::sprintf(buff, "%.2e", 99.9);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.2e", 99.9);
ASSERT_STREQ_LEN(written, buff, "9.99e+01");
- written = __llvm_libc::sprintf(buff, "%.1e", 99.9);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1e", 99.9);
ASSERT_STREQ_LEN(written, buff, "1.0e+02");
- written = __llvm_libc::sprintf(buff, "%.5e", 1.25);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.5e", 1.25);
ASSERT_STREQ_LEN(written, buff, "1.25000e+00");
- written = __llvm_libc::sprintf(buff, "%.0e", 1.25);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.0e", 1.25);
ASSERT_STREQ_LEN(written, buff, "1e+00");
- written = __llvm_libc::sprintf(buff, "%.0e", 1.75);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.0e", 1.75);
ASSERT_STREQ_LEN(written, buff, "2e+00");
- written = __llvm_libc::sprintf(buff, "%.20e", 1.234e-10);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.20e", 1.234e-10);
ASSERT_STREQ_LEN(written, buff, "1.23400000000000008140e-10");
- written = __llvm_libc::sprintf(buff, "%.2e", -9.99);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.2e", -9.99);
ASSERT_STREQ_LEN(written, buff, "-9.99e+00");
- written = __llvm_libc::sprintf(buff, "%.1e", -9.99);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1e", -9.99);
ASSERT_STREQ_LEN(written, buff, "-1.0e+01");
- written = __llvm_libc::sprintf(buff, "%.5e", 0.0);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.5e", 0.0);
ASSERT_STREQ_LEN(written, buff, "0.00000e+00");
- written = __llvm_libc::sprintf(buff, "%.5e", 1.008);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.5e", 1.008);
ASSERT_STREQ_LEN(written, buff, "1.00800e+00");
- written = __llvm_libc::sprintf(buff, "%.5e", 1.008e3);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.5e", 1.008e3);
ASSERT_STREQ_LEN(written, buff, "1.00800e+03");
// These tests also focus on rounding. Almost all of them have a 5 right after
@@ -1971,40 +1973,40 @@ TEST_F(LlvmLibcSPrintfTest, FloatExponentConv) {
// even (if the 5 is the last non-zero digit). Additionally, the algorithm for
// checking if a number is all 0s after the decimal point may not work since
// the decimal point moves in this representation.
- written = __llvm_libc::sprintf(buff, "%.0e", 2.5812229360061737E+200);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.0e", 2.5812229360061737E+200);
ASSERT_STREQ_LEN(written, buff, "3e+200");
- written = __llvm_libc::sprintf(buff, "%.1e", 9.059E+200);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1e", 9.059E+200);
ASSERT_STREQ_LEN(written, buff, "9.1e+200");
- written = __llvm_libc::sprintf(buff, "%.0e", 9.059E+200);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.0e", 9.059E+200);
ASSERT_STREQ_LEN(written, buff, "9e+200");
- written = __llvm_libc::sprintf(buff, "%.166e", 1.131959884853339E-72);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.166e", 1.131959884853339E-72);
ASSERT_STREQ_LEN(written, buff,
"1."
"13195988485333904593863991136097397258531639976739227369782"
"68612419376648241056393424414314951197624317440549121097287"
"069853416091591569170304865110665559768676757812e-72");
- written = __llvm_libc::sprintf(buff, "%.0e", 9.5);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.0e", 9.5);
ASSERT_STREQ_LEN(written, buff, "1e+01");
- written = __llvm_libc::sprintf(buff, "%.10e", 1.9999999999890936);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.10e", 1.9999999999890936);
ASSERT_STREQ_LEN(written, buff, "2.0000000000e+00");
- written = __llvm_libc::sprintf(buff, "%.1e", 745362143563.03894);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1e", 745362143563.03894);
ASSERT_STREQ_LEN(written, buff, "7.5e+11");
- written = __llvm_libc::sprintf(buff, "%.0e", 45181042688.0);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.0e", 45181042688.0);
ASSERT_STREQ_LEN(written, buff, "5e+10");
- written = __llvm_libc::sprintf(buff, "%.35e", 1.3752441369139243);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.35e", 1.3752441369139243);
ASSERT_STREQ_LEN(written, buff, "1.37524413691392433101157166674965993e+00");
// Subnormal Precision Tests
- written = __llvm_libc::sprintf(buff, "%.310e", 0x1.0p-1022);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.310e", 0x1.0p-1022);
ASSERT_STREQ_LEN(
written, buff,
"2."
@@ -2014,10 +2016,10 @@ TEST_F(LlvmLibcSPrintfTest, FloatExponentConv) {
"375250806650616658158948720491179968591639648500635908770118304874799780"
"8877537499494515804516e-308");
- written = __llvm_libc::sprintf(buff, "%.30e", 0x1.0p-1022);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.30e", 0x1.0p-1022);
ASSERT_STREQ_LEN(written, buff, "2.225073858507201383090232717332e-308");
- written = __llvm_libc::sprintf(buff, "%.310e", 0x1.0p-1023);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.310e", 0x1.0p-1023);
ASSERT_STREQ_LEN(
written, buff,
"1."
@@ -2027,32 +2029,32 @@ TEST_F(LlvmLibcSPrintfTest, FloatExponentConv) {
"187625403325308329079474360245589984295819824250317954385059152437399890"
"4438768749747257902258e-308");
- written = __llvm_libc::sprintf(buff, "%.6e", 9.99999e-310);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.6e", 9.99999e-310);
ASSERT_STREQ_LEN(written, buff, "9.999990e-310");
- written = __llvm_libc::sprintf(buff, "%.5e", 9.99999e-310);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.5e", 9.99999e-310);
ASSERT_STREQ_LEN(written, buff, "9.99999e-310");
- written = __llvm_libc::sprintf(buff, "%.4e", 9.99999e-310);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.4e", 9.99999e-310);
ASSERT_STREQ_LEN(written, buff, "1.0000e-309");
- written = __llvm_libc::sprintf(buff, "%.3e", 9.99999e-310);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.3e", 9.99999e-310);
ASSERT_STREQ_LEN(written, buff, "1.000e-309");
- written = __llvm_libc::sprintf(buff, "%.2e", 9.99999e-310);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.2e", 9.99999e-310);
ASSERT_STREQ_LEN(written, buff, "1.00e-309");
- written = __llvm_libc::sprintf(buff, "%.1e", 9.99999e-310);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1e", 9.99999e-310);
ASSERT_STREQ_LEN(written, buff, "1.0e-309");
- written = __llvm_libc::sprintf(buff, "%.0e", 9.99999e-310);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.0e", 9.99999e-310);
ASSERT_STREQ_LEN(written, buff, "1e-309");
- written = __llvm_libc::sprintf(buff, "%.10e", 0x1.0p-1074);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.10e", 0x1.0p-1074);
ASSERT_STREQ_LEN(written, buff, "4.9406564584e-324");
/*
- written = __llvm_libc::sprintf(buff, "%.1La", 0.1L);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1La", 0.1L);
#if defined(SPECIAL_X86_LONG_DOUBLE)
ASSERT_STREQ_LEN(written, buff, "0xc.dp-7");
#elif defined(LONG_DOUBLE_IS_DOUBLE)
@@ -2061,8 +2063,8 @@ TEST_F(LlvmLibcSPrintfTest, FloatExponentConv) {
ASSERT_STREQ_LEN(written, buff, "0x1.ap-4");
#endif
- written = __llvm_libc::sprintf(buff, "%.1La", 0xf.fffffffffffffffp16380L);
- #if defined(SPECIAL_X86_LONG_DOUBLE)
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1La",
+ 0xf.fffffffffffffffp16380L); #if defined(SPECIAL_X86_LONG_DOUBLE)
ASSERT_STREQ_LEN(written, buff, "0x1.0p+16384");
#elif defined(LONG_DOUBLE_IS_DOUBLE)
ASSERT_STREQ_LEN(written, buff, "inf");
@@ -2074,322 +2076,322 @@ TEST_F(LlvmLibcSPrintfTest, FloatExponentConv) {
// Rounding Mode Tests.
if (ForceRoundingMode r(RoundingMode::Nearest); r.success) {
- written = __llvm_libc::sprintf(buff, "%.1e", 1.75);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1e", 1.75);
ASSERT_STREQ_LEN(written, buff, "1.8e+00");
- written = __llvm_libc::sprintf(buff, "%.1e", 1.25);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1e", 1.25);
ASSERT_STREQ_LEN(written, buff, "1.2e+00");
- written = __llvm_libc::sprintf(buff, "%.1e", 1.125);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1e", 1.125);
ASSERT_STREQ_LEN(written, buff, "1.1e+00");
- written = __llvm_libc::sprintf(buff, "%.1e", 1.625);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1e", 1.625);
ASSERT_STREQ_LEN(written, buff, "1.6e+00");
- written = __llvm_libc::sprintf(buff, "%.1e", 1.375);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1e", 1.375);
ASSERT_STREQ_LEN(written, buff, "1.4e+00");
- written = __llvm_libc::sprintf(buff, "%.1e", 1.875);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1e", 1.875);
ASSERT_STREQ_LEN(written, buff, "1.9e+00");
- written = __llvm_libc::sprintf(buff, "%.1e", -1.75);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1e", -1.75);
ASSERT_STREQ_LEN(written, buff, "-1.8e+00");
- written = __llvm_libc::sprintf(buff, "%.1e", -1.25);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1e", -1.25);
ASSERT_STREQ_LEN(written, buff, "-1.2e+00");
- written = __llvm_libc::sprintf(buff, "%.1e", -1.125);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1e", -1.125);
ASSERT_STREQ_LEN(written, buff, "-1.1e+00");
- written = __llvm_libc::sprintf(buff, "%.1e", -1.625);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1e", -1.625);
ASSERT_STREQ_LEN(written, buff, "-1.6e+00");
- written = __llvm_libc::sprintf(buff, "%.1e", -1.375);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1e", -1.375);
ASSERT_STREQ_LEN(written, buff, "-1.4e+00");
- written = __llvm_libc::sprintf(buff, "%.1e", -1.875);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1e", -1.875);
ASSERT_STREQ_LEN(written, buff, "-1.9e+00");
}
if (ForceRoundingMode r(RoundingMode::Upward); r.success) {
- written = __llvm_libc::sprintf(buff, "%.1e", 1.75);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1e", 1.75);
ASSERT_STREQ_LEN(written, buff, "1.8e+00");
- written = __llvm_libc::sprintf(buff, "%.1e", 1.25);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1e", 1.25);
ASSERT_STREQ_LEN(written, buff, "1.3e+00");
- written = __llvm_libc::sprintf(buff, "%.1e", 1.125);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1e", 1.125);
ASSERT_STREQ_LEN(written, buff, "1.2e+00");
- written = __llvm_libc::sprintf(buff, "%.1e", 1.625);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1e", 1.625);
ASSERT_STREQ_LEN(written, buff, "1.7e+00");
- written = __llvm_libc::sprintf(buff, "%.1e", 1.375);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1e", 1.375);
ASSERT_STREQ_LEN(written, buff, "1.4e+00");
- written = __llvm_libc::sprintf(buff, "%.1e", 1.875);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1e", 1.875);
ASSERT_STREQ_LEN(written, buff, "1.9e+00");
- written = __llvm_libc::sprintf(buff, "%.1e", -1.75);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1e", -1.75);
ASSERT_STREQ_LEN(written, buff, "-1.7e+00");
- written = __llvm_libc::sprintf(buff, "%.1e", -1.25);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1e", -1.25);
ASSERT_STREQ_LEN(written, buff, "-1.2e+00");
- written = __llvm_libc::sprintf(buff, "%.1e", -1.125);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1e", -1.125);
ASSERT_STREQ_LEN(written, buff, "-1.1e+00");
- written = __llvm_libc::sprintf(buff, "%.1e", -1.625);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1e", -1.625);
ASSERT_STREQ_LEN(written, buff, "-1.6e+00");
- written = __llvm_libc::sprintf(buff, "%.1e", -1.375);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1e", -1.375);
ASSERT_STREQ_LEN(written, buff, "-1.3e+00");
- written = __llvm_libc::sprintf(buff, "%.1e", -1.875);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1e", -1.875);
ASSERT_STREQ_LEN(written, buff, "-1.8e+00");
}
if (ForceRoundingMode r(RoundingMode::Downward); r.success) {
- written = __llvm_libc::sprintf(buff, "%.1e", 1.75);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1e", 1.75);
ASSERT_STREQ_LEN(written, buff, "1.7e+00");
- written = __llvm_libc::sprintf(buff, "%.1e", 1.25);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1e", 1.25);
ASSERT_STREQ_LEN(written, buff, "1.2e+00");
- written = __llvm_libc::sprintf(buff, "%.1e", 1.125);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1e", 1.125);
ASSERT_STREQ_LEN(written, buff, "1.1e+00");
- written = __llvm_libc::sprintf(buff, "%.1e", 1.625);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1e", 1.625);
ASSERT_STREQ_LEN(written, buff, "1.6e+00");
- written = __llvm_libc::sprintf(buff, "%.1e", 1.375);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1e", 1.375);
ASSERT_STREQ_LEN(written, buff, "1.3e+00");
- written = __llvm_libc::sprintf(buff, "%.1e", 1.875);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1e", 1.875);
ASSERT_STREQ_LEN(written, buff, "1.8e+00");
- written = __llvm_libc::sprintf(buff, "%.1e", -1.75);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1e", -1.75);
ASSERT_STREQ_LEN(written, buff, "-1.8e+00");
- written = __llvm_libc::sprintf(buff, "%.1e", -1.25);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1e", -1.25);
ASSERT_STREQ_LEN(written, buff, "-1.3e+00");
- written = __llvm_libc::sprintf(buff, "%.1e", -1.125);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1e", -1.125);
ASSERT_STREQ_LEN(written, buff, "-1.2e+00");
- written = __llvm_libc::sprintf(buff, "%.1e", -1.625);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1e", -1.625);
ASSERT_STREQ_LEN(written, buff, "-1.7e+00");
- written = __llvm_libc::sprintf(buff, "%.1e", -1.375);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1e", -1.375);
ASSERT_STREQ_LEN(written, buff, "-1.4e+00");
- written = __llvm_libc::sprintf(buff, "%.1e", -1.875);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1e", -1.875);
ASSERT_STREQ_LEN(written, buff, "-1.9e+00");
}
if (ForceRoundingMode r(RoundingMode::TowardZero); r.success) {
- written = __llvm_libc::sprintf(buff, "%.1e", 1.75);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1e", 1.75);
ASSERT_STREQ_LEN(written, buff, "1.7e+00");
- written = __llvm_libc::sprintf(buff, "%.1e", 1.25);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1e", 1.25);
ASSERT_STREQ_LEN(written, buff, "1.2e+00");
- written = __llvm_libc::sprintf(buff, "%.1e", 1.125);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1e", 1.125);
ASSERT_STREQ_LEN(written, buff, "1.1e+00");
- written = __llvm_libc::sprintf(buff, "%.1e", 1.625);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1e", 1.625);
ASSERT_STREQ_LEN(written, buff, "1.6e+00");
- written = __llvm_libc::sprintf(buff, "%.1e", 1.375);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1e", 1.375);
ASSERT_STREQ_LEN(written, buff, "1.3e+00");
- written = __llvm_libc::sprintf(buff, "%.1e", 1.875);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1e", 1.875);
ASSERT_STREQ_LEN(written, buff, "1.8e+00");
- written = __llvm_libc::sprintf(buff, "%.1e", -1.75);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1e", -1.75);
ASSERT_STREQ_LEN(written, buff, "-1.7e+00");
- written = __llvm_libc::sprintf(buff, "%.1e", -1.25);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1e", -1.25);
ASSERT_STREQ_LEN(written, buff, "-1.2e+00");
- written = __llvm_libc::sprintf(buff, "%.1e", -1.125);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1e", -1.125);
ASSERT_STREQ_LEN(written, buff, "-1.1e+00");
- written = __llvm_libc::sprintf(buff, "%.1e", -1.625);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1e", -1.625);
ASSERT_STREQ_LEN(written, buff, "-1.6e+00");
- written = __llvm_libc::sprintf(buff, "%.1e", -1.375);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1e", -1.375);
ASSERT_STREQ_LEN(written, buff, "-1.3e+00");
- written = __llvm_libc::sprintf(buff, "%.1e", -1.875);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1e", -1.875);
ASSERT_STREQ_LEN(written, buff, "-1.8e+00");
}
// Flag Tests.
- written = __llvm_libc::sprintf(buff, "%+e", 1.0);
+ written = LIBC_NAMESPACE::sprintf(buff, "%+e", 1.0);
ASSERT_STREQ_LEN(written, buff, "+1.000000e+00");
- written = __llvm_libc::sprintf(buff, "%+e", -1.0);
+ written = LIBC_NAMESPACE::sprintf(buff, "%+e", -1.0);
ASSERT_STREQ_LEN(written, buff, "-1.000000e+00");
- written = __llvm_libc::sprintf(buff, "% e", 1.0);
+ written = LIBC_NAMESPACE::sprintf(buff, "% e", 1.0);
ASSERT_STREQ_LEN(written, buff, " 1.000000e+00");
- written = __llvm_libc::sprintf(buff, "% e", -1.0);
+ written = LIBC_NAMESPACE::sprintf(buff, "% e", -1.0);
ASSERT_STREQ_LEN(written, buff, "-1.000000e+00");
- written = __llvm_libc::sprintf(buff, "%-15e", 1.5);
+ written = LIBC_NAMESPACE::sprintf(buff, "%-15e", 1.5);
ASSERT_STREQ_LEN(written, buff, "1.500000e+00 ");
- written = __llvm_libc::sprintf(buff, "%#.e", 1.0);
+ written = LIBC_NAMESPACE::sprintf(buff, "%#.e", 1.0);
ASSERT_STREQ_LEN(written, buff, "1.e+00");
- written = __llvm_libc::sprintf(buff, "%#.0e", 1.5);
+ written = LIBC_NAMESPACE::sprintf(buff, "%#.0e", 1.5);
ASSERT_STREQ_LEN(written, buff, "2.e+00");
- written = __llvm_libc::sprintf(buff, "%015e", 1.5);
+ written = LIBC_NAMESPACE::sprintf(buff, "%015e", 1.5);
ASSERT_STREQ_LEN(written, buff, "0001.500000e+00");
- written = __llvm_libc::sprintf(buff, "%015e", -1.5);
+ written = LIBC_NAMESPACE::sprintf(buff, "%015e", -1.5);
ASSERT_STREQ_LEN(written, buff, "-001.500000e+00");
- written = __llvm_libc::sprintf(buff, "%+- #0e", 0.0);
+ written = LIBC_NAMESPACE::sprintf(buff, "%+- #0e", 0.0);
ASSERT_STREQ_LEN(written, buff, "+0.000000e+00");
// Combined Tests.
- written = __llvm_libc::sprintf(buff, "%10.2e", 9.99);
+ written = LIBC_NAMESPACE::sprintf(buff, "%10.2e", 9.99);
ASSERT_STREQ_LEN(written, buff, " 9.99e+00");
- written = __llvm_libc::sprintf(buff, "%10.1e", 9.99);
+ written = LIBC_NAMESPACE::sprintf(buff, "%10.1e", 9.99);
ASSERT_STREQ_LEN(written, buff, " 1.0e+01");
- written = __llvm_libc::sprintf(buff, "%10.0e", 9.99);
+ written = LIBC_NAMESPACE::sprintf(buff, "%10.0e", 9.99);
ASSERT_STREQ_LEN(written, buff, " 1e+01");
- written = __llvm_libc::sprintf(buff, "%10.0e", 0.0999);
+ written = LIBC_NAMESPACE::sprintf(buff, "%10.0e", 0.0999);
ASSERT_STREQ_LEN(written, buff, " 1e-01");
- written = __llvm_libc::sprintf(buff, "%-10.2e", 9.99);
+ written = LIBC_NAMESPACE::sprintf(buff, "%-10.2e", 9.99);
ASSERT_STREQ_LEN(written, buff, "9.99e+00 ");
- written = __llvm_libc::sprintf(buff, "%-10.1e", 9.99);
+ written = LIBC_NAMESPACE::sprintf(buff, "%-10.1e", 9.99);
ASSERT_STREQ_LEN(written, buff, "1.0e+01 ");
- written = __llvm_libc::sprintf(buff, "%-10.1e", 1.0e-50);
+ written = LIBC_NAMESPACE::sprintf(buff, "%-10.1e", 1.0e-50);
ASSERT_STREQ_LEN(written, buff, "1.0e-50 ");
- written = __llvm_libc::sprintf(buff, "%30e", 1234567890123456789.0);
+ written = LIBC_NAMESPACE::sprintf(buff, "%30e", 1234567890123456789.0);
ASSERT_STREQ_LEN(written, buff, " 1.234568e+18");
- written = __llvm_libc::sprintf(buff, "%-30e", 1234567890123456789.0);
+ written = LIBC_NAMESPACE::sprintf(buff, "%-30e", 1234567890123456789.0);
ASSERT_STREQ_LEN(written, buff, "1.234568e+18 ");
- written = __llvm_libc::sprintf(buff, "%25.14e", 9999999999999.99);
+ written = LIBC_NAMESPACE::sprintf(buff, "%25.14e", 9999999999999.99);
ASSERT_STREQ_LEN(written, buff, " 9.99999999999999e+12");
- written = __llvm_libc::sprintf(buff, "%25.13e", 9999999999999.99);
+ written = LIBC_NAMESPACE::sprintf(buff, "%25.13e", 9999999999999.99);
ASSERT_STREQ_LEN(written, buff, " 1.0000000000000e+13");
- written = __llvm_libc::sprintf(buff, "%25.12e", 9999999999999.99);
+ written = LIBC_NAMESPACE::sprintf(buff, "%25.12e", 9999999999999.99);
ASSERT_STREQ_LEN(written, buff, " 1.000000000000e+13");
- written = __llvm_libc::sprintf(buff, "%12.3e %-12.3e", 0.1, 256.0);
+ written = LIBC_NAMESPACE::sprintf(buff, "%12.3e %-12.3e", 0.1, 256.0);
ASSERT_STREQ_LEN(written, buff, " 1.000e-01 2.560e+02 ");
- written = __llvm_libc::sprintf(buff, "%+-#12.3e % 012.3e", 0.1256, 1256.0);
+ written = LIBC_NAMESPACE::sprintf(buff, "%+-#12.3e % 012.3e", 0.1256, 1256.0);
ASSERT_STREQ_LEN(written, buff, "+1.256e-01 001.256e+03");
}
TEST_F(LlvmLibcSPrintfTest, FloatAutoConv) {
ForceRoundingMode r(RoundingMode::Nearest);
- double inf = __llvm_libc::fputil::FPBits<double>::inf().get_val();
- double nan = __llvm_libc::fputil::FPBits<double>::build_nan(1);
+ double inf = LIBC_NAMESPACE::fputil::FPBits<double>::inf().get_val();
+ double nan = LIBC_NAMESPACE::fputil::FPBits<double>::build_nan(1);
- written = __llvm_libc::sprintf(buff, "%g", 1.0);
+ written = LIBC_NAMESPACE::sprintf(buff, "%g", 1.0);
ASSERT_STREQ_LEN(written, buff, "1");
- written = __llvm_libc::sprintf(buff, "%G", -1.0);
+ written = LIBC_NAMESPACE::sprintf(buff, "%G", -1.0);
ASSERT_STREQ_LEN(written, buff, "-1");
- written = __llvm_libc::sprintf(buff, "%g", -1.234567);
+ written = LIBC_NAMESPACE::sprintf(buff, "%g", -1.234567);
ASSERT_STREQ_LEN(written, buff, "-1.23457");
- written = __llvm_libc::sprintf(buff, "%g", 0.0);
+ written = LIBC_NAMESPACE::sprintf(buff, "%g", 0.0);
ASSERT_STREQ_LEN(written, buff, "0");
- written = __llvm_libc::sprintf(buff, "%g", -0.0);
+ written = LIBC_NAMESPACE::sprintf(buff, "%g", -0.0);
ASSERT_STREQ_LEN(written, buff, "-0");
- written = __llvm_libc::sprintf(buff, "%g", 1.5);
+ written = LIBC_NAMESPACE::sprintf(buff, "%g", 1.5);
ASSERT_STREQ_LEN(written, buff, "1.5");
- written = __llvm_libc::sprintf(buff, "%g", 1e300);
+ written = LIBC_NAMESPACE::sprintf(buff, "%g", 1e300);
ASSERT_STREQ_LEN(written, buff, "1e+300");
- written = __llvm_libc::sprintf(buff, "%g", 0.1);
+ written = LIBC_NAMESPACE::sprintf(buff, "%g", 0.1);
ASSERT_STREQ_LEN(written, buff, "0.1");
- written = __llvm_libc::sprintf(buff, "%g", 0.001);
+ written = LIBC_NAMESPACE::sprintf(buff, "%g", 0.001);
ASSERT_STREQ_LEN(written, buff, "0.001");
- written = __llvm_libc::sprintf(buff, "%g", 0.00001);
+ written = LIBC_NAMESPACE::sprintf(buff, "%g", 0.00001);
ASSERT_STREQ_LEN(written, buff, "1e-05");
- written = __llvm_libc::sprintf(buff, "%g", 0.0000001);
+ written = LIBC_NAMESPACE::sprintf(buff, "%g", 0.0000001);
ASSERT_STREQ_LEN(written, buff, "1e-07");
- written = __llvm_libc::sprintf(buff, "%g", 0.000000001);
+ written = LIBC_NAMESPACE::sprintf(buff, "%g", 0.000000001);
ASSERT_STREQ_LEN(written, buff, "1e-09");
- written = __llvm_libc::sprintf(buff, "%g", 1.0e-20);
+ written = LIBC_NAMESPACE::sprintf(buff, "%g", 1.0e-20);
ASSERT_STREQ_LEN(written, buff, "1e-20");
- written = __llvm_libc::sprintf(buff, "%g", 1234567890123456789.0);
+ written = LIBC_NAMESPACE::sprintf(buff, "%g", 1234567890123456789.0);
ASSERT_STREQ_LEN(written, buff, "1.23457e+18");
- written = __llvm_libc::sprintf(buff, "%g", 9999990000000.00);
+ written = LIBC_NAMESPACE::sprintf(buff, "%g", 9999990000000.00);
ASSERT_STREQ_LEN(written, buff, "9.99999e+12");
- written = __llvm_libc::sprintf(buff, "%g", 9999999000000.00);
+ written = LIBC_NAMESPACE::sprintf(buff, "%g", 9999999000000.00);
ASSERT_STREQ_LEN(written, buff, "1e+13");
// Simple Subnormal Tests.
- written = __llvm_libc::sprintf(buff, "%g", 0x1.0p-1027);
+ written = LIBC_NAMESPACE::sprintf(buff, "%g", 0x1.0p-1027);
ASSERT_STREQ_LEN(written, buff, "6.95336e-310");
- written = __llvm_libc::sprintf(buff, "%g", 0x1.0p-1074);
+ written = LIBC_NAMESPACE::sprintf(buff, "%g", 0x1.0p-1074);
ASSERT_STREQ_LEN(written, buff, "4.94066e-324");
// Inf/Nan Tests.
- written = __llvm_libc::sprintf(buff, "%g", inf);
+ written = LIBC_NAMESPACE::sprintf(buff, "%g", inf);
ASSERT_STREQ_LEN(written, buff, "inf");
- written = __llvm_libc::sprintf(buff, "%G", -inf);
+ written = LIBC_NAMESPACE::sprintf(buff, "%G", -inf);
ASSERT_STREQ_LEN(written, buff, "-INF");
- written = __llvm_libc::sprintf(buff, "%g", nan);
+ written = LIBC_NAMESPACE::sprintf(buff, "%g", nan);
ASSERT_STREQ_LEN(written, buff, "nan");
- written = __llvm_libc::sprintf(buff, "%G", -nan);
+ written = LIBC_NAMESPACE::sprintf(buff, "%G", -nan);
ASSERT_STREQ_LEN(written, buff, "-NAN");
// Length Modifier Tests.
// TODO: Uncomment the below tests after long double support is added
/*
- written = __llvm_libc::sprintf(buff, "%Lf", 1e100L);
+ written = LIBC_NAMESPACE::sprintf(buff, "%Lf", 1e100L);
ASSERT_STREQ_LEN(written, buff,
"99999999999999999996693535322073426194986990198284960792713"
"91541752018669482644324418977840117055488.000000");
- written = __llvm_libc::sprintf(buff, "%Lf", 1.0L);
+ written = LIBC_NAMESPACE::sprintf(buff, "%Lf", 1.0L);
ASSERT_STREQ_LEN(written, buff, "1.000000");
char big_buff[10000];
- written = __llvm_libc::sprintf(big_buff, "%Lf", 1e1000L);
+ written = LIBC_NAMESPACE::sprintf(big_buff, "%Lf", 1e1000L);
ASSERT_STREQ_LEN(
written, big_buff,
"999999999999999999973107317669562353428234857594552594925899449376328728"
@@ -2408,7 +2410,7 @@ TEST_F(LlvmLibcSPrintfTest, FloatAutoConv) {
"2431457550909271560663602154947063707982236377366647567795879936."
"000000");
- written = __llvm_libc::sprintf(big_buff, "%Lf", 1e4900L);
+ written = LIBC_NAMESPACE::sprintf(big_buff, "%Lf", 1e4900L);
ASSERT_STREQ_LEN(
written, big_buff,
"100000000000000000002708312230690349833224052504078834346502930111959028"
@@ -2482,7 +2484,7 @@ TEST_F(LlvmLibcSPrintfTest, FloatAutoConv) {
"24896.000000");
*/
/*
- written = __llvm_libc::sprintf(buff, "%La", 0.1L);
+ written = LIBC_NAMESPACE::sprintf(buff, "%La", 0.1L);
#if defined(SPECIAL_X86_LONG_DOUBLE)
ASSERT_STREQ_LEN(written, buff, "0xc.ccccccccccccccdp-7");
#elif defined(LONG_DOUBLE_IS_DOUBLE)
@@ -2491,7 +2493,7 @@ TEST_F(LlvmLibcSPrintfTest, FloatAutoConv) {
ASSERT_STREQ_LEN(written, buff, "0x1.999999999999999999999999999ap-4");
#endif
- written = __llvm_libc::sprintf(buff, "%La", 1.0e1000L);
+ written = LIBC_NAMESPACE::sprintf(buff, "%La", 1.0e1000L);
#if defined(SPECIAL_X86_LONG_DOUBLE)
ASSERT_STREQ_LEN(written, buff, "0xf.38db1f9dd3dac05p+3318");
#elif defined(LONG_DOUBLE_IS_DOUBLE)
@@ -2500,7 +2502,7 @@ TEST_F(LlvmLibcSPrintfTest, FloatAutoConv) {
ASSERT_STREQ_LEN(written, buff, "0x1.e71b63f3ba7b580af1a52d2a7379p+3321");
#endif
- written = __llvm_libc::sprintf(buff, "%La", 1.0e-1000L);
+ written = LIBC_NAMESPACE::sprintf(buff, "%La", 1.0e-1000L);
#if defined(SPECIAL_X86_LONG_DOUBLE)
ASSERT_STREQ_LEN(written, buff, "0x8.68a9188a89e1467p-3325");
#elif defined(LONG_DOUBLE_IS_DOUBLE)
@@ -2512,98 +2514,98 @@ TEST_F(LlvmLibcSPrintfTest, FloatAutoConv) {
// Min Width Tests.
- written = __llvm_libc::sprintf(buff, "%15g", 1.0);
+ written = LIBC_NAMESPACE::sprintf(buff, "%15g", 1.0);
ASSERT_STREQ_LEN(written, buff, " 1");
- written = __llvm_libc::sprintf(buff, "%15g", -1.0);
+ written = LIBC_NAMESPACE::sprintf(buff, "%15g", -1.0);
ASSERT_STREQ_LEN(written, buff, " -1");
- written = __llvm_libc::sprintf(buff, "%15g", 1.0e5);
+ written = LIBC_NAMESPACE::sprintf(buff, "%15g", 1.0e5);
ASSERT_STREQ_LEN(written, buff, " 100000");
- written = __llvm_libc::sprintf(buff, "%15g", -1.0e5);
+ written = LIBC_NAMESPACE::sprintf(buff, "%15g", -1.0e5);
ASSERT_STREQ_LEN(written, buff, " -100000");
- written = __llvm_libc::sprintf(buff, "%10g", 1.0e-5);
+ written = LIBC_NAMESPACE::sprintf(buff, "%10g", 1.0e-5);
ASSERT_STREQ_LEN(written, buff, " 1e-05");
// Precision Tests.
- written = __llvm_libc::sprintf(buff, "%.2g", 1.23456789);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.2g", 1.23456789);
ASSERT_STREQ_LEN(written, buff, "1.2");
// Trimming trailing zeroes causes the precision to be ignored here.
- written = __llvm_libc::sprintf(buff, "%.1g", 0.0);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1g", 0.0);
ASSERT_STREQ_LEN(written, buff, "0");
- written = __llvm_libc::sprintf(buff, "%.0g", 0.0);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.0g", 0.0);
ASSERT_STREQ_LEN(written, buff, "0");
- written = __llvm_libc::sprintf(buff, "%.2g", 0.1);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.2g", 0.1);
ASSERT_STREQ_LEN(written, buff, "0.1");
- written = __llvm_libc::sprintf(buff, "%.2g", 1.09);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.2g", 1.09);
ASSERT_STREQ_LEN(written, buff, "1.1");
- written = __llvm_libc::sprintf(buff, "%.2g", 1.04);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.2g", 1.04);
ASSERT_STREQ_LEN(written, buff, "1");
- written = __llvm_libc::sprintf(buff, "%.2g", 1.19);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.2g", 1.19);
ASSERT_STREQ_LEN(written, buff, "1.2");
- written = __llvm_libc::sprintf(buff, "%.2g", 1.99);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.2g", 1.99);
ASSERT_STREQ_LEN(written, buff, "2");
- written = __llvm_libc::sprintf(buff, "%.2g", 9.99);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.2g", 9.99);
ASSERT_STREQ_LEN(written, buff, "10");
- written = __llvm_libc::sprintf(buff, "%.3g", 99.9);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.3g", 99.9);
ASSERT_STREQ_LEN(written, buff, "99.9");
- written = __llvm_libc::sprintf(buff, "%.2g", 99.9);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.2g", 99.9);
ASSERT_STREQ_LEN(written, buff, "1e+02");
- written = __llvm_libc::sprintf(buff, "%.1g", 99.9);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1g", 99.9);
ASSERT_STREQ_LEN(written, buff, "1e+02");
- written = __llvm_libc::sprintf(buff, "%.5g", 1.25);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.5g", 1.25);
ASSERT_STREQ_LEN(written, buff, "1.25");
- written = __llvm_libc::sprintf(buff, "%.0g", 1.25);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.0g", 1.25);
ASSERT_STREQ_LEN(written, buff, "1");
- written = __llvm_libc::sprintf(buff, "%.0g", 1.75);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.0g", 1.75);
ASSERT_STREQ_LEN(written, buff, "2");
- written = __llvm_libc::sprintf(buff, "%.20g", 1.234e-10);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.20g", 1.234e-10);
ASSERT_STREQ_LEN(written, buff, "1.2340000000000000814e-10");
- written = __llvm_libc::sprintf(buff, "%.3g", -9.99);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.3g", -9.99);
ASSERT_STREQ_LEN(written, buff, "-9.99");
- written = __llvm_libc::sprintf(buff, "%.2g", -9.99);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.2g", -9.99);
ASSERT_STREQ_LEN(written, buff, "-10");
- written = __llvm_libc::sprintf(buff, "%.1g", -9.99);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1g", -9.99);
ASSERT_STREQ_LEN(written, buff, "-1e+01");
- written = __llvm_libc::sprintf(buff, "%.5g", 1.008);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.5g", 1.008);
ASSERT_STREQ_LEN(written, buff, "1.008");
- written = __llvm_libc::sprintf(buff, "%.5g", 1.008e3);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.5g", 1.008e3);
ASSERT_STREQ_LEN(written, buff, "1008");
- written = __llvm_libc::sprintf(buff, "%.4g", 9999.0);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.4g", 9999.0);
ASSERT_STREQ_LEN(written, buff, "9999");
- written = __llvm_libc::sprintf(buff, "%.3g", 9999.0);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.3g", 9999.0);
ASSERT_STREQ_LEN(written, buff, "1e+04");
- written = __llvm_libc::sprintf(buff, "%.3g", 1256.0);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.3g", 1256.0);
ASSERT_STREQ_LEN(written, buff, "1.26e+03");
// Found through large scale testing.
- written = __llvm_libc::sprintf(buff, "%.15g", 22.25);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.15g", 22.25);
ASSERT_STREQ_LEN(written, buff, "22.25");
// These tests also focus on rounding, but only in how it relates to the base
@@ -2614,18 +2616,18 @@ TEST_F(LlvmLibcSPrintfTest, FloatAutoConv) {
// is %f with an effective precision of P - X + 1 if P > X >= -4, else the
// style is %e with effective precision P - 1. Additionally, it attempts to
// trim zeros that would be displayed after the decimal point.
- written = __llvm_libc::sprintf(buff, "%.1g", 9.059E+200);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1g", 9.059E+200);
ASSERT_STREQ_LEN(written, buff, "9e+200");
- written = __llvm_libc::sprintf(buff, "%.2g", 9.059E+200);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.2g", 9.059E+200);
ASSERT_STREQ_LEN(written, buff, "9.1e+200");
// For this test, P = 0 and X = 1, so P > X >= -4 is false, giving a %e style.
- written = __llvm_libc::sprintf(buff, "%.0g", 9.5);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.0g", 9.5);
ASSERT_STREQ_LEN(written, buff, "1e+01");
// Subnormal Precision Tests
- written = __llvm_libc::sprintf(buff, "%.310g", 0x1.0p-1022);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.310g", 0x1.0p-1022);
ASSERT_STREQ_LEN(
written, buff,
"2."
@@ -2635,10 +2637,10 @@ TEST_F(LlvmLibcSPrintfTest, FloatAutoConv) {
"375250806650616658158948720491179968591639648500635908770118304874799780"
"887753749949451580452e-308");
- written = __llvm_libc::sprintf(buff, "%.30g", 0x1.0p-1022);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.30g", 0x1.0p-1022);
ASSERT_STREQ_LEN(written, buff, "2.22507385850720138309023271733e-308");
- written = __llvm_libc::sprintf(buff, "%.310g", 0x1.0p-1023);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.310g", 0x1.0p-1023);
ASSERT_STREQ_LEN(
written, buff,
"1."
@@ -2648,38 +2650,38 @@ TEST_F(LlvmLibcSPrintfTest, FloatAutoConv) {
"187625403325308329079474360245589984295819824250317954385059152437399890"
"443876874974725790226e-308");
- written = __llvm_libc::sprintf(buff, "%.7g", 9.99999e-310);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.7g", 9.99999e-310);
ASSERT_STREQ_LEN(written, buff, "9.99999e-310");
- written = __llvm_libc::sprintf(buff, "%.6g", 9.99999e-310);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.6g", 9.99999e-310);
ASSERT_STREQ_LEN(written, buff, "9.99999e-310");
- written = __llvm_libc::sprintf(buff, "%.5g", 9.99999e-310);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.5g", 9.99999e-310);
ASSERT_STREQ_LEN(written, buff, "1e-309");
- written = __llvm_libc::sprintf(buff, "%.4g", 9.99999e-310);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.4g", 9.99999e-310);
ASSERT_STREQ_LEN(written, buff, "1e-309");
- written = __llvm_libc::sprintf(buff, "%.3g", 9.99999e-310);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.3g", 9.99999e-310);
ASSERT_STREQ_LEN(written, buff, "1e-309");
- written = __llvm_libc::sprintf(buff, "%.2g", 9.99999e-310);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.2g", 9.99999e-310);
ASSERT_STREQ_LEN(written, buff, "1e-309");
- written = __llvm_libc::sprintf(buff, "%.1g", 9.99999e-310);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1g", 9.99999e-310);
ASSERT_STREQ_LEN(written, buff, "1e-309");
- written = __llvm_libc::sprintf(buff, "%.0g", 9.99999e-310);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.0g", 9.99999e-310);
ASSERT_STREQ_LEN(written, buff, "1e-309");
- written = __llvm_libc::sprintf(buff, "%.10g", 0x1.0p-1074);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.10g", 0x1.0p-1074);
ASSERT_STREQ_LEN(written, buff, "4.940656458e-324");
// Long double precision tests.
// These are currently commented out because they require long double support
// that isn't ready yet.
/*
- written = __llvm_libc::sprintf(buff, "%.1La", 0.1L);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1La", 0.1L);
#if defined(SPECIAL_X86_LONG_DOUBLE)
ASSERT_STREQ_LEN(written, buff, "0xc.dp-7");
#elif defined(LONG_DOUBLE_IS_DOUBLE)
@@ -2688,8 +2690,8 @@ TEST_F(LlvmLibcSPrintfTest, FloatAutoConv) {
ASSERT_STREQ_LEN(written, buff, "0x1.ap-4");
#endif
- written = __llvm_libc::sprintf(buff, "%.1La", 0xf.fffffffffffffffp16380L);
- #if defined(SPECIAL_X86_LONG_DOUBLE)
+ written = LIBC_NAMESPACE::sprintf(buff, "%.1La",
+ 0xf.fffffffffffffffp16380L); #if defined(SPECIAL_X86_LONG_DOUBLE)
ASSERT_STREQ_LEN(written, buff, "0x1.0p+16384");
#elif defined(LONG_DOUBLE_IS_DOUBLE)
ASSERT_STREQ_LEN(written, buff, "inf");
@@ -2701,233 +2703,233 @@ TEST_F(LlvmLibcSPrintfTest, FloatAutoConv) {
// Rounding Mode Tests.
if (ForceRoundingMode r(RoundingMode::Nearest); r.success) {
- written = __llvm_libc::sprintf(buff, "%.2g", 1.75);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.2g", 1.75);
ASSERT_STREQ_LEN(written, buff, "1.8");
- written = __llvm_libc::sprintf(buff, "%.2g", 1.25);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.2g", 1.25);
ASSERT_STREQ_LEN(written, buff, "1.2");
- written = __llvm_libc::sprintf(buff, "%.2g", 1.125);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.2g", 1.125);
ASSERT_STREQ_LEN(written, buff, "1.1");
- written = __llvm_libc::sprintf(buff, "%.2g", 1.625);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.2g", 1.625);
ASSERT_STREQ_LEN(written, buff, "1.6");
- written = __llvm_libc::sprintf(buff, "%.2g", 1.375);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.2g", 1.375);
ASSERT_STREQ_LEN(written, buff, "1.4");
- written = __llvm_libc::sprintf(buff, "%.2g", 1.875);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.2g", 1.875);
ASSERT_STREQ_LEN(written, buff, "1.9");
- written = __llvm_libc::sprintf(buff, "%.2g", -1.75);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.2g", -1.75);
ASSERT_STREQ_LEN(written, buff, "-1.8");
- written = __llvm_libc::sprintf(buff, "%.2g", -1.25);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.2g", -1.25);
ASSERT_STREQ_LEN(written, buff, "-1.2");
- written = __llvm_libc::sprintf(buff, "%.2g", -1.125);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.2g", -1.125);
ASSERT_STREQ_LEN(written, buff, "-1.1");
- written = __llvm_libc::sprintf(buff, "%.2g", -1.625);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.2g", -1.625);
ASSERT_STREQ_LEN(written, buff, "-1.6");
- written = __llvm_libc::sprintf(buff, "%.2g", -1.375);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.2g", -1.375);
ASSERT_STREQ_LEN(written, buff, "-1.4");
- written = __llvm_libc::sprintf(buff, "%.2g", -1.875);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.2g", -1.875);
ASSERT_STREQ_LEN(written, buff, "-1.9");
}
if (ForceRoundingMode r(RoundingMode::Upward); r.success) {
- written = __llvm_libc::sprintf(buff, "%.2g", 1.75);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.2g", 1.75);
ASSERT_STREQ_LEN(written, buff, "1.8");
- written = __llvm_libc::sprintf(buff, "%.2g", 1.25);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.2g", 1.25);
ASSERT_STREQ_LEN(written, buff, "1.3");
- written = __llvm_libc::sprintf(buff, "%.2g", 1.125);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.2g", 1.125);
ASSERT_STREQ_LEN(written, buff, "1.2");
- written = __llvm_libc::sprintf(buff, "%.2g", 1.625);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.2g", 1.625);
ASSERT_STREQ_LEN(written, buff, "1.7");
- written = __llvm_libc::sprintf(buff, "%.2g", 1.375);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.2g", 1.375);
ASSERT_STREQ_LEN(written, buff, "1.4");
- written = __llvm_libc::sprintf(buff, "%.2g", 1.875);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.2g", 1.875);
ASSERT_STREQ_LEN(written, buff, "1.9");
- written = __llvm_libc::sprintf(buff, "%.2g", -1.75);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.2g", -1.75);
ASSERT_STREQ_LEN(written, buff, "-1.7");
- written = __llvm_libc::sprintf(buff, "%.2g", -1.25);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.2g", -1.25);
ASSERT_STREQ_LEN(written, buff, "-1.2");
- written = __llvm_libc::sprintf(buff, "%.2g", -1.125);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.2g", -1.125);
ASSERT_STREQ_LEN(written, buff, "-1.1");
- written = __llvm_libc::sprintf(buff, "%.2g", -1.625);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.2g", -1.625);
ASSERT_STREQ_LEN(written, buff, "-1.6");
- written = __llvm_libc::sprintf(buff, "%.2g", -1.375);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.2g", -1.375);
ASSERT_STREQ_LEN(written, buff, "-1.3");
- written = __llvm_libc::sprintf(buff, "%.2g", -1.875);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.2g", -1.875);
ASSERT_STREQ_LEN(written, buff, "-1.8");
}
if (ForceRoundingMode r(RoundingMode::Downward); r.success) {
- written = __llvm_libc::sprintf(buff, "%.2g", 1.75);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.2g", 1.75);
ASSERT_STREQ_LEN(written, buff, "1.7");
- written = __llvm_libc::sprintf(buff, "%.2g", 1.25);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.2g", 1.25);
ASSERT_STREQ_LEN(written, buff, "1.2");
- written = __llvm_libc::sprintf(buff, "%.2g", 1.125);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.2g", 1.125);
ASSERT_STREQ_LEN(written, buff, "1.1");
- written = __llvm_libc::sprintf(buff, "%.2g", 1.625);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.2g", 1.625);
ASSERT_STREQ_LEN(written, buff, "1.6");
- written = __llvm_libc::sprintf(buff, "%.2g", 1.375);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.2g", 1.375);
ASSERT_STREQ_LEN(written, buff, "1.3");
- written = __llvm_libc::sprintf(buff, "%.2g", 1.875);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.2g", 1.875);
ASSERT_STREQ_LEN(written, buff, "1.8");
- written = __llvm_libc::sprintf(buff, "%.2g", -1.75);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.2g", -1.75);
ASSERT_STREQ_LEN(written, buff, "-1.8");
- written = __llvm_libc::sprintf(buff, "%.2g", -1.25);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.2g", -1.25);
ASSERT_STREQ_LEN(written, buff, "-1.3");
- written = __llvm_libc::sprintf(buff, "%.2g", -1.125);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.2g", -1.125);
ASSERT_STREQ_LEN(written, buff, "-1.2");
- written = __llvm_libc::sprintf(buff, "%.2g", -1.625);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.2g", -1.625);
ASSERT_STREQ_LEN(written, buff, "-1.7");
- written = __llvm_libc::sprintf(buff, "%.2g", -1.375);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.2g", -1.375);
ASSERT_STREQ_LEN(written, buff, "-1.4");
- written = __llvm_libc::sprintf(buff, "%.2g", -1.875);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.2g", -1.875);
ASSERT_STREQ_LEN(written, buff, "-1.9");
}
if (ForceRoundingMode r(RoundingMode::TowardZero); r.success) {
- written = __llvm_libc::sprintf(buff, "%.2g", 1.75);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.2g", 1.75);
ASSERT_STREQ_LEN(written, buff, "1.7");
- written = __llvm_libc::sprintf(buff, "%.2g", 1.25);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.2g", 1.25);
ASSERT_STREQ_LEN(written, buff, "1.2");
- written = __llvm_libc::sprintf(buff, "%.2g", 1.125);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.2g", 1.125);
ASSERT_STREQ_LEN(written, buff, "1.1");
- written = __llvm_libc::sprintf(buff, "%.2g", 1.625);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.2g", 1.625);
ASSERT_STREQ_LEN(written, buff, "1.6");
- written = __llvm_libc::sprintf(buff, "%.2g", 1.375);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.2g", 1.375);
ASSERT_STREQ_LEN(written, buff, "1.3");
- written = __llvm_libc::sprintf(buff, "%.2g", 1.875);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.2g", 1.875);
ASSERT_STREQ_LEN(written, buff, "1.8");
- written = __llvm_libc::sprintf(buff, "%.2g", -1.75);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.2g", -1.75);
ASSERT_STREQ_LEN(written, buff, "-1.7");
- written = __llvm_libc::sprintf(buff, "%.2g", -1.25);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.2g", -1.25);
ASSERT_STREQ_LEN(written, buff, "-1.2");
- written = __llvm_libc::sprintf(buff, "%.2g", -1.125);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.2g", -1.125);
ASSERT_STREQ_LEN(written, buff, "-1.1");
- written = __llvm_libc::sprintf(buff, "%.2g", -1.625);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.2g", -1.625);
ASSERT_STREQ_LEN(written, buff, "-1.6");
- written = __llvm_libc::sprintf(buff, "%.2g", -1.375);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.2g", -1.375);
ASSERT_STREQ_LEN(written, buff, "-1.3");
- written = __llvm_libc::sprintf(buff, "%.2g", -1.875);
+ written = LIBC_NAMESPACE::sprintf(buff, "%.2g", -1.875);
ASSERT_STREQ_LEN(written, buff, "-1.8");
}
// Flag Tests.
- written = __llvm_libc::sprintf(buff, "%+g", 1.0);
+ written = LIBC_NAMESPACE::sprintf(buff, "%+g", 1.0);
ASSERT_STREQ_LEN(written, buff, "+1");
- written = __llvm_libc::sprintf(buff, "%+g", -1.0);
+ written = LIBC_NAMESPACE::sprintf(buff, "%+g", -1.0);
ASSERT_STREQ_LEN(written, buff, "-1");
- written = __llvm_libc::sprintf(buff, "% g", 1.0);
+ written = LIBC_NAMESPACE::sprintf(buff, "% g", 1.0);
ASSERT_STREQ_LEN(written, buff, " 1");
- written = __llvm_libc::sprintf(buff, "% g", -1.0);
+ written = LIBC_NAMESPACE::sprintf(buff, "% g", -1.0);
ASSERT_STREQ_LEN(written, buff, "-1");
- written = __llvm_libc::sprintf(buff, "%-15g", 1.5);
+ written = LIBC_NAMESPACE::sprintf(buff, "%-15g", 1.5);
ASSERT_STREQ_LEN(written, buff, "1.5 ");
- written = __llvm_libc::sprintf(buff, "%#.g", 1.0);
+ written = LIBC_NAMESPACE::sprintf(buff, "%#.g", 1.0);
ASSERT_STREQ_LEN(written, buff, "1.");
- written = __llvm_libc::sprintf(buff, "%#g", 1.0);
+ written = LIBC_NAMESPACE::sprintf(buff, "%#g", 1.0);
ASSERT_STREQ_LEN(written, buff, "1.00000");
- written = __llvm_libc::sprintf(buff, "%#.0g", 1.5);
+ written = LIBC_NAMESPACE::sprintf(buff, "%#.0g", 1.5);
ASSERT_STREQ_LEN(written, buff, "2.");
- written = __llvm_libc::sprintf(buff, "%015g", 1.5);
+ written = LIBC_NAMESPACE::sprintf(buff, "%015g", 1.5);
ASSERT_STREQ_LEN(written, buff, "0000000000001.5");
- written = __llvm_libc::sprintf(buff, "%015g", -1.5);
+ written = LIBC_NAMESPACE::sprintf(buff, "%015g", -1.5);
ASSERT_STREQ_LEN(written, buff, "-000000000001.5");
- written = __llvm_libc::sprintf(buff, "%+- #0g", 0.0);
+ written = LIBC_NAMESPACE::sprintf(buff, "%+- #0g", 0.0);
ASSERT_STREQ_LEN(written, buff, "+0.00000");
// Combined Tests.
- written = __llvm_libc::sprintf(buff, "%10.3g", 9.99);
+ written = LIBC_NAMESPACE::sprintf(buff, "%10.3g", 9.99);
ASSERT_STREQ_LEN(written, buff, " 9.99");
- written = __llvm_libc::sprintf(buff, "%10.2g", 9.99);
+ written = LIBC_NAMESPACE::sprintf(buff, "%10.2g", 9.99);
ASSERT_STREQ_LEN(written, buff, " 10");
- written = __llvm_libc::sprintf(buff, "%10.1g", 9.99);
+ written = LIBC_NAMESPACE::sprintf(buff, "%10.1g", 9.99);
ASSERT_STREQ_LEN(written, buff, " 1e+01");
- written = __llvm_libc::sprintf(buff, "%-10.3g", 9.99);
+ written = LIBC_NAMESPACE::sprintf(buff, "%-10.3g", 9.99);
ASSERT_STREQ_LEN(written, buff, "9.99 ");
- written = __llvm_libc::sprintf(buff, "%-10.2g", 9.99);
+ written = LIBC_NAMESPACE::sprintf(buff, "%-10.2g", 9.99);
ASSERT_STREQ_LEN(written, buff, "10 ");
- written = __llvm_libc::sprintf(buff, "%-10.1g", 9.99);
+ written = LIBC_NAMESPACE::sprintf(buff, "%-10.1g", 9.99);
ASSERT_STREQ_LEN(written, buff, "1e+01 ");
- written = __llvm_libc::sprintf(buff, "%-10.1g", 1.0e-50);
+ written = LIBC_NAMESPACE::sprintf(buff, "%-10.1g", 1.0e-50);
ASSERT_STREQ_LEN(written, buff, "1e-50 ");
- written = __llvm_libc::sprintf(buff, "%30g", 1234567890123456789.0);
+ written = LIBC_NAMESPACE::sprintf(buff, "%30g", 1234567890123456789.0);
ASSERT_STREQ_LEN(written, buff, " 1.23457e+18");
- written = __llvm_libc::sprintf(buff, "%-30g", 1234567890123456789.0);
+ written = LIBC_NAMESPACE::sprintf(buff, "%-30g", 1234567890123456789.0);
ASSERT_STREQ_LEN(written, buff, "1.23457e+18 ");
- written = __llvm_libc::sprintf(buff, "%25.15g", 9999999999999.99);
+ written = LIBC_NAMESPACE::sprintf(buff, "%25.15g", 9999999999999.99);
ASSERT_STREQ_LEN(written, buff, " 9999999999999.99");
- written = __llvm_libc::sprintf(buff, "%25.14g", 9999999999999.99);
+ written = LIBC_NAMESPACE::sprintf(buff, "%25.14g", 9999999999999.99);
ASSERT_STREQ_LEN(written, buff, " 10000000000000");
- written = __llvm_libc::sprintf(buff, "%25.13g", 9999999999999.99);
+ written = LIBC_NAMESPACE::sprintf(buff, "%25.13g", 9999999999999.99);
ASSERT_STREQ_LEN(written, buff, " 1e+13");
- written = __llvm_libc::sprintf(buff, "%#12.3g %-12.3g", 0.1, 256.0);
+ written = LIBC_NAMESPACE::sprintf(buff, "%#12.3g %-12.3g", 0.1, 256.0);
ASSERT_STREQ_LEN(written, buff, " 0.100 256 ");
- written = __llvm_libc::sprintf(buff, "%+-#12.3g % 012.3g", 0.1256, 1256.0);
+ written = LIBC_NAMESPACE::sprintf(buff, "%+-#12.3g % 012.3g", 0.1256, 1256.0);
ASSERT_STREQ_LEN(written, buff, "+0.126 0001.26e+03");
}
@@ -2940,31 +2942,31 @@ TEST(LlvmLibcSPrintfTest, WriteIntConv) {
int test_val = -1;
test_val = -1;
- written = __llvm_libc::sprintf(buff, "12345%n67890", &test_val);
+ written = LIBC_NAMESPACE::sprintf(buff, "12345%n67890", &test_val);
EXPECT_EQ(written, 10);
EXPECT_EQ(test_val, 5);
ASSERT_STREQ(buff, "1234567890");
test_val = -1;
- written = __llvm_libc::sprintf(buff, "%n", &test_val);
+ written = LIBC_NAMESPACE::sprintf(buff, "%n", &test_val);
EXPECT_EQ(written, 0);
EXPECT_EQ(test_val, 0);
ASSERT_STREQ(buff, "");
test_val = 0x100;
- written = __llvm_libc::sprintf(buff, "ABC%hhnDEF", &test_val);
+ written = LIBC_NAMESPACE::sprintf(buff, "ABC%hhnDEF", &test_val);
EXPECT_EQ(written, 6);
EXPECT_EQ(test_val, 0x103);
ASSERT_STREQ(buff, "ABCDEF");
test_val = -1;
- written = __llvm_libc::sprintf(buff, "%s%n", "87654321", &test_val);
+ written = LIBC_NAMESPACE::sprintf(buff, "%s%n", "87654321", &test_val);
EXPECT_EQ(written, 8);
EXPECT_EQ(test_val, 8);
ASSERT_STREQ(buff, "87654321");
#ifndef LIBC_COPT_PRINTF_NO_NULLPTR_CHECKS
- written = __llvm_libc::sprintf(buff, "abc123%n", nullptr);
+ written = LIBC_NAMESPACE::sprintf(buff, "abc123%n", nullptr);
EXPECT_LT(written, 0);
#endif // LIBC_COPT_PRINTF_NO_NULLPTR_CHECKS
}
@@ -2975,20 +2977,20 @@ TEST(LlvmLibcSPrintfTest, IndexModeParsing) {
char buff[64];
int written;
- written = __llvm_libc::sprintf(buff, "%1$s", "abcDEF123");
+ written = LIBC_NAMESPACE::sprintf(buff, "%1$s", "abcDEF123");
EXPECT_EQ(written, 9);
ASSERT_STREQ(buff, "abcDEF123");
- written = __llvm_libc::sprintf(buff, "%1$s %%", "abcDEF123");
+ written = LIBC_NAMESPACE::sprintf(buff, "%1$s %%", "abcDEF123");
EXPECT_EQ(written, 11);
ASSERT_STREQ(buff, "abcDEF123 %");
written =
- __llvm_libc::sprintf(buff, "%3$s %1$s %2$s", "is", "hard", "ordering");
+ LIBC_NAMESPACE::sprintf(buff, "%3$s %1$s %2$s", "is", "hard", "ordering");
EXPECT_EQ(written, 16);
ASSERT_STREQ(buff, "ordering is hard");
- written = __llvm_libc::sprintf(
+ written = LIBC_NAMESPACE::sprintf(
buff, "%10$s %9$s %8$c %7$s %6$s, %6$s %5$s %4$-*1$s %3$.*11$s %2$s. %%",
6, "pain", "alphabetical", "such", "is", "this", "do", 'u', "would",
"why", 1);
diff --git a/libc/test/src/stdio/sscanf_test.cpp b/libc/test/src/stdio/sscanf_test.cpp
index b6535dfde076cd4..8e0ad7de4f2ea2f 100644
--- a/libc/test/src/stdio/sscanf_test.cpp
+++ b/libc/test/src/stdio/sscanf_test.cpp
@@ -21,16 +21,16 @@ TEST(LlvmLibcSScanfTest, SimpleStringConv) {
int ret_val;
char buffer[10];
char buffer2[10];
- ret_val = __llvm_libc::sscanf("abc123", "abc %s", buffer);
+ ret_val = LIBC_NAMESPACE::sscanf("abc123", "abc %s", buffer);
ASSERT_EQ(ret_val, 1);
ASSERT_STREQ(buffer, "123");
- ret_val = __llvm_libc::sscanf("abc123", "%3s %3s", buffer, buffer2);
+ ret_val = LIBC_NAMESPACE::sscanf("abc123", "%3s %3s", buffer, buffer2);
ASSERT_EQ(ret_val, 2);
ASSERT_STREQ(buffer, "abc");
ASSERT_STREQ(buffer2, "123");
- ret_val = __llvm_libc::sscanf("abc 123", "%3s%3s", buffer, buffer2);
+ ret_val = LIBC_NAMESPACE::sscanf("abc 123", "%3s%3s", buffer, buffer2);
ASSERT_EQ(ret_val, 2);
ASSERT_STREQ(buffer, "abc");
ASSERT_STREQ(buffer2, "123");
@@ -39,41 +39,41 @@ TEST(LlvmLibcSScanfTest, SimpleStringConv) {
TEST(LlvmLibcSScanfTest, IntConvSimple) {
int ret_val;
int result = 0;
- ret_val = __llvm_libc::sscanf("123", "%d", &result);
+ ret_val = LIBC_NAMESPACE::sscanf("123", "%d", &result);
EXPECT_EQ(ret_val, 1);
EXPECT_EQ(result, 123);
- ret_val = __llvm_libc::sscanf("456", "%i", &result);
+ ret_val = LIBC_NAMESPACE::sscanf("456", "%i", &result);
EXPECT_EQ(ret_val, 1);
EXPECT_EQ(result, 456);
- ret_val = __llvm_libc::sscanf("789", "%x", &result);
+ ret_val = LIBC_NAMESPACE::sscanf("789", "%x", &result);
EXPECT_EQ(ret_val, 1);
EXPECT_EQ(result, 0x789);
- ret_val = __llvm_libc::sscanf("012", "%o", &result);
+ ret_val = LIBC_NAMESPACE::sscanf("012", "%o", &result);
EXPECT_EQ(ret_val, 1);
EXPECT_EQ(result, 012);
- ret_val = __llvm_libc::sscanf("345", "%u", &result);
+ ret_val = LIBC_NAMESPACE::sscanf("345", "%u", &result);
EXPECT_EQ(ret_val, 1);
EXPECT_EQ(result, 345);
// 288 characters
- ret_val = __llvm_libc::sscanf("10000000000000000000000000000000"
- "00000000000000000000000000000000"
- "00000000000000000000000000000000"
- "00000000000000000000000000000000"
- "00000000000000000000000000000000"
- "00000000000000000000000000000000"
- "00000000000000000000000000000000"
- "00000000000000000000000000000000"
- "00000000000000000000000000000000",
- "%d", &result);
- EXPECT_EQ(ret_val, 1);
- EXPECT_EQ(result, int(__llvm_libc::cpp::numeric_limits<intmax_t>::max()));
-
- ret_val = __llvm_libc::sscanf("Not an integer", "%d", &result);
+ ret_val = LIBC_NAMESPACE::sscanf("10000000000000000000000000000000"
+ "00000000000000000000000000000000"
+ "00000000000000000000000000000000"
+ "00000000000000000000000000000000"
+ "00000000000000000000000000000000"
+ "00000000000000000000000000000000"
+ "00000000000000000000000000000000"
+ "00000000000000000000000000000000"
+ "00000000000000000000000000000000",
+ "%d", &result);
+ EXPECT_EQ(ret_val, 1);
+ EXPECT_EQ(result, int(LIBC_NAMESPACE::cpp::numeric_limits<intmax_t>::max()));
+
+ ret_val = LIBC_NAMESPACE::sscanf("Not an integer", "%d", &result);
EXPECT_EQ(ret_val, 0);
}
@@ -83,33 +83,33 @@ TEST(LlvmLibcSScanfTest, IntConvLengthModifier) {
int int_result = 0;
char char_result = 0;
- ret_val = __llvm_libc::sscanf("123", "%ju", &max_result);
+ ret_val = LIBC_NAMESPACE::sscanf("123", "%ju", &max_result);
EXPECT_EQ(ret_val, 1);
EXPECT_EQ(max_result, uintmax_t(123));
// Check overflow handling
- ret_val = __llvm_libc::sscanf("999999999999999999999999999999999999", "%ju",
- &max_result);
+ ret_val = LIBC_NAMESPACE::sscanf("999999999999999999999999999999999999",
+ "%ju", &max_result);
EXPECT_EQ(ret_val, 1);
- EXPECT_EQ(max_result, __llvm_libc::cpp::numeric_limits<uintmax_t>::max());
+ EXPECT_EQ(max_result, LIBC_NAMESPACE::cpp::numeric_limits<uintmax_t>::max());
// Because this is unsigned, any out of range value should return the maximum,
// even with a negative sign.
- ret_val = __llvm_libc::sscanf("-999999999999999999999999999999999999", "%ju",
- &max_result);
+ ret_val = LIBC_NAMESPACE::sscanf("-999999999999999999999999999999999999",
+ "%ju", &max_result);
EXPECT_EQ(ret_val, 1);
- EXPECT_EQ(max_result, __llvm_libc::cpp::numeric_limits<uintmax_t>::max());
+ EXPECT_EQ(max_result, LIBC_NAMESPACE::cpp::numeric_limits<uintmax_t>::max());
- ret_val = __llvm_libc::sscanf("-18446744073709551616", "%ju", &max_result);
+ ret_val = LIBC_NAMESPACE::sscanf("-18446744073709551616", "%ju", &max_result);
EXPECT_EQ(ret_val, 1);
- EXPECT_EQ(max_result, __llvm_libc::cpp::numeric_limits<uintmax_t>::max());
+ EXPECT_EQ(max_result, LIBC_NAMESPACE::cpp::numeric_limits<uintmax_t>::max());
// But any number below the maximum should have the - sign applied.
- ret_val = __llvm_libc::sscanf("-1", "%ju", &max_result);
+ ret_val = LIBC_NAMESPACE::sscanf("-1", "%ju", &max_result);
EXPECT_EQ(ret_val, 1);
EXPECT_EQ(max_result, uintmax_t(-1));
- ret_val = __llvm_libc::sscanf("-1", "%u", &int_result);
+ ret_val = LIBC_NAMESPACE::sscanf("-1", "%u", &int_result);
EXPECT_EQ(ret_val, 1);
EXPECT_EQ(int_result, -1);
@@ -117,7 +117,7 @@ TEST(LlvmLibcSScanfTest, IntConvLengthModifier) {
char_result = 0x6f;
// Overflows for sizes larger than the maximum are handled by casting.
- ret_val = __llvm_libc::sscanf("8589967360", "%d", &int_result);
+ ret_val = LIBC_NAMESPACE::sscanf("8589967360", "%d", &int_result);
EXPECT_EQ(ret_val, 1);
EXPECT_EQ(int_result, int(8589967360)); // 2^33 + 2^15
@@ -125,13 +125,13 @@ TEST(LlvmLibcSScanfTest, IntConvLengthModifier) {
ASSERT_EQ(max_result, uintmax_t(0xff00ff00ff00ff00));
ASSERT_EQ(char_result, char(0x6f));
- ret_val = __llvm_libc::sscanf("-8589967360", "%d", &int_result);
+ ret_val = LIBC_NAMESPACE::sscanf("-8589967360", "%d", &int_result);
EXPECT_EQ(ret_val, 1);
EXPECT_EQ(int_result, int(-8589967360));
ASSERT_EQ(max_result, uintmax_t(0xff00ff00ff00ff00));
ASSERT_EQ(char_result, char(0x6f));
- ret_val = __llvm_libc::sscanf("25", "%hhd", &char_result);
+ ret_val = LIBC_NAMESPACE::sscanf("25", "%hhd", &char_result);
EXPECT_EQ(ret_val, 1);
EXPECT_EQ(char_result, char(25));
}
@@ -139,19 +139,19 @@ TEST(LlvmLibcSScanfTest, IntConvLengthModifier) {
TEST(LlvmLibcSScanfTest, IntConvBaseSelection) {
int ret_val;
int result = 0;
- ret_val = __llvm_libc::sscanf("0xabc123", "%i", &result);
+ ret_val = LIBC_NAMESPACE::sscanf("0xabc123", "%i", &result);
EXPECT_EQ(ret_val, 1);
EXPECT_EQ(result, 0xabc123);
- ret_val = __llvm_libc::sscanf("0456", "%i", &result);
+ ret_val = LIBC_NAMESPACE::sscanf("0456", "%i", &result);
EXPECT_EQ(ret_val, 1);
EXPECT_EQ(result, 0456);
- ret_val = __llvm_libc::sscanf("0999", "%i", &result);
+ ret_val = LIBC_NAMESPACE::sscanf("0999", "%i", &result);
EXPECT_EQ(ret_val, 1);
EXPECT_EQ(result, 0);
- ret_val = __llvm_libc::sscanf("123abc456", "%i", &result);
+ ret_val = LIBC_NAMESPACE::sscanf("123abc456", "%i", &result);
EXPECT_EQ(ret_val, 1);
EXPECT_EQ(result, 123);
}
@@ -160,43 +160,43 @@ TEST(LlvmLibcSScanfTest, IntConvMaxLengthTests) {
int ret_val;
int result = 0;
- ret_val = __llvm_libc::sscanf("12", "%1d", &result);
+ ret_val = LIBC_NAMESPACE::sscanf("12", "%1d", &result);
EXPECT_EQ(ret_val, 1);
EXPECT_EQ(result, 1);
- ret_val = __llvm_libc::sscanf("-1", "%1d", &result);
+ ret_val = LIBC_NAMESPACE::sscanf("-1", "%1d", &result);
EXPECT_EQ(ret_val, 0);
EXPECT_EQ(result, 0);
- ret_val = __llvm_libc::sscanf("+1", "%1d", &result);
+ ret_val = LIBC_NAMESPACE::sscanf("+1", "%1d", &result);
EXPECT_EQ(ret_val, 0);
EXPECT_EQ(result, 0);
- ret_val = __llvm_libc::sscanf("01", "%1d", &result);
+ ret_val = LIBC_NAMESPACE::sscanf("01", "%1d", &result);
EXPECT_EQ(ret_val, 1);
EXPECT_EQ(result, 0);
- ret_val = __llvm_libc::sscanf("01", "%1i", &result);
+ ret_val = LIBC_NAMESPACE::sscanf("01", "%1i", &result);
EXPECT_EQ(ret_val, 1);
EXPECT_EQ(result, 0);
- ret_val = __llvm_libc::sscanf("0x1", "%2i", &result);
+ ret_val = LIBC_NAMESPACE::sscanf("0x1", "%2i", &result);
EXPECT_EQ(ret_val, 1);
EXPECT_EQ(result, 0);
- ret_val = __llvm_libc::sscanf("-0x1", "%3i", &result);
+ ret_val = LIBC_NAMESPACE::sscanf("-0x1", "%3i", &result);
EXPECT_EQ(ret_val, 1);
EXPECT_EQ(result, 0);
- ret_val = __llvm_libc::sscanf("-0x123", "%4i", &result);
+ ret_val = LIBC_NAMESPACE::sscanf("-0x123", "%4i", &result);
EXPECT_EQ(ret_val, 1);
EXPECT_EQ(result, -1);
- ret_val = __llvm_libc::sscanf("123456789", "%5i", &result);
+ ret_val = LIBC_NAMESPACE::sscanf("123456789", "%5i", &result);
EXPECT_EQ(ret_val, 1);
EXPECT_EQ(result, 12345);
- ret_val = __llvm_libc::sscanf("123456789", "%10i", &result);
+ ret_val = LIBC_NAMESPACE::sscanf("123456789", "%10i", &result);
EXPECT_EQ(ret_val, 1);
EXPECT_EQ(result, 123456789);
}
@@ -206,23 +206,23 @@ TEST(LlvmLibcSScanfTest, IntConvNoWriteTests) {
// Result shouldn't be used by these tests, but it's safer to have it and
// check it.
int result = 0;
- ret_val = __llvm_libc::sscanf("-1", "%*1d", &result);
+ ret_val = LIBC_NAMESPACE::sscanf("-1", "%*1d", &result);
EXPECT_EQ(ret_val, 0);
EXPECT_EQ(result, 0);
- ret_val = __llvm_libc::sscanf("01", "%*1i", &result);
+ ret_val = LIBC_NAMESPACE::sscanf("01", "%*1i", &result);
EXPECT_EQ(ret_val, 1);
EXPECT_EQ(result, 0);
- ret_val = __llvm_libc::sscanf("0x1", "%*2i", &result);
+ ret_val = LIBC_NAMESPACE::sscanf("0x1", "%*2i", &result);
EXPECT_EQ(ret_val, 1);
EXPECT_EQ(result, 0);
- ret_val = __llvm_libc::sscanf("a", "%*i", &result);
+ ret_val = LIBC_NAMESPACE::sscanf("a", "%*i", &result);
EXPECT_EQ(ret_val, 0);
EXPECT_EQ(result, 0);
- ret_val = __llvm_libc::sscanf("123", "%*i", &result);
+ ret_val = LIBC_NAMESPACE::sscanf("123", "%*i", &result);
EXPECT_EQ(ret_val, 1);
EXPECT_EQ(result, 0);
}
@@ -231,62 +231,62 @@ TEST(LlvmLibcSScanfTest, FloatConvSimple) {
int ret_val;
float result = 0;
- float inf = __llvm_libc::fputil::FPBits<float>::inf().get_val();
- float nan = __llvm_libc::fputil::FPBits<float>::build_nan(1);
+ float inf = LIBC_NAMESPACE::fputil::FPBits<float>::inf().get_val();
+ float nan = LIBC_NAMESPACE::fputil::FPBits<float>::build_nan(1);
- ret_val = __llvm_libc::sscanf("123", "%f", &result);
+ ret_val = LIBC_NAMESPACE::sscanf("123", "%f", &result);
EXPECT_EQ(ret_val, 1);
EXPECT_FP_EQ(result, 123.0);
- ret_val = __llvm_libc::sscanf("456.1", "%a", &result);
+ ret_val = LIBC_NAMESPACE::sscanf("456.1", "%a", &result);
EXPECT_EQ(ret_val, 1);
EXPECT_FP_EQ(result, 456.1);
- ret_val = __llvm_libc::sscanf("0x789.ap0", "%e", &result);
+ ret_val = LIBC_NAMESPACE::sscanf("0x789.ap0", "%e", &result);
EXPECT_EQ(ret_val, 1);
EXPECT_FP_EQ(result, 0x789.ap0);
- ret_val = __llvm_libc::sscanf("0x.8", "%e", &result);
+ ret_val = LIBC_NAMESPACE::sscanf("0x.8", "%e", &result);
EXPECT_EQ(ret_val, 1);
EXPECT_FP_EQ(result, 0x0.8p0);
- ret_val = __llvm_libc::sscanf("0x8.", "%e", &result);
+ ret_val = LIBC_NAMESPACE::sscanf("0x8.", "%e", &result);
EXPECT_EQ(ret_val, 1);
EXPECT_FP_EQ(result, 0x8.0p0);
- ret_val = __llvm_libc::sscanf("+12.0e1", "%g", &result);
+ ret_val = LIBC_NAMESPACE::sscanf("+12.0e1", "%g", &result);
EXPECT_EQ(ret_val, 1);
EXPECT_FP_EQ(result, 12.0e1);
- ret_val = __llvm_libc::sscanf("inf", "%F", &result);
+ ret_val = LIBC_NAMESPACE::sscanf("inf", "%F", &result);
EXPECT_EQ(ret_val, 1);
EXPECT_FP_EQ(result, inf);
- ret_val = __llvm_libc::sscanf("NaN", "%A", &result);
+ ret_val = LIBC_NAMESPACE::sscanf("NaN", "%A", &result);
EXPECT_EQ(ret_val, 1);
EXPECT_FP_EQ(result, nan);
- ret_val = __llvm_libc::sscanf("-InFiNiTy", "%E", &result);
+ ret_val = LIBC_NAMESPACE::sscanf("-InFiNiTy", "%E", &result);
EXPECT_EQ(ret_val, 1);
EXPECT_FP_EQ(result, -inf);
- ret_val = __llvm_libc::sscanf("1e10", "%G", &result);
+ ret_val = LIBC_NAMESPACE::sscanf("1e10", "%G", &result);
EXPECT_EQ(ret_val, 1);
EXPECT_FP_EQ(result, 1e10);
- ret_val = __llvm_libc::sscanf(".1", "%G", &result);
+ ret_val = LIBC_NAMESPACE::sscanf(".1", "%G", &result);
EXPECT_EQ(ret_val, 1);
EXPECT_FP_EQ(result, 0.1);
- ret_val = __llvm_libc::sscanf("1.", "%G", &result);
+ ret_val = LIBC_NAMESPACE::sscanf("1.", "%G", &result);
EXPECT_EQ(ret_val, 1);
EXPECT_FP_EQ(result, 1.0);
- ret_val = __llvm_libc::sscanf("0", "%f", &result);
+ ret_val = LIBC_NAMESPACE::sscanf("0", "%f", &result);
EXPECT_EQ(ret_val, 1);
EXPECT_FP_EQ(result, 0.0);
- ret_val = __llvm_libc::sscanf("Not a float", "%f", &result);
+ ret_val = LIBC_NAMESPACE::sscanf("Not a float", "%f", &result);
EXPECT_EQ(ret_val, 0);
}
@@ -295,30 +295,31 @@ TEST(LlvmLibcSScanfTest, FloatConvLengthModifier) {
double d_result = 0;
long double ld_result = 0;
- double d_inf = __llvm_libc::fputil::FPBits<double>::inf().get_val();
- long double ld_nan = __llvm_libc::fputil::FPBits<long double>::build_nan(1);
+ double d_inf = LIBC_NAMESPACE::fputil::FPBits<double>::inf().get_val();
+ long double ld_nan =
+ LIBC_NAMESPACE::fputil::FPBits<long double>::build_nan(1);
- ret_val = __llvm_libc::sscanf("123", "%lf", &d_result);
+ ret_val = LIBC_NAMESPACE::sscanf("123", "%lf", &d_result);
EXPECT_EQ(ret_val, 1);
EXPECT_FP_EQ(d_result, 123.0);
- ret_val = __llvm_libc::sscanf("456.1", "%La", &ld_result);
+ ret_val = LIBC_NAMESPACE::sscanf("456.1", "%La", &ld_result);
EXPECT_EQ(ret_val, 1);
EXPECT_FP_EQ(ld_result, 456.1L);
- ret_val = __llvm_libc::sscanf("inf", "%le", &d_result);
+ ret_val = LIBC_NAMESPACE::sscanf("inf", "%le", &d_result);
EXPECT_EQ(ret_val, 1);
EXPECT_FP_EQ(d_result, d_inf);
- ret_val = __llvm_libc::sscanf("nan", "%Lg", &ld_result);
+ ret_val = LIBC_NAMESPACE::sscanf("nan", "%Lg", &ld_result);
EXPECT_EQ(ret_val, 1);
EXPECT_FP_EQ(ld_result, ld_nan);
- ret_val = __llvm_libc::sscanf("1e-300", "%lF", &d_result);
+ ret_val = LIBC_NAMESPACE::sscanf("1e-300", "%lF", &d_result);
EXPECT_EQ(ret_val, 1);
EXPECT_FP_EQ(d_result, 1e-300);
- ret_val = __llvm_libc::sscanf("1.0e600", "%LA", &ld_result);
+ ret_val = LIBC_NAMESPACE::sscanf("1.0e600", "%LA", &ld_result);
EXPECT_EQ(ret_val, 1);
// 1e600 may be larger than the maximum long double (if long double is double).
// In that case both of these should be evaluated as inf.
@@ -336,12 +337,12 @@ TEST(LlvmLibcSScanfTest, FloatConvLongNumber) {
// 32 characters
ret_val =
- __llvm_libc::sscanf("123456789012345678901234567890.0", "%f", &result);
+ LIBC_NAMESPACE::sscanf("123456789012345678901234567890.0", "%f", &result);
EXPECT_EQ(ret_val, 1);
EXPECT_FP_EQ(result, 123456789012345678901234567890.0f);
// 64 characters
- ret_val = __llvm_libc::sscanf(
+ ret_val = LIBC_NAMESPACE::sscanf(
"123456789012345678901234567890123456789012345678901234567890.000", "%la",
&d_result);
EXPECT_EQ(ret_val, 1);
@@ -350,7 +351,7 @@ TEST(LlvmLibcSScanfTest, FloatConvLongNumber) {
123456789012345678901234567890123456789012345678901234567890.000);
// 128 characters
- ret_val = __llvm_libc::sscanf(
+ ret_val = LIBC_NAMESPACE::sscanf(
"123456789012345678901234567890123456789012345678901234567890"
"123456789012345678901234567890123456789012345678901234567890.0000000",
"%le", &d_result);
@@ -360,29 +361,29 @@ TEST(LlvmLibcSScanfTest, FloatConvLongNumber) {
123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890.0000000);
// 256 characters
- ret_val = __llvm_libc::sscanf("10000000000000000000000000000000"
- "00000000000000000000000000000000"
- "00000000000000000000000000000000"
- "00000000000000000000000000000000"
- "00000000000000000000000000000000"
- "00000000000000000000000000000000"
- "00000000000000000000000000000000"
- "00000000000000000000000000000000",
- "%lf", &d_result);
+ ret_val = LIBC_NAMESPACE::sscanf("10000000000000000000000000000000"
+ "00000000000000000000000000000000"
+ "00000000000000000000000000000000"
+ "00000000000000000000000000000000"
+ "00000000000000000000000000000000"
+ "00000000000000000000000000000000"
+ "00000000000000000000000000000000"
+ "00000000000000000000000000000000",
+ "%lf", &d_result);
EXPECT_EQ(ret_val, 1);
EXPECT_FP_EQ(d_result, 1e255);
// 288 characters
- ret_val = __llvm_libc::sscanf("10000000000000000000000000000000"
- "00000000000000000000000000000000"
- "00000000000000000000000000000000"
- "00000000000000000000000000000000"
- "00000000000000000000000000000000"
- "00000000000000000000000000000000"
- "00000000000000000000000000000000"
- "00000000000000000000000000000000"
- "00000000000000000000000000000000",
- "%lf", &d_result);
+ ret_val = LIBC_NAMESPACE::sscanf("10000000000000000000000000000000"
+ "00000000000000000000000000000000"
+ "00000000000000000000000000000000"
+ "00000000000000000000000000000000"
+ "00000000000000000000000000000000"
+ "00000000000000000000000000000000"
+ "00000000000000000000000000000000"
+ "00000000000000000000000000000000"
+ "00000000000000000000000000000000",
+ "%lf", &d_result);
EXPECT_EQ(ret_val, 1);
EXPECT_FP_EQ(d_result, 1e287);
}
@@ -391,48 +392,48 @@ TEST(LlvmLibcSScanfTest, FloatConvComplexParsing) {
int ret_val;
float result = 0;
- float inf = __llvm_libc::fputil::FPBits<float>::inf().get_val();
- float nan = __llvm_libc::fputil::FPBits<float>::build_nan(1);
+ float inf = LIBC_NAMESPACE::fputil::FPBits<float>::inf().get_val();
+ float nan = LIBC_NAMESPACE::fputil::FPBits<float>::build_nan(1);
- ret_val = __llvm_libc::sscanf("0x1.0e3", "%f", &result);
+ ret_val = LIBC_NAMESPACE::sscanf("0x1.0e3", "%f", &result);
EXPECT_EQ(ret_val, 1);
EXPECT_FP_EQ(result, 0x1.0e3p0);
- ret_val = __llvm_libc::sscanf("", "%a", &result);
+ ret_val = LIBC_NAMESPACE::sscanf("", "%a", &result);
EXPECT_EQ(ret_val, 0);
- ret_val = __llvm_libc::sscanf("+", "%a", &result);
+ ret_val = LIBC_NAMESPACE::sscanf("+", "%a", &result);
EXPECT_EQ(ret_val, 0);
- ret_val = __llvm_libc::sscanf("-", "%a", &result);
+ ret_val = LIBC_NAMESPACE::sscanf("-", "%a", &result);
EXPECT_EQ(ret_val, 0);
- ret_val = __llvm_libc::sscanf("+.", "%a", &result);
+ ret_val = LIBC_NAMESPACE::sscanf("+.", "%a", &result);
EXPECT_EQ(ret_val, 0);
- ret_val = __llvm_libc::sscanf("-.e+10", "%a", &result);
+ ret_val = LIBC_NAMESPACE::sscanf("-.e+10", "%a", &result);
EXPECT_EQ(ret_val, 0);
// This is a specific example from the standard. Its behavior diverges from
// other implementations that accept "100e" as being the same as "100e0"
- ret_val = __llvm_libc::sscanf("100er", "%a", &result);
+ ret_val = LIBC_NAMESPACE::sscanf("100er", "%a", &result);
EXPECT_EQ(ret_val, 0);
- ret_val = __llvm_libc::sscanf("nah", "%a", &result);
+ ret_val = LIBC_NAMESPACE::sscanf("nah", "%a", &result);
EXPECT_EQ(ret_val, 0);
- ret_val = __llvm_libc::sscanf("indirection", "%a", &result);
+ ret_val = LIBC_NAMESPACE::sscanf("indirection", "%a", &result);
EXPECT_EQ(ret_val, 0);
- ret_val = __llvm_libc::sscanf("infnan", "%a", &result);
+ ret_val = LIBC_NAMESPACE::sscanf("infnan", "%a", &result);
EXPECT_EQ(ret_val, 1);
EXPECT_FP_EQ(result, inf);
- ret_val = __llvm_libc::sscanf("naninf", "%a", &result);
+ ret_val = LIBC_NAMESPACE::sscanf("naninf", "%a", &result);
EXPECT_EQ(ret_val, 1);
EXPECT_FP_EQ(result, nan);
- ret_val = __llvm_libc::sscanf("infinityinfinity", "%a", &result);
+ ret_val = LIBC_NAMESPACE::sscanf("infinityinfinity", "%a", &result);
EXPECT_EQ(ret_val, 1);
EXPECT_FP_EQ(result, inf);
@@ -444,17 +445,17 @@ TEST(LlvmLibcSScanfTest, FloatConvComplexParsing) {
// one character so when it finds that the character after the second 'i' is
// not the next character in "infinity" it can't rewind to the point where it
// had just "inf".
- ret_val = __llvm_libc::sscanf("infi", "%a", &result);
+ ret_val = LIBC_NAMESPACE::sscanf("infi", "%a", &result);
EXPECT_EQ(ret_val, 0);
- ret_val = __llvm_libc::sscanf("infinite", "%a", &result);
+ ret_val = LIBC_NAMESPACE::sscanf("infinite", "%a", &result);
EXPECT_EQ(ret_val, 0);
- ret_val = __llvm_libc::sscanf("-.1e1", "%f", &result);
+ ret_val = LIBC_NAMESPACE::sscanf("-.1e1", "%f", &result);
EXPECT_EQ(ret_val, 1);
EXPECT_FP_EQ(result, -.1e1);
- ret_val = __llvm_libc::sscanf("1.2.e1", "%f", &result);
+ ret_val = LIBC_NAMESPACE::sscanf("1.2.e1", "%f", &result);
EXPECT_EQ(ret_val, 1);
EXPECT_FP_EQ(result, 1.2);
}
@@ -463,64 +464,64 @@ TEST(LlvmLibcSScanfTest, FloatConvMaxWidth) {
int ret_val;
float result = 0;
- float inf = __llvm_libc::fputil::FPBits<float>::inf().get_val();
+ float inf = LIBC_NAMESPACE::fputil::FPBits<float>::inf().get_val();
- ret_val = __llvm_libc::sscanf("123", "%3f", &result);
+ ret_val = LIBC_NAMESPACE::sscanf("123", "%3f", &result);
EXPECT_EQ(ret_val, 1);
EXPECT_FP_EQ(result, 123.0);
- ret_val = __llvm_libc::sscanf("123", "%5f", &result);
+ ret_val = LIBC_NAMESPACE::sscanf("123", "%5f", &result);
EXPECT_EQ(ret_val, 1);
EXPECT_FP_EQ(result, 123.0);
- ret_val = __llvm_libc::sscanf("456", "%1f", &result);
+ ret_val = LIBC_NAMESPACE::sscanf("456", "%1f", &result);
EXPECT_EQ(ret_val, 1);
EXPECT_FP_EQ(result, 4.0);
- ret_val = __llvm_libc::sscanf("-789", "%1f", &result);
+ ret_val = LIBC_NAMESPACE::sscanf("-789", "%1f", &result);
EXPECT_EQ(ret_val, 0);
- ret_val = __llvm_libc::sscanf("-123", "%2f", &result);
+ ret_val = LIBC_NAMESPACE::sscanf("-123", "%2f", &result);
EXPECT_EQ(ret_val, 1);
EXPECT_FP_EQ(result, -1.0);
- ret_val = __llvm_libc::sscanf("inf", "%2f", &result);
+ ret_val = LIBC_NAMESPACE::sscanf("inf", "%2f", &result);
EXPECT_EQ(ret_val, 0);
- ret_val = __llvm_libc::sscanf("nan", "%1f", &result);
+ ret_val = LIBC_NAMESPACE::sscanf("nan", "%1f", &result);
EXPECT_EQ(ret_val, 0);
- ret_val = __llvm_libc::sscanf("-inf", "%3f", &result);
+ ret_val = LIBC_NAMESPACE::sscanf("-inf", "%3f", &result);
EXPECT_EQ(ret_val, 0);
- ret_val = __llvm_libc::sscanf("-nan", "%3f", &result);
+ ret_val = LIBC_NAMESPACE::sscanf("-nan", "%3f", &result);
EXPECT_EQ(ret_val, 0);
// If the max length were not here this would fail as discussed above, but
// since the max length limits it to the 3 it succeeds.
- ret_val = __llvm_libc::sscanf("infinite", "%3f", &result);
+ ret_val = LIBC_NAMESPACE::sscanf("infinite", "%3f", &result);
EXPECT_EQ(ret_val, 1);
EXPECT_FP_EQ(result, inf);
- ret_val = __llvm_libc::sscanf("-infinite", "%4f", &result);
+ ret_val = LIBC_NAMESPACE::sscanf("-infinite", "%4f", &result);
EXPECT_EQ(ret_val, 1);
EXPECT_FP_EQ(result, -inf);
- ret_val = __llvm_libc::sscanf("01", "%1f", &result);
+ ret_val = LIBC_NAMESPACE::sscanf("01", "%1f", &result);
EXPECT_EQ(ret_val, 1);
EXPECT_FP_EQ(result, 0.0);
- ret_val = __llvm_libc::sscanf("0x1", "%2f", &result);
+ ret_val = LIBC_NAMESPACE::sscanf("0x1", "%2f", &result);
EXPECT_EQ(ret_val, 1);
EXPECT_FP_EQ(result, 0.0);
- ret_val = __llvm_libc::sscanf("100e", "%4f", &result);
+ ret_val = LIBC_NAMESPACE::sscanf("100e", "%4f", &result);
EXPECT_EQ(ret_val, 0);
- ret_val = __llvm_libc::sscanf("100e+10", "%5f", &result);
+ ret_val = LIBC_NAMESPACE::sscanf("100e+10", "%5f", &result);
EXPECT_EQ(ret_val, 0);
- ret_val = __llvm_libc::sscanf("100e10", "%5f", &result);
+ ret_val = LIBC_NAMESPACE::sscanf("100e10", "%5f", &result);
EXPECT_EQ(ret_val, 1);
EXPECT_FP_EQ(result, 100e1);
}
@@ -529,55 +530,55 @@ TEST(LlvmLibcSScanfTest, FloatConvNoWrite) {
int ret_val;
float result = 0;
- ret_val = __llvm_libc::sscanf("123", "%*f", &result);
+ ret_val = LIBC_NAMESPACE::sscanf("123", "%*f", &result);
EXPECT_EQ(ret_val, 1);
EXPECT_FP_EQ(result, 0.0);
- ret_val = __llvm_libc::sscanf("456.1", "%*a", &result);
+ ret_val = LIBC_NAMESPACE::sscanf("456.1", "%*a", &result);
EXPECT_EQ(ret_val, 1);
EXPECT_FP_EQ(result, 0.0);
- ret_val = __llvm_libc::sscanf("0x789.ap0", "%*e", &result);
+ ret_val = LIBC_NAMESPACE::sscanf("0x789.ap0", "%*e", &result);
EXPECT_EQ(ret_val, 1);
EXPECT_FP_EQ(result, 0.0);
- ret_val = __llvm_libc::sscanf("+12.0e1", "%*g", &result);
+ ret_val = LIBC_NAMESPACE::sscanf("+12.0e1", "%*g", &result);
EXPECT_EQ(ret_val, 1);
EXPECT_FP_EQ(result, 0.0);
- ret_val = __llvm_libc::sscanf("inf", "%*F", &result);
+ ret_val = LIBC_NAMESPACE::sscanf("inf", "%*F", &result);
EXPECT_EQ(ret_val, 1);
EXPECT_FP_EQ(result, 0.0);
- ret_val = __llvm_libc::sscanf("NaN", "%*A", &result);
+ ret_val = LIBC_NAMESPACE::sscanf("NaN", "%*A", &result);
EXPECT_EQ(ret_val, 1);
EXPECT_FP_EQ(result, 0.0);
- ret_val = __llvm_libc::sscanf("-InFiNiTy", "%*E", &result);
+ ret_val = LIBC_NAMESPACE::sscanf("-InFiNiTy", "%*E", &result);
EXPECT_EQ(ret_val, 1);
EXPECT_FP_EQ(result, 0.0);
- ret_val = __llvm_libc::sscanf("1e10", "%*G", &result);
+ ret_val = LIBC_NAMESPACE::sscanf("1e10", "%*G", &result);
EXPECT_EQ(ret_val, 1);
EXPECT_FP_EQ(result, 0.0);
- ret_val = __llvm_libc::sscanf(".1", "%*G", &result);
+ ret_val = LIBC_NAMESPACE::sscanf(".1", "%*G", &result);
EXPECT_EQ(ret_val, 1);
EXPECT_FP_EQ(result, 0.0);
- ret_val = __llvm_libc::sscanf("123", "%*3f", &result);
+ ret_val = LIBC_NAMESPACE::sscanf("123", "%*3f", &result);
EXPECT_EQ(ret_val, 1);
EXPECT_FP_EQ(result, 0.0);
- ret_val = __llvm_libc::sscanf("123", "%*5f", &result);
+ ret_val = LIBC_NAMESPACE::sscanf("123", "%*5f", &result);
EXPECT_EQ(ret_val, 1);
EXPECT_FP_EQ(result, 0.0);
- ret_val = __llvm_libc::sscanf("456", "%*1f", &result);
+ ret_val = LIBC_NAMESPACE::sscanf("456", "%*1f", &result);
EXPECT_EQ(ret_val, 1);
EXPECT_FP_EQ(result, 0.0);
- ret_val = __llvm_libc::sscanf("Not a float", "%*f", &result);
+ ret_val = LIBC_NAMESPACE::sscanf("Not a float", "%*f", &result);
EXPECT_EQ(ret_val, 0);
}
@@ -586,45 +587,45 @@ TEST(LlvmLibcSScanfTest, CurPosCombined) {
int result = -1;
char c_result = 0;
- ret_val = __llvm_libc::sscanf("some text", "%n", &result);
+ ret_val = LIBC_NAMESPACE::sscanf("some text", "%n", &result);
// %n doesn't count as a conversion for the return value.
EXPECT_EQ(ret_val, 0);
EXPECT_EQ(result, 0);
- ret_val = __llvm_libc::sscanf("1234567890", "12345%n", &result);
+ ret_val = LIBC_NAMESPACE::sscanf("1234567890", "12345%n", &result);
EXPECT_EQ(ret_val, 0);
EXPECT_EQ(result, 5);
- ret_val = __llvm_libc::sscanf("1234567890", "12345%n", &result);
+ ret_val = LIBC_NAMESPACE::sscanf("1234567890", "12345%n", &result);
EXPECT_EQ(ret_val, 0);
EXPECT_EQ(result, 5);
// 288 characters
- ret_val = __llvm_libc::sscanf("10000000000000000000000000000000"
- "00000000000000000000000000000000"
- "00000000000000000000000000000000"
- "00000000000000000000000000000000"
- "00000000000000000000000000000000"
- "00000000000000000000000000000000"
- "00000000000000000000000000000000"
- "00000000000000000000000000000000"
- "00000000000000000000000000000000",
- "%*d%hhn", &c_result);
+ ret_val = LIBC_NAMESPACE::sscanf("10000000000000000000000000000000"
+ "00000000000000000000000000000000"
+ "00000000000000000000000000000000"
+ "00000000000000000000000000000000"
+ "00000000000000000000000000000000"
+ "00000000000000000000000000000000"
+ "00000000000000000000000000000000"
+ "00000000000000000000000000000000"
+ "00000000000000000000000000000000",
+ "%*d%hhn", &c_result);
EXPECT_EQ(ret_val, 1);
EXPECT_EQ(c_result, char(288)); // Overflow is handled by casting.
// 320 characters
- ret_val = __llvm_libc::sscanf("10000000000000000000000000000000"
- "00000000000000000000000000000000"
- "00000000000000000000000000000000"
- "00000000000000000000000000000000"
- "00000000000000000000000000000000"
- "00000000000000000000000000000000"
- "00000000000000000000000000000000"
- "00000000000000000000000000000000"
- "00000000000000000000000000000000"
- "00000000000000000000000000000000",
- "%*d%n", &result);
+ ret_val = LIBC_NAMESPACE::sscanf("10000000000000000000000000000000"
+ "00000000000000000000000000000000"
+ "00000000000000000000000000000000"
+ "00000000000000000000000000000000"
+ "00000000000000000000000000000000"
+ "00000000000000000000000000000000"
+ "00000000000000000000000000000000"
+ "00000000000000000000000000000000"
+ "00000000000000000000000000000000"
+ "00000000000000000000000000000000",
+ "%*d%n", &result);
EXPECT_EQ(ret_val, 1);
EXPECT_EQ(result, 320);
}
@@ -633,37 +634,37 @@ TEST(LlvmLibcSScanfTest, PointerConvCombined) {
int ret_val;
void *result;
- ret_val = __llvm_libc::sscanf("(nullptr)", "%p", &result);
+ ret_val = LIBC_NAMESPACE::sscanf("(nullptr)", "%p", &result);
EXPECT_EQ(ret_val, 1);
EXPECT_EQ(result, static_cast<void *>(nullptr));
- ret_val = __llvm_libc::sscanf("(NuLlPtR)", "%p", &result);
+ ret_val = LIBC_NAMESPACE::sscanf("(NuLlPtR)", "%p", &result);
EXPECT_EQ(ret_val, 1);
EXPECT_EQ(result, static_cast<void *>(nullptr));
- ret_val = __llvm_libc::sscanf("(NULLPTR)", "%p", &result);
+ ret_val = LIBC_NAMESPACE::sscanf("(NULLPTR)", "%p", &result);
EXPECT_EQ(ret_val, 1);
EXPECT_EQ(result, static_cast<void *>(nullptr));
- ret_val = __llvm_libc::sscanf("(null)", "%p", &result);
+ ret_val = LIBC_NAMESPACE::sscanf("(null)", "%p", &result);
EXPECT_EQ(ret_val, 0);
- ret_val = __llvm_libc::sscanf("(nullptr2", "%p", &result);
+ ret_val = LIBC_NAMESPACE::sscanf("(nullptr2", "%p", &result);
EXPECT_EQ(ret_val, 0);
- ret_val = __llvm_libc::sscanf("0", "%p", &result);
+ ret_val = LIBC_NAMESPACE::sscanf("0", "%p", &result);
EXPECT_EQ(ret_val, 1);
EXPECT_EQ(result, reinterpret_cast<void *>(0));
- ret_val = __llvm_libc::sscanf("100", "%p", &result);
+ ret_val = LIBC_NAMESPACE::sscanf("100", "%p", &result);
EXPECT_EQ(ret_val, 1);
EXPECT_EQ(result, reinterpret_cast<void *>(0x100));
- ret_val = __llvm_libc::sscanf("-1", "%p", &result);
+ ret_val = LIBC_NAMESPACE::sscanf("-1", "%p", &result);
EXPECT_EQ(ret_val, 1);
EXPECT_EQ(result, reinterpret_cast<void *>(-1));
- ret_val = __llvm_libc::sscanf("0xabcDEFG", "%p", &result);
+ ret_val = LIBC_NAMESPACE::sscanf("0xabcDEFG", "%p", &result);
EXPECT_EQ(ret_val, 1);
EXPECT_EQ(result, reinterpret_cast<void *>(0xabcdef));
}
@@ -672,17 +673,17 @@ TEST(LlvmLibcSScanfTest, CombinedConv) {
int ret_val;
int result = 0;
char buffer[10];
- ret_val = __llvm_libc::sscanf("123abc", "%i%s", &result, buffer);
+ ret_val = LIBC_NAMESPACE::sscanf("123abc", "%i%s", &result, buffer);
EXPECT_EQ(ret_val, 2);
EXPECT_EQ(result, 123);
ASSERT_STREQ(buffer, "abc");
- ret_val = __llvm_libc::sscanf("0xZZZ", "%i%s", &result, buffer);
+ ret_val = LIBC_NAMESPACE::sscanf("0xZZZ", "%i%s", &result, buffer);
EXPECT_EQ(ret_val, 2);
EXPECT_EQ(result, 0);
ASSERT_STREQ(buffer, "ZZZ");
- ret_val = __llvm_libc::sscanf("0xZZZ", "%X%s", &result, buffer);
+ ret_val = LIBC_NAMESPACE::sscanf("0xZZZ", "%X%s", &result, buffer);
EXPECT_EQ(ret_val, 2);
EXPECT_EQ(result, 0);
ASSERT_STREQ(buffer, "ZZZ");
diff --git a/libc/test/src/stdio/ungetc_test.cpp b/libc/test/src/stdio/ungetc_test.cpp
index 028343d8b979334..75eecc87ef265ff 100644
--- a/libc/test/src/stdio/ungetc_test.cpp
+++ b/libc/test/src/stdio/ungetc_test.cpp
@@ -18,42 +18,43 @@
TEST(LlvmLibcUngetcTest, UngetAndReadBack) {
constexpr char FILENAME[] = "testdata/ungetc_test.test";
- ::FILE *file = __llvm_libc::fopen(FILENAME, "w");
+ ::FILE *file = LIBC_NAMESPACE::fopen(FILENAME, "w");
ASSERT_FALSE(file == nullptr);
constexpr char CONTENT[] = "abcdef";
constexpr size_t CONTENT_SIZE = sizeof(CONTENT);
- ASSERT_EQ(CONTENT_SIZE, __llvm_libc::fwrite(CONTENT, 1, CONTENT_SIZE, file));
+ ASSERT_EQ(CONTENT_SIZE,
+ LIBC_NAMESPACE::fwrite(CONTENT, 1, CONTENT_SIZE, file));
// Cannot unget to an un-readable file.
- ASSERT_EQ(EOF, __llvm_libc::ungetc('1', file));
- ASSERT_EQ(0, __llvm_libc::fclose(file));
+ ASSERT_EQ(EOF, LIBC_NAMESPACE::ungetc('1', file));
+ ASSERT_EQ(0, LIBC_NAMESPACE::fclose(file));
- file = __llvm_libc::fopen(FILENAME, "r+");
+ file = LIBC_NAMESPACE::fopen(FILENAME, "r+");
ASSERT_FALSE(file == nullptr);
char c;
- ASSERT_EQ(__llvm_libc::fread(&c, 1, 1, file), size_t(1));
+ ASSERT_EQ(LIBC_NAMESPACE::fread(&c, 1, 1, file), size_t(1));
ASSERT_EQ(c, CONTENT[0]);
- ASSERT_EQ(__llvm_libc::ungetc(int(c), file), int(c));
+ ASSERT_EQ(LIBC_NAMESPACE::ungetc(int(c), file), int(c));
char data[CONTENT_SIZE];
- ASSERT_EQ(CONTENT_SIZE, __llvm_libc::fread(data, 1, CONTENT_SIZE, file));
+ ASSERT_EQ(CONTENT_SIZE, LIBC_NAMESPACE::fread(data, 1, CONTENT_SIZE, file));
ASSERT_STREQ(CONTENT, data);
- ASSERT_EQ(0, __llvm_libc::fseek(file, 0, SEEK_SET));
+ ASSERT_EQ(0, LIBC_NAMESPACE::fseek(file, 0, SEEK_SET));
// ungetc should not fail after a seek operation.
int unget_char = 'z';
- ASSERT_EQ(unget_char, __llvm_libc::ungetc(unget_char, file));
+ ASSERT_EQ(unget_char, LIBC_NAMESPACE::ungetc(unget_char, file));
// Another unget should fail.
- ASSERT_EQ(EOF, __llvm_libc::ungetc(unget_char, file));
+ ASSERT_EQ(EOF, LIBC_NAMESPACE::ungetc(unget_char, file));
// ungetting a char at the beginning of the file will allow us to fetch
// one additional character.
char new_data[CONTENT_SIZE + 1];
ASSERT_EQ(CONTENT_SIZE + 1,
- __llvm_libc::fread(new_data, 1, CONTENT_SIZE + 1, file));
+ LIBC_NAMESPACE::fread(new_data, 1, CONTENT_SIZE + 1, file));
ASSERT_STREQ("zabcdef", new_data);
- ASSERT_EQ(size_t(1), __llvm_libc::fwrite("x", 1, 1, file));
+ ASSERT_EQ(size_t(1), LIBC_NAMESPACE::fwrite("x", 1, 1, file));
// unget should fail after a write operation.
- ASSERT_EQ(EOF, __llvm_libc::ungetc('1', file));
+ ASSERT_EQ(EOF, LIBC_NAMESPACE::ungetc('1', file));
- ASSERT_EQ(0, __llvm_libc::fclose(file));
+ ASSERT_EQ(0, LIBC_NAMESPACE::fclose(file));
}
diff --git a/libc/test/src/stdio/unlocked_fileop_test.cpp b/libc/test/src/stdio/unlocked_fileop_test.cpp
index 67ce11e25d1c5d7..cf51e8caa6a550d 100644
--- a/libc/test/src/stdio/unlocked_fileop_test.cpp
+++ b/libc/test/src/stdio/unlocked_fileop_test.cpp
@@ -22,55 +22,55 @@
TEST(LlvmLibcFILETest, UnlockedReadAndWrite) {
constexpr char fNAME[] = "testdata/unlocked_read_and_write.test";
- ::FILE *f = __llvm_libc::fopen(fNAME, "w");
+ ::FILE *f = LIBC_NAMESPACE::fopen(fNAME, "w");
ASSERT_FALSE(f == nullptr);
constexpr char CONTENT[] = "1234567890987654321";
- __llvm_libc::flockfile(f);
- ASSERT_EQ(sizeof(CONTENT) - 1,
- __llvm_libc::fwrite_unlocked(CONTENT, 1, sizeof(CONTENT) - 1, f));
+ LIBC_NAMESPACE::flockfile(f);
+ ASSERT_EQ(sizeof(CONTENT) - 1, LIBC_NAMESPACE::fwrite_unlocked(
+ CONTENT, 1, sizeof(CONTENT) - 1, f));
// Should be an error to read.
constexpr size_t READ_SIZE = 5;
char data[READ_SIZE * 2 + 1];
data[READ_SIZE * 2] = '\0';
ASSERT_EQ(size_t(0),
- __llvm_libc::fread_unlocked(data, 1, sizeof(READ_SIZE), f));
- ASSERT_NE(__llvm_libc::ferror_unlocked(f), 0);
+ LIBC_NAMESPACE::fread_unlocked(data, 1, sizeof(READ_SIZE), f));
+ ASSERT_NE(LIBC_NAMESPACE::ferror_unlocked(f), 0);
ASSERT_NE(libc_errno, 0);
libc_errno = 0;
- __llvm_libc::clearerr_unlocked(f);
- ASSERT_EQ(__llvm_libc::ferror_unlocked(f), 0);
+ LIBC_NAMESPACE::clearerr_unlocked(f);
+ ASSERT_EQ(LIBC_NAMESPACE::ferror_unlocked(f), 0);
- __llvm_libc::funlockfile(f);
- ASSERT_EQ(0, __llvm_libc::fclose(f));
+ LIBC_NAMESPACE::funlockfile(f);
+ ASSERT_EQ(0, LIBC_NAMESPACE::fclose(f));
- f = __llvm_libc::fopen(fNAME, "r");
+ f = LIBC_NAMESPACE::fopen(fNAME, "r");
ASSERT_FALSE(f == nullptr);
- __llvm_libc::flockfile(f);
- ASSERT_EQ(__llvm_libc::fread_unlocked(data, 1, READ_SIZE, f), READ_SIZE);
- ASSERT_EQ(__llvm_libc::fread_unlocked(data + READ_SIZE, 1, READ_SIZE, f),
+ LIBC_NAMESPACE::flockfile(f);
+ ASSERT_EQ(LIBC_NAMESPACE::fread_unlocked(data, 1, READ_SIZE, f), READ_SIZE);
+ ASSERT_EQ(LIBC_NAMESPACE::fread_unlocked(data + READ_SIZE, 1, READ_SIZE, f),
READ_SIZE);
// Should be an error to write.
ASSERT_EQ(size_t(0),
- __llvm_libc::fwrite_unlocked(CONTENT, 1, sizeof(CONTENT), f));
- ASSERT_NE(__llvm_libc::ferror_unlocked(f), 0);
+ LIBC_NAMESPACE::fwrite_unlocked(CONTENT, 1, sizeof(CONTENT), f));
+ ASSERT_NE(LIBC_NAMESPACE::ferror_unlocked(f), 0);
ASSERT_NE(libc_errno, 0);
libc_errno = 0;
- __llvm_libc::clearerr_unlocked(f);
- ASSERT_EQ(__llvm_libc::ferror_unlocked(f), 0);
+ LIBC_NAMESPACE::clearerr_unlocked(f);
+ ASSERT_EQ(LIBC_NAMESPACE::ferror_unlocked(f), 0);
// Reading more should trigger eof.
char large_data[sizeof(CONTENT)];
ASSERT_NE(sizeof(CONTENT),
- __llvm_libc::fread_unlocked(large_data, 1, sizeof(CONTENT), f));
- ASSERT_NE(__llvm_libc::feof_unlocked(f), 0);
+ LIBC_NAMESPACE::fread_unlocked(large_data, 1, sizeof(CONTENT), f));
+ ASSERT_NE(LIBC_NAMESPACE::feof_unlocked(f), 0);
- __llvm_libc::funlockfile(f);
+ LIBC_NAMESPACE::funlockfile(f);
ASSERT_STREQ(data, "1234567890");
- ASSERT_EQ(__llvm_libc::fclose(f), 0);
+ ASSERT_EQ(LIBC_NAMESPACE::fclose(f), 0);
}
diff --git a/libc/test/src/stdio/vfprintf_test.cpp b/libc/test/src/stdio/vfprintf_test.cpp
index 31facdb6b162126..f6db3a6b26da045 100644
--- a/libc/test/src/stdio/vfprintf_test.cpp
+++ b/libc/test/src/stdio/vfprintf_test.cpp
@@ -25,10 +25,10 @@
namespace printf_test {
#ifndef LIBC_COPT_PRINTF_USE_SYSTEM_FILE
-using __llvm_libc::fclose;
-using __llvm_libc::ferror;
-using __llvm_libc::fopen;
-using __llvm_libc::fread;
+using LIBC_NAMESPACE::fclose;
+using LIBC_NAMESPACE::ferror;
+using LIBC_NAMESPACE::fopen;
+using LIBC_NAMESPACE::fread;
#else // defined(LIBC_COPT_PRINTF_USE_SYSTEM_FILE)
using ::fclose;
using ::ferror;
@@ -41,7 +41,7 @@ int call_vfprintf(::FILE *__restrict stream, const char *__restrict format,
...) {
va_list vlist;
va_start(vlist, format);
- int ret = __llvm_libc::vfprintf(stream, format, vlist);
+ int ret = LIBC_NAMESPACE::vfprintf(stream, format, vlist);
va_end(vlist);
return ret;
}
diff --git a/libc/test/src/stdio/vprintf_test.cpp b/libc/test/src/stdio/vprintf_test.cpp
index 0710bbffe5b137a..40eba723a007071 100644
--- a/libc/test/src/stdio/vprintf_test.cpp
+++ b/libc/test/src/stdio/vprintf_test.cpp
@@ -17,7 +17,7 @@
int call_vprintf(const char *__restrict format, ...) {
va_list vlist;
va_start(vlist, format);
- int ret = __llvm_libc::vprintf(format, vlist);
+ int ret = LIBC_NAMESPACE::vprintf(format, vlist);
va_end(vlist);
return ret;
}
diff --git a/libc/test/src/stdio/vsnprintf_test.cpp b/libc/test/src/stdio/vsnprintf_test.cpp
index 08f10708b8dca3d..2aef1d71917eeeb 100644
--- a/libc/test/src/stdio/vsnprintf_test.cpp
+++ b/libc/test/src/stdio/vsnprintf_test.cpp
@@ -18,7 +18,7 @@ int call_vsnprintf(char *__restrict buffer, size_t buffsz,
const char *__restrict format, ...) {
va_list vlist;
va_start(vlist, format);
- int ret = __llvm_libc::vsnprintf(buffer, buffsz, format, vlist);
+ int ret = LIBC_NAMESPACE::vsnprintf(buffer, buffsz, format, vlist);
va_end(vlist);
return ret;
}
diff --git a/libc/test/src/stdio/vsprintf_test.cpp b/libc/test/src/stdio/vsprintf_test.cpp
index 3f0551a877f60c0..ddccdfa5cef7305 100644
--- a/libc/test/src/stdio/vsprintf_test.cpp
+++ b/libc/test/src/stdio/vsprintf_test.cpp
@@ -17,7 +17,7 @@
int call_vsprintf(char *__restrict buffer, const char *__restrict format, ...) {
va_list vlist;
va_start(vlist, format);
- int ret = __llvm_libc::vsprintf(buffer, format, vlist);
+ int ret = LIBC_NAMESPACE::vsprintf(buffer, format, vlist);
va_end(vlist);
return ret;
}
diff --git a/libc/test/src/stdlib/AtoiTest.h b/libc/test/src/stdlib/AtoiTest.h
index 923489d6644c78d..85701828c0f6b7c 100644
--- a/libc/test/src/stdlib/AtoiTest.h
+++ b/libc/test/src/stdlib/AtoiTest.h
@@ -11,9 +11,10 @@
#include <limits.h>
-using __llvm_libc::cpp::is_same_v;
+using LIBC_NAMESPACE::cpp::is_same_v;
-template <typename ReturnT> struct AtoTest : public __llvm_libc::testing::Test {
+template <typename ReturnT>
+struct AtoTest : public LIBC_NAMESPACE::testing::Test {
using FunctionT = ReturnT (*)(const char *);
void validNumbers(FunctionT func) {
diff --git a/libc/test/src/stdlib/DivTest.h b/libc/test/src/stdlib/DivTest.h
index 5867c5b7a0231c4..90fae6c4df44ff3 100644
--- a/libc/test/src/stdlib/DivTest.h
+++ b/libc/test/src/stdlib/DivTest.h
@@ -9,7 +9,7 @@
#include "test/UnitTest/Test.h"
template <typename IntType, typename ReturnType>
-class DivTest : public __llvm_libc::testing::Test {
+class DivTest : public LIBC_NAMESPACE::testing::Test {
public:
using DivFunc = ReturnType(IntType, IntType);
diff --git a/libc/test/src/stdlib/StrtolTest.h b/libc/test/src/stdlib/StrtolTest.h
index 24726b418817d11..11794c4bfe05f8a 100644
--- a/libc/test/src/stdlib/StrtolTest.h
+++ b/libc/test/src/stdlib/StrtolTest.h
@@ -15,7 +15,7 @@
#include <limits.h>
#include <stddef.h>
-using __llvm_libc::cpp::is_signed_v;
+using LIBC_NAMESPACE::cpp::is_signed_v;
static inline char int_to_b36_char(int input) {
if (input < 0 || input > 36)
@@ -26,13 +26,13 @@ static inline char int_to_b36_char(int input) {
}
template <typename ReturnT>
-struct StrtoTest : public __llvm_libc::testing::Test {
+struct StrtoTest : public LIBC_NAMESPACE::testing::Test {
using FunctionT = ReturnT (*)(const char *, char **, int);
static constexpr ReturnT T_MAX =
- __llvm_libc::cpp::numeric_limits<ReturnT>::max();
+ LIBC_NAMESPACE::cpp::numeric_limits<ReturnT>::max();
static constexpr ReturnT T_MIN =
- __llvm_libc::cpp::numeric_limits<ReturnT>::min();
+ LIBC_NAMESPACE::cpp::numeric_limits<ReturnT>::min();
void InvalidBase(FunctionT func) {
const char *ten = "10";
diff --git a/libc/test/src/stdlib/_Exit_test.cpp b/libc/test/src/stdlib/_Exit_test.cpp
index af5cd23743f6ea3..9ca0fc51aab8121 100644
--- a/libc/test/src/stdlib/_Exit_test.cpp
+++ b/libc/test/src/stdlib/_Exit_test.cpp
@@ -13,9 +13,9 @@
#include <stdlib.h>
TEST(LlvmLibcStdlib, _Exit) {
- EXPECT_EXITS([] { __llvm_libc::_Exit(1); }, 1);
- EXPECT_EXITS([] { __llvm_libc::_Exit(65); }, 65);
+ EXPECT_EXITS([] { LIBC_NAMESPACE::_Exit(1); }, 1);
+ EXPECT_EXITS([] { LIBC_NAMESPACE::_Exit(65); }, 65);
- EXPECT_EXITS([] { __llvm_libc::exit(1); }, 1);
- EXPECT_EXITS([] { __llvm_libc::exit(65); }, 65);
+ EXPECT_EXITS([] { LIBC_NAMESPACE::exit(1); }, 1);
+ EXPECT_EXITS([] { LIBC_NAMESPACE::exit(65); }, 65);
}
diff --git a/libc/test/src/stdlib/abort_test.cpp b/libc/test/src/stdlib/abort_test.cpp
index 6e6f1aeeb91e143..766c8d5fbb21a18 100644
--- a/libc/test/src/stdlib/abort_test.cpp
+++ b/libc/test/src/stdlib/abort_test.cpp
@@ -14,6 +14,6 @@
TEST(LlvmLibcStdlib, abort) {
// -1 matches against any signal, which is necessary for now until
- // __llvm_libc::abort() unblocks SIGABRT.
- EXPECT_DEATH([] { __llvm_libc::abort(); }, WITH_SIGNAL(-1));
+ // LIBC_NAMESPACE::abort() unblocks SIGABRT.
+ EXPECT_DEATH([] { LIBC_NAMESPACE::abort(); }, WITH_SIGNAL(-1));
}
diff --git a/libc/test/src/stdlib/abs_test.cpp b/libc/test/src/stdlib/abs_test.cpp
index a402253fb0695f1..171383e2c9133de 100644
--- a/libc/test/src/stdlib/abs_test.cpp
+++ b/libc/test/src/stdlib/abs_test.cpp
@@ -9,8 +9,8 @@
#include "src/stdlib/abs.h"
#include "test/UnitTest/Test.h"
-TEST(LlvmLibcAbsTest, Zero) { EXPECT_EQ(__llvm_libc::abs(0), 0); }
+TEST(LlvmLibcAbsTest, Zero) { EXPECT_EQ(LIBC_NAMESPACE::abs(0), 0); }
-TEST(LlvmLibcAbsTest, Positive) { EXPECT_EQ(__llvm_libc::abs(1), 1); }
+TEST(LlvmLibcAbsTest, Positive) { EXPECT_EQ(LIBC_NAMESPACE::abs(1), 1); }
-TEST(LlvmLibcAbsTest, Negative) { EXPECT_EQ(__llvm_libc::abs(-1), 1); }
+TEST(LlvmLibcAbsTest, Negative) { EXPECT_EQ(LIBC_NAMESPACE::abs(-1), 1); }
diff --git a/libc/test/src/stdlib/atexit_test.cpp b/libc/test/src/stdlib/atexit_test.cpp
index eb295adfb719a00..8a785ccb8cce20a 100644
--- a/libc/test/src/stdlib/atexit_test.cpp
+++ b/libc/test/src/stdlib/atexit_test.cpp
@@ -18,38 +18,39 @@ TEST(LlvmLibcAtExit, Basic) {
a = 0;
auto test = [] {
- int status = __llvm_libc::atexit(+[] {
+ int status = LIBC_NAMESPACE::atexit(+[] {
if (a != 1)
__builtin_trap();
});
- status |= __llvm_libc::atexit(+[] { a++; });
+ status |= LIBC_NAMESPACE::atexit(+[] { a++; });
if (status)
__builtin_trap();
- __llvm_libc::exit(0);
+ LIBC_NAMESPACE::exit(0);
};
EXPECT_EXITS(test, 0);
}
TEST(LlvmLibcAtExit, AtExitCallsSysExit) {
auto test = [] {
- __llvm_libc::atexit(+[] { _Exit(1); });
- __llvm_libc::exit(0);
+ LIBC_NAMESPACE::atexit(+[] { _Exit(1); });
+ LIBC_NAMESPACE::exit(0);
};
EXPECT_EXITS(test, 1);
}
static int size;
-static __llvm_libc::cpp::array<int, 256> arr;
+static LIBC_NAMESPACE::cpp::array<int, 256> arr;
template <int... Ts>
-void register_atexit_handlers(__llvm_libc::cpp::integer_sequence<int, Ts...>) {
- (__llvm_libc::atexit(+[] { arr[size++] = Ts; }), ...);
+void register_atexit_handlers(
+ LIBC_NAMESPACE::cpp::integer_sequence<int, Ts...>) {
+ (LIBC_NAMESPACE::atexit(+[] { arr[size++] = Ts; }), ...);
}
template <int count> constexpr auto getTest() {
return [] {
- __llvm_libc::atexit(+[] {
+ LIBC_NAMESPACE::atexit(+[] {
if (size != count)
__builtin_trap();
for (int i = 0; i < count; i++)
@@ -57,8 +58,8 @@ template <int count> constexpr auto getTest() {
__builtin_trap();
});
register_atexit_handlers(
- __llvm_libc::cpp::make_integer_sequence<int, count>{});
- __llvm_libc::exit(0);
+ LIBC_NAMESPACE::cpp::make_integer_sequence<int, count>{});
+ LIBC_NAMESPACE::exit(0);
};
}
@@ -80,9 +81,9 @@ TEST(LlvmLibcAtExit, Many) {
TEST(LlvmLibcAtExit, HandlerCallsAtExit) {
auto test = [] {
- __llvm_libc::atexit(
- +[] { __llvm_libc::atexit(+[] { __llvm_libc::exit(1); }); });
- __llvm_libc::exit(0);
+ LIBC_NAMESPACE::atexit(
+ +[] { LIBC_NAMESPACE::atexit(+[] { LIBC_NAMESPACE::exit(1); }); });
+ LIBC_NAMESPACE::exit(0);
};
EXPECT_EXITS(test, 1);
}
diff --git a/libc/test/src/stdlib/atof_test.cpp b/libc/test/src/stdlib/atof_test.cpp
index efa9f6c96d365de..ed3d4c26308cb23 100644
--- a/libc/test/src/stdlib/atof_test.cpp
+++ b/libc/test/src/stdlib/atof_test.cpp
@@ -16,21 +16,21 @@
#include <limits.h>
#include <stddef.h>
-using __llvm_libc::testing::ErrnoSetterMatcher::Succeeds;
+using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds;
// This is just a simple test to make sure that this function works at all. It's
// functionally identical to strtod so the bulk of the testing is there.
TEST(LlvmLibcAToFTest, SimpleTest) {
- __llvm_libc::fputil::FPBits<double> expected_fp =
- __llvm_libc::fputil::FPBits<double>(uint64_t(0x405ec00000000000));
+ LIBC_NAMESPACE::fputil::FPBits<double> expected_fp =
+ LIBC_NAMESPACE::fputil::FPBits<double>(uint64_t(0x405ec00000000000));
libc_errno = 0;
- EXPECT_THAT(__llvm_libc::atof("123"),
+ EXPECT_THAT(LIBC_NAMESPACE::atof("123"),
Succeeds<double>(static_cast<double>(expected_fp)));
}
TEST(LlvmLibcAToFTest, FailedParsingTest) {
libc_errno = 0;
// atof does not flag errors.
- EXPECT_THAT(__llvm_libc::atof("???"), Succeeds<double>(0.0));
+ EXPECT_THAT(LIBC_NAMESPACE::atof("???"), Succeeds<double>(0.0));
}
diff --git a/libc/test/src/stdlib/atoi_test.cpp b/libc/test/src/stdlib/atoi_test.cpp
index 6fbde557e1f0421..4973fbb3c1da4ef 100644
--- a/libc/test/src/stdlib/atoi_test.cpp
+++ b/libc/test/src/stdlib/atoi_test.cpp
@@ -12,4 +12,4 @@
#include "test/UnitTest/Test.h"
-ATOI_TEST(Atoi, __llvm_libc::atoi)
+ATOI_TEST(Atoi, LIBC_NAMESPACE::atoi)
diff --git a/libc/test/src/stdlib/atol_test.cpp b/libc/test/src/stdlib/atol_test.cpp
index ad1cbba94650324..cc817087d05f958 100644
--- a/libc/test/src/stdlib/atol_test.cpp
+++ b/libc/test/src/stdlib/atol_test.cpp
@@ -12,4 +12,4 @@
#include "test/UnitTest/Test.h"
-ATOI_TEST(Atol, __llvm_libc::atol)
+ATOI_TEST(Atol, LIBC_NAMESPACE::atol)
diff --git a/libc/test/src/stdlib/atoll_test.cpp b/libc/test/src/stdlib/atoll_test.cpp
index 8052f2fb15b69a6..0c7a1331da29f3b 100644
--- a/libc/test/src/stdlib/atoll_test.cpp
+++ b/libc/test/src/stdlib/atoll_test.cpp
@@ -12,4 +12,4 @@
#include "test/UnitTest/Test.h"
-ATOI_TEST(Atoll, __llvm_libc::atoll)
+ATOI_TEST(Atoll, LIBC_NAMESPACE::atoll)
diff --git a/libc/test/src/stdlib/bsearch_test.cpp b/libc/test/src/stdlib/bsearch_test.cpp
index 4726f28c129a632..689145806ba8d3b 100644
--- a/libc/test/src/stdlib/bsearch_test.cpp
+++ b/libc/test/src/stdlib/bsearch_test.cpp
@@ -25,13 +25,14 @@ static int int_compare(const void *l, const void *r) {
TEST(LlvmLibcBsearchTest, ErrorInputs) {
int val = 123;
- EXPECT_TRUE(__llvm_libc::bsearch(nullptr, &val, 1, sizeof(int),
- int_compare) == nullptr);
- EXPECT_TRUE(__llvm_libc::bsearch(&val, nullptr, 1, sizeof(int),
- int_compare) == nullptr);
- EXPECT_TRUE(__llvm_libc::bsearch(&val, &val, 0, sizeof(int), int_compare) ==
+ EXPECT_TRUE(LIBC_NAMESPACE::bsearch(nullptr, &val, 1, sizeof(int),
+ int_compare) == nullptr);
+ EXPECT_TRUE(LIBC_NAMESPACE::bsearch(&val, nullptr, 1, sizeof(int),
+ int_compare) == nullptr);
+ EXPECT_TRUE(LIBC_NAMESPACE::bsearch(&val, &val, 0, sizeof(int),
+ int_compare) == nullptr);
+ EXPECT_TRUE(LIBC_NAMESPACE::bsearch(&val, &val, 1, 0, int_compare) ==
nullptr);
- EXPECT_TRUE(__llvm_libc::bsearch(&val, &val, 1, 0, int_compare) == nullptr);
}
TEST(LlvmLibcBsearchTest, IntegerArray) {
@@ -45,7 +46,7 @@ TEST(LlvmLibcBsearchTest, IntegerArray) {
for (size_t i = 0; i < s; ++i) {
int key = ARRAY[i];
void *elem =
- __llvm_libc::bsearch(&key, ARRAY, s, sizeof(int), int_compare);
+ LIBC_NAMESPACE::bsearch(&key, ARRAY, s, sizeof(int), int_compare);
ASSERT_EQ(*reinterpret_cast<int *>(elem), key);
}
}
@@ -53,26 +54,26 @@ TEST(LlvmLibcBsearchTest, IntegerArray) {
// Non existent keys
for (size_t s = 1; s <= ARRAY_SIZE; ++s) {
int key = 5;
- ASSERT_TRUE(__llvm_libc::bsearch(&key, &ARRAY, s, sizeof(int),
- int_compare) == nullptr);
+ ASSERT_TRUE(LIBC_NAMESPACE::bsearch(&key, &ARRAY, s, sizeof(int),
+ int_compare) == nullptr);
key = 125;
- ASSERT_TRUE(__llvm_libc::bsearch(&key, &ARRAY, s, sizeof(int),
- int_compare) == nullptr);
+ ASSERT_TRUE(LIBC_NAMESPACE::bsearch(&key, &ARRAY, s, sizeof(int),
+ int_compare) == nullptr);
key = 136;
- ASSERT_TRUE(__llvm_libc::bsearch(&key, &ARRAY, s, sizeof(int),
- int_compare) == nullptr);
+ ASSERT_TRUE(LIBC_NAMESPACE::bsearch(&key, &ARRAY, s, sizeof(int),
+ int_compare) == nullptr);
key = 12345;
- ASSERT_TRUE(__llvm_libc::bsearch(&key, &ARRAY, s, sizeof(int),
- int_compare) == nullptr);
+ ASSERT_TRUE(LIBC_NAMESPACE::bsearch(&key, &ARRAY, s, sizeof(int),
+ int_compare) == nullptr);
}
}
TEST(LlvmLibcBsearchTest, SameKeyAndArray) {
constexpr int ARRAY[5] = {1, 2, 3, 4, 5};
constexpr size_t ARRAY_SIZE = sizeof(ARRAY) / sizeof(int);
- void *elem =
- __llvm_libc::bsearch(ARRAY, ARRAY, ARRAY_SIZE, sizeof(int), int_compare);
+ void *elem = LIBC_NAMESPACE::bsearch(ARRAY, ARRAY, ARRAY_SIZE, sizeof(int),
+ int_compare);
EXPECT_EQ(*reinterpret_cast<int *>(elem), ARRAY[0]);
}
diff --git a/libc/test/src/stdlib/div_test.cpp b/libc/test/src/stdlib/div_test.cpp
index 6b1f20d18685468..d06b8348b6464e2 100644
--- a/libc/test/src/stdlib/div_test.cpp
+++ b/libc/test/src/stdlib/div_test.cpp
@@ -12,4 +12,4 @@
#include <stdlib.h>
-LIST_DIV_TESTS(int, div_t, __llvm_libc::div)
+LIST_DIV_TESTS(int, div_t, LIBC_NAMESPACE::div)
diff --git a/libc/test/src/stdlib/labs_test.cpp b/libc/test/src/stdlib/labs_test.cpp
index 1209d174331e323..535d1da5d5f4a62 100644
--- a/libc/test/src/stdlib/labs_test.cpp
+++ b/libc/test/src/stdlib/labs_test.cpp
@@ -9,8 +9,8 @@
#include "src/stdlib/labs.h"
#include "test/UnitTest/Test.h"
-TEST(LlvmLibcLabsTest, Zero) { EXPECT_EQ(__llvm_libc::labs(0l), 0l); }
+TEST(LlvmLibcLabsTest, Zero) { EXPECT_EQ(LIBC_NAMESPACE::labs(0l), 0l); }
-TEST(LlvmLibcLabsTest, Positive) { EXPECT_EQ(__llvm_libc::labs(1l), 1l); }
+TEST(LlvmLibcLabsTest, Positive) { EXPECT_EQ(LIBC_NAMESPACE::labs(1l), 1l); }
-TEST(LlvmLibcLabsTest, Negative) { EXPECT_EQ(__llvm_libc::labs(-1l), 1l); }
+TEST(LlvmLibcLabsTest, Negative) { EXPECT_EQ(LIBC_NAMESPACE::labs(-1l), 1l); }
diff --git a/libc/test/src/stdlib/ldiv_test.cpp b/libc/test/src/stdlib/ldiv_test.cpp
index d28d38789a71689..6b84163d6547482 100644
--- a/libc/test/src/stdlib/ldiv_test.cpp
+++ b/libc/test/src/stdlib/ldiv_test.cpp
@@ -12,4 +12,4 @@
#include <stdlib.h>
-LIST_DIV_TESTS(long, ldiv_t, __llvm_libc::ldiv)
+LIST_DIV_TESTS(long, ldiv_t, LIBC_NAMESPACE::ldiv)
diff --git a/libc/test/src/stdlib/llabs_test.cpp b/libc/test/src/stdlib/llabs_test.cpp
index 13ed4f8f1c523c3..a6dfa4655f28ae2 100644
--- a/libc/test/src/stdlib/llabs_test.cpp
+++ b/libc/test/src/stdlib/llabs_test.cpp
@@ -9,8 +9,12 @@
#include "src/stdlib/llabs.h"
#include "test/UnitTest/Test.h"
-TEST(LlvmLibcLlabsTest, Zero) { EXPECT_EQ(__llvm_libc::llabs(0ll), 0ll); }
+TEST(LlvmLibcLlabsTest, Zero) { EXPECT_EQ(LIBC_NAMESPACE::llabs(0ll), 0ll); }
-TEST(LlvmLibcLlabsTest, Positive) { EXPECT_EQ(__llvm_libc::llabs(1ll), 1ll); }
+TEST(LlvmLibcLlabsTest, Positive) {
+ EXPECT_EQ(LIBC_NAMESPACE::llabs(1ll), 1ll);
+}
-TEST(LlvmLibcLlabsTest, Negative) { EXPECT_EQ(__llvm_libc::llabs(-1ll), 1ll); }
+TEST(LlvmLibcLlabsTest, Negative) {
+ EXPECT_EQ(LIBC_NAMESPACE::llabs(-1ll), 1ll);
+}
diff --git a/libc/test/src/stdlib/lldiv_test.cpp b/libc/test/src/stdlib/lldiv_test.cpp
index 5fa0de23f930c78..d803894fa862cc3 100644
--- a/libc/test/src/stdlib/lldiv_test.cpp
+++ b/libc/test/src/stdlib/lldiv_test.cpp
@@ -12,4 +12,4 @@
#include <stdlib.h>
-LIST_DIV_TESTS(long long, lldiv_t, __llvm_libc::lldiv)
+LIST_DIV_TESTS(long long, lldiv_t, LIBC_NAMESPACE::lldiv)
diff --git a/libc/test/src/stdlib/malloc_test.cpp b/libc/test/src/stdlib/malloc_test.cpp
index 579d5dca53f0076..d9023cf56d9feaf 100644
--- a/libc/test/src/stdlib/malloc_test.cpp
+++ b/libc/test/src/stdlib/malloc_test.cpp
@@ -11,9 +11,9 @@
#include "test/UnitTest/Test.h"
TEST(LlvmLibcMallocTest, Allocate) {
- int *ptr = reinterpret_cast<int *>(__llvm_libc::malloc(sizeof(int)));
+ int *ptr = reinterpret_cast<int *>(LIBC_NAMESPACE::malloc(sizeof(int)));
EXPECT_NE(reinterpret_cast<void *>(ptr), static_cast<void *>(nullptr));
*ptr = 1;
EXPECT_EQ(*ptr, 1);
- __llvm_libc::free(ptr);
+ LIBC_NAMESPACE::free(ptr);
}
diff --git a/libc/test/src/stdlib/qsort_r_test.cpp b/libc/test/src/stdlib/qsort_r_test.cpp
index ceb58fc1e896ae0..2c810f411b03e21 100644
--- a/libc/test/src/stdlib/qsort_r_test.cpp
+++ b/libc/test/src/stdlib/qsort_r_test.cpp
@@ -33,8 +33,8 @@ TEST(LlvmLibcQsortRTest, SortedArray) {
size_t count = 0;
- __llvm_libc::qsort_r(array, ARRAY_SIZE, sizeof(int), int_compare_count,
- &count);
+ LIBC_NAMESPACE::qsort_r(array, ARRAY_SIZE, sizeof(int), int_compare_count,
+ &count);
ASSERT_LE(array[0], 10);
ASSERT_LE(array[1], 23);
@@ -74,8 +74,8 @@ TEST(LlvmLibcQsortRTest, ReverseSortedArray) {
size_t count = 0;
- __llvm_libc::qsort_r(array, ARRAY_SIZE, sizeof(int), int_compare_count,
- &count);
+ LIBC_NAMESPACE::qsort_r(array, ARRAY_SIZE, sizeof(int), int_compare_count,
+ &count);
for (int i = 0; i < int(ARRAY_SIZE - 1); ++i)
ASSERT_LE(array[i], i + 1);
@@ -127,9 +127,9 @@ TEST(LlvmLibcQsortRTest, SafeTypeErasure) {
};
constexpr size_t ARRAY_SIZE = sizeof(array) / sizeof(PriorityVal);
- __llvm_libc::qsort_r(array, ARRAY_SIZE, sizeof(PriorityVal),
- type_erased_comp<PriorityVal>,
- reinterpret_cast<void *>(compare_priority_val));
+ LIBC_NAMESPACE::qsort_r(array, ARRAY_SIZE, sizeof(PriorityVal),
+ type_erased_comp<PriorityVal>,
+ reinterpret_cast<void *>(compare_priority_val));
EXPECT_EQ(array[0].priority, -1);
EXPECT_EQ(array[0].size, 100);
diff --git a/libc/test/src/stdlib/qsort_test.cpp b/libc/test/src/stdlib/qsort_test.cpp
index 9808ad0dcc275c1..0822d490e65208b 100644
--- a/libc/test/src/stdlib/qsort_test.cpp
+++ b/libc/test/src/stdlib/qsort_test.cpp
@@ -29,7 +29,7 @@ TEST(LlvmLibcQsortTest, SortedArray) {
1133, 1135, 1155, 1170, 1171, 11100, 12310};
constexpr size_t ARRAY_SIZE = sizeof(array) / sizeof(int);
- __llvm_libc::qsort(array, ARRAY_SIZE, sizeof(int), int_compare);
+ LIBC_NAMESPACE::qsort(array, ARRAY_SIZE, sizeof(int), int_compare);
ASSERT_LE(array[0], 10);
ASSERT_LE(array[1], 23);
@@ -63,7 +63,7 @@ TEST(LlvmLibcQsortTest, ReverseSortedArray) {
12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1};
constexpr size_t ARRAY_SIZE = sizeof(array) / sizeof(int);
- __llvm_libc::qsort(array, ARRAY_SIZE, sizeof(int), int_compare);
+ LIBC_NAMESPACE::qsort(array, ARRAY_SIZE, sizeof(int), int_compare);
for (int i = 0; i < int(ARRAY_SIZE - 1); ++i)
ASSERT_LE(array[i], i + 1);
@@ -75,7 +75,7 @@ TEST(LlvmLibcQsortTest, AllEqualElements) {
100, 100, 100, 100, 100, 100, 100};
constexpr size_t ARRAY_SIZE = sizeof(array) / sizeof(int);
- __llvm_libc::qsort(array, ARRAY_SIZE, sizeof(int), int_compare);
+ LIBC_NAMESPACE::qsort(array, ARRAY_SIZE, sizeof(int), int_compare);
for (size_t i = 0; i < ARRAY_SIZE - 1; ++i)
ASSERT_LE(array[i], 100);
@@ -86,7 +86,7 @@ TEST(LlvmLibcQsortTest, UnsortedArray1) {
60, 171, 11, 1, -1, -5, -10, 1155, 1170, 1171, 12, -100};
constexpr size_t ARRAY_SIZE = sizeof(array) / sizeof(int);
- __llvm_libc::qsort(array, ARRAY_SIZE, sizeof(int), int_compare);
+ LIBC_NAMESPACE::qsort(array, ARRAY_SIZE, sizeof(int), int_compare);
ASSERT_LE(array[0], -100);
ASSERT_LE(array[1], -10);
@@ -119,7 +119,7 @@ TEST(LlvmLibcQsortTest, UnsortedArray2) {
int array[7] = {10, 40, 45, 55, 35, 23, 60};
constexpr size_t ARRAY_SIZE = sizeof(array) / sizeof(int);
- __llvm_libc::qsort(array, ARRAY_SIZE, sizeof(int), int_compare);
+ LIBC_NAMESPACE::qsort(array, ARRAY_SIZE, sizeof(int), int_compare);
ASSERT_LE(array[0], 10);
ASSERT_LE(array[1], 23);
@@ -134,7 +134,7 @@ TEST(LlvmLibcQsortTest, UnsortedArrayDuplicateElements1) {
int array[6] = {10, 10, 20, 20, 5, 5};
constexpr size_t ARRAY_SIZE = sizeof(array) / sizeof(int);
- __llvm_libc::qsort(array, ARRAY_SIZE, sizeof(int), int_compare);
+ LIBC_NAMESPACE::qsort(array, ARRAY_SIZE, sizeof(int), int_compare);
ASSERT_LE(array[0], 5);
ASSERT_LE(array[1], 5);
@@ -148,7 +148,7 @@ TEST(LlvmLibcQsortTest, UnsortedArrayDuplicateElements2) {
int array[10] = {20, 10, 10, 10, 10, 20, 21, 21, 21, 21};
constexpr size_t ARRAY_SIZE = sizeof(array) / sizeof(int);
- __llvm_libc::qsort(array, ARRAY_SIZE, sizeof(int), int_compare);
+ LIBC_NAMESPACE::qsort(array, ARRAY_SIZE, sizeof(int), int_compare);
ASSERT_LE(array[0], 10);
ASSERT_LE(array[1], 10);
@@ -166,7 +166,7 @@ TEST(LlvmLibcQsortTest, UnsortedArrayDuplicateElements3) {
int array[10] = {20, 30, 30, 30, 30, 20, 21, 21, 21, 21};
constexpr size_t ARRAY_SIZE = sizeof(array) / sizeof(int);
- __llvm_libc::qsort(array, ARRAY_SIZE, sizeof(int), int_compare);
+ LIBC_NAMESPACE::qsort(array, ARRAY_SIZE, sizeof(int), int_compare);
ASSERT_LE(array[0], 20);
ASSERT_LE(array[1], 20);
@@ -184,7 +184,7 @@ TEST(LlvmLibcQsortTest, UnsortedThreeElementArray1) {
int array[3] = {14999024, 0, 3};
constexpr size_t ARRAY_SIZE = sizeof(array) / sizeof(int);
- __llvm_libc::qsort(array, ARRAY_SIZE, sizeof(int), int_compare);
+ LIBC_NAMESPACE::qsort(array, ARRAY_SIZE, sizeof(int), int_compare);
ASSERT_LE(array[0], 0);
ASSERT_LE(array[1], 3);
@@ -195,7 +195,7 @@ TEST(LlvmLibcQsortTest, UnsortedThreeElementArray2) {
int array[3] = {3, 14999024, 0};
constexpr size_t ARRAY_SIZE = sizeof(array) / sizeof(int);
- __llvm_libc::qsort(array, ARRAY_SIZE, sizeof(int), int_compare);
+ LIBC_NAMESPACE::qsort(array, ARRAY_SIZE, sizeof(int), int_compare);
ASSERT_LE(array[0], 0);
ASSERT_LE(array[1], 3);
@@ -206,7 +206,7 @@ TEST(LlvmLibcQsortTest, UnsortedThreeElementArray3) {
int array[3] = {3, 0, 14999024};
constexpr size_t ARRAY_SIZE = sizeof(array) / sizeof(int);
- __llvm_libc::qsort(array, ARRAY_SIZE, sizeof(int), int_compare);
+ LIBC_NAMESPACE::qsort(array, ARRAY_SIZE, sizeof(int), int_compare);
ASSERT_LE(array[0], 0);
ASSERT_LE(array[1], 3);
@@ -217,7 +217,7 @@ TEST(LlvmLibcQsortTest, SameElementThreeElementArray) {
int array[3] = {12345, 12345, 12345};
constexpr size_t ARRAY_SIZE = sizeof(array) / sizeof(int);
- __llvm_libc::qsort(array, ARRAY_SIZE, sizeof(int), int_compare);
+ LIBC_NAMESPACE::qsort(array, ARRAY_SIZE, sizeof(int), int_compare);
ASSERT_LE(array[0], 12345);
ASSERT_LE(array[1], 12345);
@@ -228,7 +228,7 @@ TEST(LlvmLibcQsortTest, UnsortedTwoElementArray1) {
int array[2] = {14999024, 0};
constexpr size_t ARRAY_SIZE = sizeof(array) / sizeof(int);
- __llvm_libc::qsort(array, ARRAY_SIZE, sizeof(int), int_compare);
+ LIBC_NAMESPACE::qsort(array, ARRAY_SIZE, sizeof(int), int_compare);
ASSERT_LE(array[0], 0);
ASSERT_LE(array[1], 14999024);
@@ -238,7 +238,7 @@ TEST(LlvmLibcQsortTest, UnsortedTwoElementArray2) {
int array[2] = {0, 14999024};
constexpr size_t ARRAY_SIZE = sizeof(array) / sizeof(int);
- __llvm_libc::qsort(array, ARRAY_SIZE, sizeof(int), int_compare);
+ LIBC_NAMESPACE::qsort(array, ARRAY_SIZE, sizeof(int), int_compare);
ASSERT_LE(array[0], 0);
ASSERT_LE(array[1], 14999024);
@@ -248,7 +248,7 @@ TEST(LlvmLibcQsortTest, SameElementTwoElementArray) {
int array[2] = {12345, 12345};
constexpr size_t ARRAY_SIZE = sizeof(array) / sizeof(int);
- __llvm_libc::qsort(array, ARRAY_SIZE, sizeof(int), int_compare);
+ LIBC_NAMESPACE::qsort(array, ARRAY_SIZE, sizeof(int), int_compare);
ASSERT_LE(array[0], 12345);
ASSERT_LE(array[1], 12345);
@@ -259,7 +259,7 @@ TEST(LlvmLibcQSortTest, SingleElementArray) {
int array[1] = {ELEM};
constexpr size_t ARRAY_SIZE = sizeof(array) / sizeof(int);
- __llvm_libc::qsort(array, ARRAY_SIZE, sizeof(int), int_compare);
+ LIBC_NAMESPACE::qsort(array, ARRAY_SIZE, sizeof(int), int_compare);
ASSERT_LE(array[0], ELEM);
}
diff --git a/libc/test/src/stdlib/rand_test.cpp b/libc/test/src/stdlib/rand_test.cpp
index 4bebbe37ffbe114..6f25708e539053d 100644
--- a/libc/test/src/stdlib/rand_test.cpp
+++ b/libc/test/src/stdlib/rand_test.cpp
@@ -17,7 +17,7 @@ TEST(LlvmLibcRandTest, UnsetSeed) {
static int vals[1000];
for (size_t i = 0; i < 1000; ++i) {
- int val = __llvm_libc::rand();
+ int val = LIBC_NAMESPACE::rand();
ASSERT_GE(val, 0);
ASSERT_LE(val, RAND_MAX);
vals[i] = val;
@@ -26,27 +26,27 @@ TEST(LlvmLibcRandTest, UnsetSeed) {
// The C standard specifies that if 'srand' is never called it should behave
// as if 'srand' was called with a value of 1. If we seed the value with 1 we
// should get the same sequence as the unseeded version.
- __llvm_libc::srand(1);
+ LIBC_NAMESPACE::srand(1);
for (size_t i = 0; i < 1000; ++i)
- ASSERT_EQ(__llvm_libc::rand(), vals[i]);
+ ASSERT_EQ(LIBC_NAMESPACE::rand(), vals[i]);
}
TEST(LlvmLibcRandTest, SetSeed) {
const unsigned int SEED = 12344321;
- __llvm_libc::srand(SEED);
+ LIBC_NAMESPACE::srand(SEED);
const size_t NUM_RESULTS = 10;
int results[NUM_RESULTS];
for (size_t i = 0; i < NUM_RESULTS; ++i) {
- results[i] = __llvm_libc::rand();
+ results[i] = LIBC_NAMESPACE::rand();
ASSERT_GE(results[i], 0);
ASSERT_LE(results[i], RAND_MAX);
}
// If the seed is set to the same value, it should give the same sequence.
- __llvm_libc::srand(SEED);
+ LIBC_NAMESPACE::srand(SEED);
for (size_t i = 0; i < NUM_RESULTS; ++i) {
- int val = __llvm_libc::rand();
+ int val = LIBC_NAMESPACE::rand();
EXPECT_EQ(results[i], val);
}
}
diff --git a/libc/test/src/stdlib/strtod_test.cpp b/libc/test/src/stdlib/strtod_test.cpp
index 70129ba0714d44e..b1bdd89e41fd151 100644
--- a/libc/test/src/stdlib/strtod_test.cpp
+++ b/libc/test/src/stdlib/strtod_test.cpp
@@ -17,13 +17,13 @@
#include <limits.h>
#include <stddef.h>
-using __llvm_libc::fputil::testing::ForceRoundingModeTest;
-using __llvm_libc::fputil::testing::RoundingMode;
+using LIBC_NAMESPACE::fputil::testing::ForceRoundingModeTest;
+using LIBC_NAMESPACE::fputil::testing::RoundingMode;
-using __llvm_libc::testing::ErrnoSetterMatcher::Fails;
-using __llvm_libc::testing::ErrnoSetterMatcher::Succeeds;
+using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails;
+using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds;
-class LlvmLibcStrToDTest : public __llvm_libc::testing::Test,
+class LlvmLibcStrToDTest : public LIBC_NAMESPACE::testing::Test,
ForceRoundingModeTest<RoundingMode::Nearest> {
public:
void run_test(const char *inputString, const ptrdiff_t expectedStrLen,
@@ -44,11 +44,11 @@ class LlvmLibcStrToDTest : public __llvm_libc::testing::Test,
// This is so that the result can be compared in parts.
char *str_end = nullptr;
- __llvm_libc::fputil::FPBits<double> expected_fp =
- __llvm_libc::fputil::FPBits<double>(expectedRawData);
+ LIBC_NAMESPACE::fputil::FPBits<double> expected_fp =
+ LIBC_NAMESPACE::fputil::FPBits<double>(expectedRawData);
libc_errno = 0;
- double result = __llvm_libc::strtod(inputString, &str_end);
+ double result = LIBC_NAMESPACE::strtod(inputString, &str_end);
if (expectedErrno == 0)
EXPECT_THAT(result, Succeeds<double>(static_cast<double>(expected_fp)));
else
diff --git a/libc/test/src/stdlib/strtof_test.cpp b/libc/test/src/stdlib/strtof_test.cpp
index 9151cbeb88d587b..15a8a34ef4fb171 100644
--- a/libc/test/src/stdlib/strtof_test.cpp
+++ b/libc/test/src/stdlib/strtof_test.cpp
@@ -17,10 +17,10 @@
#include <limits.h>
#include <stddef.h>
-using __llvm_libc::fputil::testing::ForceRoundingModeTest;
-using __llvm_libc::fputil::testing::RoundingMode;
+using LIBC_NAMESPACE::fputil::testing::ForceRoundingModeTest;
+using LIBC_NAMESPACE::fputil::testing::RoundingMode;
-class LlvmLibcStrToFTest : public __llvm_libc::testing::Test,
+class LlvmLibcStrToFTest : public LIBC_NAMESPACE::testing::Test,
ForceRoundingModeTest<RoundingMode::Nearest> {
public:
void run_test(const char *inputString, const ptrdiff_t expectedStrLen,
@@ -41,11 +41,11 @@ class LlvmLibcStrToFTest : public __llvm_libc::testing::Test,
// This is so that the result can be compared in parts.
char *str_end = nullptr;
- __llvm_libc::fputil::FPBits<float> expected_fp =
- __llvm_libc::fputil::FPBits<float>(expectedRawData);
+ LIBC_NAMESPACE::fputil::FPBits<float> expected_fp =
+ LIBC_NAMESPACE::fputil::FPBits<float>(expectedRawData);
libc_errno = 0;
- float result = __llvm_libc::strtof(inputString, &str_end);
+ float result = LIBC_NAMESPACE::strtof(inputString, &str_end);
EXPECT_EQ(str_end - inputString, expectedStrLen);
EXPECT_FP_EQ(result, static_cast<float>(expected_fp));
diff --git a/libc/test/src/stdlib/strtoint32_test.cpp b/libc/test/src/stdlib/strtoint32_test.cpp
index fa5e57145d24caa..4ca20f3333f5601 100644
--- a/libc/test/src/stdlib/strtoint32_test.cpp
+++ b/libc/test/src/stdlib/strtoint32_test.cpp
@@ -14,7 +14,7 @@
#include "StrtolTest.h"
#include "test/UnitTest/Test.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int32_t strtoint32(const char *__restrict str, char **__restrict str_end,
int base) {
@@ -39,7 +39,7 @@ uint32_t strtouint32(const char *__restrict str, char **__restrict str_end,
return result;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
-STRTOL_TEST(Strtoint32, __llvm_libc::strtoint32)
-STRTOL_TEST(Strtouint32, __llvm_libc::strtouint32)
+STRTOL_TEST(Strtoint32, LIBC_NAMESPACE::strtoint32)
+STRTOL_TEST(Strtouint32, LIBC_NAMESPACE::strtouint32)
diff --git a/libc/test/src/stdlib/strtoint64_test.cpp b/libc/test/src/stdlib/strtoint64_test.cpp
index 95e4761881f5191..f8d807b146f2ec4 100644
--- a/libc/test/src/stdlib/strtoint64_test.cpp
+++ b/libc/test/src/stdlib/strtoint64_test.cpp
@@ -14,7 +14,7 @@
#include "StrtolTest.h"
#include "test/UnitTest/Test.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
int64_t strtoint64(const char *__restrict str, char **__restrict str_end,
int base) {
@@ -39,7 +39,7 @@ uint64_t strtouint64(const char *__restrict str, char **__restrict str_end,
return result;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
-STRTOL_TEST(Strtoint64, __llvm_libc::strtoint64)
-STRTOL_TEST(Strtouint64, __llvm_libc::strtouint64)
+STRTOL_TEST(Strtoint64, LIBC_NAMESPACE::strtoint64)
+STRTOL_TEST(Strtouint64, LIBC_NAMESPACE::strtouint64)
diff --git a/libc/test/src/stdlib/strtol_test.cpp b/libc/test/src/stdlib/strtol_test.cpp
index fb92ee6978d9bc9..a6ce262559f71f4 100644
--- a/libc/test/src/stdlib/strtol_test.cpp
+++ b/libc/test/src/stdlib/strtol_test.cpp
@@ -12,4 +12,4 @@
#include "StrtolTest.h"
-STRTOL_TEST(Strtol, __llvm_libc::strtol)
+STRTOL_TEST(Strtol, LIBC_NAMESPACE::strtol)
diff --git a/libc/test/src/stdlib/strtold_test.cpp b/libc/test/src/stdlib/strtold_test.cpp
index dfa1fb7e939b5e1..680a93188c76d1d 100644
--- a/libc/test/src/stdlib/strtold_test.cpp
+++ b/libc/test/src/stdlib/strtold_test.cpp
@@ -24,7 +24,7 @@
#define SELECT_CONST(_, __, val) val
#endif
-class LlvmLibcStrToLDTest : public __llvm_libc::testing::Test {
+class LlvmLibcStrToLDTest : public LIBC_NAMESPACE::testing::Test {
public:
#if defined(LONG_DOUBLE_IS_DOUBLE)
void run_test(const char *inputString, const ptrdiff_t expectedStrLen,
@@ -74,16 +74,16 @@ class LlvmLibcStrToLDTest : public __llvm_libc::testing::Test {
// +-- 15 Exponent Bits
char *str_end = nullptr;
- __llvm_libc::fputil::FPBits<long double> expected_fp =
- __llvm_libc::fputil::FPBits<long double>(expectedRawData);
+ LIBC_NAMESPACE::fputil::FPBits<long double> expected_fp =
+ LIBC_NAMESPACE::fputil::FPBits<long double>(expectedRawData);
const int expected_errno = expectedErrno;
libc_errno = 0;
- long double result = __llvm_libc::strtold(inputString, &str_end);
+ long double result = LIBC_NAMESPACE::strtold(inputString, &str_end);
- __llvm_libc::fputil::FPBits<long double> actual_fp =
- __llvm_libc::fputil::FPBits<long double>();
- actual_fp = __llvm_libc::fputil::FPBits<long double>(result);
+ LIBC_NAMESPACE::fputil::FPBits<long double> actual_fp =
+ LIBC_NAMESPACE::fputil::FPBits<long double>();
+ actual_fp = LIBC_NAMESPACE::fputil::FPBits<long double>(result);
EXPECT_EQ(str_end - inputString, expectedStrLen);
diff --git a/libc/test/src/stdlib/strtoll_test.cpp b/libc/test/src/stdlib/strtoll_test.cpp
index b4b197d59ea0609..8e94cdc6a389961 100644
--- a/libc/test/src/stdlib/strtoll_test.cpp
+++ b/libc/test/src/stdlib/strtoll_test.cpp
@@ -12,4 +12,4 @@
#include "StrtolTest.h"
-STRTOL_TEST(Strtoll, __llvm_libc::strtoll)
+STRTOL_TEST(Strtoll, LIBC_NAMESPACE::strtoll)
diff --git a/libc/test/src/stdlib/strtoul_test.cpp b/libc/test/src/stdlib/strtoul_test.cpp
index f2cd8603a9832ce..7ba721139dd3948 100644
--- a/libc/test/src/stdlib/strtoul_test.cpp
+++ b/libc/test/src/stdlib/strtoul_test.cpp
@@ -12,4 +12,4 @@
#include "StrtolTest.h"
-STRTOL_TEST(Strtoul, __llvm_libc::strtoul)
+STRTOL_TEST(Strtoul, LIBC_NAMESPACE::strtoul)
diff --git a/libc/test/src/stdlib/strtoull_test.cpp b/libc/test/src/stdlib/strtoull_test.cpp
index c2544060d8bd5b4..c9a0b8de46b5870 100644
--- a/libc/test/src/stdlib/strtoull_test.cpp
+++ b/libc/test/src/stdlib/strtoull_test.cpp
@@ -12,4 +12,4 @@
#include "StrtolTest.h"
-STRTOL_TEST(Strtoull, __llvm_libc::strtoull)
+STRTOL_TEST(Strtoull, LIBC_NAMESPACE::strtoull)
diff --git a/libc/test/src/string/StrchrTest.h b/libc/test/src/string/StrchrTest.h
index 71903c987cacbbb..74e172de95953e7 100644
--- a/libc/test/src/string/StrchrTest.h
+++ b/libc/test/src/string/StrchrTest.h
@@ -8,7 +8,7 @@
#include "test/UnitTest/Test.h"
-template <auto Func> struct StrchrTest : public __llvm_libc::testing::Test {
+template <auto Func> struct StrchrTest : public LIBC_NAMESPACE::testing::Test {
void findsFirstCharacter() {
const char *src = "abcde";
@@ -82,7 +82,7 @@ template <auto Func> struct StrchrTest : public __llvm_libc::testing::Test {
}
};
-template <auto Func> struct StrrchrTest : public __llvm_libc::testing::Test {
+template <auto Func> struct StrrchrTest : public LIBC_NAMESPACE::testing::Test {
void findsFirstCharacter() {
const char *src = "abcde";
diff --git a/libc/test/src/string/bcmp_test.cpp b/libc/test/src/string/bcmp_test.cpp
index 72037c73b4f5060..fa89e4d7b08f19c 100644
--- a/libc/test/src/string/bcmp_test.cpp
+++ b/libc/test/src/string/bcmp_test.cpp
@@ -11,35 +11,35 @@
#include "test/UnitTest/Test.h"
#include "test/UnitTest/TestLogger.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
TEST(LlvmLibcBcmpTest, CmpZeroByte) {
const char *lhs = "ab";
const char *rhs = "bc";
- ASSERT_EQ(__llvm_libc::bcmp(lhs, rhs, 0), 0);
+ ASSERT_EQ(LIBC_NAMESPACE::bcmp(lhs, rhs, 0), 0);
}
TEST(LlvmLibcBcmpTest, LhsRhsAreTheSame) {
const char *lhs = "ab";
const char *rhs = "ab";
- ASSERT_EQ(__llvm_libc::bcmp(lhs, rhs, 2), 0);
+ ASSERT_EQ(LIBC_NAMESPACE::bcmp(lhs, rhs, 2), 0);
}
TEST(LlvmLibcBcmpTest, LhsBeforeRhsLexically) {
const char *lhs = "ab";
const char *rhs = "ac";
- ASSERT_NE(__llvm_libc::bcmp(lhs, rhs, 2), 0);
+ ASSERT_NE(LIBC_NAMESPACE::bcmp(lhs, rhs, 2), 0);
}
TEST(LlvmLibcBcmpTest, LhsAfterRhsLexically) {
const char *lhs = "ac";
const char *rhs = "ab";
- ASSERT_NE(__llvm_libc::bcmp(lhs, rhs, 2), 0);
+ ASSERT_NE(LIBC_NAMESPACE::bcmp(lhs, rhs, 2), 0);
}
// Adapt CheckBcmp signature to bcmp.
static inline int Adaptor(cpp::span<char> p1, cpp::span<char> p2, size_t size) {
- return __llvm_libc::bcmp(p1.begin(), p2.begin(), size);
+ return LIBC_NAMESPACE::bcmp(p1.begin(), p2.begin(), size);
}
TEST(LlvmLibcBcmpTest, SizeSweep) {
@@ -57,4 +57,4 @@ TEST(LlvmLibcBcmpTest, SizeSweep) {
}
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/test/src/string/bcopy_test.cpp b/libc/test/src/string/bcopy_test.cpp
index 96541797eed338e..f8cb9208838f33f 100644
--- a/libc/test/src/string/bcopy_test.cpp
+++ b/libc/test/src/string/bcopy_test.cpp
@@ -13,16 +13,16 @@
#include "test/UnitTest/MemoryMatcher.h"
#include "test/UnitTest/Test.h"
-using __llvm_libc::cpp::array;
-using __llvm_libc::cpp::span;
+using LIBC_NAMESPACE::cpp::array;
+using LIBC_NAMESPACE::cpp::span;
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
TEST(LlvmLibcBcopyTest, MoveZeroByte) {
char Buffer[] = {'a', 'b', 'y', 'z'};
const char Expected[] = {'a', 'b', 'y', 'z'};
void *const Dst = Buffer;
- __llvm_libc::bcopy(Buffer + 2, Dst, 0);
+ LIBC_NAMESPACE::bcopy(Buffer + 2, Dst, 0);
ASSERT_MEM_EQ(Buffer, testing::MemoryView(Expected));
}
@@ -30,7 +30,7 @@ TEST(LlvmLibcBcopyTest, DstAndSrcPointToSameAddress) {
char Buffer[] = {'a', 'b'};
const char Expected[] = {'a', 'b'};
void *const Dst = Buffer;
- __llvm_libc::bcopy(Buffer, Dst, 1);
+ LIBC_NAMESPACE::bcopy(Buffer, Dst, 1);
ASSERT_MEM_EQ(Buffer, testing::MemoryView(Expected));
}
@@ -40,7 +40,7 @@ TEST(LlvmLibcBcopyTest, DstStartsBeforeSrc) {
char Buffer[] = {'z', 'a', 'b', 'c', 'z'};
const char Expected[] = {'z', 'b', 'c', 'c', 'z'};
void *const Dst = Buffer + 1;
- __llvm_libc::bcopy(Buffer + 2, Dst, 2);
+ LIBC_NAMESPACE::bcopy(Buffer + 2, Dst, 2);
ASSERT_MEM_EQ(Buffer, testing::MemoryView(Expected));
}
@@ -48,7 +48,7 @@ TEST(LlvmLibcBcopyTest, DstStartsAfterSrc) {
char Buffer[] = {'z', 'a', 'b', 'c', 'z'};
const char Expected[] = {'z', 'a', 'a', 'b', 'z'};
void *const Dst = Buffer + 2;
- __llvm_libc::bcopy(Buffer + 1, Dst, 2);
+ LIBC_NAMESPACE::bcopy(Buffer + 1, Dst, 2);
ASSERT_MEM_EQ(Buffer, testing::MemoryView(Expected));
}
@@ -60,7 +60,7 @@ TEST(LlvmLibcBcopyTest, SrcFollowDst) {
char Buffer[] = {'z', 'a', 'b', 'z'};
const char Expected[] = {'z', 'b', 'b', 'z'};
void *const Dst = Buffer + 1;
- __llvm_libc::bcopy(Buffer + 2, Dst, 1);
+ LIBC_NAMESPACE::bcopy(Buffer + 2, Dst, 1);
ASSERT_MEM_EQ(Buffer, testing::MemoryView(Expected));
}
@@ -68,14 +68,14 @@ TEST(LlvmLibcBcopyTest, DstFollowSrc) {
char Buffer[] = {'z', 'a', 'b', 'z'};
const char Expected[] = {'z', 'a', 'a', 'z'};
void *const Dst = Buffer + 2;
- __llvm_libc::bcopy(Buffer + 1, Dst, 1);
+ LIBC_NAMESPACE::bcopy(Buffer + 1, Dst, 1);
ASSERT_MEM_EQ(Buffer, testing::MemoryView(Expected));
}
// Adapt CheckMemmove signature to bcopy.
static inline void Adaptor(cpp::span<char> dst, cpp::span<char> src,
size_t size) {
- __llvm_libc::bcopy(src.begin(), dst.begin(), size);
+ LIBC_NAMESPACE::bcopy(src.begin(), dst.begin(), size);
}
TEST(LlvmLibcBcopyTest, SizeSweep) {
@@ -95,4 +95,4 @@ TEST(LlvmLibcBcopyTest, SizeSweep) {
}
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/test/src/string/bzero_test.cpp b/libc/test/src/string/bzero_test.cpp
index d3ee64dc8ad7d30..7382490e13cbae0 100644
--- a/libc/test/src/string/bzero_test.cpp
+++ b/libc/test/src/string/bzero_test.cpp
@@ -10,11 +10,11 @@
#include "src/string/bzero.h"
#include "test/UnitTest/Test.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
// Adapt CheckMemset signature to bzero.
static inline void Adaptor(cpp::span<char> p1, uint8_t value, size_t size) {
- __llvm_libc::bzero(p1.begin(), size);
+ LIBC_NAMESPACE::bzero(p1.begin(), size);
}
TEST(LlvmLibcBzeroTest, SizeSweep) {
@@ -26,4 +26,4 @@ TEST(LlvmLibcBzeroTest, SizeSweep) {
}
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/test/src/string/index_test.cpp b/libc/test/src/string/index_test.cpp
index 22202f0fc8346b8..88953205009d76c 100644
--- a/libc/test/src/string/index_test.cpp
+++ b/libc/test/src/string/index_test.cpp
@@ -11,4 +11,4 @@
#include "src/string/index.h"
#include "test/UnitTest/Test.h"
-STRCHR_TEST(Index, __llvm_libc::index)
+STRCHR_TEST(Index, LIBC_NAMESPACE::index)
diff --git a/libc/test/src/string/memccpy_test.cpp b/libc/test/src/string/memccpy_test.cpp
index 09f24ae7cdeace2..5bac86541ccff16 100644
--- a/libc/test/src/string/memccpy_test.cpp
+++ b/libc/test/src/string/memccpy_test.cpp
@@ -11,17 +11,17 @@
#include "test/UnitTest/Test.h"
#include <stddef.h> // For size_t.
-class LlvmLibcMemccpyTest : public __llvm_libc::testing::Test {
+class LlvmLibcMemccpyTest : public LIBC_NAMESPACE::testing::Test {
public:
- void check_memccpy(__llvm_libc::cpp::span<char> dst,
- const __llvm_libc::cpp::span<const char> src, int end,
+ void check_memccpy(LIBC_NAMESPACE::cpp::span<char> dst,
+ const LIBC_NAMESPACE::cpp::span<const char> src, int end,
size_t count,
- const __llvm_libc::cpp::span<const char> expected,
+ const LIBC_NAMESPACE::cpp::span<const char> expected,
size_t expectedCopied, bool shouldReturnNull = false) {
// Making sure we don't overflow buffer.
ASSERT_GE(dst.size(), count);
// Making sure memccpy returns dst.
- void *result = __llvm_libc::memccpy(dst.data(), src.data(), end, count);
+ void *result = LIBC_NAMESPACE::memccpy(dst.data(), src.data(), end, count);
if (shouldReturnNull) {
ASSERT_EQ(result, static_cast<void *>(nullptr));
diff --git a/libc/test/src/string/memchr_test.cpp b/libc/test/src/string/memchr_test.cpp
index 1523be8f3fc36e3..343958234edceee 100644
--- a/libc/test/src/string/memchr_test.cpp
+++ b/libc/test/src/string/memchr_test.cpp
@@ -13,7 +13,7 @@
// A helper function that calls memchr and abstracts away the explicit cast for
// readability purposes.
const char *call_memchr(const void *src, int c, size_t size) {
- return reinterpret_cast<const char *>(__llvm_libc::memchr(src, c, size));
+ return reinterpret_cast<const char *>(LIBC_NAMESPACE::memchr(src, c, size));
}
TEST(LlvmLibcMemChrTest, FindsCharacterAfterNullTerminator) {
@@ -80,10 +80,10 @@ TEST(LlvmLibcMemChrTest, TheSourceShouldNotChange) {
const unsigned char src[size] = {'a', 'b', 'c', 'd', 'e', '\0'};
const char *src_copy = reinterpret_cast<const char *>(src);
// When the character is found, the source string should not change.
- __llvm_libc::memchr(src, 'd', size);
+ LIBC_NAMESPACE::memchr(src, 'd', size);
ASSERT_STREQ(reinterpret_cast<const char *>(src), src_copy);
// Same case for when the character is not found.
- __llvm_libc::memchr(src, 'z', size);
+ LIBC_NAMESPACE::memchr(src, 'z', size);
ASSERT_STREQ(reinterpret_cast<const char *>(src), src_copy);
}
diff --git a/libc/test/src/string/memcmp_test.cpp b/libc/test/src/string/memcmp_test.cpp
index ac26fd49de6f2b3..03a0ac1c0ba6550 100644
--- a/libc/test/src/string/memcmp_test.cpp
+++ b/libc/test/src/string/memcmp_test.cpp
@@ -11,35 +11,35 @@
#include "test/UnitTest/Test.h"
#include "test/UnitTest/TestLogger.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
TEST(LlvmLibcMemcmpTest, CmpZeroByte) {
const char *lhs = "ab";
const char *rhs = "yz";
- EXPECT_EQ(__llvm_libc::memcmp(lhs, rhs, 0), 0);
+ EXPECT_EQ(LIBC_NAMESPACE::memcmp(lhs, rhs, 0), 0);
}
TEST(LlvmLibcMemcmpTest, LhsRhsAreTheSame) {
const char *lhs = "ab";
const char *rhs = "ab";
- EXPECT_EQ(__llvm_libc::memcmp(lhs, rhs, 2), 0);
+ EXPECT_EQ(LIBC_NAMESPACE::memcmp(lhs, rhs, 2), 0);
}
TEST(LlvmLibcMemcmpTest, LhsBeforeRhsLexically) {
const char *lhs = "ab";
const char *rhs = "az";
- EXPECT_LT(__llvm_libc::memcmp(lhs, rhs, 2), 0);
+ EXPECT_LT(LIBC_NAMESPACE::memcmp(lhs, rhs, 2), 0);
}
TEST(LlvmLibcMemcmpTest, LhsAfterRhsLexically) {
const char *lhs = "az";
const char *rhs = "ab";
- EXPECT_GT(__llvm_libc::memcmp(lhs, rhs, 2), 0);
+ EXPECT_GT(LIBC_NAMESPACE::memcmp(lhs, rhs, 2), 0);
}
// Adapt CheckMemcmp signature to memcmp.
static inline int Adaptor(cpp::span<char> p1, cpp::span<char> p2, size_t size) {
- return __llvm_libc::memcmp(p1.begin(), p2.begin(), size);
+ return LIBC_NAMESPACE::memcmp(p1.begin(), p2.begin(), size);
}
TEST(LlvmLibcMemcmpTest, SizeSweep) {
@@ -57,4 +57,4 @@ TEST(LlvmLibcMemcmpTest, SizeSweep) {
}
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/test/src/string/memcpy_test.cpp b/libc/test/src/string/memcpy_test.cpp
index 7fe0921077c33b0..b05d4202ea31cd1 100644
--- a/libc/test/src/string/memcpy_test.cpp
+++ b/libc/test/src/string/memcpy_test.cpp
@@ -10,12 +10,12 @@
#include "src/string/memcpy.h"
#include "test/UnitTest/Test.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
// Adapt CheckMemcpy signature to memcpy.
static inline void Adaptor(cpp::span<char> dst, cpp::span<char> src,
size_t size) {
- __llvm_libc::memcpy(dst.begin(), src.begin(), size);
+ LIBC_NAMESPACE::memcpy(dst.begin(), src.begin(), size);
}
TEST(LlvmLibcMemcpyTest, SizeSweep) {
@@ -30,4 +30,4 @@ TEST(LlvmLibcMemcpyTest, SizeSweep) {
}
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/test/src/string/memmem_test.cpp b/libc/test/src/string/memmem_test.cpp
index db6c9c05e3a0b15..56d4b7f03c264be 100644
--- a/libc/test/src/string/memmem_test.cpp
+++ b/libc/test/src/string/memmem_test.cpp
@@ -11,40 +11,40 @@
#include "src/string/string_utils.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
TEST(LlvmLibcMemmemTest, EmptyHaystackEmptyNeedleReturnsHaystck) {
char *h = nullptr;
char *n = nullptr;
- void *result = __llvm_libc::memmem(h, 0, n, 0);
+ void *result = LIBC_NAMESPACE::memmem(h, 0, n, 0);
ASSERT_EQ(static_cast<char *>(result), h);
}
TEST(LlvmLibcMemmemTest, EmptyHaystackNonEmptyNeedleReturnsNull) {
char *h = nullptr;
char n[] = {'a', 'b', 'c'};
- void *result = __llvm_libc::memmem(h, 0, n, sizeof(n));
+ void *result = LIBC_NAMESPACE::memmem(h, 0, n, sizeof(n));
ASSERT_EQ(result, static_cast<void *>(nullptr));
}
TEST(LlvmLibcMemmemTest, EmptyNeedleReturnsHaystack) {
char h[] = {'a', 'b', 'c'};
char *n = nullptr;
- void *result = __llvm_libc::memmem(h, sizeof(h), n, 0);
+ void *result = LIBC_NAMESPACE::memmem(h, sizeof(h), n, 0);
ASSERT_EQ(static_cast<char *>(result), h + 0);
}
TEST(LlvmLibcMemmemTest, ExactMatchReturnsHaystack) {
char h[] = {'a', 'b', 'c'};
char n[] = {'a', 'b', 'c'};
- void *result = __llvm_libc::memmem(h, sizeof(h), n, sizeof(n));
+ void *result = LIBC_NAMESPACE::memmem(h, sizeof(h), n, sizeof(n));
ASSERT_EQ(static_cast<char *>(result), h + 0);
}
TEST(LlvmLibcMemmemTest, ReturnFirstMatchOfNeedle) {
char h[] = {'a', 'a', 'b', 'c'};
char n[] = {'a'};
- void *result = __llvm_libc::memmem(h, sizeof(h), n, sizeof(n));
+ void *result = LIBC_NAMESPACE::memmem(h, sizeof(h), n, sizeof(n));
ASSERT_EQ(static_cast<char *>(result), h + 0);
}
@@ -52,13 +52,13 @@ TEST(LlvmLibcMemmemTest, ReturnFirstExactMatchOfNeedle) {
{
char h[] = {'a', 'b', 'a', 'c', 'a', 'a'};
char n[] = {'a', 'a'};
- void *result = __llvm_libc::memmem(h, sizeof(h), n, sizeof(n));
+ void *result = LIBC_NAMESPACE::memmem(h, sizeof(h), n, sizeof(n));
ASSERT_EQ(static_cast<char *>(result), h + 4);
}
{
char h[] = {'a', 'a', 'b', 'a', 'b', 'a'};
char n[] = {'a', 'b', 'a'};
- void *result = __llvm_libc::memmem(h, sizeof(h), n, sizeof(n));
+ void *result = LIBC_NAMESPACE::memmem(h, sizeof(h), n, sizeof(n));
ASSERT_EQ(static_cast<char *>(result), h + 1);
}
}
@@ -66,7 +66,7 @@ TEST(LlvmLibcMemmemTest, ReturnFirstExactMatchOfNeedle) {
TEST(LlvmLibcMemmemTest, NullTerminatorDoesNotInterruptMatch) {
char h[] = {'\0', 'a', 'b'};
char n[] = {'a', 'b'};
- void *result = __llvm_libc::memmem(h, sizeof(h), n, sizeof(n));
+ void *result = LIBC_NAMESPACE::memmem(h, sizeof(h), n, sizeof(n));
ASSERT_EQ(static_cast<char *>(result), h + 1);
}
@@ -74,25 +74,25 @@ TEST(LlvmLibcMemmemTest, ReturnNullIfNoExactMatch) {
{
char h[] = {'a'};
char n[] = {'a', 'a'};
- void *result = __llvm_libc::memmem(h, sizeof(h), n, sizeof(n));
+ void *result = LIBC_NAMESPACE::memmem(h, sizeof(h), n, sizeof(n));
ASSERT_EQ(result, static_cast<void *>(nullptr));
}
{
char h[] = {'a', 'A'};
char n[] = {'a', 'a'};
- void *result = __llvm_libc::memmem(h, sizeof(h), n, sizeof(n));
+ void *result = LIBC_NAMESPACE::memmem(h, sizeof(h), n, sizeof(n));
ASSERT_EQ(result, static_cast<void *>(nullptr));
}
{
char h[] = {'a'};
char n[] = {'a', '\0'};
- void *result = __llvm_libc::memmem(h, sizeof(h), n, sizeof(n));
+ void *result = LIBC_NAMESPACE::memmem(h, sizeof(h), n, sizeof(n));
ASSERT_EQ(result, static_cast<void *>(nullptr));
}
{
char h[] = {'\0'};
char n[] = {'\0', '\0'};
- void *result = __llvm_libc::memmem(h, sizeof(h), n, sizeof(n));
+ void *result = LIBC_NAMESPACE::memmem(h, sizeof(h), n, sizeof(n));
ASSERT_EQ(result, static_cast<void *>(nullptr));
}
}
@@ -101,13 +101,13 @@ TEST(LlvmLibcMemmemTest, ReturnMatchOfSpecifiedNeedleLength) {
{
char h[] = {'a', 'b', 'c'};
char n[] = {'x', 'y', 'z'};
- void *result = __llvm_libc::memmem(h, sizeof(h), n, 0);
+ void *result = LIBC_NAMESPACE::memmem(h, sizeof(h), n, 0);
ASSERT_EQ(static_cast<char *>(result), h + 0);
}
{
char h[] = {'a', 'b', 'c'};
char n[] = {'b', 'c', 'a'};
- void *result = __llvm_libc::memmem(h, sizeof(h), n, 2);
+ void *result = LIBC_NAMESPACE::memmem(h, sizeof(h), n, 2);
ASSERT_EQ(static_cast<char *>(result), h + 1);
}
}
@@ -116,14 +116,14 @@ TEST(LlvmLibcMemmemTest, ReturnNullIfInadequateHaystackLength) {
{
char h[] = {'a', 'b', 'c'};
char n[] = {'c'};
- void *result = __llvm_libc::memmem(h, 2, n, sizeof(n));
+ void *result = LIBC_NAMESPACE::memmem(h, 2, n, sizeof(n));
ASSERT_EQ(result, static_cast<void *>(nullptr));
}
{
char h[] = {'a', 'b', 'c'};
char n[] = {'a', 'b', 'c'};
- void *result = __llvm_libc::memmem(h, 2, n, sizeof(n));
+ void *result = LIBC_NAMESPACE::memmem(h, 2, n, sizeof(n));
ASSERT_EQ(result, static_cast<void *>(nullptr));
}
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/test/src/string/memmove_test.cpp b/libc/test/src/string/memmove_test.cpp
index 57ab0d40d33eaaf..b076e862b6ec749 100644
--- a/libc/test/src/string/memmove_test.cpp
+++ b/libc/test/src/string/memmove_test.cpp
@@ -13,16 +13,16 @@
#include "test/UnitTest/MemoryMatcher.h"
#include "test/UnitTest/Test.h"
-using __llvm_libc::cpp::array;
-using __llvm_libc::cpp::span;
+using LIBC_NAMESPACE::cpp::array;
+using LIBC_NAMESPACE::cpp::span;
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
TEST(LlvmLibcMemmoveTest, MoveZeroByte) {
char Buffer[] = {'a', 'b', 'y', 'z'};
const char Expected[] = {'a', 'b', 'y', 'z'};
void *const Dst = Buffer;
- void *const Ret = __llvm_libc::memmove(Dst, Buffer + 2, 0);
+ void *const Ret = LIBC_NAMESPACE::memmove(Dst, Buffer + 2, 0);
EXPECT_EQ(Ret, Dst);
ASSERT_MEM_EQ(Buffer, testing::MemoryView(Expected));
}
@@ -31,7 +31,7 @@ TEST(LlvmLibcMemmoveTest, DstAndSrcPointToSameAddress) {
char Buffer[] = {'a', 'b'};
const char Expected[] = {'a', 'b'};
void *const Dst = Buffer;
- void *const Ret = __llvm_libc::memmove(Dst, Buffer, 1);
+ void *const Ret = LIBC_NAMESPACE::memmove(Dst, Buffer, 1);
EXPECT_EQ(Ret, Dst);
ASSERT_MEM_EQ(Buffer, testing::MemoryView(Expected));
}
@@ -42,7 +42,7 @@ TEST(LlvmLibcMemmoveTest, DstStartsBeforeSrc) {
char Buffer[] = {'z', 'a', 'b', 'c', 'z'};
const char Expected[] = {'z', 'b', 'c', 'c', 'z'};
void *const Dst = Buffer + 1;
- void *const Ret = __llvm_libc::memmove(Dst, Buffer + 2, 2);
+ void *const Ret = LIBC_NAMESPACE::memmove(Dst, Buffer + 2, 2);
EXPECT_EQ(Ret, Dst);
ASSERT_MEM_EQ(Buffer, testing::MemoryView(Expected));
}
@@ -51,7 +51,7 @@ TEST(LlvmLibcMemmoveTest, DstStartsAfterSrc) {
char Buffer[] = {'z', 'a', 'b', 'c', 'z'};
const char Expected[] = {'z', 'a', 'a', 'b', 'z'};
void *const Dst = Buffer + 2;
- void *const Ret = __llvm_libc::memmove(Dst, Buffer + 1, 2);
+ void *const Ret = LIBC_NAMESPACE::memmove(Dst, Buffer + 1, 2);
EXPECT_EQ(Ret, Dst);
ASSERT_MEM_EQ(Buffer, testing::MemoryView(Expected));
}
@@ -64,7 +64,7 @@ TEST(LlvmLibcMemmoveTest, SrcFollowDst) {
char Buffer[] = {'z', 'a', 'b', 'z'};
const char Expected[] = {'z', 'b', 'b', 'z'};
void *const Dst = Buffer + 1;
- void *const Ret = __llvm_libc::memmove(Dst, Buffer + 2, 1);
+ void *const Ret = LIBC_NAMESPACE::memmove(Dst, Buffer + 2, 1);
EXPECT_EQ(Ret, Dst);
ASSERT_MEM_EQ(Buffer, testing::MemoryView(Expected));
}
@@ -73,7 +73,7 @@ TEST(LlvmLibcMemmoveTest, DstFollowSrc) {
char Buffer[] = {'z', 'a', 'b', 'z'};
const char Expected[] = {'z', 'a', 'a', 'z'};
void *const Dst = Buffer + 2;
- void *const Ret = __llvm_libc::memmove(Dst, Buffer + 1, 1);
+ void *const Ret = LIBC_NAMESPACE::memmove(Dst, Buffer + 1, 1);
EXPECT_EQ(Ret, Dst);
ASSERT_MEM_EQ(Buffer, testing::MemoryView(Expected));
}
@@ -81,7 +81,7 @@ TEST(LlvmLibcMemmoveTest, DstFollowSrc) {
// Adapt CheckMemmove signature to op implementation signatures.
static inline void Adaptor(cpp::span<char> dst, cpp::span<char> src,
size_t size) {
- __llvm_libc::memmove(dst.begin(), src.begin(), size);
+ LIBC_NAMESPACE::memmove(dst.begin(), src.begin(), size);
}
TEST(LlvmLibcMemmoveTest, SizeSweep) {
@@ -101,4 +101,4 @@ TEST(LlvmLibcMemmoveTest, SizeSweep) {
}
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/test/src/string/memory_utils/memory_check_utils.h b/libc/test/src/string/memory_utils/memory_check_utils.h
index dee375e811e7584..9504230e0c3aa9f 100644
--- a/libc/test/src/string/memory_utils/memory_check_utils.h
+++ b/libc/test/src/string/memory_utils/memory_check_utils.h
@@ -17,7 +17,7 @@
#include <stdint.h> // uintxx_t
#include <stdlib.h> // malloc/free
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
// Simple structure to allocate a buffer of a particular size.
// When ASAN is present it also poisons the whole memory.
@@ -198,6 +198,6 @@ inline bool CheckMemmove(cpp::span<char> buffer, size_t size, int overlap) {
return true;
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LIBC_TEST_SRC_STRING_MEMORY_UTILS_MEMORY_CHECK_UTILS_H
diff --git a/libc/test/src/string/memory_utils/op_tests.cpp b/libc/test/src/string/memory_utils/op_tests.cpp
index f1223b81dac895b..15ac9607bf3e3df 100644
--- a/libc/test/src/string/memory_utils/op_tests.cpp
+++ b/libc/test/src/string/memory_utils/op_tests.cpp
@@ -14,7 +14,7 @@
#include "src/string/memory_utils/op_x86.h"
#include "test/UnitTest/Test.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
template <typename T> struct has_head_tail {
template <typename C> static char sfinae(decltype(&C::head_tail));
@@ -343,4 +343,4 @@ TYPED_TEST(LlvmLibcOpTest, Memcmp, MemcmpImplementations) {
}
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/test/src/string/memory_utils/utils_test.cpp b/libc/test/src/string/memory_utils/utils_test.cpp
index 8968e0d85ae992e..8e9052de56f1b08 100644
--- a/libc/test/src/string/memory_utils/utils_test.cpp
+++ b/libc/test/src/string/memory_utils/utils_test.cpp
@@ -10,7 +10,7 @@
#include "src/string/memory_utils/utils.h"
#include "test/UnitTest/Test.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
TEST(LlvmLibcUtilsTest, IsPowerOfTwoOrZero) {
static const cpp::array<bool, 65> kExpectedValues{
@@ -197,4 +197,4 @@ TEST(LlvmLibcUtilsTest, LoadStoreAligned) {
}
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/test/src/string/mempcpy_test.cpp b/libc/test/src/string/mempcpy_test.cpp
index 5259874d25d600b..43ad5a0f3e1b7e3 100644
--- a/libc/test/src/string/mempcpy_test.cpp
+++ b/libc/test/src/string/mempcpy_test.cpp
@@ -15,7 +15,7 @@
TEST(LlvmLibcMempcpyTest, Simple) {
const char *src = "12345";
char dest[10];
- void *result = __llvm_libc::mempcpy(dest, src, 6);
+ void *result = LIBC_NAMESPACE::mempcpy(dest, src, 6);
ASSERT_EQ(static_cast<char *>(result), dest + 6);
ASSERT_STREQ(src, dest);
}
@@ -23,6 +23,6 @@ TEST(LlvmLibcMempcpyTest, Simple) {
TEST(LlvmLibcMempcpyTest, ZeroCount) {
const char *src = "12345";
char dest[10];
- void *result = __llvm_libc::mempcpy(dest, src, 0);
+ void *result = LIBC_NAMESPACE::mempcpy(dest, src, 0);
ASSERT_EQ(static_cast<char *>(result), dest + 0);
}
diff --git a/libc/test/src/string/memrchr_test.cpp b/libc/test/src/string/memrchr_test.cpp
index c8e81ecfbfaa737..421cb9b98516e5d 100644
--- a/libc/test/src/string/memrchr_test.cpp
+++ b/libc/test/src/string/memrchr_test.cpp
@@ -13,7 +13,7 @@
// A helper function that calls memrchr and abstracts away the explicit cast for
// readability purposes.
const char *call_memrchr(const void *src, int c, size_t size) {
- return reinterpret_cast<const char *>(__llvm_libc::memrchr(src, c, size));
+ return reinterpret_cast<const char *>(LIBC_NAMESPACE::memrchr(src, c, size));
}
TEST(LlvmLibcMemRChrTest, FindsCharacterAfterNullTerminator) {
diff --git a/libc/test/src/string/memset_test.cpp b/libc/test/src/string/memset_test.cpp
index 1aa8edd1bc65a1c..3a54498498f6b2d 100644
--- a/libc/test/src/string/memset_test.cpp
+++ b/libc/test/src/string/memset_test.cpp
@@ -10,11 +10,11 @@
#include "src/string/memset.h"
#include "test/UnitTest/Test.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
// Adapt CheckMemset signature to memset.
static inline void Adaptor(cpp::span<char> p1, uint8_t value, size_t size) {
- __llvm_libc::memset(p1.begin(), value, size);
+ LIBC_NAMESPACE::memset(p1.begin(), value, size);
}
TEST(LlvmLibcMemsetTest, SizeSweep) {
@@ -27,4 +27,4 @@ TEST(LlvmLibcMemsetTest, SizeSweep) {
}
}
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/test/src/string/rindex_test.cpp b/libc/test/src/string/rindex_test.cpp
index 1e5969653d5e707..10513919cffa2da 100644
--- a/libc/test/src/string/rindex_test.cpp
+++ b/libc/test/src/string/rindex_test.cpp
@@ -11,4 +11,4 @@
#include "src/string/rindex.h"
#include "test/UnitTest/Test.h"
-STRRCHR_TEST(Rindex, __llvm_libc::rindex)
+STRRCHR_TEST(Rindex, LIBC_NAMESPACE::rindex)
diff --git a/libc/test/src/string/stpcpy_test.cpp b/libc/test/src/string/stpcpy_test.cpp
index 56e53c12f86593d..523eaf16d988a8d 100644
--- a/libc/test/src/string/stpcpy_test.cpp
+++ b/libc/test/src/string/stpcpy_test.cpp
@@ -13,10 +13,10 @@
TEST(LlvmLibcStpCpyTest, EmptySrc) {
const char *empty = "";
- size_t src_size = __llvm_libc::internal::string_length(empty);
+ size_t src_size = LIBC_NAMESPACE::internal::string_length(empty);
char dest[4] = {'a', 'b', 'c', '\0'};
- char *result = __llvm_libc::stpcpy(dest, empty);
+ char *result = LIBC_NAMESPACE::stpcpy(dest, empty);
ASSERT_EQ(dest + src_size, result);
ASSERT_EQ(result[0], '\0');
ASSERT_STREQ(dest, empty);
@@ -24,10 +24,10 @@ TEST(LlvmLibcStpCpyTest, EmptySrc) {
TEST(LlvmLibcStpCpyTest, EmptyDest) {
const char *abc = "abc";
- size_t src_size = __llvm_libc::internal::string_length(abc);
+ size_t src_size = LIBC_NAMESPACE::internal::string_length(abc);
char dest[4];
- char *result = __llvm_libc::stpcpy(dest, abc);
+ char *result = LIBC_NAMESPACE::stpcpy(dest, abc);
ASSERT_EQ(dest + src_size, result);
ASSERT_EQ(result[0], '\0');
ASSERT_STREQ(dest, abc);
@@ -35,10 +35,10 @@ TEST(LlvmLibcStpCpyTest, EmptyDest) {
TEST(LlvmLibcStpCpyTest, OffsetDest) {
const char *abc = "abc";
- size_t src_size = __llvm_libc::internal::string_length(abc);
+ size_t src_size = LIBC_NAMESPACE::internal::string_length(abc);
char dest[7] = {'x', 'y', 'z'};
- char *result = __llvm_libc::stpcpy(dest + 3, abc);
+ char *result = LIBC_NAMESPACE::stpcpy(dest + 3, abc);
ASSERT_EQ(dest + 3 + src_size, result);
ASSERT_EQ(result[0], '\0');
ASSERT_STREQ(dest, "xyzabc");
diff --git a/libc/test/src/string/stpncpy_test.cpp b/libc/test/src/string/stpncpy_test.cpp
index 2448ea5759767ae..247fa92a0c7bfa5 100644
--- a/libc/test/src/string/stpncpy_test.cpp
+++ b/libc/test/src/string/stpncpy_test.cpp
@@ -11,16 +11,16 @@
#include "test/UnitTest/Test.h"
#include <stddef.h> // For size_t.
-class LlvmLibcStpncpyTest : public __llvm_libc::testing::Test {
+class LlvmLibcStpncpyTest : public LIBC_NAMESPACE::testing::Test {
public:
- void check_stpncpy(__llvm_libc::cpp::span<char> dst,
- const __llvm_libc::cpp::span<const char> src, size_t n,
- const __llvm_libc::cpp::span<const char> expected,
+ void check_stpncpy(LIBC_NAMESPACE::cpp::span<char> dst,
+ const LIBC_NAMESPACE::cpp::span<const char> src, size_t n,
+ const LIBC_NAMESPACE::cpp::span<const char> expected,
size_t expectedCopied) {
// Making sure we don't overflow buffer.
ASSERT_GE(dst.size(), n);
// Making sure stpncpy returns a pointer to the end of dst.
- ASSERT_EQ(__llvm_libc::stpncpy(dst.data(), src.data(), n),
+ ASSERT_EQ(LIBC_NAMESPACE::stpncpy(dst.data(), src.data(), n),
dst.data() + expectedCopied);
// Expected must be of the same size as dst.
ASSERT_EQ(dst.size(), expected.size());
diff --git a/libc/test/src/string/strcasecmp_test.cpp b/libc/test/src/string/strcasecmp_test.cpp
index 2eb16ee76fd8a4c..df7888168c69e03 100644
--- a/libc/test/src/string/strcasecmp_test.cpp
+++ b/libc/test/src/string/strcasecmp_test.cpp
@@ -12,24 +12,24 @@
TEST(LlvmLibcStrCaseCmpTest, EmptyStringsShouldReturnZero) {
const char *s1 = "";
const char *s2 = "";
- int result = __llvm_libc::strcasecmp(s1, s2);
+ int result = LIBC_NAMESPACE::strcasecmp(s1, s2);
ASSERT_EQ(result, 0);
// Verify operands reversed.
- result = __llvm_libc::strcasecmp(s2, s1);
+ result = LIBC_NAMESPACE::strcasecmp(s2, s1);
ASSERT_EQ(result, 0);
}
TEST(LlvmLibcStrCaseCmpTest, EmptyStringShouldNotEqualNonEmptyString) {
const char *empty = "";
const char *s2 = "abc";
- int result = __llvm_libc::strcasecmp(empty, s2);
+ int result = LIBC_NAMESPACE::strcasecmp(empty, s2);
// This should be '\0' - 'a' = -97
ASSERT_LT(result, 0);
// Similar case if empty string is second argument.
const char *s3 = "123";
- result = __llvm_libc::strcasecmp(s3, empty);
+ result = LIBC_NAMESPACE::strcasecmp(s3, empty);
// This should be '1' - '\0' = 49
ASSERT_GT(result, 0);
}
@@ -37,10 +37,10 @@ TEST(LlvmLibcStrCaseCmpTest, EmptyStringShouldNotEqualNonEmptyString) {
TEST(LlvmLibcStrCaseCmpTest, Case) {
const char *s1 = "aB";
const char *s2 = "ab";
- int result = __llvm_libc::strcasecmp(s1, s2);
+ int result = LIBC_NAMESPACE::strcasecmp(s1, s2);
ASSERT_EQ(result, 0);
// Verify operands reversed.
- result = __llvm_libc::strcasecmp(s2, s1);
+ result = LIBC_NAMESPACE::strcasecmp(s2, s1);
ASSERT_EQ(result, 0);
}
diff --git a/libc/test/src/string/strcasestr_test.cpp b/libc/test/src/string/strcasestr_test.cpp
index 6345ac5e3e1c3d5..5b8604a1756e435 100644
--- a/libc/test/src/string/strcasestr_test.cpp
+++ b/libc/test/src/string/strcasestr_test.cpp
@@ -10,15 +10,15 @@
#include "test/UnitTest/Test.h"
TEST(LlvmLibcStrCaseStrTest, NeedleNotInHaystack) {
- EXPECT_STREQ(__llvm_libc::strcasestr("abcd", "e"), nullptr);
- EXPECT_STREQ(__llvm_libc::strcasestr("ABCD", "e"), nullptr);
- EXPECT_STREQ(__llvm_libc::strcasestr("abcd", "E"), nullptr);
- EXPECT_STREQ(__llvm_libc::strcasestr("ABCD", "E"), nullptr);
+ EXPECT_STREQ(LIBC_NAMESPACE::strcasestr("abcd", "e"), nullptr);
+ EXPECT_STREQ(LIBC_NAMESPACE::strcasestr("ABCD", "e"), nullptr);
+ EXPECT_STREQ(LIBC_NAMESPACE::strcasestr("abcd", "E"), nullptr);
+ EXPECT_STREQ(LIBC_NAMESPACE::strcasestr("ABCD", "E"), nullptr);
}
TEST(LlvmLibcStrCaseStrTest, NeedleInMiddle) {
- EXPECT_STREQ(__llvm_libc::strcasestr("abcdefghi", "def"), "defghi");
- EXPECT_STREQ(__llvm_libc::strcasestr("ABCDEFGHI", "def"), "DEFGHI");
- EXPECT_STREQ(__llvm_libc::strcasestr("abcdefghi", "DEF"), "defghi");
- EXPECT_STREQ(__llvm_libc::strcasestr("ABCDEFGHI", "DEF"), "DEFGHI");
+ EXPECT_STREQ(LIBC_NAMESPACE::strcasestr("abcdefghi", "def"), "defghi");
+ EXPECT_STREQ(LIBC_NAMESPACE::strcasestr("ABCDEFGHI", "def"), "DEFGHI");
+ EXPECT_STREQ(LIBC_NAMESPACE::strcasestr("abcdefghi", "DEF"), "defghi");
+ EXPECT_STREQ(LIBC_NAMESPACE::strcasestr("ABCDEFGHI", "DEF"), "DEFGHI");
}
diff --git a/libc/test/src/string/strcat_test.cpp b/libc/test/src/string/strcat_test.cpp
index 2fd42123ec79ffc..e4f6c1ee75992e6 100644
--- a/libc/test/src/string/strcat_test.cpp
+++ b/libc/test/src/string/strcat_test.cpp
@@ -15,7 +15,7 @@ TEST(LlvmLibcStrCatTest, EmptyDest) {
dest[0] = '\0';
- char *result = __llvm_libc::strcat(dest, abc);
+ char *result = LIBC_NAMESPACE::strcat(dest, abc);
ASSERT_EQ(dest, result);
ASSERT_STREQ(dest, result);
ASSERT_STREQ(dest, abc);
@@ -30,7 +30,7 @@ TEST(LlvmLibcStrCatTest, NonEmptyDest) {
dest[2] = 'z';
dest[3] = '\0';
- char *result = __llvm_libc::strcat(dest, abc);
+ char *result = LIBC_NAMESPACE::strcat(dest, abc);
ASSERT_EQ(dest, result);
ASSERT_STREQ(dest, result);
ASSERT_STREQ(dest, "xyzabc");
diff --git a/libc/test/src/string/strchr_test.cpp b/libc/test/src/string/strchr_test.cpp
index 684b631a6e9bd2d..6ad83446ab25ae4 100644
--- a/libc/test/src/string/strchr_test.cpp
+++ b/libc/test/src/string/strchr_test.cpp
@@ -11,4 +11,4 @@
#include "src/string/strchr.h"
#include "test/UnitTest/Test.h"
-STRCHR_TEST(Strchr, __llvm_libc::strchr)
+STRCHR_TEST(Strchr, LIBC_NAMESPACE::strchr)
diff --git a/libc/test/src/string/strchrnul_test.cpp b/libc/test/src/string/strchrnul_test.cpp
index e4ca729db7e6787..273cf40925d7452 100644
--- a/libc/test/src/string/strchrnul_test.cpp
+++ b/libc/test/src/string/strchrnul_test.cpp
@@ -13,7 +13,7 @@ TEST(LlvmLibcStrChrNulTest, FindsFirstCharacter) {
const char *src = "abcde";
// Should return original string since 'a' is the first character.
- ASSERT_STREQ(__llvm_libc::strchrnul(src, 'a'), "abcde");
+ ASSERT_STREQ(LIBC_NAMESPACE::strchrnul(src, 'a'), "abcde");
// Source string should not change.
ASSERT_STREQ(src, "abcde");
}
@@ -22,7 +22,7 @@ TEST(LlvmLibcStrChrNulTest, FindsMiddleCharacter) {
const char *src = "abcde";
// Should return characters after (and including) 'c'.
- ASSERT_STREQ(__llvm_libc::strchrnul(src, 'c'), "cde");
+ ASSERT_STREQ(LIBC_NAMESPACE::strchrnul(src, 'c'), "cde");
// Source string should not change.
ASSERT_STREQ(src, "abcde");
}
@@ -31,7 +31,7 @@ TEST(LlvmLibcStrChrNulTest, FindsLastCharacterThatIsNotNullTerminator) {
const char *src = "abcde";
// Should return 'e' and null-terminator.
- ASSERT_STREQ(__llvm_libc::strchrnul(src, 'e'), "e");
+ ASSERT_STREQ(LIBC_NAMESPACE::strchrnul(src, 'e'), "e");
// Source string should not change.
ASSERT_STREQ(src, "abcde");
}
@@ -40,7 +40,7 @@ TEST(LlvmLibcStrChrNulTest, FindsNullTerminator) {
const char *src = "abcde";
// Should return null terminator.
- ASSERT_STREQ(__llvm_libc::strchrnul(src, '\0'), "");
+ ASSERT_STREQ(LIBC_NAMESPACE::strchrnul(src, '\0'), "");
// Source string should not change.
ASSERT_STREQ(src, "abcde");
}
@@ -51,7 +51,7 @@ TEST(LlvmLibcStrChrNulTest,
// Since 'z' is not within the string, should return a pointer to the source
// string's null terminator.
- char *result = __llvm_libc::strchrnul(src, 'z');
+ char *result = LIBC_NAMESPACE::strchrnul(src, 'z');
ASSERT_EQ(*result, '\0');
char *term = const_cast<char *>(src) + 4;
@@ -61,36 +61,36 @@ TEST(LlvmLibcStrChrNulTest,
TEST(LlvmLibcStrChrNulTest, TheSourceShouldNotChange) {
const char *src = "abcde";
// When the character is found, the source string should not change.
- __llvm_libc::strchrnul(src, 'd');
+ LIBC_NAMESPACE::strchrnul(src, 'd');
ASSERT_STREQ(src, "abcde");
// Same case for when the character is not found.
- __llvm_libc::strchrnul(src, 'z');
+ LIBC_NAMESPACE::strchrnul(src, 'z');
ASSERT_STREQ(src, "abcde");
// Same case for when looking for null terminator.
- __llvm_libc::strchrnul(src, '\0');
+ LIBC_NAMESPACE::strchrnul(src, '\0');
ASSERT_STREQ(src, "abcde");
}
TEST(LlvmLibcStrChrNulTest, ShouldFindFirstOfDuplicates) {
// '1' is duplicated in the string, but it should find the first copy.
- ASSERT_STREQ(__llvm_libc::strchrnul("abc1def1ghi", '1'), "1def1ghi");
+ ASSERT_STREQ(LIBC_NAMESPACE::strchrnul("abc1def1ghi", '1'), "1def1ghi");
const char *dups = "XXXXX";
// Should return original string since 'X' is the first character.
- ASSERT_STREQ(__llvm_libc::strchrnul(dups, 'X'), dups);
+ ASSERT_STREQ(LIBC_NAMESPACE::strchrnul(dups, 'X'), dups);
}
TEST(LlvmLibcStrChrNulTest, EmptyStringShouldOnlyMatchNullTerminator) {
// Null terminator should match.
- ASSERT_STREQ(__llvm_libc::strchrnul("", '\0'), "");
+ ASSERT_STREQ(LIBC_NAMESPACE::strchrnul("", '\0'), "");
// All other characters should not match.
- char *result = __llvm_libc::strchrnul("", 'Z');
+ char *result = LIBC_NAMESPACE::strchrnul("", 'Z');
ASSERT_EQ(*result, '\0');
- result = __llvm_libc::strchrnul("", '3');
+ result = LIBC_NAMESPACE::strchrnul("", '3');
ASSERT_EQ(*result, '\0');
- result = __llvm_libc::strchrnul("", '*');
+ result = LIBC_NAMESPACE::strchrnul("", '*');
ASSERT_EQ(*result, '\0');
}
diff --git a/libc/test/src/string/strcmp_test.cpp b/libc/test/src/string/strcmp_test.cpp
index 78dd8c1a8d4e724..ef58dc608c83b0d 100644
--- a/libc/test/src/string/strcmp_test.cpp
+++ b/libc/test/src/string/strcmp_test.cpp
@@ -12,24 +12,24 @@
TEST(LlvmLibcStrCmpTest, EmptyStringsShouldReturnZero) {
const char *s1 = "";
const char *s2 = "";
- int result = __llvm_libc::strcmp(s1, s2);
+ int result = LIBC_NAMESPACE::strcmp(s1, s2);
ASSERT_EQ(result, 0);
// Verify operands reversed.
- result = __llvm_libc::strcmp(s2, s1);
+ result = LIBC_NAMESPACE::strcmp(s2, s1);
ASSERT_EQ(result, 0);
}
TEST(LlvmLibcStrCmpTest, EmptyStringShouldNotEqualNonEmptyString) {
const char *empty = "";
const char *s2 = "abc";
- int result = __llvm_libc::strcmp(empty, s2);
+ int result = LIBC_NAMESPACE::strcmp(empty, s2);
// This should be '\0' - 'a' = -97
ASSERT_EQ(result, -97);
// Similar case if empty string is second argument.
const char *s3 = "123";
- result = __llvm_libc::strcmp(s3, empty);
+ result = LIBC_NAMESPACE::strcmp(s3, empty);
// This should be '1' - '\0' = 49
ASSERT_EQ(result, 49);
}
@@ -37,23 +37,23 @@ TEST(LlvmLibcStrCmpTest, EmptyStringShouldNotEqualNonEmptyString) {
TEST(LlvmLibcStrCmpTest, EqualStringsShouldReturnZero) {
const char *s1 = "abc";
const char *s2 = "abc";
- int result = __llvm_libc::strcmp(s1, s2);
+ int result = LIBC_NAMESPACE::strcmp(s1, s2);
ASSERT_EQ(result, 0);
// Verify operands reversed.
- result = __llvm_libc::strcmp(s2, s1);
+ result = LIBC_NAMESPACE::strcmp(s2, s1);
ASSERT_EQ(result, 0);
}
TEST(LlvmLibcStrCmpTest, ShouldReturnResultOfFirstDifference) {
const char *s1 = "___B42__";
const char *s2 = "___C55__";
- int result = __llvm_libc::strcmp(s1, s2);
+ int result = LIBC_NAMESPACE::strcmp(s1, s2);
// This should return 'B' - 'C' = -1.
ASSERT_EQ(result, -1);
// Verify operands reversed.
- result = __llvm_libc::strcmp(s2, s1);
+ result = LIBC_NAMESPACE::strcmp(s2, s1);
// This should return 'C' - 'B' = 1.
ASSERT_EQ(result, 1);
}
@@ -61,12 +61,12 @@ TEST(LlvmLibcStrCmpTest, ShouldReturnResultOfFirstDifference) {
TEST(LlvmLibcStrCmpTest, CapitalizedLetterShouldNotBeEqual) {
const char *s1 = "abcd";
const char *s2 = "abCd";
- int result = __llvm_libc::strcmp(s1, s2);
+ int result = LIBC_NAMESPACE::strcmp(s1, s2);
// 'c' - 'C' = 32.
ASSERT_EQ(result, 32);
// Verify operands reversed.
- result = __llvm_libc::strcmp(s2, s1);
+ result = LIBC_NAMESPACE::strcmp(s2, s1);
// 'C' - 'c' = -32.
ASSERT_EQ(result, -32);
}
@@ -74,12 +74,12 @@ TEST(LlvmLibcStrCmpTest, CapitalizedLetterShouldNotBeEqual) {
TEST(LlvmLibcStrCmpTest, UnequalLengthStringsShouldNotReturnZero) {
const char *s1 = "abc";
const char *s2 = "abcd";
- int result = __llvm_libc::strcmp(s1, s2);
+ int result = LIBC_NAMESPACE::strcmp(s1, s2);
// '\0' - 'd' = -100.
ASSERT_EQ(result, -100);
// Verify operands reversed.
- result = __llvm_libc::strcmp(s2, s1);
+ result = LIBC_NAMESPACE::strcmp(s2, s1);
// 'd' - '\0' = 100.
ASSERT_EQ(result, 100);
}
@@ -87,11 +87,11 @@ TEST(LlvmLibcStrCmpTest, UnequalLengthStringsShouldNotReturnZero) {
TEST(LlvmLibcStrCmpTest, StringArgumentSwapChangesSign) {
const char *a = "a";
const char *b = "b";
- int result = __llvm_libc::strcmp(b, a);
+ int result = LIBC_NAMESPACE::strcmp(b, a);
// 'b' - 'a' = 1.
ASSERT_EQ(result, 1);
- result = __llvm_libc::strcmp(a, b);
+ result = LIBC_NAMESPACE::strcmp(a, b);
// 'a' - 'b' = -1.
ASSERT_EQ(result, -1);
}
@@ -99,10 +99,10 @@ TEST(LlvmLibcStrCmpTest, StringArgumentSwapChangesSign) {
TEST(LlvmLibcStrCmpTest, Case) {
const char *s1 = "aB";
const char *s2 = "ab";
- int result = __llvm_libc::strcmp(s1, s2);
+ int result = LIBC_NAMESPACE::strcmp(s1, s2);
ASSERT_LT(result, 0);
// Verify operands reversed.
- result = __llvm_libc::strcmp(s2, s1);
+ result = LIBC_NAMESPACE::strcmp(s2, s1);
ASSERT_GT(result, 0);
}
diff --git a/libc/test/src/string/strcoll_test.cpp b/libc/test/src/string/strcoll_test.cpp
index 256c3c7bd281a1a..a10f98f1ca4d6ae 100644
--- a/libc/test/src/string/strcoll_test.cpp
+++ b/libc/test/src/string/strcoll_test.cpp
@@ -15,16 +15,16 @@ TEST(LlvmLibcStrcollTest, SimpleTest) {
const char *s1 = "abc";
const char *s2 = "abc";
const char *s3 = "def";
- int result = __llvm_libc::strcoll(s1, s2);
+ int result = LIBC_NAMESPACE::strcoll(s1, s2);
ASSERT_EQ(result, 0);
// Verify operands reversed.
- result = __llvm_libc::strcoll(s2, s1);
+ result = LIBC_NAMESPACE::strcoll(s2, s1);
ASSERT_EQ(result, 0);
- result = __llvm_libc::strcoll(s1, s3);
+ result = LIBC_NAMESPACE::strcoll(s1, s3);
ASSERT_LT(result, 0);
- result = __llvm_libc::strcoll(s3, s1);
+ result = LIBC_NAMESPACE::strcoll(s3, s1);
ASSERT_GT(result, 0);
}
diff --git a/libc/test/src/string/strcpy_test.cpp b/libc/test/src/string/strcpy_test.cpp
index 7508b56e23db28d..1a1227aac5d2f80 100644
--- a/libc/test/src/string/strcpy_test.cpp
+++ b/libc/test/src/string/strcpy_test.cpp
@@ -13,7 +13,7 @@ TEST(LlvmLibcStrCpyTest, EmptySrc) {
const char *empty = "";
char dest[4] = {'a', 'b', 'c', '\0'};
- char *result = __llvm_libc::strcpy(dest, empty);
+ char *result = LIBC_NAMESPACE::strcpy(dest, empty);
ASSERT_EQ(dest, result);
ASSERT_STREQ(dest, result);
ASSERT_STREQ(dest, empty);
@@ -23,7 +23,7 @@ TEST(LlvmLibcStrCpyTest, EmptyDest) {
const char *abc = "abc";
char dest[4];
- char *result = __llvm_libc::strcpy(dest, abc);
+ char *result = LIBC_NAMESPACE::strcpy(dest, abc);
ASSERT_EQ(dest, result);
ASSERT_STREQ(dest, result);
ASSERT_STREQ(dest, abc);
@@ -37,7 +37,7 @@ TEST(LlvmLibcStrCpyTest, OffsetDest) {
dest[1] = 'y';
dest[2] = 'z';
- char *result = __llvm_libc::strcpy(dest + 3, abc);
+ char *result = LIBC_NAMESPACE::strcpy(dest + 3, abc);
ASSERT_EQ(dest + 3, result);
ASSERT_STREQ(dest + 3, result);
ASSERT_STREQ(dest, "xyzabc");
diff --git a/libc/test/src/string/strcspn_test.cpp b/libc/test/src/string/strcspn_test.cpp
index 2f3565c78f6b34e..d83b3cf4fdfe8c8 100644
--- a/libc/test/src/string/strcspn_test.cpp
+++ b/libc/test/src/string/strcspn_test.cpp
@@ -12,39 +12,39 @@
TEST(LlvmLibcStrCSpnTest, ComplementarySpanShouldNotGoPastNullTerminator) {
const char src[5] = {'a', 'b', '\0', 'c', 'd'};
- EXPECT_EQ(__llvm_libc::strcspn(src, "b"), size_t{1});
- EXPECT_EQ(__llvm_libc::strcspn(src, "d"), size_t{2});
+ EXPECT_EQ(LIBC_NAMESPACE::strcspn(src, "b"), size_t{1});
+ EXPECT_EQ(LIBC_NAMESPACE::strcspn(src, "d"), size_t{2});
// Same goes for the segment to be searched for.
const char segment[5] = {'1', '2', '\0', '3', '4'};
- EXPECT_EQ(__llvm_libc::strcspn("123", segment), size_t{0});
+ EXPECT_EQ(LIBC_NAMESPACE::strcspn("123", segment), size_t{0});
}
TEST(LlvmLibcStrCSpnTest, ComplementarySpanForEachIndividualCharacter) {
const char *src = "12345";
// The complementary span size should increment accordingly.
- EXPECT_EQ(__llvm_libc::strcspn(src, "1"), size_t{0});
- EXPECT_EQ(__llvm_libc::strcspn(src, "2"), size_t{1});
- EXPECT_EQ(__llvm_libc::strcspn(src, "3"), size_t{2});
- EXPECT_EQ(__llvm_libc::strcspn(src, "4"), size_t{3});
- EXPECT_EQ(__llvm_libc::strcspn(src, "5"), size_t{4});
+ EXPECT_EQ(LIBC_NAMESPACE::strcspn(src, "1"), size_t{0});
+ EXPECT_EQ(LIBC_NAMESPACE::strcspn(src, "2"), size_t{1});
+ EXPECT_EQ(LIBC_NAMESPACE::strcspn(src, "3"), size_t{2});
+ EXPECT_EQ(LIBC_NAMESPACE::strcspn(src, "4"), size_t{3});
+ EXPECT_EQ(LIBC_NAMESPACE::strcspn(src, "5"), size_t{4});
}
TEST(LlvmLibcStrCSpnTest, ComplementarySpanIsStringLengthIfNoCharacterFound) {
// Null terminator.
- EXPECT_EQ(__llvm_libc::strcspn("", ""), size_t{0});
- EXPECT_EQ(__llvm_libc::strcspn("", "_"), size_t{0});
+ EXPECT_EQ(LIBC_NAMESPACE::strcspn("", ""), size_t{0});
+ EXPECT_EQ(LIBC_NAMESPACE::strcspn("", "_"), size_t{0});
// Single character.
- EXPECT_EQ(__llvm_libc::strcspn("a", "b"), size_t{1});
+ EXPECT_EQ(LIBC_NAMESPACE::strcspn("a", "b"), size_t{1});
// Multiple characters.
- EXPECT_EQ(__llvm_libc::strcspn("abc", "1"), size_t{3});
+ EXPECT_EQ(LIBC_NAMESPACE::strcspn("abc", "1"), size_t{3});
}
TEST(LlvmLibcStrCSpnTest, DuplicatedCharactersNotPartOfComplementarySpan) {
// Complementary span should be zero in all these cases.
- EXPECT_EQ(__llvm_libc::strcspn("a", "aa"), size_t{0});
- EXPECT_EQ(__llvm_libc::strcspn("aa", "a"), size_t{0});
- EXPECT_EQ(__llvm_libc::strcspn("aaa", "aa"), size_t{0});
- EXPECT_EQ(__llvm_libc::strcspn("aaaa", "aa"), size_t{0});
- EXPECT_EQ(__llvm_libc::strcspn("aaaa", "baa"), size_t{0});
+ EXPECT_EQ(LIBC_NAMESPACE::strcspn("a", "aa"), size_t{0});
+ EXPECT_EQ(LIBC_NAMESPACE::strcspn("aa", "a"), size_t{0});
+ EXPECT_EQ(LIBC_NAMESPACE::strcspn("aaa", "aa"), size_t{0});
+ EXPECT_EQ(LIBC_NAMESPACE::strcspn("aaaa", "aa"), size_t{0});
+ EXPECT_EQ(LIBC_NAMESPACE::strcspn("aaaa", "baa"), size_t{0});
}
diff --git a/libc/test/src/string/strdup_test.cpp b/libc/test/src/string/strdup_test.cpp
index ee46882233dd37a..b1d4df31603c4b2 100644
--- a/libc/test/src/string/strdup_test.cpp
+++ b/libc/test/src/string/strdup_test.cpp
@@ -16,7 +16,7 @@ TEST(LlvmLibcStrDupTest, EmptyString) {
const char *empty = "";
libc_errno = 0;
- char *result = __llvm_libc::strdup(empty);
+ char *result = LIBC_NAMESPACE::strdup(empty);
ASSERT_EQ(libc_errno, 0);
ASSERT_NE(result, static_cast<char *>(nullptr));
@@ -29,7 +29,7 @@ TEST(LlvmLibcStrDupTest, AnyString) {
const char *abc = "abc";
libc_errno = 0;
- char *result = __llvm_libc::strdup(abc);
+ char *result = LIBC_NAMESPACE::strdup(abc);
ASSERT_EQ(libc_errno, 0);
ASSERT_NE(result, static_cast<char *>(nullptr));
@@ -40,7 +40,7 @@ TEST(LlvmLibcStrDupTest, AnyString) {
TEST(LlvmLibcStrDupTest, NullPtr) {
libc_errno = 0;
- char *result = __llvm_libc::strdup(nullptr);
+ char *result = LIBC_NAMESPACE::strdup(nullptr);
ASSERT_EQ(libc_errno, 0);
ASSERT_EQ(result, static_cast<char *>(nullptr));
diff --git a/libc/test/src/string/strerror_r_test.cpp b/libc/test/src/string/strerror_r_test.cpp
index 6ac3cdf48085187..868362edd84b113 100644
--- a/libc/test/src/string/strerror_r_test.cpp
+++ b/libc/test/src/string/strerror_r_test.cpp
@@ -18,11 +18,11 @@ TEST(LlvmLibcStrErrorRTest, GnuVariantTests) {
buffer[0] = '\0';
// If strerror_r returns a constant string, then it shouldn't affect the
// buffer.
- ASSERT_STREQ(__llvm_libc::strerror_r(0, buffer, BUFF_SIZE), "Success");
+ ASSERT_STREQ(LIBC_NAMESPACE::strerror_r(0, buffer, BUFF_SIZE), "Success");
ASSERT_EQ(buffer[0], '\0');
// Else it should write the result to the provided buffer.
- ASSERT_STREQ(__llvm_libc::strerror_r(-1, buffer, BUFF_SIZE),
+ ASSERT_STREQ(LIBC_NAMESPACE::strerror_r(-1, buffer, BUFF_SIZE),
"Unknown error -1");
ASSERT_STREQ(buffer, "Unknown error -1");
}
diff --git a/libc/test/src/string/strerror_test.cpp b/libc/test/src/string/strerror_test.cpp
index 20a8fba6f30fbe6..ec9827b75cfc828 100644
--- a/libc/test/src/string/strerror_test.cpp
+++ b/libc/test/src/string/strerror_test.cpp
@@ -10,7 +10,7 @@
#include "test/UnitTest/Test.h"
TEST(LlvmLibcStrErrorTest, KnownErrors) {
- ASSERT_STREQ(__llvm_libc::strerror(0), "Success");
+ ASSERT_STREQ(LIBC_NAMESPACE::strerror(0), "Success");
const char *message_array[] = {
"Success",
@@ -150,13 +150,16 @@ TEST(LlvmLibcStrErrorTest, KnownErrors) {
};
for (size_t i = 0; i < (sizeof(message_array) / sizeof(char *)); ++i) {
- EXPECT_STREQ(__llvm_libc::strerror(static_cast<int>(i)), message_array[i]);
+ EXPECT_STREQ(LIBC_NAMESPACE::strerror(static_cast<int>(i)),
+ message_array[i]);
}
}
TEST(LlvmLibcStrErrorTest, UnknownErrors) {
- ASSERT_STREQ(__llvm_libc::strerror(-1), "Unknown error -1");
- ASSERT_STREQ(__llvm_libc::strerror(134), "Unknown error 134");
- ASSERT_STREQ(__llvm_libc::strerror(2147483647), "Unknown error 2147483647");
- ASSERT_STREQ(__llvm_libc::strerror(-2147483648), "Unknown error -2147483648");
+ ASSERT_STREQ(LIBC_NAMESPACE::strerror(-1), "Unknown error -1");
+ ASSERT_STREQ(LIBC_NAMESPACE::strerror(134), "Unknown error 134");
+ ASSERT_STREQ(LIBC_NAMESPACE::strerror(2147483647),
+ "Unknown error 2147483647");
+ ASSERT_STREQ(LIBC_NAMESPACE::strerror(-2147483648),
+ "Unknown error -2147483648");
}
diff --git a/libc/test/src/string/strlcat_test.cpp b/libc/test/src/string/strlcat_test.cpp
index 50c4b2e33897d80..1ffa4b0e921e2b5 100644
--- a/libc/test/src/string/strlcat_test.cpp
+++ b/libc/test/src/string/strlcat_test.cpp
@@ -13,9 +13,9 @@
TEST(LlvmLibcStrlcatTest, TooBig) {
const char *str = "cd";
char buf[4]{"ab"};
- EXPECT_EQ(__llvm_libc::strlcat(buf, str, 3), size_t(4));
+ EXPECT_EQ(LIBC_NAMESPACE::strlcat(buf, str, 3), size_t(4));
EXPECT_STREQ(buf, "ab");
- EXPECT_EQ(__llvm_libc::strlcat(buf, str, 4), size_t(4));
+ EXPECT_EQ(LIBC_NAMESPACE::strlcat(buf, str, 4), size_t(4));
EXPECT_STREQ(buf, "abc");
}
@@ -23,15 +23,15 @@ TEST(LlvmLibcStrlcatTest, Smaller) {
const char *str = "cd";
char buf[7]{"ab"};
- EXPECT_EQ(__llvm_libc::strlcat(buf, str, 7), size_t(4));
+ EXPECT_EQ(LIBC_NAMESPACE::strlcat(buf, str, 7), size_t(4));
EXPECT_STREQ(buf, "abcd");
}
TEST(LlvmLibcStrlcatTest, No0) {
const char *str = "cd";
char buf[7]{"ab"};
- EXPECT_EQ(__llvm_libc::strlcat(buf, str, 1), size_t(3));
+ EXPECT_EQ(LIBC_NAMESPACE::strlcat(buf, str, 1), size_t(3));
EXPECT_STREQ(buf, "ab");
- EXPECT_EQ(__llvm_libc::strlcat(buf, str, 2), size_t(4));
+ EXPECT_EQ(LIBC_NAMESPACE::strlcat(buf, str, 2), size_t(4));
EXPECT_STREQ(buf, "ab");
}
diff --git a/libc/test/src/string/strlcpy_test.cpp b/libc/test/src/string/strlcpy_test.cpp
index 41e244b239d0674..5a1e30c12963f36 100644
--- a/libc/test/src/string/strlcpy_test.cpp
+++ b/libc/test/src/string/strlcpy_test.cpp
@@ -13,17 +13,17 @@
TEST(LlvmLibcStrlcpyTest, TooBig) {
const char *str = "abc";
char buf[2];
- EXPECT_EQ(__llvm_libc::strlcpy(buf, str, 2), size_t(3));
+ EXPECT_EQ(LIBC_NAMESPACE::strlcpy(buf, str, 2), size_t(3));
EXPECT_STREQ(buf, "a");
- EXPECT_EQ(__llvm_libc::strlcpy(nullptr, str, 0), size_t(3));
+ EXPECT_EQ(LIBC_NAMESPACE::strlcpy(nullptr, str, 0), size_t(3));
}
TEST(LlvmLibcStrlcpyTest, Smaller) {
const char *str = "abc";
char buf[7]{"111111"};
- EXPECT_EQ(__llvm_libc::strlcpy(buf, str, 7), size_t(3));
+ EXPECT_EQ(LIBC_NAMESPACE::strlcpy(buf, str, 7), size_t(3));
EXPECT_STREQ(buf, "abc");
for (const char *p = buf + 3; p < buf + 7; p++)
EXPECT_EQ(*p, '\0');
diff --git a/libc/test/src/string/strlen_test.cpp b/libc/test/src/string/strlen_test.cpp
index 41b5fbede0fd06d..4eb9d47e9209ddc 100644
--- a/libc/test/src/string/strlen_test.cpp
+++ b/libc/test/src/string/strlen_test.cpp
@@ -12,13 +12,13 @@
TEST(LlvmLibcStrLenTest, EmptyString) {
const char *empty = "";
- size_t result = __llvm_libc::strlen(empty);
+ size_t result = LIBC_NAMESPACE::strlen(empty);
ASSERT_EQ((size_t)0, result);
}
TEST(LlvmLibcStrLenTest, AnyString) {
const char *any = "Hello World!";
- size_t result = __llvm_libc::strlen(any);
+ size_t result = LIBC_NAMESPACE::strlen(any);
ASSERT_EQ((size_t)12, result);
}
diff --git a/libc/test/src/string/strncasecmp_test.cpp b/libc/test/src/string/strncasecmp_test.cpp
index cf6284318cf7efa..b4173c455de91b8 100644
--- a/libc/test/src/string/strncasecmp_test.cpp
+++ b/libc/test/src/string/strncasecmp_test.cpp
@@ -13,11 +13,11 @@ TEST(LlvmLibcStrNCaseCmpTest,
EmptyStringsShouldReturnZeroWithSufficientLength) {
const char *s1 = "";
const char *s2 = "";
- int result = __llvm_libc::strncasecmp(s1, s2, 1);
+ int result = LIBC_NAMESPACE::strncasecmp(s1, s2, 1);
ASSERT_EQ(result, 0);
// Verify operands reversed.
- result = __llvm_libc::strncasecmp(s2, s1, 1);
+ result = LIBC_NAMESPACE::strncasecmp(s2, s1, 1);
ASSERT_EQ(result, 0);
}
@@ -25,13 +25,13 @@ TEST(LlvmLibcStrNCaseCmpTest,
EmptyStringShouldNotEqualNonEmptyStringWithSufficientLength) {
const char *empty = "";
const char *s2 = "abc";
- int result = __llvm_libc::strncasecmp(empty, s2, 3);
+ int result = LIBC_NAMESPACE::strncasecmp(empty, s2, 3);
// This should be '\0' - 'a' = -97
ASSERT_LT(result, 0);
// Similar case if empty string is second argument.
const char *s3 = "123";
- result = __llvm_libc::strncasecmp(s3, empty, 3);
+ result = LIBC_NAMESPACE::strncasecmp(s3, empty, 3);
// This should be '1' - '\0' = 49
ASSERT_GT(result, 0);
}
@@ -39,10 +39,10 @@ TEST(LlvmLibcStrNCaseCmpTest,
TEST(LlvmLibcStrNCaseCmpTest, Case) {
const char *s1 = "aB";
const char *s2 = "ab";
- int result = __llvm_libc::strncasecmp(s1, s2, 2);
+ int result = LIBC_NAMESPACE::strncasecmp(s1, s2, 2);
ASSERT_EQ(result, 0);
// Verify operands reversed.
- result = __llvm_libc::strncasecmp(s2, s1, 2);
+ result = LIBC_NAMESPACE::strncasecmp(s2, s1, 2);
ASSERT_EQ(result, 0);
}
diff --git a/libc/test/src/string/strncat_test.cpp b/libc/test/src/string/strncat_test.cpp
index 146922194eba2af..9b52788d93d1203 100644
--- a/libc/test/src/string/strncat_test.cpp
+++ b/libc/test/src/string/strncat_test.cpp
@@ -16,12 +16,12 @@ TEST(LlvmLibcStrNCatTest, EmptyDest) {
dest[0] = '\0';
// Start by copying nothing
- char *result = __llvm_libc::strncat(dest, abc, 0);
+ char *result = LIBC_NAMESPACE::strncat(dest, abc, 0);
ASSERT_EQ(dest, result);
ASSERT_EQ(dest[0], '\0');
// Then copy part of it.
- result = __llvm_libc::strncat(dest, abc, 1);
+ result = LIBC_NAMESPACE::strncat(dest, abc, 1);
ASSERT_EQ(dest, result);
ASSERT_STREQ(dest, "a");
@@ -29,7 +29,7 @@ TEST(LlvmLibcStrNCatTest, EmptyDest) {
dest[0] = '\0';
// Then copy all of it.
- result = __llvm_libc::strncat(dest, abc, 3);
+ result = LIBC_NAMESPACE::strncat(dest, abc, 3);
ASSERT_EQ(dest, result);
ASSERT_STREQ(dest, result);
ASSERT_STREQ(dest, abc);
@@ -45,19 +45,19 @@ TEST(LlvmLibcStrNCatTest, NonEmptyDest) {
dest[3] = '\0';
// Copy only part of the string onto the end
- char *result = __llvm_libc::strncat(dest, abc, 1);
+ char *result = LIBC_NAMESPACE::strncat(dest, abc, 1);
ASSERT_EQ(dest, result);
ASSERT_STREQ(dest, "xyza");
// Copy a bit more, but without resetting.
- result = __llvm_libc::strncat(dest, abc, 2);
+ result = LIBC_NAMESPACE::strncat(dest, abc, 2);
ASSERT_EQ(dest, result);
ASSERT_STREQ(dest, "xyzaab");
// Set just the end marker, to make sure it overwrites properly.
dest[3] = '\0';
- result = __llvm_libc::strncat(dest, abc, 3);
+ result = LIBC_NAMESPACE::strncat(dest, abc, 3);
ASSERT_EQ(dest, result);
ASSERT_STREQ(dest, "xyzabc");
@@ -65,12 +65,12 @@ TEST(LlvmLibcStrNCatTest, NonEmptyDest) {
dest[0] = '\0';
// And that it doesn't write beyond what is necessary.
dest[4] = 'Z';
- result = __llvm_libc::strncat(dest, abc, 4);
+ result = LIBC_NAMESPACE::strncat(dest, abc, 4);
ASSERT_EQ(dest, result);
ASSERT_STREQ(dest, "abc");
ASSERT_EQ(dest[4], 'Z');
- result = __llvm_libc::strncat(dest, abc, 5);
+ result = LIBC_NAMESPACE::strncat(dest, abc, 5);
ASSERT_EQ(dest, result);
ASSERT_STREQ(dest, "abcabc");
}
diff --git a/libc/test/src/string/strncmp_test.cpp b/libc/test/src/string/strncmp_test.cpp
index b3971f6b95a2800..1724a5436d1ea33 100644
--- a/libc/test/src/string/strncmp_test.cpp
+++ b/libc/test/src/string/strncmp_test.cpp
@@ -15,11 +15,11 @@
TEST(LlvmLibcStrNCmpTest, EmptyStringsShouldReturnZeroWithSufficientLength) {
const char *s1 = "";
const char *s2 = "";
- int result = __llvm_libc::strncmp(s1, s2, 1);
+ int result = LIBC_NAMESPACE::strncmp(s1, s2, 1);
ASSERT_EQ(result, 0);
// Verify operands reversed.
- result = __llvm_libc::strncmp(s2, s1, 1);
+ result = LIBC_NAMESPACE::strncmp(s2, s1, 1);
ASSERT_EQ(result, 0);
}
@@ -27,13 +27,13 @@ TEST(LlvmLibcStrNCmpTest,
EmptyStringShouldNotEqualNonEmptyStringWithSufficientLength) {
const char *empty = "";
const char *s2 = "abc";
- int result = __llvm_libc::strncmp(empty, s2, 3);
+ int result = LIBC_NAMESPACE::strncmp(empty, s2, 3);
// This should be '\0' - 'a' = -97
ASSERT_EQ(result, -97);
// Similar case if empty string is second argument.
const char *s3 = "123";
- result = __llvm_libc::strncmp(s3, empty, 3);
+ result = LIBC_NAMESPACE::strncmp(s3, empty, 3);
// This should be '1' - '\0' = 49
ASSERT_EQ(result, 49);
}
@@ -41,11 +41,11 @@ TEST(LlvmLibcStrNCmpTest,
TEST(LlvmLibcStrNCmpTest, EqualStringsShouldReturnZeroWithSufficientLength) {
const char *s1 = "abc";
const char *s2 = "abc";
- int result = __llvm_libc::strncmp(s1, s2, 3);
+ int result = LIBC_NAMESPACE::strncmp(s1, s2, 3);
ASSERT_EQ(result, 0);
// Verify operands reversed.
- result = __llvm_libc::strncmp(s2, s1, 3);
+ result = LIBC_NAMESPACE::strncmp(s2, s1, 3);
ASSERT_EQ(result, 0);
}
@@ -53,12 +53,12 @@ TEST(LlvmLibcStrNCmpTest,
ShouldReturnResultOfFirstDifferenceWithSufficientLength) {
const char *s1 = "___B42__";
const char *s2 = "___C55__";
- int result = __llvm_libc::strncmp(s1, s2, 8);
+ int result = LIBC_NAMESPACE::strncmp(s1, s2, 8);
// This should return 'B' - 'C' = -1.
ASSERT_EQ(result, -1);
// Verify operands reversed.
- result = __llvm_libc::strncmp(s2, s1, 8);
+ result = LIBC_NAMESPACE::strncmp(s2, s1, 8);
// This should return 'C' - 'B' = 1.
ASSERT_EQ(result, 1);
}
@@ -67,12 +67,12 @@ TEST(LlvmLibcStrNCmpTest,
CapitalizedLetterShouldNotBeEqualWithSufficientLength) {
const char *s1 = "abcd";
const char *s2 = "abCd";
- int result = __llvm_libc::strncmp(s1, s2, 4);
+ int result = LIBC_NAMESPACE::strncmp(s1, s2, 4);
// 'c' - 'C' = 32.
ASSERT_EQ(result, 32);
// Verify operands reversed.
- result = __llvm_libc::strncmp(s2, s1, 4);
+ result = LIBC_NAMESPACE::strncmp(s2, s1, 4);
// 'C' - 'c' = -32.
ASSERT_EQ(result, -32);
}
@@ -81,12 +81,12 @@ TEST(LlvmLibcStrNCmpTest,
UnequalLengthStringsShouldNotReturnZeroWithSufficientLength) {
const char *s1 = "abc";
const char *s2 = "abcd";
- int result = __llvm_libc::strncmp(s1, s2, 4);
+ int result = LIBC_NAMESPACE::strncmp(s1, s2, 4);
// '\0' - 'd' = -100.
ASSERT_EQ(result, -100);
// Verify operands reversed.
- result = __llvm_libc::strncmp(s2, s1, 4);
+ result = LIBC_NAMESPACE::strncmp(s2, s1, 4);
// 'd' - '\0' = 100.
ASSERT_EQ(result, 100);
}
@@ -94,11 +94,11 @@ TEST(LlvmLibcStrNCmpTest,
TEST(LlvmLibcStrNCmpTest, StringArgumentSwapChangesSignWithSufficientLength) {
const char *a = "a";
const char *b = "b";
- int result = __llvm_libc::strncmp(b, a, 1);
+ int result = LIBC_NAMESPACE::strncmp(b, a, 1);
// 'b' - 'a' = 1.
ASSERT_EQ(result, 1);
- result = __llvm_libc::strncmp(a, b, 1);
+ result = LIBC_NAMESPACE::strncmp(a, b, 1);
// 'a' - 'b' = -1.
ASSERT_EQ(result, -1);
}
@@ -108,62 +108,62 @@ TEST(LlvmLibcStrNCmpTest, StringArgumentSwapChangesSignWithSufficientLength) {
TEST(LlvmLibcStrNCmpTest, NonEqualStringsEqualWithLengthZero) {
const char *s1 = "abc";
const char *s2 = "def";
- int result = __llvm_libc::strncmp(s1, s2, 0);
+ int result = LIBC_NAMESPACE::strncmp(s1, s2, 0);
ASSERT_EQ(result, 0);
// Verify operands reversed.
- result = __llvm_libc::strncmp(s2, s1, 0);
+ result = LIBC_NAMESPACE::strncmp(s2, s1, 0);
ASSERT_EQ(result, 0);
}
TEST(LlvmLibcStrNCmpTest, NonEqualStringsNotEqualWithLengthOne) {
const char *s1 = "abc";
const char *s2 = "def";
- int result = __llvm_libc::strncmp(s1, s2, 1);
+ int result = LIBC_NAMESPACE::strncmp(s1, s2, 1);
ASSERT_EQ(result, -3);
// Verify operands reversed.
- result = __llvm_libc::strncmp(s2, s1, 1);
+ result = LIBC_NAMESPACE::strncmp(s2, s1, 1);
ASSERT_EQ(result, 3);
}
TEST(LlvmLibcStrNCmpTest, NonEqualStringsEqualWithShorterLength) {
const char *s1 = "___B42__";
const char *s2 = "___C55__";
- int result = __llvm_libc::strncmp(s1, s2, 3);
+ int result = LIBC_NAMESPACE::strncmp(s1, s2, 3);
ASSERT_EQ(result, 0);
// This should return 'B' - 'C' = -1.
- result = __llvm_libc::strncmp(s1, s2, 4);
+ result = LIBC_NAMESPACE::strncmp(s1, s2, 4);
ASSERT_EQ(result, -1);
// Verify operands reversed.
- result = __llvm_libc::strncmp(s2, s1, 3);
+ result = LIBC_NAMESPACE::strncmp(s2, s1, 3);
ASSERT_EQ(result, 0);
// This should return 'C' - 'B' = 1.
- result = __llvm_libc::strncmp(s2, s1, 4);
+ result = LIBC_NAMESPACE::strncmp(s2, s1, 4);
ASSERT_EQ(result, 1);
}
TEST(LlvmLibcStrNCmpTest, StringComparisonEndsOnNullByteEvenWithLongerLength) {
const char *s1 = "abc\0def";
const char *s2 = "abc\0abc";
- int result = __llvm_libc::strncmp(s1, s2, 7);
+ int result = LIBC_NAMESPACE::strncmp(s1, s2, 7);
ASSERT_EQ(result, 0);
// Verify operands reversed.
- result = __llvm_libc::strncmp(s2, s1, 7);
+ result = LIBC_NAMESPACE::strncmp(s2, s1, 7);
ASSERT_EQ(result, 0);
}
TEST(LlvmLibcStrNCmpTest, Case) {
const char *s1 = "aB";
const char *s2 = "ab";
- int result = __llvm_libc::strncmp(s1, s2, 2);
+ int result = LIBC_NAMESPACE::strncmp(s1, s2, 2);
ASSERT_LT(result, 0);
// Verify operands reversed.
- result = __llvm_libc::strncmp(s2, s1, 2);
+ result = LIBC_NAMESPACE::strncmp(s2, s1, 2);
ASSERT_GT(result, 0);
}
diff --git a/libc/test/src/string/strncpy_test.cpp b/libc/test/src/string/strncpy_test.cpp
index 69265f82183b599..b71ed66f5c6a835 100644
--- a/libc/test/src/string/strncpy_test.cpp
+++ b/libc/test/src/string/strncpy_test.cpp
@@ -11,15 +11,15 @@
#include "test/UnitTest/Test.h"
#include <stddef.h> // For size_t.
-class LlvmLibcStrncpyTest : public __llvm_libc::testing::Test {
+class LlvmLibcStrncpyTest : public LIBC_NAMESPACE::testing::Test {
public:
- void check_strncpy(__llvm_libc::cpp::span<char> dst,
- const __llvm_libc::cpp::span<const char> src, size_t n,
- const __llvm_libc::cpp::span<const char> expected) {
+ void check_strncpy(LIBC_NAMESPACE::cpp::span<char> dst,
+ const LIBC_NAMESPACE::cpp::span<const char> src, size_t n,
+ const LIBC_NAMESPACE::cpp::span<const char> expected) {
// Making sure we don't overflow buffer.
ASSERT_GE(dst.size(), n);
// Making sure strncpy returns dst.
- ASSERT_EQ(__llvm_libc::strncpy(dst.data(), src.data(), n), dst.data());
+ ASSERT_EQ(LIBC_NAMESPACE::strncpy(dst.data(), src.data(), n), dst.data());
// Expected must be of the same size as dst.
ASSERT_EQ(dst.size(), expected.size());
// Expected and dst are the same.
diff --git a/libc/test/src/string/strndup_test.cpp b/libc/test/src/string/strndup_test.cpp
index 53cdd368fb42af0..3adcd9bacffdb22 100644
--- a/libc/test/src/string/strndup_test.cpp
+++ b/libc/test/src/string/strndup_test.cpp
@@ -13,7 +13,7 @@
TEST(LlvmLibcstrndupTest, EmptyString) {
const char *empty = "";
- char *result = __llvm_libc::strndup(empty, 1);
+ char *result = LIBC_NAMESPACE::strndup(empty, 1);
ASSERT_NE(result, static_cast<char *>(nullptr));
ASSERT_NE(empty, const_cast<const char *>(result));
ASSERT_STREQ(empty, result);
@@ -23,21 +23,21 @@ TEST(LlvmLibcstrndupTest, EmptyString) {
TEST(LlvmLibcstrndupTest, AnyString) {
const char *abc = "abc";
- char *result = __llvm_libc::strndup(abc, 3);
+ char *result = LIBC_NAMESPACE::strndup(abc, 3);
ASSERT_NE(result, static_cast<char *>(nullptr));
ASSERT_NE(abc, const_cast<const char *>(result));
ASSERT_STREQ(abc, result);
::free(result);
- result = __llvm_libc::strndup(abc, 1);
+ result = LIBC_NAMESPACE::strndup(abc, 1);
ASSERT_NE(result, static_cast<char *>(nullptr));
ASSERT_NE(abc, const_cast<const char *>(result));
ASSERT_STREQ("a", result);
::free(result);
- result = __llvm_libc::strndup(abc, 10);
+ result = LIBC_NAMESPACE::strndup(abc, 10);
ASSERT_NE(result, static_cast<char *>(nullptr));
ASSERT_NE(abc, const_cast<const char *>(result));
@@ -46,7 +46,7 @@ TEST(LlvmLibcstrndupTest, AnyString) {
}
TEST(LlvmLibcstrndupTest, NullPtr) {
- char *result = __llvm_libc::strndup(nullptr, 0);
+ char *result = LIBC_NAMESPACE::strndup(nullptr, 0);
ASSERT_EQ(result, static_cast<char *>(nullptr));
}
diff --git a/libc/test/src/string/strnlen_test.cpp b/libc/test/src/string/strnlen_test.cpp
index e260cd65e878e9b..bd1002c0ae07840 100644
--- a/libc/test/src/string/strnlen_test.cpp
+++ b/libc/test/src/string/strnlen_test.cpp
@@ -12,35 +12,35 @@
TEST(LlvmLibcStrNLenTest, EmptyString) {
const char *empty = "";
- ASSERT_EQ(static_cast<size_t>(0), __llvm_libc::strnlen(empty, 0));
+ ASSERT_EQ(static_cast<size_t>(0), LIBC_NAMESPACE::strnlen(empty, 0));
// If N is greater than string length, this should still return 0.
- ASSERT_EQ(static_cast<size_t>(0), __llvm_libc::strnlen(empty, 1));
+ ASSERT_EQ(static_cast<size_t>(0), LIBC_NAMESPACE::strnlen(empty, 1));
}
TEST(LlvmLibcStrNLenTest, OneCharacterString) {
const char *single = "X";
- ASSERT_EQ(static_cast<size_t>(1), __llvm_libc::strnlen(single, 1));
+ ASSERT_EQ(static_cast<size_t>(1), LIBC_NAMESPACE::strnlen(single, 1));
// If N is zero, this should return 0.
- ASSERT_EQ(static_cast<size_t>(0), __llvm_libc::strnlen(single, 0));
+ ASSERT_EQ(static_cast<size_t>(0), LIBC_NAMESPACE::strnlen(single, 0));
// If N is greater than string length, this should still return 1.
- ASSERT_EQ(static_cast<size_t>(1), __llvm_libc::strnlen(single, 2));
+ ASSERT_EQ(static_cast<size_t>(1), LIBC_NAMESPACE::strnlen(single, 2));
}
TEST(LlvmLibcStrNLenTest, ManyCharacterString) {
const char *many = "123456789";
- ASSERT_EQ(static_cast<size_t>(9), __llvm_libc::strnlen(many, 9));
+ ASSERT_EQ(static_cast<size_t>(9), LIBC_NAMESPACE::strnlen(many, 9));
// If N is smaller than the string length, it should return N.
- ASSERT_EQ(static_cast<size_t>(3), __llvm_libc::strnlen(many, 3));
+ ASSERT_EQ(static_cast<size_t>(3), LIBC_NAMESPACE::strnlen(many, 3));
// If N is zero, this should return 0.
- ASSERT_EQ(static_cast<size_t>(0), __llvm_libc::strnlen(many, 0));
+ ASSERT_EQ(static_cast<size_t>(0), LIBC_NAMESPACE::strnlen(many, 0));
// If N is greater than the string length, this should still return 9.
- ASSERT_EQ(static_cast<size_t>(9), __llvm_libc::strnlen(many, 42));
+ ASSERT_EQ(static_cast<size_t>(9), LIBC_NAMESPACE::strnlen(many, 42));
}
TEST(LlvmLibcStrNLenTest, CharactersAfterNullTerminatorShouldNotBeIncluded) {
const char str[5] = {'a', 'b', 'c', '\0', 'd'};
- ASSERT_EQ(static_cast<size_t>(3), __llvm_libc::strnlen(str, 3));
+ ASSERT_EQ(static_cast<size_t>(3), LIBC_NAMESPACE::strnlen(str, 3));
// This should only read up to the null terminator.
- ASSERT_EQ(static_cast<size_t>(3), __llvm_libc::strnlen(str, 4));
- ASSERT_EQ(static_cast<size_t>(3), __llvm_libc::strnlen(str, 5));
+ ASSERT_EQ(static_cast<size_t>(3), LIBC_NAMESPACE::strnlen(str, 4));
+ ASSERT_EQ(static_cast<size_t>(3), LIBC_NAMESPACE::strnlen(str, 5));
}
diff --git a/libc/test/src/string/strpbrk_test.cpp b/libc/test/src/string/strpbrk_test.cpp
index fe10f87930593ef..fbe14da12ac10e0 100644
--- a/libc/test/src/string/strpbrk_test.cpp
+++ b/libc/test/src/string/strpbrk_test.cpp
@@ -12,51 +12,51 @@
TEST(LlvmLibcStrPBrkTest, EmptyStringShouldReturnNullptr) {
// The search should not include the null terminator.
- EXPECT_STREQ(__llvm_libc::strpbrk("", ""), nullptr);
- EXPECT_STREQ(__llvm_libc::strpbrk("_", ""), nullptr);
- EXPECT_STREQ(__llvm_libc::strpbrk("", "_"), nullptr);
+ EXPECT_STREQ(LIBC_NAMESPACE::strpbrk("", ""), nullptr);
+ EXPECT_STREQ(LIBC_NAMESPACE::strpbrk("_", ""), nullptr);
+ EXPECT_STREQ(LIBC_NAMESPACE::strpbrk("", "_"), nullptr);
}
TEST(LlvmLibcStrPBrkTest, ShouldNotFindAnythingAfterNullTerminator) {
const char src[4] = {'a', 'b', '\0', 'c'};
- EXPECT_STREQ(__llvm_libc::strpbrk(src, "c"), nullptr);
+ EXPECT_STREQ(LIBC_NAMESPACE::strpbrk(src, "c"), nullptr);
}
TEST(LlvmLibcStrPBrkTest, ShouldReturnNullptrIfNoCharactersFound) {
- EXPECT_STREQ(__llvm_libc::strpbrk("12345", "abcdef"), nullptr);
+ EXPECT_STREQ(LIBC_NAMESPACE::strpbrk("12345", "abcdef"), nullptr);
}
TEST(LlvmLibcStrPBrkTest, FindsFirstCharacter) {
const char *src = "12345";
- EXPECT_STREQ(__llvm_libc::strpbrk(src, "1"), "12345");
- EXPECT_STREQ(__llvm_libc::strpbrk(src, "-1"), "12345");
- EXPECT_STREQ(__llvm_libc::strpbrk(src, "1_"), "12345");
- EXPECT_STREQ(__llvm_libc::strpbrk(src, "f1_"), "12345");
+ EXPECT_STREQ(LIBC_NAMESPACE::strpbrk(src, "1"), "12345");
+ EXPECT_STREQ(LIBC_NAMESPACE::strpbrk(src, "-1"), "12345");
+ EXPECT_STREQ(LIBC_NAMESPACE::strpbrk(src, "1_"), "12345");
+ EXPECT_STREQ(LIBC_NAMESPACE::strpbrk(src, "f1_"), "12345");
ASSERT_STREQ(src, "12345");
}
TEST(LlvmLibcStrPBrkTest, FindsMiddleCharacter) {
const char *src = "12345";
- EXPECT_STREQ(__llvm_libc::strpbrk(src, "3"), "345");
- EXPECT_STREQ(__llvm_libc::strpbrk(src, "?3"), "345");
- EXPECT_STREQ(__llvm_libc::strpbrk(src, "3F"), "345");
- EXPECT_STREQ(__llvm_libc::strpbrk(src, "z3_"), "345");
+ EXPECT_STREQ(LIBC_NAMESPACE::strpbrk(src, "3"), "345");
+ EXPECT_STREQ(LIBC_NAMESPACE::strpbrk(src, "?3"), "345");
+ EXPECT_STREQ(LIBC_NAMESPACE::strpbrk(src, "3F"), "345");
+ EXPECT_STREQ(LIBC_NAMESPACE::strpbrk(src, "z3_"), "345");
ASSERT_STREQ(src, "12345");
}
TEST(LlvmLibcStrPBrkTest, FindsLastCharacter) {
const char *src = "12345";
- EXPECT_STREQ(__llvm_libc::strpbrk(src, "5"), "5");
- EXPECT_STREQ(__llvm_libc::strpbrk(src, "r5"), "5");
- EXPECT_STREQ(__llvm_libc::strpbrk(src, "59"), "5");
- EXPECT_STREQ(__llvm_libc::strpbrk(src, "n5_"), "5");
+ EXPECT_STREQ(LIBC_NAMESPACE::strpbrk(src, "5"), "5");
+ EXPECT_STREQ(LIBC_NAMESPACE::strpbrk(src, "r5"), "5");
+ EXPECT_STREQ(LIBC_NAMESPACE::strpbrk(src, "59"), "5");
+ EXPECT_STREQ(LIBC_NAMESPACE::strpbrk(src, "n5_"), "5");
ASSERT_STREQ(src, "12345");
}
TEST(LlvmLibcStrPBrkTest, FindsFirstOfRepeated) {
- EXPECT_STREQ(__llvm_libc::strpbrk("A,B,C,D", ","), ",B,C,D");
+ EXPECT_STREQ(LIBC_NAMESPACE::strpbrk("A,B,C,D", ","), ",B,C,D");
}
TEST(LlvmLibcStrPBrkTest, FindsFirstInBreakset) {
- EXPECT_STREQ(__llvm_libc::strpbrk("12345", "34"), "345");
+ EXPECT_STREQ(LIBC_NAMESPACE::strpbrk("12345", "34"), "345");
}
diff --git a/libc/test/src/string/strrchr_test.cpp b/libc/test/src/string/strrchr_test.cpp
index 02659c010ada14c..e415eddaeca0de0 100644
--- a/libc/test/src/string/strrchr_test.cpp
+++ b/libc/test/src/string/strrchr_test.cpp
@@ -11,4 +11,4 @@
#include "src/string/strrchr.h"
#include "test/UnitTest/Test.h"
-STRRCHR_TEST(Strrchr, __llvm_libc::strrchr)
+STRRCHR_TEST(Strrchr, LIBC_NAMESPACE::strrchr)
diff --git a/libc/test/src/string/strsep_test.cpp b/libc/test/src/string/strsep_test.cpp
index 7c0863b3266f5cb..0daa29f6a7ad59f 100644
--- a/libc/test/src/string/strsep_test.cpp
+++ b/libc/test/src/string/strsep_test.cpp
@@ -11,26 +11,26 @@
TEST(LlvmLibcStrsepTest, NullSrc) {
char *string = nullptr;
- EXPECT_STREQ(__llvm_libc::strsep(&string, ""), nullptr);
+ EXPECT_STREQ(LIBC_NAMESPACE::strsep(&string, ""), nullptr);
}
TEST(LlvmLibcStrsepTest, NoTokenFound) {
{
char s[] = "";
char *string = s, *orig = s;
- EXPECT_STREQ(__llvm_libc::strsep(&string, ""), nullptr);
+ EXPECT_STREQ(LIBC_NAMESPACE::strsep(&string, ""), nullptr);
EXPECT_EQ(orig, string);
}
{
char s[] = "abcde";
char *string = s, *orig = s;
- EXPECT_STREQ(__llvm_libc::strsep(&string, ""), orig);
+ EXPECT_STREQ(LIBC_NAMESPACE::strsep(&string, ""), orig);
EXPECT_EQ(string, orig + 5);
}
{
char s[] = "abcde";
char *string = s, *orig = s;
- EXPECT_STREQ(__llvm_libc::strsep(&string, "fghijk"), orig);
+ EXPECT_STREQ(LIBC_NAMESPACE::strsep(&string, "fghijk"), orig);
EXPECT_EQ(string, orig + 5);
}
}
@@ -38,7 +38,7 @@ TEST(LlvmLibcStrsepTest, NoTokenFound) {
TEST(LlvmLibcStrsepTest, TokenFound) {
char s[] = "abacd";
char *string = s;
- EXPECT_STREQ(__llvm_libc::strsep(&string, "c"), "aba");
+ EXPECT_STREQ(LIBC_NAMESPACE::strsep(&string, "c"), "aba");
EXPECT_STREQ(string, "d");
}
@@ -48,6 +48,6 @@ TEST(LlvmLibcStrsepTest, DelimitersShouldNotBeIncludedInToken) {
const char *expected[] = {"", "", "ab", "", "", "cd", "",
"", "ef", "", "", "", nullptr};
for (int i = 0; expected[i]; i++) {
- ASSERT_STREQ(__llvm_libc::strsep(&string, "_:"), expected[i]);
+ ASSERT_STREQ(LIBC_NAMESPACE::strsep(&string, "_:"), expected[i]);
}
}
diff --git a/libc/test/src/string/strsignal_test.cpp b/libc/test/src/string/strsignal_test.cpp
index aa55230d5286b85..48b5d17f85c4659 100644
--- a/libc/test/src/string/strsignal_test.cpp
+++ b/libc/test/src/string/strsignal_test.cpp
@@ -12,7 +12,7 @@
#include <signal.h>
TEST(LlvmLibcStrSignalTest, KnownSignals) {
- ASSERT_STREQ(__llvm_libc::strsignal(1), "Hangup");
+ ASSERT_STREQ(LIBC_NAMESPACE::strsignal(1), "Hangup");
const char *message_array[] = {
"Unknown signal 0", // unknown
@@ -67,18 +67,20 @@ TEST(LlvmLibcStrSignalTest, KnownSignals) {
for (size_t i = 0; i < (sizeof(message_array) / sizeof(char *)); ++i) {
ASSERT_EQ(static_cast<size_t>(static_cast<int>(i)), i);
- EXPECT_STREQ(__llvm_libc::strsignal(static_cast<int>(i)), message_array[i]);
+ EXPECT_STREQ(LIBC_NAMESPACE::strsignal(static_cast<int>(i)),
+ message_array[i]);
}
for (int i = 0; i < SIGRTMAX - SIGRTMIN; ++i) {
- EXPECT_STREQ(__llvm_libc::strsignal(i + SIGRTMIN), rt_message_array[i]);
+ EXPECT_STREQ(LIBC_NAMESPACE::strsignal(i + SIGRTMIN), rt_message_array[i]);
}
}
TEST(LlvmLibcStrsignalTest, UnknownSignals) {
- ASSERT_STREQ(__llvm_libc::strsignal(-1), "Unknown signal -1");
- ASSERT_STREQ(__llvm_libc::strsignal(65), "Unknown signal 65");
- ASSERT_STREQ(__llvm_libc::strsignal(2147483647), "Unknown signal 2147483647");
- ASSERT_STREQ(__llvm_libc::strsignal(-2147483648),
+ ASSERT_STREQ(LIBC_NAMESPACE::strsignal(-1), "Unknown signal -1");
+ ASSERT_STREQ(LIBC_NAMESPACE::strsignal(65), "Unknown signal 65");
+ ASSERT_STREQ(LIBC_NAMESPACE::strsignal(2147483647),
+ "Unknown signal 2147483647");
+ ASSERT_STREQ(LIBC_NAMESPACE::strsignal(-2147483648),
"Unknown signal -2147483648");
}
diff --git a/libc/test/src/string/strspn_test.cpp b/libc/test/src/string/strspn_test.cpp
index d5276091d753166..cdd12af07ee7da9 100644
--- a/libc/test/src/string/strspn_test.cpp
+++ b/libc/test/src/string/strspn_test.cpp
@@ -12,74 +12,74 @@
TEST(LlvmLibcStrSpnTest, EmptyStringShouldReturnZeroLengthSpan) {
// The search should not include the null terminator.
- EXPECT_EQ(__llvm_libc::strspn("", ""), size_t{0});
- EXPECT_EQ(__llvm_libc::strspn("_", ""), size_t{0});
- EXPECT_EQ(__llvm_libc::strspn("", "_"), size_t{0});
+ EXPECT_EQ(LIBC_NAMESPACE::strspn("", ""), size_t{0});
+ EXPECT_EQ(LIBC_NAMESPACE::strspn("_", ""), size_t{0});
+ EXPECT_EQ(LIBC_NAMESPACE::strspn("", "_"), size_t{0});
}
TEST(LlvmLibcStrSpnTest, ShouldNotSpanAnythingAfterNullTerminator) {
const char src[4] = {'a', 'b', '\0', 'c'};
- EXPECT_EQ(__llvm_libc::strspn(src, "ab"), size_t{2});
- EXPECT_EQ(__llvm_libc::strspn(src, "c"), size_t{0});
+ EXPECT_EQ(LIBC_NAMESPACE::strspn(src, "ab"), size_t{2});
+ EXPECT_EQ(LIBC_NAMESPACE::strspn(src, "c"), size_t{0});
// Same goes for the segment to be searched for.
const char segment[4] = {'1', '2', '\0', '3'};
- EXPECT_EQ(__llvm_libc::strspn("123", segment), size_t{2});
+ EXPECT_EQ(LIBC_NAMESPACE::strspn("123", segment), size_t{2});
}
TEST(LlvmLibcStrSpnTest, SpanEachIndividualCharacter) {
const char *src = "12345";
- EXPECT_EQ(__llvm_libc::strspn(src, "1"), size_t{1});
+ EXPECT_EQ(LIBC_NAMESPACE::strspn(src, "1"), size_t{1});
// Since '1' is not within the segment, the span
// size should remain zero.
- EXPECT_EQ(__llvm_libc::strspn(src, "2"), size_t{0});
- EXPECT_EQ(__llvm_libc::strspn(src, "3"), size_t{0});
- EXPECT_EQ(__llvm_libc::strspn(src, "4"), size_t{0});
- EXPECT_EQ(__llvm_libc::strspn(src, "5"), size_t{0});
+ EXPECT_EQ(LIBC_NAMESPACE::strspn(src, "2"), size_t{0});
+ EXPECT_EQ(LIBC_NAMESPACE::strspn(src, "3"), size_t{0});
+ EXPECT_EQ(LIBC_NAMESPACE::strspn(src, "4"), size_t{0});
+ EXPECT_EQ(LIBC_NAMESPACE::strspn(src, "5"), size_t{0});
}
TEST(LlvmLibcStrSpnTest, UnmatchedCharacterShouldNotBeCountedInSpan) {
- EXPECT_EQ(__llvm_libc::strspn("a", "b"), size_t{0});
- EXPECT_EQ(__llvm_libc::strspn("abcdef", "1"), size_t{0});
- EXPECT_EQ(__llvm_libc::strspn("123", "4"), size_t{0});
+ EXPECT_EQ(LIBC_NAMESPACE::strspn("a", "b"), size_t{0});
+ EXPECT_EQ(LIBC_NAMESPACE::strspn("abcdef", "1"), size_t{0});
+ EXPECT_EQ(LIBC_NAMESPACE::strspn("123", "4"), size_t{0});
}
TEST(LlvmLibcStrSpnTest, SequentialCharactersShouldSpan) {
const char *src = "abcde";
- EXPECT_EQ(__llvm_libc::strspn(src, "a"), size_t{1});
- EXPECT_EQ(__llvm_libc::strspn(src, "ab"), size_t{2});
- EXPECT_EQ(__llvm_libc::strspn(src, "abc"), size_t{3});
- EXPECT_EQ(__llvm_libc::strspn(src, "abcd"), size_t{4});
- EXPECT_EQ(__llvm_libc::strspn(src, "abcde"), size_t{5});
+ EXPECT_EQ(LIBC_NAMESPACE::strspn(src, "a"), size_t{1});
+ EXPECT_EQ(LIBC_NAMESPACE::strspn(src, "ab"), size_t{2});
+ EXPECT_EQ(LIBC_NAMESPACE::strspn(src, "abc"), size_t{3});
+ EXPECT_EQ(LIBC_NAMESPACE::strspn(src, "abcd"), size_t{4});
+ EXPECT_EQ(LIBC_NAMESPACE::strspn(src, "abcde"), size_t{5});
// Same thing for when the roles are reversed.
- EXPECT_EQ(__llvm_libc::strspn("abcde", src), size_t{5});
- EXPECT_EQ(__llvm_libc::strspn("abcd", src), size_t{4});
- EXPECT_EQ(__llvm_libc::strspn("abc", src), size_t{3});
- EXPECT_EQ(__llvm_libc::strspn("ab", src), size_t{2});
- EXPECT_EQ(__llvm_libc::strspn("a", src), size_t{1});
+ EXPECT_EQ(LIBC_NAMESPACE::strspn("abcde", src), size_t{5});
+ EXPECT_EQ(LIBC_NAMESPACE::strspn("abcd", src), size_t{4});
+ EXPECT_EQ(LIBC_NAMESPACE::strspn("abc", src), size_t{3});
+ EXPECT_EQ(LIBC_NAMESPACE::strspn("ab", src), size_t{2});
+ EXPECT_EQ(LIBC_NAMESPACE::strspn("a", src), size_t{1});
}
TEST(LlvmLibcStrSpnTest, NonSequentialCharactersShouldNotSpan) {
const char *src = "123456789";
- EXPECT_EQ(__llvm_libc::strspn(src, "_1_abc_2_def_3_"), size_t{3});
+ EXPECT_EQ(LIBC_NAMESPACE::strspn(src, "_1_abc_2_def_3_"), size_t{3});
// Only spans 4 since '5' is not within the span.
- EXPECT_EQ(__llvm_libc::strspn(src, "67__34abc12"), size_t{4});
+ EXPECT_EQ(LIBC_NAMESPACE::strspn(src, "67__34abc12"), size_t{4});
}
TEST(LlvmLibcStrSpnTest, ReverseCharacters) {
// Since these are still sequential, this should span.
- EXPECT_EQ(__llvm_libc::strspn("12345", "54321"), size_t{5});
+ EXPECT_EQ(LIBC_NAMESPACE::strspn("12345", "54321"), size_t{5});
// Does not span any since '1' is not within the span.
- EXPECT_EQ(__llvm_libc::strspn("12345", "432"), size_t{0});
+ EXPECT_EQ(LIBC_NAMESPACE::strspn("12345", "432"), size_t{0});
// Only spans 1 since '2' is not within the span.
- EXPECT_EQ(__llvm_libc::strspn("12345", "51"), size_t{1});
+ EXPECT_EQ(LIBC_NAMESPACE::strspn("12345", "51"), size_t{1});
}
TEST(LlvmLibcStrSpnTest, DuplicatedCharactersToBeSearchedForShouldStillMatch) {
// Only a single character, so only spans 1.
- EXPECT_EQ(__llvm_libc::strspn("a", "aa"), size_t{1});
+ EXPECT_EQ(LIBC_NAMESPACE::strspn("a", "aa"), size_t{1});
// This should count once for each 'a' in the source string.
- EXPECT_EQ(__llvm_libc::strspn("aa", "aa"), size_t{2});
- EXPECT_EQ(__llvm_libc::strspn("aaa", "aa"), size_t{3});
- EXPECT_EQ(__llvm_libc::strspn("aaaa", "aa"), size_t{4});
+ EXPECT_EQ(LIBC_NAMESPACE::strspn("aa", "aa"), size_t{2});
+ EXPECT_EQ(LIBC_NAMESPACE::strspn("aaa", "aa"), size_t{3});
+ EXPECT_EQ(LIBC_NAMESPACE::strspn("aaaa", "aa"), size_t{4});
}
diff --git a/libc/test/src/string/strstr_test.cpp b/libc/test/src/string/strstr_test.cpp
index 2008d1c42e94e01..3de138cae28bd2c 100644
--- a/libc/test/src/string/strstr_test.cpp
+++ b/libc/test/src/string/strstr_test.cpp
@@ -12,103 +12,103 @@
TEST(LlvmLibcStrStrTest, NeedleNotInHaystack) {
const char *haystack = "12345";
const char *needle = "a";
- ASSERT_STREQ(__llvm_libc::strstr(haystack, needle), nullptr);
+ ASSERT_STREQ(LIBC_NAMESPACE::strstr(haystack, needle), nullptr);
}
TEST(LlvmLibcStrStrTest, NeedleIsEmptyString) {
const char *haystack = "12345";
const char *needle = "";
- ASSERT_STREQ(__llvm_libc::strstr(haystack, needle), haystack);
+ ASSERT_STREQ(LIBC_NAMESPACE::strstr(haystack, needle), haystack);
}
TEST(LlvmLibcStrStrTest, HaystackIsEmptyString) {
const char *haystack = "";
const char *needle = "12345";
- ASSERT_STREQ(__llvm_libc::strstr(haystack, needle), nullptr);
+ ASSERT_STREQ(LIBC_NAMESPACE::strstr(haystack, needle), nullptr);
}
TEST(LlvmLibcStrStrTest, HaystackAndNeedleAreEmptyStrings) {
const char *haystack = "";
const char *needle = "";
- ASSERT_STREQ(__llvm_libc::strstr(haystack, needle), "");
+ ASSERT_STREQ(LIBC_NAMESPACE::strstr(haystack, needle), "");
}
TEST(LlvmLibcStrStrTest, HaystackAndNeedleAreSingleCharacters) {
const char *haystack = "a";
// Same characer returns that character.
- ASSERT_STREQ(__llvm_libc::strstr(haystack, /*needle=*/"a"), "a");
+ ASSERT_STREQ(LIBC_NAMESPACE::strstr(haystack, /*needle=*/"a"), "a");
// Different character returns nullptr.
- ASSERT_STREQ(__llvm_libc::strstr(haystack, /*needle=*/"b"), nullptr);
+ ASSERT_STREQ(LIBC_NAMESPACE::strstr(haystack, /*needle=*/"b"), nullptr);
}
TEST(LlvmLibcStrStrTest, NeedleEqualToHaystack) {
const char *haystack = "12345";
const char *needle = "12345";
- ASSERT_STREQ(__llvm_libc::strstr(haystack, needle), "12345");
+ ASSERT_STREQ(LIBC_NAMESPACE::strstr(haystack, needle), "12345");
}
TEST(LlvmLibcStrStrTest, NeedleSmallerThanHaystack) {
const char *haystack = "12345";
const char *needle = "345";
- ASSERT_STREQ(__llvm_libc::strstr(haystack, needle), "345");
+ ASSERT_STREQ(LIBC_NAMESPACE::strstr(haystack, needle), "345");
}
TEST(LlvmLibcStrStrTest, NeedleLargerThanHaystack) {
const char *haystack = "123";
const char *needle = "12345";
- ASSERT_STREQ(__llvm_libc::strstr(haystack, needle), nullptr);
+ ASSERT_STREQ(LIBC_NAMESPACE::strstr(haystack, needle), nullptr);
}
TEST(LlvmLibcStrStrTest, NeedleAtBeginning) {
const char *haystack = "12345";
const char *needle = "12";
- ASSERT_STREQ(__llvm_libc::strstr(haystack, needle), "12345");
+ ASSERT_STREQ(LIBC_NAMESPACE::strstr(haystack, needle), "12345");
}
TEST(LlvmLibcStrStrTest, NeedleInMiddle) {
const char *haystack = "abcdefghi";
const char *needle = "def";
- ASSERT_STREQ(__llvm_libc::strstr(haystack, needle), "defghi");
+ ASSERT_STREQ(LIBC_NAMESPACE::strstr(haystack, needle), "defghi");
}
TEST(LlvmLibcStrStrTest, NeedleDirectlyBeforeNullTerminator) {
const char *haystack = "abcdefghi";
const char *needle = "ghi";
- ASSERT_STREQ(__llvm_libc::strstr(haystack, needle), "ghi");
+ ASSERT_STREQ(LIBC_NAMESPACE::strstr(haystack, needle), "ghi");
}
TEST(LlvmLibcStrStrTest, NeedlePastNullTerminator) {
const char haystack[5] = {'1', '2', '\0', '3', '4'};
// Shouldn't find anything after the null terminator.
- ASSERT_STREQ(__llvm_libc::strstr(haystack, /*needle=*/"3"), nullptr);
- ASSERT_STREQ(__llvm_libc::strstr(haystack, /*needle=*/"4"), nullptr);
+ ASSERT_STREQ(LIBC_NAMESPACE::strstr(haystack, /*needle=*/"3"), nullptr);
+ ASSERT_STREQ(LIBC_NAMESPACE::strstr(haystack, /*needle=*/"4"), nullptr);
}
TEST(LlvmLibcStrStrTest, PartialNeedle) {
const char *haystack = "la_ap_lap";
const char *needle = "lap";
// Shouldn't find la or ap.
- ASSERT_STREQ(__llvm_libc::strstr(haystack, needle), "lap");
+ ASSERT_STREQ(LIBC_NAMESPACE::strstr(haystack, needle), "lap");
}
TEST(LlvmLibcStrStrTest, MisspelledNeedle) {
const char *haystack = "atalloftwocities...wait, tale";
const char *needle = "tale";
- ASSERT_STREQ(__llvm_libc::strstr(haystack, needle), "tale");
+ ASSERT_STREQ(LIBC_NAMESPACE::strstr(haystack, needle), "tale");
}
TEST(LlvmLibcStrStrTest, AnagramNeedle) {
const char *haystack = "dgo_ogd_god_odg_gdo_dog";
const char *needle = "dog";
- ASSERT_STREQ(__llvm_libc::strstr(haystack, needle), "dog");
+ ASSERT_STREQ(LIBC_NAMESPACE::strstr(haystack, needle), "dog");
}
TEST(LlvmLibcStrStrTest, MorphedNeedle) {
// Changes a single letter in the needle to mismatch with the haystack.
const char *haystack = "once upon a time";
- ASSERT_STREQ(__llvm_libc::strstr(haystack, "time"), "time");
- ASSERT_STREQ(__llvm_libc::strstr(haystack, "lime"), nullptr);
- ASSERT_STREQ(__llvm_libc::strstr(haystack, "tome"), nullptr);
- ASSERT_STREQ(__llvm_libc::strstr(haystack, "tire"), nullptr);
- ASSERT_STREQ(__llvm_libc::strstr(haystack, "timo"), nullptr);
+ ASSERT_STREQ(LIBC_NAMESPACE::strstr(haystack, "time"), "time");
+ ASSERT_STREQ(LIBC_NAMESPACE::strstr(haystack, "lime"), nullptr);
+ ASSERT_STREQ(LIBC_NAMESPACE::strstr(haystack, "tome"), nullptr);
+ ASSERT_STREQ(LIBC_NAMESPACE::strstr(haystack, "tire"), nullptr);
+ ASSERT_STREQ(LIBC_NAMESPACE::strstr(haystack, "timo"), nullptr);
}
diff --git a/libc/test/src/string/strtok_r_test.cpp b/libc/test/src/string/strtok_r_test.cpp
index fa436e0116b37ec..fdc27bae23c9757 100644
--- a/libc/test/src/string/strtok_r_test.cpp
+++ b/libc/test/src/string/strtok_r_test.cpp
@@ -13,71 +13,71 @@ TEST(LlvmLibcStrTokReentrantTest, NoTokenFound) {
{ // Empty source and delimiter string.
char empty[] = "";
char *reserve = nullptr;
- ASSERT_STREQ(__llvm_libc::strtok_r(empty, "", &reserve), nullptr);
+ ASSERT_STREQ(LIBC_NAMESPACE::strtok_r(empty, "", &reserve), nullptr);
// Another call to ensure that 'reserve' is not in a bad state.
- ASSERT_STREQ(__llvm_libc::strtok_r(empty, "", &reserve), nullptr);
- ASSERT_STREQ(__llvm_libc::strtok_r(nullptr, "", &reserve), nullptr);
+ ASSERT_STREQ(LIBC_NAMESPACE::strtok_r(empty, "", &reserve), nullptr);
+ ASSERT_STREQ(LIBC_NAMESPACE::strtok_r(nullptr, "", &reserve), nullptr);
}
{ // Empty source and single character delimiter string.
char empty[] = "";
char *reserve = nullptr;
- ASSERT_STREQ(__llvm_libc::strtok_r(empty, "_", &reserve), nullptr);
+ ASSERT_STREQ(LIBC_NAMESPACE::strtok_r(empty, "_", &reserve), nullptr);
// Another call to ensure that 'reserve' is not in a bad state.
- ASSERT_STREQ(__llvm_libc::strtok_r(empty, "_", &reserve), nullptr);
- ASSERT_STREQ(__llvm_libc::strtok_r(nullptr, "_", &reserve), nullptr);
+ ASSERT_STREQ(LIBC_NAMESPACE::strtok_r(empty, "_", &reserve), nullptr);
+ ASSERT_STREQ(LIBC_NAMESPACE::strtok_r(nullptr, "_", &reserve), nullptr);
}
{ // Same character source and delimiter string.
char single[] = "_";
char *reserve = nullptr;
- ASSERT_STREQ(__llvm_libc::strtok_r(single, "_", &reserve), nullptr);
+ ASSERT_STREQ(LIBC_NAMESPACE::strtok_r(single, "_", &reserve), nullptr);
// Another call to ensure that 'reserve' is not in a bad state.
- ASSERT_STREQ(__llvm_libc::strtok_r(single, "_", &reserve), nullptr);
- ASSERT_STREQ(__llvm_libc::strtok_r(nullptr, "_", &reserve), nullptr);
+ ASSERT_STREQ(LIBC_NAMESPACE::strtok_r(single, "_", &reserve), nullptr);
+ ASSERT_STREQ(LIBC_NAMESPACE::strtok_r(nullptr, "_", &reserve), nullptr);
}
{ // Multiple character source and single character delimiter string.
char multiple[] = "1,2";
char *reserve = nullptr;
- ASSERT_STREQ(__llvm_libc::strtok_r(multiple, ":", &reserve), "1,2");
+ ASSERT_STREQ(LIBC_NAMESPACE::strtok_r(multiple, ":", &reserve), "1,2");
// Another call to ensure that 'reserve' is not in a bad state.
- ASSERT_STREQ(__llvm_libc::strtok_r(multiple, ":", &reserve), "1,2");
- ASSERT_STREQ(__llvm_libc::strtok_r(nullptr, ":", &reserve), nullptr);
+ ASSERT_STREQ(LIBC_NAMESPACE::strtok_r(multiple, ":", &reserve), "1,2");
+ ASSERT_STREQ(LIBC_NAMESPACE::strtok_r(nullptr, ":", &reserve), nullptr);
}
}
TEST(LlvmLibcStrTokReentrantTest, DelimiterAsFirstCharacterShouldBeIgnored) {
char src[] = ".123";
char *reserve = nullptr;
- ASSERT_STREQ(__llvm_libc::strtok_r(src, ".", &reserve), "123");
+ ASSERT_STREQ(LIBC_NAMESPACE::strtok_r(src, ".", &reserve), "123");
// Another call to ensure that 'reserve' is not in a bad state.
- ASSERT_STREQ(__llvm_libc::strtok_r(src, ".", &reserve), "123");
- ASSERT_STREQ(__llvm_libc::strtok_r(nullptr, ".", &reserve), nullptr);
+ ASSERT_STREQ(LIBC_NAMESPACE::strtok_r(src, ".", &reserve), "123");
+ ASSERT_STREQ(LIBC_NAMESPACE::strtok_r(nullptr, ".", &reserve), nullptr);
}
TEST(LlvmLibcStrTokReentrantTest, DelimiterIsMiddleCharacter) {
char src[] = "12,34";
char *reserve = nullptr;
- ASSERT_STREQ(__llvm_libc::strtok_r(src, ",", &reserve), "12");
+ ASSERT_STREQ(LIBC_NAMESPACE::strtok_r(src, ",", &reserve), "12");
// Another call to ensure that 'reserve' is not in a bad state.
- ASSERT_STREQ(__llvm_libc::strtok_r(src, ",", &reserve), "12");
- ASSERT_STREQ(__llvm_libc::strtok_r(nullptr, ",", &reserve), nullptr);
+ ASSERT_STREQ(LIBC_NAMESPACE::strtok_r(src, ",", &reserve), "12");
+ ASSERT_STREQ(LIBC_NAMESPACE::strtok_r(nullptr, ",", &reserve), nullptr);
}
TEST(LlvmLibcStrTokReentrantTest, DelimiterAsLastCharacterShouldBeIgnored) {
char src[] = "1234:";
char *reserve = nullptr;
- ASSERT_STREQ(__llvm_libc::strtok_r(src, ":", &reserve), "1234");
+ ASSERT_STREQ(LIBC_NAMESPACE::strtok_r(src, ":", &reserve), "1234");
// Another call to ensure that 'reserve' is not in a bad state.
- ASSERT_STREQ(__llvm_libc::strtok_r(src, ":", &reserve), "1234");
- ASSERT_STREQ(__llvm_libc::strtok_r(nullptr, ":", &reserve), nullptr);
+ ASSERT_STREQ(LIBC_NAMESPACE::strtok_r(src, ":", &reserve), "1234");
+ ASSERT_STREQ(LIBC_NAMESPACE::strtok_r(nullptr, ":", &reserve), nullptr);
}
TEST(LlvmLibcStrTokReentrantTest, ShouldNotGoPastNullTerminator) {
char src[] = {'1', '2', '\0', ',', '3'};
char *reserve = nullptr;
- ASSERT_STREQ(__llvm_libc::strtok_r(src, ",", &reserve), "12");
+ ASSERT_STREQ(LIBC_NAMESPACE::strtok_r(src, ",", &reserve), "12");
// Another call to ensure that 'reserve' is not in a bad state.
- ASSERT_STREQ(__llvm_libc::strtok_r(src, ",", &reserve), "12");
- ASSERT_STREQ(__llvm_libc::strtok_r(nullptr, ",", &reserve), nullptr);
+ ASSERT_STREQ(LIBC_NAMESPACE::strtok_r(src, ",", &reserve), "12");
+ ASSERT_STREQ(LIBC_NAMESPACE::strtok_r(nullptr, ",", &reserve), nullptr);
}
TEST(LlvmLibcStrTokReentrantTest,
@@ -86,7 +86,7 @@ TEST(LlvmLibcStrTokReentrantTest,
char *reserve = nullptr;
// Ensure that instead of crashing if src and reserve are null, nullptr is
// returned
- ASSERT_STREQ(__llvm_libc::strtok_r(src, ",", &reserve), nullptr);
+ ASSERT_STREQ(LIBC_NAMESPACE::strtok_r(src, ",", &reserve), nullptr);
// And that neither src nor reserve are changed when that happens
ASSERT_STREQ(src, nullptr);
ASSERT_STREQ(reserve, nullptr);
@@ -96,29 +96,29 @@ TEST(LlvmLibcStrTokReentrantTest,
SubsequentCallsShouldFindFollowingDelimiters) {
char src[] = "12,34.56";
char *reserve = nullptr;
- char *token = __llvm_libc::strtok_r(src, ",.", &reserve);
+ char *token = LIBC_NAMESPACE::strtok_r(src, ",.", &reserve);
ASSERT_STREQ(token, "12");
- token = __llvm_libc::strtok_r(nullptr, ",.", &reserve);
+ token = LIBC_NAMESPACE::strtok_r(nullptr, ",.", &reserve);
ASSERT_STREQ(token, "34");
- token = __llvm_libc::strtok_r(nullptr, ",.", &reserve);
+ token = LIBC_NAMESPACE::strtok_r(nullptr, ",.", &reserve);
ASSERT_STREQ(token, "56");
- token = __llvm_libc::strtok_r(nullptr, "_:,_", &reserve);
+ token = LIBC_NAMESPACE::strtok_r(nullptr, "_:,_", &reserve);
ASSERT_STREQ(token, nullptr);
// Subsequent calls after hitting the end of the string should also return
// nullptr.
- token = __llvm_libc::strtok_r(nullptr, "_:,_", &reserve);
+ token = LIBC_NAMESPACE::strtok_r(nullptr, "_:,_", &reserve);
ASSERT_STREQ(token, nullptr);
}
TEST(LlvmLibcStrTokReentrantTest, DelimitersShouldNotBeIncludedInToken) {
char src[] = "__ab__:_cd__:__ef__:__";
char *reserve = nullptr;
- char *token = __llvm_libc::strtok_r(src, "_:", &reserve);
+ char *token = LIBC_NAMESPACE::strtok_r(src, "_:", &reserve);
ASSERT_STREQ(token, "ab");
- token = __llvm_libc::strtok_r(nullptr, ":_", &reserve);
+ token = LIBC_NAMESPACE::strtok_r(nullptr, ":_", &reserve);
ASSERT_STREQ(token, "cd");
- token = __llvm_libc::strtok_r(nullptr, "_:,", &reserve);
+ token = LIBC_NAMESPACE::strtok_r(nullptr, "_:,", &reserve);
ASSERT_STREQ(token, "ef");
- token = __llvm_libc::strtok_r(nullptr, "_:,_", &reserve);
+ token = LIBC_NAMESPACE::strtok_r(nullptr, "_:,_", &reserve);
ASSERT_STREQ(token, nullptr);
}
diff --git a/libc/test/src/string/strtok_test.cpp b/libc/test/src/string/strtok_test.cpp
index 24033c41244357d..b82065309e00c65 100644
--- a/libc/test/src/string/strtok_test.cpp
+++ b/libc/test/src/string/strtok_test.cpp
@@ -11,68 +11,68 @@
TEST(LlvmLibcStrTokTest, NoTokenFound) {
char empty[] = "";
- ASSERT_STREQ(__llvm_libc::strtok(empty, ""), nullptr);
- ASSERT_STREQ(__llvm_libc::strtok(empty, "_"), nullptr);
+ ASSERT_STREQ(LIBC_NAMESPACE::strtok(empty, ""), nullptr);
+ ASSERT_STREQ(LIBC_NAMESPACE::strtok(empty, "_"), nullptr);
char single[] = "_";
- ASSERT_STREQ(__llvm_libc::strtok(single, ""), "_");
+ ASSERT_STREQ(LIBC_NAMESPACE::strtok(single, ""), "_");
char multiple[] = "1,2";
- ASSERT_STREQ(__llvm_libc::strtok(multiple, ":"), "1,2");
+ ASSERT_STREQ(LIBC_NAMESPACE::strtok(multiple, ":"), "1,2");
}
TEST(LlvmLibcStrTokTest, DelimiterAsFirstCharacterShouldBeIgnored) {
char src[] = ".123";
- ASSERT_STREQ(__llvm_libc::strtok(src, "."), "123");
+ ASSERT_STREQ(LIBC_NAMESPACE::strtok(src, "."), "123");
}
TEST(LlvmLibcStrTokTest, DelimiterIsMiddleCharacter) {
char src[] = "12,34";
- ASSERT_STREQ(__llvm_libc::strtok(src, ","), "12");
+ ASSERT_STREQ(LIBC_NAMESPACE::strtok(src, ","), "12");
}
TEST(LlvmLibcStrTokTest, DelimiterAsLastCharacterShouldBeIgnored) {
char src[] = "1234:";
- ASSERT_STREQ(__llvm_libc::strtok(src, ":"), "1234");
+ ASSERT_STREQ(LIBC_NAMESPACE::strtok(src, ":"), "1234");
}
TEST(LlvmLibcStrTokTest, MultipleDelimiters) {
char src[] = "12,.34";
- ASSERT_STREQ(__llvm_libc::strtok(src, "."), "12,");
- ASSERT_STREQ(__llvm_libc::strtok(src, ".,"), "12");
- ASSERT_STREQ(__llvm_libc::strtok(src, ",."), "12");
- ASSERT_STREQ(__llvm_libc::strtok(src, ":,."), "12");
+ ASSERT_STREQ(LIBC_NAMESPACE::strtok(src, "."), "12,");
+ ASSERT_STREQ(LIBC_NAMESPACE::strtok(src, ".,"), "12");
+ ASSERT_STREQ(LIBC_NAMESPACE::strtok(src, ",."), "12");
+ ASSERT_STREQ(LIBC_NAMESPACE::strtok(src, ":,."), "12");
}
TEST(LlvmLibcStrTokTest, ShouldNotGoPastNullTerminator) {
char src[] = {'1', '2', '\0', ',', '3'};
- ASSERT_STREQ(__llvm_libc::strtok(src, ","), "12");
+ ASSERT_STREQ(LIBC_NAMESPACE::strtok(src, ","), "12");
}
TEST(LlvmLibcStrTokTest, SubsequentCallsShouldFindFollowingDelimiters) {
char src[] = "12,34.56";
- char *token = __llvm_libc::strtok(src, ",.");
+ char *token = LIBC_NAMESPACE::strtok(src, ",.");
ASSERT_STREQ(token, "12");
- token = __llvm_libc::strtok(nullptr, ",.");
+ token = LIBC_NAMESPACE::strtok(nullptr, ",.");
ASSERT_STREQ(token, "34");
- token = __llvm_libc::strtok(nullptr, ",.");
+ token = LIBC_NAMESPACE::strtok(nullptr, ",.");
ASSERT_STREQ(token, "56");
- token = __llvm_libc::strtok(nullptr, "_:,_");
+ token = LIBC_NAMESPACE::strtok(nullptr, "_:,_");
ASSERT_STREQ(token, nullptr);
// Subsequent calls after hitting the end of the string should also return
// nullptr.
- token = __llvm_libc::strtok(nullptr, "_:,_");
+ token = LIBC_NAMESPACE::strtok(nullptr, "_:,_");
ASSERT_STREQ(token, nullptr);
}
TEST(LlvmLibcStrTokTest, DelimitersShouldNotBeIncludedInToken) {
char src[] = "__ab__:_cd__:__ef__:__";
- char *token = __llvm_libc::strtok(src, "_:");
+ char *token = LIBC_NAMESPACE::strtok(src, "_:");
ASSERT_STREQ(token, "ab");
- token = __llvm_libc::strtok(nullptr, ":_");
+ token = LIBC_NAMESPACE::strtok(nullptr, ":_");
ASSERT_STREQ(token, "cd");
- token = __llvm_libc::strtok(nullptr, "_:,");
+ token = LIBC_NAMESPACE::strtok(nullptr, "_:,");
ASSERT_STREQ(token, "ef");
- token = __llvm_libc::strtok(nullptr, "_:,_");
+ token = LIBC_NAMESPACE::strtok(nullptr, "_:,_");
ASSERT_STREQ(token, nullptr);
}
diff --git a/libc/test/src/string/strxfrm_test.cpp b/libc/test/src/string/strxfrm_test.cpp
index 0512556d74c2918..b704dbf6052fcbb 100644
--- a/libc/test/src/string/strxfrm_test.cpp
+++ b/libc/test/src/string/strxfrm_test.cpp
@@ -18,8 +18,8 @@ TEST(LlvmLibcStrxfrmTest, SimpleTestSufficientlySizedN) {
const size_t n = 5;
char dest[n];
- size_t result = __llvm_libc::strxfrm(dest, src, n);
- ASSERT_EQ(result, __llvm_libc::internal::string_length(src));
+ size_t result = LIBC_NAMESPACE::strxfrm(dest, src, n);
+ ASSERT_EQ(result, LIBC_NAMESPACE::internal::string_length(src));
ASSERT_STREQ(dest, src);
}
@@ -28,8 +28,8 @@ TEST(LlvmLibcStrxfrmTest, SimpleTestExactSizedN) {
const size_t n = 4;
char dest[n];
- size_t result = __llvm_libc::strxfrm(dest, src, n);
- ASSERT_EQ(result, __llvm_libc::internal::string_length(src));
+ size_t result = LIBC_NAMESPACE::strxfrm(dest, src, n);
+ ASSERT_EQ(result, LIBC_NAMESPACE::internal::string_length(src));
ASSERT_STREQ(dest, src);
}
@@ -39,7 +39,7 @@ TEST(LlvmLibcStrxfrmTest, SimpleTestInsufficientlySizedN) {
// Verify strxfrm does not modify dest if src len >= n
char dest[n] = {'x', 'x', '\0'};
- size_t result = __llvm_libc::strxfrm(dest, src, n);
+ size_t result = LIBC_NAMESPACE::strxfrm(dest, src, n);
ASSERT_GE(result, n);
ASSERT_STREQ(dest, "xx");
}
diff --git a/libc/test/src/sys/mman/linux/madvise_test.cpp b/libc/test/src/sys/mman/linux/madvise_test.cpp
index 4fdb4a2f2fde366..83c73f5454de1bc 100644
--- a/libc/test/src/sys/mman/linux/madvise_test.cpp
+++ b/libc/test/src/sys/mman/linux/madvise_test.cpp
@@ -15,28 +15,30 @@
#include <sys/mman.h>
-using __llvm_libc::testing::ErrnoSetterMatcher::Fails;
-using __llvm_libc::testing::ErrnoSetterMatcher::Succeeds;
+using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails;
+using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds;
TEST(LlvmLibcMadviseTest, NoError) {
size_t alloc_size = 128;
libc_errno = 0;
- void *addr = __llvm_libc::mmap(nullptr, alloc_size, PROT_READ,
- MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
+ void *addr = LIBC_NAMESPACE::mmap(nullptr, alloc_size, PROT_READ,
+ MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
EXPECT_EQ(0, libc_errno);
EXPECT_NE(addr, MAP_FAILED);
- EXPECT_THAT(__llvm_libc::madvise(addr, alloc_size, MADV_RANDOM), Succeeds());
+ EXPECT_THAT(LIBC_NAMESPACE::madvise(addr, alloc_size, MADV_RANDOM),
+ Succeeds());
int *array = reinterpret_cast<int *>(addr);
// Reading from the memory should not crash the test.
// Since we used the MAP_ANONYMOUS flag, the contents of the newly
// allocated memory should be initialized to zero.
EXPECT_EQ(array[0], 0);
- EXPECT_THAT(__llvm_libc::munmap(addr, alloc_size), Succeeds());
+ EXPECT_THAT(LIBC_NAMESPACE::munmap(addr, alloc_size), Succeeds());
}
TEST(LlvmLibcMadviseTest, Error_BadPtr) {
libc_errno = 0;
- EXPECT_THAT(__llvm_libc::madvise(nullptr, 8, MADV_SEQUENTIAL), Fails(ENOMEM));
+ EXPECT_THAT(LIBC_NAMESPACE::madvise(nullptr, 8, MADV_SEQUENTIAL),
+ Fails(ENOMEM));
}
diff --git a/libc/test/src/sys/mman/linux/mmap_test.cpp b/libc/test/src/sys/mman/linux/mmap_test.cpp
index d74701c5e59c971..9b13b8bd8057f23 100644
--- a/libc/test/src/sys/mman/linux/mmap_test.cpp
+++ b/libc/test/src/sys/mman/linux/mmap_test.cpp
@@ -14,14 +14,14 @@
#include <sys/mman.h>
-using __llvm_libc::testing::ErrnoSetterMatcher::Fails;
-using __llvm_libc::testing::ErrnoSetterMatcher::Succeeds;
+using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails;
+using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds;
TEST(LlvmLibcMMapTest, NoError) {
size_t alloc_size = 128;
libc_errno = 0;
- void *addr = __llvm_libc::mmap(nullptr, alloc_size, PROT_READ,
- MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
+ void *addr = LIBC_NAMESPACE::mmap(nullptr, alloc_size, PROT_READ,
+ MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
EXPECT_EQ(0, libc_errno);
EXPECT_NE(addr, MAP_FAILED);
@@ -30,14 +30,14 @@ TEST(LlvmLibcMMapTest, NoError) {
// Since we used the MAP_ANONYMOUS flag, the contents of the newly
// allocated memory should be initialized to zero.
EXPECT_EQ(array[0], 0);
- EXPECT_THAT(__llvm_libc::munmap(addr, alloc_size), Succeeds());
+ EXPECT_THAT(LIBC_NAMESPACE::munmap(addr, alloc_size), Succeeds());
}
TEST(LlvmLibcMMapTest, Error_InvalidSize) {
libc_errno = 0;
- void *addr = __llvm_libc::mmap(nullptr, 0, PROT_READ,
- MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
+ void *addr = LIBC_NAMESPACE::mmap(nullptr, 0, PROT_READ,
+ MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
EXPECT_THAT(addr, Fails(EINVAL, MAP_FAILED));
- EXPECT_THAT(__llvm_libc::munmap(0, 0), Fails(EINVAL));
+ EXPECT_THAT(LIBC_NAMESPACE::munmap(0, 0), Fails(EINVAL));
}
diff --git a/libc/test/src/sys/mman/linux/mprotect_test.cpp b/libc/test/src/sys/mman/linux/mprotect_test.cpp
index 5f2f5f27ce04189..7127f77714d6421 100644
--- a/libc/test/src/sys/mman/linux/mprotect_test.cpp
+++ b/libc/test/src/sys/mman/linux/mprotect_test.cpp
@@ -16,14 +16,14 @@
#include <signal.h>
#include <sys/mman.h>
-using __llvm_libc::testing::ErrnoSetterMatcher::Fails;
-using __llvm_libc::testing::ErrnoSetterMatcher::Succeeds;
+using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails;
+using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds;
TEST(LlvmLibcMProtectTest, NoError) {
size_t alloc_size = 128;
libc_errno = 0;
- void *addr = __llvm_libc::mmap(nullptr, alloc_size, PROT_READ,
- MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
+ void *addr = LIBC_NAMESPACE::mmap(nullptr, alloc_size, PROT_READ,
+ MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
EXPECT_EQ(0, libc_errno);
EXPECT_NE(addr, MAP_FAILED);
@@ -35,12 +35,13 @@ TEST(LlvmLibcMProtectTest, NoError) {
// By setting the memory protection to read and write, we should be able to
// modify that memory.
- EXPECT_THAT(__llvm_libc::mprotect(addr, alloc_size, PROT_READ | PROT_WRITE),
- Succeeds());
+ EXPECT_THAT(
+ LIBC_NAMESPACE::mprotect(addr, alloc_size, PROT_READ | PROT_WRITE),
+ Succeeds());
array[0] = 1;
EXPECT_EQ(array[0], 1);
- EXPECT_THAT(__llvm_libc::munmap(addr, alloc_size), Succeeds());
+ EXPECT_THAT(LIBC_NAMESPACE::munmap(addr, alloc_size), Succeeds());
}
// This test is disabled currently due to flakeyness. It will be re-enabled once
@@ -53,9 +54,9 @@ TEST(LlvmLibcMProtectTest, Error_InvalidWrite) {
[] {
size_t alloc_size = 128;
void *addr =
- __llvm_libc::mmap(nullptr, alloc_size, PROT_READ | PROT_WRITE,
+ LIBC_NAMESPACE::mmap(nullptr, alloc_size, PROT_READ | PROT_WRITE,
MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
- __llvm_libc::mprotect(addr, alloc_size, PROT_READ);
+ LIBC_NAMESPACE::mprotect(addr, alloc_size, PROT_READ);
(reinterpret_cast<char *>(addr))[0] = 'A';
},
diff --git a/libc/test/src/sys/mman/linux/posix_madvise_test.cpp b/libc/test/src/sys/mman/linux/posix_madvise_test.cpp
index b271a7185d000c4..59cf01ac746959d 100644
--- a/libc/test/src/sys/mman/linux/posix_madvise_test.cpp
+++ b/libc/test/src/sys/mman/linux/posix_madvise_test.cpp
@@ -15,35 +15,36 @@
#include <sys/mman.h>
-using __llvm_libc::testing::ErrnoSetterMatcher::Fails;
-using __llvm_libc::testing::ErrnoSetterMatcher::Succeeds;
+using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails;
+using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds;
TEST(LlvmLibcPosixMadviseTest, NoError) {
size_t alloc_size = 128;
libc_errno = 0;
- void *addr = __llvm_libc::mmap(nullptr, alloc_size, PROT_READ,
- MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
+ void *addr = LIBC_NAMESPACE::mmap(nullptr, alloc_size, PROT_READ,
+ MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
EXPECT_EQ(0, libc_errno);
EXPECT_NE(addr, MAP_FAILED);
- EXPECT_EQ(__llvm_libc::posix_madvise(addr, alloc_size, POSIX_MADV_RANDOM), 0);
+ EXPECT_EQ(LIBC_NAMESPACE::posix_madvise(addr, alloc_size, POSIX_MADV_RANDOM),
+ 0);
int *array = reinterpret_cast<int *>(addr);
// Reading from the memory should not crash the test.
// Since we used the MAP_ANONYMOUS flag, the contents of the newly
// allocated memory should be initialized to zero.
EXPECT_EQ(array[0], 0);
- EXPECT_THAT(__llvm_libc::munmap(addr, alloc_size), Succeeds());
+ EXPECT_THAT(LIBC_NAMESPACE::munmap(addr, alloc_size), Succeeds());
}
TEST(LlvmLibcPosixMadviseTest, Error_BadPtr) {
libc_errno = 0;
// posix_madvise is a no-op on DONTNEED, so it shouldn't fail even with the
// nullptr.
- EXPECT_EQ(__llvm_libc::posix_madvise(nullptr, 8, POSIX_MADV_DONTNEED), 0);
+ EXPECT_EQ(LIBC_NAMESPACE::posix_madvise(nullptr, 8, POSIX_MADV_DONTNEED), 0);
// posix_madvise doesn't set errno, but the return value is actually the error
// code.
- EXPECT_EQ(__llvm_libc::posix_madvise(nullptr, 8, POSIX_MADV_SEQUENTIAL),
+ EXPECT_EQ(LIBC_NAMESPACE::posix_madvise(nullptr, 8, POSIX_MADV_SEQUENTIAL),
ENOMEM);
}
diff --git a/libc/test/src/sys/random/linux/getrandom_test.cpp b/libc/test/src/sys/random/linux/getrandom_test.cpp
index 839297bc32a618a..5a595afb0cdaa7a 100644
--- a/libc/test/src/sys/random/linux/getrandom_test.cpp
+++ b/libc/test/src/sys/random/linux/getrandom_test.cpp
@@ -14,23 +14,23 @@
#include "test/UnitTest/Test.h"
TEST(LlvmLibcGetRandomTest, InvalidFlag) {
- __llvm_libc::cpp::array<char, 10> buffer;
+ LIBC_NAMESPACE::cpp::array<char, 10> buffer;
libc_errno = 0;
- ASSERT_THAT(__llvm_libc::getrandom(buffer.data(), buffer.size(), -1),
- __llvm_libc::testing::ErrnoSetterMatcher::Fails(EINVAL));
+ ASSERT_THAT(LIBC_NAMESPACE::getrandom(buffer.data(), buffer.size(), -1),
+ LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails(EINVAL));
}
TEST(LlvmLibcGetRandomTest, InvalidBuffer) {
libc_errno = 0;
- ASSERT_THAT(__llvm_libc::getrandom(nullptr, 65536, 0),
- __llvm_libc::testing::ErrnoSetterMatcher::Fails(EFAULT));
+ ASSERT_THAT(LIBC_NAMESPACE::getrandom(nullptr, 65536, 0),
+ LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails(EFAULT));
}
TEST(LlvmLibcGetRandomTest, ReturnsSize) {
- __llvm_libc::cpp::array<char, 10> buffer;
+ LIBC_NAMESPACE::cpp::array<char, 10> buffer;
for (size_t i = 0; i < buffer.size(); ++i) {
// Without GRND_RANDOM set this should never fail.
- ASSERT_EQ(__llvm_libc::getrandom(buffer.data(), i, 0),
+ ASSERT_EQ(LIBC_NAMESPACE::getrandom(buffer.data(), i, 0),
static_cast<ssize_t>(i));
}
}
@@ -38,12 +38,12 @@ TEST(LlvmLibcGetRandomTest, ReturnsSize) {
TEST(LlvmLibcGetRandomTest, CheckValue) {
// Probability of picking one particular value amongst 256 possibilities a
// hundred times in a row is (1/256)^100 = 1.49969681e-241.
- __llvm_libc::cpp::array<char, 100> buffer;
+ LIBC_NAMESPACE::cpp::array<char, 100> buffer;
for (char &c : buffer)
c = 0;
- __llvm_libc::getrandom(buffer.data(), buffer.size(), 0);
+ LIBC_NAMESPACE::getrandom(buffer.data(), buffer.size(), 0);
bool all_zeros = true;
for (char c : buffer)
diff --git a/libc/test/src/sys/resource/getrlimit_setrlimit_test.cpp b/libc/test/src/sys/resource/getrlimit_setrlimit_test.cpp
index b385cf86ce97839..7e6bb0aaca92518 100644
--- a/libc/test/src/sys/resource/getrlimit_setrlimit_test.cpp
+++ b/libc/test/src/sys/resource/getrlimit_setrlimit_test.cpp
@@ -19,8 +19,8 @@
#include <sys/resource.h>
TEST(LlvmLibcResourceLimitsTest, SetNoFileLimit) {
- using __llvm_libc::testing::ErrnoSetterMatcher::Fails;
- using __llvm_libc::testing::ErrnoSetterMatcher::Succeeds;
+ using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails;
+ using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds;
// The test strategy is to first create initialize two file descriptors
// successfully. Next, close the files and set the file descriptor limit
@@ -30,47 +30,47 @@ TEST(LlvmLibcResourceLimitsTest, SetNoFileLimit) {
constexpr const char *TEST_FILE2 = "testdata/resource_limits2.test";
libc_errno = 0;
- int fd1 = __llvm_libc::open(TEST_FILE1, O_CREAT | O_WRONLY, S_IRWXU);
+ int fd1 = LIBC_NAMESPACE::open(TEST_FILE1, O_CREAT | O_WRONLY, S_IRWXU);
ASSERT_GT(fd1, 0);
ASSERT_EQ(libc_errno, 0);
- int fd2 = __llvm_libc::open(TEST_FILE2, O_CREAT | O_WRONLY, S_IRWXU);
+ int fd2 = LIBC_NAMESPACE::open(TEST_FILE2, O_CREAT | O_WRONLY, S_IRWXU);
ASSERT_GT(fd2, 0);
ASSERT_EQ(libc_errno, 0);
- ASSERT_THAT(__llvm_libc::close(fd1), Succeeds(0));
- ASSERT_THAT(__llvm_libc::close(fd2), Succeeds(0));
+ ASSERT_THAT(LIBC_NAMESPACE::close(fd1), Succeeds(0));
+ ASSERT_THAT(LIBC_NAMESPACE::close(fd2), Succeeds(0));
struct rlimit limits {
4, 4
};
- ASSERT_THAT(__llvm_libc::setrlimit(RLIMIT_NOFILE, &limits), Succeeds(0));
+ ASSERT_THAT(LIBC_NAMESPACE::setrlimit(RLIMIT_NOFILE, &limits), Succeeds(0));
// One can now only open one of the files successfully.
- fd1 = __llvm_libc::open(TEST_FILE1, O_RDONLY);
+ fd1 = LIBC_NAMESPACE::open(TEST_FILE1, O_RDONLY);
ASSERT_GT(fd1, 0);
ASSERT_EQ(libc_errno, 0);
- fd2 = __llvm_libc::open(TEST_FILE2, O_RDONLY);
+ fd2 = LIBC_NAMESPACE::open(TEST_FILE2, O_RDONLY);
ASSERT_LT(fd2, 0);
ASSERT_NE(libc_errno, 0);
libc_errno = 0;
- ASSERT_THAT(__llvm_libc::close(fd1), Succeeds(0));
+ ASSERT_THAT(LIBC_NAMESPACE::close(fd1), Succeeds(0));
- fd2 = __llvm_libc::open(TEST_FILE2, O_RDONLY);
+ fd2 = LIBC_NAMESPACE::open(TEST_FILE2, O_RDONLY);
ASSERT_GT(fd2, 0);
ASSERT_EQ(libc_errno, 0);
- fd1 = __llvm_libc::open(TEST_FILE1, O_RDONLY);
+ fd1 = LIBC_NAMESPACE::open(TEST_FILE1, O_RDONLY);
ASSERT_LT(fd1, 0);
ASSERT_NE(libc_errno, 0);
libc_errno = 0;
- ASSERT_THAT(__llvm_libc::close(fd2), Succeeds(0));
+ ASSERT_THAT(LIBC_NAMESPACE::close(fd2), Succeeds(0));
- ASSERT_THAT(__llvm_libc::unlink(TEST_FILE1), Succeeds(0));
- ASSERT_THAT(__llvm_libc::unlink(TEST_FILE2), Succeeds(0));
+ ASSERT_THAT(LIBC_NAMESPACE::unlink(TEST_FILE1), Succeeds(0));
+ ASSERT_THAT(LIBC_NAMESPACE::unlink(TEST_FILE2), Succeeds(0));
struct rlimit current_limits;
- ASSERT_THAT(__llvm_libc::getrlimit(RLIMIT_NOFILE, ¤t_limits),
+ ASSERT_THAT(LIBC_NAMESPACE::getrlimit(RLIMIT_NOFILE, ¤t_limits),
Succeeds(0));
ASSERT_EQ(current_limits.rlim_cur, rlim_t(4));
ASSERT_EQ(current_limits.rlim_max, rlim_t(4));
diff --git a/libc/test/src/sys/select/select_failure_test.cpp b/libc/test/src/sys/select/select_failure_test.cpp
index 44d5b2e14c01282..61df532b3e96ccc 100644
--- a/libc/test/src/sys/select/select_failure_test.cpp
+++ b/libc/test/src/sys/select/select_failure_test.cpp
@@ -15,7 +15,7 @@
#include <sys/select.h>
#include <unistd.h>
-using __llvm_libc::testing::ErrnoSetterMatcher::Fails;
+using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails;
TEST(LlvmLibcSelectTest, SelectInvalidFD) {
fd_set set;
@@ -23,6 +23,6 @@ TEST(LlvmLibcSelectTest, SelectInvalidFD) {
struct timeval timeout {
0, 0
};
- ASSERT_THAT(__llvm_libc::select(-1, &set, nullptr, nullptr, &timeout),
+ ASSERT_THAT(LIBC_NAMESPACE::select(-1, &set, nullptr, nullptr, &timeout),
Fails(EINVAL));
}
diff --git a/libc/test/src/sys/select/select_ui_test.cpp b/libc/test/src/sys/select/select_ui_test.cpp
index e10d1aa17096013..2e6baced801b106 100644
--- a/libc/test/src/sys/select/select_ui_test.cpp
+++ b/libc/test/src/sys/select/select_ui_test.cpp
@@ -32,18 +32,19 @@ TEST(LlvmLibcSelectTest, ReadStdinAfterSelect) {
// Zero timeout means we don't wait for input. So, select should return
// immediately.
- int count = __llvm_libc::select(STDIN_FD + 1, &set, nullptr, nullptr, &zero);
+ int count =
+ LIBC_NAMESPACE::select(STDIN_FD + 1, &set, nullptr, nullptr, &zero);
// The set should indicate that stdin is NOT ready for reading.
ASSERT_EQ(0, FD_ISSET(STDIN_FD, &set));
FD_SET(STDIN_FD, &set);
// Wait for an hour and give the user a chance to hit a key.
- count = __llvm_libc::select(STDIN_FD + 1, &set, nullptr, nullptr, &hr);
+ count = LIBC_NAMESPACE::select(STDIN_FD + 1, &set, nullptr, nullptr, &hr);
ASSERT_EQ(count, 1);
// The set should indicate that stdin is ready for reading.
ASSERT_EQ(1, FD_ISSET(STDIN_FD, &set));
// Verify that atleast one character can be read.
char c;
- ASSERT_EQ(__llvm_libc::read(STDIN_FD, &c, 1), ssize_t(1));
+ ASSERT_EQ(LIBC_NAMESPACE::read(STDIN_FD, &c, 1), ssize_t(1));
}
diff --git a/libc/test/src/sys/sendfile/sendfile_test.cpp b/libc/test/src/sys/sendfile/sendfile_test.cpp
index 9af01ad6337471f..6e4665a1bb96b10 100644
--- a/libc/test/src/sys/sendfile/sendfile_test.cpp
+++ b/libc/test/src/sys/sendfile/sendfile_test.cpp
@@ -20,11 +20,11 @@
#include <fcntl.h>
#include <sys/stat.h>
-namespace cpp = __llvm_libc::cpp;
+namespace cpp = LIBC_NAMESPACE::cpp;
TEST(LlvmLibcSendfileTest, CreateAndTransfer) {
- using __llvm_libc::testing::ErrnoSetterMatcher::Fails;
- using __llvm_libc::testing::ErrnoSetterMatcher::Succeeds;
+ using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails;
+ using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds;
// The test strategy is to
// 1. Create a temporary file with known data.
@@ -37,30 +37,30 @@ TEST(LlvmLibcSendfileTest, CreateAndTransfer) {
constexpr ssize_t IN_SIZE = ssize_t(sizeof(IN_DATA));
libc_errno = 0;
- int in_fd = __llvm_libc::open(IN_FILE, O_CREAT | O_WRONLY, S_IRWXU);
+ int in_fd = LIBC_NAMESPACE::open(IN_FILE, O_CREAT | O_WRONLY, S_IRWXU);
ASSERT_GT(in_fd, 0);
ASSERT_EQ(libc_errno, 0);
- ASSERT_EQ(__llvm_libc::write(in_fd, IN_DATA, IN_SIZE), IN_SIZE);
- ASSERT_THAT(__llvm_libc::close(in_fd), Succeeds(0));
+ ASSERT_EQ(LIBC_NAMESPACE::write(in_fd, IN_DATA, IN_SIZE), IN_SIZE);
+ ASSERT_THAT(LIBC_NAMESPACE::close(in_fd), Succeeds(0));
- in_fd = __llvm_libc::open(IN_FILE, O_RDONLY);
+ in_fd = LIBC_NAMESPACE::open(IN_FILE, O_RDONLY);
ASSERT_GT(in_fd, 0);
ASSERT_EQ(libc_errno, 0);
- int out_fd = __llvm_libc::open(OUT_FILE, O_CREAT | O_WRONLY, S_IRWXU);
+ int out_fd = LIBC_NAMESPACE::open(OUT_FILE, O_CREAT | O_WRONLY, S_IRWXU);
ASSERT_GT(out_fd, 0);
ASSERT_EQ(libc_errno, 0);
- ssize_t size = __llvm_libc::sendfile(in_fd, out_fd, nullptr, IN_SIZE);
+ ssize_t size = LIBC_NAMESPACE::sendfile(in_fd, out_fd, nullptr, IN_SIZE);
ASSERT_EQ(size, IN_SIZE);
- ASSERT_THAT(__llvm_libc::close(in_fd), Succeeds(0));
- ASSERT_THAT(__llvm_libc::close(out_fd), Succeeds(0));
+ ASSERT_THAT(LIBC_NAMESPACE::close(in_fd), Succeeds(0));
+ ASSERT_THAT(LIBC_NAMESPACE::close(out_fd), Succeeds(0));
- out_fd = __llvm_libc::open(OUT_FILE, O_RDONLY);
+ out_fd = LIBC_NAMESPACE::open(OUT_FILE, O_RDONLY);
ASSERT_GT(out_fd, 0);
ASSERT_EQ(libc_errno, 0);
char buf[IN_SIZE];
- ASSERT_EQ(IN_SIZE, __llvm_libc::read(out_fd, buf, IN_SIZE));
+ ASSERT_EQ(IN_SIZE, LIBC_NAMESPACE::read(out_fd, buf, IN_SIZE));
ASSERT_EQ(cpp::string_view(buf), cpp::string_view(IN_DATA));
- ASSERT_THAT(__llvm_libc::unlink(IN_FILE), Succeeds(0));
- ASSERT_THAT(__llvm_libc::unlink(OUT_FILE), Succeeds(0));
+ ASSERT_THAT(LIBC_NAMESPACE::unlink(IN_FILE), Succeeds(0));
+ ASSERT_THAT(LIBC_NAMESPACE::unlink(OUT_FILE), Succeeds(0));
}
diff --git a/libc/test/src/sys/socket/linux/socket_test.cpp b/libc/test/src/sys/socket/linux/socket_test.cpp
index 6826594e52d7b25..9037888441a357f 100644
--- a/libc/test/src/sys/socket/linux/socket_test.cpp
+++ b/libc/test/src/sys/socket/linux/socket_test.cpp
@@ -16,9 +16,9 @@
#include <sys/socket.h> // For AF_LOCAL and SOCK_DGRAM
TEST(LlvmLibcSocketTest, LocalSocket) {
- int sock = __llvm_libc::socket(AF_LOCAL, SOCK_DGRAM, 0);
+ int sock = LIBC_NAMESPACE::socket(AF_LOCAL, SOCK_DGRAM, 0);
ASSERT_GE(sock, 0);
ASSERT_EQ(libc_errno, 0);
- __llvm_libc::close(sock);
+ LIBC_NAMESPACE::close(sock);
}
diff --git a/libc/test/src/sys/stat/chmod_test.cpp b/libc/test/src/sys/stat/chmod_test.cpp
index f12d20dedf489f9..c476b92b5e4379f 100644
--- a/libc/test/src/sys/stat/chmod_test.cpp
+++ b/libc/test/src/sys/stat/chmod_test.cpp
@@ -18,8 +18,8 @@
#include <sys/stat.h>
TEST(LlvmLibcChmodTest, ChangeAndOpen) {
- using __llvm_libc::testing::ErrnoSetterMatcher::Fails;
- using __llvm_libc::testing::ErrnoSetterMatcher::Succeeds;
+ using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails;
+ using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds;
// The test file is initially writable. We open it for writing and ensure
// that it indeed can be opened for writing. Next, we close the file and
@@ -30,34 +30,36 @@ TEST(LlvmLibcChmodTest, ChangeAndOpen) {
constexpr ssize_t WRITE_SIZE = ssize_t(sizeof(WRITE_DATA));
libc_errno = 0;
- int fd = __llvm_libc::open(TEST_FILE, O_APPEND | O_WRONLY);
+ int fd = LIBC_NAMESPACE::open(TEST_FILE, O_APPEND | O_WRONLY);
ASSERT_GT(fd, 0);
ASSERT_EQ(libc_errno, 0);
- ASSERT_EQ(__llvm_libc::write(fd, WRITE_DATA, sizeof(WRITE_DATA)), WRITE_SIZE);
- ASSERT_THAT(__llvm_libc::close(fd), Succeeds(0));
+ ASSERT_EQ(LIBC_NAMESPACE::write(fd, WRITE_DATA, sizeof(WRITE_DATA)),
+ WRITE_SIZE);
+ ASSERT_THAT(LIBC_NAMESPACE::close(fd), Succeeds(0));
- fd = __llvm_libc::open(TEST_FILE, O_PATH);
+ fd = LIBC_NAMESPACE::open(TEST_FILE, O_PATH);
ASSERT_GT(fd, 0);
ASSERT_EQ(libc_errno, 0);
- ASSERT_THAT(__llvm_libc::close(fd), Succeeds(0));
- EXPECT_THAT(__llvm_libc::chmod(TEST_FILE, S_IRUSR), Succeeds(0));
+ ASSERT_THAT(LIBC_NAMESPACE::close(fd), Succeeds(0));
+ EXPECT_THAT(LIBC_NAMESPACE::chmod(TEST_FILE, S_IRUSR), Succeeds(0));
// Opening for writing should fail.
- EXPECT_EQ(__llvm_libc::open(TEST_FILE, O_APPEND | O_WRONLY), -1);
+ EXPECT_EQ(LIBC_NAMESPACE::open(TEST_FILE, O_APPEND | O_WRONLY), -1);
EXPECT_NE(libc_errno, 0);
libc_errno = 0;
// But opening for reading should succeed.
- fd = __llvm_libc::open(TEST_FILE, O_APPEND | O_RDONLY);
+ fd = LIBC_NAMESPACE::open(TEST_FILE, O_APPEND | O_RDONLY);
EXPECT_GT(fd, 0);
EXPECT_EQ(libc_errno, 0);
- EXPECT_THAT(__llvm_libc::close(fd), Succeeds(0));
- EXPECT_THAT(__llvm_libc::chmod(TEST_FILE, S_IRWXU), Succeeds(0));
+ EXPECT_THAT(LIBC_NAMESPACE::close(fd), Succeeds(0));
+ EXPECT_THAT(LIBC_NAMESPACE::chmod(TEST_FILE, S_IRWXU), Succeeds(0));
}
TEST(LlvmLibcChmodTest, NonExistentFile) {
libc_errno = 0;
- using __llvm_libc::testing::ErrnoSetterMatcher::Fails;
- ASSERT_THAT(__llvm_libc::chmod("non-existent-file", S_IRUSR), Fails(ENOENT));
+ using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails;
+ ASSERT_THAT(LIBC_NAMESPACE::chmod("non-existent-file", S_IRUSR),
+ Fails(ENOENT));
libc_errno = 0;
}
diff --git a/libc/test/src/sys/stat/fchmod_test.cpp b/libc/test/src/sys/stat/fchmod_test.cpp
index 0a6c9f4a4509b0c..5a32b5c973db9b6 100644
--- a/libc/test/src/sys/stat/fchmod_test.cpp
+++ b/libc/test/src/sys/stat/fchmod_test.cpp
@@ -18,8 +18,8 @@
#include <sys/stat.h>
TEST(LlvmLibcChmodTest, ChangeAndOpen) {
- using __llvm_libc::testing::ErrnoSetterMatcher::Fails;
- using __llvm_libc::testing::ErrnoSetterMatcher::Succeeds;
+ using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails;
+ using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds;
// The test file is initially writable. We open it for writing and ensure
// that it indeed can be opened for writing. Next, we close the file and
@@ -30,34 +30,35 @@ TEST(LlvmLibcChmodTest, ChangeAndOpen) {
constexpr ssize_t WRITE_SIZE = ssize_t(sizeof(WRITE_DATA));
libc_errno = 0;
- int fd = __llvm_libc::open(TEST_FILE, O_APPEND | O_WRONLY);
+ int fd = LIBC_NAMESPACE::open(TEST_FILE, O_APPEND | O_WRONLY);
ASSERT_GT(fd, 0);
ASSERT_EQ(libc_errno, 0);
- ASSERT_EQ(__llvm_libc::write(fd, WRITE_DATA, sizeof(WRITE_DATA)), WRITE_SIZE);
- ASSERT_THAT(__llvm_libc::close(fd), Succeeds(0));
+ ASSERT_EQ(LIBC_NAMESPACE::write(fd, WRITE_DATA, sizeof(WRITE_DATA)),
+ WRITE_SIZE);
+ ASSERT_THAT(LIBC_NAMESPACE::close(fd), Succeeds(0));
- fd = __llvm_libc::open(TEST_FILE, O_APPEND | O_WRONLY);
+ fd = LIBC_NAMESPACE::open(TEST_FILE, O_APPEND | O_WRONLY);
ASSERT_GT(fd, 0);
ASSERT_EQ(libc_errno, 0);
- EXPECT_THAT(__llvm_libc::fchmod(fd, S_IRUSR), Succeeds(0));
- ASSERT_THAT(__llvm_libc::close(fd), Succeeds(0));
+ EXPECT_THAT(LIBC_NAMESPACE::fchmod(fd, S_IRUSR), Succeeds(0));
+ ASSERT_THAT(LIBC_NAMESPACE::close(fd), Succeeds(0));
// Opening for writing should fail.
- EXPECT_EQ(__llvm_libc::open(TEST_FILE, O_APPEND | O_WRONLY), -1);
+ EXPECT_EQ(LIBC_NAMESPACE::open(TEST_FILE, O_APPEND | O_WRONLY), -1);
EXPECT_NE(libc_errno, 0);
libc_errno = 0;
// But opening for reading should succeed.
- fd = __llvm_libc::open(TEST_FILE, O_APPEND | O_RDONLY);
+ fd = LIBC_NAMESPACE::open(TEST_FILE, O_APPEND | O_RDONLY);
EXPECT_GT(fd, 0);
EXPECT_EQ(libc_errno, 0);
- EXPECT_THAT(__llvm_libc::fchmod(fd, S_IRWXU), Succeeds(0));
- EXPECT_THAT(__llvm_libc::close(fd), Succeeds(0));
+ EXPECT_THAT(LIBC_NAMESPACE::fchmod(fd, S_IRWXU), Succeeds(0));
+ EXPECT_THAT(LIBC_NAMESPACE::close(fd), Succeeds(0));
}
TEST(LlvmLibcChmodTest, NonExistentFile) {
libc_errno = 0;
- ASSERT_EQ(__llvm_libc::fchmod(-1, S_IRUSR), -1);
+ ASSERT_EQ(LIBC_NAMESPACE::fchmod(-1, S_IRUSR), -1);
ASSERT_NE(libc_errno, 0);
libc_errno = 0;
}
diff --git a/libc/test/src/sys/stat/fchmodat_test.cpp b/libc/test/src/sys/stat/fchmodat_test.cpp
index 578d0b0f1dfa671..077d21df15af3ce 100644
--- a/libc/test/src/sys/stat/fchmodat_test.cpp
+++ b/libc/test/src/sys/stat/fchmodat_test.cpp
@@ -18,8 +18,8 @@
#include <sys/stat.h>
TEST(LlvmLibcFchmodatTest, ChangeAndOpen) {
- using __llvm_libc::testing::ErrnoSetterMatcher::Fails;
- using __llvm_libc::testing::ErrnoSetterMatcher::Succeeds;
+ using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails;
+ using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds;
// The test file is initially writable. We open it for writing and ensure
// that it indeed can be opened for writing. Next, we close the file and
@@ -32,39 +32,41 @@ TEST(LlvmLibcFchmodatTest, ChangeAndOpen) {
constexpr ssize_t WRITE_SIZE = ssize_t(sizeof(WRITE_DATA));
libc_errno = 0;
- int fd = __llvm_libc::open(TEST_FILE, O_CREAT | O_WRONLY, S_IRWXU);
+ int fd = LIBC_NAMESPACE::open(TEST_FILE, O_CREAT | O_WRONLY, S_IRWXU);
ASSERT_GT(fd, 0);
ASSERT_EQ(libc_errno, 0);
- ASSERT_EQ(__llvm_libc::write(fd, WRITE_DATA, sizeof(WRITE_DATA)), WRITE_SIZE);
- ASSERT_THAT(__llvm_libc::close(fd), Succeeds(0));
+ ASSERT_EQ(LIBC_NAMESPACE::write(fd, WRITE_DATA, sizeof(WRITE_DATA)),
+ WRITE_SIZE);
+ ASSERT_THAT(LIBC_NAMESPACE::close(fd), Succeeds(0));
- int dirfd = __llvm_libc::open(TEST_DIR, O_DIRECTORY);
+ int dirfd = LIBC_NAMESPACE::open(TEST_DIR, O_DIRECTORY);
ASSERT_GT(dirfd, 0);
ASSERT_EQ(libc_errno, 0);
- EXPECT_THAT(__llvm_libc::fchmodat(dirfd, TEST_FILE_BASENAME, S_IRUSR, 0),
+ EXPECT_THAT(LIBC_NAMESPACE::fchmodat(dirfd, TEST_FILE_BASENAME, S_IRUSR, 0),
Succeeds(0));
// Opening for writing should fail.
- EXPECT_EQ(__llvm_libc::open(TEST_FILE, O_APPEND | O_WRONLY), -1);
+ EXPECT_EQ(LIBC_NAMESPACE::open(TEST_FILE, O_APPEND | O_WRONLY), -1);
EXPECT_NE(libc_errno, 0);
libc_errno = 0;
// But opening for reading should succeed.
- fd = __llvm_libc::open(TEST_FILE, O_APPEND | O_RDONLY);
+ fd = LIBC_NAMESPACE::open(TEST_FILE, O_APPEND | O_RDONLY);
EXPECT_GT(fd, 0);
EXPECT_EQ(libc_errno, 0);
- EXPECT_THAT(__llvm_libc::close(fd), Succeeds(0));
- EXPECT_THAT(__llvm_libc::fchmodat(dirfd, TEST_FILE_BASENAME, S_IRWXU, 0),
+ EXPECT_THAT(LIBC_NAMESPACE::close(fd), Succeeds(0));
+ EXPECT_THAT(LIBC_NAMESPACE::fchmodat(dirfd, TEST_FILE_BASENAME, S_IRWXU, 0),
Succeeds(0));
- EXPECT_THAT(__llvm_libc::close(dirfd), Succeeds(0));
+ EXPECT_THAT(LIBC_NAMESPACE::close(dirfd), Succeeds(0));
}
TEST(LlvmLibcFchmodatTest, NonExistentFile) {
libc_errno = 0;
- using __llvm_libc::testing::ErrnoSetterMatcher::Fails;
- ASSERT_THAT(__llvm_libc::fchmodat(AT_FDCWD, "non-existent-file", S_IRUSR, 0),
- Fails(ENOENT));
+ using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails;
+ ASSERT_THAT(
+ LIBC_NAMESPACE::fchmodat(AT_FDCWD, "non-existent-file", S_IRUSR, 0),
+ Fails(ENOENT));
libc_errno = 0;
}
diff --git a/libc/test/src/sys/stat/fstat_test.cpp b/libc/test/src/sys/stat/fstat_test.cpp
index 8220181e03bd5db..22e407f6d791b8d 100644
--- a/libc/test/src/sys/stat/fstat_test.cpp
+++ b/libc/test/src/sys/stat/fstat_test.cpp
@@ -18,8 +18,8 @@
#include <sys/stat.h>
TEST(LlvmLibcFStatTest, CreatAndReadMode) {
- using __llvm_libc::testing::ErrnoSetterMatcher::Fails;
- using __llvm_libc::testing::ErrnoSetterMatcher::Succeeds;
+ using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails;
+ using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds;
// The test file is initially writable. We open it for writing and ensure
// that it indeed can be opened for writing. Next, we close the file and
@@ -28,23 +28,23 @@ TEST(LlvmLibcFStatTest, CreatAndReadMode) {
constexpr const char *TEST_FILE = "testdata/fstat.test";
libc_errno = 0;
- int fd = __llvm_libc::open(TEST_FILE, O_CREAT | O_WRONLY, S_IRWXU);
+ int fd = LIBC_NAMESPACE::open(TEST_FILE, O_CREAT | O_WRONLY, S_IRWXU);
ASSERT_GT(fd, 0);
ASSERT_EQ(libc_errno, 0);
struct stat statbuf;
- ASSERT_THAT(__llvm_libc::fstat(fd, &statbuf), Succeeds(0));
+ ASSERT_THAT(LIBC_NAMESPACE::fstat(fd, &statbuf), Succeeds(0));
ASSERT_EQ(int(statbuf.st_mode), int(S_IRWXU | S_IFREG));
- ASSERT_THAT(__llvm_libc::close(fd), Succeeds(0));
- ASSERT_THAT(__llvm_libc::unlink(TEST_FILE), Succeeds(0));
+ ASSERT_THAT(LIBC_NAMESPACE::close(fd), Succeeds(0));
+ ASSERT_THAT(LIBC_NAMESPACE::unlink(TEST_FILE), Succeeds(0));
}
TEST(LlvmLibcFStatTest, NonExistentFile) {
libc_errno = 0;
- using __llvm_libc::testing::ErrnoSetterMatcher::Fails;
+ using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails;
struct stat statbuf;
- ASSERT_THAT(__llvm_libc::fstat(-1, &statbuf), Fails(EBADF));
+ ASSERT_THAT(LIBC_NAMESPACE::fstat(-1, &statbuf), Fails(EBADF));
libc_errno = 0;
}
diff --git a/libc/test/src/sys/stat/lstat_test.cpp b/libc/test/src/sys/stat/lstat_test.cpp
index a3edae192d28082..6eae08daeb1cff8 100644
--- a/libc/test/src/sys/stat/lstat_test.cpp
+++ b/libc/test/src/sys/stat/lstat_test.cpp
@@ -18,8 +18,8 @@
#include <sys/stat.h>
TEST(LlvmLibcLStatTest, CreatAndReadMode) {
- using __llvm_libc::testing::ErrnoSetterMatcher::Fails;
- using __llvm_libc::testing::ErrnoSetterMatcher::Succeeds;
+ using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails;
+ using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds;
// The test file is initially writable. We open it for writing and ensure
// that it indeed can be opened for writing. Next, we close the file and
@@ -28,23 +28,24 @@ TEST(LlvmLibcLStatTest, CreatAndReadMode) {
constexpr const char *TEST_FILE = "testdata/lstat.test";
libc_errno = 0;
- int fd = __llvm_libc::open(TEST_FILE, O_CREAT | O_WRONLY, S_IRWXU);
+ int fd = LIBC_NAMESPACE::open(TEST_FILE, O_CREAT | O_WRONLY, S_IRWXU);
ASSERT_GT(fd, 0);
ASSERT_EQ(libc_errno, 0);
- ASSERT_THAT(__llvm_libc::close(fd), Succeeds(0));
+ ASSERT_THAT(LIBC_NAMESPACE::close(fd), Succeeds(0));
struct stat statbuf;
- ASSERT_THAT(__llvm_libc::lstat(TEST_FILE, &statbuf), Succeeds(0));
+ ASSERT_THAT(LIBC_NAMESPACE::lstat(TEST_FILE, &statbuf), Succeeds(0));
ASSERT_EQ(int(statbuf.st_mode), int(S_IRWXU | S_IFREG));
- ASSERT_THAT(__llvm_libc::unlink(TEST_FILE), Succeeds(0));
+ ASSERT_THAT(LIBC_NAMESPACE::unlink(TEST_FILE), Succeeds(0));
}
TEST(LlvmLibcLStatTest, NonExistentFile) {
libc_errno = 0;
- using __llvm_libc::testing::ErrnoSetterMatcher::Fails;
+ using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails;
struct stat statbuf;
- ASSERT_THAT(__llvm_libc::lstat("non-existent-file", &statbuf), Fails(ENOENT));
+ ASSERT_THAT(LIBC_NAMESPACE::lstat("non-existent-file", &statbuf),
+ Fails(ENOENT));
libc_errno = 0;
}
diff --git a/libc/test/src/sys/stat/mkdirat_test.cpp b/libc/test/src/sys/stat/mkdirat_test.cpp
index 584f6eb18251abb..ae11af4f6b9b111 100644
--- a/libc/test/src/sys/stat/mkdirat_test.cpp
+++ b/libc/test/src/sys/stat/mkdirat_test.cpp
@@ -14,14 +14,16 @@
#include <fcntl.h>
TEST(LlvmLibcMkdiratTest, CreateAndRemove) {
- using __llvm_libc::testing::ErrnoSetterMatcher::Succeeds;
+ using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds;
constexpr const char *TEST_DIR = "testdata/mkdirat.testdir";
- ASSERT_THAT(__llvm_libc::mkdirat(AT_FDCWD, TEST_DIR, S_IRWXU), Succeeds(0));
- ASSERT_THAT(__llvm_libc::rmdir(TEST_DIR), Succeeds(0));
+ ASSERT_THAT(LIBC_NAMESPACE::mkdirat(AT_FDCWD, TEST_DIR, S_IRWXU),
+ Succeeds(0));
+ ASSERT_THAT(LIBC_NAMESPACE::rmdir(TEST_DIR), Succeeds(0));
}
TEST(LlvmLibcMkdiratTest, BadPath) {
- using __llvm_libc::testing::ErrnoSetterMatcher::Fails;
- ASSERT_THAT(__llvm_libc::mkdirat(AT_FDCWD, "non-existent-dir/test", S_IRWXU),
- Fails(ENOENT));
+ using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails;
+ ASSERT_THAT(
+ LIBC_NAMESPACE::mkdirat(AT_FDCWD, "non-existent-dir/test", S_IRWXU),
+ Fails(ENOENT));
}
diff --git a/libc/test/src/sys/stat/stat_test.cpp b/libc/test/src/sys/stat/stat_test.cpp
index dd9bb1cbe31715b..1711c860df269d2 100644
--- a/libc/test/src/sys/stat/stat_test.cpp
+++ b/libc/test/src/sys/stat/stat_test.cpp
@@ -18,8 +18,8 @@
#include <sys/stat.h>
TEST(LlvmLibcStatTest, CreatAndReadMode) {
- using __llvm_libc::testing::ErrnoSetterMatcher::Fails;
- using __llvm_libc::testing::ErrnoSetterMatcher::Succeeds;
+ using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails;
+ using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds;
// The test file is initially writable. We open it for writing and ensure
// that it indeed can be opened for writing. Next, we close the file and
@@ -28,23 +28,24 @@ TEST(LlvmLibcStatTest, CreatAndReadMode) {
constexpr const char *TEST_FILE = "testdata/stat.test";
libc_errno = 0;
- int fd = __llvm_libc::open(TEST_FILE, O_CREAT | O_WRONLY, S_IRWXU);
+ int fd = LIBC_NAMESPACE::open(TEST_FILE, O_CREAT | O_WRONLY, S_IRWXU);
ASSERT_GT(fd, 0);
ASSERT_EQ(libc_errno, 0);
- ASSERT_THAT(__llvm_libc::close(fd), Succeeds(0));
+ ASSERT_THAT(LIBC_NAMESPACE::close(fd), Succeeds(0));
struct stat statbuf;
- ASSERT_THAT(__llvm_libc::stat(TEST_FILE, &statbuf), Succeeds(0));
+ ASSERT_THAT(LIBC_NAMESPACE::stat(TEST_FILE, &statbuf), Succeeds(0));
ASSERT_EQ(int(statbuf.st_mode), int(S_IRWXU | S_IFREG));
- ASSERT_THAT(__llvm_libc::unlink(TEST_FILE), Succeeds(0));
+ ASSERT_THAT(LIBC_NAMESPACE::unlink(TEST_FILE), Succeeds(0));
}
TEST(LlvmLibcStatTest, NonExistentFile) {
libc_errno = 0;
- using __llvm_libc::testing::ErrnoSetterMatcher::Fails;
+ using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails;
struct stat statbuf;
- ASSERT_THAT(__llvm_libc::stat("non-existent-file", &statbuf), Fails(ENOENT));
+ ASSERT_THAT(LIBC_NAMESPACE::stat("non-existent-file", &statbuf),
+ Fails(ENOENT));
libc_errno = 0;
}
diff --git a/libc/test/src/sys/utsname/uname_test.cpp b/libc/test/src/sys/utsname/uname_test.cpp
index 58d7db797a621f4..79822c112a5b6b0 100644
--- a/libc/test/src/sys/utsname/uname_test.cpp
+++ b/libc/test/src/sys/utsname/uname_test.cpp
@@ -17,7 +17,7 @@
TEST(LlvmLibcUnameTest, GetMachineName) {
struct utsname names;
- ASSERT_GE(__llvm_libc::uname(&names), 0);
+ ASSERT_GE(LIBC_NAMESPACE::uname(&names), 0);
#ifdef LIBC_TARGET_ARCH_IS_X86_64
ASSERT_STREQ(names.machine, "x86_64");
#elif defined(LIBC_TARGET_ARCH_IS_AARCH64)
diff --git a/libc/test/src/sys/wait/wait4_test.cpp b/libc/test/src/sys/wait/wait4_test.cpp
index a7ea9ee25d7ce74..70d4d436927e6b2 100644
--- a/libc/test/src/sys/wait/wait4_test.cpp
+++ b/libc/test/src/sys/wait/wait4_test.cpp
@@ -17,7 +17,8 @@
// involved test, look at fork_test.
TEST(LlvmLibcwait4Test, NoHangTest) {
- using __llvm_libc::testing::ErrnoSetterMatcher::Fails;
+ using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails;
int status;
- ASSERT_THAT(__llvm_libc::wait4(-1, &status, WNOHANG, nullptr), Fails(ECHILD));
+ ASSERT_THAT(LIBC_NAMESPACE::wait4(-1, &status, WNOHANG, nullptr),
+ Fails(ECHILD));
}
diff --git a/libc/test/src/sys/wait/waitpid_test.cpp b/libc/test/src/sys/wait/waitpid_test.cpp
index 64441e70ec42805..b2ace2617d2d3f0 100644
--- a/libc/test/src/sys/wait/waitpid_test.cpp
+++ b/libc/test/src/sys/wait/waitpid_test.cpp
@@ -17,7 +17,7 @@
// involved test, look at fork_test.
TEST(LlvmLibcWaitPidTest, NoHangTest) {
- using __llvm_libc::testing::ErrnoSetterMatcher::Fails;
+ using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails;
int status;
- ASSERT_THAT(__llvm_libc::waitpid(-1, &status, WNOHANG), Fails(ECHILD));
+ ASSERT_THAT(LIBC_NAMESPACE::waitpid(-1, &status, WNOHANG), Fails(ECHILD));
}
diff --git a/libc/test/src/termios/termios_test.cpp b/libc/test/src/termios/termios_test.cpp
index 01a78c24de38388..3048f9cda1e0596 100644
--- a/libc/test/src/termios/termios_test.cpp
+++ b/libc/test/src/termios/termios_test.cpp
@@ -21,8 +21,8 @@
#include <termios.h>
-using __llvm_libc::testing::ErrnoSetterMatcher::Fails;
-using __llvm_libc::testing::ErrnoSetterMatcher::Succeeds;
+using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails;
+using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds;
// We just list a bunch of smoke tests here as it is not possible to
// test functionality at the least because we want to run the tests
@@ -31,34 +31,34 @@ using __llvm_libc::testing::ErrnoSetterMatcher::Succeeds;
TEST(LlvmLibcTermiosTest, SpeedSmokeTest) {
struct termios t;
libc_errno = 0;
- ASSERT_THAT(__llvm_libc::cfsetispeed(&t, B50), Succeeds(0));
- ASSERT_EQ(__llvm_libc::cfgetispeed(&t), speed_t(B50));
- ASSERT_THAT(__llvm_libc::cfsetospeed(&t, B75), Succeeds(0));
- ASSERT_EQ(__llvm_libc::cfgetospeed(&t), speed_t(B75));
+ ASSERT_THAT(LIBC_NAMESPACE::cfsetispeed(&t, B50), Succeeds(0));
+ ASSERT_EQ(LIBC_NAMESPACE::cfgetispeed(&t), speed_t(B50));
+ ASSERT_THAT(LIBC_NAMESPACE::cfsetospeed(&t, B75), Succeeds(0));
+ ASSERT_EQ(LIBC_NAMESPACE::cfgetospeed(&t), speed_t(B75));
libc_errno = 0;
- ASSERT_THAT(__llvm_libc::cfsetispeed(&t, ~CBAUD), Fails(EINVAL));
+ ASSERT_THAT(LIBC_NAMESPACE::cfsetispeed(&t, ~CBAUD), Fails(EINVAL));
libc_errno = 0;
- ASSERT_THAT(__llvm_libc::cfsetospeed(&t, ~CBAUD), Fails(EINVAL));
+ ASSERT_THAT(LIBC_NAMESPACE::cfsetospeed(&t, ~CBAUD), Fails(EINVAL));
}
TEST(LlvmLibcTermiosTest, GetAttrSmokeTest) {
struct termios t;
libc_errno = 0;
- int fd = __llvm_libc::open("/dev/tty", O_RDONLY);
+ int fd = LIBC_NAMESPACE::open("/dev/tty", O_RDONLY);
if (fd < 0)
return; // When /dev/tty is not available, no point continuing.
ASSERT_EQ(libc_errno, 0);
- ASSERT_THAT(__llvm_libc::tcgetattr(fd, &t), Succeeds(0));
- ASSERT_EQ(__llvm_libc::close(fd), 0);
+ ASSERT_THAT(LIBC_NAMESPACE::tcgetattr(fd, &t), Succeeds(0));
+ ASSERT_EQ(LIBC_NAMESPACE::close(fd), 0);
}
TEST(LlvmLibcTermiosTest, TcGetSidSmokeTest) {
libc_errno = 0;
- int fd = __llvm_libc::open("/dev/tty", O_RDONLY);
+ int fd = LIBC_NAMESPACE::open("/dev/tty", O_RDONLY);
if (fd < 0)
return; // When /dev/tty is not available, no point continuing.
ASSERT_EQ(libc_errno, 0);
- ASSERT_GT(__llvm_libc::tcgetsid(fd), pid_t(0));
- ASSERT_EQ(__llvm_libc::close(fd), 0);
+ ASSERT_GT(LIBC_NAMESPACE::tcgetsid(fd), pid_t(0));
+ ASSERT_EQ(LIBC_NAMESPACE::close(fd), 0);
}
diff --git a/libc/test/src/time/TmHelper.h b/libc/test/src/time/TmHelper.h
index 54d9f4eb72ce3b3..19202031915df16 100644
--- a/libc/test/src/time/TmHelper.h
+++ b/libc/test/src/time/TmHelper.h
@@ -13,9 +13,9 @@
#include "src/time/time_utils.h"
-using __llvm_libc::time_utils::TimeConstants;
+using LIBC_NAMESPACE::time_utils::TimeConstants;
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
namespace tmhelper {
namespace testing {
@@ -37,6 +37,6 @@ static inline void initialize_tm_data(struct tm *tm_data, int year, int month,
} // namespace testing
} // namespace tmhelper
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#endif // LLVM_LIBC_TEST_SRC_TIME_TM_HELPER_H
diff --git a/libc/test/src/time/TmMatcher.h b/libc/test/src/time/TmMatcher.h
index fb2d57bb99add53..7cdc2c4b90502c2 100644
--- a/libc/test/src/time/TmMatcher.h
+++ b/libc/test/src/time/TmMatcher.h
@@ -13,7 +13,7 @@
#include "test/UnitTest/Test.h"
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
namespace testing {
class StructTmMatcher : public Matcher<::tm> {
@@ -57,9 +57,9 @@ class StructTmMatcher : public Matcher<::tm> {
};
} // namespace testing
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
#define EXPECT_TM_EQ(expected, actual) \
- EXPECT_THAT((actual), __llvm_libc::testing::StructTmMatcher((expected)))
+ EXPECT_THAT((actual), LIBC_NAMESPACE::testing::StructTmMatcher((expected)))
#endif // LLVM_LIBC_TEST_SRC_TIME_TM_MATCHER_H
diff --git a/libc/test/src/time/asctime_r_test.cpp b/libc/test/src/time/asctime_r_test.cpp
index 9682f1822f0c59c..1abaa135350c139 100644
--- a/libc/test/src/time/asctime_r_test.cpp
+++ b/libc/test/src/time/asctime_r_test.cpp
@@ -12,31 +12,31 @@
#include "test/UnitTest/Test.h"
#include "test/src/time/TmHelper.h"
-using __llvm_libc::time_utils::TimeConstants;
+using LIBC_NAMESPACE::time_utils::TimeConstants;
static inline char *call_asctime_r(struct tm *tm_data, int year, int month,
int mday, int hour, int min, int sec,
int wday, int yday, char *buffer) {
- __llvm_libc::tmhelper::testing::initialize_tm_data(
+ LIBC_NAMESPACE::tmhelper::testing::initialize_tm_data(
tm_data, year, month, mday, hour, min, sec, wday, yday);
- return __llvm_libc::asctime_r(tm_data, buffer);
+ return LIBC_NAMESPACE::asctime_r(tm_data, buffer);
}
// asctime and asctime_r share the same code and thus didn't repeat all the
// tests from asctime. Added couple of validation tests.
TEST(LlvmLibcAsctimeR, Nullptr) {
char *result;
- result = __llvm_libc::asctime_r(nullptr, nullptr);
+ result = LIBC_NAMESPACE::asctime_r(nullptr, nullptr);
ASSERT_EQ(EINVAL, libc_errno);
ASSERT_STREQ(nullptr, result);
char buffer[TimeConstants::ASCTIME_BUFFER_SIZE];
- result = __llvm_libc::asctime_r(nullptr, buffer);
+ result = LIBC_NAMESPACE::asctime_r(nullptr, buffer);
ASSERT_EQ(EINVAL, libc_errno);
ASSERT_STREQ(nullptr, result);
struct tm tm_data;
- result = __llvm_libc::asctime_r(&tm_data, nullptr);
+ result = LIBC_NAMESPACE::asctime_r(&tm_data, nullptr);
ASSERT_EQ(EINVAL, libc_errno);
ASSERT_STREQ(nullptr, result);
}
diff --git a/libc/test/src/time/asctime_test.cpp b/libc/test/src/time/asctime_test.cpp
index 3df2edf1f9c9a02..4b5ceb596aa467c 100644
--- a/libc/test/src/time/asctime_test.cpp
+++ b/libc/test/src/time/asctime_test.cpp
@@ -14,14 +14,14 @@
static inline char *call_asctime(struct tm *tm_data, int year, int month,
int mday, int hour, int min, int sec, int wday,
int yday) {
- __llvm_libc::tmhelper::testing::initialize_tm_data(
+ LIBC_NAMESPACE::tmhelper::testing::initialize_tm_data(
tm_data, year, month, mday, hour, min, sec, wday, yday);
- return __llvm_libc::asctime(tm_data);
+ return LIBC_NAMESPACE::asctime(tm_data);
}
TEST(LlvmLibcAsctime, Nullptr) {
char *result;
- result = __llvm_libc::asctime(nullptr);
+ result = LIBC_NAMESPACE::asctime(nullptr);
ASSERT_EQ(EINVAL, libc_errno);
ASSERT_STREQ(nullptr, result);
}
diff --git a/libc/test/src/time/clock_gettime_test.cpp b/libc/test/src/time/clock_gettime_test.cpp
index 58f9c61129d2061..6367ae7145a47d4 100644
--- a/libc/test/src/time/clock_gettime_test.cpp
+++ b/libc/test/src/time/clock_gettime_test.cpp
@@ -14,7 +14,7 @@
TEST(LlvmLibcClockGetTime, RealTime) {
struct timespec tp;
int result;
- result = __llvm_libc::clock_gettime(CLOCK_REALTIME, &tp);
+ result = LIBC_NAMESPACE::clock_gettime(CLOCK_REALTIME, &tp);
ASSERT_EQ(result, 0);
ASSERT_GT(tp.tv_sec, time_t(0));
}
@@ -23,10 +23,10 @@ TEST(LlvmLibcClockGetTime, RealTime) {
TEST(LlvmLibcClockGetTime, MonotonicTime) {
struct timespec tp1, tp2;
int result;
- result = __llvm_libc::clock_gettime(CLOCK_MONOTONIC, &tp1);
+ result = LIBC_NAMESPACE::clock_gettime(CLOCK_MONOTONIC, &tp1);
ASSERT_EQ(result, 0);
ASSERT_GT(tp1.tv_sec, time_t(0));
- result = __llvm_libc::clock_gettime(CLOCK_MONOTONIC, &tp2);
+ result = LIBC_NAMESPACE::clock_gettime(CLOCK_MONOTONIC, &tp2);
ASSERT_EQ(result, 0);
ASSERT_GE(tp2.tv_sec, tp1.tv_sec); // The monotonic clock should increase.
if (tp2.tv_sec == tp1.tv_sec) {
diff --git a/libc/test/src/time/clock_test.cpp b/libc/test/src/time/clock_test.cpp
index fc7e5b54342d8c8..a3dffc6bae3913d 100644
--- a/libc/test/src/time/clock_test.cpp
+++ b/libc/test/src/time/clock_test.cpp
@@ -13,9 +13,9 @@
#include <time.h>
TEST(LlvmLibcClockTest, SmokeTest) {
- clock_t c1 = __llvm_libc::clock();
+ clock_t c1 = LIBC_NAMESPACE::clock();
ASSERT_GT(c1, clock_t(0));
- clock_t c2 = __llvm_libc::clock();
+ clock_t c2 = LIBC_NAMESPACE::clock();
ASSERT_GE(c2, c1);
}
diff --git a/libc/test/src/time/difftime_test.cpp b/libc/test/src/time/difftime_test.cpp
index dc22494114dfd1b..187df4add1e727c 100644
--- a/libc/test/src/time/difftime_test.cpp
+++ b/libc/test/src/time/difftime_test.cpp
@@ -12,23 +12,23 @@
#include "test/UnitTest/ErrnoSetterMatcher.h"
#include "test/UnitTest/Test.h"
-using __llvm_libc::testing::ErrnoSetterMatcher::Succeeds;
-using __llvm_libc::time_utils::TimeConstants;
+using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds;
+using LIBC_NAMESPACE::time_utils::TimeConstants;
TEST(LlvmLibcDifftime, SmokeTest) {
time_t t1_seconds = TimeConstants::SECONDS_PER_HOUR;
time_t t2_seconds = 0;
- __llvm_libc::fputil::FPBits<long double> expected_fp =
- __llvm_libc::fputil::FPBits<long double>();
- expected_fp = __llvm_libc::fputil::FPBits<long double>(
+ LIBC_NAMESPACE::fputil::FPBits<long double> expected_fp =
+ LIBC_NAMESPACE::fputil::FPBits<long double>();
+ expected_fp = LIBC_NAMESPACE::fputil::FPBits<long double>(
static_cast<long double>(t1_seconds));
- double result = __llvm_libc::difftime(t1_seconds, t2_seconds);
+ double result = LIBC_NAMESPACE::difftime(t1_seconds, t2_seconds);
- __llvm_libc::fputil::FPBits<long double> actual_fp =
- __llvm_libc::fputil::FPBits<long double>();
- actual_fp = __llvm_libc::fputil::FPBits<long double>(
+ LIBC_NAMESPACE::fputil::FPBits<long double> actual_fp =
+ LIBC_NAMESPACE::fputil::FPBits<long double>();
+ actual_fp = LIBC_NAMESPACE::fputil::FPBits<long double>(
static_cast<long double>(result));
EXPECT_EQ(actual_fp.bits, expected_fp.bits);
diff --git a/libc/test/src/time/gettimeofday_test.cpp b/libc/test/src/time/gettimeofday_test.cpp
index a852d4fd30ef120..44250787c5381ef 100644
--- a/libc/test/src/time/gettimeofday_test.cpp
+++ b/libc/test/src/time/gettimeofday_test.cpp
@@ -13,28 +13,28 @@
#include "test/UnitTest/ErrnoSetterMatcher.h"
#include "test/UnitTest/Test.h"
-namespace cpp = __llvm_libc::cpp;
+namespace cpp = LIBC_NAMESPACE::cpp;
TEST(LlvmLibcGettimeofday, SmokeTest) {
- using __llvm_libc::testing::ErrnoSetterMatcher::Succeeds;
+ using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds;
void *tz = nullptr;
struct timeval tv;
int sleep_times[2] = {200, 1000};
for (int i = 0; i < 2; i++) {
- int ret = __llvm_libc::gettimeofday(&tv, tz);
+ int ret = LIBC_NAMESPACE::gettimeofday(&tv, tz);
ASSERT_EQ(ret, 0);
int sleep_time = sleep_times[i];
// Sleep for {sleep_time} microsceconds.
struct timespec tim = {0, sleep_time * 1000};
struct timespec tim2 = {0, 0};
- ret = __llvm_libc::nanosleep(&tim, &tim2);
+ ret = LIBC_NAMESPACE::nanosleep(&tim, &tim2);
// Call gettimeofday again and verify that it is more {sleep_time}
// microscecods.
struct timeval tv1;
- ret = __llvm_libc::gettimeofday(&tv1, tz);
+ ret = LIBC_NAMESPACE::gettimeofday(&tv1, tz);
ASSERT_EQ(ret, 0);
ASSERT_GE(tv1.tv_usec - tv.tv_usec, sleep_time);
}
diff --git a/libc/test/src/time/gmtime_r_test.cpp b/libc/test/src/time/gmtime_r_test.cpp
index 0d210b6f04fe6e2..2276b4803f1922d 100644
--- a/libc/test/src/time/gmtime_r_test.cpp
+++ b/libc/test/src/time/gmtime_r_test.cpp
@@ -11,7 +11,7 @@
#include "test/UnitTest/Test.h"
#include "test/src/time/TmMatcher.h"
-using __llvm_libc::time_utils::TimeConstants;
+using LIBC_NAMESPACE::time_utils::TimeConstants;
// gmtime and gmtime_r share the same code and thus didn't repeat all the tests
// from gmtime. Added couple of validation tests.
@@ -21,7 +21,7 @@ TEST(LlvmLibcGmTimeR, EndOf32BitEpochYear) {
time_t seconds = 0x7FFFFFFF;
struct tm tm_data;
struct tm *tm_data_ptr;
- tm_data_ptr = __llvm_libc::gmtime_r(&seconds, &tm_data);
+ tm_data_ptr = LIBC_NAMESPACE::gmtime_r(&seconds, &tm_data);
EXPECT_TM_EQ((tm{7, // sec
14, // min
3, // hr
@@ -42,7 +42,7 @@ TEST(LlvmLibcGmTimeR, Max64BitYear) {
time_t seconds = 67767976202043050;
struct tm tm_data;
struct tm *tm_data_ptr;
- tm_data_ptr = __llvm_libc::gmtime_r(&seconds, &tm_data);
+ tm_data_ptr = LIBC_NAMESPACE::gmtime_r(&seconds, &tm_data);
EXPECT_TM_EQ((tm{50, // sec
50, // min
12, // hr
diff --git a/libc/test/src/time/gmtime_test.cpp b/libc/test/src/time/gmtime_test.cpp
index 4d990b3da5bc15a..6b1d029a693c383 100644
--- a/libc/test/src/time/gmtime_test.cpp
+++ b/libc/test/src/time/gmtime_test.cpp
@@ -15,9 +15,9 @@
#include <limits.h>
-using __llvm_libc::testing::ErrnoSetterMatcher::Fails;
-using __llvm_libc::testing::ErrnoSetterMatcher::Succeeds;
-using __llvm_libc::time_utils::TimeConstants;
+using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails;
+using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds;
+using LIBC_NAMESPACE::time_utils::TimeConstants;
TEST(LlvmLibcGmTime, OutOfRange) {
if (sizeof(time_t) < sizeof(int64_t))
@@ -25,7 +25,7 @@ TEST(LlvmLibcGmTime, OutOfRange) {
time_t seconds =
1 + INT_MAX * static_cast<int64_t>(
TimeConstants::NUMBER_OF_SECONDS_IN_LEAP_YEAR);
- struct tm *tm_data = __llvm_libc::gmtime(&seconds);
+ struct tm *tm_data = LIBC_NAMESPACE::gmtime(&seconds);
EXPECT_TRUE(tm_data == nullptr);
EXPECT_EQ(libc_errno, EOVERFLOW);
@@ -33,7 +33,7 @@ TEST(LlvmLibcGmTime, OutOfRange) {
seconds = INT_MIN * static_cast<int64_t>(
TimeConstants::NUMBER_OF_SECONDS_IN_LEAP_YEAR) -
1;
- tm_data = __llvm_libc::gmtime(&seconds);
+ tm_data = LIBC_NAMESPACE::gmtime(&seconds);
EXPECT_TRUE(tm_data == nullptr);
EXPECT_EQ(libc_errno, EOVERFLOW);
}
@@ -43,7 +43,7 @@ TEST(LlvmLibcGmTime, InvalidSeconds) {
struct tm *tm_data = nullptr;
// -1 second from 1970-01-01 00:00:00 returns 1969-12-31 23:59:59.
seconds = -1;
- tm_data = __llvm_libc::gmtime(&seconds);
+ tm_data = LIBC_NAMESPACE::gmtime(&seconds);
EXPECT_TM_EQ((tm{59, // sec
59, // min
23, // hr
@@ -56,7 +56,7 @@ TEST(LlvmLibcGmTime, InvalidSeconds) {
*tm_data);
// 60 seconds from 1970-01-01 00:00:00 returns 1970-01-01 00:01:00.
seconds = 60;
- tm_data = __llvm_libc::gmtime(&seconds);
+ tm_data = LIBC_NAMESPACE::gmtime(&seconds);
EXPECT_TM_EQ((tm{0, // sec
1, // min
0, // hr
@@ -74,7 +74,7 @@ TEST(LlvmLibcGmTime, InvalidMinutes) {
struct tm *tm_data = nullptr;
// -1 minute from 1970-01-01 00:00:00 returns 1969-12-31 23:59:00.
seconds = -TimeConstants::SECONDS_PER_MIN;
- tm_data = __llvm_libc::gmtime(&seconds);
+ tm_data = LIBC_NAMESPACE::gmtime(&seconds);
EXPECT_TM_EQ((tm{0, // sec
59, // min
23, // hr
@@ -87,7 +87,7 @@ TEST(LlvmLibcGmTime, InvalidMinutes) {
*tm_data);
// 60 minutes from 1970-01-01 00:00:00 returns 1970-01-01 01:00:00.
seconds = 60 * TimeConstants::SECONDS_PER_MIN;
- tm_data = __llvm_libc::gmtime(&seconds);
+ tm_data = LIBC_NAMESPACE::gmtime(&seconds);
EXPECT_TM_EQ((tm{0, // sec
0, // min
1, // hr
@@ -105,7 +105,7 @@ TEST(LlvmLibcGmTime, InvalidHours) {
struct tm *tm_data = nullptr;
// -1 hour from 1970-01-01 00:00:00 returns 1969-12-31 23:00:00.
seconds = -TimeConstants::SECONDS_PER_HOUR;
- tm_data = __llvm_libc::gmtime(&seconds);
+ tm_data = LIBC_NAMESPACE::gmtime(&seconds);
EXPECT_TM_EQ((tm{0, // sec
0, // min
23, // hr
@@ -118,7 +118,7 @@ TEST(LlvmLibcGmTime, InvalidHours) {
*tm_data);
// 24 hours from 1970-01-01 00:00:00 returns 1970-01-02 00:00:00.
seconds = 24 * TimeConstants::SECONDS_PER_HOUR;
- tm_data = __llvm_libc::gmtime(&seconds);
+ tm_data = LIBC_NAMESPACE::gmtime(&seconds);
EXPECT_TM_EQ((tm{0, // sec
0, // min
0, // hr
@@ -135,7 +135,7 @@ TEST(LlvmLibcGmTime, InvalidYear) {
// -1 year from 1970-01-01 00:00:00 returns 1969-01-01 00:00:00.
time_t seconds =
-TimeConstants::DAYS_PER_NON_LEAP_YEAR * TimeConstants::SECONDS_PER_DAY;
- struct tm *tm_data = __llvm_libc::gmtime(&seconds);
+ struct tm *tm_data = LIBC_NAMESPACE::gmtime(&seconds);
EXPECT_TM_EQ((tm{0, // sec
0, // min
0, // hr
@@ -153,7 +153,7 @@ TEST(LlvmLibcGmTime, InvalidMonths) {
struct tm *tm_data = nullptr;
// -1 month from 1970-01-01 00:00:00 returns 1969-12-01 00:00:00.
seconds = -31 * TimeConstants::SECONDS_PER_DAY;
- tm_data = __llvm_libc::gmtime(&seconds);
+ tm_data = LIBC_NAMESPACE::gmtime(&seconds);
EXPECT_TM_EQ((tm{0, // sec
0, // min
0, // hr
@@ -167,7 +167,7 @@ TEST(LlvmLibcGmTime, InvalidMonths) {
// 1970-13-01 00:00:00 returns 1971-01-01 00:00:00.
seconds =
TimeConstants::DAYS_PER_NON_LEAP_YEAR * TimeConstants::SECONDS_PER_DAY;
- tm_data = __llvm_libc::gmtime(&seconds);
+ tm_data = LIBC_NAMESPACE::gmtime(&seconds);
EXPECT_TM_EQ((tm{0, // sec
0, // min
0, // hr
@@ -185,7 +185,7 @@ TEST(LlvmLibcGmTime, InvalidDays) {
struct tm *tm_data = nullptr;
// -1 day from 1970-01-01 00:00:00 returns 1969-12-31 00:00:00.
seconds = -1 * TimeConstants::SECONDS_PER_DAY;
- tm_data = __llvm_libc::gmtime(&seconds);
+ tm_data = LIBC_NAMESPACE::gmtime(&seconds);
EXPECT_TM_EQ((tm{0, // sec
0, // min
0, // hr
@@ -199,7 +199,7 @@ TEST(LlvmLibcGmTime, InvalidDays) {
// 1970-01-32 00:00:00 returns 1970-02-01 00:00:00.
seconds = 31 * TimeConstants::SECONDS_PER_DAY;
- tm_data = __llvm_libc::gmtime(&seconds);
+ tm_data = LIBC_NAMESPACE::gmtime(&seconds);
EXPECT_TM_EQ((tm{0, // sec
0, // min
0, // hr
@@ -213,7 +213,7 @@ TEST(LlvmLibcGmTime, InvalidDays) {
// 1970-02-29 00:00:00 returns 1970-03-01 00:00:00.
seconds = 59 * TimeConstants::SECONDS_PER_DAY;
- tm_data = __llvm_libc::gmtime(&seconds);
+ tm_data = LIBC_NAMESPACE::gmtime(&seconds);
EXPECT_TM_EQ((tm{0, // sec
0, // min
0, // hr
@@ -228,7 +228,7 @@ TEST(LlvmLibcGmTime, InvalidDays) {
// 1972-02-30 00:00:00 returns 1972-03-01 00:00:00.
seconds = ((2 * TimeConstants::DAYS_PER_NON_LEAP_YEAR) + 60) *
TimeConstants::SECONDS_PER_DAY;
- tm_data = __llvm_libc::gmtime(&seconds);
+ tm_data = LIBC_NAMESPACE::gmtime(&seconds);
EXPECT_TM_EQ((tm{0, // sec
0, // min
0, // hr
@@ -245,7 +245,7 @@ TEST(LlvmLibcGmTime, EndOf32BitEpochYear) {
// Test for maximum value of a signed 32-bit integer.
// Test implementation can encode time for Tue 19 January 2038 03:14:07 UTC.
time_t seconds = 0x7FFFFFFF;
- struct tm *tm_data = __llvm_libc::gmtime(&seconds);
+ struct tm *tm_data = LIBC_NAMESPACE::gmtime(&seconds);
EXPECT_TM_EQ((tm{7, // sec
14, // min
3, // hr
@@ -263,7 +263,7 @@ TEST(LlvmLibcGmTime, Max64BitYear) {
return;
// Mon Jan 1 12:50:50 2170 (200 years from 1970),
time_t seconds = 6311479850;
- struct tm *tm_data = __llvm_libc::gmtime(&seconds);
+ struct tm *tm_data = LIBC_NAMESPACE::gmtime(&seconds);
EXPECT_TM_EQ((tm{50, // sec
50, // min
12, // hr
@@ -277,7 +277,7 @@ TEST(LlvmLibcGmTime, Max64BitYear) {
// Test for Tue Jan 1 12:50:50 in 2,147,483,647th year.
seconds = 67767976202043050;
- tm_data = __llvm_libc::gmtime(&seconds);
+ tm_data = LIBC_NAMESPACE::gmtime(&seconds);
EXPECT_TM_EQ((tm{50, // sec
50, // min
12, // hr
diff --git a/libc/test/src/time/mktime_test.cpp b/libc/test/src/time/mktime_test.cpp
index 6cf115e89f05ef5..753363ec3975862 100644
--- a/libc/test/src/time/mktime_test.cpp
+++ b/libc/test/src/time/mktime_test.cpp
@@ -15,9 +15,9 @@
#include <limits.h>
-using __llvm_libc::testing::ErrnoSetterMatcher::Fails;
-using __llvm_libc::testing::ErrnoSetterMatcher::Succeeds;
-using __llvm_libc::time_utils::Month;
+using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails;
+using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds;
+using LIBC_NAMESPACE::time_utils::Month;
static inline constexpr int tm_year(int year) {
return year - TimeConstants::TIME_YEAR_BASE;
@@ -29,7 +29,7 @@ TEST(LlvmLibcMkTime, FailureSetsErrno) {
.tm_mday = INT_MAX, .tm_mon = INT_MAX - 1, .tm_year = tm_year(INT_MAX),
.tm_wday = 0, .tm_yday = 0
};
- EXPECT_THAT(__llvm_libc::mktime(&tm_data), Fails(EOVERFLOW));
+ EXPECT_THAT(LIBC_NAMESPACE::mktime(&tm_data), Fails(EOVERFLOW));
}
TEST(LlvmLibcMkTime, InvalidSeconds) {
@@ -40,7 +40,7 @@ TEST(LlvmLibcMkTime, InvalidSeconds) {
.tm_mon = Month::JANUARY, .tm_year = tm_year(1970), .tm_wday = 0,
.tm_yday = 0
};
- EXPECT_THAT(__llvm_libc::mktime(&tm_data), Succeeds(-1));
+ EXPECT_THAT(LIBC_NAMESPACE::mktime(&tm_data), Succeeds(-1));
EXPECT_TM_EQ((tm{.tm_sec = 59,
.tm_min = 59,
.tm_hour = 23,
@@ -59,7 +59,7 @@ TEST(LlvmLibcMkTime, InvalidSeconds) {
.tm_mon = Month::JANUARY, .tm_year = tm_year(1970), .tm_wday = 0,
.tm_yday = 0
};
- EXPECT_THAT(__llvm_libc::mktime(&tm_data), Succeeds(60));
+ EXPECT_THAT(LIBC_NAMESPACE::mktime(&tm_data), Succeeds(60));
EXPECT_TM_EQ((tm{.tm_sec = 0,
.tm_min = 1,
.tm_hour = 0,
@@ -80,7 +80,7 @@ TEST(LlvmLibcMkTime, InvalidMinutes) {
.tm_mon = Month::JANUARY, .tm_year = tm_year(1970), .tm_wday = 0,
.tm_yday = 0
};
- EXPECT_THAT(__llvm_libc::mktime(&tm_data),
+ EXPECT_THAT(LIBC_NAMESPACE::mktime(&tm_data),
Succeeds(-TimeConstants::SECONDS_PER_MIN));
EXPECT_TM_EQ((tm{.tm_sec = 0,
.tm_min = 59,
@@ -100,7 +100,7 @@ TEST(LlvmLibcMkTime, InvalidMinutes) {
.tm_mon = Month::JANUARY, .tm_year = tm_year(1970), .tm_wday = 0,
.tm_yday = 0
};
- EXPECT_THAT(__llvm_libc::mktime(&tm_data),
+ EXPECT_THAT(LIBC_NAMESPACE::mktime(&tm_data),
Succeeds(60 * TimeConstants::SECONDS_PER_MIN));
EXPECT_TM_EQ((tm{.tm_sec = 0,
.tm_min = 0,
@@ -122,7 +122,7 @@ TEST(LlvmLibcMkTime, InvalidHours) {
.tm_mon = Month::JANUARY, .tm_year = tm_year(1970), .tm_wday = 0,
.tm_yday = 0
};
- EXPECT_THAT(__llvm_libc::mktime(&tm_data),
+ EXPECT_THAT(LIBC_NAMESPACE::mktime(&tm_data),
Succeeds(-TimeConstants::SECONDS_PER_HOUR));
EXPECT_TM_EQ((tm{.tm_sec = 0,
.tm_min = 0,
@@ -142,7 +142,7 @@ TEST(LlvmLibcMkTime, InvalidHours) {
.tm_mon = Month::JANUARY, .tm_year = tm_year(1970), .tm_wday = 0,
.tm_yday = 0
};
- EXPECT_THAT(__llvm_libc::mktime(&tm_data),
+ EXPECT_THAT(LIBC_NAMESPACE::mktime(&tm_data),
Succeeds(24 * TimeConstants::SECONDS_PER_HOUR));
EXPECT_TM_EQ((tm{.tm_sec = 0,
.tm_min = 0,
@@ -163,7 +163,7 @@ TEST(LlvmLibcMkTime, InvalidYear) {
.tm_mon = Month::JANUARY, .tm_year = tm_year(1969), .tm_wday = 0,
.tm_yday = 0
};
- EXPECT_THAT(__llvm_libc::mktime(&tm_data),
+ EXPECT_THAT(LIBC_NAMESPACE::mktime(&tm_data),
Succeeds(-TimeConstants::DAYS_PER_NON_LEAP_YEAR *
TimeConstants::SECONDS_PER_DAY));
EXPECT_TM_EQ((tm{.tm_sec = 0,
@@ -187,7 +187,7 @@ TEST(LlvmLibcMkTime, InvalidEndOf32BitEpochYear) {
.tm_mon = Month::JANUARY, .tm_year = tm_year(2038), .tm_wday = 0,
.tm_yday = 0
};
- EXPECT_THAT(__llvm_libc::mktime(&tm_data), Fails(EOVERFLOW));
+ EXPECT_THAT(LIBC_NAMESPACE::mktime(&tm_data), Fails(EOVERFLOW));
}
{
@@ -197,7 +197,7 @@ TEST(LlvmLibcMkTime, InvalidEndOf32BitEpochYear) {
.tm_mon = Month::JANUARY, .tm_year = tm_year(2038), .tm_wday = 0,
.tm_yday = 0
};
- EXPECT_THAT(__llvm_libc::mktime(&tm_data), Fails(EOVERFLOW));
+ EXPECT_THAT(LIBC_NAMESPACE::mktime(&tm_data), Fails(EOVERFLOW));
}
{
@@ -207,7 +207,7 @@ TEST(LlvmLibcMkTime, InvalidEndOf32BitEpochYear) {
.tm_mon = Month::JANUARY, .tm_year = tm_year(2038), .tm_wday = 0,
.tm_yday = 0
};
- EXPECT_THAT(__llvm_libc::mktime(&tm_data), Fails(EOVERFLOW));
+ EXPECT_THAT(LIBC_NAMESPACE::mktime(&tm_data), Fails(EOVERFLOW));
}
{
@@ -217,7 +217,7 @@ TEST(LlvmLibcMkTime, InvalidEndOf32BitEpochYear) {
.tm_mon = Month::JANUARY, .tm_year = tm_year(2038), .tm_wday = 0,
.tm_yday = 0
};
- EXPECT_THAT(__llvm_libc::mktime(&tm_data), Fails(EOVERFLOW));
+ EXPECT_THAT(LIBC_NAMESPACE::mktime(&tm_data), Fails(EOVERFLOW));
}
{
@@ -227,7 +227,7 @@ TEST(LlvmLibcMkTime, InvalidEndOf32BitEpochYear) {
.tm_mon = Month::FEBRUARY, .tm_year = tm_year(2038), .tm_wday = 0,
.tm_yday = 0
};
- EXPECT_THAT(__llvm_libc::mktime(&tm_data), Fails(EOVERFLOW));
+ EXPECT_THAT(LIBC_NAMESPACE::mktime(&tm_data), Fails(EOVERFLOW));
}
{
@@ -237,7 +237,7 @@ TEST(LlvmLibcMkTime, InvalidEndOf32BitEpochYear) {
.tm_mon = Month::JANUARY, .tm_year = tm_year(2039), .tm_wday = 0,
.tm_yday = 0
};
- EXPECT_THAT(__llvm_libc::mktime(&tm_data), Fails(EOVERFLOW));
+ EXPECT_THAT(LIBC_NAMESPACE::mktime(&tm_data), Fails(EOVERFLOW));
}
}
@@ -248,7 +248,7 @@ TEST(LlvmLibcMkTime, InvalidMonths) {
.tm_sec = 0, .tm_min = 0, .tm_hour = 0, .tm_mday = 0, .tm_mon = -1,
.tm_year = tm_year(1970), .tm_wday = 0, .tm_yday = 0
};
- EXPECT_THAT(__llvm_libc::mktime(&tm_data),
+ EXPECT_THAT(LIBC_NAMESPACE::mktime(&tm_data),
Succeeds(-32 * TimeConstants::SECONDS_PER_DAY));
EXPECT_TM_EQ((tm{.tm_sec = 0,
.tm_min = 0,
@@ -267,7 +267,7 @@ TEST(LlvmLibcMkTime, InvalidMonths) {
.tm_sec = 0, .tm_min = 0, .tm_hour = 0, .tm_mday = 1, .tm_mon = 12,
.tm_year = tm_year(1970), .tm_wday = 0, .tm_yday = 0
};
- EXPECT_THAT(__llvm_libc::mktime(&tm_data),
+ EXPECT_THAT(LIBC_NAMESPACE::mktime(&tm_data),
Succeeds(TimeConstants::DAYS_PER_NON_LEAP_YEAR *
TimeConstants::SECONDS_PER_DAY));
EXPECT_TM_EQ((tm{.tm_sec = 0,
@@ -290,7 +290,7 @@ TEST(LlvmLibcMkTime, InvalidDays) {
.tm_mon = Month::JANUARY, .tm_year = tm_year(1970), .tm_wday = 0,
.tm_yday = 0
};
- EXPECT_THAT(__llvm_libc::mktime(&tm_data),
+ EXPECT_THAT(LIBC_NAMESPACE::mktime(&tm_data),
Succeeds(-1 * TimeConstants::SECONDS_PER_DAY));
EXPECT_TM_EQ((tm{.tm_sec = 0,
.tm_min = 0,
@@ -310,7 +310,7 @@ TEST(LlvmLibcMkTime, InvalidDays) {
.tm_mon = Month::JANUARY, .tm_year = tm_year(1970), .tm_wday = 0,
.tm_yday = 0
};
- EXPECT_THAT(__llvm_libc::mktime(&tm_data),
+ EXPECT_THAT(LIBC_NAMESPACE::mktime(&tm_data),
Succeeds(31 * TimeConstants::SECONDS_PER_DAY));
EXPECT_TM_EQ((tm{.tm_sec = 0,
.tm_min = 0,
@@ -330,7 +330,7 @@ TEST(LlvmLibcMkTime, InvalidDays) {
.tm_mon = Month::FEBRUARY, .tm_year = tm_year(1970), .tm_wday = 0,
.tm_yday = 0
};
- EXPECT_THAT(__llvm_libc::mktime(&tm_data),
+ EXPECT_THAT(LIBC_NAMESPACE::mktime(&tm_data),
Succeeds(59 * TimeConstants::SECONDS_PER_DAY));
EXPECT_TM_EQ((tm{.tm_sec = 0,
.tm_min = 0,
@@ -350,7 +350,7 @@ TEST(LlvmLibcMkTime, InvalidDays) {
.tm_mon = Month::FEBRUARY, .tm_year = tm_year(1972), .tm_wday = 0,
.tm_yday = 0
};
- EXPECT_THAT(__llvm_libc::mktime(&tm_data),
+ EXPECT_THAT(LIBC_NAMESPACE::mktime(&tm_data),
Succeeds(((2 * TimeConstants::DAYS_PER_NON_LEAP_YEAR) + 60) *
TimeConstants::SECONDS_PER_DAY));
EXPECT_TM_EQ((tm{.tm_sec = 0,
@@ -373,7 +373,7 @@ TEST(LlvmLibcMkTime, EndOf32BitEpochYear) {
.tm_mon = Month::JANUARY, .tm_year = tm_year(2038), .tm_wday = 0,
.tm_yday = 0
};
- EXPECT_THAT(__llvm_libc::mktime(&tm_data), Succeeds(0x7FFFFFFF));
+ EXPECT_THAT(LIBC_NAMESPACE::mktime(&tm_data), Succeeds(0x7FFFFFFF));
EXPECT_TM_EQ((tm{.tm_sec = 7,
.tm_min = 14,
.tm_hour = 3,
@@ -395,7 +395,7 @@ TEST(LlvmLibcMkTime, Max64BitYear) {
.tm_mon = Month::JANUARY, .tm_year = tm_year(2170), .tm_wday = 0,
.tm_yday = 0
};
- EXPECT_THAT(__llvm_libc::mktime(&tm_data), Succeeds(6311479850));
+ EXPECT_THAT(LIBC_NAMESPACE::mktime(&tm_data), Succeeds(6311479850));
EXPECT_TM_EQ((tm{.tm_sec = 50,
.tm_min = 50,
.tm_hour = 12,
@@ -414,7 +414,7 @@ TEST(LlvmLibcMkTime, Max64BitYear) {
.tm_mon = Month::JANUARY, .tm_year = tm_year(2147483647), .tm_wday = 0,
.tm_yday = 0
};
- EXPECT_THAT(__llvm_libc::mktime(&tm_data), Succeeds(67767976202043050));
+ EXPECT_THAT(LIBC_NAMESPACE::mktime(&tm_data), Succeeds(67767976202043050));
EXPECT_TM_EQ((tm{.tm_sec = 50,
.tm_min = 50,
.tm_hour = 12,
diff --git a/libc/test/src/time/nanosleep_test.cpp b/libc/test/src/time/nanosleep_test.cpp
index e89d4fdfc05763e..2826ed14dfedaba 100644
--- a/libc/test/src/time/nanosleep_test.cpp
+++ b/libc/test/src/time/nanosleep_test.cpp
@@ -13,16 +13,16 @@
#include "test/UnitTest/ErrnoSetterMatcher.h"
#include "test/UnitTest/Test.h"
-namespace cpp = __llvm_libc::cpp;
+namespace cpp = LIBC_NAMESPACE::cpp;
TEST(LlvmLibcNanosleep, SmokeTest) {
// TODO: When we have the code to read clocks, test that time has passed.
- using __llvm_libc::testing::ErrnoSetterMatcher::Succeeds;
+ using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds;
libc_errno = 0;
struct timespec tim = {1, 500};
struct timespec tim2 = {0, 0};
- int ret = __llvm_libc::nanosleep(&tim, &tim2);
+ int ret = LIBC_NAMESPACE::nanosleep(&tim, &tim2);
ASSERT_EQ(libc_errno, 0);
ASSERT_EQ(ret, 0);
}
diff --git a/libc/test/src/time/time_test.cpp b/libc/test/src/time/time_test.cpp
index 92fd8e48a77a399..1d938e8dae7adb2 100644
--- a/libc/test/src/time/time_test.cpp
+++ b/libc/test/src/time/time_test.cpp
@@ -14,10 +14,10 @@
TEST(LlvmLibcTimeTest, SmokeTest) {
time_t t1;
- time_t t2 = __llvm_libc::time(&t1);
+ time_t t2 = LIBC_NAMESPACE::time(&t1);
ASSERT_EQ(t1, t2);
ASSERT_GT(t1, time_t(0));
- time_t t3 = __llvm_libc::time(nullptr);
+ time_t t3 = LIBC_NAMESPACE::time(nullptr);
ASSERT_GE(t3, t1);
}
diff --git a/libc/test/src/unistd/access_test.cpp b/libc/test/src/unistd/access_test.cpp
index f0fa9de8e62564e..ed1fe96f4f4a167 100644
--- a/libc/test/src/unistd/access_test.cpp
+++ b/libc/test/src/unistd/access_test.cpp
@@ -20,38 +20,38 @@ TEST(LlvmLibcAccessTest, CreateAndTest) {
// The test strategy is to repeatedly create a file in different modes and
// test that it is accessable in those modes but not in others.
libc_errno = 0;
- using __llvm_libc::testing::ErrnoSetterMatcher::Succeeds;
+ using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds;
constexpr const char *TEST_FILE = "testdata/access.test";
- int fd = __llvm_libc::open(TEST_FILE, O_WRONLY | O_CREAT, S_IRWXU);
+ int fd = LIBC_NAMESPACE::open(TEST_FILE, O_WRONLY | O_CREAT, S_IRWXU);
ASSERT_EQ(libc_errno, 0);
ASSERT_GT(fd, 0);
- ASSERT_THAT(__llvm_libc::close(fd), Succeeds(0));
+ ASSERT_THAT(LIBC_NAMESPACE::close(fd), Succeeds(0));
- ASSERT_EQ(__llvm_libc::access(TEST_FILE, F_OK), 0);
+ ASSERT_EQ(LIBC_NAMESPACE::access(TEST_FILE, F_OK), 0);
ASSERT_EQ(libc_errno, 0);
- ASSERT_EQ(__llvm_libc::access(TEST_FILE, X_OK | W_OK | R_OK), 0);
+ ASSERT_EQ(LIBC_NAMESPACE::access(TEST_FILE, X_OK | W_OK | R_OK), 0);
ASSERT_EQ(libc_errno, 0);
- ASSERT_THAT(__llvm_libc::unlink(TEST_FILE), Succeeds(0));
+ ASSERT_THAT(LIBC_NAMESPACE::unlink(TEST_FILE), Succeeds(0));
- fd = __llvm_libc::open(TEST_FILE, O_WRONLY | O_CREAT, S_IXUSR);
+ fd = LIBC_NAMESPACE::open(TEST_FILE, O_WRONLY | O_CREAT, S_IXUSR);
ASSERT_EQ(libc_errno, 0);
ASSERT_GT(fd, 0);
- ASSERT_THAT(__llvm_libc::close(fd), Succeeds(0));
- ASSERT_EQ(__llvm_libc::access(TEST_FILE, F_OK), 0);
+ ASSERT_THAT(LIBC_NAMESPACE::close(fd), Succeeds(0));
+ ASSERT_EQ(LIBC_NAMESPACE::access(TEST_FILE, F_OK), 0);
ASSERT_EQ(libc_errno, 0);
- ASSERT_EQ(__llvm_libc::access(TEST_FILE, X_OK), 0);
+ ASSERT_EQ(LIBC_NAMESPACE::access(TEST_FILE, X_OK), 0);
ASSERT_EQ(libc_errno, 0);
- ASSERT_EQ(__llvm_libc::access(TEST_FILE, R_OK), -1);
+ ASSERT_EQ(LIBC_NAMESPACE::access(TEST_FILE, R_OK), -1);
ASSERT_EQ(libc_errno, EACCES);
libc_errno = 0;
- ASSERT_EQ(__llvm_libc::access(TEST_FILE, W_OK), -1);
+ ASSERT_EQ(LIBC_NAMESPACE::access(TEST_FILE, W_OK), -1);
ASSERT_EQ(libc_errno, EACCES);
libc_errno = 0;
- ASSERT_THAT(__llvm_libc::unlink(TEST_FILE), Succeeds(0));
+ ASSERT_THAT(LIBC_NAMESPACE::unlink(TEST_FILE), Succeeds(0));
}
TEST(LlvmLibcAccessTest, AccessNonExistentFile) {
- using __llvm_libc::testing::ErrnoSetterMatcher::Fails;
- ASSERT_THAT(__llvm_libc::access("testdata/non-existent-file", F_OK),
+ using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails;
+ ASSERT_THAT(LIBC_NAMESPACE::access("testdata/non-existent-file", F_OK),
Fails(ENOENT));
}
diff --git a/libc/test/src/unistd/chdir_test.cpp b/libc/test/src/unistd/chdir_test.cpp
index a19fb29c6ebabac..dfdeacdc8e42afc 100644
--- a/libc/test/src/unistd/chdir_test.cpp
+++ b/libc/test/src/unistd/chdir_test.cpp
@@ -20,27 +20,27 @@ TEST(LlvmLibcChdirTest, ChangeAndOpen) {
// without changing the directory to make sure it exists. Next, we change
// directory and open the same file to make sure that the "chdir" operation
// succeeded.
- using __llvm_libc::testing::ErrnoSetterMatcher::Succeeds;
+ using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds;
constexpr const char *TEST_DIR = "testdata";
constexpr const char *TEST_FILE = "testdata/chdir.test";
constexpr const char *TEST_FILE_BASE = "chdir.test";
libc_errno = 0;
- int fd = __llvm_libc::open(TEST_FILE, O_PATH);
+ int fd = LIBC_NAMESPACE::open(TEST_FILE, O_PATH);
ASSERT_GT(fd, 0);
ASSERT_EQ(libc_errno, 0);
- ASSERT_THAT(__llvm_libc::close(fd), Succeeds(0));
+ ASSERT_THAT(LIBC_NAMESPACE::close(fd), Succeeds(0));
- ASSERT_THAT(__llvm_libc::chdir(TEST_DIR), Succeeds(0));
- fd = __llvm_libc::open(TEST_FILE_BASE, O_PATH);
+ ASSERT_THAT(LIBC_NAMESPACE::chdir(TEST_DIR), Succeeds(0));
+ fd = LIBC_NAMESPACE::open(TEST_FILE_BASE, O_PATH);
ASSERT_GT(fd, 0);
ASSERT_EQ(libc_errno, 0);
- ASSERT_THAT(__llvm_libc::close(fd), Succeeds(0));
+ ASSERT_THAT(LIBC_NAMESPACE::close(fd), Succeeds(0));
}
TEST(LlvmLibcChdirTest, ChangeToNonExistentDir) {
libc_errno = 0;
- using __llvm_libc::testing::ErrnoSetterMatcher::Fails;
- ASSERT_THAT(__llvm_libc::chdir("non-existent-dir"), Fails(ENOENT));
+ using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails;
+ ASSERT_THAT(LIBC_NAMESPACE::chdir("non-existent-dir"), Fails(ENOENT));
libc_errno = 0;
}
diff --git a/libc/test/src/unistd/dup2_test.cpp b/libc/test/src/unistd/dup2_test.cpp
index bde5b9605e6aa56..ff870db0334c93d 100644
--- a/libc/test/src/unistd/dup2_test.cpp
+++ b/libc/test/src/unistd/dup2_test.cpp
@@ -19,12 +19,12 @@
TEST(LlvmLibcdupTest, ReadAndWriteViaDup) {
constexpr int DUPFD = 0xD0;
libc_errno = 0;
- using __llvm_libc::testing::ErrnoSetterMatcher::Succeeds;
+ using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds;
constexpr const char *TEST_FILE = "testdata/dup2.test";
- int fd = __llvm_libc::open(TEST_FILE, O_WRONLY | O_CREAT, S_IRWXU);
+ int fd = LIBC_NAMESPACE::open(TEST_FILE, O_WRONLY | O_CREAT, S_IRWXU);
ASSERT_EQ(libc_errno, 0);
ASSERT_GT(fd, 0);
- int dupfd = __llvm_libc::dup2(fd, DUPFD);
+ int dupfd = LIBC_NAMESPACE::dup2(fd, DUPFD);
ASSERT_EQ(libc_errno, 0);
ASSERT_EQ(dupfd, DUPFD);
@@ -32,30 +32,31 @@ TEST(LlvmLibcdupTest, ReadAndWriteViaDup) {
constexpr char WRITE_DATA[] = "Hello, dup!";
constexpr size_t WRITE_SIZE = sizeof(WRITE_DATA);
ASSERT_EQ(ssize_t(WRITE_SIZE),
- __llvm_libc::write(dupfd, WRITE_DATA, WRITE_SIZE));
- ASSERT_THAT(__llvm_libc::close(dupfd), Succeeds(0));
+ LIBC_NAMESPACE::write(dupfd, WRITE_DATA, WRITE_SIZE));
+ ASSERT_THAT(LIBC_NAMESPACE::close(dupfd), Succeeds(0));
// Reopen the file for reading and create a dup.
- fd = __llvm_libc::open(TEST_FILE, O_RDONLY);
+ fd = LIBC_NAMESPACE::open(TEST_FILE, O_RDONLY);
ASSERT_EQ(libc_errno, 0);
ASSERT_GT(fd, 0);
- dupfd = __llvm_libc::dup2(fd, DUPFD);
+ dupfd = LIBC_NAMESPACE::dup2(fd, DUPFD);
ASSERT_EQ(libc_errno, 0);
ASSERT_EQ(dupfd, DUPFD);
// Read the file content via the dup.
char buf[WRITE_SIZE];
- ASSERT_THAT(__llvm_libc::read(dupfd, buf, WRITE_SIZE), Succeeds(WRITE_SIZE));
+ ASSERT_THAT(LIBC_NAMESPACE::read(dupfd, buf, WRITE_SIZE),
+ Succeeds(WRITE_SIZE));
ASSERT_STREQ(buf, WRITE_DATA);
// Verify that duping to the same fd value succeeds.
- ASSERT_THAT(__llvm_libc::dup2(dupfd, dupfd), Succeeds(dupfd));
+ ASSERT_THAT(LIBC_NAMESPACE::dup2(dupfd, dupfd), Succeeds(dupfd));
- ASSERT_THAT(__llvm_libc::close(dupfd), Succeeds(0));
- ASSERT_THAT(__llvm_libc::unlink(TEST_FILE), Succeeds(0));
+ ASSERT_THAT(LIBC_NAMESPACE::close(dupfd), Succeeds(0));
+ ASSERT_THAT(LIBC_NAMESPACE::unlink(TEST_FILE), Succeeds(0));
}
TEST(LlvmLibcdupTest, DupBadFD) {
- using __llvm_libc::testing::ErrnoSetterMatcher::Fails;
- ASSERT_THAT(__llvm_libc::dup2(-1, 123), Fails(EBADF));
+ using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails;
+ ASSERT_THAT(LIBC_NAMESPACE::dup2(-1, 123), Fails(EBADF));
}
diff --git a/libc/test/src/unistd/dup3_test.cpp b/libc/test/src/unistd/dup3_test.cpp
index 11a540c44706a93..279cfbfea1b144b 100644
--- a/libc/test/src/unistd/dup3_test.cpp
+++ b/libc/test/src/unistd/dup3_test.cpp
@@ -24,13 +24,13 @@
TEST(LlvmLibcdupTest, ReadAndWriteViaDup) {
constexpr int DUPFD = 0xD0;
libc_errno = 0;
- using __llvm_libc::testing::ErrnoSetterMatcher::Fails;
- using __llvm_libc::testing::ErrnoSetterMatcher::Succeeds;
+ using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails;
+ using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds;
constexpr const char *TEST_FILE = "testdata/dup3.test";
- int fd = __llvm_libc::open(TEST_FILE, O_WRONLY | O_CREAT, S_IRWXU);
+ int fd = LIBC_NAMESPACE::open(TEST_FILE, O_WRONLY | O_CREAT, S_IRWXU);
ASSERT_EQ(libc_errno, 0);
ASSERT_GT(fd, 0);
- int dupfd = __llvm_libc::dup3(fd, DUPFD, 0);
+ int dupfd = LIBC_NAMESPACE::dup3(fd, DUPFD, 0);
ASSERT_EQ(libc_errno, 0);
ASSERT_EQ(dupfd, DUPFD);
@@ -38,30 +38,31 @@ TEST(LlvmLibcdupTest, ReadAndWriteViaDup) {
constexpr char WRITE_DATA[] = "Hello, dup!";
constexpr size_t WRITE_SIZE = sizeof(WRITE_DATA);
ASSERT_EQ(ssize_t(WRITE_SIZE),
- __llvm_libc::write(dupfd, WRITE_DATA, WRITE_SIZE));
- ASSERT_THAT(__llvm_libc::close(dupfd), Succeeds(0));
+ LIBC_NAMESPACE::write(dupfd, WRITE_DATA, WRITE_SIZE));
+ ASSERT_THAT(LIBC_NAMESPACE::close(dupfd), Succeeds(0));
// Reopen the file for reading and create a dup.
- fd = __llvm_libc::open(TEST_FILE, O_RDONLY);
+ fd = LIBC_NAMESPACE::open(TEST_FILE, O_RDONLY);
ASSERT_EQ(libc_errno, 0);
ASSERT_GT(fd, 0);
- dupfd = __llvm_libc::dup3(fd, DUPFD, 0);
+ dupfd = LIBC_NAMESPACE::dup3(fd, DUPFD, 0);
ASSERT_EQ(libc_errno, 0);
ASSERT_EQ(dupfd, DUPFD);
// Read the file content via the dup.
char buf[WRITE_SIZE];
- ASSERT_THAT(__llvm_libc::read(dupfd, buf, WRITE_SIZE), Succeeds(WRITE_SIZE));
+ ASSERT_THAT(LIBC_NAMESPACE::read(dupfd, buf, WRITE_SIZE),
+ Succeeds(WRITE_SIZE));
ASSERT_STREQ(buf, WRITE_DATA);
// Verify that, unlike dup2, duping to the same fd value with dup3 fails.
- ASSERT_THAT(__llvm_libc::dup3(dupfd, dupfd, 0), Fails(EINVAL));
+ ASSERT_THAT(LIBC_NAMESPACE::dup3(dupfd, dupfd, 0), Fails(EINVAL));
- ASSERT_THAT(__llvm_libc::close(dupfd), Succeeds(0));
- ASSERT_THAT(__llvm_libc::unlink(TEST_FILE), Succeeds(0));
+ ASSERT_THAT(LIBC_NAMESPACE::close(dupfd), Succeeds(0));
+ ASSERT_THAT(LIBC_NAMESPACE::unlink(TEST_FILE), Succeeds(0));
}
TEST(LlvmLibcdupTest, DupBadFD) {
- using __llvm_libc::testing::ErrnoSetterMatcher::Fails;
- ASSERT_THAT(__llvm_libc::dup3(-1, 123, 0), Fails(EBADF));
+ using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails;
+ ASSERT_THAT(LIBC_NAMESPACE::dup3(-1, 123, 0), Fails(EBADF));
}
diff --git a/libc/test/src/unistd/dup_test.cpp b/libc/test/src/unistd/dup_test.cpp
index 9a0f8056b8ae8e1..38c439125db3d7b 100644
--- a/libc/test/src/unistd/dup_test.cpp
+++ b/libc/test/src/unistd/dup_test.cpp
@@ -18,12 +18,12 @@
TEST(LlvmLibcdupTest, ReadAndWriteViaDup) {
libc_errno = 0;
- using __llvm_libc::testing::ErrnoSetterMatcher::Succeeds;
+ using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds;
constexpr const char *TEST_FILE = "testdata/dup.test";
- int fd = __llvm_libc::open(TEST_FILE, O_WRONLY | O_CREAT, S_IRWXU);
+ int fd = LIBC_NAMESPACE::open(TEST_FILE, O_WRONLY | O_CREAT, S_IRWXU);
ASSERT_EQ(libc_errno, 0);
ASSERT_GT(fd, 0);
- int dupfd = __llvm_libc::dup(fd);
+ int dupfd = LIBC_NAMESPACE::dup(fd);
ASSERT_EQ(libc_errno, 0);
ASSERT_GT(dupfd, 0);
@@ -31,27 +31,28 @@ TEST(LlvmLibcdupTest, ReadAndWriteViaDup) {
constexpr char WRITE_DATA[] = "Hello, dup!";
constexpr size_t WRITE_SIZE = sizeof(WRITE_DATA);
ASSERT_EQ(ssize_t(WRITE_SIZE),
- __llvm_libc::write(dupfd, WRITE_DATA, WRITE_SIZE));
- ASSERT_THAT(__llvm_libc::close(dupfd), Succeeds(0));
+ LIBC_NAMESPACE::write(dupfd, WRITE_DATA, WRITE_SIZE));
+ ASSERT_THAT(LIBC_NAMESPACE::close(dupfd), Succeeds(0));
// Reopen the file for reading and create a dup.
- fd = __llvm_libc::open(TEST_FILE, O_RDONLY);
+ fd = LIBC_NAMESPACE::open(TEST_FILE, O_RDONLY);
ASSERT_EQ(libc_errno, 0);
ASSERT_GT(fd, 0);
- dupfd = __llvm_libc::dup(fd);
+ dupfd = LIBC_NAMESPACE::dup(fd);
ASSERT_EQ(libc_errno, 0);
ASSERT_GT(dupfd, 0);
// Read the file content via the dup.
char buf[WRITE_SIZE];
- ASSERT_THAT(__llvm_libc::read(dupfd, buf, WRITE_SIZE), Succeeds(WRITE_SIZE));
+ ASSERT_THAT(LIBC_NAMESPACE::read(dupfd, buf, WRITE_SIZE),
+ Succeeds(WRITE_SIZE));
ASSERT_STREQ(buf, WRITE_DATA);
- ASSERT_THAT(__llvm_libc::close(dupfd), Succeeds(0));
- ASSERT_THAT(__llvm_libc::unlink(TEST_FILE), Succeeds(0));
+ ASSERT_THAT(LIBC_NAMESPACE::close(dupfd), Succeeds(0));
+ ASSERT_THAT(LIBC_NAMESPACE::unlink(TEST_FILE), Succeeds(0));
}
TEST(LlvmLibcdupTest, DupBadFD) {
- using __llvm_libc::testing::ErrnoSetterMatcher::Fails;
- ASSERT_THAT(__llvm_libc::dup(-1), Fails(EBADF));
+ using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails;
+ ASSERT_THAT(LIBC_NAMESPACE::dup(-1), Fails(EBADF));
}
diff --git a/libc/test/src/unistd/fchdir_test.cpp b/libc/test/src/unistd/fchdir_test.cpp
index 3e04acd7f421314..27d4489f6447ea0 100644
--- a/libc/test/src/unistd/fchdir_test.cpp
+++ b/libc/test/src/unistd/fchdir_test.cpp
@@ -20,32 +20,32 @@ TEST(LlvmLibcChdirTest, ChangeAndOpen) {
// without changing the directory to make sure it exists. Next, we change
// directory and open the same file to make sure that the "fchdir" operation
// succeeded.
- using __llvm_libc::testing::ErrnoSetterMatcher::Succeeds;
+ using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds;
constexpr const char *TEST_DIR = "testdata";
constexpr const char *TEST_FILE = "testdata/fchdir.test";
constexpr const char *TEST_FILE_BASE = "fchdir.test";
libc_errno = 0;
- int dir_fd = __llvm_libc::open(TEST_DIR, O_DIRECTORY);
+ int dir_fd = LIBC_NAMESPACE::open(TEST_DIR, O_DIRECTORY);
ASSERT_GT(dir_fd, 0);
ASSERT_EQ(libc_errno, 0);
- int file_fd = __llvm_libc::open(TEST_FILE, O_PATH);
+ int file_fd = LIBC_NAMESPACE::open(TEST_FILE, O_PATH);
ASSERT_GT(file_fd, 0);
ASSERT_EQ(libc_errno, 0);
- ASSERT_THAT(__llvm_libc::close(file_fd), Succeeds(0));
+ ASSERT_THAT(LIBC_NAMESPACE::close(file_fd), Succeeds(0));
- ASSERT_THAT(__llvm_libc::fchdir(dir_fd), Succeeds(0));
- file_fd = __llvm_libc::open(TEST_FILE_BASE, O_PATH);
+ ASSERT_THAT(LIBC_NAMESPACE::fchdir(dir_fd), Succeeds(0));
+ file_fd = LIBC_NAMESPACE::open(TEST_FILE_BASE, O_PATH);
ASSERT_GT(file_fd, 0);
ASSERT_EQ(libc_errno, 0);
- ASSERT_THAT(__llvm_libc::close(file_fd), Succeeds(0));
- ASSERT_THAT(__llvm_libc::close(dir_fd), Succeeds(0));
+ ASSERT_THAT(LIBC_NAMESPACE::close(file_fd), Succeeds(0));
+ ASSERT_THAT(LIBC_NAMESPACE::close(dir_fd), Succeeds(0));
}
TEST(LlvmLibcChdirTest, ChangeToNonExistentDir) {
- using __llvm_libc::testing::ErrnoSetterMatcher::Fails;
+ using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails;
libc_errno = 0;
- ASSERT_EQ(__llvm_libc::fchdir(0), -1);
+ ASSERT_EQ(LIBC_NAMESPACE::fchdir(0), -1);
ASSERT_NE(libc_errno, 0);
libc_errno = 0;
}
diff --git a/libc/test/src/unistd/ftruncate_test.cpp b/libc/test/src/unistd/ftruncate_test.cpp
index 217ab95f1fedb55..ae743b385e220db 100644
--- a/libc/test/src/unistd/ftruncate_test.cpp
+++ b/libc/test/src/unistd/ftruncate_test.cpp
@@ -17,10 +17,10 @@
#include "test/UnitTest/ErrnoSetterMatcher.h"
#include "test/UnitTest/Test.h"
-namespace cpp = __llvm_libc::cpp;
+namespace cpp = LIBC_NAMESPACE::cpp;
TEST(LlvmLibcFtruncateTest, CreateAndTruncate) {
- using __llvm_libc::testing::ErrnoSetterMatcher::Succeeds;
+ using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds;
constexpr const char TEST_FILE[] = "testdata/ftruncate.test";
constexpr const char WRITE_DATA[] = "hello, ftruncate";
constexpr size_t WRITE_SIZE = sizeof(WRITE_DATA);
@@ -32,39 +32,39 @@ TEST(LlvmLibcFtruncateTest, CreateAndTruncate) {
// 3. Truncate to 1 byte.
// 4. Try to read more than 1 byte and fail.
libc_errno = 0;
- int fd = __llvm_libc::open(TEST_FILE, O_WRONLY | O_CREAT, S_IRWXU);
+ int fd = LIBC_NAMESPACE::open(TEST_FILE, O_WRONLY | O_CREAT, S_IRWXU);
ASSERT_EQ(libc_errno, 0);
ASSERT_GT(fd, 0);
ASSERT_EQ(ssize_t(WRITE_SIZE),
- __llvm_libc::write(fd, WRITE_DATA, WRITE_SIZE));
- ASSERT_THAT(__llvm_libc::close(fd), Succeeds(0));
+ LIBC_NAMESPACE::write(fd, WRITE_DATA, WRITE_SIZE));
+ ASSERT_THAT(LIBC_NAMESPACE::close(fd), Succeeds(0));
- fd = __llvm_libc::open(TEST_FILE, O_RDONLY);
+ fd = LIBC_NAMESPACE::open(TEST_FILE, O_RDONLY);
ASSERT_EQ(libc_errno, 0);
ASSERT_GT(fd, 0);
- ASSERT_EQ(ssize_t(WRITE_SIZE), __llvm_libc::read(fd, buf, WRITE_SIZE));
+ ASSERT_EQ(ssize_t(WRITE_SIZE), LIBC_NAMESPACE::read(fd, buf, WRITE_SIZE));
ASSERT_EQ(cpp::string_view(buf), cpp::string_view(WRITE_DATA));
- ASSERT_THAT(__llvm_libc::close(fd), Succeeds(0));
+ ASSERT_THAT(LIBC_NAMESPACE::close(fd), Succeeds(0));
// For ftruncate operation to succeed, the file should be opened for
// writing.
- fd = __llvm_libc::open(TEST_FILE, O_WRONLY);
+ fd = LIBC_NAMESPACE::open(TEST_FILE, O_WRONLY);
ASSERT_GT(fd, 0);
ASSERT_EQ(libc_errno, 0);
- ASSERT_THAT(__llvm_libc::ftruncate(fd, off_t(1)), Succeeds(0));
- ASSERT_THAT(__llvm_libc::close(fd), Succeeds(0));
+ ASSERT_THAT(LIBC_NAMESPACE::ftruncate(fd, off_t(1)), Succeeds(0));
+ ASSERT_THAT(LIBC_NAMESPACE::close(fd), Succeeds(0));
- fd = __llvm_libc::open(TEST_FILE, O_RDONLY);
+ fd = LIBC_NAMESPACE::open(TEST_FILE, O_RDONLY);
ASSERT_EQ(libc_errno, 0);
ASSERT_GT(fd, 0);
- ASSERT_EQ(ssize_t(1), __llvm_libc::read(fd, buf, WRITE_SIZE));
+ ASSERT_EQ(ssize_t(1), LIBC_NAMESPACE::read(fd, buf, WRITE_SIZE));
ASSERT_EQ(buf[0], WRITE_DATA[0]);
- ASSERT_THAT(__llvm_libc::close(fd), Succeeds(0));
+ ASSERT_THAT(LIBC_NAMESPACE::close(fd), Succeeds(0));
- ASSERT_THAT(__llvm_libc::unlink(TEST_FILE), Succeeds(0));
+ ASSERT_THAT(LIBC_NAMESPACE::unlink(TEST_FILE), Succeeds(0));
}
TEST(LlvmLibcFtruncateTest, TruncateBadFD) {
- using __llvm_libc::testing::ErrnoSetterMatcher::Fails;
- ASSERT_THAT(__llvm_libc::ftruncate(1, off_t(1)), Fails(EINVAL));
+ using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails;
+ ASSERT_THAT(LIBC_NAMESPACE::ftruncate(1, off_t(1)), Fails(EINVAL));
}
diff --git a/libc/test/src/unistd/geteuid_test.cpp b/libc/test/src/unistd/geteuid_test.cpp
index 6ac6abafd60e884..aa8e2e6f217a211 100644
--- a/libc/test/src/unistd/geteuid_test.cpp
+++ b/libc/test/src/unistd/geteuid_test.cpp
@@ -11,5 +11,5 @@
TEST(LlvmLibcGetEuidTest, SmokeTest) {
// geteuid always succeeds. So, we just call it as a smoke test.
- __llvm_libc::geteuid();
+ LIBC_NAMESPACE::geteuid();
}
diff --git a/libc/test/src/unistd/getopt_test.cpp b/libc/test/src/unistd/getopt_test.cpp
index 0fcf941b5edb10b..1ca7c99e1ce3731 100644
--- a/libc/test/src/unistd/getopt_test.cpp
+++ b/libc/test/src/unistd/getopt_test.cpp
@@ -15,7 +15,7 @@
#include <stdio.h>
-using __llvm_libc::cpp::array;
+using LIBC_NAMESPACE::cpp::array;
namespace test_globals {
char *optarg;
@@ -29,7 +29,7 @@ unsigned optpos;
// This can't be a constructor because it will get run before the constructor
// which sets the default state in getopt.
void set_state(FILE *errstream) {
- __llvm_libc::impl::set_getopt_state(
+ LIBC_NAMESPACE::impl::set_getopt_state(
&test_globals::optarg, &test_globals::optind, &test_globals::optopt,
&test_globals::optpos, &test_globals::opterr, errstream);
}
@@ -52,16 +52,18 @@ static cookie_io_functions_t cookie{nullptr, &cookie_write, nullptr, nullptr};
// doesn't currently support fmemopen but does have fopencookie. In the future
// just use that instead. This memopen does no error checking for the size
// of the buffer, etc.
-FILE *memopen(char **pos) { return __llvm_libc::fopencookie(pos, "w", cookie); }
+FILE *memopen(char **pos) {
+ return LIBC_NAMESPACE::fopencookie(pos, "w", cookie);
+}
-struct LlvmLibcGetoptTest : public __llvm_libc::testing::Test {
+struct LlvmLibcGetoptTest : public LIBC_NAMESPACE::testing::Test {
FILE *errstream;
char buf[256];
char *pos = buf;
void reset_errstream() { pos = buf; }
const char *get_error_msg() {
- __llvm_libc::fflush(errstream);
+ LIBC_NAMESPACE::fflush(errstream);
return buf;
}
@@ -85,32 +87,32 @@ TEST_F(LlvmLibcGetoptTest, NoMatch) {
array<char *, 3> argv{"prog"_c, "arg1"_c, nullptr};
// optind >= argc
- EXPECT_EQ(__llvm_libc::getopt(1, argv.data(), "..."), -1);
+ EXPECT_EQ(LIBC_NAMESPACE::getopt(1, argv.data(), "..."), -1);
// argv[optind] == nullptr
test_globals::optind = 2;
- EXPECT_EQ(__llvm_libc::getopt(100, argv.data(), "..."), -1);
+ EXPECT_EQ(LIBC_NAMESPACE::getopt(100, argv.data(), "..."), -1);
// argv[optind][0] != '-'
test_globals::optind = 1;
- EXPECT_EQ(__llvm_libc::getopt(2, argv.data(), "a"), -1);
+ EXPECT_EQ(LIBC_NAMESPACE::getopt(2, argv.data(), "a"), -1);
ASSERT_EQ(test_globals::optind, 1);
// argv[optind] == "-"
argv[1] = "-"_c;
- EXPECT_EQ(__llvm_libc::getopt(2, argv.data(), "a"), -1);
+ EXPECT_EQ(LIBC_NAMESPACE::getopt(2, argv.data(), "a"), -1);
ASSERT_EQ(test_globals::optind, 1);
// argv[optind] == "--", then return -1 and incremement optind
argv[1] = "--"_c;
- EXPECT_EQ(__llvm_libc::getopt(2, argv.data(), "a"), -1);
+ EXPECT_EQ(LIBC_NAMESPACE::getopt(2, argv.data(), "a"), -1);
EXPECT_EQ(test_globals::optind, 2);
}
TEST_F(LlvmLibcGetoptTest, WrongMatch) {
array<char *, 3> argv{"prog"_c, "-b"_c, nullptr};
- EXPECT_EQ(__llvm_libc::getopt(2, argv.data(), "a"), int('?'));
+ EXPECT_EQ(LIBC_NAMESPACE::getopt(2, argv.data(), "a"), int('?'));
EXPECT_EQ(test_globals::optopt, (int)'b');
EXPECT_EQ(test_globals::optind, 1);
EXPECT_STREQ(get_error_msg(), "prog: illegal option -- b\n");
@@ -121,7 +123,7 @@ TEST_F(LlvmLibcGetoptTest, OpterrFalse) {
test_globals::opterr = 0;
set_state(errstream);
- EXPECT_EQ(__llvm_libc::getopt(2, argv.data(), "a"), int('?'));
+ EXPECT_EQ(LIBC_NAMESPACE::getopt(2, argv.data(), "a"), int('?'));
EXPECT_EQ(test_globals::optopt, (int)'b');
EXPECT_EQ(test_globals::optind, 1);
EXPECT_STREQ(get_error_msg(), "");
@@ -130,11 +132,11 @@ TEST_F(LlvmLibcGetoptTest, OpterrFalse) {
TEST_F(LlvmLibcGetoptTest, MissingArg) {
array<char *, 3> argv{"prog"_c, "-b"_c, nullptr};
- EXPECT_EQ(__llvm_libc::getopt(2, argv.data(), ":b:"), (int)':');
+ EXPECT_EQ(LIBC_NAMESPACE::getopt(2, argv.data(), ":b:"), (int)':');
ASSERT_EQ(test_globals::optind, 1);
EXPECT_STREQ(get_error_msg(), "prog: option requires an argument -- b\n");
reset_errstream();
- EXPECT_EQ(__llvm_libc::getopt(2, argv.data(), "b:"), int('?'));
+ EXPECT_EQ(LIBC_NAMESPACE::getopt(2, argv.data(), "b:"), int('?'));
EXPECT_EQ(test_globals::optind, 1);
EXPECT_STREQ(get_error_msg(), "prog: option requires an argument -- b\n");
}
@@ -142,7 +144,7 @@ TEST_F(LlvmLibcGetoptTest, MissingArg) {
TEST_F(LlvmLibcGetoptTest, ParseArgInCurrent) {
array<char *, 3> argv{"prog"_c, "-barg"_c, nullptr};
- EXPECT_EQ(__llvm_libc::getopt(2, argv.data(), "b:"), (int)'b');
+ EXPECT_EQ(LIBC_NAMESPACE::getopt(2, argv.data(), "b:"), (int)'b');
EXPECT_STREQ(test_globals::optarg, "arg");
EXPECT_EQ(test_globals::optind, 2);
}
@@ -150,7 +152,7 @@ TEST_F(LlvmLibcGetoptTest, ParseArgInCurrent) {
TEST_F(LlvmLibcGetoptTest, ParseArgInNext) {
array<char *, 4> argv{"prog"_c, "-b"_c, "arg"_c, nullptr};
- EXPECT_EQ(__llvm_libc::getopt(3, argv.data(), "b:"), (int)'b');
+ EXPECT_EQ(LIBC_NAMESPACE::getopt(3, argv.data(), "b:"), (int)'b');
EXPECT_STREQ(test_globals::optarg, "arg");
EXPECT_EQ(test_globals::optind, 3);
}
@@ -158,10 +160,10 @@ TEST_F(LlvmLibcGetoptTest, ParseArgInNext) {
TEST_F(LlvmLibcGetoptTest, ParseMutliInOne) {
array<char *, 3> argv{"prog"_c, "-abc"_c, nullptr};
- EXPECT_EQ(__llvm_libc::getopt(2, argv.data(), "abc"), (int)'a');
+ EXPECT_EQ(LIBC_NAMESPACE::getopt(2, argv.data(), "abc"), (int)'a');
ASSERT_EQ(test_globals::optind, 1);
- EXPECT_EQ(__llvm_libc::getopt(2, argv.data(), "abc"), (int)'b');
+ EXPECT_EQ(LIBC_NAMESPACE::getopt(2, argv.data(), "abc"), (int)'b');
ASSERT_EQ(test_globals::optind, 1);
- EXPECT_EQ(__llvm_libc::getopt(2, argv.data(), "abc"), (int)'c');
+ EXPECT_EQ(LIBC_NAMESPACE::getopt(2, argv.data(), "abc"), (int)'c');
EXPECT_EQ(test_globals::optind, 2);
}
diff --git a/libc/test/src/unistd/getpid_test.cpp b/libc/test/src/unistd/getpid_test.cpp
index fc8805309d43c08..9d6c926415ee405 100644
--- a/libc/test/src/unistd/getpid_test.cpp
+++ b/libc/test/src/unistd/getpid_test.cpp
@@ -11,5 +11,5 @@
TEST(LlvmLibcGetPidTest, SmokeTest) {
// getpid always succeeds. So, we just call it as a smoke test.
- __llvm_libc::getpid();
+ LIBC_NAMESPACE::getpid();
}
diff --git a/libc/test/src/unistd/getppid_test.cpp b/libc/test/src/unistd/getppid_test.cpp
index e9724765a478df4..3e674afab5c9488 100644
--- a/libc/test/src/unistd/getppid_test.cpp
+++ b/libc/test/src/unistd/getppid_test.cpp
@@ -11,5 +11,5 @@
TEST(LlvmLibcGetPpidTest, SmokeTest) {
// getppid always succeeds. So, we just call it as a smoke test.
- __llvm_libc::getppid();
+ LIBC_NAMESPACE::getppid();
}
diff --git a/libc/test/src/unistd/getuid_test.cpp b/libc/test/src/unistd/getuid_test.cpp
index 8f2d9d9a7be62c4..a76eee64a6eef91 100644
--- a/libc/test/src/unistd/getuid_test.cpp
+++ b/libc/test/src/unistd/getuid_test.cpp
@@ -11,5 +11,5 @@
TEST(LlvmLibcGetUidTest, SmokeTest) {
// getuid always succeeds. So, we just call it as a smoke test.
- __llvm_libc::getuid();
+ LIBC_NAMESPACE::getuid();
}
diff --git a/libc/test/src/unistd/isatty_test.cpp b/libc/test/src/unistd/isatty_test.cpp
index 538101d3567da65..fce4a3e5f5062aa 100644
--- a/libc/test/src/unistd/isatty_test.cpp
+++ b/libc/test/src/unistd/isatty_test.cpp
@@ -13,46 +13,46 @@
#include "test/UnitTest/ErrnoSetterMatcher.h"
#include "test/UnitTest/Test.h"
-using __llvm_libc::testing::ErrnoSetterMatcher::Fails;
-using __llvm_libc::testing::ErrnoSetterMatcher::Succeeds;
+using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails;
+using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds;
TEST(LlvmLibcIsATTYTest, StdInOutTests) {
// If stdin is connected to a terminal, assume that all of the standard i/o
// fds are.
libc_errno = 0;
- if (__llvm_libc::isatty(0)) {
- EXPECT_THAT(__llvm_libc::isatty(0), Succeeds(1)); // stdin
- EXPECT_THAT(__llvm_libc::isatty(1), Succeeds(1)); // stdout
- EXPECT_THAT(__llvm_libc::isatty(2), Succeeds(1)); // stderr
+ if (LIBC_NAMESPACE::isatty(0)) {
+ EXPECT_THAT(LIBC_NAMESPACE::isatty(0), Succeeds(1)); // stdin
+ EXPECT_THAT(LIBC_NAMESPACE::isatty(1), Succeeds(1)); // stdout
+ EXPECT_THAT(LIBC_NAMESPACE::isatty(2), Succeeds(1)); // stderr
} else {
- EXPECT_THAT(__llvm_libc::isatty(0), Fails(ENOTTY, 0)); // stdin
- EXPECT_THAT(__llvm_libc::isatty(1), Fails(ENOTTY, 0)); // stdout
- EXPECT_THAT(__llvm_libc::isatty(2), Fails(ENOTTY, 0)); // stderr
+ EXPECT_THAT(LIBC_NAMESPACE::isatty(0), Fails(ENOTTY, 0)); // stdin
+ EXPECT_THAT(LIBC_NAMESPACE::isatty(1), Fails(ENOTTY, 0)); // stdout
+ EXPECT_THAT(LIBC_NAMESPACE::isatty(2), Fails(ENOTTY, 0)); // stderr
}
}
TEST(LlvmLibcIsATTYTest, BadFdTest) {
libc_errno = 0;
- EXPECT_THAT(__llvm_libc::isatty(-1), Fails(EBADF, 0)); // invalid fd
+ EXPECT_THAT(LIBC_NAMESPACE::isatty(-1), Fails(EBADF, 0)); // invalid fd
}
TEST(LlvmLibcIsATTYTest, DevTTYTest) {
constexpr const char *TTY_FILE = "/dev/tty";
libc_errno = 0;
- int fd = __llvm_libc::open(TTY_FILE, O_RDONLY);
+ int fd = LIBC_NAMESPACE::open(TTY_FILE, O_RDONLY);
if (fd > 0) {
ASSERT_EQ(libc_errno, 0);
- EXPECT_THAT(__llvm_libc::isatty(fd), Succeeds(1));
- ASSERT_THAT(__llvm_libc::close(fd), Succeeds(0));
+ EXPECT_THAT(LIBC_NAMESPACE::isatty(fd), Succeeds(1));
+ ASSERT_THAT(LIBC_NAMESPACE::close(fd), Succeeds(0));
}
}
TEST(LlvmLibcIsATTYTest, FileTest) {
constexpr const char *TEST_FILE = "testdata/isatty.test";
libc_errno = 0;
- int fd = __llvm_libc::open(TEST_FILE, O_WRONLY | O_CREAT, S_IRWXU);
+ int fd = LIBC_NAMESPACE::open(TEST_FILE, O_WRONLY | O_CREAT, S_IRWXU);
ASSERT_EQ(libc_errno, 0);
ASSERT_GT(fd, 0);
- EXPECT_THAT(__llvm_libc::isatty(fd), Fails(ENOTTY, 0));
- ASSERT_THAT(__llvm_libc::close(fd), Succeeds(0));
+ EXPECT_THAT(LIBC_NAMESPACE::isatty(fd), Fails(ENOTTY, 0));
+ ASSERT_THAT(LIBC_NAMESPACE::close(fd), Succeeds(0));
}
diff --git a/libc/test/src/unistd/link_test.cpp b/libc/test/src/unistd/link_test.cpp
index 7acb9dc86a0549b..b1b9383cb62ee07 100644
--- a/libc/test/src/unistd/link_test.cpp
+++ b/libc/test/src/unistd/link_test.cpp
@@ -15,7 +15,7 @@
#include "test/UnitTest/Test.h"
TEST(LlvmLibcLinkTest, CreateAndUnlink) {
- using __llvm_libc::testing::ErrnoSetterMatcher::Succeeds;
+ using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds;
constexpr const char *TEST_FILE = "testdata/link.test";
constexpr const char *TEST_FILE_LINK = "testdata/link.test.link";
@@ -25,24 +25,24 @@ TEST(LlvmLibcLinkTest, CreateAndUnlink) {
// 3. Open the link to check that the link was created.
// 4. Cleanup the file and its link.
libc_errno = 0;
- int write_fd = __llvm_libc::open(TEST_FILE, O_WRONLY | O_CREAT, S_IRWXU);
+ int write_fd = LIBC_NAMESPACE::open(TEST_FILE, O_WRONLY | O_CREAT, S_IRWXU);
ASSERT_EQ(libc_errno, 0);
ASSERT_GT(write_fd, 0);
- ASSERT_THAT(__llvm_libc::close(write_fd), Succeeds(0));
- ASSERT_THAT(__llvm_libc::link(TEST_FILE, TEST_FILE_LINK), Succeeds(0));
+ ASSERT_THAT(LIBC_NAMESPACE::close(write_fd), Succeeds(0));
+ ASSERT_THAT(LIBC_NAMESPACE::link(TEST_FILE, TEST_FILE_LINK), Succeeds(0));
- int link_fd = __llvm_libc::open(TEST_FILE_LINK, O_PATH);
+ int link_fd = LIBC_NAMESPACE::open(TEST_FILE_LINK, O_PATH);
ASSERT_GT(link_fd, 0);
ASSERT_EQ(libc_errno, 0);
- ASSERT_THAT(__llvm_libc::close(link_fd), Succeeds(0));
+ ASSERT_THAT(LIBC_NAMESPACE::close(link_fd), Succeeds(0));
- ASSERT_THAT(__llvm_libc::unlink(TEST_FILE), Succeeds(0));
- ASSERT_THAT(__llvm_libc::unlink(TEST_FILE_LINK), Succeeds(0));
+ ASSERT_THAT(LIBC_NAMESPACE::unlink(TEST_FILE), Succeeds(0));
+ ASSERT_THAT(LIBC_NAMESPACE::unlink(TEST_FILE_LINK), Succeeds(0));
}
TEST(LlvmLibcLinkTest, LinkToNonExistentFile) {
- using __llvm_libc::testing::ErrnoSetterMatcher::Fails;
+ using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails;
ASSERT_THAT(
- __llvm_libc::link("testdata/non-existent-file", "testdata/bad-link"),
+ LIBC_NAMESPACE::link("testdata/non-existent-file", "testdata/bad-link"),
Fails(ENOENT));
}
diff --git a/libc/test/src/unistd/linkat_test.cpp b/libc/test/src/unistd/linkat_test.cpp
index dcb6bff594a789e..2ef41cd4e75f6a7 100644
--- a/libc/test/src/unistd/linkat_test.cpp
+++ b/libc/test/src/unistd/linkat_test.cpp
@@ -15,7 +15,7 @@
#include "test/UnitTest/Test.h"
TEST(LlvmLibcLinkatTest, CreateAndUnlink) {
- using __llvm_libc::testing::ErrnoSetterMatcher::Succeeds;
+ using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds;
constexpr const char *TEST_DIR = "testdata";
constexpr const char *TEST_FILE = "linkat.test";
constexpr const char *TEST_FILE_PATH = "testdata/linkat.test";
@@ -28,28 +28,30 @@ TEST(LlvmLibcLinkatTest, CreateAndUnlink) {
// 3. Open the link to check that the link was created.
// 4. Cleanup the file and its link.
libc_errno = 0;
- int write_fd = __llvm_libc::open(TEST_FILE_PATH, O_WRONLY | O_CREAT, S_IRWXU);
+ int write_fd =
+ LIBC_NAMESPACE::open(TEST_FILE_PATH, O_WRONLY | O_CREAT, S_IRWXU);
ASSERT_EQ(libc_errno, 0);
ASSERT_GT(write_fd, 0);
- ASSERT_THAT(__llvm_libc::close(write_fd), Succeeds(0));
+ ASSERT_THAT(LIBC_NAMESPACE::close(write_fd), Succeeds(0));
- int dir_fd = __llvm_libc::open(TEST_DIR, O_DIRECTORY);
- ASSERT_THAT(__llvm_libc::linkat(dir_fd, TEST_FILE, dir_fd, TEST_FILE_LINK, 0),
- Succeeds(0));
+ int dir_fd = LIBC_NAMESPACE::open(TEST_DIR, O_DIRECTORY);
+ ASSERT_THAT(
+ LIBC_NAMESPACE::linkat(dir_fd, TEST_FILE, dir_fd, TEST_FILE_LINK, 0),
+ Succeeds(0));
- int link_fd = __llvm_libc::open(TEST_FILE_LINK_PATH, O_PATH);
+ int link_fd = LIBC_NAMESPACE::open(TEST_FILE_LINK_PATH, O_PATH);
ASSERT_GT(link_fd, 0);
ASSERT_EQ(libc_errno, 0);
- ASSERT_THAT(__llvm_libc::close(link_fd), Succeeds(0));
+ ASSERT_THAT(LIBC_NAMESPACE::close(link_fd), Succeeds(0));
- ASSERT_THAT(__llvm_libc::unlink(TEST_FILE_PATH), Succeeds(0));
- ASSERT_THAT(__llvm_libc::unlink(TEST_FILE_LINK_PATH), Succeeds(0));
- ASSERT_THAT(__llvm_libc::close(dir_fd), Succeeds(0));
+ ASSERT_THAT(LIBC_NAMESPACE::unlink(TEST_FILE_PATH), Succeeds(0));
+ ASSERT_THAT(LIBC_NAMESPACE::unlink(TEST_FILE_LINK_PATH), Succeeds(0));
+ ASSERT_THAT(LIBC_NAMESPACE::close(dir_fd), Succeeds(0));
}
TEST(LlvmLibcLinkatTest, LinkToNonExistentFile) {
- using __llvm_libc::testing::ErrnoSetterMatcher::Fails;
- ASSERT_THAT(__llvm_libc::linkat(AT_FDCWD, "testdata/non-existent-file",
- AT_FDCWD, "testdata/bad-link", 0),
+ using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails;
+ ASSERT_THAT(LIBC_NAMESPACE::linkat(AT_FDCWD, "testdata/non-existent-file",
+ AT_FDCWD, "testdata/bad-link", 0),
Fails(ENOENT));
}
diff --git a/libc/test/src/unistd/lseek_test.cpp b/libc/test/src/unistd/lseek_test.cpp
index cb04db462e414ba..1a13d54dbc2328c 100644
--- a/libc/test/src/unistd/lseek_test.cpp
+++ b/libc/test/src/unistd/lseek_test.cpp
@@ -17,44 +17,45 @@
#include <unistd.h>
TEST(LlvmLibcUniStd, LseekTest) {
- using __llvm_libc::testing::ErrnoSetterMatcher::Succeeds;
+ using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds;
constexpr const char *TEST_FILE = "testdata/lseek.test";
- int fd = __llvm_libc::open(TEST_FILE, O_RDONLY);
+ int fd = LIBC_NAMESPACE::open(TEST_FILE, O_RDONLY);
ASSERT_EQ(libc_errno, 0);
ASSERT_GT(fd, 0);
constexpr const char LSEEK_TEST[] = "lseek test";
constexpr int LSEEK_TEST_SIZE = sizeof(LSEEK_TEST) - 1;
char read_buf[20];
- ASSERT_THAT(__llvm_libc::read(fd, read_buf, LSEEK_TEST_SIZE),
+ ASSERT_THAT(LIBC_NAMESPACE::read(fd, read_buf, LSEEK_TEST_SIZE),
Succeeds(LSEEK_TEST_SIZE));
read_buf[LSEEK_TEST_SIZE] = '\0';
EXPECT_STREQ(read_buf, LSEEK_TEST);
// Seek to the beginning of the file and re-read.
- ASSERT_THAT(__llvm_libc::lseek(fd, 0, SEEK_SET), Succeeds(0));
- ASSERT_THAT(__llvm_libc::read(fd, read_buf, LSEEK_TEST_SIZE),
+ ASSERT_THAT(LIBC_NAMESPACE::lseek(fd, 0, SEEK_SET), Succeeds(0));
+ ASSERT_THAT(LIBC_NAMESPACE::read(fd, read_buf, LSEEK_TEST_SIZE),
Succeeds(LSEEK_TEST_SIZE));
read_buf[LSEEK_TEST_SIZE] = '\0';
EXPECT_STREQ(read_buf, LSEEK_TEST);
// Seek to the beginning of the file from the end and re-read.
- ASSERT_THAT(__llvm_libc::lseek(fd, -LSEEK_TEST_SIZE, SEEK_END), Succeeds(0));
- ASSERT_THAT(__llvm_libc::read(fd, read_buf, LSEEK_TEST_SIZE),
+ ASSERT_THAT(LIBC_NAMESPACE::lseek(fd, -LSEEK_TEST_SIZE, SEEK_END),
+ Succeeds(0));
+ ASSERT_THAT(LIBC_NAMESPACE::read(fd, read_buf, LSEEK_TEST_SIZE),
Succeeds(LSEEK_TEST_SIZE));
read_buf[LSEEK_TEST_SIZE] = '\0';
EXPECT_STREQ(read_buf, LSEEK_TEST);
- ASSERT_THAT(__llvm_libc::close(fd), Succeeds(0));
+ ASSERT_THAT(LIBC_NAMESPACE::close(fd), Succeeds(0));
}
TEST(LlvmLibcUniStd, LseekFailsTest) {
- using __llvm_libc::testing::ErrnoSetterMatcher::Fails;
- using __llvm_libc::testing::ErrnoSetterMatcher::Succeeds;
+ using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails;
+ using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds;
constexpr const char *TEST_FILE = "testdata/lseek.test";
- int fd = __llvm_libc::open(TEST_FILE, O_RDONLY);
+ int fd = LIBC_NAMESPACE::open(TEST_FILE, O_RDONLY);
ASSERT_EQ(libc_errno, 0);
ASSERT_GT(fd, 0);
- EXPECT_THAT(__llvm_libc::lseek(fd, -1, SEEK_CUR), Fails(EINVAL));
- ASSERT_THAT(__llvm_libc::close(fd), Succeeds(0));
+ EXPECT_THAT(LIBC_NAMESPACE::lseek(fd, -1, SEEK_CUR), Fails(EINVAL));
+ ASSERT_THAT(LIBC_NAMESPACE::close(fd), Succeeds(0));
}
diff --git a/libc/test/src/unistd/pread_pwrite_test.cpp b/libc/test/src/unistd/pread_pwrite_test.cpp
index 4d0158a8173a020..6819f559424f3e0 100644
--- a/libc/test/src/unistd/pread_pwrite_test.cpp
+++ b/libc/test/src/unistd/pread_pwrite_test.cpp
@@ -28,45 +28,46 @@ TEST(LlvmLibcUniStd, PWriteAndPReadBackTest) {
constexpr const char OFFSET_TEXT[] = "helhello";
constexpr int OFFSET_TEXT_SIZE = sizeof(OFFSET_TEXT);
- using __llvm_libc::testing::ErrnoSetterMatcher::Succeeds;
+ using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds;
constexpr const char *TEST_FILE = "testdata/pread_pwrite.test";
- int fd = __llvm_libc::open(TEST_FILE, O_WRONLY | O_CREAT, S_IRWXU);
+ int fd = LIBC_NAMESPACE::open(TEST_FILE, O_WRONLY | O_CREAT, S_IRWXU);
ASSERT_EQ(libc_errno, 0);
ASSERT_GT(fd, 0);
- ASSERT_THAT(__llvm_libc::write(fd, HELLO, HELLO_SIZE), Succeeds(HELLO_SIZE));
- ASSERT_THAT(__llvm_libc::fsync(fd), Succeeds(0));
- ASSERT_THAT(__llvm_libc::close(fd), Succeeds(0));
+ ASSERT_THAT(LIBC_NAMESPACE::write(fd, HELLO, HELLO_SIZE),
+ Succeeds(HELLO_SIZE));
+ ASSERT_THAT(LIBC_NAMESPACE::fsync(fd), Succeeds(0));
+ ASSERT_THAT(LIBC_NAMESPACE::close(fd), Succeeds(0));
- fd = __llvm_libc::open(TEST_FILE, O_WRONLY);
+ fd = LIBC_NAMESPACE::open(TEST_FILE, O_WRONLY);
ASSERT_EQ(libc_errno, 0);
ASSERT_GT(fd, 0);
- ASSERT_THAT(__llvm_libc::pwrite(fd, HELLO, HELLO_SIZE, OFFSET),
+ ASSERT_THAT(LIBC_NAMESPACE::pwrite(fd, HELLO, HELLO_SIZE, OFFSET),
Succeeds(HELLO_SIZE));
- ASSERT_THAT(__llvm_libc::fsync(fd), Succeeds(0));
- ASSERT_THAT(__llvm_libc::close(fd), Succeeds(0));
+ ASSERT_THAT(LIBC_NAMESPACE::fsync(fd), Succeeds(0));
+ ASSERT_THAT(LIBC_NAMESPACE::close(fd), Succeeds(0));
- fd = __llvm_libc::open(TEST_FILE, O_RDONLY);
+ fd = LIBC_NAMESPACE::open(TEST_FILE, O_RDONLY);
ASSERT_EQ(libc_errno, 0);
ASSERT_GT(fd, 0);
char read_buf[OFFSET_TEXT_SIZE];
- ASSERT_THAT(__llvm_libc::pread(fd, read_buf, HELLO_SIZE, OFFSET),
+ ASSERT_THAT(LIBC_NAMESPACE::pread(fd, read_buf, HELLO_SIZE, OFFSET),
Succeeds(HELLO_SIZE));
EXPECT_STREQ(read_buf, HELLO);
- ASSERT_THAT(__llvm_libc::pread(fd, read_buf, OFFSET_TEXT_SIZE, 0),
+ ASSERT_THAT(LIBC_NAMESPACE::pread(fd, read_buf, OFFSET_TEXT_SIZE, 0),
Succeeds(OFFSET_TEXT_SIZE));
EXPECT_STREQ(read_buf, OFFSET_TEXT);
- ASSERT_THAT(__llvm_libc::close(fd), Succeeds(0));
+ ASSERT_THAT(LIBC_NAMESPACE::close(fd), Succeeds(0));
- ASSERT_THAT(__llvm_libc::unlink(TEST_FILE), Succeeds(0));
+ ASSERT_THAT(LIBC_NAMESPACE::unlink(TEST_FILE), Succeeds(0));
}
TEST(LlvmLibcUniStd, PWriteFails) {
- using __llvm_libc::testing::ErrnoSetterMatcher::Fails;
- EXPECT_THAT(__llvm_libc::pwrite(-1, "", 1, 0), Fails(EBADF));
+ using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails;
+ EXPECT_THAT(LIBC_NAMESPACE::pwrite(-1, "", 1, 0), Fails(EBADF));
}
TEST(LlvmLibcUniStd, PReadFails) {
- using __llvm_libc::testing::ErrnoSetterMatcher::Fails;
- EXPECT_THAT(__llvm_libc::pread(-1, nullptr, 1, 0), Fails(EBADF));
+ using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails;
+ EXPECT_THAT(LIBC_NAMESPACE::pread(-1, nullptr, 1, 0), Fails(EBADF));
}
diff --git a/libc/test/src/unistd/read_write_test.cpp b/libc/test/src/unistd/read_write_test.cpp
index ed819a93d5f8272..20b51bb8082b120 100644
--- a/libc/test/src/unistd/read_write_test.cpp
+++ b/libc/test/src/unistd/read_write_test.cpp
@@ -16,42 +16,42 @@
#include "test/UnitTest/Test.h"
TEST(LlvmLibcUniStd, WriteAndReadBackTest) {
- using __llvm_libc::testing::ErrnoSetterMatcher::Succeeds;
+ using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds;
constexpr const char *TEST_FILE = "__unistd_read_write.test";
- int write_fd = __llvm_libc::open(TEST_FILE, O_WRONLY | O_CREAT, S_IRWXU);
+ int write_fd = LIBC_NAMESPACE::open(TEST_FILE, O_WRONLY | O_CREAT, S_IRWXU);
ASSERT_EQ(libc_errno, 0);
ASSERT_GT(write_fd, 0);
constexpr const char HELLO[] = "hello";
constexpr int HELLO_SIZE = sizeof(HELLO);
- ASSERT_THAT(__llvm_libc::write(write_fd, HELLO, HELLO_SIZE),
+ ASSERT_THAT(LIBC_NAMESPACE::write(write_fd, HELLO, HELLO_SIZE),
Succeeds(HELLO_SIZE));
- ASSERT_THAT(__llvm_libc::fsync(write_fd), Succeeds(0));
- ASSERT_THAT(__llvm_libc::close(write_fd), Succeeds(0));
+ ASSERT_THAT(LIBC_NAMESPACE::fsync(write_fd), Succeeds(0));
+ ASSERT_THAT(LIBC_NAMESPACE::close(write_fd), Succeeds(0));
- int read_fd = __llvm_libc::open(TEST_FILE, O_RDONLY);
+ int read_fd = LIBC_NAMESPACE::open(TEST_FILE, O_RDONLY);
ASSERT_EQ(libc_errno, 0);
ASSERT_GT(read_fd, 0);
char read_buf[10];
- ASSERT_THAT(__llvm_libc::read(read_fd, read_buf, HELLO_SIZE),
+ ASSERT_THAT(LIBC_NAMESPACE::read(read_fd, read_buf, HELLO_SIZE),
Succeeds(HELLO_SIZE));
EXPECT_STREQ(read_buf, HELLO);
- ASSERT_THAT(__llvm_libc::close(read_fd), Succeeds(0));
+ ASSERT_THAT(LIBC_NAMESPACE::close(read_fd), Succeeds(0));
// TODO: 'remove' the test file after the test.
}
TEST(LlvmLibcUniStd, WriteFails) {
- using __llvm_libc::testing::ErrnoSetterMatcher::Fails;
+ using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails;
- EXPECT_THAT(__llvm_libc::write(-1, "", 1), Fails(EBADF));
- EXPECT_THAT(__llvm_libc::write(1, reinterpret_cast<const void *>(-1), 1),
+ EXPECT_THAT(LIBC_NAMESPACE::write(-1, "", 1), Fails(EBADF));
+ EXPECT_THAT(LIBC_NAMESPACE::write(1, reinterpret_cast<const void *>(-1), 1),
Fails(EFAULT));
}
TEST(LlvmLibcUniStd, ReadFails) {
- using __llvm_libc::testing::ErrnoSetterMatcher::Fails;
+ using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails;
- EXPECT_THAT(__llvm_libc::read(-1, nullptr, 1), Fails(EBADF));
- EXPECT_THAT(__llvm_libc::read(0, reinterpret_cast<void *>(-1), 1),
+ EXPECT_THAT(LIBC_NAMESPACE::read(-1, nullptr, 1), Fails(EBADF));
+ EXPECT_THAT(LIBC_NAMESPACE::read(0, reinterpret_cast<void *>(-1), 1),
Fails(EFAULT));
}
diff --git a/libc/test/src/unistd/readlink_test.cpp b/libc/test/src/unistd/readlink_test.cpp
index dbb957f29fd05c8..b2d018a50ec7931 100644
--- a/libc/test/src/unistd/readlink_test.cpp
+++ b/libc/test/src/unistd/readlink_test.cpp
@@ -14,10 +14,10 @@
#include "test/UnitTest/ErrnoSetterMatcher.h"
#include "test/UnitTest/Test.h"
-namespace cpp = __llvm_libc::cpp;
+namespace cpp = LIBC_NAMESPACE::cpp;
TEST(LlvmLibcReadlinkTest, CreateAndUnlink) {
- using __llvm_libc::testing::ErrnoSetterMatcher::Succeeds;
+ using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds;
constexpr const char LINK_VAL[] = "readlink_test_value";
constexpr const char LINK[] = "testdata/readlink.test.link";
libc_errno = 0;
@@ -26,19 +26,19 @@ TEST(LlvmLibcReadlinkTest, CreateAndUnlink) {
// 1. Create a symlink with value LINK_VAL.
// 2. Read the symlink with readlink. The link value read should be LINK_VAL
// 3. Cleanup the symlink created in step #1.
- ASSERT_THAT(__llvm_libc::symlink(LINK_VAL, LINK), Succeeds(0));
+ ASSERT_THAT(LIBC_NAMESPACE::symlink(LINK_VAL, LINK), Succeeds(0));
char buf[sizeof(LINK_VAL)];
- ssize_t len = __llvm_libc::readlink(LINK, buf, sizeof(buf));
+ ssize_t len = LIBC_NAMESPACE::readlink(LINK, buf, sizeof(buf));
ASSERT_EQ(libc_errno, 0);
ASSERT_EQ(cpp::string_view(buf, len), cpp::string_view(LINK_VAL));
- ASSERT_THAT(__llvm_libc::unlink(LINK), Succeeds(0));
+ ASSERT_THAT(LIBC_NAMESPACE::unlink(LINK), Succeeds(0));
}
TEST(LlvmLibcReadlinkTest, ReadlinkInNonExistentPath) {
- using __llvm_libc::testing::ErrnoSetterMatcher::Fails;
+ using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails;
char buf[8];
- ASSERT_THAT(__llvm_libc::readlink("non-existent-link", buf, sizeof(buf)),
+ ASSERT_THAT(LIBC_NAMESPACE::readlink("non-existent-link", buf, sizeof(buf)),
Fails(ENOENT));
}
diff --git a/libc/test/src/unistd/readlinkat_test.cpp b/libc/test/src/unistd/readlinkat_test.cpp
index 39127c0288b0b45..19f0ceec3cf7c59 100644
--- a/libc/test/src/unistd/readlinkat_test.cpp
+++ b/libc/test/src/unistd/readlinkat_test.cpp
@@ -16,10 +16,10 @@
#include <fcntl.h>
-namespace cpp = __llvm_libc::cpp;
+namespace cpp = LIBC_NAMESPACE::cpp;
TEST(LlvmLibcReadlinkatTest, CreateAndUnlink) {
- using __llvm_libc::testing::ErrnoSetterMatcher::Succeeds;
+ using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds;
constexpr const char LINK_VAL[] = "readlinkat_test_value";
constexpr const char LINK[] = "testdata/readlinkat.test.link";
libc_errno = 0;
@@ -28,20 +28,20 @@ TEST(LlvmLibcReadlinkatTest, CreateAndUnlink) {
// 1. Create a symlink with value LINK_VAL.
// 2. Read the symlink with readlink. The link value read should be LINK_VAL
// 3. Cleanup the symlink created in step #1.
- ASSERT_THAT(__llvm_libc::symlink(LINK_VAL, LINK), Succeeds(0));
+ ASSERT_THAT(LIBC_NAMESPACE::symlink(LINK_VAL, LINK), Succeeds(0));
char buf[sizeof(LINK_VAL)];
- ssize_t len = __llvm_libc::readlinkat(AT_FDCWD, LINK, buf, sizeof(buf));
+ ssize_t len = LIBC_NAMESPACE::readlinkat(AT_FDCWD, LINK, buf, sizeof(buf));
ASSERT_EQ(libc_errno, 0);
ASSERT_EQ(cpp::string_view(buf, len), cpp::string_view(LINK_VAL));
- ASSERT_THAT(__llvm_libc::unlink(LINK), Succeeds(0));
+ ASSERT_THAT(LIBC_NAMESPACE::unlink(LINK), Succeeds(0));
}
TEST(LlvmLibcReadlinkatTest, ReadlinkInNonExistentPath) {
- using __llvm_libc::testing::ErrnoSetterMatcher::Fails;
+ using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails;
char buf[8];
- ASSERT_THAT(
- __llvm_libc::readlinkat(AT_FDCWD, "non-existent-link", buf, sizeof(buf)),
- Fails(ENOENT));
+ ASSERT_THAT(LIBC_NAMESPACE::readlinkat(AT_FDCWD, "non-existent-link", buf,
+ sizeof(buf)),
+ Fails(ENOENT));
}
diff --git a/libc/test/src/unistd/rmdir_test.cpp b/libc/test/src/unistd/rmdir_test.cpp
index 3fcf328b67d9882..69228ce98c82244 100644
--- a/libc/test/src/unistd/rmdir_test.cpp
+++ b/libc/test/src/unistd/rmdir_test.cpp
@@ -15,13 +15,14 @@
#include <fcntl.h>
TEST(LlvmLibcRmdirTest, CreateAndRemove) {
- using __llvm_libc::testing::ErrnoSetterMatcher::Succeeds;
+ using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds;
constexpr const char *TEST_DIR = "testdata/rmdir.testdir";
- ASSERT_THAT(__llvm_libc::mkdir(TEST_DIR, S_IRWXU), Succeeds(0));
- ASSERT_THAT(__llvm_libc::rmdir(TEST_DIR), Succeeds(0));
+ ASSERT_THAT(LIBC_NAMESPACE::mkdir(TEST_DIR, S_IRWXU), Succeeds(0));
+ ASSERT_THAT(LIBC_NAMESPACE::rmdir(TEST_DIR), Succeeds(0));
}
TEST(LlvmLibcRmdirTest, RemoveNonExistentDir) {
- using __llvm_libc::testing::ErrnoSetterMatcher::Fails;
- ASSERT_THAT(__llvm_libc::rmdir("testdata/non-existent-dir"), Fails(ENOENT));
+ using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails;
+ ASSERT_THAT(LIBC_NAMESPACE::rmdir("testdata/non-existent-dir"),
+ Fails(ENOENT));
}
diff --git a/libc/test/src/unistd/swab_test.cpp b/libc/test/src/unistd/swab_test.cpp
index 9b94924ee3cf13a..f75120d192ba3b6 100644
--- a/libc/test/src/unistd/swab_test.cpp
+++ b/libc/test/src/unistd/swab_test.cpp
@@ -15,48 +15,51 @@
TEST(LlvmLibcSwabTest, NegativeSizeIsNoOp) {
const char *from = "abc";
char to[4] = {'x', 'y', 'z', '\0'};
- __llvm_libc::swab(from, to, -1);
+ LIBC_NAMESPACE::swab(from, to, -1);
ASSERT_STREQ(to, "xyz");
}
TEST(LlvmLibcSwabTest, ZeroSizeIsNoOp) {
const char *from = "abc";
char to[4] = {'x', 'y', 'z', '\0'};
- __llvm_libc::swab(from, to, 0);
+ LIBC_NAMESPACE::swab(from, to, 0);
ASSERT_STREQ(to, "xyz");
}
TEST(LlvmLibcSwabTest, SingleByteIsNoOp) {
char from[] = {'a'};
char to[4] = {'x', 'y', 'z', '\0'};
- __llvm_libc::swab(from, to, sizeof(from));
+ LIBC_NAMESPACE::swab(from, to, sizeof(from));
ASSERT_STREQ(to, "xyz");
}
TEST(LlvmLibcSwabTest, NullPtrsAreNotDeRefedIfNIsLessThanTwo) {
// This test passes if a crash does not happen
- __llvm_libc::swab(nullptr, nullptr, -1);
- __llvm_libc::swab(nullptr, nullptr, 0);
- __llvm_libc::swab(nullptr, nullptr, 1);
+ LIBC_NAMESPACE::swab(nullptr, nullptr, -1);
+ LIBC_NAMESPACE::swab(nullptr, nullptr, 0);
+ LIBC_NAMESPACE::swab(nullptr, nullptr, 1);
}
TEST(LlvmLibcSwabTest, BytesAreSwappedWithEvenN) {
{
const char *from = "ab";
char to[3] = {};
- __llvm_libc::swab(from, to, __llvm_libc::internal::string_length(from));
+ LIBC_NAMESPACE::swab(from, to,
+ LIBC_NAMESPACE::internal::string_length(from));
ASSERT_STREQ(to, "ba");
}
{
const char *from = "abcd";
char to[5] = {};
- __llvm_libc::swab(from, to, __llvm_libc::internal::string_length(from));
+ LIBC_NAMESPACE::swab(from, to,
+ LIBC_NAMESPACE::internal::string_length(from));
ASSERT_STREQ(to, "badc");
}
{
const char *from = "aAaAaA";
char to[7] = {};
- __llvm_libc::swab(from, to, __llvm_libc::internal::string_length(from));
+ LIBC_NAMESPACE::swab(from, to,
+ LIBC_NAMESPACE::internal::string_length(from));
ASSERT_STREQ(to, "AaAaAa");
}
}
@@ -65,19 +68,22 @@ TEST(LlvmLibcSwabTest, LastByteIgnoredWithOddN) {
{
const char *from = "aba";
char to[3] = {};
- __llvm_libc::swab(from, to, __llvm_libc::internal::string_length(from));
+ LIBC_NAMESPACE::swab(from, to,
+ LIBC_NAMESPACE::internal::string_length(from));
ASSERT_STREQ(to, "ba");
}
{
const char *from = "abcde";
char to[5] = {};
- __llvm_libc::swab(from, to, __llvm_libc::internal::string_length(from));
+ LIBC_NAMESPACE::swab(from, to,
+ LIBC_NAMESPACE::internal::string_length(from));
ASSERT_STREQ(to, "badc");
}
{
const char *from = "aAaAaAx";
char to[7] = {};
- __llvm_libc::swab(from, to, __llvm_libc::internal::string_length(from));
+ LIBC_NAMESPACE::swab(from, to,
+ LIBC_NAMESPACE::internal::string_length(from));
ASSERT_STREQ(to, "AaAaAa");
}
}
diff --git a/libc/test/src/unistd/symlink_test.cpp b/libc/test/src/unistd/symlink_test.cpp
index 7017d4bb4f941f1..84d963b7a207ce8 100644
--- a/libc/test/src/unistd/symlink_test.cpp
+++ b/libc/test/src/unistd/symlink_test.cpp
@@ -15,7 +15,7 @@
#include "test/UnitTest/Test.h"
TEST(LlvmLibcSymlinkTest, CreateAndUnlink) {
- using __llvm_libc::testing::ErrnoSetterMatcher::Succeeds;
+ using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds;
constexpr const char *TEST_FILE_BASE = "symlink.test";
constexpr const char *TEST_FILE = "testdata/symlink.test";
constexpr const char *TEST_FILE_LINK = "testdata/symlink.test.symlink";
@@ -26,26 +26,26 @@ TEST(LlvmLibcSymlinkTest, CreateAndUnlink) {
// 3. Open the symlink to check that the symlink was created.
// 4. Cleanup the file and its symlink.
libc_errno = 0;
- int write_fd = __llvm_libc::open(TEST_FILE, O_WRONLY | O_CREAT, S_IRWXU);
+ int write_fd = LIBC_NAMESPACE::open(TEST_FILE, O_WRONLY | O_CREAT, S_IRWXU);
ASSERT_EQ(libc_errno, 0);
ASSERT_GT(write_fd, 0);
- ASSERT_THAT(__llvm_libc::close(write_fd), Succeeds(0));
+ ASSERT_THAT(LIBC_NAMESPACE::close(write_fd), Succeeds(0));
- ASSERT_THAT(__llvm_libc::symlink(TEST_FILE_BASE, TEST_FILE_LINK),
+ ASSERT_THAT(LIBC_NAMESPACE::symlink(TEST_FILE_BASE, TEST_FILE_LINK),
Succeeds(0));
- int symlink_fd = __llvm_libc::open(TEST_FILE_LINK, O_PATH);
+ int symlink_fd = LIBC_NAMESPACE::open(TEST_FILE_LINK, O_PATH);
ASSERT_GT(symlink_fd, 0);
ASSERT_EQ(libc_errno, 0);
- ASSERT_THAT(__llvm_libc::close(symlink_fd), Succeeds(0));
+ ASSERT_THAT(LIBC_NAMESPACE::close(symlink_fd), Succeeds(0));
- ASSERT_THAT(__llvm_libc::unlink(TEST_FILE), Succeeds(0));
- ASSERT_THAT(__llvm_libc::unlink(TEST_FILE_LINK), Succeeds(0));
+ ASSERT_THAT(LIBC_NAMESPACE::unlink(TEST_FILE), Succeeds(0));
+ ASSERT_THAT(LIBC_NAMESPACE::unlink(TEST_FILE_LINK), Succeeds(0));
}
TEST(LlvmLibcSymlinkTest, SymlinkInNonExistentPath) {
- using __llvm_libc::testing::ErrnoSetterMatcher::Fails;
- ASSERT_THAT(__llvm_libc::symlink("non-existent-dir/non-existent-file",
- "non-existent-dir/bad-symlink"),
+ using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails;
+ ASSERT_THAT(LIBC_NAMESPACE::symlink("non-existent-dir/non-existent-file",
+ "non-existent-dir/bad-symlink"),
Fails(ENOENT));
}
diff --git a/libc/test/src/unistd/symlinkat_test.cpp b/libc/test/src/unistd/symlinkat_test.cpp
index e629c14f0f7a17d..b0308787f2052a2 100644
--- a/libc/test/src/unistd/symlinkat_test.cpp
+++ b/libc/test/src/unistd/symlinkat_test.cpp
@@ -15,7 +15,7 @@
#include "test/UnitTest/Test.h"
TEST(LlvmLibcSymlinkatTest, CreateAndUnlink) {
- using __llvm_libc::testing::ErrnoSetterMatcher::Succeeds;
+ using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds;
constexpr const char *TEST_DIR = "testdata";
constexpr const char *TEST_FILE = "symlinkat.test";
constexpr const char *TEST_FILE_PATH = "testdata/symlinkat.test";
@@ -28,28 +28,29 @@ TEST(LlvmLibcSymlinkatTest, CreateAndUnlink) {
// 3. Open the link to check that the link was created.
// 4. Cleanup the file and its link.
libc_errno = 0;
- int write_fd = __llvm_libc::open(TEST_FILE_PATH, O_WRONLY | O_CREAT, S_IRWXU);
+ int write_fd =
+ LIBC_NAMESPACE::open(TEST_FILE_PATH, O_WRONLY | O_CREAT, S_IRWXU);
ASSERT_EQ(libc_errno, 0);
ASSERT_GT(write_fd, 0);
- ASSERT_THAT(__llvm_libc::close(write_fd), Succeeds(0));
+ ASSERT_THAT(LIBC_NAMESPACE::close(write_fd), Succeeds(0));
- int dir_fd = __llvm_libc::open(TEST_DIR, O_DIRECTORY);
- ASSERT_THAT(__llvm_libc::symlinkat(TEST_FILE, dir_fd, TEST_FILE_LINK),
+ int dir_fd = LIBC_NAMESPACE::open(TEST_DIR, O_DIRECTORY);
+ ASSERT_THAT(LIBC_NAMESPACE::symlinkat(TEST_FILE, dir_fd, TEST_FILE_LINK),
Succeeds(0));
- int link_fd = __llvm_libc::open(TEST_FILE_LINK_PATH, O_PATH);
+ int link_fd = LIBC_NAMESPACE::open(TEST_FILE_LINK_PATH, O_PATH);
ASSERT_GT(link_fd, 0);
ASSERT_EQ(libc_errno, 0);
- ASSERT_THAT(__llvm_libc::close(link_fd), Succeeds(0));
+ ASSERT_THAT(LIBC_NAMESPACE::close(link_fd), Succeeds(0));
- ASSERT_THAT(__llvm_libc::close(dir_fd), Succeeds(0));
- ASSERT_THAT(__llvm_libc::unlink(TEST_FILE_LINK_PATH), Succeeds(0));
- ASSERT_THAT(__llvm_libc::unlink(TEST_FILE_PATH), Succeeds(0));
+ ASSERT_THAT(LIBC_NAMESPACE::close(dir_fd), Succeeds(0));
+ ASSERT_THAT(LIBC_NAMESPACE::unlink(TEST_FILE_LINK_PATH), Succeeds(0));
+ ASSERT_THAT(LIBC_NAMESPACE::unlink(TEST_FILE_PATH), Succeeds(0));
}
TEST(LlvmLibcSymlinkatTest, SymlinkInNonExistentPath) {
- using __llvm_libc::testing::ErrnoSetterMatcher::Fails;
- ASSERT_THAT(__llvm_libc::symlinkat("non-existent-dir/non-existent-file",
- AT_FDCWD, "non-existent-dir/bad-link"),
+ using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails;
+ ASSERT_THAT(LIBC_NAMESPACE::symlinkat("non-existent-dir/non-existent-file",
+ AT_FDCWD, "non-existent-dir/bad-link"),
Fails(ENOENT));
}
diff --git a/libc/test/src/unistd/syscall_test.cpp b/libc/test/src/unistd/syscall_test.cpp
index 03b9a547cdcb7e4..4a53f674b8f3d61 100644
--- a/libc/test/src/unistd/syscall_test.cpp
+++ b/libc/test/src/unistd/syscall_test.cpp
@@ -15,7 +15,7 @@
#include <sys/syscall.h> // For syscall numbers.
#include <unistd.h>
-using __llvm_libc::testing::ErrnoSetterMatcher::Succeeds;
+using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds;
// We only do a smoke test here. Actual functionality tests are
// done by the unit tests of the syscall wrappers like mmap.
@@ -24,11 +24,11 @@ using __llvm_libc::testing::ErrnoSetterMatcher::Succeeds;
// There is no function named "syscall" in llvm-libc, we instead use a macro to
// set up the arguments properly. We still need to specify the namespace though
// because the macro generates a call to the actual internal function
-// (__llvm_libc_syscall) which is inside the namespace.
+// (LIBC_NAMESPACE_syscall) which is inside the namespace.
TEST(LlvmLibcSyscallTest, TrivialCall) {
libc_errno = 0;
- ASSERT_GE(__llvm_libc::syscall(SYS_gettid), 0l);
+ ASSERT_GE(LIBC_NAMESPACE::syscall(SYS_gettid), 0l);
ASSERT_EQ(libc_errno, 0);
}
@@ -37,9 +37,10 @@ TEST(LlvmLibcSyscallTest, SymlinkCreateDestroy) {
constexpr const char LINK[] = "testdata/syscall_readlink.test.link";
#ifdef SYS_symlink
- ASSERT_GE(__llvm_libc::syscall(SYS_symlink, LINK_VAL, LINK), 0l);
+ ASSERT_GE(LIBC_NAMESPACE::syscall(SYS_symlink, LINK_VAL, LINK), 0l);
#elif defined(SYS_symlinkat)
- ASSERT_GE(__llvm_libc::syscall(SYS_symlinkat, LINK_VAL, AT_FDCWD, LINK), 0l);
+ ASSERT_GE(LIBC_NAMESPACE::syscall(SYS_symlinkat, LINK_VAL, AT_FDCWD, LINK),
+ 0l);
#else
#error "symlink and symlinkat syscalls not available."
#endif
@@ -48,18 +49,18 @@ TEST(LlvmLibcSyscallTest, SymlinkCreateDestroy) {
char buf[sizeof(LINK_VAL)];
#ifdef SYS_readlink
- ASSERT_GE(__llvm_libc::syscall(SYS_readlink, LINK, buf, sizeof(buf)), 0l);
+ ASSERT_GE(LIBC_NAMESPACE::syscall(SYS_readlink, LINK, buf, sizeof(buf)), 0l);
#elif defined(SYS_readlinkat)
ASSERT_GE(
- __llvm_libc::syscall(SYS_readlinkat, AT_FDCWD, LINK, buf, sizeof(buf)),
+ LIBC_NAMESPACE::syscall(SYS_readlinkat, AT_FDCWD, LINK, buf, sizeof(buf)),
0l);
#endif
ASSERT_EQ(libc_errno, 0);
#ifdef SYS_unlink
- ASSERT_GE(__llvm_libc::syscall(SYS_unlink, LINK), 0l);
+ ASSERT_GE(LIBC_NAMESPACE::syscall(SYS_unlink, LINK), 0l);
#elif defined(SYS_unlinkat)
- ASSERT_GE(__llvm_libc::syscall(SYS_unlinkat, AT_FDCWD, LINK, 0), 0l);
+ ASSERT_GE(LIBC_NAMESPACE::syscall(SYS_unlinkat, AT_FDCWD, LINK, 0), 0l);
#else
#error "unlink and unlinkat syscalls not available."
#endif
@@ -74,23 +75,24 @@ TEST(LlvmLibcSyscallTest, FileReadWrite) {
#ifdef SYS_open
int fd =
- __llvm_libc::syscall(SYS_open, TEST_FILE, O_WRONLY | O_CREAT, S_IRWXU);
+ LIBC_NAMESPACE::syscall(SYS_open, TEST_FILE, O_WRONLY | O_CREAT, S_IRWXU);
#elif defined(SYS_openat)
- int fd = __llvm_libc::syscall(SYS_openat, AT_FDCWD, TEST_FILE,
- O_WRONLY | O_CREAT, S_IRWXU);
+ int fd = LIBC_NAMESPACE::syscall(SYS_openat, AT_FDCWD, TEST_FILE,
+ O_WRONLY | O_CREAT, S_IRWXU);
#else
#error "open and openat syscalls not available."
#endif
ASSERT_GT(fd, 0);
ASSERT_EQ(libc_errno, 0);
- ASSERT_GE(__llvm_libc::syscall(SYS_pwrite64, fd, HELLO, HELLO_SIZE, 0), 0l);
+ ASSERT_GE(LIBC_NAMESPACE::syscall(SYS_pwrite64, fd, HELLO, HELLO_SIZE, 0),
+ 0l);
ASSERT_EQ(libc_errno, 0);
- ASSERT_GE(__llvm_libc::syscall(SYS_fsync, fd), 0l);
+ ASSERT_GE(LIBC_NAMESPACE::syscall(SYS_fsync, fd), 0l);
ASSERT_EQ(libc_errno, 0);
- ASSERT_GE(__llvm_libc::syscall(SYS_close, fd), 0l);
+ ASSERT_GE(LIBC_NAMESPACE::syscall(SYS_close, fd), 0l);
ASSERT_EQ(libc_errno, 0);
}
@@ -109,40 +111,41 @@ TEST(LlvmLibcSyscallTest, FileLinkCreateDestroy) {
// 4. Cleanup the file and its link.
#ifdef SYS_open
- int write_fd = __llvm_libc::syscall(SYS_open, TEST_FILE_PATH,
- O_WRONLY | O_CREAT, S_IRWXU);
+ int write_fd = LIBC_NAMESPACE::syscall(SYS_open, TEST_FILE_PATH,
+ O_WRONLY | O_CREAT, S_IRWXU);
#elif defined(SYS_openat)
- int write_fd = __llvm_libc::syscall(SYS_openat, AT_FDCWD, TEST_FILE_PATH,
- O_WRONLY | O_CREAT, S_IRWXU);
+ int write_fd = LIBC_NAMESPACE::syscall(SYS_openat, AT_FDCWD, TEST_FILE_PATH,
+ O_WRONLY | O_CREAT, S_IRWXU);
#else
#error "open and openat syscalls not available."
#endif
ASSERT_GT(write_fd, 0);
ASSERT_EQ(libc_errno, 0);
- ASSERT_GE(__llvm_libc::syscall(SYS_close, write_fd), 0l);
+ ASSERT_GE(LIBC_NAMESPACE::syscall(SYS_close, write_fd), 0l);
ASSERT_EQ(libc_errno, 0);
#ifdef SYS_open
- int dir_fd = __llvm_libc::syscall(SYS_open, TEST_DIR, O_DIRECTORY, 0);
+ int dir_fd = LIBC_NAMESPACE::syscall(SYS_open, TEST_DIR, O_DIRECTORY, 0);
#elif defined(SYS_openat)
int dir_fd =
- __llvm_libc::syscall(SYS_openat, AT_FDCWD, TEST_DIR, O_DIRECTORY, 0);
+ LIBC_NAMESPACE::syscall(SYS_openat, AT_FDCWD, TEST_DIR, O_DIRECTORY, 0);
#else
#error "open and openat syscalls not available."
#endif
ASSERT_GT(dir_fd, 0);
ASSERT_EQ(libc_errno, 0);
- ASSERT_GE(__llvm_libc::syscall(SYS_linkat, dir_fd, TEST_FILE, dir_fd,
- TEST_FILE_LINK, 0),
+ ASSERT_GE(LIBC_NAMESPACE::syscall(SYS_linkat, dir_fd, TEST_FILE, dir_fd,
+ TEST_FILE_LINK, 0),
0l);
ASSERT_EQ(libc_errno, 0);
#ifdef SYS_open
- int link_fd = __llvm_libc::syscall(SYS_open, TEST_FILE_LINK_PATH, O_PATH, 0);
+ int link_fd =
+ LIBC_NAMESPACE::syscall(SYS_open, TEST_FILE_LINK_PATH, O_PATH, 0);
#elif defined(SYS_openat)
- int link_fd = __llvm_libc::syscall(SYS_openat, AT_FDCWD, TEST_FILE_LINK_PATH,
- O_PATH, 0);
+ int link_fd = LIBC_NAMESPACE::syscall(SYS_openat, AT_FDCWD,
+ TEST_FILE_LINK_PATH, O_PATH, 0);
#else
#error "open and openat syscalls not available."
#endif
@@ -150,9 +153,9 @@ TEST(LlvmLibcSyscallTest, FileLinkCreateDestroy) {
ASSERT_EQ(libc_errno, 0);
#ifdef SYS_unlink
- ASSERT_GE(__llvm_libc::syscall(SYS_unlink, TEST_FILE_PATH), 0l);
+ ASSERT_GE(LIBC_NAMESPACE::syscall(SYS_unlink, TEST_FILE_PATH), 0l);
#elif defined(SYS_unlinkat)
- ASSERT_GE(__llvm_libc::syscall(SYS_unlinkat, AT_FDCWD, TEST_FILE_PATH, 0),
+ ASSERT_GE(LIBC_NAMESPACE::syscall(SYS_unlinkat, AT_FDCWD, TEST_FILE_PATH, 0),
0l);
#else
#error "unlink and unlinkat syscalls not available."
@@ -160,15 +163,16 @@ TEST(LlvmLibcSyscallTest, FileLinkCreateDestroy) {
ASSERT_EQ(libc_errno, 0);
#ifdef SYS_unlink
- ASSERT_GE(__llvm_libc::syscall(SYS_unlink, TEST_FILE_LINK_PATH), 0l);
+ ASSERT_GE(LIBC_NAMESPACE::syscall(SYS_unlink, TEST_FILE_LINK_PATH), 0l);
#elif defined(SYS_unlinkat)
ASSERT_GE(
- __llvm_libc::syscall(SYS_unlinkat, AT_FDCWD, TEST_FILE_LINK_PATH, 0), 0l);
+ LIBC_NAMESPACE::syscall(SYS_unlinkat, AT_FDCWD, TEST_FILE_LINK_PATH, 0),
+ 0l);
#else
#error "unlink and unlinkat syscalls not available."
#endif
ASSERT_EQ(libc_errno, 0);
- ASSERT_GE(__llvm_libc::syscall(SYS_close, dir_fd), 0l);
+ ASSERT_GE(LIBC_NAMESPACE::syscall(SYS_close, dir_fd), 0l);
ASSERT_EQ(libc_errno, 0);
}
diff --git a/libc/test/src/unistd/sysconf_test.cpp b/libc/test/src/unistd/sysconf_test.cpp
index eda2e566b0257dd..85bc1258a486385 100644
--- a/libc/test/src/unistd/sysconf_test.cpp
+++ b/libc/test/src/unistd/sysconf_test.cpp
@@ -12,6 +12,6 @@
#include <unistd.h>
TEST(LlvmLibcSysconfTest, PagesizeTest) {
- long pagesize = __llvm_libc::sysconf(_SC_PAGESIZE);
+ long pagesize = LIBC_NAMESPACE::sysconf(_SC_PAGESIZE);
ASSERT_GT(pagesize, 0l);
}
diff --git a/libc/test/src/unistd/truncate_test.cpp b/libc/test/src/unistd/truncate_test.cpp
index 4885a12225854d4..15940321e5ad456 100644
--- a/libc/test/src/unistd/truncate_test.cpp
+++ b/libc/test/src/unistd/truncate_test.cpp
@@ -17,10 +17,10 @@
#include "test/UnitTest/ErrnoSetterMatcher.h"
#include "test/UnitTest/Test.h"
-namespace cpp = __llvm_libc::cpp;
+namespace cpp = LIBC_NAMESPACE::cpp;
TEST(LlvmLibcTruncateTest, CreateAndTruncate) {
- using __llvm_libc::testing::ErrnoSetterMatcher::Succeeds;
+ using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds;
constexpr const char TEST_FILE[] = "testdata/truncate.test";
constexpr const char WRITE_DATA[] = "hello, truncate";
constexpr size_t WRITE_SIZE = sizeof(WRITE_DATA);
@@ -32,35 +32,35 @@ TEST(LlvmLibcTruncateTest, CreateAndTruncate) {
// 3. Truncate to 1 byte.
// 4. Try to read more than 1 byte and fail.
libc_errno = 0;
- int fd = __llvm_libc::open(TEST_FILE, O_WRONLY | O_CREAT, S_IRWXU);
+ int fd = LIBC_NAMESPACE::open(TEST_FILE, O_WRONLY | O_CREAT, S_IRWXU);
ASSERT_EQ(libc_errno, 0);
ASSERT_GT(fd, 0);
ASSERT_EQ(ssize_t(WRITE_SIZE),
- __llvm_libc::write(fd, WRITE_DATA, WRITE_SIZE));
- ASSERT_THAT(__llvm_libc::close(fd), Succeeds(0));
+ LIBC_NAMESPACE::write(fd, WRITE_DATA, WRITE_SIZE));
+ ASSERT_THAT(LIBC_NAMESPACE::close(fd), Succeeds(0));
- fd = __llvm_libc::open(TEST_FILE, O_RDONLY);
+ fd = LIBC_NAMESPACE::open(TEST_FILE, O_RDONLY);
ASSERT_EQ(libc_errno, 0);
ASSERT_GT(fd, 0);
- ASSERT_EQ(ssize_t(WRITE_SIZE), __llvm_libc::read(fd, buf, WRITE_SIZE));
+ ASSERT_EQ(ssize_t(WRITE_SIZE), LIBC_NAMESPACE::read(fd, buf, WRITE_SIZE));
ASSERT_EQ(cpp::string_view(buf), cpp::string_view(WRITE_DATA));
- ASSERT_THAT(__llvm_libc::close(fd), Succeeds(0));
+ ASSERT_THAT(LIBC_NAMESPACE::close(fd), Succeeds(0));
- ASSERT_THAT(__llvm_libc::truncate(TEST_FILE, off_t(1)), Succeeds(0));
+ ASSERT_THAT(LIBC_NAMESPACE::truncate(TEST_FILE, off_t(1)), Succeeds(0));
- fd = __llvm_libc::open(TEST_FILE, O_RDONLY);
+ fd = LIBC_NAMESPACE::open(TEST_FILE, O_RDONLY);
ASSERT_EQ(libc_errno, 0);
ASSERT_GT(fd, 0);
- ASSERT_EQ(ssize_t(1), __llvm_libc::read(fd, buf, WRITE_SIZE));
+ ASSERT_EQ(ssize_t(1), LIBC_NAMESPACE::read(fd, buf, WRITE_SIZE));
ASSERT_EQ(buf[0], WRITE_DATA[0]);
- ASSERT_THAT(__llvm_libc::close(fd), Succeeds(0));
+ ASSERT_THAT(LIBC_NAMESPACE::close(fd), Succeeds(0));
- ASSERT_THAT(__llvm_libc::unlink(TEST_FILE), Succeeds(0));
+ ASSERT_THAT(LIBC_NAMESPACE::unlink(TEST_FILE), Succeeds(0));
}
TEST(LlvmLibcTruncateTest, TruncateNonExistentFile) {
- using __llvm_libc::testing::ErrnoSetterMatcher::Fails;
+ using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails;
ASSERT_THAT(
- __llvm_libc::truncate("non-existent-dir/non-existent-file", off_t(1)),
+ LIBC_NAMESPACE::truncate("non-existent-dir/non-existent-file", off_t(1)),
Fails(ENOENT));
}
diff --git a/libc/test/src/unistd/unlink_test.cpp b/libc/test/src/unistd/unlink_test.cpp
index ff55123fa0a4ea4..8a64f88ee6f26db 100644
--- a/libc/test/src/unistd/unlink_test.cpp
+++ b/libc/test/src/unistd/unlink_test.cpp
@@ -14,16 +14,17 @@
#include "test/UnitTest/Test.h"
TEST(LlvmLibcUnlinkTest, CreateAndUnlink) {
- using __llvm_libc::testing::ErrnoSetterMatcher::Succeeds;
+ using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds;
constexpr const char *TEST_FILE = "testdata/unlink.test";
- int write_fd = __llvm_libc::open(TEST_FILE, O_WRONLY | O_CREAT, S_IRWXU);
+ int write_fd = LIBC_NAMESPACE::open(TEST_FILE, O_WRONLY | O_CREAT, S_IRWXU);
ASSERT_EQ(libc_errno, 0);
ASSERT_GT(write_fd, 0);
- ASSERT_THAT(__llvm_libc::close(write_fd), Succeeds(0));
- ASSERT_THAT(__llvm_libc::unlink(TEST_FILE), Succeeds(0));
+ ASSERT_THAT(LIBC_NAMESPACE::close(write_fd), Succeeds(0));
+ ASSERT_THAT(LIBC_NAMESPACE::unlink(TEST_FILE), Succeeds(0));
}
TEST(LlvmLibcUnlinkTest, UnlinkNonExistentFile) {
- using __llvm_libc::testing::ErrnoSetterMatcher::Fails;
- ASSERT_THAT(__llvm_libc::unlink("testdata/non-existent-file"), Fails(ENOENT));
+ using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails;
+ ASSERT_THAT(LIBC_NAMESPACE::unlink("testdata/non-existent-file"),
+ Fails(ENOENT));
}
diff --git a/libc/test/src/unistd/unlinkat_test.cpp b/libc/test/src/unistd/unlinkat_test.cpp
index ecb9d3a771392a2..5953085bf12b66c 100644
--- a/libc/test/src/unistd/unlinkat_test.cpp
+++ b/libc/test/src/unistd/unlinkat_test.cpp
@@ -15,29 +15,29 @@
#include "test/UnitTest/Test.h"
TEST(LlvmLibcUnlinkatTest, CreateAndDeleteTest) {
- using __llvm_libc::testing::ErrnoSetterMatcher::Succeeds;
+ using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds;
constexpr const char *TEST_DIR = "testdata";
constexpr const char *TEST_FILE = "openat.test";
- int dir_fd = __llvm_libc::open(TEST_DIR, O_DIRECTORY);
+ int dir_fd = LIBC_NAMESPACE::open(TEST_DIR, O_DIRECTORY);
ASSERT_EQ(libc_errno, 0);
ASSERT_GT(dir_fd, 0);
int write_fd =
- __llvm_libc::openat(dir_fd, TEST_FILE, O_WRONLY | O_CREAT, S_IRWXU);
+ LIBC_NAMESPACE::openat(dir_fd, TEST_FILE, O_WRONLY | O_CREAT, S_IRWXU);
ASSERT_EQ(libc_errno, 0);
ASSERT_GT(write_fd, 0);
- ASSERT_THAT(__llvm_libc::close(write_fd), Succeeds(0));
- ASSERT_THAT(__llvm_libc::unlinkat(dir_fd, TEST_FILE, 0), Succeeds(0));
- ASSERT_THAT(__llvm_libc::close(dir_fd), Succeeds(0));
+ ASSERT_THAT(LIBC_NAMESPACE::close(write_fd), Succeeds(0));
+ ASSERT_THAT(LIBC_NAMESPACE::unlinkat(dir_fd, TEST_FILE, 0), Succeeds(0));
+ ASSERT_THAT(LIBC_NAMESPACE::close(dir_fd), Succeeds(0));
}
TEST(LlvmLibcUnlinkatTest, UnlinkatNonExistentFile) {
constexpr const char *TEST_DIR = "testdata";
- int dir_fd = __llvm_libc::open(TEST_DIR, O_DIRECTORY);
+ int dir_fd = LIBC_NAMESPACE::open(TEST_DIR, O_DIRECTORY);
ASSERT_EQ(libc_errno, 0);
ASSERT_GT(dir_fd, 0);
- using __llvm_libc::testing::ErrnoSetterMatcher::Fails;
- using __llvm_libc::testing::ErrnoSetterMatcher::Succeeds;
- ASSERT_THAT(__llvm_libc::unlinkat(dir_fd, "non-existent-file", 0),
+ using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails;
+ using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds;
+ ASSERT_THAT(LIBC_NAMESPACE::unlinkat(dir_fd, "non-existent-file", 0),
Fails(ENOENT));
- ASSERT_THAT(__llvm_libc::close(dir_fd), Succeeds(0));
+ ASSERT_THAT(LIBC_NAMESPACE::close(dir_fd), Succeeds(0));
}
diff --git a/libc/test/src/wchar/btowc_test.cpp b/libc/test/src/wchar/btowc_test.cpp
index cfac485cdecc773..b5fcb451bd07b03 100644
--- a/libc/test/src/wchar/btowc_test.cpp
+++ b/libc/test/src/wchar/btowc_test.cpp
@@ -17,8 +17,8 @@ TEST(LlvmLibcBtowc, DefaultLocale) {
// everything else returns WEOF.
for (int c = 0; c < 255; ++c) {
if (c < 128)
- EXPECT_EQ(__llvm_libc::btowc(c), static_cast<wint_t>(c));
+ EXPECT_EQ(LIBC_NAMESPACE::btowc(c), static_cast<wint_t>(c));
else
- EXPECT_EQ(__llvm_libc::btowc(c), WEOF);
+ EXPECT_EQ(LIBC_NAMESPACE::btowc(c), WEOF);
}
}
diff --git a/libc/test/src/wchar/wctob_test.cpp b/libc/test/src/wchar/wctob_test.cpp
index 7a8d6eea0c82a09..3f911884a7c12c6 100644
--- a/libc/test/src/wchar/wctob_test.cpp
+++ b/libc/test/src/wchar/wctob_test.cpp
@@ -17,8 +17,8 @@ TEST(LlvmLibcWctob, DefaultLocale) {
// itself and everything else returns EOF.
for (wint_t c = 0; c < 32767; ++c) {
if (c < 128)
- EXPECT_EQ(__llvm_libc::wctob(c), static_cast<int>(c));
+ EXPECT_EQ(LIBC_NAMESPACE::wctob(c), static_cast<int>(c));
else
- EXPECT_EQ(__llvm_libc::wctob(c), EOF);
+ EXPECT_EQ(LIBC_NAMESPACE::wctob(c), EOF);
}
}
diff --git a/libc/test/utils/FPUtil/x86_long_double_test.cpp b/libc/test/utils/FPUtil/x86_long_double_test.cpp
index e116482c500a248..6ca9b16377c0b80 100644
--- a/libc/test/utils/FPUtil/x86_long_double_test.cpp
+++ b/libc/test/utils/FPUtil/x86_long_double_test.cpp
@@ -11,7 +11,7 @@
#include <math.h>
-using FPBits = __llvm_libc::fputil::FPBits<long double>;
+using FPBits = LIBC_NAMESPACE::fputil::FPBits<long double>;
TEST(LlvmLibcX86LongDoubleTest, is_nan) {
// In the nan checks below, we use the macro isnan from math.h to ensure that
diff --git a/libc/test/utils/UnitTest/testfilter_test.cpp b/libc/test/utils/UnitTest/testfilter_test.cpp
index 8a62f7d767101ab..567b5e2bde85530 100644
--- a/libc/test/utils/UnitTest/testfilter_test.cpp
+++ b/libc/test/utils/UnitTest/testfilter_test.cpp
@@ -17,22 +17,22 @@ TEST(LlvmLibcTestFilterTest, IncorrectFilter) {}
TEST(LlvmLibcTestFilterTest, NoFilter) {}
TEST(LlvmLibcTestFilterTest, CheckCorrectFilter) {
- ASSERT_EQ(
- __llvm_libc::testing::Test::runTests("LlvmLibcTestFilterTest.NoFilter"),
- 0);
- ASSERT_EQ(__llvm_libc::testing::Test::runTests(
+ ASSERT_EQ(LIBC_NAMESPACE::testing::Test::runTests(
+ "LlvmLibcTestFilterTest.NoFilter"),
+ 0);
+ ASSERT_EQ(LIBC_NAMESPACE::testing::Test::runTests(
"LlvmLibcTestFilterTest.IncorrFilter"),
1);
- ASSERT_EQ(__llvm_libc::testing::Test::runTests(
+ ASSERT_EQ(LIBC_NAMESPACE::testing::Test::runTests(
"LlvmLibcTestFilterTest.CorrectFilter"),
0);
- ASSERT_EQ(__llvm_libc::testing::Test::runTests(
+ ASSERT_EQ(LIBC_NAMESPACE::testing::Test::runTests(
"LlvmLibcTestFilterTest.CorrectFilter2"),
0);
}
int main() {
- __llvm_libc::testing::Test::runTests(
+ LIBC_NAMESPACE::testing::Test::runTests(
"LlvmLibcTestFilterTest.CheckCorrectFilter");
return 0;
}
diff --git a/libc/utils/HdrGen/PrototypeTestGen/PrototypeTestGen.cpp b/libc/utils/HdrGen/PrototypeTestGen/PrototypeTestGen.cpp
index 86f0220a510ad0a..551b97caf81fd69 100644
--- a/libc/utils/HdrGen/PrototypeTestGen/PrototypeTestGen.cpp
+++ b/libc/utils/HdrGen/PrototypeTestGen/PrototypeTestGen.cpp
@@ -77,7 +77,8 @@ bool TestGeneratorMain(llvm::raw_ostream &OS, llvm::RecordKeeper &records) {
if (llvm::StringRef(returnType).contains("_Noreturn"))
returnType = "void";
- OS << " static_assert(__llvm_libc::cpp::is_same_v<" << returnType << '(';
+ OS << " static_assert(LIBC_NAMESPACE::cpp::is_same_v<" << returnType
+ << '(';
auto args = functionSpec->getValueAsListOfDefs("Args");
for (size_t i = 0, size = args.size(); i < size; ++i) {
llvm::Record *argType = args[i]->getValueAsDef("ArgType");
diff --git a/libc/utils/MPFRWrapper/MPFRUtils.cpp b/libc/utils/MPFRWrapper/MPFRUtils.cpp
index e9f13fe4d0ad402..e23a3c2034cb283 100644
--- a/libc/utils/MPFRWrapper/MPFRUtils.cpp
+++ b/libc/utils/MPFRWrapper/MPFRUtils.cpp
@@ -23,9 +23,9 @@
#include "mpfr_inc.h"
-template <typename T> using FPBits = __llvm_libc::fputil::FPBits<T>;
+template <typename T> using FPBits = LIBC_NAMESPACE::fputil::FPBits<T>;
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
namespace testing {
namespace mpfr {
@@ -51,7 +51,7 @@ template <> struct ExtraPrecision<long double> {
template <typename T>
static inline unsigned int get_precision(double ulp_tolerance) {
if (ulp_tolerance <= 0.5) {
- return __llvm_libc::fputil::FloatProperties<T>::MANTISSA_PRECISION;
+ return LIBC_NAMESPACE::fputil::FloatProperties<T>::MANTISSA_PRECISION;
} else {
return ExtraPrecision<T>::VALUE;
}
@@ -1011,4 +1011,4 @@ template long double round<long double>(long double, RoundingMode);
} // namespace mpfr
} // namespace testing
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
diff --git a/libc/utils/MPFRWrapper/MPFRUtils.h b/libc/utils/MPFRWrapper/MPFRUtils.h
index 0ba5ab6888bb79a..baac2d0e3a410eb 100644
--- a/libc/utils/MPFRWrapper/MPFRUtils.h
+++ b/libc/utils/MPFRWrapper/MPFRUtils.h
@@ -15,7 +15,7 @@
#include <stdint.h>
-namespace __llvm_libc {
+namespace LIBC_NAMESPACE {
namespace testing {
namespace mpfr {
@@ -87,12 +87,12 @@ enum class Operation : int {
EndTernaryOperationsSingleOutput,
};
-using __llvm_libc::fputil::testing::ForceRoundingMode;
-using __llvm_libc::fputil::testing::RoundingMode;
+using LIBC_NAMESPACE::fputil::testing::ForceRoundingMode;
+using LIBC_NAMESPACE::fputil::testing::RoundingMode;
template <typename T> struct BinaryInput {
static_assert(
- __llvm_libc::cpp::is_floating_point_v<T>,
+ LIBC_NAMESPACE::cpp::is_floating_point_v<T>,
"Template parameter of BinaryInput must be a floating point type.");
using Type = T;
@@ -101,7 +101,7 @@ template <typename T> struct BinaryInput {
template <typename T> struct TernaryInput {
static_assert(
- __llvm_libc::cpp::is_floating_point_v<T>,
+ LIBC_NAMESPACE::cpp::is_floating_point_v<T>,
"Template parameter of TernaryInput must be a floating point type.");
using Type = T;
@@ -316,7 +316,7 @@ template <typename T> bool round_to_long(T x, RoundingMode mode, long &result);
} // namespace mpfr
} // namespace testing
-} // namespace __llvm_libc
+} // namespace LIBC_NAMESPACE
// GET_MPFR_DUMMY_ARG is going to be added to the end of GET_MPFR_MACRO as a
// simple way to avoid the compiler warning `gnu-zero-variadic-macro-arguments`.
@@ -326,14 +326,15 @@ template <typename T> bool round_to_long(T x, RoundingMode mode, long &result);
#define EXPECT_MPFR_MATCH_DEFAULT(op, input, match_value, ulp_tolerance) \
EXPECT_THAT(match_value, \
- __llvm_libc::testing::mpfr::get_mpfr_matcher<op>( \
+ LIBC_NAMESPACE::testing::mpfr::get_mpfr_matcher<op>( \
input, match_value, ulp_tolerance, \
- __llvm_libc::testing::mpfr::RoundingMode::Nearest))
+ LIBC_NAMESPACE::testing::mpfr::RoundingMode::Nearest))
#define EXPECT_MPFR_MATCH_ROUNDING(op, input, match_value, ulp_tolerance, \
rounding) \
- EXPECT_THAT(match_value, __llvm_libc::testing::mpfr::get_mpfr_matcher<op>( \
- input, match_value, ulp_tolerance, rounding))
+ EXPECT_THAT(match_value, \
+ LIBC_NAMESPACE::testing::mpfr::get_mpfr_matcher<op>( \
+ input, match_value, ulp_tolerance, rounding))
#define EXPECT_MPFR_MATCH(...) \
GET_MPFR_MACRO(__VA_ARGS__, EXPECT_MPFR_MATCH_ROUNDING, \
@@ -342,8 +343,8 @@ template <typename T> bool round_to_long(T x, RoundingMode mode, long &result);
#define TEST_MPFR_MATCH_ROUNDING(op, input, match_value, ulp_tolerance, \
rounding) \
- __llvm_libc::testing::mpfr::get_mpfr_matcher<op>(input, match_value, \
- ulp_tolerance, rounding) \
+ LIBC_NAMESPACE::testing::mpfr::get_mpfr_matcher<op>(input, match_value, \
+ ulp_tolerance, rounding) \
.match(match_value)
#define TEST_MPFR_MATCH(...) \
@@ -353,7 +354,7 @@ template <typename T> bool round_to_long(T x, RoundingMode mode, long &result);
#define EXPECT_MPFR_MATCH_ALL_ROUNDING(op, input, match_value, ulp_tolerance) \
{ \
- namespace mpfr = __llvm_libc::testing::mpfr; \
+ namespace mpfr = LIBC_NAMESPACE::testing::mpfr; \
mpfr::ForceRoundingMode __r1(mpfr::RoundingMode::Nearest); \
if (__r1.success) \
EXPECT_MPFR_MATCH(op, input, match_value, ulp_tolerance, \
@@ -374,20 +375,21 @@ template <typename T> bool round_to_long(T x, RoundingMode mode, long &result);
#define TEST_MPFR_MATCH_ROUNDING_SILENTLY(op, input, match_value, \
ulp_tolerance, rounding) \
- __llvm_libc::testing::mpfr::get_silent_mpfr_matcher<op>( \
+ LIBC_NAMESPACE::testing::mpfr::get_silent_mpfr_matcher<op>( \
input, match_value, ulp_tolerance, rounding) \
.match(match_value)
#define ASSERT_MPFR_MATCH_DEFAULT(op, input, match_value, ulp_tolerance) \
ASSERT_THAT(match_value, \
- __llvm_libc::testing::mpfr::get_mpfr_matcher<op>( \
+ LIBC_NAMESPACE::testing::mpfr::get_mpfr_matcher<op>( \
input, match_value, ulp_tolerance, \
- __llvm_libc::testing::mpfr::RoundingMode::Nearest))
+ LIBC_NAMESPACE::testing::mpfr::RoundingMode::Nearest))
#define ASSERT_MPFR_MATCH_ROUNDING(op, input, match_value, ulp_tolerance, \
rounding) \
- ASSERT_THAT(match_value, __llvm_libc::testing::mpfr::get_mpfr_matcher<op>( \
- input, match_value, ulp_tolerance, rounding))
+ ASSERT_THAT(match_value, \
+ LIBC_NAMESPACE::testing::mpfr::get_mpfr_matcher<op>( \
+ input, match_value, ulp_tolerance, rounding))
#define ASSERT_MPFR_MATCH(...) \
GET_MPFR_MACRO(__VA_ARGS__, ASSERT_MPFR_MATCH_ROUNDING, \
@@ -396,7 +398,7 @@ template <typename T> bool round_to_long(T x, RoundingMode mode, long &result);
#define ASSERT_MPFR_MATCH_ALL_ROUNDING(op, input, match_value, ulp_tolerance) \
{ \
- namespace mpfr = __llvm_libc::testing::mpfr; \
+ namespace mpfr = LIBC_NAMESPACE::testing::mpfr; \
mpfr::ForceRoundingMode __r1(mpfr::RoundingMode::Nearest); \
if (__r1.success) \
ASSERT_MPFR_MATCH(op, input, match_value, ulp_tolerance, \
diff --git a/libc/utils/gpu/loader/amdgpu/Loader.cpp b/libc/utils/gpu/loader/amdgpu/Loader.cpp
index 9d732fe987da40a..21135bdec7421ea 100644
--- a/libc/utils/gpu/loader/amdgpu/Loader.cpp
+++ b/libc/utils/gpu/loader/amdgpu/Loader.cpp
@@ -434,7 +434,7 @@ int load(int argc, char **argv, char **envp, void *image, size_t size,
// If the clock_freq symbol is missing, no work to do.
hsa_executable_symbol_t freq_sym;
if (HSA_STATUS_SUCCESS ==
- hsa_executable_get_symbol_by_name(executable, "__llvm_libc_clock_freq",
+ hsa_executable_get_symbol_by_name(executable, "LIBC_NAMESPACE_clock_freq",
&dev_agent, &freq_sym)) {
void *host_clock_freq;
diff --git a/libc/utils/gpu/server/rpc_server.cpp b/libc/utils/gpu/server/rpc_server.cpp
index c98b9fa46ce058b..8e1970398c2215f 100644
--- a/libc/utils/gpu/server/rpc_server.cpp
+++ b/libc/utils/gpu/server/rpc_server.cpp
@@ -19,7 +19,7 @@
#include <variant>
#include <vector>
-using namespace __llvm_libc;
+using namespace LIBC_NAMESPACE;
static_assert(sizeof(rpc_buffer_t) == sizeof(rpc::Buffer),
"Buffer size mismatch");
diff --git a/libc/utils/gpu/server/rpc_server.h b/libc/utils/gpu/server/rpc_server.h
index f4f4f31265843b3..30e4c4a4b6f53e2 100644
--- a/libc/utils/gpu/server/rpc_server.h
+++ b/libc/utils/gpu/server/rpc_server.h
@@ -22,7 +22,7 @@ const uint64_t RPC_MAXIMUM_PORT_COUNT = 512;
/// The symbol name associated with the client for use with the LLVM C library
/// implementation.
-const char *const rpc_client_symbol_name = "__llvm_libc_rpc_client";
+const char *const rpc_client_symbol_name = "LIBC_NAMESPACE_rpc_client";
/// status codes.
typedef enum {
More information about the libc-commits
mailing list