diff --git a/.github/new-prs-labeler.yml b/.github/new-prs-labeler.yml index a45df493307eda..c377de146bc882 100644 --- a/.github/new-prs-labeler.yml +++ b/.github/new-prs-labeler.yml @@ -254,9 +254,6 @@ mlir:vector: mlir:execution-engine: - mlir/**/ExecutionEngine/** -mlir:affine: - - mlir/**/Affine/**/* - mlir:presburger: - mlir/**/*Presburger*/** diff --git a/compiler-rt/lib/scudo/standalone/combined.h b/compiler-rt/lib/scudo/standalone/combined.h index 29589cdd99fa78..e4d2e4dee893a4 100644 --- a/compiler-rt/lib/scudo/standalone/combined.h +++ b/compiler-rt/lib/scudo/standalone/combined.h @@ -1044,6 +1044,7 @@ class Allocator { atomic_u32 DeallocationTid; }; + MemMapT MemMap; atomic_uptr Pos; u32 Size; // An array of Size (at least one) elements of type Entry is immediately @@ -1492,12 +1493,15 @@ class Allocator { static_cast(getFlags()->allocation_ring_buffer_size); if (AllocationRingBufferSize < 1) return; - RawRingBuffer = static_cast( - map(/*Addr=*/nullptr, - roundUp(ringBufferSizeInBytes(AllocationRingBufferSize), - getPageSizeCached()), - "scudo:ring_buffer")); + MemMapT MemMap; + MemMap.map( + /*Addr=*/0U, + roundUp(ringBufferSizeInBytes(AllocationRingBufferSize), + getPageSizeCached()), + "scudo:ring_buffer"); + RawRingBuffer = reinterpret_cast(MemMap.getBase()); auto *RingBuffer = reinterpret_cast(RawRingBuffer); + RingBuffer->MemMap = MemMap; RingBuffer->Size = AllocationRingBufferSize; static_assert(sizeof(AllocationRingBuffer) % alignof(typename AllocationRingBuffer::Entry) == @@ -1506,7 +1510,11 @@ class Allocator { } void unmapRingBuffer() { - unmap(RawRingBuffer, roundUp(getRingBufferSize(), getPageSizeCached())); + auto *RingBuffer = getRingBuffer(); + if (RingBuffer != nullptr) { + MemMapT MemMap = RingBuffer->MemMap; + MemMap.unmap(MemMap.getBase(), MemMap.getCapacity()); + } RawRingBuffer = nullptr; } diff --git a/libc/benchmarks/CMakeLists.txt b/libc/benchmarks/CMakeLists.txt index 48f5f48ff83224..4978da65850ccb 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 95077cd6591530..c50ae00ffa105e 100644 --- a/libc/benchmarks/LibcDefaultImplementations.cpp +++ b/libc/benchmarks/LibcDefaultImplementations.cpp @@ -2,7 +2,7 @@ #include "llvm/ADT/ArrayRef.h" #include -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 getMemcpyConfigurations() { static constexpr MemcpyConfiguration kMemcpyConfigurations[] = { - {__llvm_libc::memcpy, "__llvm_libc::memcpy"}}; + {LIBC_NAMESPACE::memcpy, "LIBC_NAMESPACE::memcpy"}}; return llvm::ArrayRef(kMemcpyConfigurations); } llvm::ArrayRef getMemmoveConfigurations() { static constexpr MemmoveConfiguration kMemmoveConfigurations[] = { - {__llvm_libc::memmove, "__llvm_libc::memmove"}}; + {LIBC_NAMESPACE::memmove, "LIBC_NAMESPACE::memmove"}}; return llvm::ArrayRef(kMemmoveConfigurations); } llvm::ArrayRef getMemcmpConfigurations() { static constexpr MemcmpOrBcmpConfiguration kMemcmpConfiguration[] = { - {__llvm_libc::memcmp, "__llvm_libc::memcmp"}}; + {LIBC_NAMESPACE::memcmp, "LIBC_NAMESPACE::memcmp"}}; return llvm::ArrayRef(kMemcmpConfiguration); } llvm::ArrayRef getBcmpConfigurations() { static constexpr MemcmpOrBcmpConfiguration kBcmpConfigurations[] = { - {__llvm_libc::bcmp, "__llvm_libc::bcmp"}}; + {LIBC_NAMESPACE::bcmp, "LIBC_NAMESPACE::bcmp"}}; return llvm::ArrayRef(kBcmpConfigurations); } llvm::ArrayRef getMemsetConfigurations() { static constexpr MemsetConfiguration kMemsetConfigurations[] = { - {__llvm_libc::memset, "__llvm_libc::memset"}}; + {LIBC_NAMESPACE::memset, "LIBC_NAMESPACE::memset"}}; return llvm::ArrayRef(kMemsetConfigurations); } llvm::ArrayRef 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 f00bed4f693117..5ba8b936a0cafa 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 4fc6777cec45d0..acd7c30717597a 100644 --- a/libc/benchmarks/LibcMemoryBenchmarkMain.cpp +++ b/libc/benchmarks/LibcMemoryBenchmarkMain.cpp @@ -21,7 +21,7 @@ #include #include -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 f4060099bddd77..3837bd97d9f9a7 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>(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 getMemcpyConfigurations() { -// using namespace __llvm_libc; +// using namespace LIBC_NAMESPACE; // static constexpr MemcpyConfiguration kConfigurations[] = { // {Wrap, "memcpy_0xE00E29EE73994E2B"}, // {Wrap, "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 b0c5f3a05734de..5084b1d67dcd5e 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(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>(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>(lhs, rhs, size); @@ -95,7 +95,7 @@ static int memcmp_0x348D7BA6DB0EE033(const char * lhs, const char * rhs, size_t return three_way_compare::Then>>(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>(dst, value, size); @@ -108,7 +108,7 @@ static void memset_0x71E761699B999863(char * dst, int value, size_t size) { return splat_set::Then>>(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>(dst, value, size); @@ -121,7 +121,7 @@ static void memset_0x3DF0F44E2ED6A50F(char * dst, int value, size_t size) { return splat_set::Then>>(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::Then>>(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 getMemcpyConfigurations() { - using namespace __llvm_libc; + using namespace LIBC_NAMESPACE; static constexpr MemcpyConfiguration kConfigurations[] = { {Wrap, "memcpy_0xE00E29EE73994E2B"}, {Wrap, "memcpy_0x7381B60C7BE75EF9"}, @@ -178,7 +178,7 @@ int Wrap(const void *lhs, const void *rhs, size_t size) { reinterpret_cast(rhs), size); } llvm::ArrayRef getMemcmpConfigurations() { - using namespace __llvm_libc; + using namespace LIBC_NAMESPACE; static constexpr MemcmpOrBcmpConfiguration kConfigurations[] = { {Wrap, "memcmp_0x348D7BA6DB0EE033"}, }; @@ -194,7 +194,7 @@ template void *Wrap(void *dst, int value, size_t size) { return dst; } llvm::ArrayRef getMemsetConfigurations() { - using namespace __llvm_libc; + using namespace LIBC_NAMESPACE; static constexpr MemsetConfiguration kConfigurations[] = { {Wrap, "memset_0x71E761699B999863"}, {Wrap, "memset_0x3DF0F44E2ED6A50F"}, @@ -207,7 +207,7 @@ template void Wrap(void *dst, size_t size) { Foo(reinterpret_cast(dst), size); } llvm::ArrayRef getBzeroConfigurations() { - using namespace __llvm_libc; + using namespace LIBC_NAMESPACE; static constexpr BzeroConfiguration kConfigurations[] = { {Wrap, "bzero_0x475977492C218AD4"}, }; diff --git a/libc/config/linux/app.h b/libc/config/linux/app.h index 40a45078f6c8f3..5521991e3e1c36 100644 --- a/libc/config/linux/app.h +++ b/libc/config/linux/app.h @@ -13,7 +13,7 @@ #include -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 e635f84a5a1a46..18c011e67b4b91 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 4b03217b18c33f..a28f7b9d717d4d 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 0fdbb7c3c3d74d..389981a42f76c1 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 e690e5168d27b8..2b84ad3ab46213 100644 --- a/libc/fuzzing/math/Compare.h +++ b/libc/fuzzing/math/Compare.h @@ -13,10 +13,11 @@ #include "src/__support/FPUtil/FPBits.h" template -__llvm_libc::cpp::enable_if_t<__llvm_libc::cpp::is_floating_point_v, bool> +LIBC_NAMESPACE::cpp::enable_if_t, + bool> ValuesEqual(T x1, T x2) { - __llvm_libc::fputil::FPBits bits1(x1); - __llvm_libc::fputil::FPBits bits2(x2); + LIBC_NAMESPACE::fputil::FPBits bits1(x1); + LIBC_NAMESPACE::fputil::FPBits 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 -__llvm_libc::cpp::enable_if_t<__llvm_libc::cpp::is_integral_v, bool> +LIBC_NAMESPACE::cpp::enable_if_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 b934bc88587699..2a962249617673 100644 --- a/libc/fuzzing/math/RemQuoDiff.h +++ b/libc/fuzzing/math/RemQuoDiff.h @@ -44,8 +44,8 @@ void RemQuoDiff(RemQuoFunc func1, RemQuoFunc func2, const uint8_t *data, if ((q1 & 0x7) != (q2 & 0x7)) __builtin_trap(); - __llvm_libc::fputil::FPBits bits1(remainder1); - __llvm_libc::fputil::FPBits bits2(remainder2); + LIBC_NAMESPACE::fputil::FPBits bits1(remainder1); + LIBC_NAMESPACE::fputil::FPBits 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 f315b6a99e1e52..0e66377cfba90d 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(&__llvm_libc::ceilf, &::ceilf, data, size); - SingleInputSingleOutputDiff(&__llvm_libc::ceil, &::ceil, data, size); - SingleInputSingleOutputDiff(&__llvm_libc::ceill, &::ceill, data, - size); + SingleInputSingleOutputDiff(&LIBC_NAMESPACE::ceilf, &::ceilf, data, + size); + SingleInputSingleOutputDiff(&LIBC_NAMESPACE::ceil, &::ceil, data, + size); + SingleInputSingleOutputDiff(&LIBC_NAMESPACE::ceill, &::ceill, + data, size); - SingleInputSingleOutputDiff(&__llvm_libc::floorf, &::floorf, data, + SingleInputSingleOutputDiff(&LIBC_NAMESPACE::floorf, &::floorf, data, size); - SingleInputSingleOutputDiff(&__llvm_libc::floor, &::floor, data, + SingleInputSingleOutputDiff(&LIBC_NAMESPACE::floor, &::floor, data, size); - SingleInputSingleOutputDiff(&__llvm_libc::floorl, &::floorl, + SingleInputSingleOutputDiff(&LIBC_NAMESPACE::floorl, &::floorl, data, size); - SingleInputSingleOutputDiff(&__llvm_libc::roundf, &::roundf, data, + SingleInputSingleOutputDiff(&LIBC_NAMESPACE::roundf, &::roundf, data, size); - SingleInputSingleOutputDiff(&__llvm_libc::round, &::round, data, + SingleInputSingleOutputDiff(&LIBC_NAMESPACE::round, &::round, data, size); - SingleInputSingleOutputDiff(&__llvm_libc::roundl, &::roundl, + SingleInputSingleOutputDiff(&LIBC_NAMESPACE::roundl, &::roundl, data, size); - SingleInputSingleOutputDiff(&__llvm_libc::truncf, &::truncf, data, + SingleInputSingleOutputDiff(&LIBC_NAMESPACE::truncf, &::truncf, data, size); - SingleInputSingleOutputDiff(&__llvm_libc::trunc, &::trunc, data, + SingleInputSingleOutputDiff(&LIBC_NAMESPACE::trunc, &::trunc, data, size); - SingleInputSingleOutputDiff(&__llvm_libc::truncl, &::truncl, + SingleInputSingleOutputDiff(&LIBC_NAMESPACE::truncl, &::truncl, data, size); - SingleInputSingleOutputDiff(&__llvm_libc::logbf, &::logbf, data, size); - SingleInputSingleOutputDiff(&__llvm_libc::logb, &::logb, data, size); - SingleInputSingleOutputDiff(&__llvm_libc::logbl, &::logbl, data, - size); + SingleInputSingleOutputDiff(&LIBC_NAMESPACE::logbf, &::logbf, data, + size); + SingleInputSingleOutputDiff(&LIBC_NAMESPACE::logb, &::logb, data, + size); + SingleInputSingleOutputDiff(&LIBC_NAMESPACE::logbl, &::logbl, + data, size); - TwoInputSingleOutputDiff(&__llvm_libc::hypotf, &::hypotf, data, - size); + TwoInputSingleOutputDiff(&LIBC_NAMESPACE::hypotf, &::hypotf, + data, size); - TwoInputSingleOutputDiff(&__llvm_libc::remainderf, + TwoInputSingleOutputDiff(&LIBC_NAMESPACE::remainderf, &::remainderf, data, size); - TwoInputSingleOutputDiff(&__llvm_libc::remainder, + TwoInputSingleOutputDiff(&LIBC_NAMESPACE::remainder, &::remainder, data, size); - TwoInputSingleOutputDiff(&__llvm_libc::remainderl, - &::remainderl, data, size); + TwoInputSingleOutputDiff( + &LIBC_NAMESPACE::remainderl, &::remainderl, data, size); - TwoInputSingleOutputDiff(&__llvm_libc::fdimf, &::fdimf, data, + TwoInputSingleOutputDiff(&LIBC_NAMESPACE::fdimf, &::fdimf, data, size); - TwoInputSingleOutputDiff(&__llvm_libc::fdim, &::fdim, data, + TwoInputSingleOutputDiff(&LIBC_NAMESPACE::fdim, &::fdim, data, size); - TwoInputSingleOutputDiff(&__llvm_libc::fdiml, + TwoInputSingleOutputDiff(&LIBC_NAMESPACE::fdiml, &::fdiml, data, size); - SingleInputSingleOutputDiff(&__llvm_libc::sqrtf, &::sqrtf, data, size); - SingleInputSingleOutputDiff(&__llvm_libc::sqrt, &::sqrt, data, size); - SingleInputSingleOutputDiff(&__llvm_libc::sqrtl, &::sqrtl, data, - size); + SingleInputSingleOutputDiff(&LIBC_NAMESPACE::sqrtf, &::sqrtf, data, + size); + SingleInputSingleOutputDiff(&LIBC_NAMESPACE::sqrt, &::sqrt, data, + size); + SingleInputSingleOutputDiff(&LIBC_NAMESPACE::sqrtl, &::sqrtl, + data, size); - SingleInputSingleOutputWithSideEffectDiff(&__llvm_libc::frexpf, + SingleInputSingleOutputWithSideEffectDiff(&LIBC_NAMESPACE::frexpf, &::frexpf, data, size); - SingleInputSingleOutputWithSideEffectDiff(&__llvm_libc::frexp, + SingleInputSingleOutputWithSideEffectDiff(&LIBC_NAMESPACE::frexp, &::frexp, data, size); SingleInputSingleOutputWithSideEffectDiff( - &__llvm_libc::frexpl, &::frexpl, data, size); + &LIBC_NAMESPACE::frexpl, &::frexpl, data, size); - SingleInputSingleOutputWithSideEffectDiff(&__llvm_libc::modff, - &::modff, data, size); + SingleInputSingleOutputWithSideEffectDiff( + &LIBC_NAMESPACE::modff, &::modff, data, size); SingleInputSingleOutputWithSideEffectDiff( - &__llvm_libc::modf, &::modf, data, size); + &LIBC_NAMESPACE::modf, &::modf, data, size); SingleInputSingleOutputWithSideEffectDiff( - &__llvm_libc::modfl, &::modfl, data, size); + &LIBC_NAMESPACE::modfl, &::modfl, data, size); - TwoInputSingleOutputDiff(&__llvm_libc::ldexpf, &::ldexpf, data, + TwoInputSingleOutputDiff(&LIBC_NAMESPACE::ldexpf, &::ldexpf, data, size); - TwoInputSingleOutputDiff(&__llvm_libc::ldexp, &::ldexp, data, + TwoInputSingleOutputDiff(&LIBC_NAMESPACE::ldexp, &::ldexp, data, size); - TwoInputSingleOutputDiff(&__llvm_libc::ldexpl, &::ldexpl, + TwoInputSingleOutputDiff(&LIBC_NAMESPACE::ldexpl, &::ldexpl, data, size); - RemQuoDiff(&__llvm_libc::remquof, &::remquof, data, size); - RemQuoDiff(&__llvm_libc::remquo, &::remquo, data, size); - RemQuoDiff(&__llvm_libc::remquol, &::remquol, data, size); + RemQuoDiff(&LIBC_NAMESPACE::remquof, &::remquof, data, size); + RemQuoDiff(&LIBC_NAMESPACE::remquo, &::remquo, data, size); + RemQuoDiff(&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 f4a7891df2aabe..2e6d58995a31fa 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(&__llvm_libc::nextafterf, + TwoInputSingleOutputDiff(&LIBC_NAMESPACE::nextafterf, &::nextafterf, data, size); - TwoInputSingleOutputDiff(&__llvm_libc::nextafter, + TwoInputSingleOutputDiff(&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 7d8335b817085e..dd3902eebda617 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::UIntType raw_num = 0; + LIBC_NAMESPACE::fputil::FPBits::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(raw_num).get_val(); + num = LIBC_NAMESPACE::fputil::FPBits(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 86f8c1e0a55f81..e745850bd6c3a4 100644 --- a/libc/fuzzing/stdio/printf_parser_fuzz.cpp +++ b/libc/fuzzing/stdio/printf_parser_fuzz.cpp @@ -16,7 +16,7 @@ #include #include -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 b368129960d3b5..eeb96aef9abe52 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(&__llvm_libc::atof, &::atof, container, size); + StringParserOutputDiff(&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 dbbc8e96f92433..5d5053cff5c58c 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 5ef506a08e4c6a..f6cc8abedf4645 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 612be4271b2384..097e6193ee6ef0 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(&__llvm_libc::atoi, &::atoi, container, size); - StringParserOutputDiff(&__llvm_libc::atol, &::atol, container, size); - StringParserOutputDiff(&__llvm_libc::atoll, &::atoll, container, + StringParserOutputDiff(&LIBC_NAMESPACE::atoi, &::atoi, container, size); + StringParserOutputDiff(&LIBC_NAMESPACE::atol, &::atol, container, size); + StringParserOutputDiff(&LIBC_NAMESPACE::atoll, &::atoll, container, size); - StringToNumberOutputDiff(&__llvm_libc::strtol, &::strtol, container, + StringToNumberOutputDiff(&LIBC_NAMESPACE::strtol, &::strtol, container, size); - StringToNumberOutputDiff(&__llvm_libc::strtoll, &::strtoll, + StringToNumberOutputDiff(&LIBC_NAMESPACE::strtoll, &::strtoll, container, size); - StringToNumberOutputDiff(&__llvm_libc::strtoul, &::strtoul, + StringToNumberOutputDiff(&LIBC_NAMESPACE::strtoul, &::strtoul, container, size); - StringToNumberOutputDiff(&__llvm_libc::strtoull, + StringToNumberOutputDiff(&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 197bee01d3a3ae..3ffe5c261d09c0 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 c1b497dfb2065e..50587bf3778b5f 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 10e0c03bb18fbb..c15649aa07ecd8 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 5ccf85c7dc0fcd..34ee8914890751 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(container); const char *haystack = reinterpret_cast(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/src/__support/CPP/README.md b/libc/src/__support/CPP/README.md index 472a630110fd4e..b470c3f1dc343c 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 ` and not `#include `. -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 6ce56a9f356597..fef3c18dc50bc8 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 LIBC_INLINE constexpr const T &max(const T &a, const T &b) { @@ -26,6 +26,6 @@ template 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 1cdc8b7d7e79ba..12e57489998806 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 // For size_t. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace cpp { template 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 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 609aac31252e09..78dc8d2da3c191 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 4e4205db9128b3..456266626ae9b2 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 bae71d84314e6b..cfac749e0d84e3 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 // For size_t. -namespace __llvm_libc::cpp { +namespace LIBC_NAMESPACE::cpp { template 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 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 4c5c4a492ba425..1da51fd253fb55 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(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 c20d100f8cf82a..52174a054f8749 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 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 6c33b55db3700c..16283a264e6571 100644 --- a/libc/src/__support/CPP/functional.h +++ b/libc/src/__support/CPP/functional.h @@ -20,7 +20,7 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace cpp { /// A function type adapted from LLVM's function_ref. @@ -65,6 +65,6 @@ template class function { }; } // 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 4e76337a2445e0..e163f00c732091 100644 --- a/libc/src/__support/CPP/limits.h +++ b/libc/src/__support/CPP/limits.h @@ -11,7 +11,7 @@ #include -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 14ee0ab2bbc0d1..16353d57e3a6cb 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 b5e2ef7c8bc2f2..02e8395b871ba2 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 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 ebf637c5d26679..a8c1353581ba0e 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 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 2f60720e934500..cb794e081970dd 100644 --- a/libc/src/__support/CPP/string.h +++ b/libc/src/__support/CPP/string.h @@ -18,7 +18,7 @@ #include // size_t #include // 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 d494325def3bfa..d23aa261ca0614 100644 --- a/libc/src/__support/CPP/string_view.h +++ b/libc/src/__support/CPP/string_view.h @@ -13,7 +13,7 @@ #include -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 0a92ddae66c64a..c8eb59cf65cbb3 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 69d75018fcf2e9..2bca6267914d58 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(0)) { template using add_lvalue_reference_t = typename add_lvalue_reference::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 1ea55b7137feec..72a764bb8ba60c 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 auto try_add_pointer(...) -> cpp::type_identity; template struct add_pointer : decltype(detail::try_add_pointer(0)) {}; template using add_pointer_t = typename add_pointer::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 e2a135b3893d8f..76db6712e53645 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(0)) { template using add_rvalue_reference_t = typename add_rvalue_reference::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 0a633d41598df9..a86e926569fe67 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, "error message");` template 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 84a5c76fcde9b5..72eeaf29bc0940 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 using bool_constant = cpp::integral_constant; -} // 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 431ccb2a483fc5..4fa65a08e55526 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 @@ -20,6 +20,6 @@ struct conditional : type_identity {}; template using conditional_t = typename conditional::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 0961fd1c3689b4..a018286fddd8ab 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 decay { @@ -33,6 +33,6 @@ template class decay { }; template using decay_t = typename decay::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 1a83c2ca732f9e..cda9189b29eca7 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 struct enable_if; @@ -18,6 +18,6 @@ template struct enable_if : type_identity {}; template using enable_if_t = typename enable_if::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 98c6d1c8412ac7..97c041ccd1624a 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; -} // 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 958910ca9c5e6f..7b5b6c2150c71c 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 struct integral_constant { @@ -18,6 +18,6 @@ template 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 348abe92db4900..edf6a570c433e0 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(fun), cpp::forward(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 edcefd28e47e25..a6e522fbd1a0fb 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 struct invoke_result : cpp::type_identity using invoke_result_t = typename invoke_result::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 9317874b36abf0..53bb21203f593f 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 @@ -22,6 +22,6 @@ struct is_arithmetic : cpp::bool_constant<(cpp::is_integral_v || template LIBC_INLINE_VAR constexpr bool is_arithmetic_v = is_arithmetic::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 2d66ff11f707c7..14360b130b2b10 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 // For size_t -namespace __llvm_libc::cpp { +namespace LIBC_NAMESPACE::cpp { // is_array template struct is_array : false_type {}; @@ -23,6 +23,6 @@ template struct is_array : true_type {}; template LIBC_INLINE_VAR constexpr bool is_array_v = is_array::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 46435f2c7612c0..47fb56876cd7ff 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 LIBC_INLINE_VAR constexpr bool is_base_of_v = is_base_of::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 bf9c5469f0420a..83ebaea544c755 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 struct is_class : decltype(detail::test(nullptr)) {}; template LIBC_INLINE_VAR constexpr bool is_class_v = is_class::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 83e7b83f60f3d3..8e56a9afd22917 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 struct is_const : cpp::false_type {}; @@ -20,6 +20,6 @@ template struct is_const : cpp::true_type {}; template LIBC_INLINE_VAR constexpr bool is_const_v = is_const::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 cfc82ca7168028..d419443493f7d2 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 LIBC_INLINE_VAR constexpr bool is_convertible_v = is_convertible::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 2d69fa95a07da2..d47de1cc797b29 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 : public false_type {}; template LIBC_INLINE_VAR constexpr bool is_destructible_v = is_destructible::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 14cea71e0fe4f3..8d55a1ca8a9f7f 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 struct is_enum : bool_constant<__is_enum(T)> {}; template LIBC_INLINE_VAR constexpr bool is_enum_v = is_enum::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 ccb004d4cf1581..2df75a072c3606 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 struct is_floating_point { @@ -30,6 +30,6 @@ template LIBC_INLINE_VAR constexpr bool is_floating_point_v = is_floating_point::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 d8a9166ee99c4f..557b3224484bca 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 LIBC_INLINE_VAR constexpr bool is_function_v = is_function::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 511101c278a944..2808be594b20ed 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 struct is_integral { @@ -34,6 +34,6 @@ template struct is_integral { template LIBC_INLINE_VAR constexpr bool is_integral_v = is_integral::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 ca3b7d9fc2dd7a..f52e303afad2a5 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 LIBC_INLINE_VAR constexpr bool is_lvalue_reference_v = is_lvalue_reference::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 c885e773de84e0..f1f362f8dfd544 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 struct is_member_pointer_helper : cpp::false_type {}; @@ -25,6 +25,6 @@ template LIBC_INLINE_VAR constexpr bool is_member_pointer_v = is_member_pointer::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 bc661e32075abf..14452433862ae7 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> {}; template LIBC_INLINE_VAR constexpr bool is_null_pointer_v = is_null_pointer::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 a9dafee7b49a72..a23bebca572bec 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 @@ -25,6 +25,6 @@ struct is_object template LIBC_INLINE_VAR constexpr bool is_object_v = is_object::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 0903c586c806de..177f8e5b64e7ab 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 struct is_pointer : cpp::false_type {}; @@ -23,6 +23,6 @@ template struct is_pointer : cpp::true_type {}; template LIBC_INLINE_VAR constexpr bool is_pointer_v = is_pointer::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 ff3b26c769aa16..c017028edf411f 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 struct is_reference : public true_type {}; template LIBC_INLINE_VAR constexpr bool is_reference_v = is_reference::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 eb8412a1d82ea7..f0487e41c998fe 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 LIBC_INLINE_VAR constexpr bool is_rvalue_reference_v = is_rvalue_reference::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 bd1c7362b64cd7..eb73952f9f971f 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 struct is_same : cpp::false_type {}; @@ -20,6 +20,6 @@ template struct is_same : cpp::true_type {}; template LIBC_INLINE_VAR constexpr bool is_same_v = is_same::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 ed7e34e508d038..1f71cde36ca27a 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 @@ -27,6 +27,6 @@ struct is_scalar template LIBC_INLINE_VAR constexpr bool is_scalar_v = is_scalar::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 71151307129bf9..971fe692679f93 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 @@ -23,6 +23,6 @@ struct is_signed : bool_constant<(is_arithmetic_v && (T(-1) < T(0)))> { template LIBC_INLINE_VAR constexpr bool is_signed_v = is_signed::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 daa9c7add2c0a9..be97b2289cf0ab 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 struct is_trivially_constructible : integral_constant {}; -} // 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 9e7d05e2ecc74f..0c3fdcc711d57f 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 struct is_trivially_copyable : public integral_constant {}; -} // 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 ce32309b3bf7a8..3345149433afc4 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 LIBC_INLINE_VAR constexpr bool is_trivially_destructible_v = is_trivially_destructible::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 807d8f13c2b1c7..04e78a89fc0c10 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 struct is_union : bool_constant<__is_union(T)> {}; template LIBC_INLINE_VAR constexpr bool is_union_v = is_union::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 c4dc777441e29c..f089c2b61632f1 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 @@ -23,6 +23,6 @@ struct is_unsigned : bool_constant<(is_arithmetic_v && (T(-1) > T(0)))> { template LIBC_INLINE_VAR constexpr bool is_unsigned_v = is_unsigned::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 54cda12def095c..040dc831fd64e1 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 struct is_void : is_same> {}; template LIBC_INLINE_VAR constexpr bool is_void_v = is_void::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 0e8bff68ddb75d..21302850bfd4ab 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 struct make_signed; @@ -32,6 +32,6 @@ template <> struct make_signed<__uint128_t> : type_identity<__int128_t> {}; #endif template using make_signed_t = typename make_signed::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 75fc8188b870bf..20948014a66574 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 using make_unsigned_t = typename make_unsigned::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 da66043c58c126..bff6341d3e4560 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 // 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 using remove_all_extents_t = typename remove_all_extents::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 972e0fc2fdb01a..3cd7e5914119cc 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 struct remove_cv : cpp::type_identity {}; @@ -20,6 +20,6 @@ template struct remove_cv : cpp::type_identity {}; template using remove_cv_t = typename remove_cv::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 73831486d01161..6b410bb5841bc3 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 struct remove_cvref { @@ -19,6 +19,6 @@ template struct remove_cvref { }; template using remove_cvref_t = typename remove_cvref::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 72d8d984427fb2..3c0759dc1a522a 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 struct remove_extent : cpp::type_identity {}; @@ -20,6 +20,6 @@ template struct remove_extent : cpp::type_identity {}; template using remove_extent_t = typename remove_extent::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 34f0ae9ff3e3ba..02a0bd6373d3ab 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 struct remove_reference : cpp::type_identity {}; @@ -19,6 +19,6 @@ template struct remove_reference : cpp::type_identity {}; template using remove_reference_t = typename remove_reference::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 8551cef874f7ce..60ffc8acd9dad1 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; -} // 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 0804276a5424d8..f33a43ac7ea10b 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 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 03fe6b957e7122..babdaccfbc5370 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 struct make_void : cpp::type_identity {}; template using void_t = typename detail::make_void::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 2522baf0e1b150..0d00aa6d38199b 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 cpp::add_rvalue_reference_t declval() { @@ -19,6 +19,6 @@ template cpp::add_rvalue_reference_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 78ffb736ceb3de..891097ec96d545 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 @@ -27,6 +27,6 @@ LIBC_INLINE constexpr T &&forward(remove_reference_t &&value) { return static_cast(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 dfb7486c4eba0b..f15703fad63b3a 100644 --- a/libc/src/__support/CPP/utility/in_place.h +++ b/libc/src/__support/CPP/utility/in_place.h @@ -12,7 +12,7 @@ #include // size_t -namespace __llvm_libc::cpp { +namespace LIBC_NAMESPACE::cpp { // in_place struct in_place_t { @@ -31,6 +31,6 @@ template struct in_place_index_t { template LIBC_INLINE_VAR constexpr in_place_index_t 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 3d2e001e87799b..2ed26df3d238ee 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 struct integer_sequence { @@ -32,6 +32,6 @@ template using make_integer_sequence = typename detail::make_integer_sequence::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 bc0b63e3687c80..2b4cdf0c4a160b 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 constexpr cpp::remove_reference_t &&move(T &&t) { return static_cast &&>(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 67b8e666479f2d..2ec61517b0b808 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 , 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 f0b5ba98e43ab7..60252fe9cb877a 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 29ae4a37f8823f..8801760d887fc2 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 eb95bf0f2ee108..32e562ab1d5e48 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 LIBC_INLINE T fma(T x, T y, T z) { @@ -37,7 +37,7 @@ template 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 d7ab076130840f..226dd9b85515d6 100644 --- a/libc/src/__support/FPUtil/FPBits.h +++ b/libc/src/__support/FPUtil/FPBits.h @@ -19,7 +19,7 @@ #include "FloatProperties.h" #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace fputil { template struct MantissaWidth { @@ -233,7 +233,7 @@ template 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 3df961a9380e5e..c1d58a87101afc 100644 --- a/libc/src/__support/FPUtil/FloatProperties.h +++ b/libc/src/__support/FPUtil/FloatProperties.h @@ -15,7 +15,7 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace fputil { template struct FloatProperties {}; @@ -194,6 +194,6 @@ template using FloatTypeT = typename FloatType::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 5bf6db72bdc130..357d9a6e99c745 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 676dafa27c9631..6d62a2d0fcdf2b 100644 --- a/libc/src/__support/FPUtil/ManipulationFunctions.h +++ b/libc/src/__support/FPUtil/ManipulationFunctions.h @@ -22,7 +22,7 @@ #include #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace fputil { template , 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 9f151f24f3b8a9..8c4b24803bec1d 100644 --- a/libc/src/__support/FPUtil/NearestIntegerOperations.h +++ b/libc/src/__support/FPUtil/NearestIntegerOperations.h @@ -18,7 +18,7 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace fputil { template , 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 0b2eb628ee1960..afbf97cc2b6386 100644 --- a/libc/src/__support/FPUtil/NormalFloat.h +++ b/libc/src/__support/FPUtil/NormalFloat.h @@ -16,7 +16,7 @@ #include -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::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 12027289bde9e3..7a6384541a7474 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 @@ -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 b3f8f44badd332..fe334f8a33011d 100644 --- a/libc/src/__support/FPUtil/XFloat.h +++ b/libc/src/__support/FPUtil/XFloat.h @@ -12,7 +12,7 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace fputil { // Store and manipulate positive double precision numbers at |Precision| bits. @@ -177,4 +177,4 @@ template 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 4cc4920bb39c16..47c65af452809b 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 eaa3b2c11bb2a4..6254a0673ff427 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 @@ -45,6 +45,6 @@ LIBC_INLINE cpp::enable_if_t, 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 9243df1e360356..6a0ac5fef0cac5 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 2ee4e3363a11bf..ca0763078ff0d4 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 6edf2a489064f4..bad7e316bf370c 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 x) { @@ -34,6 +34,6 @@ template <> LIBC_INLINE double sqrt(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 5e856075b1d76f..e2669d13bc2a7c 100644 --- a/libc/src/__support/FPUtil/arm/FEnvImpl.h +++ b/libc/src/__support/FPUtil/arm/FEnvImpl.h @@ -15,7 +15,7 @@ #include #include -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 fd44d5e95268f6..b9490b52f6b41e 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; +using DoubleDouble = LIBC_NAMESPACE::NumberPair; // 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(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 ec000d592b9fec..2ee97b4ac7f783 100644 --- a/libc/src/__support/FPUtil/dyadic_float.h +++ b/libc/src/__support/FPUtil/dyadic_float.h @@ -18,7 +18,7 @@ #include -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 struct DyadicFloat { - using MantissaType = __llvm_libc::cpp::UInt; + using MantissaType = LIBC_NAMESPACE::cpp::UInt; bool sign = false; int exponent = 0; @@ -306,6 +306,6 @@ constexpr DyadicFloat mul_pow_2(DyadicFloat 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 0229c961f05364..b51025096e36f6 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 46cd102d83f640..4dec85ac2cc862 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 LIBC_INLINE cpp::string str(fputil::FPBits 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 ee6659346de4e9..b90b134926bb64 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 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 10998443d854b9..48906e545a89ba 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 9b29e8480e80f2..61278aca949cd6 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 35ace1365c442c..7d446d3a5ffb13 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, 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 2b03273f29c408..685a90dba7c704 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 7990ec01c7e8a3..86bc8603149611 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 @@ -31,6 +31,6 @@ LIBC_INLINE cpp::enable_if_t, 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 6670a15eb3357a..82932da5417c8d 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 9ccaf55f25312f..bc98667c8a3b3a 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 05b62dd9580c72..4b2d0ea9e6990c 100644 --- a/libc/src/__support/FPUtil/riscv32/FEnvImpl.h +++ b/libc/src/__support/FPUtil/riscv32/FEnvImpl.h @@ -16,7 +16,7 @@ #include #include -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 2e3c3c76a8d9cf..db244fc0906c52 100644 --- a/libc/src/__support/FPUtil/riscv64/FEnvImpl.h +++ b/libc/src/__support/FPUtil/riscv64/FEnvImpl.h @@ -16,7 +16,7 @@ #include #include -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 88623a6e860198..770a2342c441e7 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 @@ -45,6 +45,6 @@ LIBC_INLINE cpp::enable_if_t, 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 12c9acdc1669c4..b34a099486bfc2 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 x) { @@ -34,6 +34,6 @@ template <> LIBC_INLINE double sqrt(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 a11b6b42750600..91a5b9c50e7c2b 100644 --- a/libc/src/__support/FPUtil/rounding_mode.h +++ b/libc/src/__support/FPUtil/rounding_mode.h @@ -13,7 +13,7 @@ #include -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 1f85382cc928d8..eafa7778786518 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 4380efab778c4d..b73b70e907790f 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 b54613a67f4389..91ef7f96ff4d3e 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 -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace fputil { template @@ -50,6 +50,6 @@ LIBC_INLINE cpp::enable_if_t, 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 43273ee8864aa0..085c19638122b5 100644 --- a/libc/src/__support/FPUtil/x86_64/LongDoubleBits.h +++ b/libc/src/__support/FPUtil/x86_64/LongDoubleBits.h @@ -22,7 +22,7 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace fputil { template 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 98e90e044509d3..52ef2568c1dce0 100644 --- a/libc/src/__support/FPUtil/x86_64/NextAfterLongDouble.h +++ b/libc/src/__support/FPUtil/x86_64/NextAfterLongDouble.h @@ -20,7 +20,7 @@ #include -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 81cf965feedf66..69fd776320799c 100644 --- a/libc/src/__support/FPUtil/x86_64/PolyEval.h +++ b/libc/src/__support/FPUtil/x86_64/PolyEval.h @@ -18,7 +18,7 @@ #include -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 a6203543336290..ee31aeefd8489a 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 -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 324f5907f9aca9..7edba5528d6a91 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 x) { @@ -47,6 +47,6 @@ template <> LIBC_INLINE long double sqrt(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 93b609dc7b755f..9ff639a777e234 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::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 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 baf57cb52c68c5..a2f50f88e0e8be 100644 --- a/libc/src/__support/File/dir.h +++ b/libc/src/__support/File/dir.h @@ -16,7 +16,7 @@ #include #include -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 f106d51f897ac4..58097d017a23f3 100644 --- a/libc/src/__support/File/file.cpp +++ b/libc/src/__support/File/file.cpp @@ -15,7 +15,7 @@ #include #include -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 9e65e2a8ecf630..2ea3843749ffe4 100644 --- a/libc/src/__support/File/file.h +++ b/libc/src/__support/File/file.h @@ -17,7 +17,7 @@ #include #include -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 b4871031c4d21b..cae545a9fb8e93 100644 --- a/libc/src/__support/File/linux/dir.cpp +++ b/libc/src/__support/File/linux/dir.cpp @@ -14,46 +14,46 @@ #include // For open flags #include // For syscall numbers -namespace __llvm_libc { +namespace LIBC_NAMESPACE { ErrorOr platform_opendir(const char *name) { int open_flags = O_RDONLY | O_DIRECTORY | O_CLOEXEC; #ifdef SYS_open - int fd = __llvm_libc::syscall_impl(SYS_open, name, open_flags); + int fd = LIBC_NAMESPACE::syscall_impl(SYS_open, name, open_flags); #elif defined(SYS_openat) int fd = - __llvm_libc::syscall_impl(SYS_openat, AT_FDCWD, name, open_flags); + LIBC_NAMESPACE::syscall_impl(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 platform_fetch_dirents(int fd, cpp::span buffer) { #ifdef SYS_getdents64 - long size = __llvm_libc::syscall_impl(SYS_getdents64, fd, buffer.data(), - buffer.size()); + long size = LIBC_NAMESPACE::syscall_impl(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(-size)); + return LIBC_NAMESPACE::Error(static_cast(-size)); } return size; } int platform_closedir(int fd) { - int ret = __llvm_libc::syscall_impl(SYS_close, fd); + int ret = LIBC_NAMESPACE::syscall_impl(SYS_close, fd); if (ret < 0) { return static_cast(-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 2d4481bc4b5637..2d4cea5b53c581 100644 --- a/libc/src/__support/File/linux/file.cpp +++ b/libc/src/__support/File/linux/file.cpp @@ -19,11 +19,12 @@ #include #include // 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(f); - int ret = __llvm_libc::syscall_impl(SYS_write, lf->get_fd(), data, size); + int ret = + LIBC_NAMESPACE::syscall_impl(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(f); - int ret = __llvm_libc::syscall_impl(SYS_read, lf->get_fd(), buf, size); + int ret = + LIBC_NAMESPACE::syscall_impl(SYS_read, lf->get_fd(), buf, size); if (ret < 0) { return {0, -ret}; } @@ -49,7 +51,7 @@ ErrorOr linux_file_seek(File *f, long offset, int whence) { int linux_file_close(File *f) { auto *lf = reinterpret_cast(f); - int ret = __llvm_libc::syscall_impl(SYS_close, lf->get_fd()); + int ret = LIBC_NAMESPACE::syscall_impl(SYS_close, lf->get_fd()); if (ret < 0) { return -ret; } @@ -90,10 +92,10 @@ ErrorOr openfile(const char *path, const char *mode) { #ifdef SYS_open int fd = - __llvm_libc::syscall_impl(SYS_open, path, open_flags, OPEN_MODE); + LIBC_NAMESPACE::syscall_impl(SYS_open, path, open_flags, OPEN_MODE); #elif defined(SYS_openat) - int fd = __llvm_libc::syscall_impl(SYS_openat, AT_FDCWD, path, - open_flags, OPEN_MODE); + int fd = LIBC_NAMESPACE::syscall_impl(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 85a941b5d71e26..24e71b133c4813 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 859faf479e4865..d1632b703d3bc3 100644 --- a/libc/src/__support/File/linux/lseekImpl.h +++ b/libc/src/__support/File/linux/lseekImpl.h @@ -18,13 +18,13 @@ #include // For syscall numbers. #include // For off_t. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace internal { LIBC_INLINE ErrorOr lseekimpl(int fd, off_t offset, int whence) { off_t result; #ifdef SYS_lseek - int ret = __llvm_libc::syscall_impl(SYS_lseek, fd, offset, whence); + int ret = LIBC_NAMESPACE::syscall_impl(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 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 ret = LIBC_NAMESPACE::syscall_impl( 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 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 a2ab37a51bd292..65d7865720ffe1 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 -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(&__llvm_libc::StdErr); +FILE *stderr = reinterpret_cast(&LIBC_NAMESPACE::StdErr); } diff --git a/libc/src/__support/File/linux/stdin.cpp b/libc/src/__support/File/linux/stdin.cpp index e40081cd2a1ed5..c9a363bb7c65ae 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 -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(&__llvm_libc::StdIn); +FILE *stdin = reinterpret_cast(&LIBC_NAMESPACE::StdIn); } // extern "C" diff --git a/libc/src/__support/File/linux/stdout.cpp b/libc/src/__support/File/linux/stdout.cpp index cfb6aa4105baaf..314692ecbfe1e4 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 -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(&__llvm_libc::StdOut); +FILE *stdout = reinterpret_cast(&LIBC_NAMESPACE::StdOut); } // extern "C" diff --git a/libc/src/__support/GPU/amdgpu/utils.h b/libc/src/__support/GPU/amdgpu/utils.h index f64ed796dc1779..9f0ff0c717a6c9 100644 --- a/libc/src/__support/GPU/amdgpu/utils.h +++ b/libc/src/__support/GPU/amdgpu/utils.h @@ -14,7 +14,7 @@ #include -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 af347580cca99f..b701db482bbe98 100644 --- a/libc/src/__support/GPU/generic/utils.h +++ b/libc/src/__support/GPU/generic/utils.h @@ -13,7 +13,7 @@ #include -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 375af6ef10acc9..1519f36850a63c 100644 --- a/libc/src/__support/GPU/nvptx/utils.h +++ b/libc/src/__support/GPU/nvptx/utils.h @@ -13,7 +13,7 @@ #include -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 d598996e0aa251..6505b18dbd331e 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 807ede0e6f9825..ce10c2a7a30793 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 d29c539048a40e..9bbc8e1ded0000 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(msg.data()), msg.size()); + LIBC_NAMESPACE::syscall_impl(4 /*SYS_write*/, 2 /* stderr */, + reinterpret_cast(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 51b82d945372c7..71647f50def5e2 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(1 /* SYS_exit */, status); + LIBC_NAMESPACE::syscall_impl(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 b051745a1e3719..93b492e14ddfce 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 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(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 fc794b85931629..9a5e00beaa316c 100644 --- a/libc/src/__support/OSUtil/fuchsia/io.h +++ b/libc/src/__support/OSUtil/fuchsia/io.h @@ -17,12 +17,12 @@ #include -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 09b54526ab95df..fec4d9f7b35d27 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(); @@ -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 be5daaec55c6bb..d6c89cf45e3a55 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 a316e2731a01f0..1a03be0ace6728 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 c4d67e56f32bb2..b51385defbc0de 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 1d0ed9acedea02..f6c9a741de3ac1 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 351a1c05aae190..af100747832750 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 b20be451137867..fd5d2e1b898b24 100644 --- a/libc/src/__support/OSUtil/linux/io.h +++ b/libc/src/__support/OSUtil/linux/io.h @@ -14,13 +14,13 @@ #include // For syscall numbers. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LIBC_INLINE void write_to_stderr(cpp::string_view msg) { - __llvm_libc::syscall_impl(SYS_write, 2 /* stderr */, msg.data(), - msg.size()); + LIBC_NAMESPACE::syscall_impl(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 2e2d86d634d064..c461d5f8b8fcb6 100644 --- a/libc/src/__support/OSUtil/linux/quick_exit.h +++ b/libc/src/__support/OSUtil/linux/quick_exit.h @@ -15,15 +15,15 @@ #include // For syscall numbers. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LIBC_INLINE void quick_exit(int status) { for (;;) { - __llvm_libc::syscall_impl(SYS_exit_group, status); - __llvm_libc::syscall_impl(SYS_exit, status); + LIBC_NAMESPACE::syscall_impl(SYS_exit_group, status); + LIBC_NAMESPACE::syscall_impl(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 e307bcb8f1dbd6..53ee21d5cbdf10 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 8a1fbb34189b8f..6c9559bb12ee4e 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 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(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 bf2d2cd7351dd0..986db9372ad394 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 6ebc0c3951c551..189da8671461c8 100644 --- a/libc/src/__support/RPC/rpc.h +++ b/libc/src/__support/RPC/rpc.h @@ -28,7 +28,7 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace rpc { /// A fixed size channel used to communicate between the RPC client and server. @@ -586,6 +586,6 @@ LIBC_INLINE typename Server::Port Server::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 b25ff56410d7f5..e223caf2a16a8e 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 3b36c4fffc9e84..571d7cce2a8039 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 999fd902adf622..46ca841c49199b 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 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 692f8845558270..3ea60a6740b30a 100644 --- a/libc/src/__support/StringUtil/error_to_string.cpp +++ b/libc/src/__support/StringUtil/error_to_string.cpp @@ -18,7 +18,7 @@ #include -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 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 7981aa9b9a96ec..43cf785c30b036 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 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 a190037462f119..c93a57c6256784 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 -namespace __llvm_libc { +namespace LIBC_NAMESPACE { struct MsgMapping { int num; @@ -98,6 +98,6 @@ constexpr MsgTable operator+(const MsgTable &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 78b4d4dd853682..1fea53a32aa218 100644 --- a/libc/src/__support/StringUtil/signal_to_string.cpp +++ b/libc/src/__support/StringUtil/signal_to_string.cpp @@ -19,7 +19,7 @@ #include #include -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 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 11ec33a0a07c64..e27324e970c066 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 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 5440c8e3715401..4964fa47efd531 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 // 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 fd17881d4f780c..633d0e2ed53827 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 // 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 3139a1f1c5b38a..a9ae2e8100a1b3 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 b08517426445ad..1daaa9cc62852e 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 fa164db91ceed0..1cfd9e2e944d46 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 a6d59e5de45f1d..7fcf91bfee8525 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 59ed279c47810a..3ade7aaab4f0de 100644 --- a/libc/src/__support/StringUtil/tables/posix_errors.h +++ b/libc/src/__support/StringUtil/tables/posix_errors.h @@ -13,7 +13,7 @@ #include // 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 beaa18bff87f36..2fba2d963f4b9b 100644 --- a/libc/src/__support/StringUtil/tables/posix_signals.h +++ b/libc/src/__support/StringUtil/tables/posix_signals.h @@ -14,7 +14,7 @@ #include // 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 87b5abf5e09773..5035c54770c5c7 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 054c4ffdc7adde..f0fc78710b18a6 100644 --- a/libc/src/__support/StringUtil/tables/stdc_errors.h +++ b/libc/src/__support/StringUtil/tables/stdc_errors.h @@ -13,7 +13,7 @@ #include // 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 0bc288db3c449a..773f182140ef93 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 6310c8925c40d0..9aeb239b8328be 100644 --- a/libc/src/__support/UInt.h +++ b/libc/src/__support/UInt.h @@ -21,7 +21,7 @@ #include // For size_t #include -namespace __llvm_libc::cpp { +namespace LIBC_NAMESPACE::cpp { template struct BigInt { @@ -927,6 +927,6 @@ struct make_signed> : type_identity> { "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 2df4e5263bc163..2f688f1f31cb56 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 e4154154924166..9de17651142f49 100644 --- a/libc/src/__support/arg_list.h +++ b/libc/src/__support/arg_list.h @@ -14,7 +14,7 @@ #include #include -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 cdef80b1675b86..d78e4be5fa9ca4 100644 --- a/libc/src/__support/blockstore.h +++ b/libc/src/__support/blockstore.h @@ -15,7 +15,7 @@ #include #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace cpp { // The difference between BlockStore a traditional vector types is that, @@ -204,6 +204,6 @@ template using ReverseOrderBlockStore = BlockStore; } // 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 1da9cee4ad9f19..bd307a3544cd93 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 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 580a685849a6dc..9049311a577893 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 49609fd6a2b4a0..ed55c48cc94cc9 100644 --- a/libc/src/__support/char_vector.h +++ b/libc/src/__support/char_vector.h @@ -14,7 +14,7 @@ #include #include // 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 2b253fd567c19d..fe7b7c8b7624c9 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 61a5fe65431944..5fa4777ffd65fc 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 5335f0dba41643..f9628484bbe609 100644 --- a/libc/src/__support/detailed_powers_of_ten.h +++ b/libc/src/__support/detailed_powers_of_ten.h @@ -13,7 +13,7 @@ #include -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 43ddbb68506666..cd083aad09c3ca 100644 --- a/libc/src/__support/endian.h +++ b/libc/src/__support/endian.h @@ -13,7 +13,7 @@ #include -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 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 33bb942d9d0d0f..34c652dd878c28 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 using ErrorOr = cpp::expected; @@ -34,6 +34,6 @@ using Error = cpp::unexpected; // 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 5dfda1e629623e..fff905d8c6c418 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 class FixedVector { static void destroy(FixedVector *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 d430594060424b..05189e993babbc 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; @@ -756,6 +756,6 @@ FloatToString::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 9ee7c1fb8653fb..bf33658982c362 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 -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 396ebc7cbb9db1..6253afed06b757 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 static constexpr cpp::enable_if_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 2c11d834a8f34e..29f71246125944 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 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 9a734da3e117b3..7b62cb0d9f5059 100644 --- a/libc/src/__support/integer_utils.h +++ b/libc/src/__support/integer_utils.h @@ -17,7 +17,7 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { template NumberPair full_mul(T a, T b); @@ -60,6 +60,6 @@ LIBC_INLINE NumberPair full_mul(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 4190cfe04a759e..61f075435b552d 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 1d221ff6aff45a..ae97efcaa41706 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 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 3f23394ee4cc20..5e553d817994b4 100644 --- a/libc/src/__support/number_pair.h +++ b/libc/src/__support/number_pair.h @@ -14,7 +14,7 @@ #include -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 58bdee2c573b50..db50090ec4e129 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 struct ExpandedFloat { @@ -1247,6 +1247,6 @@ LIBC_INLINE StrToNumResult 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 f9608928430a8c..4ee336ec9e2bbd 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 -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 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 ea96f950cfb99a..9ba704c690655e 100644 --- a/libc/src/__support/str_to_num_result.h +++ b/libc/src/__support/str_to_num_result.h @@ -11,7 +11,7 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { template struct StrToNumResult { T value; @@ -28,6 +28,6 @@ template 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 12e5c82a89d485..b3d6813f7dda9e 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 7ac4c485b1f07a..54fda676f281ed 100644 --- a/libc/src/__support/threads/fork_callbacks.cpp +++ b/libc/src/__support/threads/fork_callbacks.cpp @@ -12,7 +12,7 @@ #include // 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 5e77c35f6b5a84..57a4f8228c5fbd 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 5a5dc73e2515aa..7a23604b5b986a 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 1e43037d3fe2f3..de1e1008784f60 100644 --- a/libc/src/__support/threads/linux/callonce.cpp +++ b/libc/src/__support/threads/linux/callonce.cpp @@ -16,7 +16,7 @@ #include #include // 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(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 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( + LIBC_NAMESPACE::syscall_impl( 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 4585aacf4623a5..67159b81b56132 100644 --- a/libc/src/__support/threads/linux/futex_word.h +++ b/libc/src/__support/threads/linux/futex_word.h @@ -12,7 +12,7 @@ #include #include -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 9b22fbab7c4c3c..618698db0d25b3 100644 --- a/libc/src/__support/threads/linux/mutex.h +++ b/libc/src/__support/threads/linux/mutex.h @@ -18,7 +18,7 @@ #include #include // 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( + LIBC_NAMESPACE::syscall_impl( 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( + LIBC_NAMESPACE::syscall_impl( 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(FUTEX_SYSCALL_ID, &futex_word, - FUTEX_WAKE_PRIVATE, 1, 0, 0, 0); + LIBC_NAMESPACE::syscall_impl(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 88efaece182a37..05fa0433ed8646 100644 --- a/libc/src/__support/threads/linux/thread.cpp +++ b/libc/src/__support/threads/linux/thread.cpp @@ -30,7 +30,7 @@ #include // For PROT_* and MAP_* definitions. #include // 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 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 mmap_result = LIBC_NAMESPACE::syscall_impl( MMAP_SYSCALL_NUMBER, 0, // No special address size, prot, @@ -106,9 +106,9 @@ LIBC_INLINE ErrorOr 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(SYS_mprotect, mmap_result + guardsize, - stacksize, PROT_READ | PROT_WRITE); + long result = LIBC_NAMESPACE::syscall_impl( + 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(stack); stackaddr -= guardsize; stack = reinterpret_cast(stackaddr); - __llvm_libc::syscall_impl(SYS_munmap, stack, stacksize + guardsize); + LIBC_NAMESPACE::syscall_impl(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( + clone_result = LIBC_NAMESPACE::syscall_impl( 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( + clone_result = LIBC_NAMESPACE::syscall_impl( 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(FUTEX_SYSCALL_ID, &clear_tid->val, - FUTEX_WAIT, CLEAR_TID_VALUE, nullptr); + LIBC_NAMESPACE::syscall_impl(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(SYS_prctl, PR_SET_NAME, name.data()); + LIBC_NAMESPACE::syscall_impl(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(SYS_open, path_name_buffer, O_RDWR); + int fd = + LIBC_NAMESPACE::syscall_impl(SYS_open, path_name_buffer, O_RDWR); #else - int fd = __llvm_libc::syscall_impl(SYS_openat, AT_FDCWD, - path_name_buffer, O_RDWR); + int fd = LIBC_NAMESPACE::syscall_impl(SYS_openat, AT_FDCWD, + path_name_buffer, O_RDWR); #endif if (fd < 0) return -fd; - int retval = - __llvm_libc::syscall_impl(SYS_write, fd, name.data(), name.size()); - __llvm_libc::syscall_impl(SYS_close, fd); + int retval = LIBC_NAMESPACE::syscall_impl(SYS_write, fd, name.data(), + name.size()); + LIBC_NAMESPACE::syscall_impl(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(SYS_prctl, PR_GET_NAME, name_buffer); + LIBC_NAMESPACE::syscall_impl(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(SYS_open, path_name_buffer, O_RDONLY); + int fd = + LIBC_NAMESPACE::syscall_impl(SYS_open, path_name_buffer, O_RDONLY); #else - int fd = __llvm_libc::syscall_impl(SYS_openat, AT_FDCWD, - path_name_buffer, O_RDONLY); + int fd = LIBC_NAMESPACE::syscall_impl(SYS_openat, AT_FDCWD, + path_name_buffer, O_RDONLY); #endif if (fd < 0) return -fd; - int retval = - __llvm_libc::syscall_impl(SYS_read, fd, name_buffer, NAME_SIZE_MAX); - __llvm_libc::syscall_impl(SYS_close, fd); + int retval = LIBC_NAMESPACE::syscall_impl(SYS_read, fd, name_buffer, + NAME_SIZE_MAX); + LIBC_NAMESPACE::syscall_impl(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(SYS_set_tid_address, 0); + LIBC_NAMESPACE::syscall_impl(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(SYS_exit, 0); + LIBC_NAMESPACE::syscall_impl(SYS_exit, 0); __builtin_unreachable(); } if (style == ThreadStyle::POSIX) - __llvm_libc::syscall_impl(SYS_exit, retval.posix_retval); + LIBC_NAMESPACE::syscall_impl(SYS_exit, retval.posix_retval); else - __llvm_libc::syscall_impl(SYS_exit, retval.stdc_retval); + LIBC_NAMESPACE::syscall_impl(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 7b27514c748b94..fa2bd64b6b51cf 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 ec275eb2b1c4e6..ad8d0025eba698 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 bedaa7c6efaf17..62aa86b7aef708 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 6fbacef483d35d..3fc3aef462a5b6 100644 --- a/libc/src/__support/threads/thread.h +++ b/libc/src/__support/threads/thread.h @@ -21,7 +21,7 @@ #include // For size_t #include -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 d8de9fd806087b..2c8eef8a5c0b70 100644 --- a/libc/src/__support/wctype_utils.h +++ b/libc/src/__support/wctype_utils.h @@ -16,7 +16,7 @@ #define __need_wchar_t #include // needed for wint_t and wchar_t -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace internal { // ------------------------------------------------------ @@ -40,6 +40,6 @@ LIBC_INLINE cpp::optional 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 ba8db9d47ba350..6b9dee2a4bf66d 100644 --- a/libc/src/assert/__assert_fail.h +++ b/libc/src/assert/__assert_fail.h @@ -11,11 +11,11 @@ #include -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 c1f325d8593bce..0318a934acca49 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 10de66fed53fbc..4cf914bbe257f5 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 30c5f7fff602c1..b239088df69b01 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 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 ce3608fceae363..42ed8ea475f109 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(internal::isalnum(static_cast(c))); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/ctype/isalnum.h b/libc/src/ctype/isalnum.h index beb202a7529daf..71830c95cb2fff 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 37f80f90cd2c84..2b1bd0efc3b3ab 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(internal::isalpha(static_cast(c))); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/ctype/isalpha.h b/libc/src/ctype/isalpha.h index d5697a39e9aa56..b5b07eecd6798e 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 8357563c7f3cc6..8be3d7e205afe3 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((c & (~0x7f)) == 0); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/ctype/isascii.h b/libc/src/ctype/isascii.h index 7e31b3c6ca4dd1..5a734a21bd1e5f 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 438eff7f0a62d6..9ac9d36580c7b2 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(c == ' ' || c == '\t'); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/ctype/isblank.h b/libc/src/ctype/isblank.h index 0554322d082515..4cacdb3d2a8d72 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 b203e4e35f4e23..b52b86f1df2910 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(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 26f094053a28a0..e0cae0caa6b8d5 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 b478384916d1b5..d4d5d1f20f3fbd 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(internal::isdigit(static_cast(c))); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/ctype/isdigit.h b/libc/src/ctype/isdigit.h index 32a76235e0592b..a024cf464b52ad 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 6a1f55e85eea9c..e195f9fcbf48cf 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(internal::isgraph(static_cast(c))); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/ctype/isgraph.h b/libc/src/ctype/isgraph.h index 421d0ffc4488b6..486c32d10a11a3 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 b21ccd491ebcf9..bd252e5e6efd17 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(internal::islower(static_cast(c))); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/ctype/islower.h b/libc/src/ctype/islower.h index 7643542fb7a990..dc59ce9cea4380 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 dd9a085e17cbce..bdf9d083b621b4 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((ch - ' ') < 95); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/ctype/isprint.h b/libc/src/ctype/isprint.h index 17ed56ef253400..22c835b7987c0e 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 7ccad4b0ecdc0d..d355c19c426c69 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(!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 23cc08a0bac9c8..7eaa83ac8ae5e9 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 8cd76c4ea6d2ab..8c09eda00bc433 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(internal::isspace(static_cast(c))); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/ctype/isspace.h b/libc/src/ctype/isspace.h index d919e9e7d972bd..56b70579fad943 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 dcb4cf1b4db535..b527e3ee53279b 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(internal::isupper(static_cast(c))); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/ctype/isupper.h b/libc/src/ctype/isupper.h index 7a1f2270943a94..8f5ce849f7961b 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 96efc8f1d93007..79152c95986c3d 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(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 a332ecc1018ff7..4966c320341e03 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 19a97ae91791f0..06bf91b1719068 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 c3f48a38d84c91..246580e23d5f64 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 2c4b851a615e0f..4e8b96dca078f0 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 97e675c5582520..8213da9319af18 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 b216cc277b8c21..7b0db354410359 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 a21b0cf79d9557..b5d8890b2090da 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 2863106b4ce89e..22c27c4c0f0611 100644 --- a/libc/src/dirent/closedir.cpp +++ b/libc/src/dirent/closedir.cpp @@ -14,10 +14,10 @@ #include -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(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 c5ee7ae59f1edd..6d6b898cfe1a98 100644 --- a/libc/src/dirent/closedir.h +++ b/libc/src/dirent/closedir.h @@ -11,10 +11,10 @@ #include -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 214c5c5852033d..27995f6ef3c64d 100644 --- a/libc/src/dirent/dirfd.cpp +++ b/libc/src/dirent/dirfd.cpp @@ -13,11 +13,11 @@ #include -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(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 8590e3e159d364..34acb01dd61181 100644 --- a/libc/src/dirent/dirfd.h +++ b/libc/src/dirent/dirfd.h @@ -11,10 +11,10 @@ #include -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 06749e82c75f10..56f7bc8b574f0f 100644 --- a/libc/src/dirent/opendir.cpp +++ b/libc/src/dirent/opendir.cpp @@ -14,7 +14,7 @@ #include -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.value()); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/dirent/opendir.h b/libc/src/dirent/opendir.h index e183587999a9cf..635cb9083d068b 100644 --- a/libc/src/dirent/opendir.h +++ b/libc/src/dirent/opendir.h @@ -11,10 +11,10 @@ #include -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 a9f9491d47e594..448935e3a4ab21 100644 --- a/libc/src/dirent/readdir.cpp +++ b/libc/src/dirent/readdir.cpp @@ -14,10 +14,10 @@ #include -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(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 b78150bf648904..83c8c56e3f53b0 100644 --- a/libc/src/dirent/readdir.h +++ b/libc/src/dirent/readdir.h @@ -11,10 +11,10 @@ #include -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 0489e11a1e8947..c8f0bffd0962e9 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 c81ea3129333ac..fbcd1c3395cd1f 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 0c1abda2870c79..fc91a3cc8f677a 100644 --- a/libc/src/fcntl/creat.h +++ b/libc/src/fcntl/creat.h @@ -11,10 +11,10 @@ #include -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 0b449bb8e0616c..0710fab23fe1b8 100644 --- a/libc/src/fcntl/linux/creat.cpp +++ b/libc/src/fcntl/linux/creat.cpp @@ -15,14 +15,14 @@ #include #include // 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 fd = LIBC_NAMESPACE::syscall_impl( SYS_open, path, O_CREAT | O_WRONLY | O_TRUNC, mode_flags); #else - int fd = __llvm_libc::syscall_impl( + int fd = LIBC_NAMESPACE::syscall_impl( 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 9558a2b030b9e5..7394069a7e7369 100644 --- a/libc/src/fcntl/linux/open.cpp +++ b/libc/src/fcntl/linux/open.cpp @@ -16,7 +16,7 @@ #include #include // 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(SYS_open, path, flags, mode_flags); + int fd = LIBC_NAMESPACE::syscall_impl(SYS_open, path, flags, mode_flags); #else - int fd = __llvm_libc::syscall_impl(SYS_openat, AT_FDCWD, path, flags, - mode_flags); + int fd = LIBC_NAMESPACE::syscall_impl(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 c6a47bfa2b4756..a2f7413ff87bf8 100644 --- a/libc/src/fcntl/linux/openat.cpp +++ b/libc/src/fcntl/linux/openat.cpp @@ -16,7 +16,7 @@ #include #include // 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(SYS_openat, dfd, path, flags, mode_flags); + int fd = LIBC_NAMESPACE::syscall_impl(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 49cfb50126594b..30950dd828ae3e 100644 --- a/libc/src/fcntl/open.h +++ b/libc/src/fcntl/open.h @@ -11,10 +11,10 @@ #include -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 96a96de1404963..5ea5d7f0b65ac3 100644 --- a/libc/src/fcntl/openat.h +++ b/libc/src/fcntl/openat.h @@ -11,10 +11,10 @@ #include -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 2bdea887e1df62..5eb1b0438b9af1 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 fa771cee32a180..e7df86d0e20d81 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 855d7077f7d99f..c715627c395b90 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 44a545edb7a922..977fd83262c1e5 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 0b63a7fc5d123d..cf45b7f1b5f735 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 58c1e0a9a4a461..a0771624799522 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 cc98031b1252e5..fbdb7d577b5a5e 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 e1001682a42bba..658316482984e1 100644 --- a/libc/src/fenv/fegetenv.h +++ b/libc/src/fenv/fegetenv.h @@ -11,10 +11,10 @@ #include -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 7cf1294fc6dfe7..edc4faff052827 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 ed6579f8f4671f..53ce64872eaf0a 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 15c2468a1eb26b..71b87ce7315d1a 100644 --- a/libc/src/fenv/fegetexceptflag.cpp +++ b/libc/src/fenv/fegetexceptflag.cpp @@ -12,7 +12,7 @@ #include -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 20913cb7a22f84..ad72161e536f83 100644 --- a/libc/src/fenv/fegetexceptflag.h +++ b/libc/src/fenv/fegetexceptflag.h @@ -11,10 +11,10 @@ #include -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 c01ea2c0ec417a..edf6eac0a5b03a 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 1bc79cbf5a6c40..40be879a66d05d 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 fe0f10245b8754..3c73b1f4217798 100644 --- a/libc/src/fenv/feholdexcept.cpp +++ b/libc/src/fenv/feholdexcept.cpp @@ -12,7 +12,7 @@ #include -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 cfb86b54ff49e9..bbefc4ecbd41b2 100644 --- a/libc/src/fenv/feholdexcept.h +++ b/libc/src/fenv/feholdexcept.h @@ -11,10 +11,10 @@ #include -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 4c2a467ccf653b..0bee7f5f5b9232 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 5c9eacf462d49f..a5ab3b93720ef4 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 628da315feda34..25ac78958cf930 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 316ecee41996e1..8b56bebc2e36d4 100644 --- a/libc/src/fenv/fesetenv.h +++ b/libc/src/fenv/fesetenv.h @@ -11,10 +11,10 @@ #include -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 3e134aba7fcf74..2fe7cb571a8ddd 100644 --- a/libc/src/fenv/fesetexceptflag.cpp +++ b/libc/src/fenv/fesetexceptflag.cpp @@ -12,7 +12,7 @@ #include -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 0e6497abafaed4..15e62eda1b840c 100644 --- a/libc/src/fenv/fesetexceptflag.h +++ b/libc/src/fenv/fesetexceptflag.h @@ -11,10 +11,10 @@ #include -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 4af8a77e6e9e43..22f2b9d1e087ef 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 148a5eabcf3d58..75023bdb691c47 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 c70301fd248e2e..c284a2c2a9528a 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 fb3e4045dd6b0a..dec1ac20cc08bf 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 5cecf0fae19e89..7e81b9476da91b 100644 --- a/libc/src/fenv/feupdateenv.cpp +++ b/libc/src/fenv/feupdateenv.cpp @@ -12,7 +12,7 @@ #include -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 1599c01ebddffa..294c041ddeae79 100644 --- a/libc/src/fenv/feupdateenv.h +++ b/libc/src/fenv/feupdateenv.h @@ -11,10 +11,10 @@ #include -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 b39bef65fc1a22..7b9b9f2adfd536 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 f8e2cdd31902a2..14393ab95dc13a 100644 --- a/libc/src/gpu/rpc_host_call.h +++ b/libc/src/gpu/rpc_host_call.h @@ -11,10 +11,10 @@ #include // 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/inttypes/imaxabs.cpp b/libc/src/inttypes/imaxabs.cpp index 6c29ea2354e46b..b390676f9dde28 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 0add10d38071cb..cd30011b9e57a7 100644 --- a/libc/src/inttypes/imaxabs.h +++ b/libc/src/inttypes/imaxabs.h @@ -11,10 +11,10 @@ #include -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 9ed6a1b46e5add..77f0cc58a897cb 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 c8af35272fcc23..749122782347c3 100644 --- a/libc/src/inttypes/imaxdiv.h +++ b/libc/src/inttypes/imaxdiv.h @@ -11,10 +11,10 @@ #include -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 5a2562380aa6a4..459877eeff472d 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 c2097e33616b43..b72547f3d22f62 100644 --- a/libc/src/inttypes/strtoimax.h +++ b/libc/src/inttypes/strtoimax.h @@ -11,11 +11,11 @@ #include -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 0e33c55ec3e2d8..4011a177b81fe1 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 e3ec13a53b89cc..d59e9932da519e 100644 --- a/libc/src/inttypes/strtoumax.h +++ b/libc/src/inttypes/strtoumax.h @@ -11,11 +11,11 @@ #include -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 73c3cc02839d0d..81cd95078efee4 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 2268989d131aa9..3cbcc1f0e90d81 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 8de1f67bd93c86..0e3d13a13a95c7 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 6bb99ebeff28b0..8942a9e7c576ed 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 6659060fbd700a..8972c16c571677 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 6044c8b75136b8..8b3a9cf50e601f 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 280d919bda9fb4..34ffd1702f5a63 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 a325ce3687f4af..fc2426f26df242 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 9604fbfa51aeb9..3221efa340a9dc 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 66df87874a05da..aac43b4ccca8dd 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 71821277ef7611..227f10b0a50729 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 ff4b32552c1e26..32a697cbfad097 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 9b264e84a3a2f9..bb4c5a8bd963ce 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 8e8b4ebf0bfdbd..589ffd022366ac 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 98188de20e4054..c424deec34ca80 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 e8e64565052a63..0fa3aa8bc048e6 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 8bf4c565c7d3b1..fbe6563d219232 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 edffe1b082fe04..004240f412bf16 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 5b7f1132252d67..503e7cbfeda6ed 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 4f48323c701417..8b8b37bd85d95b 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 aca1d6d1e2281e..aa97ccf66e6c77 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 1aaabe900ba884..158f3119108123 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 c7a911b79ac2dc..f0c8b6bced4546 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 558dc220a0380e..c470a8c943b505 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 9efe0620f5d7d9..6f08bf037c578e 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/.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 1f7dcb5352f74e..f6c56c7dddab61 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 6fed17185ccc21..6d60a3bc4802f4 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 5afc95db2ce9c3..081b419275a33c 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 7f0ef25efa48f5..4df5c461c1f56b 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 ee70722ca3858c..2feccf6128e76d 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 c1f72b1b80fa8d..13af54c02468f5 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 c61ce98e9ddcf5..38837cba41d535 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 2577e4a4929809..359cbeec72f6c3 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 424d2e01646b00..0aad5ea1f69f98 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 0ad97a027c6c87..ca2cc106a08b2c 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 fa25b1ab564d7d..b3df8bffed105e 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 f838c121e291cd..457cb470a4e2b0 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 50c586c49cc39c..01d5a530b8cca8 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 6de261fe861a0a..4b18d9a2590a4b 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 88a76ebf7d8058..2920c7a7ee45d6 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 029df3ac5c9fe5..52d6dd701fa9b9 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 224cc13ec6fa66..ef53b29e735882 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 fbc7f09ee2c746..7f0608ea4aaa69 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 48fbb65d66506f..29e5bdc3e23359 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 9f057983d28bb7..64baa4d261dba5 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 e37df5cf9565d4..1126323e2a4b24 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 41d80ba4aa52ca..a0673001fe0e6a 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 52334ee8e45605..bf011bb7c313cc 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 62dad57d852aad..b9c159a68b88e2 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 c19505c018283e..e111e26fc3f077 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 a79ff018ec641c..01b9aa7d2441e1 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 ab9c4aee611782..90d97e6cf1e052 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 9258243188360b..963ea7ba5fd072 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 ed303d2c76dd54..74eeac24bef8e5 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 9f75c82b9034ad..818266ed9f5fa5 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 ab13467b4a0a5f..2a9b2a6852fe9e 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(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 ce352764fbbc19..9438be1bee74eb 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; @@ -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 9b724d3296c84e..f40a08e752ed39 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(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 91ecf45667bfc7..6bde08d42a429c 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; @@ -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 5037806d37a1b1..f2e4f8bb93b6f9 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; @@ -61,4 +61,4 @@ LLVM_LIBC_FUNCTION(float, atanf, (float x)) { return static_cast(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 0a4512f7622da6..58e7f234b2c55b 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; @@ -57,4 +57,4 @@ LLVM_LIBC_FUNCTION(float, atanhf, (float x)) { return static_cast(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 372a0356e6a2a2..efd0f246a9b900 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 9a510483f7a4aa..d49b34242da4f8 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 b055d90761b2ff..7c3b680ce64428 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 78f9df9547ab44..737d2ab77121ad 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 8cb86b615e35a8..df9d7828bf1609 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 51e63f1019b82c..c5ad414bd64826 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 4773a25d12b4f9..077e1ce60ec18f 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 5622378755d7e4..b74393cee5d6a6 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 2e4ca3c4133ff3..67b60de03024fb 100644 --- a/libc/src/math/generic/cosf.cpp +++ b/libc/src/math/generic/cosf.cpp @@ -19,7 +19,7 @@ #include -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 67d2667711de94..62d77867f26f19 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; @@ -51,4 +51,4 @@ LLVM_LIBC_FUNCTION(float, coshf, (float x)) { return static_cast(exp_pm_eval(x)); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/math/generic/erff.cpp b/libc/src/math/generic/erff.cpp index a2cc8bf860fc95..a7b0897c3b58cb 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(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 c16b461c14ed87..110ab9666e52ae 100644 --- a/libc/src/math/generic/exp.cpp +++ b/libc/src/math/generic/exp.cpp @@ -25,7 +25,7 @@ #include -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(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 4a43259b3307d3..b152425b14b597 100644 --- a/libc/src/math/generic/exp10.cpp +++ b/libc/src/math/generic/exp10.cpp @@ -25,7 +25,7 @@ #include -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(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 b0e93dd6fbca4d..52190fb92405e7 100644 --- a/libc/src/math/generic/exp10f.cpp +++ b/libc/src/math/generic/exp10f.cpp @@ -20,7 +20,7 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(float, exp10f, (float x)) { using FPBits = typename fputil::FPBits; @@ -133,4 +133,4 @@ LLVM_LIBC_FUNCTION(float, exp10f, (float x)) { return static_cast(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 96710c7d537069..b4b9960ccb2fb6 100644 --- a/libc/src/math/generic/exp2.cpp +++ b/libc/src/math/generic/exp2.cpp @@ -25,7 +25,7 @@ #include -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(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 2a5776ad6ca712..fc91dfdfe95afa 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(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 9555dd61fb4388..afdaea347478d4 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 edbd60a2d56819..49d9a8192d344a 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 2cc8406c095aef..5a938a7a1c22e5 100644 --- a/libc/src/math/generic/expf.cpp +++ b/libc/src/math/generic/expf.cpp @@ -20,7 +20,7 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(float, expf, (float x)) { using FPBits = typename fputil::FPBits; @@ -105,4 +105,4 @@ LLVM_LIBC_FUNCTION(float, expf, (float x)) { return static_cast(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 3e12e8a0ce4bb5..87ee57850c4734 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 97b5854c581b2b..512785be2cb858 100644 --- a/libc/src/math/generic/explogxf.h +++ b/libc/src/math/generic/explogxf.h @@ -22,7 +22,7 @@ #include -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 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 811baec0e91038..edd0183c935e44 100644 --- a/libc/src/math/generic/expm1f.cpp +++ b/libc/src/math/generic/expm1f.cpp @@ -22,7 +22,7 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(float, expm1f, (float x)) { using FPBits = typename fputil::FPBits; @@ -160,4 +160,4 @@ LLVM_LIBC_FUNCTION(float, expm1f, (float x)) { return static_cast(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 13872ac6e3ae2f..0c0b7748b1f35f 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 da4c67e588890d..a57f6bf914eb26 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 9dd3665b5f5be5..6b912c92eca867 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 1fcd09be52e4db..22d99867b423dc 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 db36f50a8dfb5e..789a0c57eb1eee 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 97c46e542b05ac..c1091cc66b7a87 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 982464c4f88f3d..60386f0c9cf812 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 af66be776aff94..85666688685dc0 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 a56bc054e79409..280312797fe0ad 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 22aa20e78396e9..e27e5baeddf588 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 30074b8ca4a0bf..7512b82005d0f5 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 e96794ba17a957..7feeee9dcd9461 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 6ad319f5cb5b9f..32410926c89a01 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 2a95c983de9393..6c6250736f4f18 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 d06c8a649516e6..b9f313d5716358 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 658f1474919aa7..539fedbdd2fa25 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 2f10c8472d6af9..147f6c562c52c7 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 563a1644aa75d0..69e0c8dd99169c 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::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 dca476c183b0c4..7a29ff1f18d319 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::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 c31526b78d45f3..a183ba70cfc3e7 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 2185e479fd656e..4fdc869907ca09 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 4573065ad5b1ef..0be4e744b2d34b 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 9bd27559320c3f..a1914d0e823c83 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 ffc892ee566f4e..3fedeed4ed26b4 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; @@ -70,4 +70,4 @@ LLVM_LIBC_FUNCTION(float, hypotf, (float x, float y)) { return static_cast(static_cast(result)); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/math/generic/ilogb.cpp b/libc/src/math/generic/ilogb.cpp index 296e3027992b4d..4e5f7d9642b4aa 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 476fc3e4883c59..ca15879bc25fe5 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 b08ee91eeb3b97..4c18daab1a5358 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 d88fe6097a6f57..8013c0470affb1 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 53763d484b8537..c88ded20b5bf24 100644 --- a/libc/src/math/generic/inv_trigf_utils.h +++ b/libc/src/math/generic/inv_trigf_utils.h @@ -18,7 +18,7 @@ #include -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 775aa7be9404ea..18aae09036409f 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 24450cc0ce51a2..37f88ab2da00c3 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 df146cb51a23cc..8b29009fa1aa49 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 66097f88e5abc8..87755e83fececd 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(x); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/math/generic/llround.cpp b/libc/src/math/generic/llround.cpp index b3dfd2f8783e07..41bee8520ac2e1 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(x); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/math/generic/llroundf.cpp b/libc/src/math/generic/llroundf.cpp index 8784b0c0d69327..67105e8d1f6bc2 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(x); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/math/generic/llroundl.cpp b/libc/src/math/generic/llroundl.cpp index 30dec140e15598..98cfb3690659c8 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(x); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/math/generic/log.cpp b/libc/src/math/generic/log.cpp index 54fe9704f1cf12..46b64df689086d 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 b68ed5c6bc32eb..38789acc441e5b 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 812850aff1235f..bc9af75169b14b 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(r); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/math/generic/log1p.cpp b/libc/src/math/generic/log1p.cpp index 26e314c0a98f04..c6ee8d8f9bbfbb 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 a7ca54887d59af..d479130c5681aa 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(r); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/math/generic/log2.cpp b/libc/src/math/generic/log2.cpp index 7ba239b00e3f83..d72b0931c14b81 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 c48b8c99bc70be..cbb71fb91b1070 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(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 c4dd649cc57375..f04012c1d58376 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(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 eef428aba8aba4..8cd6edce05c23f 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 1b1241b2982dec..78aa33ebbf4a95 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 7f4dc08ed536e0..f18c3727a3168a 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 73634e009c74e9..1f689f25931d4e 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(r); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/math/generic/lrint.cpp b/libc/src/math/generic/lrint.cpp index 162fa03e419efb..59fde7b5018d32 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(x); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/math/generic/lrintf.cpp b/libc/src/math/generic/lrintf.cpp index 6444ecc2c34693..e92014c79bdc44 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(x); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/math/generic/lrintl.cpp b/libc/src/math/generic/lrintl.cpp index 3fcd97cc6d19ff..b363aacb39bb32 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 413c06ff736fa2..a22d8723bdbac2 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(x); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/math/generic/lroundf.cpp b/libc/src/math/generic/lroundf.cpp index 919ae35aa0065b..40c1323fafd623 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(x); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/math/generic/lroundl.cpp b/libc/src/math/generic/lroundl.cpp index 9ffa36e0c7a0b3..c0c3bde4e285ab 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(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 cc922f73fbb45a..14bbb2babc60a7 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::OVERFLOW_VALUE = 0x1p97f; constexpr float XFlowValues::UNDERFLOW_VALUE = 0x1p-95f; @@ -18,4 +18,4 @@ constexpr double XFlowValues::OVERFLOW_VALUE = 0x1p769; constexpr double XFlowValues::UNDERFLOW_VALUE = 0x1p-767; constexpr double XFlowValues::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 f286c9ce9faedd..38a14a47e88fa5 100644 --- a/libc/src/math/generic/math_utils.h +++ b/libc/src/math/generic/math_utils.h @@ -18,7 +18,7 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LIBC_INLINE uint32_t as_uint32_bits(float x) { return cpp::bit_cast(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 2c4f051234c14c..d465d194cc64c4 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 a979cffeb96901..daa6697cb62da4 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 535c31981f17a3..3271da2953dbdc 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 b1becee4dd094c..20cbf6c0e701aa 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 1b0c2cc0aa6293..5fb103388d262e 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 75eb49e5692b02..9cbff0169b9b18 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 3566cd6b451845..57a58b10be9116 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 07dabdcd0807fe..dd09fb7f900cf7 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 6e5c3698a24d13..e12ad040b5659d 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 f620bcda0948f8..551f2457ecb8e3 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 79c076d265c671..13a7360b423328 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 149f45874978d1..3703a32057751a 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 9de40b23dce4cd..5e8c5e9996b690 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 1360ae70137aae..def5d4b6fdb98a 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 905547cca0e1d6..bd88742e5a5c29 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 d4232db52b7ee1..b59606f6266fa4 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 3756a05a9ac036..7a08af36a47533 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 9427b6ffce4780..e3189ea48b5698 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 8c2e9c9ba700c5..259a46f3765372 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 493d825e0468ac..5110f238cb05ff 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 b7366f723236cf..ca8f19f35f7fe3 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 bcdd61ea304d6d..9627390ea8b8d8 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 6c59c271c5addb..c734225844079b 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 faccf6c378d618..3908f5892f144f 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 391da1f01cce24..4a4fa86dcfd895 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 9ef6f230f41011..681338ec01f078 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 1611567eef9779..7ed1c4381078b1 100644 --- a/libc/src/math/generic/sincosf.cpp +++ b/libc/src/math/generic/sincosf.cpp @@ -18,7 +18,7 @@ #include -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 2488f50720896c..904df4f4ed08e1 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 01d2f70e73568b..6fc1abb83e2e7b 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; @@ -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 3ebfe6ba07009e..4917b9980bc661 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; @@ -74,4 +74,4 @@ LLVM_LIBC_FUNCTION(float, sinhf, (float x)) { return static_cast(exp_pm_eval(x)); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/math/generic/sqrt.cpp b/libc/src/math/generic/sqrt.cpp index de21f329e15abb..b4d02785dcb43f 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 3ca8d381898bbc..bc74252295b3a5 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 970646a2e4d1a9..b2aaa279f9c2a1 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 681f16177fde51..7909e9e5d5568a 100644 --- a/libc/src/math/generic/tanf.cpp +++ b/libc/src/math/generic/tanf.cpp @@ -20,7 +20,7 @@ #include -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 1620e370402167..7d9f86cf9044b2 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((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 50220d9ebaf027..d171ab1f092fd5 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 dc11d5eebf27cd..93bfb7f2882a5e 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 df5fc03af7e893..3429129183100b 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 1e84f7acd6a31b..ad1407d61f620a 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 4979116d47f81b..c4fc58d9360385 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 b09c3e64cb5f14..6f804bdb90a1f0 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 fe3f451c47a590..4d7e132462ac90 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 d8b0a54867bf3f..c0d063d50ae53d 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 64d7058eaa485e..398ffd0c74c074 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 850c4ee6592ceb..eada89c178d75c 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 22c8b731068d9d..a5611c515a88d4 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 f3803af1ceb0be..41a6ddf60dbc35 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 48b52a84537e23..c948e32f77eb92 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 f3c255f61c09ee..a2c35371d12b6a 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 f540b4c8a11c15..67178b3e273575 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 d6e9859d7810ef..7303adcd347ee9 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 67b1862cdd4fd9..bbf0c677b5e3ae 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 2ae5142722671a..0654cdd2abe081 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 ad1db4906e3bc8..b689046468fbe5 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 b6b06da2dac0bb..07dbbd6059c35f 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 b89c9c3b1c7d44..ad35f9006b5122 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 35a4a8d5d7e988..9c7b600df7082e 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 e732b7c198f224..7fbe9f4f0e0bee 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 af06432d3b911b..89b235f9c22af3 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 b0f9c8f8841637..9fee6f856dc8b7 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 e21b469c4ee2b6..44d494a8ed57af 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 5e828372a50361..daf98d94360511 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 ab840ba605a283..9d8b5582f0407a 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 32d54b83746c12..8743e4eb7fb8d7 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 2946e4781ae6c7..054e046f2abd3b 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 729f3bb49d3fcc..ed69dffe3ea831 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 fe814c764b878c..60ca5af4987b6c 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 a712e455443471..e17f942a4d5fcf 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 81f04a2b857b62..d02b1063561246 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 32af444959a06f..da7bd54ab08ae3 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 c5872580988621..778e883acba044 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 dd97af97213328..be666fd9f8740c 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 b4708245d49597..773600f0f25011 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 352733d50a7099..534797a3e5860c 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 7ae0811a3c3b5f..ac629761a4398a 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 fa0dd58cde51de..a0384f89eed3a6 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 7755174e445b22..280ae49989f944 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 7219d5a7dfa6d7..b07c079682580a 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 *); double __ocml_remquo_f64(double, double, gpu::Private *); } -} // 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 6ec47c24a93a2d..480a46bf14dfd8 100644 --- a/libc/src/math/gpu/vendor/amdgpu/platform.h +++ b/libc/src/math/gpu/vendor/amdgpu/platform.h @@ -11,7 +11,7 @@ #include -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 9a9ffb23a7cbee..595a48f82744d5 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 7d1d7e8709e110..78e5543cf36656 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 7193d8cb2a3734..132c43d9e3af7c 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 b044a735f8777d..521c4133243d98 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 a3e2d65b8f98c4..37c7507911ec2e 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 3ce8fa6361d6eb..1bd42ba37e92d9 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 3dc5c2b10cbcad..3be05e58b51d96 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 c2933ecff94257..1b945bbd7c47e4 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 05b753583cd7da..844809355087b4 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 818c3801b9f11b..cb61557383dfa7 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 e243385e43fd8e..89c194e4bc291e 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 062e4a760c7c3a..c5497797dbe1b3 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 b06787cb0865c1..f30dafb46e5488 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 a675d484238c56..e30736206a9a92 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 4bd47fa2810232..5fc2c1409c6e93 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 c6d398007cad4b..e928d375e03db3 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 5bac6fc76f8ddf..45b629e3e28585 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 34ce290e37fd9a..533e9dcb8dbfb0 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 ea41099c35c0e0..1d075027b41c05 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 e15f4e198c8d7f..8dc2ff0a374af2 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 d9988fac0a45dc..f760a42563305b 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 bdd40a6a217c34..d00d39115ffc33 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 064d2775460edc..aafd1609002b2b 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 d1befb67c9788b..39cd3ad0c021a5 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 51b8370759e980..e53701bda75cf4 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 0131d278020029..ddb5ec00a036f5 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 9e8e57e8a26f37..f88e17f1090842 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 9780471e071c6b..7a39dc8fc814ea 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 8b6702834a04cf..003a9a8a5dfa55 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 6ea1743cf7a6f3..4298d56db6a027 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 7945bc096e6656..d49f2610a6919d 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 2fd2dcda6e465e..37e02d252b74fd 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 755efeaba530ba..e92c9b3c2a6e3b 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 c2be2cd87aad6c..b234885aa88c03 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 44aa286166cbf5..435533a90501b7 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 6d02f8617201ac..0a4844c8a433ef 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 4eda066b60f53c..96e07c99b71a33 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 589d65fdc61d26..d882157b0bc8d7 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 bf3593bef7e501..17892ceb107da5 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 4be642cbd0bc4e..af93227ab63bb9 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 c65cb5536f125a..be6b3ae2e2fa0b 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 4d1fcbb530a903..99c399b62b7f6d 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 16587dc26c0c0c..9a1bd9c89fcf0a 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 99b33639029303..a5266a8c154c5b 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 de38d158492393..57d764f1f2a0dd 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 a673a49de52864..1c9c2f3843a953 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 6c901ee8f4c0c2..981473f9e8d5b0 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 084fd7f3ef8143..1d290b421f1515 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 96672077865a9a..e851a6a4c4d558 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 1afb76a107c1cd..edea34618ac025 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 4d1cc1995341b8..1b4782f3445cad 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 74f9a600666faf..7a8bcc34bf5815 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 f30d60155f1fd9..c06b487171cd29 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 3ee9c045e17139..f2df0c86cad223 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 96bd7b8cc9e1c9..69c881ea844f9f 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 eecf380f5e94dc..023e84aa050920 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 94dfba7080aa99..4dbcc60589812d 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 5b2b7fc96df871..265b4fd92e0e8f 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 65faad1e07a614..2141ca91da46bb 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 f859485a730bd9..9cb4251f72fe55 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 eff98b42ff5b8b..67f5d7f89279b7 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 d86694136aff85..3d8249aaee2d66 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 d544ab5a55daad..ca3eadc8866b10 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 0f25ce6167545a..48eb9ca885265b 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 ea00377f8e2adc..854f76fce9f758 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 f55ffedd154075..49f05493cf166b 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 94d2c543c90866..04b7743edc0aab 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 b875dcd702babe..e24dd4320de659 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 46dcd3c91d628c..e8d50180562864 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 3630e52c92d298..bc32993a4bdc2a 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 195580190ba319..b69be468ab4552 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 62df79a1de2302..e40f860f1a35e4 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 af5159437532b2..93b2c8cd265dfe 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 812acecadafadf..c17901d220d189 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 8c555e816c8ba1..4a67cc9693ba7c 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 3d318a7a2faba3..9d4f4e82b78946 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 a8b5aff0fcf386..86673dc597fd30 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 1dc732f6e89aba..91453a01f02fc5 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 21457e0d2e81aa..85bf2aacbc17c2 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 ff89239c4bfde5..5ea2c6d98c0afb 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 957a06b9792144..df292a252583f3 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 3793f6bc1b881b..3860dc03bcf58f 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 7029e86a52114c..e22cae6386e690 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 1f6d24de5f2e0b..fc4c9eb182aa4c 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 8afac0e5f6a033..de7870df5d7669 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 912877867dc215..1b94e242c776e5 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 26fed175787a92..dd9b4a6556837c 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 ec2d67b8fd639b..6582dc335d6130 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 8a720fc23b6be7..f1f89542013d70 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 19a16d08a94d39..31a9bbe86b56c3 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 f2837635ab77c7..584af37f5f37c6 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 cb753fee6ea0d2..7590e7df5ddb8b 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 feb2e4f5e0dd55..8b8e8772706fdb 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 d1b0e20fcc8659..ba9b09929cc2f7 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 e4910ad95a81c2..3cd676bfb724e3 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 0091ba3a8cd006..d0246a32cdd30f 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 2bf095de76f88d..bddfa183f7ae70 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 bb09ea4a77c53a..3e6a3b34c9a46e 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 6bab35adf781a0..d6ca186ed16e1b 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 43fb63e231de45..0abe87a055061c 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 e24f29e4d466e9..9fc1dc4d93fbd2 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 f5316eed292619..6b5a5f9cab7f06 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 6839a75072cd60..876f147dde4f3c 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 f3919c46df603a..50ecdc74fb2d94 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 47ef983f4385ff..56539f52ce0e6c 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 e63db04c51b5df..aa0b753e74ae33 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 2784ca261e4aa1..bf1b1f1d815c17 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 843ecec9fbfc9d..65cb39f9e39264 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 2390e07b5dce57..d003e3f0964de2 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 d1d06f3adfa8e6..fe4192a5503868 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 5fbfa14507147a..e632c1925ddc2b 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 05366db52ff877..5d0121f158f11b 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 7a9fa01f4c2962..e0f06a8ba64cf4 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 5400c3d2328ebb..66561eef403dd8 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 ec5ba8001094d9..ff9d02efaffb72 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 f7fed01f30d25b..d766aff923dc9e 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 b4f1cd7ea72f62..e666d778154a3d 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 2a78ffaa3c5ef7..38f414f65fcc09 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 1d2480e3df147e..2cb8db4b7a859d 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 bda4acbe412238..2c7b8aa6e8c836 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 f25ff77095c88b..bc0e0fc7d1ffa3 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 983fcadd7dae30..862d5e3a0bc41d 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 eab56482150e4a..c7743dfad7ba38 100644 --- a/libc/src/network/htonl.h +++ b/libc/src/network/htonl.h @@ -11,10 +11,10 @@ #include -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 1d2c6bf2f8836e..e844454d5687f1 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 a3abaf6ec6df7f..e0a379f94e5267 100644 --- a/libc/src/network/htons.h +++ b/libc/src/network/htons.h @@ -11,10 +11,10 @@ #include -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 c525f722ec5b38..c00f4a5ae09c9d 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 bec626f5e4cec0..2fc4ef059c5878 100644 --- a/libc/src/network/ntohl.h +++ b/libc/src/network/ntohl.h @@ -11,10 +11,10 @@ #include -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 8556b3e28cdc35..572b6860fa6b9f 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 b10aaa9c8891b0..a84c52eeb9c2fa 100644 --- a/libc/src/network/ntohs.h +++ b/libc/src/network/ntohs.h @@ -11,10 +11,10 @@ #include -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 7136bf35816cbf..57191b8534771f 100644 --- a/libc/src/pthread/pthread_atfork.cpp +++ b/libc/src/pthread/pthread_atfork.cpp @@ -14,7 +14,7 @@ #include #include // 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 bd8bc8a35ef035..8b89d6895647b1 100644 --- a/libc/src/pthread/pthread_atfork.h +++ b/libc/src/pthread/pthread_atfork.h @@ -11,11 +11,11 @@ #include -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 f51b056ad030d0..a5bde84256fc63 100644 --- a/libc/src/pthread/pthread_attr_destroy.cpp +++ b/libc/src/pthread/pthread_attr_destroy.cpp @@ -12,11 +12,11 @@ #include -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 5d01bc8d782d67..532a0f45f7cd59 100644 --- a/libc/src/pthread/pthread_attr_destroy.h +++ b/libc/src/pthread/pthread_attr_destroy.h @@ -11,10 +11,10 @@ #include -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 18f4637e1c8fec..4bff85d45c17cc 100644 --- a/libc/src/pthread/pthread_attr_getdetachstate.cpp +++ b/libc/src/pthread/pthread_attr_getdetachstate.cpp @@ -12,7 +12,7 @@ #include -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 fd5ee886daebde..57a47b73bd50be 100644 --- a/libc/src/pthread/pthread_attr_getdetachstate.h +++ b/libc/src/pthread/pthread_attr_getdetachstate.h @@ -11,10 +11,10 @@ #include -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 79d80feed713ee..8f28db8d9c96c3 100644 --- a/libc/src/pthread/pthread_attr_getguardsize.cpp +++ b/libc/src/pthread/pthread_attr_getguardsize.cpp @@ -12,7 +12,7 @@ #include -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 61072b9350fe9a..ef2e75828f9e2c 100644 --- a/libc/src/pthread/pthread_attr_getguardsize.h +++ b/libc/src/pthread/pthread_attr_getguardsize.h @@ -11,11 +11,11 @@ #include -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 564b8fde52f84c..8788fbc1ffdd33 100644 --- a/libc/src/pthread/pthread_attr_getstack.cpp +++ b/libc/src/pthread/pthread_attr_getstack.cpp @@ -14,17 +14,17 @@ #include -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 d0164738349b53..22ac24a89e4224 100644 --- a/libc/src/pthread/pthread_attr_getstack.h +++ b/libc/src/pthread/pthread_attr_getstack.h @@ -11,12 +11,12 @@ #include -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 2b33d6fc8a447e..ecc4787951dfa1 100644 --- a/libc/src/pthread/pthread_attr_getstacksize.cpp +++ b/libc/src/pthread/pthread_attr_getstacksize.cpp @@ -12,7 +12,7 @@ #include -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 cb27a5e1927ecb..3136f08ffb7116 100644 --- a/libc/src/pthread/pthread_attr_getstacksize.h +++ b/libc/src/pthread/pthread_attr_getstacksize.h @@ -11,11 +11,11 @@ #include -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 32e54efce34ab2..13d302c18f98a7 100644 --- a/libc/src/pthread/pthread_attr_init.cpp +++ b/libc/src/pthread/pthread_attr_init.cpp @@ -13,7 +13,7 @@ #include -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 609e65381db7d8..3a2ad3d2b8b811 100644 --- a/libc/src/pthread/pthread_attr_init.h +++ b/libc/src/pthread/pthread_attr_init.h @@ -11,10 +11,10 @@ #include -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 e136538e054fc3..029b4d514ef43d 100644 --- a/libc/src/pthread/pthread_attr_setdetachstate.cpp +++ b/libc/src/pthread/pthread_attr_setdetachstate.cpp @@ -13,7 +13,7 @@ #include #include -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 a8f586619f53e6..2b994d9e99d307 100644 --- a/libc/src/pthread/pthread_attr_setdetachstate.h +++ b/libc/src/pthread/pthread_attr_setdetachstate.h @@ -11,10 +11,10 @@ #include -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 dd2584a552920c..98855b20cb0fb3 100644 --- a/libc/src/pthread/pthread_attr_setguardsize.cpp +++ b/libc/src/pthread/pthread_attr_setguardsize.cpp @@ -14,7 +14,7 @@ #include // For EXEC_PAGESIZE. #include -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 d9e159874f262e..64d896af026668 100644 --- a/libc/src/pthread/pthread_attr_setguardsize.h +++ b/libc/src/pthread/pthread_attr_setguardsize.h @@ -11,10 +11,10 @@ #include -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 a16196acf23b07..dde4e3fd70ed23 100644 --- a/libc/src/pthread/pthread_attr_setstack.cpp +++ b/libc/src/pthread/pthread_attr_setstack.cpp @@ -16,7 +16,7 @@ #include #include -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 44ee2c9e35de16..fe2a7f4fbd061a 100644 --- a/libc/src/pthread/pthread_attr_setstack.h +++ b/libc/src/pthread/pthread_attr_setstack.h @@ -11,10 +11,10 @@ #include -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 b23a7ced09aa3f..642a888aba706d 100644 --- a/libc/src/pthread/pthread_attr_setstacksize.cpp +++ b/libc/src/pthread/pthread_attr_setstacksize.cpp @@ -13,7 +13,7 @@ #include #include -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 40ee5c07d44eac..f5940948949b83 100644 --- a/libc/src/pthread/pthread_attr_setstacksize.h +++ b/libc/src/pthread/pthread_attr_setstacksize.h @@ -11,10 +11,10 @@ #include -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 9eebb80001a895..8b406cd09326ad 100644 --- a/libc/src/pthread/pthread_create.cpp +++ b/libc/src/pthread/pthread_create.cpp @@ -22,9 +22,9 @@ #include #include // 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(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 6df6c9559ea944..75466e39df7e17 100644 --- a/libc/src/pthread/pthread_create.h +++ b/libc/src/pthread/pthread_create.h @@ -11,12 +11,12 @@ #include -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 009438e16c4c3d..e8b69b6576265c 100644 --- a/libc/src/pthread/pthread_detach.cpp +++ b/libc/src/pthread/pthread_detach.cpp @@ -13,9 +13,9 @@ #include // 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 5beab40b3061af..d54fdf854de391 100644 --- a/libc/src/pthread/pthread_detach.h +++ b/libc/src/pthread/pthread_detach.h @@ -11,10 +11,10 @@ #include -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 29460204ae1d91..f154e9ba9a4212 100644 --- a/libc/src/pthread/pthread_equal.cpp +++ b/libc/src/pthread/pthread_equal.cpp @@ -13,9 +13,9 @@ #include // 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 aa5dfed54a5e01..448fb8fc07d1d4 100644 --- a/libc/src/pthread/pthread_equal.h +++ b/libc/src/pthread/pthread_equal.h @@ -11,10 +11,10 @@ #include -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 1d1a7377f8326a..acba665d0fa4f8 100644 --- a/libc/src/pthread/pthread_exit.cpp +++ b/libc/src/pthread/pthread_exit.cpp @@ -13,13 +13,13 @@ #include // 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 40051d70e0e00c..6617dab84c69e6 100644 --- a/libc/src/pthread/pthread_exit.h +++ b/libc/src/pthread/pthread_exit.h @@ -11,10 +11,10 @@ #include -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 e1c3549974b6b6..3de8c2e92f7a04 100644 --- a/libc/src/pthread/pthread_getname_np.cpp +++ b/libc/src/pthread/pthread_getname_np.cpp @@ -16,17 +16,17 @@ #include #include -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(&th); cpp::span 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 da9c77150e0af3..a51573749ba877 100644 --- a/libc/src/pthread/pthread_getname_np.h +++ b/libc/src/pthread/pthread_getname_np.h @@ -12,10 +12,10 @@ #include #include -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 02545564a8cccf..3893b52efd6e9a 100644 --- a/libc/src/pthread/pthread_getspecific.cpp +++ b/libc/src/pthread/pthread_getspecific.cpp @@ -14,10 +14,10 @@ #include #include -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 c7da0137d54505..28439838bd65b2 100644 --- a/libc/src/pthread/pthread_getspecific.h +++ b/libc/src/pthread/pthread_getspecific.h @@ -12,10 +12,10 @@ #include #include -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 b888260247cd85..8d4c2dd46c474c 100644 --- a/libc/src/pthread/pthread_join.cpp +++ b/libc/src/pthread/pthread_join.cpp @@ -13,9 +13,9 @@ #include // 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 1200fba3b20d8e..506efaead40fff 100644 --- a/libc/src/pthread/pthread_join.h +++ b/libc/src/pthread/pthread_join.h @@ -11,10 +11,10 @@ #include -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 1dc8eecfa5a218..81c1f39954a5b2 100644 --- a/libc/src/pthread/pthread_key_create.cpp +++ b/libc/src/pthread/pthread_key_create.cpp @@ -14,15 +14,15 @@ #include #include -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 cd5916ab01fbec..f12c9088e7c86d 100644 --- a/libc/src/pthread/pthread_key_create.h +++ b/libc/src/pthread/pthread_key_create.h @@ -11,10 +11,10 @@ #include -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 d45424cf601357..18a4cc7e18665d 100644 --- a/libc/src/pthread/pthread_key_delete.cpp +++ b/libc/src/pthread/pthread_key_delete.cpp @@ -14,13 +14,13 @@ #include #include -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 3ec528dde71970..5b7e40bb373a6e 100644 --- a/libc/src/pthread/pthread_key_delete.h +++ b/libc/src/pthread/pthread_key_delete.h @@ -11,10 +11,10 @@ #include -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 acb344bbea52f3..65f4b7901f4f19 100644 --- a/libc/src/pthread/pthread_mutex_destroy.cpp +++ b/libc/src/pthread/pthread_mutex_destroy.cpp @@ -13,7 +13,7 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, pthread_mutex_destroy, (pthread_mutex_t * mutex)) { auto *m = reinterpret_cast(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 b6461a0da9f39f..2df303eb2d6ca5 100644 --- a/libc/src/pthread/pthread_mutex_destroy.h +++ b/libc/src/pthread/pthread_mutex_destroy.h @@ -11,10 +11,10 @@ #include -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 5038ee08875939..f64d1fe68ad202 100644 --- a/libc/src/pthread/pthread_mutex_init.cpp +++ b/libc/src/pthread/pthread_mutex_init.cpp @@ -15,7 +15,7 @@ #include #include -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 678cac32d900d4..e6b5a0ac7eef96 100644 --- a/libc/src/pthread/pthread_mutex_init.h +++ b/libc/src/pthread/pthread_mutex_init.h @@ -11,11 +11,11 @@ #include -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 9daffafff942fe..efc6f75e43429a 100644 --- a/libc/src/pthread/pthread_mutex_lock.cpp +++ b/libc/src/pthread/pthread_mutex_lock.cpp @@ -13,7 +13,7 @@ #include -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 bb47e598096982..c5a835e4fc8706 100644 --- a/libc/src/pthread/pthread_mutex_lock.h +++ b/libc/src/pthread/pthread_mutex_lock.h @@ -11,10 +11,10 @@ #include -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 3cc8c7cdac09b9..b0819bd5fcd894 100644 --- a/libc/src/pthread/pthread_mutex_unlock.cpp +++ b/libc/src/pthread/pthread_mutex_unlock.cpp @@ -13,7 +13,7 @@ #include -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 4653841244eb79..303ec001d23787 100644 --- a/libc/src/pthread/pthread_mutex_unlock.h +++ b/libc/src/pthread/pthread_mutex_unlock.h @@ -11,10 +11,10 @@ #include -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 b65c672d34ce41..8b435854416a78 100644 --- a/libc/src/pthread/pthread_mutexattr.h +++ b/libc/src/pthread/pthread_mutexattr.h @@ -13,7 +13,7 @@ #include -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 cedfbe31c2ba59..9722d2b551cd72 100644 --- a/libc/src/pthread/pthread_mutexattr_destroy.cpp +++ b/libc/src/pthread/pthread_mutexattr_destroy.cpp @@ -13,10 +13,10 @@ #include -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 2d7a5ed24e75be..32a8b949fad8e1 100644 --- a/libc/src/pthread/pthread_mutexattr_destroy.h +++ b/libc/src/pthread/pthread_mutexattr_destroy.h @@ -11,10 +11,10 @@ #include -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 636bc1ae05edf2..a89af08464e2f1 100644 --- a/libc/src/pthread/pthread_mutexattr_getpshared.cpp +++ b/libc/src/pthread/pthread_mutexattr_getpshared.cpp @@ -13,7 +13,7 @@ #include -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 12c60ea00b6852..843fa36583d67d 100644 --- a/libc/src/pthread/pthread_mutexattr_getpshared.h +++ b/libc/src/pthread/pthread_mutexattr_getpshared.h @@ -11,11 +11,11 @@ #include -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 e3677ee415bf13..9c54b075dd9444 100644 --- a/libc/src/pthread/pthread_mutexattr_getrobust.cpp +++ b/libc/src/pthread/pthread_mutexattr_getrobust.cpp @@ -13,7 +13,7 @@ #include -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 762cde0317fb91..5ef2b929d70499 100644 --- a/libc/src/pthread/pthread_mutexattr_getrobust.h +++ b/libc/src/pthread/pthread_mutexattr_getrobust.h @@ -11,11 +11,11 @@ #include -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 6a17e889fcf244..c54396eff6fd85 100644 --- a/libc/src/pthread/pthread_mutexattr_gettype.cpp +++ b/libc/src/pthread/pthread_mutexattr_gettype.cpp @@ -13,7 +13,7 @@ #include -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 b0a7ea82e16124..b0e7c6e8e6a0c8 100644 --- a/libc/src/pthread/pthread_mutexattr_gettype.h +++ b/libc/src/pthread/pthread_mutexattr_gettype.h @@ -11,11 +11,11 @@ #include -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 818aea1d388c0f..439d198249a1ee 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 af6cf29d9be686..13de2e5925102c 100644 --- a/libc/src/pthread/pthread_mutexattr_init.h +++ b/libc/src/pthread/pthread_mutexattr_init.h @@ -11,10 +11,10 @@ #include -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 1554031865a49e..f654d337bac253 100644 --- a/libc/src/pthread/pthread_mutexattr_setpshared.cpp +++ b/libc/src/pthread/pthread_mutexattr_setpshared.cpp @@ -14,7 +14,7 @@ #include #include -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 21c7734e1fe1b5..0726b7792fedba 100644 --- a/libc/src/pthread/pthread_mutexattr_setpshared.h +++ b/libc/src/pthread/pthread_mutexattr_setpshared.h @@ -11,11 +11,11 @@ #include -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 b09e3971d44000..15fdac61e438df 100644 --- a/libc/src/pthread/pthread_mutexattr_setrobust.cpp +++ b/libc/src/pthread/pthread_mutexattr_setrobust.cpp @@ -14,7 +14,7 @@ #include #include -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 253a319e6e5083..8361a14e38f682 100644 --- a/libc/src/pthread/pthread_mutexattr_setrobust.h +++ b/libc/src/pthread/pthread_mutexattr_setrobust.h @@ -11,11 +11,11 @@ #include -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 e8134654e5e1b3..d5514a1cbf8322 100644 --- a/libc/src/pthread/pthread_mutexattr_settype.cpp +++ b/libc/src/pthread/pthread_mutexattr_settype.cpp @@ -14,7 +14,7 @@ #include #include -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 2411558ae217f2..8ad3285bacf304 100644 --- a/libc/src/pthread/pthread_mutexattr_settype.h +++ b/libc/src/pthread/pthread_mutexattr_settype.h @@ -11,10 +11,10 @@ #include -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 4d141a67203684..0e0045e9c54070 100644 --- a/libc/src/pthread/pthread_once.cpp +++ b/libc/src/pthread/pthread_once.cpp @@ -12,7 +12,7 @@ #include // 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(func)); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/pthread/pthread_once.h b/libc/src/pthread/pthread_once.h index b9b7212f72af68..25ee70a99c4d4c 100644 --- a/libc/src/pthread/pthread_once.h +++ b/libc/src/pthread/pthread_once.h @@ -11,10 +11,10 @@ #include -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 5b3145f34930ce..3e74f964c9af28 100644 --- a/libc/src/pthread/pthread_self.cpp +++ b/libc/src/pthread/pthread_self.cpp @@ -13,9 +13,9 @@ #include // 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 1c4080bb9f6327..058072e45ed288 100644 --- a/libc/src/pthread/pthread_self.h +++ b/libc/src/pthread/pthread_self.h @@ -11,10 +11,10 @@ #include -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 425c25bd3a5f7d..e211d7e082740b 100644 --- a/libc/src/pthread/pthread_setname_np.cpp +++ b/libc/src/pthread/pthread_setname_np.cpp @@ -14,14 +14,14 @@ #include -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(&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 25b8c1f4f5e0f0..e240425ae2b46b 100644 --- a/libc/src/pthread/pthread_setname_np.h +++ b/libc/src/pthread/pthread_setname_np.h @@ -11,10 +11,10 @@ #include -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 15504f7f536304..e9b23d8483a8ff 100644 --- a/libc/src/pthread/pthread_setspecific.cpp +++ b/libc/src/pthread/pthread_setspecific.cpp @@ -14,7 +14,7 @@ #include #include -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 4211a8e79e8763..af9a890fd0aebd 100644 --- a/libc/src/pthread/pthread_setspecific.h +++ b/libc/src/pthread/pthread_setspecific.h @@ -11,10 +11,10 @@ #include -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 c2954e3e8fbc43..0b6537ecd84c6f 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 // 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(SYS_sched_get_priority_max, policy); + int ret = + LIBC_NAMESPACE::syscall_impl(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 442b8572ab413e..1240a500887eeb 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 // 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(SYS_sched_get_priority_min, policy); + int ret = + LIBC_NAMESPACE::syscall_impl(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 fcdd8c32e156e3..476576178fa48f 100644 --- a/libc/src/sched/linux/sched_getaffinity.cpp +++ b/libc/src/sched/linux/sched_getaffinity.cpp @@ -16,12 +16,12 @@ #include #include // 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(SYS_sched_getaffinity, tid, - cpuset_size, mask); + int ret = LIBC_NAMESPACE::syscall_impl(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 bcb5e8222145a6..a816d92e4c0b5b 100644 --- a/libc/src/sched/linux/sched_getcpucount.cpp +++ b/libc/src/sched/linux/sched_getcpucount.cpp @@ -13,7 +13,7 @@ #include #include -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 3b19c2e1f802c2..64a62c5fd5e84a 100644 --- a/libc/src/sched/linux/sched_getparam.cpp +++ b/libc/src/sched/linux/sched_getparam.cpp @@ -14,11 +14,11 @@ #include // 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(SYS_sched_getparam, tid, param); + int ret = LIBC_NAMESPACE::syscall_impl(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 1f9affb00ed458..992a11d2925916 100644 --- a/libc/src/sched/linux/sched_getscheduler.cpp +++ b/libc/src/sched/linux/sched_getscheduler.cpp @@ -14,10 +14,10 @@ #include // For syscall numbers. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, sched_getscheduler, (pid_t tid)) { - int ret = __llvm_libc::syscall_impl(SYS_sched_getscheduler, tid); + int ret = LIBC_NAMESPACE::syscall_impl(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 c50dc711620b1d..9d7d0e9d1ef6a1 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 // 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(SYS_sched_rr_get_interval, tid, tp); + int ret = + LIBC_NAMESPACE::syscall_impl(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(SYS_sched_rr_get_interval_time64, tid, - &ts32); + ret = LIBC_NAMESPACE::syscall_impl(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(SYS_sched_rr_get_interval_time64, tid, - nullptr); + ret = LIBC_NAMESPACE::syscall_impl(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 1c992541917216..509894258e126c 100644 --- a/libc/src/sched/linux/sched_setaffinity.cpp +++ b/libc/src/sched/linux/sched_setaffinity.cpp @@ -15,12 +15,12 @@ #include #include // 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(SYS_sched_setaffinity, tid, - cpuset_size, mask); + int ret = LIBC_NAMESPACE::syscall_impl(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 28698003b14826..79acf78ef887ef 100644 --- a/libc/src/sched/linux/sched_setparam.cpp +++ b/libc/src/sched/linux/sched_setparam.cpp @@ -14,11 +14,11 @@ #include // 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(SYS_sched_setparam, tid, param); + int ret = LIBC_NAMESPACE::syscall_impl(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 c0b6205a47d003..1c18526a3c8146 100644 --- a/libc/src/sched/linux/sched_setscheduler.cpp +++ b/libc/src/sched/linux/sched_setscheduler.cpp @@ -14,12 +14,12 @@ #include // 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(SYS_sched_setscheduler, tid, policy, - param); + int ret = LIBC_NAMESPACE::syscall_impl(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 27a6f372b04722..6878a375aa092b 100644 --- a/libc/src/sched/linux/sched_yield.cpp +++ b/libc/src/sched/linux/sched_yield.cpp @@ -14,10 +14,10 @@ #include // For syscall numbers. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, sched_yield, ()) { - int ret = __llvm_libc::syscall_impl(SYS_sched_yield); + int ret = LIBC_NAMESPACE::syscall_impl(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 3ddcb086278364..01611dae7bd126 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 10bca87beadcb9..f4b5d5487887ca 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 12317729b02ba0..2f29b7e2a0b9e8 100644 --- a/libc/src/sched/sched_getaffinity.h +++ b/libc/src/sched/sched_getaffinity.h @@ -11,10 +11,10 @@ #include -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 f55ec147d5825a..a0c696fd1f4ae0 100644 --- a/libc/src/sched/sched_getcpucount.h +++ b/libc/src/sched/sched_getcpucount.h @@ -12,12 +12,12 @@ #include #include -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 fcae11b71f8b53..09bed7012e3fdd 100644 --- a/libc/src/sched/sched_getparam.h +++ b/libc/src/sched/sched_getparam.h @@ -11,10 +11,10 @@ #include -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 543b72d5a66fc3..6e4fe060a6c4ef 100644 --- a/libc/src/sched/sched_getscheduler.h +++ b/libc/src/sched/sched_getscheduler.h @@ -11,10 +11,10 @@ #include -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 b90e4c3c26accd..f9eb2d9a2220d5 100644 --- a/libc/src/sched/sched_rr_get_interval.h +++ b/libc/src/sched/sched_rr_get_interval.h @@ -11,10 +11,10 @@ #include -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 9f3f8fe3b17484..5da6dd43e7d5d7 100644 --- a/libc/src/sched/sched_setaffinity.h +++ b/libc/src/sched/sched_setaffinity.h @@ -11,10 +11,10 @@ #include -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 1707597045fd75..c371bc0bc75316 100644 --- a/libc/src/sched/sched_setparam.h +++ b/libc/src/sched/sched_setparam.h @@ -11,10 +11,10 @@ #include -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 2a56e27cdf138f..8e0cb0d0629aee 100644 --- a/libc/src/sched/sched_setscheduler.h +++ b/libc/src/sched/sched_setscheduler.h @@ -11,10 +11,10 @@ #include -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 a64950039cdc87..493646a84edbbf 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 5937504cf7e081..3697d62968c27c 100644 --- a/libc/src/setjmp/longjmp.h +++ b/libc/src/setjmp/longjmp.h @@ -11,10 +11,10 @@ #include -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 7d8acd316845bc..0aed25e8125adc 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 1ffc8d404f3c9d..826aa4021d3f4f 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 9dc5396d58b466..52c835c7414c72 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 -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 d509b25b1d5250..32340463e9f37b 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 988db6452571d5..8b6981d4cc34a2 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 52d5b0da6cc14e..a6d18935459ca2 100644 --- a/libc/src/signal/kill.h +++ b/libc/src/signal/kill.h @@ -11,10 +11,10 @@ #include -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 947373031f1578..36fa375d672e18 100644 --- a/libc/src/signal/linux/__restore.cpp +++ b/libc/src/signal/linux/__restore.cpp @@ -14,14 +14,14 @@ #include -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(SYS_rt_sigreturn); + LIBC_NAMESPACE::syscall_impl(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 10d50761edf3ad..a02b3b1d140035 100644 --- a/libc/src/signal/linux/kill.cpp +++ b/libc/src/signal/linux/kill.cpp @@ -16,10 +16,10 @@ #include #include // 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(SYS_kill, pid, sig); + int ret = LIBC_NAMESPACE::syscall_impl(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 0a9bf295b016ea..dd6f5eb4b35754 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(SYS_getpid); - long tid = __llvm_libc::syscall_impl(SYS_gettid); - int ret = __llvm_libc::syscall_impl(SYS_tgkill, pid, tid, sig); + long pid = LIBC_NAMESPACE::syscall_impl(SYS_getpid); + long tid = LIBC_NAMESPACE::syscall_impl(SYS_gettid); + int ret = LIBC_NAMESPACE::syscall_impl(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 08f4d0a8f575f4..7ddc2dc5cbcc70 100644 --- a/libc/src/signal/linux/sigaction.cpp +++ b/libc/src/signal/linux/sigaction.cpp @@ -14,7 +14,7 @@ #include -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 ret = LIBC_NAMESPACE::syscall_impl( 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 ff65c04e3e9527..536391734e0587 100644 --- a/libc/src/signal/linux/sigaddset.cpp +++ b/libc/src/signal/linux/sigaddset.cpp @@ -13,7 +13,7 @@ #include -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 1e58dc725e4b4e..47e0b23f4bad5c 100644 --- a/libc/src/signal/linux/sigaltstack.cpp +++ b/libc/src/signal/linux/sigaltstack.cpp @@ -15,7 +15,7 @@ #include #include -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(SYS_sigaltstack, ss, oss); + int ret = LIBC_NAMESPACE::syscall_impl(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 ebaa4122c067e3..5cb645e461cf8e 100644 --- a/libc/src/signal/linux/sigdelset.cpp +++ b/libc/src/signal/linux/sigdelset.cpp @@ -13,7 +13,7 @@ #include -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 6f4c731b0831ac..d08191e8ce4e0b 100644 --- a/libc/src/signal/linux/sigemptyset.cpp +++ b/libc/src/signal/linux/sigemptyset.cpp @@ -14,7 +14,7 @@ #include -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 9c3796dbee47f9..e17c85a897ce74 100644 --- a/libc/src/signal/linux/sigfillset.cpp +++ b/libc/src/signal/linux/sigfillset.cpp @@ -13,7 +13,7 @@ #include -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 464a23c2977540..a517fa73ba8a2c 100644 --- a/libc/src/signal/linux/signal.cpp +++ b/libc/src/signal/linux/signal.cpp @@ -13,15 +13,16 @@ #include -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 7b976fcafc8699..ca6fd3aeb1a6ed 100644 --- a/libc/src/signal/linux/signal_utils.h +++ b/libc/src/signal/linux/signal_utils.h @@ -16,7 +16,7 @@ #include #include // 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(SYS_rt_sigprocmask, SIG_BLOCK, &full, - &set, sizeof(sigset_t)); + return LIBC_NAMESPACE::syscall_impl(SYS_rt_sigprocmask, SIG_BLOCK, &full, + &set, sizeof(sigset_t)); } LIBC_INLINE int restore_signals(const sigset_t &set) { - return __llvm_libc::syscall_impl(SYS_rt_sigprocmask, SIG_SETMASK, &set, - nullptr, sizeof(sigset_t)); + return LIBC_NAMESPACE::syscall_impl(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 f47cbd89ab2bb3..79a35dd59d75c8 100644 --- a/libc/src/signal/linux/sigprocmask.cpp +++ b/libc/src/signal/linux/sigprocmask.cpp @@ -16,13 +16,13 @@ #include #include // 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(SYS_rt_sigprocmask, how, set, oldset, - sizeof(sigset_t)); + int ret = LIBC_NAMESPACE::syscall_impl(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 624b93c97b6109..ee4f3c9f826a9b 100644 --- a/libc/src/signal/raise.h +++ b/libc/src/signal/raise.h @@ -11,10 +11,10 @@ #include -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 8315a56bb01666..c36a3ec9fedfaa 100644 --- a/libc/src/signal/sigaction.h +++ b/libc/src/signal/sigaction.h @@ -11,11 +11,11 @@ #include -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 7d4613e32c0366..626eb20a295c83 100644 --- a/libc/src/signal/sigaddset.h +++ b/libc/src/signal/sigaddset.h @@ -11,10 +11,10 @@ #include -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 7cc77aad883aa1..705bd368ce47b5 100644 --- a/libc/src/signal/sigaltstack.h +++ b/libc/src/signal/sigaltstack.h @@ -11,10 +11,10 @@ #include -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 2283bb5fa701c2..c4fdb9975fa3d0 100644 --- a/libc/src/signal/sigdelset.h +++ b/libc/src/signal/sigdelset.h @@ -11,10 +11,10 @@ #include -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 bcb9c1a994e0a0..f3763d1f4f3d44 100644 --- a/libc/src/signal/sigemptyset.h +++ b/libc/src/signal/sigemptyset.h @@ -11,10 +11,10 @@ #include -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 08a70a40afc767..d8e3168871ea8a 100644 --- a/libc/src/signal/sigfillset.h +++ b/libc/src/signal/sigfillset.h @@ -11,10 +11,10 @@ #include -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 c45564cf9e4662..15bb5f01232eee 100644 --- a/libc/src/signal/signal.h +++ b/libc/src/signal/signal.h @@ -11,12 +11,12 @@ #include -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 490a16df7d6ff5..e0658860579e4e 100644 --- a/libc/src/signal/sigprocmask.h +++ b/libc/src/signal/sigprocmask.h @@ -11,11 +11,11 @@ #include -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 ee509a1e0ad9c8..7113256bf49cb7 100644 --- a/libc/src/spawn/file_actions.h +++ b/libc/src/spawn/file_actions.h @@ -12,7 +12,7 @@ #include // For mode_t #include -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 44c79f9400a8f1..0a0467df4959e9 100644 --- a/libc/src/spawn/linux/posix_spawn.cpp +++ b/libc/src/spawn/linux/posix_spawn.cpp @@ -18,7 +18,7 @@ #include #include // 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(SYS_fork); + return LIBC_NAMESPACE::syscall_impl(SYS_fork); #elif defined(SYS_clone) - return __llvm_libc::syscall_impl(SYS_clone, SIGCHLD, 0); + return LIBC_NAMESPACE::syscall_impl(SYS_clone, SIGCHLD, 0); #else #error "fork or clone syscalls not available." #endif @@ -37,10 +37,10 @@ pid_t fork() { cpp::optional open(const char *path, int oflags, mode_t mode) { #ifdef SYS_open - int fd = __llvm_libc::syscall_impl(SYS_open, path, oflags, mode); + int fd = LIBC_NAMESPACE::syscall_impl(SYS_open, path, oflags, mode); #else - int fd = - __llvm_libc::syscall_impl(SYS_openat, AT_FDCWD, path, oflags, mode); + int fd = LIBC_NAMESPACE::syscall_impl(SYS_openat, AT_FDCWD, path, oflags, + mode); #endif if (fd > 0) return fd; @@ -50,14 +50,14 @@ cpp::optional open(const char *path, int oflags, mode_t mode) { return cpp::nullopt; } -void close(int fd) { __llvm_libc::syscall_impl(SYS_close, fd); } +void close(int fd) { LIBC_NAMESPACE::syscall_impl(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(SYS_dup2, fd, newfd); + int ret = LIBC_NAMESPACE::syscall_impl(SYS_dup2, fd, newfd); #elif defined(SYS_dup3) - int ret = __llvm_libc::syscall_impl(SYS_dup3, fd, newfd, 0); + int ret = LIBC_NAMESPACE::syscall_impl(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(SYS_exit_group, 127); - __llvm_libc::syscall_impl(SYS_exit, 127); + LIBC_NAMESPACE::syscall_impl(SYS_exit_group, 127); + LIBC_NAMESPACE::syscall_impl(SYS_exit, 127); } } @@ -117,7 +117,7 @@ void child_process(const char *__restrict path, } } - if (__llvm_libc::syscall_impl(SYS_execve, path, argv, envp) < 0) + if (LIBC_NAMESPACE::syscall_impl(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 721462701b25ff..354b94c2d2d73d 100644 --- a/libc/src/spawn/posix_spawn.h +++ b/libc/src/spawn/posix_spawn.h @@ -11,13 +11,13 @@ #include -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 492c3e0b8bc112..9b3c4885dfd770 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 #include -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 5eda292760daf7..c84965180fa7ab 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 -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 ca18629ba6832f..caa558e2a9a5f2 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 #include -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 33444184f97362..7a7f3a5fb5bfda 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 -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 3b12c8bbc17ce5..c544f04bd54ae7 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 #include -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 ff757d42e5142f..121213abe50f8c 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 -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 7be531c67322c3..73e0ac828cd699 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 #include -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 89f3c55dd99b5f..28b9b05b9e79a9 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 -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 99502ff44962ba..04e5610c717c69 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 -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 da354e1b0ebae8..d7b228fff08d0b 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 -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 446e0fd40f87fc..b8e8d7c5cab82c 100644 --- a/libc/src/stdio/clearerr.h +++ b/libc/src/stdio/clearerr.h @@ -11,10 +11,10 @@ #include -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 8c14fd230a06f4..ff447cea61370c 100644 --- a/libc/src/stdio/clearerr_unlocked.h +++ b/libc/src/stdio/clearerr_unlocked.h @@ -11,10 +11,10 @@ #include -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 21ffa4350391e3..7fe6951a080dca 100644 --- a/libc/src/stdio/fclose.h +++ b/libc/src/stdio/fclose.h @@ -11,10 +11,10 @@ #include -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 eab056ea2fdeb0..66a49bdd257015 100644 --- a/libc/src/stdio/feof.h +++ b/libc/src/stdio/feof.h @@ -11,10 +11,10 @@ #include -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 8e20f964ba3132..359609c597900b 100644 --- a/libc/src/stdio/feof_unlocked.h +++ b/libc/src/stdio/feof_unlocked.h @@ -11,10 +11,10 @@ #include -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 3971cff6cac0cc..194dff6320c838 100644 --- a/libc/src/stdio/ferror.h +++ b/libc/src/stdio/ferror.h @@ -11,10 +11,10 @@ #include -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 9b0f12c7852c10..86281025368c36 100644 --- a/libc/src/stdio/ferror_unlocked.h +++ b/libc/src/stdio/ferror_unlocked.h @@ -11,10 +11,10 @@ #include -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 d7a565214fc3cd..dc5275b1cd08e1 100644 --- a/libc/src/stdio/fflush.cpp +++ b/libc/src/stdio/fflush.cpp @@ -12,10 +12,10 @@ #include "src/errno/libc_errno.h" #include -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(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 f2adbe17e8ef28..839fd986f15b54 100644 --- a/libc/src/stdio/fflush.h +++ b/libc/src/stdio/fflush.h @@ -11,10 +11,10 @@ #include -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 13d22ded7f3f88..26a32482a3ba78 100644 --- a/libc/src/stdio/fgetc.h +++ b/libc/src/stdio/fgetc.h @@ -11,10 +11,10 @@ #include -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 e374a6d0f6ce18..f765e8d502be79 100644 --- a/libc/src/stdio/fgetc_unlocked.h +++ b/libc/src/stdio/fgetc_unlocked.h @@ -11,10 +11,10 @@ #include -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 6f4ed93ff03dcd..42645578624793 100644 --- a/libc/src/stdio/fgets.h +++ b/libc/src/stdio/fgets.h @@ -11,10 +11,10 @@ #include -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 3b13a6f4d813da..62606c92b9ea93 100644 --- a/libc/src/stdio/flockfile.cpp +++ b/libc/src/stdio/flockfile.cpp @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(void, flockfile, (::FILE * stream)) { - reinterpret_cast<__llvm_libc::File *>(stream)->lock(); + reinterpret_cast(stream)->lock(); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdio/flockfile.h b/libc/src/stdio/flockfile.h index 961ad8f941cdfa..1509c140c5e711 100644 --- a/libc/src/stdio/flockfile.h +++ b/libc/src/stdio/flockfile.h @@ -11,10 +11,10 @@ #include -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 f8ab0542d2a6ff..68f93f5168f079 100644 --- a/libc/src/stdio/fopen.h +++ b/libc/src/stdio/fopen.h @@ -11,10 +11,10 @@ #include -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 7a4479ccae0256..2cb7ad2f46ebf6 100644 --- a/libc/src/stdio/fopencookie.cpp +++ b/libc/src/stdio/fopencookie.cpp @@ -14,11 +14,11 @@ #include #include -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 d78e5ac3317da1..3dff8949dd4351 100644 --- a/libc/src/stdio/fopencookie.h +++ b/libc/src/stdio/fopencookie.h @@ -11,11 +11,11 @@ #include -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 e13ed4d075ac85..87b0e74ae09bfb 100644 --- a/libc/src/stdio/fprintf.cpp +++ b/libc/src/stdio/fprintf.cpp @@ -15,7 +15,7 @@ #include #include -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 caac3e88ee4fed..41cd8a858b430c 100644 --- a/libc/src/stdio/fprintf.h +++ b/libc/src/stdio/fprintf.h @@ -11,10 +11,10 @@ #include -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 24732ecb74e87e..578e569072a1f2 100644 --- a/libc/src/stdio/fputc.h +++ b/libc/src/stdio/fputc.h @@ -11,10 +11,10 @@ #include -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 2419fe8eeac706..0238e46e628a61 100644 --- a/libc/src/stdio/fputs.h +++ b/libc/src/stdio/fputs.h @@ -11,10 +11,10 @@ #include -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 995367cda4560d..ae2295095b9cf5 100644 --- a/libc/src/stdio/fread.h +++ b/libc/src/stdio/fread.h @@ -11,11 +11,11 @@ #include -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 5c965b0f168cd2..7cd0ed3e35c577 100644 --- a/libc/src/stdio/fread_unlocked.h +++ b/libc/src/stdio/fread_unlocked.h @@ -11,11 +11,11 @@ #include -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 4fe0a3e57dcaa1..188e28e50d0bd7 100644 --- a/libc/src/stdio/fscanf.cpp +++ b/libc/src/stdio/fscanf.cpp @@ -15,7 +15,7 @@ #include #include -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 cc36cd7c9af8e3..0e2247d74f0e57 100644 --- a/libc/src/stdio/fscanf.h +++ b/libc/src/stdio/fscanf.h @@ -11,10 +11,10 @@ #include -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 928ff84db3a309..7666e71e699d56 100644 --- a/libc/src/stdio/fseek.cpp +++ b/libc/src/stdio/fseek.cpp @@ -12,11 +12,11 @@ #include "src/errno/libc_errno.h" #include -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(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 f3865c4efd23ff..6a7f715d2f9989 100644 --- a/libc/src/stdio/fseek.h +++ b/libc/src/stdio/fseek.h @@ -11,10 +11,10 @@ #include -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 697e9bc1b4b32e..5f7803150534b3 100644 --- a/libc/src/stdio/ftell.cpp +++ b/libc/src/stdio/ftell.cpp @@ -12,10 +12,10 @@ #include "src/errno/libc_errno.h" #include -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(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 95d44947091812..e72bb8b32bd947 100644 --- a/libc/src/stdio/ftell.h +++ b/libc/src/stdio/ftell.h @@ -11,10 +11,10 @@ #include -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 6c7dbee303cbb3..88e2eaef8ba038 100644 --- a/libc/src/stdio/funlockfile.cpp +++ b/libc/src/stdio/funlockfile.cpp @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(void, funlockfile, (::FILE * stream)) { - reinterpret_cast<__llvm_libc::File *>(stream)->unlock(); + reinterpret_cast(stream)->unlock(); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdio/funlockfile.h b/libc/src/stdio/funlockfile.h index cb04b7e9550ec0..c50f9dd1d70099 100644 --- a/libc/src/stdio/funlockfile.h +++ b/libc/src/stdio/funlockfile.h @@ -11,10 +11,10 @@ #include -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 eb258fcec33b79..a71f20cff023ac 100644 --- a/libc/src/stdio/fwrite.h +++ b/libc/src/stdio/fwrite.h @@ -11,11 +11,11 @@ #include -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 33bcc219d2efa3..7012e0d16737a9 100644 --- a/libc/src/stdio/fwrite_unlocked.h +++ b/libc/src/stdio/fwrite_unlocked.h @@ -11,11 +11,11 @@ #include -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 95556bfdf73903..1f1ce38639f50c 100644 --- a/libc/src/stdio/generic/clearerr.cpp +++ b/libc/src/stdio/generic/clearerr.cpp @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(void, clearerr, (::FILE * stream)) { - reinterpret_cast<__llvm_libc::File *>(stream)->clearerr(); + reinterpret_cast(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 88f26a82dbbe37..2840e3703ca939 100644 --- a/libc/src/stdio/generic/clearerr_unlocked.cpp +++ b/libc/src/stdio/generic/clearerr_unlocked.cpp @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(void, clearerr_unlocked, (::FILE * stream)) { - reinterpret_cast<__llvm_libc::File *>(stream)->clearerr_unlocked(); + reinterpret_cast(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 da75e9bc1fdf73..cc163ab21e78d0 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 -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(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 3d22a19f05d3ad..311561c4271f01 100644 --- a/libc/src/stdio/generic/feof.cpp +++ b/libc/src/stdio/generic/feof.cpp @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, feof, (::FILE * stream)) { - return reinterpret_cast<__llvm_libc::File *>(stream)->iseof(); + return reinterpret_cast(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 fdb9e2ca369d71..e8c718c1369613 100644 --- a/libc/src/stdio/generic/feof_unlocked.cpp +++ b/libc/src/stdio/generic/feof_unlocked.cpp @@ -11,10 +11,10 @@ #include -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(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 12bfc2a857a538..65cf99fe484730 100644 --- a/libc/src/stdio/generic/ferror.cpp +++ b/libc/src/stdio/generic/ferror.cpp @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, ferror, (::FILE * stream)) { - return reinterpret_cast<__llvm_libc::File *>(stream)->error(); + return reinterpret_cast(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 301aa83dac8ad0..089ea4ab36b576 100644 --- a/libc/src/stdio/generic/ferror_unlocked.cpp +++ b/libc/src/stdio/generic/ferror_unlocked.cpp @@ -11,10 +11,10 @@ #include -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(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 9a6109636364a3..771811382fd595 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 -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(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 032a9fbac019ce..e7aaf9dc8ea223 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 -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(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 dd5051a32cea82..8c9dac8bd3b31f 100644 --- a/libc/src/stdio/generic/fgets.cpp +++ b/libc/src/stdio/generic/fgets.cpp @@ -13,7 +13,7 @@ #include #include -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(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 3062a059ae16a7..794ef0366dd669 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 -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 5f41e5ca31844b..ecbe45e97208d4 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 -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, fputc, (int c, ::FILE *stream)) { unsigned char uc = static_cast(c); - auto result = reinterpret_cast<__llvm_libc::File *>(stream)->write(&uc, 1); + auto result = reinterpret_cast(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 d8ba18f003cb79..ef77ad43a1b427 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 -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(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 affc6b7e8a0da2..e8bd2517df6f80 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 -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(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 3f922c5a5b48f7..9810c9d6519d9c 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 -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(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 cc6c45079bb2c0..bd11f62a7121c5 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 -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(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 736dfe0fc761cf..5ab7c766087b7b 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 -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(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 730be685c2ce23..5cea28d506f6bc 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 -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(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 4eae5c13d85884..883405e84bad07 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 -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(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 91e01e37125f2a..181999fe56c422 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 -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 1a9a44ea4279e8..be98d0333ec87b 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 -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 37937dfb7e6077..58e3b4d1bae4db 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 -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, putc, (int c, ::FILE *stream)) { unsigned char uc = static_cast(c); - auto result = reinterpret_cast<__llvm_libc::File *>(stream)->write(&uc, 1); + auto result = reinterpret_cast(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 9190b714dd3f8d..4a4aeb54c9c6f3 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 -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, putchar, (int c)) { unsigned char uc = static_cast(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 ffcbf56ce96d66..d8d69332566cd0 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 -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 b5de6a75858072..c085d35d7de9c7 100644 --- a/libc/src/stdio/getc.h +++ b/libc/src/stdio/getc.h @@ -11,10 +11,10 @@ #include -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 b318dfc934e90c..f4e1165dd75dcf 100644 --- a/libc/src/stdio/getc_unlocked.h +++ b/libc/src/stdio/getc_unlocked.h @@ -11,10 +11,10 @@ #include -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 51f2f7afa19453..4168808d3e3299 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 6bbd49a76a62b8..24fdb752f5530f 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 01c34ca936b11a..2267fdf8115eed 100644 --- a/libc/src/stdio/gpu/clearerr.cpp +++ b/libc/src/stdio/gpu/clearerr.cpp @@ -11,7 +11,7 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(void, clearerr, (::FILE * stream)) { rpc::Client::Port port = rpc::client.open(); @@ -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 a8e36bcb27c858..bdedbe51ec38ea 100644 --- a/libc/src/stdio/gpu/fclose.cpp +++ b/libc/src/stdio/gpu/fclose.cpp @@ -11,7 +11,7 @@ #include -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(ret); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdio/gpu/feof.cpp b/libc/src/stdio/gpu/feof.cpp index 27d27a445812c0..ddcef384142c42 100644 --- a/libc/src/stdio/gpu/feof.cpp +++ b/libc/src/stdio/gpu/feof.cpp @@ -11,7 +11,7 @@ #include -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 e4bd631f392d4e..9ed598fb67541e 100644 --- a/libc/src/stdio/gpu/ferror.cpp +++ b/libc/src/stdio/gpu/ferror.cpp @@ -11,7 +11,7 @@ #include -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 ff4ef27ccb88e9..56f42a04857fb2 100644 --- a/libc/src/stdio/gpu/fgetc.cpp +++ b/libc/src/stdio/gpu/fgetc.cpp @@ -11,7 +11,7 @@ #include -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 df00451e2a9703..4cabd15001a7f5 100644 --- a/libc/src/stdio/gpu/fgets.cpp +++ b/libc/src/stdio/gpu/fgets.cpp @@ -14,7 +14,7 @@ #include #include -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 4b07f9fab2eb62..2cab2e6d36a259 100644 --- a/libc/src/stdio/gpu/file.h +++ b/libc/src/stdio/gpu/file.h @@ -11,7 +11,7 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace file { enum Stream { @@ -94,4 +94,4 @@ LIBC_INLINE uint64_t read(::FILE *f, void *data, size_t size) { } } // 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 5d88b65e9f702d..41d2c89473168e 100644 --- a/libc/src/stdio/gpu/fopen.cpp +++ b/libc/src/stdio/gpu/fopen.cpp @@ -12,7 +12,7 @@ #include -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); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdio/gpu/fputc.cpp b/libc/src/stdio/gpu/fputc.cpp index 90d238972972ec..e6ef12f4b2f804 100644 --- a/libc/src/stdio/gpu/fputc.cpp +++ b/libc/src/stdio/gpu/fputc.cpp @@ -11,7 +11,7 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, fputc, (int c, ::FILE *stream)) { unsigned char uc = static_cast(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 c5919e8913746f..1b6e0732b98cd6 100644 --- a/libc/src/stdio/gpu/fputs.cpp +++ b/libc/src/stdio/gpu/fputs.cpp @@ -13,7 +13,7 @@ #include -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 2b9112ee50eb39..fe367ae1aa2499 100644 --- a/libc/src/stdio/gpu/fread.cpp +++ b/libc/src/stdio/gpu/fread.cpp @@ -11,7 +11,7 @@ #include -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 fccaabd0673ec5..a059bd5ea3b719 100644 --- a/libc/src/stdio/gpu/fwrite.cpp +++ b/libc/src/stdio/gpu/fwrite.cpp @@ -11,7 +11,7 @@ #include -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 a2272221d6b7b9..b50e3963c31a11 100644 --- a/libc/src/stdio/gpu/getc.cpp +++ b/libc/src/stdio/gpu/getc.cpp @@ -11,7 +11,7 @@ #include -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 a7a6e6c55c13e1..c8a004124a2e57 100644 --- a/libc/src/stdio/gpu/getchar.cpp +++ b/libc/src/stdio/gpu/getchar.cpp @@ -11,7 +11,7 @@ #include -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 d450edb6596df1..b5ecbfc65d6779 100644 --- a/libc/src/stdio/gpu/putc.cpp +++ b/libc/src/stdio/gpu/putc.cpp @@ -11,7 +11,7 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, putc, (int c, ::FILE *stream)) { unsigned char uc = static_cast(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 df577544b8ba40..57663eec40f3b7 100644 --- a/libc/src/stdio/gpu/putchar.cpp +++ b/libc/src/stdio/gpu/putchar.cpp @@ -11,7 +11,7 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, putchar, (int c)) { unsigned char uc = static_cast(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 e50e2cc7d55d50..10573a862a4c20 100644 --- a/libc/src/stdio/gpu/puts.cpp +++ b/libc/src/stdio/gpu/puts.cpp @@ -13,7 +13,7 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, puts, (const char *__restrict str)) { cpp::string_view str_view(str); @@ -24,4 +24,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 5e7b79e80e8a19..70846827064a38 100644 --- a/libc/src/stdio/gpu/stderr.cpp +++ b/libc/src/stdio/gpu/stderr.cpp @@ -8,9 +8,9 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { static struct { } stub; FILE *stderr = reinterpret_cast(&stub); -} // namespace __llvm_libc -extern "C" FILE *stderr = reinterpret_cast(&__llvm_libc::stub); +} // namespace LIBC_NAMESPACE +extern "C" FILE *stderr = reinterpret_cast(&LIBC_NAMESPACE::stub); diff --git a/libc/src/stdio/gpu/stdin.cpp b/libc/src/stdio/gpu/stdin.cpp index 408852b461de4d..1a58461c3dec93 100644 --- a/libc/src/stdio/gpu/stdin.cpp +++ b/libc/src/stdio/gpu/stdin.cpp @@ -8,9 +8,9 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { static struct { } stub; FILE *stdin = reinterpret_cast(&stub); -} // namespace __llvm_libc -extern "C" FILE *stdin = reinterpret_cast(&__llvm_libc::stub); +} // namespace LIBC_NAMESPACE +extern "C" FILE *stdin = reinterpret_cast(&LIBC_NAMESPACE::stub); diff --git a/libc/src/stdio/gpu/stdout.cpp b/libc/src/stdio/gpu/stdout.cpp index 02425d31e1e251..abeeff2ce9f53c 100644 --- a/libc/src/stdio/gpu/stdout.cpp +++ b/libc/src/stdio/gpu/stdout.cpp @@ -8,9 +8,9 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { static struct { } stub; FILE *stdout = reinterpret_cast(&stub); -} // namespace __llvm_libc -extern "C" FILE *stdout = reinterpret_cast(&__llvm_libc::stub); +} // namespace LIBC_NAMESPACE +extern "C" FILE *stdout = reinterpret_cast(&LIBC_NAMESPACE::stub); diff --git a/libc/src/stdio/linux/remove.cpp b/libc/src/stdio/linux/remove.cpp index 1f975679e2f9bf..b2742c29a3e26a 100644 --- a/libc/src/stdio/linux/remove.cpp +++ b/libc/src/stdio/linux/remove.cpp @@ -15,19 +15,19 @@ #include // For AT_* macros. #include // 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(SYS_unlinkat, AT_FDCWD, path, 0); + int ret = LIBC_NAMESPACE::syscall_impl(SYS_unlinkat, AT_FDCWD, path, 0); if (ret == -EISDIR) - ret = __llvm_libc::syscall_impl(SYS_unlinkat, AT_FDCWD, path, - AT_REMOVEDIR); + ret = LIBC_NAMESPACE::syscall_impl(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 c59a084353b5c1..5701ca9eb2704c 100644 --- a/libc/src/stdio/printf.cpp +++ b/libc/src/stdio/printf.cpp @@ -16,12 +16,12 @@ #include #ifndef LIBC_COPT_STDIO_USE_SYSTEM_FILE -#define PRINTF_STDOUT __llvm_libc::stdout +#define PRINTF_STDOUT LIBC_NAMESPACE::stdout #else // LIBC_COPT_STDIO_USE_SYSTEM_FILE #define PRINTF_STDOUT ::stdout #endif // LIBC_COPT_STDIO_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 c568b04adb7c54..c5b4603c589d51 100644 --- a/libc/src/stdio/printf.h +++ b/libc/src/stdio/printf.h @@ -11,10 +11,10 @@ #include -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 ffd2422c822f7e..9b1501ff24b0d8 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 e27deb4cbf5995..74a36cbf7432fb 100644 --- a/libc/src/stdio/printf_core/converter.cpp +++ b/libc/src/stdio/printf_core/converter.cpp @@ -21,7 +21,7 @@ #include -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 ae281ba99ec070..d653f1e56dc280 100644 --- a/libc/src/stdio/printf_core/converter.h +++ b/libc/src/stdio/printf_core/converter.h @@ -14,7 +14,7 @@ #include -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 54948a2a5f1fd1..4540bba6346e2f 100644 --- a/libc/src/stdio/printf_core/converter_utils.h +++ b/libc/src/stdio/printf_core/converter_utils.h @@ -16,7 +16,7 @@ #include #include -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 771d5a8cff437e..e96bc4dc0f8dd3 100644 --- a/libc/src/stdio/printf_core/core_structs.h +++ b/libc/src/stdio/printf_core/core_structs.h @@ -15,7 +15,7 @@ #include #include -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 5e6f1d127370ce..8c5ba0d241eda5 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 #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace printf_core { using MantissaInt = fputil::FPBits::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 4bd0f91b68a7ba..e264af9844bd24 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 #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace printf_core { using MantissaInt = fputil::FPBits::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 0b7a1c3835523f..3c24c393b35483 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 #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace printf_core { using MantissaInt = fputil::FPBits::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 044721b5afde00..348e81a1fa536b 100644 --- a/libc/src/stdio/printf_core/int_converter.h +++ b/libc/src/stdio/printf_core/int_converter.h @@ -20,7 +20,7 @@ #include #include -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.h b/libc/src/stdio/printf_core/parser.h index ddffe9694b6671..7cf87dd6e17d19 100644 --- a/libc/src/stdio/printf_core/parser.h +++ b/libc/src/stdio/printf_core/parser.h @@ -19,7 +19,7 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace printf_core { template struct int_type_of { @@ -558,6 +558,6 @@ template 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 60d1e210eee4cf..54e70f58c87fe2 100644 --- a/libc/src/stdio/printf_core/printf_main.cpp +++ b/libc/src/stdio/printf_core/printf_main.cpp @@ -16,7 +16,7 @@ #include -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 341bd4cef8543a..15c6977622afb3 100644 --- a/libc/src/stdio/printf_core/printf_main.h +++ b/libc/src/stdio/printf_core/printf_main.h @@ -14,13 +14,13 @@ #include -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 6304abcdb6ddaf..73c6e608a59a78 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 460f195f5d9032..158315311e9ead 100644 --- a/libc/src/stdio/printf_core/string_converter.h +++ b/libc/src/stdio/printf_core/string_converter.h @@ -17,7 +17,7 @@ #include -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 d66b53bd1bced4..c16c3ae15fb7c5 100644 --- a/libc/src/stdio/printf_core/vfprintf_internal.h +++ b/libc/src/stdio/printf_core/vfprintf_internal.h @@ -18,26 +18,26 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace internal { #ifndef LIBC_COPT_STDIO_USE_SYSTEM_FILE LIBC_INLINE int ferror_unlocked(FILE *f) { - return reinterpret_cast<__llvm_libc::File *>(f)->error_unlocked(); + return reinterpret_cast(f)->error_unlocked(); } LIBC_INLINE void flockfile(FILE *f) { - reinterpret_cast<__llvm_libc::File *>(f)->lock(); + reinterpret_cast(f)->lock(); } LIBC_INLINE void funlockfile(FILE *f) { - reinterpret_cast<__llvm_libc::File *>(f)->unlock(); + reinterpret_cast(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(f)->write_unlocked( + ptr, size * nmemb); } #else // defined(LIBC_COPT_STDIO_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 82049426f7eff7..35cafacd5a8c1e 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 #include -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 5f8091aec58a28..c831ca14c9d917 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 -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 1cf05de5a49d1b..1d4ff9916ee5f5 100644 --- a/libc/src/stdio/printf_core/writer.h +++ b/libc/src/stdio/printf_core/writer.h @@ -17,7 +17,7 @@ #include -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 f21cad0220ecb5..a8fb5b7fa97eb1 100644 --- a/libc/src/stdio/putc.h +++ b/libc/src/stdio/putc.h @@ -11,10 +11,10 @@ #include -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 e6df8285e8b1f7..99a7453efb11dc 100644 --- a/libc/src/stdio/putchar.h +++ b/libc/src/stdio/putchar.h @@ -11,10 +11,10 @@ #include -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 fa5d6f77356aab..11fbd0be897cfa 100644 --- a/libc/src/stdio/puts.h +++ b/libc/src/stdio/puts.h @@ -11,10 +11,10 @@ #include -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 4862799bdc69b7..8c52fe5eee8e87 100644 --- a/libc/src/stdio/remove.h +++ b/libc/src/stdio/remove.h @@ -11,10 +11,10 @@ #include -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 67c6e19a6ec5fd..3a9fafab38be3a 100644 --- a/libc/src/stdio/scanf.cpp +++ b/libc/src/stdio/scanf.cpp @@ -16,12 +16,12 @@ #include #ifndef LIBC_COPT_STDIO_USE_SYSTEM_FILE -#define SCANF_STDIN __llvm_libc::stdin +#define SCANF_STDIN LIBC_NAMESPACE::stdin #else // LIBC_COPT_STDIO_USE_SYSTEM_FILE #define SCANF_STDIN ::stdin #endif // LIBC_COPT_STDIO_USE_SYSTEM_FILE -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, scanf, (const char *__restrict format, ...)) { va_list vlist; @@ -37,4 +37,4 @@ LLVM_LIBC_FUNCTION(int, scanf, (const char *__restrict format, ...)) { 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 6b4ece12a37f53..58e42d1fac185a 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 5d7b7aaec3488f..5334af1be98e18 100644 --- a/libc/src/stdio/scanf_core/converter.cpp +++ b/libc/src/stdio/scanf_core/converter.cpp @@ -22,7 +22,7 @@ #include -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 cd91ff66a3aedd..f741840da304e0 100644 --- a/libc/src/stdio/scanf_core/converter.h +++ b/libc/src/stdio/scanf_core/converter.h @@ -15,7 +15,7 @@ #include -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 a2e36e6520bb12..a14f35796d27f2 100644 --- a/libc/src/stdio/scanf_core/converter_utils.h +++ b/libc/src/stdio/scanf_core/converter_utils.h @@ -17,7 +17,7 @@ #include -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 4555595ab3bff6..246f770e0cabed 100644 --- a/libc/src/stdio/scanf_core/core_structs.h +++ b/libc/src/stdio/scanf_core/core_structs.h @@ -16,7 +16,7 @@ #include #include -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 be4b6553b89dc5..fd62383e394092 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 -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/float_converter.cpp b/libc/src/stdio/scanf_core/float_converter.cpp index 5ffb9b09fcfc27..47a43d58ba7c78 100644 --- a/libc/src/stdio/scanf_core/float_converter.cpp +++ b/libc/src/stdio/scanf_core/float_converter.cpp @@ -17,7 +17,7 @@ #include -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 e8abe8d20bcea5..a3ea1da86a3f48 100644 --- a/libc/src/stdio/scanf_core/float_converter.h +++ b/libc/src/stdio/scanf_core/float_converter.h @@ -14,12 +14,12 @@ #include -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 6370c98e0f1603..05d6ed6e0fd352 100644 --- a/libc/src/stdio/scanf_core/int_converter.cpp +++ b/libc/src/stdio/scanf_core/int_converter.cpp @@ -16,7 +16,7 @@ #include -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 af5ab3e060a7bc..7c9d8b4fbae323 100644 --- a/libc/src/stdio/scanf_core/int_converter.h +++ b/libc/src/stdio/scanf_core/int_converter.h @@ -14,12 +14,12 @@ #include -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.h b/libc/src/stdio/scanf_core/parser.h index f0cebc8de1c362..7f3a53be357008 100644 --- a/libc/src/stdio/scanf_core/parser.h +++ b/libc/src/stdio/scanf_core/parser.h @@ -18,7 +18,7 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace scanf_core { #ifndef LIBC_COPT_SCANF_DISABLE_INDEX_MODE @@ -280,6 +280,6 @@ template 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 31d6476a2da1ba..cc233c36562904 100644 --- a/libc/src/stdio/scanf_core/ptr_converter.cpp +++ b/libc/src/stdio/scanf_core/ptr_converter.cpp @@ -15,7 +15,7 @@ #include -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 642898c1db18f2..363d9aacde7be8 100644 --- a/libc/src/stdio/scanf_core/ptr_converter.h +++ b/libc/src/stdio/scanf_core/ptr_converter.h @@ -14,12 +14,12 @@ #include -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 45241d8d86b01f..eca0e3784dc8d1 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 -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace scanf_core { void Reader::ungetc(char c) { @@ -25,4 +25,4 @@ void Reader::ungetc(char c) { stream_ungetc(static_cast(c), input_stream); } } // 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 7e9cfc5c8ca2fb..d8647fe2c4ec7b 100644 --- a/libc/src/stdio/scanf_core/reader.h +++ b/libc/src/stdio/scanf_core/reader.h @@ -12,7 +12,7 @@ #include "src/__support/macros/attributes.h" // For LIBC_INLINE #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace scanf_core { using StreamGetc = int (*)(void *); @@ -67,6 +67,6 @@ class Reader { }; } // 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 ba6a92c41eea3e..dc7740d64b665b 100644 --- a/libc/src/stdio/scanf_core/scanf_main.cpp +++ b/libc/src/stdio/scanf_core/scanf_main.cpp @@ -16,7 +16,7 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace scanf_core { int scanf_main(Reader *reader, const char *__restrict str, @@ -42,4 +42,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 d1db46b7c77dc1..f1688d648ccc88 100644 --- a/libc/src/stdio/scanf_core/scanf_main.h +++ b/libc/src/stdio/scanf_core/scanf_main.h @@ -14,13 +14,13 @@ #include -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 bdbb5c87f75e55..94a7fc4e5fe0d3 100644 --- a/libc/src/stdio/scanf_core/string_converter.cpp +++ b/libc/src/stdio/scanf_core/string_converter.cpp @@ -15,7 +15,7 @@ #include -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 4113f5cb9a3693..165fc47e4bdf78 100644 --- a/libc/src/stdio/scanf_core/string_converter.h +++ b/libc/src/stdio/scanf_core/string_converter.h @@ -14,12 +14,12 @@ #include -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/vfscanf_internal.h b/libc/src/stdio/scanf_core/vfscanf_internal.h index 715d31ab13eb07..8081136d471a20 100644 --- a/libc/src/stdio/scanf_core/vfscanf_internal.h +++ b/libc/src/stdio/scanf_core/vfscanf_internal.h @@ -16,23 +16,24 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace internal { #ifndef LIBC_COPT_STDIO_USE_SYSTEM_FILE LIBC_INLINE void flockfile(FILE *f) { - reinterpret_cast<__llvm_libc::File *>(f)->lock(); + reinterpret_cast(f)->lock(); } LIBC_INLINE void funlockfile(FILE *f) { - reinterpret_cast<__llvm_libc::File *>(f)->unlock(); + reinterpret_cast(f)->unlock(); } LIBC_INLINE int getc(void *f) { unsigned char c; - auto result = reinterpret_cast<__llvm_libc::File *>(f)->read_unlocked(&c, 1); + auto result = + reinterpret_cast(f)->read_unlocked(&c, 1); size_t r = result.value; if (result.has_error() || r != 1) return '\0'; @@ -41,11 +42,11 @@ LIBC_INLINE int getc(void *f) { } LIBC_INLINE void ungetc(int c, void *f) { - reinterpret_cast<__llvm_libc::File *>(f)->ungetc_unlocked(c); + reinterpret_cast(f)->ungetc_unlocked(c); } LIBC_INLINE int ferror_unlocked(FILE *f) { - return reinterpret_cast<__llvm_libc::File *>(f)->error_unlocked(); + return reinterpret_cast(f)->error_unlocked(); } #else // defined(LIBC_COPT_STDIO_USE_SYSTEM_FILE) @@ -83,6 +84,6 @@ LIBC_INLINE int vfscanf_internal(::FILE *__restrict stream, return retval; } } // 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 cb30fe3065f0a7..8819901849a08f 100644 --- a/libc/src/stdio/setbuf.cpp +++ b/libc/src/stdio/setbuf.cpp @@ -12,17 +12,17 @@ #include "src/errno/libc_errno.h" #include -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(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 7a158ac0f173e3..9c7aab95d2c9e3 100644 --- a/libc/src/stdio/setbuf.h +++ b/libc/src/stdio/setbuf.h @@ -11,10 +11,10 @@ #include -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 9080c55cf9581c..5fdaebcdb75c2b 100644 --- a/libc/src/stdio/setvbuf.cpp +++ b/libc/src/stdio/setvbuf.cpp @@ -12,16 +12,16 @@ #include "src/errno/libc_errno.h" #include -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(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 bceedd8b44113a..21d9c9918ffa12 100644 --- a/libc/src/stdio/setvbuf.h +++ b/libc/src/stdio/setvbuf.h @@ -11,11 +11,11 @@ #include -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 4e1973fe9be3d1..fbfc2b21803263 100644 --- a/libc/src/stdio/snprintf.cpp +++ b/libc/src/stdio/snprintf.cpp @@ -15,7 +15,7 @@ #include #include -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 ec223be0e7baa6..0e4e398abc391b 100644 --- a/libc/src/stdio/snprintf.h +++ b/libc/src/stdio/snprintf.h @@ -11,11 +11,11 @@ #include -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 3e4206be0aa698..11f2f1a8634ff2 100644 --- a/libc/src/stdio/sprintf.cpp +++ b/libc/src/stdio/sprintf.cpp @@ -15,7 +15,7 @@ #include -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 234de6e165223d..14bb4fa121f42f 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 1f3e5ba888cd8f..9bbd813514ffa0 100644 --- a/libc/src/stdio/sscanf.cpp +++ b/libc/src/stdio/sscanf.cpp @@ -16,7 +16,7 @@ #include #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, sscanf, (const char *__restrict buffer, @@ -36,4 +36,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 7f63638e4c1d90..9e4b28e0033cf9 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 de6ce0ba0683d3..ccfbfb0121c86f 100644 --- a/libc/src/stdio/ungetc.cpp +++ b/libc/src/stdio/ungetc.cpp @@ -11,10 +11,10 @@ #include -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(stream)->ungetc(c); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdio/ungetc.h b/libc/src/stdio/ungetc.h index b5b7acb5962c19..c24d8e5600cadf 100644 --- a/libc/src/stdio/ungetc.h +++ b/libc/src/stdio/ungetc.h @@ -11,10 +11,10 @@ #include -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 aa56c26b46d6a2..2504ce8a20bac5 100644 --- a/libc/src/stdio/vfprintf.cpp +++ b/libc/src/stdio/vfprintf.cpp @@ -15,7 +15,7 @@ #include #include -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 b4a2d5e24042c6..01827c59d6ce15 100644 --- a/libc/src/stdio/vfprintf.h +++ b/libc/src/stdio/vfprintf.h @@ -12,11 +12,11 @@ #include #include -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 0789ee9cfc3c29..eff968d1e9134f 100644 --- a/libc/src/stdio/vprintf.cpp +++ b/libc/src/stdio/vprintf.cpp @@ -16,12 +16,12 @@ #include #ifndef LIBC_COPT_STDIO_USE_SYSTEM_FILE -#define PRINTF_STDOUT __llvm_libc::stdout +#define PRINTF_STDOUT LIBC_NAMESPACE::stdout #else // LIBC_COPT_STDIO_USE_SYSTEM_FILE #define PRINTF_STDOUT ::stdout #endif // LIBC_COPT_STDIO_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 ffc5d39eaede89..fe4252bd86203b 100644 --- a/libc/src/stdio/vprintf.h +++ b/libc/src/stdio/vprintf.h @@ -12,10 +12,10 @@ #include #include -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 0dc34a83fd441d..9446d3b223506b 100644 --- a/libc/src/stdio/vsnprintf.cpp +++ b/libc/src/stdio/vsnprintf.cpp @@ -15,7 +15,7 @@ #include #include -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 caa381e8383ad1..6da25fc66f7920 100644 --- a/libc/src/stdio/vsnprintf.h +++ b/libc/src/stdio/vsnprintf.h @@ -12,11 +12,11 @@ #include #include -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 cf86f92ced4c31..5ebdf9a2a539fe 100644 --- a/libc/src/stdio/vsprintf.cpp +++ b/libc/src/stdio/vsprintf.cpp @@ -15,7 +15,7 @@ #include -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 a129a2a420c2b8..fe8def5994214a 100644 --- a/libc/src/stdio/vsprintf.h +++ b/libc/src/stdio/vsprintf.h @@ -11,11 +11,11 @@ #include -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 5aec134b1c71c2..85684d1e90879e 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 f4ae3266ff3019..bc05fafeb766b2 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 d1e4385b6c6e23..d3bf1e9e477c2b 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 eef7937067eb88..6be63e0468f527 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 42ef7f885ed654..19cef1446bd36d 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 118c46a72723c8..10dff42b1be925 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(callback)}); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdlib/atexit.h b/libc/src/stdlib/atexit.h index 920d1eb9cf2773..7cf9d7c92191dd 100644 --- a/libc/src/stdlib/atexit.h +++ b/libc/src/stdlib/atexit.h @@ -11,12 +11,12 @@ #include // 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 2359ce7cc8e2a4..61eb7db0056f18 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(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 c897a7e410ae5d..cc9ae5157d6a52 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 eec15aa95671b3..d1dc3203d3c570 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(result); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdlib/atoi.h b/libc/src/stdlib/atoi.h index bb6c978d42f327..fb5de31860d02d 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 78928e81fa20f6..5586db7838c6b4 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(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 8ba6337aa6ebaf..690731f8714d89 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 50472261dca25d..921459ddc3ac30 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(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 d99184fdd0591a..4746eb1e5e3075 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 f3164ce5f09fcc..4dd85367411e64 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 a298e516ae7013..4292d6b6fe0465 100644 --- a/libc/src/stdlib/bsearch.cpp +++ b/libc/src/stdlib/bsearch.cpp @@ -11,7 +11,7 @@ #include -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 aab86dcd71984a..1de7e051ff6c41 100644 --- a/libc/src/stdlib/bsearch.h +++ b/libc/src/stdlib/bsearch.h @@ -11,11 +11,11 @@ #include -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 44f1d9fd1bb9d7..ee7c335bdb7fd2 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 46d59485bf517b..3a6853f7c95f53 100644 --- a/libc/src/stdlib/div.h +++ b/libc/src/stdlib/div.h @@ -11,10 +11,10 @@ #include -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 6e2f1042738cfd..cc5ae6648d11f2 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 cbd9f9720cd39d..b13573547fbf89 100644 --- a/libc/src/stdlib/exit.h +++ b/libc/src/stdlib/exit.h @@ -11,10 +11,10 @@ #include -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 81299376f9735a..f802f1d192d810 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 bb29e2c79969d3..08397e0d805716 100644 --- a/libc/src/stdlib/getenv.cpp +++ b/libc/src/stdlib/getenv.cpp @@ -13,19 +13,19 @@ #include // For size_t. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(char *, getenv, (const char *name)) { - char **env_ptr = reinterpret_cast(__llvm_libc::app.envPtr); + char **env_ptr = reinterpret_cast(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 a7eac3172de84f..adb386b18ca81d 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 441e776efd2349..f3b052be6d24db 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 64b60384581f79..3a41e5febad0bb 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(); @@ -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 c63b8383f6b163..a2196907830513 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 a32f3055c33325..d9237fad910c58 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 0f0ea99dc22a7c..b7af538cd52c03 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 b08dc65c7c7e23..57e2250063375b 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 ab2fe0961b32eb..0f0fafa7498b5e 100644 --- a/libc/src/stdlib/ldiv.h +++ b/libc/src/stdlib/ldiv.h @@ -11,10 +11,10 @@ #include -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 1da81611273dea..59feec3e5a06df 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 a72f3625567d84..f42c2b8a993dd0 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 f173431a14f15c..953fe1709c1a70 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 ef3d037f1ded21..ff2fdf8eff33dd 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 b361e4e1aaa363..ee7f4d37c74693 100644 --- a/libc/src/stdlib/lldiv.h +++ b/libc/src/stdlib/lldiv.h @@ -10,10 +10,10 @@ #include -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 ecdf9c0145a963..514e2b133c7b17 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 73cf5f894aacd4..f040f375ea59e7 100644 --- a/libc/src/stdlib/qsort.cpp +++ b/libc/src/stdlib/qsort.cpp @@ -12,7 +12,7 @@ #include -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 d716089e484df2..5c78481ad70131 100644 --- a/libc/src/stdlib/qsort.h +++ b/libc/src/stdlib/qsort.h @@ -11,11 +11,11 @@ #include -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 add030879655a3..758991848eff87 100644 --- a/libc/src/stdlib/qsort_r.cpp +++ b/libc/src/stdlib/qsort_r.cpp @@ -12,7 +12,7 @@ #include -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 a998b053393601..fab0576ed803f0 100644 --- a/libc/src/stdlib/qsort_r.h +++ b/libc/src/stdlib/qsort_r.h @@ -11,7 +11,7 @@ #include -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 e9aefe448405f9..f4b8094d05a9a7 100644 --- a/libc/src/stdlib/qsort_util.h +++ b/libc/src/stdlib/qsort_util.h @@ -13,7 +13,7 @@ #include #include -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 771944f8b336fb..c5737a8b845477 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((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 b421161f6388ff..72bb147849851c 100644 --- a/libc/src/stdlib/rand.h +++ b/libc/src/stdlib/rand.h @@ -11,10 +11,10 @@ #include -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 dac8dca2804e1c..fc2cd304e77d29 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 4cbfa1478ef7bb..55c36a45bbc6b9 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 d93d86712ecd10..008c7a9e565e41 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 ff2f138ea22223..1bcf8de78c0a4f 100644 --- a/libc/src/stdlib/srand.h +++ b/libc/src/stdlib/srand.h @@ -11,10 +11,10 @@ #include -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 eb3f290487c4ab..db5e0edefb5b38 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 1a8b9dcc95b999..5efad845fdee34 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 f4b90e860c817b..2cc8829f63d34c 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 3ebbd1112483b0..d800b2233cf8e5 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 fb02353d093891..e9bedf23716682 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 741c4e80281486..c46c650dc5b3ed 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 01cbb7fc214721..7378963f21b240 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 47e8732068d45f..6a0b5d450b58bd 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 f4f9754f40df59..99e82056bcb5b7 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 63d7335b88dbea..d699785bfd7104 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 c3b1b93c2fd5bc..f50ed7ea2dc36f 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 6aee32f48f6e19..af839928d1b0c3 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 9bf3d0b78c112c..de3a0d04b2cb1c 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 b64c7be1eb972a..47ed1019834ce3 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 c373868deb4273..4112b7931d103b 100644 --- a/libc/src/string/allocating_string_utils.h +++ b/libc/src/string/allocating_string_utils.h @@ -17,7 +17,7 @@ #include // For size_t -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace internal { LIBC_INLINE cpp::optional strdup(const char *src) { @@ -33,6 +33,6 @@ LIBC_INLINE cpp::optional 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 26ae302b10b865..f18fa0c883eecd 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 6503240319ed28..711aecf083501f 100644 --- a/libc/src/string/bcmp.h +++ b/libc/src/string/bcmp.h @@ -11,10 +11,10 @@ #include // 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 758f01ae2bf75e..9399d332dff7f4 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 12de749d4640db..ec4d8cde1c6cb9 100644 --- a/libc/src/string/bcopy.h +++ b/libc/src/string/bcopy.h @@ -11,10 +11,10 @@ #include // 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 cb6da5628ec13c..c833cd8c2116db 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(ptr), count); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/string/bzero.h b/libc/src/string/bzero.h index 064800bad29b55..3f52fe2128052b 100644 --- a/libc/src/string/bzero.h +++ b/libc/src/string/bzero.h @@ -11,10 +11,10 @@ #include // 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 0ea2f752e30c59..4b2a3527d0ad82 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 7b246109d46f96..993f060b6ac86b 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 989a24d0852c6c..200384e9f61902 100644 --- a/libc/src/string/memccpy.cpp +++ b/libc/src/string/memccpy.cpp @@ -11,7 +11,7 @@ #include "src/__support/common.h" #include // 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 38a80b1d691156..ce12dfbddc2899 100644 --- a/libc/src/string/memccpy.h +++ b/libc/src/string/memccpy.h @@ -11,11 +11,11 @@ #include -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 a2a537680920d8..918bdd957b4133 100644 --- a/libc/src/string/memchr.cpp +++ b/libc/src/string/memchr.cpp @@ -12,7 +12,7 @@ #include "src/__support/common.h" #include -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(c), n); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/string/memchr.h b/libc/src/string/memchr.h index 369475305236da..b84c8317be55e4 100644 --- a/libc/src/string/memchr.h +++ b/libc/src/string/memchr.h @@ -11,10 +11,10 @@ #include -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 dca2ee803bd9e5..adfbc1eca326a9 100644 --- a/libc/src/string/memcmp.cpp +++ b/libc/src/string/memcmp.cpp @@ -11,11 +11,11 @@ #include // 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 1d79df5d459185..f2c1dd3541cb21 100644 --- a/libc/src/string/memcmp.h +++ b/libc/src/string/memcmp.h @@ -11,10 +11,10 @@ #include // 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 5ec6176f7f7fb7..e6cf978dc3bc6e 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 f643f1de6294ef..ea34a2d3d87548 100644 --- a/libc/src/string/memcpy.h +++ b/libc/src/string/memcpy.h @@ -11,10 +11,10 @@ #include // 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 af864985e1026c..067ea2ef9e7e51 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 2809fd5c6cdf57..b1f84c8cf32345 100644 --- a/libc/src/string/memmem.h +++ b/libc/src/string/memmem.h @@ -11,11 +11,11 @@ #include // 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 9e75ef77eff240..7d473afc0b42ee 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 // 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 2f03a127f5a948..4d78aadbd6620c 100644 --- a/libc/src/string/memmove.h +++ b/libc/src/string/memmove.h @@ -11,10 +11,10 @@ #include // 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 e2e8cb19f66353..8e0827f1361fe4 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 // 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 174e812c64878f..839c8ec13854f2 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 6ee2c2b20b732e..0a159f476cd61c 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 // 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 7c9fa41c1db0de..ca28655c916820 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 // 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 6b73e5f4d617fd..91512acce6fc07 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 // 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 0a333d1fe866b8..4238167e54d644 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 // 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 023291158464af..a666c5da313604 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 // 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 d931b4192133d4..b1c981d859e022 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(LIBC_SRC_STRING_MEMORY_UTILS_BCMP( reinterpret_cast(p1), reinterpret_cast(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 af90aede1dea58..ed83cab68b2fd1 100644 --- a/libc/src/string/memory_utils/inline_bzero.h +++ b/libc/src/string/memory_utils/inline_bzero.h @@ -14,7 +14,7 @@ #include // 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(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 4182fbbf72cff4..d88d43691daee8 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(LIBC_SRC_STRING_MEMORY_UTILS_MEMCMP( reinterpret_cast(p1), reinterpret_cast(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 55f861a8047be0..0b8a7848da87b4 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(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 9c09f945b65530..eaddee57aef54f 100644 --- a/libc/src/string/memory_utils/inline_memmem.h +++ b/libc/src/string/memory_utils/inline_memmem.h @@ -13,7 +13,7 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { template 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 c520b6f4de0cdf..0d31e10eaff28e 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(dst), reinterpret_cast(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 524224c110dd4b..f20ae45fa753b4 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(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 ccb315d744b15b..2bcd56ad3d6b0b 100644 --- a/libc/src/string/memory_utils/inline_strcmp.h +++ b/libc/src/string/memory_utils/inline_strcmp.h @@ -11,7 +11,7 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { template 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(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 f9bc6b583ecdf4..f0f8e2bbf896a7 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 -namespace __llvm_libc { +namespace LIBC_NAMESPACE { template 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(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 29d3b822a4e2a5..10de5bcfce85ae 100644 --- a/libc/src/string/memory_utils/op_aarch64.h +++ b/libc/src/string/memory_utils/op_aarch64.h @@ -24,7 +24,7 @@ #include #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 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(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 210ba601920018..cfa58e43d74550 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 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 999b7a6b541678..fd71ca30e24b93 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 constexpr size_t array_size_v = array_size::value; template T load(CPtr src) { static_assert(is_element_type_v); if constexpr (is_scalar_v || is_vector_v) { - return ::__llvm_libc::load(src); + return ::LIBC_NAMESPACE::load(src); } else if constexpr (is_array_v) { using value_type = typename T::value_type; T Value; @@ -105,7 +105,7 @@ template T load(CPtr src) { template void store(Ptr dst, T value) { static_assert(is_element_type_v); if constexpr (is_scalar_v || is_vector_v) { - ::__llvm_libc::store(dst, value); + ::LIBC_NAMESPACE::store(dst, value); } else if constexpr (is_array_v) { using value_type = typename T::value_type; for (size_t I = 0; I < array_size_v; ++I) @@ -319,7 +319,7 @@ template struct Memmove { // Making the offset explicit hints the compiler to use relevant addressing mode // consistently. template LIBC_INLINE T load(CPtr ptr, size_t offset) { - return ::__llvm_libc::load(ptr + offset); + return ::LIBC_NAMESPACE::load(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(CPtr p1, CPtr p2, size_t offset) { template <> LIBC_INLINE MemcmpReturnType cmp_neq(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 e164dfa35c002f..313d55e644cb4b 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(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 4c526dabf42ac7..1a20659c178cd1 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 7d14b335ef43aa..d66f0a7b225e68 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 // 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 437a6b43bcf0c8..0b28ad92235c1b 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 // 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 c80277acf40a77..05531c8b75972c 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 // 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 9704157f4f99f0..1c26917a96d9d1 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 // 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 c64a70a99eb151..b9b8a188aff670 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 // 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 66749465ee2849..c467ae712b638a 100644 --- a/libc/src/string/memory_utils/utils.h +++ b/libc/src/string/memory_utils/utils.h @@ -20,7 +20,7 @@ #include // size_t #include // intptr_t / uintptr_t / INT32_MAX / INT32_MIN -namespace __llvm_libc { +namespace LIBC_NAMESPACE { // Allows compile time error reporting in `if constexpr` branches. template @@ -372,6 +372,6 @@ template 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 96a22f7740a8c0..31aff86e60598e 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 // 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 2569b4ddd63dd8..d5fa77cdbbcdc0 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 7d70a552354f46..f43230ffd8ad12 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 22a088823f9ce5..95ad07f7521958 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 // 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 54ef33a0c3ade2..6436594856b0ea 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 // 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::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 535e029305f43d..47cc3d634d44ce 100644 --- a/libc/src/string/mempcpy.cpp +++ b/libc/src/string/mempcpy.cpp @@ -12,7 +12,7 @@ #include "src/__support/common.h" #include // 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(dst) + count; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/string/mempcpy.h b/libc/src/string/mempcpy.h index 6000761e177a8a..317e0fc1d1f307 100644 --- a/libc/src/string/mempcpy.h +++ b/libc/src/string/mempcpy.h @@ -11,10 +11,10 @@ #include -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 7efac04a63248c..fad086809635f0 100644 --- a/libc/src/string/memrchr.cpp +++ b/libc/src/string/memrchr.cpp @@ -10,7 +10,7 @@ #include "src/__support/common.h" #include -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(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 8f43577e331fe8..5c32d6a3ad5566 100644 --- a/libc/src/string/memrchr.h +++ b/libc/src/string/memrchr.h @@ -11,10 +11,10 @@ #include -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 3a339eca661320..a94e353421968b 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(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 e38eb7d78a976b..4c1ef9d91c71aa 100644 --- a/libc/src/string/memset.h +++ b/libc/src/string/memset.h @@ -11,10 +11,10 @@ #include // 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 520a4dbeda20f4..2c7f8dc29ea8a7 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 976d6bac93131c..a2aad85bed913d 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 22de619ae2ae29..bdaa6899302c05 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(__llvm_libc::mempcpy(dest, src, size)); + reinterpret_cast(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 84d5738f0e2ba6..4352f5b389a24c 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 e03d560bf221ae..436e131d068725 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 6320a290b1dd26..5ecf65b027cab0 100644 --- a/libc/src/string/stpncpy.h +++ b/libc/src/string/stpncpy.h @@ -11,10 +11,10 @@ #include -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 ceb81ce2fdc26e..87636ee369ebd3 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 ce0a4e5b613cca..97b1f930f32272 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 61aca70d1e018e..3119ed49c56d48 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 b69165471bfdc3..9c8ad0fb82b284 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 6af5e514c407dc..6e1baa64e66ab2 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 20e966c675df1c..3cf2e19e24fe90 100644 --- a/libc/src/string/strcat.h +++ b/libc/src/string/strcat.h @@ -11,10 +11,10 @@ #include -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 3b804e94404ecc..553197b22b2ee2 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 6f106afaf695c1..bb6a9c07b89e17 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 d8dce65dca5277..9b492a634a8ff6 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(src, c); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/string/strchrnul.h b/libc/src/string/strchrnul.h index 2ba07ac0f2a72e..b847b0bda103c9 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 aca8874b00c670..0b515b76fa85c5 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 a45f2d5ba8e5dc..9fc6fdb9f27ba8 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 d60a7a5d5915ae..7280688bf3d9dc 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(*left) - static_cast(*right); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/string/strcoll.h b/libc/src/string/strcoll.h index 5949ede61bd196..d69b48a6642c31 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 cac4f6e63037e0..4fbd1a38f6873e 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 2d2af21c704495..11a26a6fa6effa 100644 --- a/libc/src/string/strcpy.h +++ b/libc/src/string/strcpy.h @@ -11,10 +11,10 @@ #include -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 d4929c56a9b3aa..ed057c3796066f 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 9674f4b6359b06..21098feb288b8a 100644 --- a/libc/src/string/strcspn.h +++ b/libc/src/string/strcspn.h @@ -11,10 +11,10 @@ #include -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 cafa0cb6994132..3530a708c131bc 100644 --- a/libc/src/string/strdup.cpp +++ b/libc/src/string/strdup.cpp @@ -15,7 +15,7 @@ #include -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 8f83558db919f2..e33a24694bf17c 100644 --- a/libc/src/string/strdup.h +++ b/libc/src/string/strdup.h @@ -11,10 +11,10 @@ #include -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 014a51a622fdea..01cbbeb4d18f20 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(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 ce3366db529d3d..36a1348a5c737e 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 efdc8d3723c408..c514dbd740906f 100644 --- a/libc/src/string/strerror_r.cpp +++ b/libc/src/string/strerror_r.cpp @@ -12,7 +12,7 @@ #include -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(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 18b361773be450..63f595866b3b63 100644 --- a/libc/src/string/strerror_r.h +++ b/libc/src/string/strerror_r.h @@ -11,10 +11,10 @@ #include -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 e874e5f5f0a69c..17efc125ea63a7 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 // For size_t -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace internal { template 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 a718de7698838e..2943f4f67b4f90 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 7b073c67068266..47f27e3ba5ac3e 100644 --- a/libc/src/string/strlcat.h +++ b/libc/src/string/strlcat.h @@ -11,10 +11,10 @@ #include -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 fa1f10290e8ec0..9b296f2cdbb054 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 f1c8e917e9864a..0c18d856e53f0a 100644 --- a/libc/src/string/strlcpy.h +++ b/libc/src/string/strlcpy.h @@ -11,10 +11,10 @@ #include -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 c7b192bff2504e..b903928f067f95 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 b3ad03f612d0aa..4dfaf8e98cdd2c 100644 --- a/libc/src/string/strlen.h +++ b/libc/src/string/strlen.h @@ -11,10 +11,10 @@ #include -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 48445ccd317ba6..994fb258746a2f 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 c596a7afa6242c..eb1155070c6baa 100644 --- a/libc/src/string/strncasecmp.h +++ b/libc/src/string/strncasecmp.h @@ -11,10 +11,10 @@ #include -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 06e69eacd355b0..ca86d9c0a2e411 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 9b2c70fca5788a..f3d9706dc23e92 100644 --- a/libc/src/string/strncat.h +++ b/libc/src/string/strncat.h @@ -11,10 +11,10 @@ #include -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 098f9e121568fb..0d2a66879704c0 100644 --- a/libc/src/string/strncmp.cpp +++ b/libc/src/string/strncmp.cpp @@ -13,7 +13,7 @@ #include -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 056fe78e6c85c9..adb270f5cd40c3 100644 --- a/libc/src/string/strncmp.h +++ b/libc/src/string/strncmp.h @@ -11,10 +11,10 @@ #include -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 274950230f5151..1408e7f0902d44 100644 --- a/libc/src/string/strncpy.cpp +++ b/libc/src/string/strncpy.cpp @@ -11,7 +11,7 @@ #include "src/__support/common.h" #include // 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 c419df990cd781..3152fef0758c72 100644 --- a/libc/src/string/strncpy.h +++ b/libc/src/string/strncpy.h @@ -11,10 +11,10 @@ #include -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 ca1c6ec406b374..6648e22ab50e00 100644 --- a/libc/src/string/strndup.cpp +++ b/libc/src/string/strndup.cpp @@ -15,7 +15,7 @@ #include -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 0a593a709aa972..3e5c951f6c87a5 100644 --- a/libc/src/string/strndup.h +++ b/libc/src/string/strndup.h @@ -11,10 +11,10 @@ #include -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 dc208b0ac66b55..8849fa0fdd9fad 100644 --- a/libc/src/string/strnlen.cpp +++ b/libc/src/string/strnlen.cpp @@ -12,7 +12,7 @@ #include "src/__support/common.h" #include -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(temp) - src : n; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/string/strnlen.h b/libc/src/string/strnlen.h index 2d2ee9703d83da..e18d21779d94c7 100644 --- a/libc/src/string/strnlen.h +++ b/libc/src/string/strnlen.h @@ -11,10 +11,10 @@ #include -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 fc2cadc275237a..8bccda02418bc7 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(src) : nullptr; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/string/strpbrk.h b/libc/src/string/strpbrk.h index 823cd35e9e30e9..c744d09365ff4a 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 d821327a998d3c..d51808b6dd8355 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 7b85929b290b7e..d4280d85ae9b8f 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 5e6aef7ac008e0..edd2cf07e20a45 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(*stringp, delim, stringp); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/string/strsep.h b/libc/src/string/strsep.h index 1b1f28ff9c87c3..48f55a899d7f33 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 bad69b6f5415e0..f6ca0bcdad8d2b 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(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 346f3960d3aa31..bd3f87a201734c 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 9580d1bc403e8d..b957f8ed7f1bda 100644 --- a/libc/src/string/strspn.cpp +++ b/libc/src/string/strspn.cpp @@ -12,7 +12,7 @@ #include "src/__support/common.h" #include -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 92321d10df93e6..ddb6f388e95a22 100644 --- a/libc/src/string/strspn.h +++ b/libc/src/string/strspn.h @@ -11,10 +11,10 @@ #include -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 3a826784524433..bfda75b2e59129 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 463ffb7494c9e5..2501b005cf9faa 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 281197e07971d5..e7d30349d3a9c9 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 33ac68184a3317..8788f333c13065 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 d1cc675ead32b3..e8847b617330e0 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 f1aff3e3176a08..b3c7b3dec162a9 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 a37c220b360384..b5eb76457f8586 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 1ca1e731e9df18..8178931f42dc92 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 // 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 af98e0bc86bf65..ff461c1d4cb48b 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 // 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 ret = LIBC_NAMESPACE::syscall_impl( SYS_madvise, reinterpret_cast(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 dde11055ccbbe8..16111c66859f5e 100644 --- a/libc/src/sys/mman/linux/mmap.cpp +++ b/libc/src/sys/mman/linux/mmap.cpp @@ -15,7 +15,7 @@ #include // For EXEC_PAGESIZE. #include // 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(addr), - size, prot, flags, fd, offset); + LIBC_NAMESPACE::syscall_impl(syscall_number, reinterpret_cast(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(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 360c19337b0e89..2e6f2a369c1d89 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 // 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 ret = LIBC_NAMESPACE::syscall_impl( SYS_mprotect, reinterpret_cast(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 cbc48688a5038c..6412b4136c49e8 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 // 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(SYS_munmap, - reinterpret_cast(addr), size); + int ret = LIBC_NAMESPACE::syscall_impl( + SYS_munmap, reinterpret_cast(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 2f6a555779ed4a..b7b4d352c1f8a3 100644 --- a/libc/src/sys/mman/linux/posix_madvise.cpp +++ b/libc/src/sys/mman/linux/posix_madvise.cpp @@ -13,7 +13,7 @@ #include // 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 ret = LIBC_NAMESPACE::syscall_impl( SYS_madvise, reinterpret_cast(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 01470c53ee3ba2..59a03af79b5873 100644 --- a/libc/src/sys/mman/madvise.h +++ b/libc/src/sys/mman/madvise.h @@ -11,10 +11,10 @@ #include // 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 9f7fd8b9196b44..4425019c4ee1a1 100644 --- a/libc/src/sys/mman/mmap.h +++ b/libc/src/sys/mman/mmap.h @@ -11,10 +11,10 @@ #include // 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 a8bca8433ca919..2e59c7526b750b 100644 --- a/libc/src/sys/mman/mprotect.h +++ b/libc/src/sys/mman/mprotect.h @@ -11,10 +11,10 @@ #include // 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 fa11d67823f620..5d7c569043d1ad 100644 --- a/libc/src/sys/mman/munmap.h +++ b/libc/src/sys/mman/munmap.h @@ -11,10 +11,10 @@ #include // 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 c13937be16907a..b8a423bfa91914 100644 --- a/libc/src/sys/mman/posix_madvise.h +++ b/libc/src/sys/mman/posix_madvise.h @@ -11,10 +11,10 @@ #include // 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 32a2a64d6e510d..e1577d9bf1eaaf 100644 --- a/libc/src/sys/random/getrandom.h +++ b/libc/src/sys/random/getrandom.h @@ -11,10 +11,10 @@ #include -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 54fbc2880a5c41..63038ad628a104 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 // 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(SYS_getrandom, buf, buflen, flags); + LIBC_NAMESPACE::syscall_impl(SYS_getrandom, buf, buflen, flags); if (ret < 0) { libc_errno = static_cast(-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 84c056efe46729..f473e82f933be5 100644 --- a/libc/src/sys/resource/getrlimit.h +++ b/libc/src/sys/resource/getrlimit.h @@ -11,10 +11,10 @@ #include -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 62b154b18e8d79..4067beba6cd303 100644 --- a/libc/src/sys/resource/linux/getrlimit.cpp +++ b/libc/src/sys/resource/linux/getrlimit.cpp @@ -15,11 +15,11 @@ #include // For struct rlimit #include // 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(SYS_prlimit64, 0, res, nullptr, limits); + LIBC_NAMESPACE::syscall_impl(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 6bbe50a49b3dd8..06927638623428 100644 --- a/libc/src/sys/resource/linux/setrlimit.cpp +++ b/libc/src/sys/resource/linux/setrlimit.cpp @@ -15,11 +15,11 @@ #include // For struct rlimit #include // 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(SYS_prlimit64, 0, res, limits, nullptr); + LIBC_NAMESPACE::syscall_impl(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 e6dc00e35714b5..d881b599833d21 100644 --- a/libc/src/sys/resource/setrlimit.h +++ b/libc/src/sys/resource/setrlimit.h @@ -11,10 +11,10 @@ #include -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 5850c9418d822a..3f387c14ec5601 100644 --- a/libc/src/sys/select/linux/select.cpp +++ b/libc/src/sys/select/linux/select.cpp @@ -18,7 +18,7 @@ #include #include // 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(SYS_pselect6, nfds, read_set, - write_set, error_set, &ts, &pss); + int ret = LIBC_NAMESPACE::syscall_impl(SYS_pselect6, nfds, read_set, + write_set, error_set, &ts, &pss); #elif defined(SYS_pselect6_time64) - int ret = __llvm_libc::syscall_impl(SYS_pselect6_time64, nfds, read_set, - write_set, error_set, &ts, &pss); + int ret = LIBC_NAMESPACE::syscall_impl( + 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 ca81c0bbd5d746..65cd15cd365c42 100644 --- a/libc/src/sys/select/select.h +++ b/libc/src/sys/select/select.h @@ -11,11 +11,11 @@ #include -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 43ddf813e157fe..5a7c012fe997d8 100644 --- a/libc/src/sys/sendfile/linux/sendfile.cpp +++ b/libc/src/sys/sendfile/linux/sendfile.cpp @@ -15,18 +15,18 @@ #include #include // 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(SYS_sendfile, in_fd, out_fd, - offset, count); + ssize_t ret = LIBC_NAMESPACE::syscall_impl(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(SYS_sendfile64, in_fd, - out_fd, offset, count); + ssize_t ret = LIBC_NAMESPACE::syscall_impl(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 ba9bf97e3af0a2..14673bba3fbdfa 100644 --- a/libc/src/sys/sendfile/sendfile.h +++ b/libc/src/sys/sendfile/sendfile.h @@ -11,10 +11,10 @@ #include -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 7f87450f152fc7..6429fd12013ea0 100644 --- a/libc/src/sys/socket/linux/socket.cpp +++ b/libc/src/sys/socket/linux/socket.cpp @@ -16,15 +16,16 @@ #include // For SYS_SOCKET socketcall number. #include // 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(SYS_socket, domain, type, protocol); + int ret = + LIBC_NAMESPACE::syscall_impl(SYS_socket, domain, type, protocol); #elif defined(SYS_socketcall) unsigned long sockcall_args[3] = {domain, type, protocol}; - int ret = - __llvm_libc::syscall_impl(SYS_socketcall, SYS_SOCKET, sockcall_args); + int ret = LIBC_NAMESPACE::syscall_impl(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 b18aa7f388d83f..a6578989d2af8d 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 bfeaa9dbd721eb..decb44222177b0 100644 --- a/libc/src/sys/stat/chmod.h +++ b/libc/src/sys/stat/chmod.h @@ -11,10 +11,10 @@ #include -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 34c167067c08a9..611bba16fad6cc 100644 --- a/libc/src/sys/stat/fchmod.h +++ b/libc/src/sys/stat/fchmod.h @@ -11,10 +11,10 @@ #include -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 3ad9af1b185adb..e7b12693558d43 100644 --- a/libc/src/sys/stat/fchmodat.h +++ b/libc/src/sys/stat/fchmodat.h @@ -11,10 +11,10 @@ #include -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 ec559a6bf225bd..7633ee60a374e3 100644 --- a/libc/src/sys/stat/fstat.h +++ b/libc/src/sys/stat/fstat.h @@ -11,10 +11,10 @@ #include -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 9123ea549a8e33..085b91691d89f4 100644 --- a/libc/src/sys/stat/linux/chmod.cpp +++ b/libc/src/sys/stat/linux/chmod.cpp @@ -16,13 +16,14 @@ #include #include // 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(SYS_chmod, path, mode); + int ret = LIBC_NAMESPACE::syscall_impl(SYS_chmod, path, mode); #elif defined(SYS_fchmodat) - int ret = __llvm_libc::syscall_impl(SYS_fchmodat, AT_FDCWD, path, mode); + int ret = + LIBC_NAMESPACE::syscall_impl(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 fa9d857c4e00ee..cdc9cbf37ba544 100644 --- a/libc/src/sys/stat/linux/fchmod.cpp +++ b/libc/src/sys/stat/linux/fchmod.cpp @@ -16,10 +16,10 @@ #include #include // 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(SYS_fchmod, fd, mode); + int ret = LIBC_NAMESPACE::syscall_impl(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 9abb3de14a9625..43b4cf00111bab 100644 --- a/libc/src/sys/stat/linux/fchmodat.cpp +++ b/libc/src/sys/stat/linux/fchmodat.cpp @@ -15,12 +15,12 @@ #include #include // 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(SYS_fchmodat, dirfd, path, mode, flags); + LIBC_NAMESPACE::syscall_impl(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 e187e5cd48eb67..516417858569c4 100644 --- a/libc/src/sys/stat/linux/fstat.cpp +++ b/libc/src/sys/stat/linux/fstat.cpp @@ -15,7 +15,7 @@ #include #include -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 48b23065d800fe..60969160b9ba4f 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(SYS_statx, dirfd, path, flags, - ::STATX_BASIC_STATS_MASK, &xbuf); + int ret = LIBC_NAMESPACE::syscall_impl(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 15a721ba784bc6..b2698148973a5f 100644 --- a/libc/src/sys/stat/linux/lstat.cpp +++ b/libc/src/sys/stat/linux/lstat.cpp @@ -16,7 +16,7 @@ #include #include -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 1f5974c23c58c0..63b64ac091a876 100644 --- a/libc/src/sys/stat/linux/mkdir.cpp +++ b/libc/src/sys/stat/linux/mkdir.cpp @@ -16,13 +16,14 @@ #include #include // 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(SYS_mkdir, path, mode); + int ret = LIBC_NAMESPACE::syscall_impl(SYS_mkdir, path, mode); #elif defined(SYS_mkdirat) - int ret = __llvm_libc::syscall_impl(SYS_mkdirat, AT_FDCWD, path, mode); + int ret = + LIBC_NAMESPACE::syscall_impl(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 ff266b18182cc6..0128d7c081cfd2 100644 --- a/libc/src/sys/stat/linux/mkdirat.cpp +++ b/libc/src/sys/stat/linux/mkdirat.cpp @@ -15,11 +15,11 @@ #include #include // 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(SYS_mkdirat, dfd, path, mode); + int ret = LIBC_NAMESPACE::syscall_impl(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 9c3b56bff47466..c30c8b65da1e8a 100644 --- a/libc/src/sys/stat/linux/stat.cpp +++ b/libc/src/sys/stat/linux/stat.cpp @@ -15,7 +15,7 @@ #include #include -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 7d5ffa23eece6d..42bd8e932da755 100644 --- a/libc/src/sys/stat/lstat.h +++ b/libc/src/sys/stat/lstat.h @@ -11,10 +11,10 @@ #include -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 535423acff7882..9f2991d850cbc9 100644 --- a/libc/src/sys/stat/mkdir.h +++ b/libc/src/sys/stat/mkdir.h @@ -11,10 +11,10 @@ #include -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 883709cb215855..322209754fc0b7 100644 --- a/libc/src/sys/stat/mkdirat.h +++ b/libc/src/sys/stat/mkdirat.h @@ -11,10 +11,10 @@ #include -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 a272aa422439fa..5d2eba5bd74c44 100644 --- a/libc/src/sys/stat/stat.h +++ b/libc/src/sys/stat/stat.h @@ -11,10 +11,10 @@ #include -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 a73e477e0bff25..f0796b63f62e95 100644 --- a/libc/src/sys/utsname/linux/uname.cpp +++ b/libc/src/sys/utsname/linux/uname.cpp @@ -15,10 +15,10 @@ #include // For syscall numbers. #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, uname, (struct utsname * name)) { - int ret = __llvm_libc::syscall_impl(SYS_uname, name); + int ret = LIBC_NAMESPACE::syscall_impl(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 80c748aefe5c07..b347cf00f33b9f 100644 --- a/libc/src/sys/utsname/uname.h +++ b/libc/src/sys/utsname/uname.h @@ -11,10 +11,10 @@ #include -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 855d45242741cc..02e6a34c1e8b13 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 f73f57be7b18e7..84036caf0a7b3f 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 0ad83ae0d72ea7..b2e8229a525832 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 d49fb21d9b728f..abe5249b83c819 100644 --- a/libc/src/sys/wait/wait.h +++ b/libc/src/sys/wait/wait.h @@ -11,10 +11,10 @@ #include -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 91c01747ecbb5b..3205b28e968ef0 100644 --- a/libc/src/sys/wait/wait4.h +++ b/libc/src/sys/wait/wait4.h @@ -11,10 +11,10 @@ #include -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 059b2cae430472..956ad0f8c9c411 100644 --- a/libc/src/sys/wait/wait4Impl.h +++ b/libc/src/sys/wait/wait4Impl.h @@ -18,7 +18,7 @@ #include // For syscall numbers. #include -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 wait4impl(pid_t pid, int *wait_status, int options, struct rusage *usage) { #if SYS_wait4 - pid = __llvm_libc::syscall_impl(SYS_wait4, pid, wait_status, options, - usage); + pid = LIBC_NAMESPACE::syscall_impl(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 wait4impl(pid_t pid, int *wait_status, int options, options |= WEXITED; siginfo_t info; - pid = __llvm_libc::syscall_impl(SYS_waitid, idtype, pid, &info, - options, usage); + pid = LIBC_NAMESPACE::syscall_impl(SYS_waitid, idtype, pid, &info, + options, usage); if (pid >= 0) pid = info.si_pid; @@ -80,6 +80,6 @@ LIBC_INLINE ErrorOr 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 1407c7f9b0ed54..37ebf289ff072a 100644 --- a/libc/src/sys/wait/waitpid.h +++ b/libc/src/sys/wait/waitpid.h @@ -11,10 +11,10 @@ #include -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 9cd3a4bac88f89..7ea280f69da444 100644 --- a/libc/src/termios/cfgetispeed.h +++ b/libc/src/termios/cfgetispeed.h @@ -11,10 +11,10 @@ #include -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 14ff9d018bcb4a..95e3edb51b382e 100644 --- a/libc/src/termios/cfgetospeed.h +++ b/libc/src/termios/cfgetospeed.h @@ -11,10 +11,10 @@ #include -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 8d1648f10cd32c..e03a2d1ef0cf55 100644 --- a/libc/src/termios/cfsetispeed.h +++ b/libc/src/termios/cfsetispeed.h @@ -11,10 +11,10 @@ #include -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 e7bb21b38a8806..74d41abc5326df 100644 --- a/libc/src/termios/cfsetospeed.h +++ b/libc/src/termios/cfsetospeed.h @@ -11,10 +11,10 @@ #include -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 d4877e8cbc6bf0..18e34b2dcb07c9 100644 --- a/libc/src/termios/linux/cfgetispeed.cpp +++ b/libc/src/termios/linux/cfgetispeed.cpp @@ -12,10 +12,10 @@ #include -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 5fbe73de29e369..1989b3feabe975 100644 --- a/libc/src/termios/linux/cfgetospeed.cpp +++ b/libc/src/termios/linux/cfgetospeed.cpp @@ -12,10 +12,10 @@ #include -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 7beb1171b8ee4b..0e8ac55fe700e5 100644 --- a/libc/src/termios/linux/cfsetispeed.cpp +++ b/libc/src/termios/linux/cfsetispeed.cpp @@ -13,7 +13,7 @@ #include -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 327cc56428f3cc..d21f629cb74b6e 100644 --- a/libc/src/termios/linux/cfsetospeed.cpp +++ b/libc/src/termios/linux/cfsetospeed.cpp @@ -13,7 +13,7 @@ #include -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 252f63db3aa6a8..d96de72029f761 100644 --- a/libc/src/termios/linux/kernel_termios.h +++ b/libc/src/termios/linux/kernel_termios.h @@ -12,7 +12,7 @@ #include #include -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 a45a00a8909dda..c3826ff9a101c2 100644 --- a/libc/src/termios/linux/tcdrain.cpp +++ b/libc/src/termios/linux/tcdrain.cpp @@ -16,10 +16,10 @@ #include // For syscall numbers #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, tcdrain, (int fd)) { - int ret = __llvm_libc::syscall_impl(SYS_ioctl, fd, TCSBRK, 1); + int ret = LIBC_NAMESPACE::syscall_impl(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 a959cf7e9f7bf2..9753ef767e9279 100644 --- a/libc/src/termios/linux/tcflow.cpp +++ b/libc/src/termios/linux/tcflow.cpp @@ -16,10 +16,10 @@ #include // For syscall numbers #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, tcflow, (int fd, int action)) { - int ret = __llvm_libc::syscall_impl(SYS_ioctl, fd, TCXONC, action); + int ret = LIBC_NAMESPACE::syscall_impl(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 26183293142a63..9c7e8f02431e88 100644 --- a/libc/src/termios/linux/tcflush.cpp +++ b/libc/src/termios/linux/tcflush.cpp @@ -16,11 +16,11 @@ #include // For syscall numbers #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, tcflush, (int fd, int queue_selector)) { int ret = - __llvm_libc::syscall_impl(SYS_ioctl, fd, TCFLSH, queue_selector); + LIBC_NAMESPACE::syscall_impl(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 931591c73b2b7b..254c48521bb908 100644 --- a/libc/src/termios/linux/tcgetattr.cpp +++ b/libc/src/termios/linux/tcgetattr.cpp @@ -17,11 +17,11 @@ #include // For syscall numbers #include -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(SYS_ioctl, fd, TCGETS, &kt); + LIBC_NAMESPACE::kernel_termios kt; + int ret = LIBC_NAMESPACE::syscall_impl(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 9afbc91ad38d58..7b2abf8f4cf08c 100644 --- a/libc/src/termios/linux/tcgetsid.cpp +++ b/libc/src/termios/linux/tcgetsid.cpp @@ -16,11 +16,11 @@ #include // For syscall numbers #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(pid_t, tcgetsid, (int fd)) { pid_t sid; - int ret = __llvm_libc::syscall_impl(SYS_ioctl, fd, TIOCGSID, &sid); + int ret = LIBC_NAMESPACE::syscall_impl(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 a2467f06c14865..fdd3f8adf7d8d3 100644 --- a/libc/src/termios/linux/tcsendbreak.cpp +++ b/libc/src/termios/linux/tcsendbreak.cpp @@ -16,13 +16,13 @@ #include // For syscall numbers #include -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(SYS_ioctl, fd, TCSBRK, 0); + int ret = LIBC_NAMESPACE::syscall_impl(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 d3872b1138816d..ba500a00210d99 100644 --- a/libc/src/termios/linux/tcsetattr.cpp +++ b/libc/src/termios/linux/tcsetattr.cpp @@ -17,7 +17,7 @@ #include // For syscall numbers #include -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(SYS_ioctl, fd, cmd, &kt); + int ret = LIBC_NAMESPACE::syscall_impl(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 1bde86d890b0fe..52042063108cc5 100644 --- a/libc/src/termios/tcdrain.h +++ b/libc/src/termios/tcdrain.h @@ -11,10 +11,10 @@ #include -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 4040c2724d56ce..267d3f682d7b2e 100644 --- a/libc/src/termios/tcflow.h +++ b/libc/src/termios/tcflow.h @@ -11,10 +11,10 @@ #include -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 61fec9baae1a89..d631ca21379e90 100644 --- a/libc/src/termios/tcflush.h +++ b/libc/src/termios/tcflush.h @@ -11,10 +11,10 @@ #include -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 61fdcdbdfd8b92..c39aa4135256d1 100644 --- a/libc/src/termios/tcgetattr.h +++ b/libc/src/termios/tcgetattr.h @@ -11,10 +11,10 @@ #include -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 1d8934764a7af3..07dbb22b167756 100644 --- a/libc/src/termios/tcgetsid.h +++ b/libc/src/termios/tcgetsid.h @@ -11,10 +11,10 @@ #include -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 52d72435ab129f..487fdad5048042 100644 --- a/libc/src/termios/tcsendbreak.h +++ b/libc/src/termios/tcsendbreak.h @@ -11,10 +11,10 @@ #include -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 a7fdfd7d57625f..d514ac71210bb3 100644 --- a/libc/src/termios/tcsetattr.h +++ b/libc/src/termios/tcsetattr.h @@ -11,10 +11,10 @@ #include -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 67ab34509a4c94..2d91094b120918 100644 --- a/libc/src/threads/call_once.cpp +++ b/libc/src/threads/call_once.cpp @@ -12,7 +12,7 @@ #include // 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(func)); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/threads/call_once.h b/libc/src/threads/call_once.h index c1e1a71da2d5c5..186d63cecdbdd2 100644 --- a/libc/src/threads/call_once.h +++ b/libc/src/threads/call_once.h @@ -11,10 +11,10 @@ #include -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 fd021956b7f664..4e996f22748f3f 100644 --- a/libc/src/threads/cnd_broadcast.h +++ b/libc/src/threads/cnd_broadcast.h @@ -11,10 +11,10 @@ #include -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 3400257529e38e..d102e7b83e7bca 100644 --- a/libc/src/threads/cnd_destroy.h +++ b/libc/src/threads/cnd_destroy.h @@ -11,10 +11,10 @@ #include -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 826564b0498634..c4fc02f5f9e7ef 100644 --- a/libc/src/threads/cnd_init.h +++ b/libc/src/threads/cnd_init.h @@ -11,10 +11,10 @@ #include -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 ec2a9772199770..4c60a9295299cf 100644 --- a/libc/src/threads/cnd_signal.h +++ b/libc/src/threads/cnd_signal.h @@ -11,10 +11,10 @@ #include -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 812e70425060f7..5d2cdbb68c78f0 100644 --- a/libc/src/threads/cnd_wait.h +++ b/libc/src/threads/cnd_wait.h @@ -11,10 +11,10 @@ #include -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 535f7299fcc04c..b4afdef9f9eba7 100644 --- a/libc/src/threads/linux/CndVar.h +++ b/libc/src/threads/linux/CndVar.h @@ -19,7 +19,7 @@ #include // For syscall numbers. #include // 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(FUTEX_SYSCALL_ID, &waiter.futex_word.val, - FUTEX_WAIT, WS_Waiting, 0, 0, 0); + LIBC_NAMESPACE::syscall_impl(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( + LIBC_NAMESPACE::syscall_impl( 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( + LIBC_NAMESPACE::syscall_impl( 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 53e2858d574722..4b426ac51ad17a 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 a3c0131ff78f18..5cdd8ebfd190ea 100644 --- a/libc/src/threads/linux/call_once.cpp +++ b/libc/src/threads/linux/call_once.cpp @@ -19,7 +19,7 @@ #include // For syscall numbers. #include // 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 7b7c8f3b1cfd9c..180ac6d68ee864 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(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 947c5be0bcd8ca..08eb3a1057b112 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(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 5e3156de93708d..5e3f360b1d2b99 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(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 6099b13ed987f1..dba01abdefbc94 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(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 5c0aed7be76da0..db3d7f1436eb76 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(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 64327003bfc585..5ee4777f5b2c2e 100644 --- a/libc/src/threads/mtx_destroy.cpp +++ b/libc/src/threads/mtx_destroy.cpp @@ -12,8 +12,8 @@ #include // 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 353bc27453bacb..1abf5d572f5dc9 100644 --- a/libc/src/threads/mtx_destroy.h +++ b/libc/src/threads/mtx_destroy.h @@ -11,10 +11,10 @@ #include -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 188209c9d37184..74d08d33b116b9 100644 --- a/libc/src/threads/mtx_init.cpp +++ b/libc/src/threads/mtx_init.cpp @@ -12,7 +12,7 @@ #include // 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 8fcaa42a2307d1..69294d79666638 100644 --- a/libc/src/threads/mtx_init.h +++ b/libc/src/threads/mtx_init.h @@ -11,10 +11,10 @@ #include -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 58379f6f9d0fd9..013a88a8e02b7a 100644 --- a/libc/src/threads/mtx_lock.cpp +++ b/libc/src/threads/mtx_lock.cpp @@ -12,7 +12,7 @@ #include // 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 df3ec0dccbdb72..15c9e1a12545fb 100644 --- a/libc/src/threads/mtx_lock.h +++ b/libc/src/threads/mtx_lock.h @@ -11,10 +11,10 @@ #include -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 f5c6a136d9dba1..a72ee4427c5a9e 100644 --- a/libc/src/threads/mtx_unlock.cpp +++ b/libc/src/threads/mtx_unlock.cpp @@ -12,7 +12,7 @@ #include // 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 b58df6392265e4..54fb034a04a21e 100644 --- a/libc/src/threads/mtx_unlock.h +++ b/libc/src/threads/mtx_unlock.h @@ -11,10 +11,10 @@ #include -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 8ec3cf1c3fcd9e..06cba84eb8646a 100644 --- a/libc/src/threads/thrd_create.cpp +++ b/libc/src/threads/thrd_create.cpp @@ -13,14 +13,14 @@ #include #include // 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(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 9ed19c48c0a4e1..0efa6f58c47eaf 100644 --- a/libc/src/threads/thrd_create.h +++ b/libc/src/threads/thrd_create.h @@ -11,10 +11,10 @@ #include -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 e8afd7bf6c49ab..b5ea0432aa5231 100644 --- a/libc/src/threads/thrd_current.cpp +++ b/libc/src/threads/thrd_current.cpp @@ -12,9 +12,9 @@ #include // 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 338a16dc56e9d4..2125729ccffebf 100644 --- a/libc/src/threads/thrd_current.h +++ b/libc/src/threads/thrd_current.h @@ -11,10 +11,10 @@ #include -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 20c6540faa17c9..17731c638bd528 100644 --- a/libc/src/threads/thrd_detach.cpp +++ b/libc/src/threads/thrd_detach.cpp @@ -12,9 +12,9 @@ #include // 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 58d36e86380adf..64f2094acd65db 100644 --- a/libc/src/threads/thrd_detach.h +++ b/libc/src/threads/thrd_detach.h @@ -11,10 +11,10 @@ #include -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 aac220ec9adb40..b9717cf121b04b 100644 --- a/libc/src/threads/thrd_equal.cpp +++ b/libc/src/threads/thrd_equal.cpp @@ -12,9 +12,9 @@ #include // 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 9e1bebc0afe5e6..5878ea458ba412 100644 --- a/libc/src/threads/thrd_equal.h +++ b/libc/src/threads/thrd_equal.h @@ -11,10 +11,10 @@ #include -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 9935c23bba1eba..67a7a419cf99a7 100644 --- a/libc/src/threads/thrd_exit.cpp +++ b/libc/src/threads/thrd_exit.cpp @@ -12,13 +12,13 @@ #include // 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 4cc835118a8523..19eb027d0357ac 100644 --- a/libc/src/threads/thrd_exit.h +++ b/libc/src/threads/thrd_exit.h @@ -11,10 +11,10 @@ #include -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 e4cf5522db92f7..cc8ba4b97a3a59 100644 --- a/libc/src/threads/thrd_join.cpp +++ b/libc/src/threads/thrd_join.cpp @@ -12,9 +12,9 @@ #include // 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 d86529c8cb9759..21a398c6e8352b 100644 --- a/libc/src/threads/thrd_join.h +++ b/libc/src/threads/thrd_join.h @@ -11,10 +11,10 @@ #include -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 f384565fbb9d16..ddea44dce301dd 100644 --- a/libc/src/threads/tss_create.cpp +++ b/libc/src/threads/tss_create.cpp @@ -13,14 +13,14 @@ #include -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 967bdca10c4fe1..def903e29e06e4 100644 --- a/libc/src/threads/tss_create.h +++ b/libc/src/threads/tss_create.h @@ -11,10 +11,10 @@ #include -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 6bdd4aa91867e8..a2a4e9aa349bab 100644 --- a/libc/src/threads/tss_delete.cpp +++ b/libc/src/threads/tss_delete.cpp @@ -13,10 +13,10 @@ #include -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 1f55d3ba69f595..3efc0d745dd14f 100644 --- a/libc/src/threads/tss_delete.h +++ b/libc/src/threads/tss_delete.h @@ -11,10 +11,10 @@ #include -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 4596a9337ffcce..9b8c94fbeba284 100644 --- a/libc/src/threads/tss_get.cpp +++ b/libc/src/threads/tss_get.cpp @@ -13,8 +13,8 @@ #include -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 4cedce988333fd..dfdb79cf122b6d 100644 --- a/libc/src/threads/tss_get.h +++ b/libc/src/threads/tss_get.h @@ -11,10 +11,10 @@ #include -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 977168a2a98cfd..640896d14e1c7b 100644 --- a/libc/src/threads/tss_set.cpp +++ b/libc/src/threads/tss_set.cpp @@ -13,7 +13,7 @@ #include -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 49d69efa62ade3..249607fdc700eb 100644 --- a/libc/src/threads/tss_set.h +++ b/libc/src/threads/tss_set.h @@ -11,10 +11,10 @@ #include -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 3ccfb042e14498..9958903d043cf6 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 f053ad23eb4e3a..941cd70250e362 100644 --- a/libc/src/time/asctime.h +++ b/libc/src/time/asctime.h @@ -11,10 +11,10 @@ #include -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 f957dac3668364..19a21241829ffd 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 21bba7ebaa3f54..04d3c01ddd2b76 100644 --- a/libc/src/time/asctime_r.h +++ b/libc/src/time/asctime_r.h @@ -11,10 +11,10 @@ #include -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 7a259e6f4b8955..d4af7656644a01 100644 --- a/libc/src/time/clock.h +++ b/libc/src/time/clock.h @@ -11,10 +11,10 @@ #include -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 a131251bac973c..72e2e1949feb69 100644 --- a/libc/src/time/clock_gettime.h +++ b/libc/src/time/clock_gettime.h @@ -11,10 +11,10 @@ #include -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 7b4526783f7070..95aa1be7abee11 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(end - beginning); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/time/difftime.h b/libc/src/time/difftime.h index 249dfed4fe819f..6498b8b943c22f 100644 --- a/libc/src/time/difftime.h +++ b/libc/src/time/difftime.h @@ -11,10 +11,10 @@ #include -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 ee08efba8381bb..880b94cee7311b 100644 --- a/libc/src/time/gettimeofday.h +++ b/libc/src/time/gettimeofday.h @@ -11,10 +11,10 @@ #include -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 75ce85941b184f..8597f2201c4ec9 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 950ba4f5673ab5..d361eb27febfa0 100644 --- a/libc/src/time/gmtime.h +++ b/libc/src/time/gmtime.h @@ -11,10 +11,10 @@ #include -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 67bf12696e2eeb..15a0c0687158f3 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 619af603c98dbf..f7aac287ecc36a 100644 --- a/libc/src/time/gmtime_r.h +++ b/libc/src/time/gmtime_r.h @@ -11,10 +11,10 @@ #include -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 146addd24a7fc8..86cc97e2a3bfb0 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 52cfecbab9be8d..a0c735502ff589 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 ef5e72f208116b..935a5394e5fdbe 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 da9cd3eebe7ebb..075fcb61768ec7 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(__llvm_libc_clock_freq) + [[clang::address_space(4)]] LIBC_NAMESPACE_clock_freq; +#define GPU_CLOCKS_PER_SEC static_cast(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 cf27f5c2995712..1e95f0526bc9c4 100644 --- a/libc/src/time/linux/clock.cpp +++ b/libc/src/time/linux/clock.cpp @@ -17,7 +17,7 @@ #include // For syscall numbers. #include -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 e519ebcdddbdb9..8c8c9fcf845cc7 100644 --- a/libc/src/time/linux/clockGetTimeImpl.h +++ b/libc/src/time/linux/clockGetTimeImpl.h @@ -18,22 +18,22 @@ #include // For syscall numbers. #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace internal { LIBC_INLINE ErrorOr clock_gettimeimpl(clockid_t clockid, struct timespec *ts) { #if SYS_clock_gettime - int ret = __llvm_libc::syscall_impl(SYS_clock_gettime, - static_cast(clockid), - reinterpret_cast(ts)); + int ret = LIBC_NAMESPACE::syscall_impl(SYS_clock_gettime, + static_cast(clockid), + reinterpret_cast(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(SYS_clock_gettime64, - static_cast(clockid), - reinterpret_cast(ts)); + int ret = LIBC_NAMESPACE::syscall_impl(SYS_clock_gettime64, + static_cast(clockid), + reinterpret_cast(ts)); #else #error "SYS_clock_gettime and SYS_clock_gettime64 syscalls not available." #endif @@ -43,6 +43,6 @@ LIBC_INLINE ErrorOr 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 33ec04eb352743..47e974a866c832 100644 --- a/libc/src/time/linux/clock_gettime.cpp +++ b/libc/src/time/linux/clock_gettime.cpp @@ -16,7 +16,7 @@ #include // For syscall numbers. #include -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 2df6429974164a..07ab4d579176ed 100644 --- a/libc/src/time/linux/gettimeofday.cpp +++ b/libc/src/time/linux/gettimeofday.cpp @@ -15,7 +15,7 @@ #include // 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 8c76dac75a176a..bcfe567191f25f 100644 --- a/libc/src/time/linux/nanosleep.cpp +++ b/libc/src/time/linux/nanosleep.cpp @@ -15,18 +15,18 @@ #include // For int64_t. #include // 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(SYS_nanosleep, req, rem); + int ret = LIBC_NAMESPACE::syscall_impl(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(SYS_clock_nanosleep_time64, - CLOCK_REALTIME, 0, req, rem); + int ret = LIBC_NAMESPACE::syscall_impl(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 4dbcabc8963510..e286fae095b2ae 100644 --- a/libc/src/time/linux/time.cpp +++ b/libc/src/time/linux/time.cpp @@ -16,7 +16,7 @@ #include // For syscall numbers. #include -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 3b3ea339f850f9..e57565f0d1fe01 100644 --- a/libc/src/time/mktime.cpp +++ b/libc/src/time/mktime.cpp @@ -12,9 +12,9 @@ #include -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(seconds); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/time/mktime.h b/libc/src/time/mktime.h index efe9cf44565a4c..a50e97c52321b3 100644 --- a/libc/src/time/mktime.h +++ b/libc/src/time/mktime.h @@ -11,10 +11,10 @@ #include -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 d8ecfb758f93c7..757394232c0790 100644 --- a/libc/src/time/nanosleep.h +++ b/libc/src/time/nanosleep.h @@ -11,10 +11,10 @@ #include -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 a24834c50b6250..beb02020b57595 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 fadd26f97dfc22..199a74cb168a2c 100644 --- a/libc/src/time/time_utils.cpp +++ b/libc/src/time/time_utils.cpp @@ -11,10 +11,10 @@ #include -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 424e7521504d91..a5da3ad74f3433 100644 --- a/libc/src/time/time_utils.h +++ b/libc/src/time/time_utils.h @@ -17,7 +17,7 @@ #include -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 2454e805731f97..7623c853091fd0 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 228b78fc799249..ca1dd356b7cfe2 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 56fce1172a1658..02e01c24120a0b 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 21b358251ea918..d6daa5a9ad74d5 100644 --- a/libc/src/unistd/dup.h +++ b/libc/src/unistd/dup.h @@ -11,10 +11,10 @@ #include -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 39e4da8c19fbbe..ba8c5f4b160103 100644 --- a/libc/src/unistd/dup2.h +++ b/libc/src/unistd/dup2.h @@ -11,10 +11,10 @@ #include -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 c7e107071b7dac..2b1082403daff7 100644 --- a/libc/src/unistd/dup3.h +++ b/libc/src/unistd/dup3.h @@ -11,10 +11,10 @@ #include -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 2a554fd9fcb4c7..2266c7203273db 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 eb808411ac1875..c09a04f99f8830 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 f26a5831781c46..7ff366464b4c8d 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 48ac78d9b575db..0054a47d4ddd70 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 3d402e62f40665..267785c919f555 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 8d591dd8667c5c..6b1b72a7dfc089 100644 --- a/libc/src/unistd/fork.h +++ b/libc/src/unistd/fork.h @@ -11,10 +11,10 @@ #include -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 12e5d740b1885b..b5742de359d94d 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 1971dc53af2d73..5508ef0718e942 100644 --- a/libc/src/unistd/ftruncate.h +++ b/libc/src/unistd/ftruncate.h @@ -11,10 +11,10 @@ #include -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 8a6947f09a1246..ab7038e453276c 100644 --- a/libc/src/unistd/getcwd.h +++ b/libc/src/unistd/getcwd.h @@ -11,10 +11,10 @@ #include -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 0df98fbee95533..f19cbaefd5792a 100644 --- a/libc/src/unistd/geteuid.h +++ b/libc/src/unistd/geteuid.h @@ -11,10 +11,10 @@ #include -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 d063a43202136a..ccdfdc6c64666f 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 struct RefWrapper { RefWrapper() = delete; @@ -45,8 +45,9 @@ struct GetoptContext { template void report_error(const char *fmt, Ts... ts) { if (opterr) - __llvm_libc::fprintf( - errstream ? errstream : reinterpret_cast(__llvm_libc::stderr), + LIBC_NAMESPACE::fprintf( + errstream ? errstream + : reinterpret_cast(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 0bc7ed6a1b1934..ae27958756f44a 100644 --- a/libc/src/unistd/getopt.h +++ b/libc/src/unistd/getopt.h @@ -12,7 +12,7 @@ #include #include -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 7b6b9b1600ccd7..5890dbf63681a9 100644 --- a/libc/src/unistd/getpid.h +++ b/libc/src/unistd/getpid.h @@ -11,10 +11,10 @@ #include -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 c5744778b5f978..a09c7ca2241872 100644 --- a/libc/src/unistd/getppid.h +++ b/libc/src/unistd/getppid.h @@ -11,10 +11,10 @@ #include -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 e3501ca04bf994..35163783518c7d 100644 --- a/libc/src/unistd/getuid.h +++ b/libc/src/unistd/getuid.h @@ -11,10 +11,10 @@ #include -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 cffee57e0f2eca..90a169730fe042 100644 --- a/libc/src/unistd/isatty.h +++ b/libc/src/unistd/isatty.h @@ -11,10 +11,10 @@ #include -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 492274286e0449..a95111f3a7f969 100644 --- a/libc/src/unistd/link.h +++ b/libc/src/unistd/link.h @@ -11,10 +11,10 @@ #include -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 7bc161952a8663..c53b87e5d11947 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 195a1c2c78d531..f062ad43e75ff2 100644 --- a/libc/src/unistd/linux/access.cpp +++ b/libc/src/unistd/linux/access.cpp @@ -15,14 +15,14 @@ #include #include // 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(SYS_access, path, mode); + int ret = LIBC_NAMESPACE::syscall_impl(SYS_access, path, mode); #elif defined(SYS_faccessat) int ret = - __llvm_libc::syscall_impl(SYS_faccessat, AT_FDCWD, path, mode, 0); + LIBC_NAMESPACE::syscall_impl(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 b3078d1e9d2fd2..61d44ff1c8088e 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 // For syscall numbers. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, chdir, (const char *path)) { - int ret = __llvm_libc::syscall_impl(SYS_chdir, path); + int ret = LIBC_NAMESPACE::syscall_impl(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 49cac104db48fd..084334861abdc7 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 // For syscall numbers. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, close, (int fd)) { - int ret = __llvm_libc::syscall_impl(SYS_close, fd); + int ret = LIBC_NAMESPACE::syscall_impl(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 423d1db5a35e8b..a2e7d3fdec4295 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 // For syscall numbers. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, dup, (int fd)) { - int ret = __llvm_libc::syscall_impl(SYS_dup, fd); + int ret = LIBC_NAMESPACE::syscall_impl(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 4a537feef2cb92..f6804e2deca5c4 100644 --- a/libc/src/unistd/linux/dup2.cpp +++ b/libc/src/unistd/linux/dup2.cpp @@ -15,12 +15,12 @@ #include #include // 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(SYS_dup2, oldfd, newfd); + int ret = LIBC_NAMESPACE::syscall_impl(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(SYS_fcntl, oldfd, F_GETFD); + int ret = LIBC_NAMESPACE::syscall_impl(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(SYS_fcntl64, oldfd, F_GETFD); + int ret = LIBC_NAMESPACE::syscall_impl(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(SYS_dup3, oldfd, newfd, 0); + int ret = LIBC_NAMESPACE::syscall_impl(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 bb0d18c499fae8..bf2c25728ca6a9 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 // 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(SYS_dup3, oldfd, newfd, flags); + int ret = LIBC_NAMESPACE::syscall_impl(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 c57ee8ef49f057..bd134ca523c774 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 // 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(SYS_execve, path, argv, - __llvm_libc::environ); + int ret = LIBC_NAMESPACE::syscall_impl(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 5eb875d7019642..b6de0a400c4401 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 // 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(SYS_execve, path, argv, envp); + int ret = LIBC_NAMESPACE::syscall_impl(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 4bfca8df58eff3..d24b9badfe4481 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 // For syscall numbers. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, fchdir, (int fd)) { - int ret = __llvm_libc::syscall_impl(SYS_fchdir, fd); + int ret = LIBC_NAMESPACE::syscall_impl(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 0cc37e7aaaf848..6fa2b990b19a93 100644 --- a/libc/src/unistd/linux/fork.cpp +++ b/libc/src/unistd/linux/fork.cpp @@ -17,7 +17,7 @@ #include // For SIGCHLD #include // 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(SYS_fork); + pid_t ret = LIBC_NAMESPACE::syscall_impl(SYS_fork); #elif defined(SYS_clone) - pid_t ret = __llvm_libc::syscall_impl(SYS_clone, SIGCHLD, 0); + pid_t ret = LIBC_NAMESPACE::syscall_impl(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(SYS_gettid); + self.attrib->tid = LIBC_NAMESPACE::syscall_impl(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 199378f82184b8..44d504ec459e3c 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 // For syscall numbers. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, fsync, (int fd)) { - int ret = __llvm_libc::syscall_impl(SYS_fsync, fd); + int ret = LIBC_NAMESPACE::syscall_impl(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 aebdfb60ffe490..795bb98ceae0cc 100644 --- a/libc/src/unistd/linux/ftruncate.cpp +++ b/libc/src/unistd/linux/ftruncate.cpp @@ -16,16 +16,16 @@ #include // For syscall numbers. #include -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(SYS_ftruncate, fd, len); + int ret = LIBC_NAMESPACE::syscall_impl(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(SYS_ftruncate64, fd, (long)len, - (long)(((uint64_t)(len)) >> 32)); + int ret = LIBC_NAMESPACE::syscall_impl(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 3a25ea990150fb..11c58f1585564d 100644 --- a/libc/src/unistd/linux/getcwd.cpp +++ b/libc/src/unistd/linux/getcwd.cpp @@ -17,12 +17,12 @@ #include #include // For syscall numbers. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace { bool getcwd_syscall(char *buf, size_t size) { - int ret = __llvm_libc::syscall_impl(SYS_getcwd, buf, size); + int ret = LIBC_NAMESPACE::syscall_impl(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 ac1d07b9b8d46f..2a7f163fb8cd47 100644 --- a/libc/src/unistd/linux/geteuid.cpp +++ b/libc/src/unistd/linux/geteuid.cpp @@ -13,10 +13,10 @@ #include // For syscall numbers. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(uid_t, geteuid, ()) { - return __llvm_libc::syscall_impl(SYS_geteuid); + return LIBC_NAMESPACE::syscall_impl(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 ae763d821e1518..85730738ca2ef6 100644 --- a/libc/src/unistd/linux/getpid.cpp +++ b/libc/src/unistd/linux/getpid.cpp @@ -13,10 +13,10 @@ #include // For syscall numbers. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(pid_t, getpid, ()) { - return __llvm_libc::syscall_impl(SYS_getpid); + return LIBC_NAMESPACE::syscall_impl(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 e722c36a17c36a..7ee11f32fd0083 100644 --- a/libc/src/unistd/linux/getppid.cpp +++ b/libc/src/unistd/linux/getppid.cpp @@ -13,10 +13,10 @@ #include // For syscall numbers. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(pid_t, getppid, ()) { - return __llvm_libc::syscall_impl(SYS_getppid); + return LIBC_NAMESPACE::syscall_impl(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 f214ffd15fda51..c8131803c84aa6 100644 --- a/libc/src/unistd/linux/getuid.cpp +++ b/libc/src/unistd/linux/getuid.cpp @@ -13,10 +13,10 @@ #include // For syscall numbers. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(uid_t, getuid, ()) { - return __llvm_libc::syscall_impl(SYS_getuid); + return LIBC_NAMESPACE::syscall_impl(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 d81ae5aab22c0c..205013897525b3 100644 --- a/libc/src/unistd/linux/isatty.cpp +++ b/libc/src/unistd/linux/isatty.cpp @@ -15,7 +15,7 @@ #include // For ioctl numbers. #include // 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(SYS_ioctl, fd, TIOCGETD, &line_d_val); + LIBC_NAMESPACE::syscall_impl(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 385756b8ea9ebe..b5024ad7a59fb7 100644 --- a/libc/src/unistd/linux/link.cpp +++ b/libc/src/unistd/linux/link.cpp @@ -15,14 +15,14 @@ #include #include // 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(SYS_link, path1, path2); + int ret = LIBC_NAMESPACE::syscall_impl(SYS_link, path1, path2); #elif defined(SYS_linkat) - int ret = __llvm_libc::syscall_impl(SYS_linkat, AT_FDCWD, path1, - AT_FDCWD, path2, 0); + int ret = LIBC_NAMESPACE::syscall_impl(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 ec1c2b45b2edc8..c5d071ee83e010 100644 --- a/libc/src/unistd/linux/linkat.cpp +++ b/libc/src/unistd/linux/linkat.cpp @@ -15,13 +15,13 @@ #include #include // 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(SYS_linkat, fd1, path1, fd2, path2, flags); + int ret = LIBC_NAMESPACE::syscall_impl(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 3ab0084269e2db..6f3d9937db245e 100644 --- a/libc/src/unistd/linux/lseek.cpp +++ b/libc/src/unistd/linux/lseek.cpp @@ -16,7 +16,7 @@ #include // For syscall numbers. #include // 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 8605925f120722..614de9732c6271 100644 --- a/libc/src/unistd/linux/pread.cpp +++ b/libc/src/unistd/linux/pread.cpp @@ -15,18 +15,18 @@ #include // For uint64_t. #include // 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 ret = LIBC_NAMESPACE::syscall_impl( SYS_pread64, fd, buf, count, (long)offset, (long)(((uint64_t)(offset)) >> 32)); #else - ssize_t ret = - __llvm_libc::syscall_impl(SYS_pread64, fd, buf, count, offset); + ssize_t ret = LIBC_NAMESPACE::syscall_impl(SYS_pread64, fd, buf, + count, offset); #endif if (ret < 0) { libc_errno = static_cast(-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 b4ea52a958ba2d..6c6a0b555ac133 100644 --- a/libc/src/unistd/linux/pwrite.cpp +++ b/libc/src/unistd/linux/pwrite.cpp @@ -15,18 +15,18 @@ #include // For uint64_t. #include // 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 ret = LIBC_NAMESPACE::syscall_impl( SYS_pwrite64, fd, buf, count, (long)offset, (long)(((uint64_t)(offset)) >> 32)); #else - ssize_t ret = - __llvm_libc::syscall_impl(SYS_pwrite64, fd, buf, count, offset); + ssize_t ret = LIBC_NAMESPACE::syscall_impl(SYS_pwrite64, fd, buf, + count, offset); #endif if (ret < 0) { libc_errno = static_cast(-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 6dbff2dee91768..691a236982e375 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 // 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(SYS_read, fd, buf, count); + ssize_t ret = LIBC_NAMESPACE::syscall_impl(SYS_read, fd, buf, count); if (ret < 0) { libc_errno = static_cast(-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 7989b11f5d28c0..8dee58c8f215f3 100644 --- a/libc/src/unistd/linux/readlink.cpp +++ b/libc/src/unistd/linux/readlink.cpp @@ -15,17 +15,17 @@ #include #include // 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(SYS_readlink, path, buf, bufsize); + LIBC_NAMESPACE::syscall_impl(SYS_readlink, path, buf, bufsize); #elif defined(SYS_readlinkat) - ssize_t ret = __llvm_libc::syscall_impl(SYS_readlinkat, AT_FDCWD, - path, buf, bufsize); + ssize_t ret = LIBC_NAMESPACE::syscall_impl(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 094853fe85ec0f..479735d4f4d3d3 100644 --- a/libc/src/unistd/linux/readlinkat.cpp +++ b/libc/src/unistd/linux/readlinkat.cpp @@ -15,13 +15,13 @@ #include #include // 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(SYS_readlinkat, fd, path, - buf, bufsize); + ssize_t ret = LIBC_NAMESPACE::syscall_impl(SYS_readlinkat, fd, path, + buf, bufsize); if (ret < 0) { libc_errno = static_cast(-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 70f7206aad5639..234b0c3a09408b 100644 --- a/libc/src/unistd/linux/rmdir.cpp +++ b/libc/src/unistd/linux/rmdir.cpp @@ -15,14 +15,14 @@ #include #include // 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(SYS_rmdir, path); + int ret = LIBC_NAMESPACE::syscall_impl(SYS_rmdir, path); #elif defined(SYS_unlinkat) - int ret = __llvm_libc::syscall_impl(SYS_unlinkat, AT_FDCWD, path, - AT_REMOVEDIR); + int ret = LIBC_NAMESPACE::syscall_impl(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 a9b7de8acf3732..e8983e252b8e36 100644 --- a/libc/src/unistd/linux/symlink.cpp +++ b/libc/src/unistd/linux/symlink.cpp @@ -15,14 +15,14 @@ #include #include // 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(SYS_symlink, path1, path2); + int ret = LIBC_NAMESPACE::syscall_impl(SYS_symlink, path1, path2); #elif defined(SYS_symlinkat) int ret = - __llvm_libc::syscall_impl(SYS_symlinkat, path1, AT_FDCWD, path2); + LIBC_NAMESPACE::syscall_impl(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 f5debb8cd0c20d..64f02d13f9a0c1 100644 --- a/libc/src/unistd/linux/symlinkat.cpp +++ b/libc/src/unistd/linux/symlinkat.cpp @@ -15,11 +15,11 @@ #include #include // 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(SYS_symlinkat, path1, fd, path2); + int ret = LIBC_NAMESPACE::syscall_impl(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 5c61c6d064a6bd..e1b13c9c143fa4 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 -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(number, arg1, arg2, arg3, arg4, - arg5, arg6); + long ret = LIBC_NAMESPACE::syscall_impl(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(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 2816cb447c1284..b16e15551fc788 100644 --- a/libc/src/unistd/linux/sysconf.cpp +++ b/libc/src/unistd/linux/sysconf.cpp @@ -14,7 +14,7 @@ #include // For EXEC_PAGESIZE. #include -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 7be355edfd48f4..0120cc738a9216 100644 --- a/libc/src/unistd/linux/truncate.cpp +++ b/libc/src/unistd/linux/truncate.cpp @@ -16,16 +16,16 @@ #include // For syscall numbers. #include -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(SYS_truncate, path, len); + int ret = LIBC_NAMESPACE::syscall_impl(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(SYS_truncate64, path, (long)len, - (long)(((uint64_t)(len)) >> 32)); + int ret = LIBC_NAMESPACE::syscall_impl(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 d4bbdea8e970b3..e62fb8faa67af2 100644 --- a/libc/src/unistd/linux/unlink.cpp +++ b/libc/src/unistd/linux/unlink.cpp @@ -15,13 +15,13 @@ #include #include // 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(SYS_unlink, path); + int ret = LIBC_NAMESPACE::syscall_impl(SYS_unlink, path); #elif defined(SYS_unlinkat) - int ret = __llvm_libc::syscall_impl(SYS_unlinkat, AT_FDCWD, path, 0); + int ret = LIBC_NAMESPACE::syscall_impl(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 eb4af39729f376..4ec5e38cb405cd 100644 --- a/libc/src/unistd/linux/unlinkat.cpp +++ b/libc/src/unistd/linux/unlinkat.cpp @@ -15,11 +15,11 @@ #include #include // 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(SYS_unlinkat, dfd, path, flags); + int ret = LIBC_NAMESPACE::syscall_impl(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 4884ccf1ed3332..bd6c9114f78775 100644 --- a/libc/src/unistd/linux/write.cpp +++ b/libc/src/unistd/linux/write.cpp @@ -14,10 +14,11 @@ #include // 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(SYS_write, fd, buf, count); + ssize_t ret = + LIBC_NAMESPACE::syscall_impl(SYS_write, fd, buf, count); if (ret < 0) { libc_errno = static_cast(-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 28252e4d491719..75e33d8a6987d1 100644 --- a/libc/src/unistd/lseek.h +++ b/libc/src/unistd/lseek.h @@ -11,10 +11,10 @@ #include -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 5ddf32eae4f813..6ecfef4c82c602 100644 --- a/libc/src/unistd/pread.h +++ b/libc/src/unistd/pread.h @@ -11,10 +11,10 @@ #include -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 4286314abee0ce..535c9217c23531 100644 --- a/libc/src/unistd/pwrite.h +++ b/libc/src/unistd/pwrite.h @@ -11,10 +11,10 @@ #include -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 62602c82a906ac..05a56a2fdeaebb 100644 --- a/libc/src/unistd/read.h +++ b/libc/src/unistd/read.h @@ -11,10 +11,10 @@ #include -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 ba246bf91b8a8b..c93c430988c79c 100644 --- a/libc/src/unistd/readlink.h +++ b/libc/src/unistd/readlink.h @@ -11,10 +11,10 @@ #include -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 54346ee1132cb8..a4357efec1a1b1 100644 --- a/libc/src/unistd/readlinkat.h +++ b/libc/src/unistd/readlinkat.h @@ -11,10 +11,10 @@ #include -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 5fe7fac23af786..55dcbafe1f7df7 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 44166a623ff42f..5c2f5074ff9780 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 e5e02e13331478..0a6aa49540b5b7 100644 --- a/libc/src/unistd/swab.h +++ b/libc/src/unistd/swab.h @@ -11,10 +11,10 @@ #include // 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 a495db8238bc0d..0a0124ccbc7ab7 100644 --- a/libc/src/unistd/symlink.h +++ b/libc/src/unistd/symlink.h @@ -11,10 +11,10 @@ #include -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 ff77f0a52f6d0f..ecca4380e98eb1 100644 --- a/libc/src/unistd/symlinkat.h +++ b/libc/src/unistd/symlinkat.h @@ -11,10 +11,10 @@ #include -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 81ff64ebcf5a13..255459cadb8b71 100644 --- a/libc/src/unistd/syscall.h +++ b/libc/src/unistd/syscall.h @@ -12,11 +12,11 @@ #include #include -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 b704edb4ada1fa..89c5efa5746364 100644 --- a/libc/src/unistd/sysconf.h +++ b/libc/src/unistd/sysconf.h @@ -11,10 +11,10 @@ #include -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 a6ef92146008cc..5245b6bf2ed028 100644 --- a/libc/src/unistd/truncate.h +++ b/libc/src/unistd/truncate.h @@ -11,10 +11,10 @@ #include -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 1119bfad7dbc53..d1d34fa1a8ac5c 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 b32d7b537851d3..81d23bdf5cec36 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 821dc49050ec5c..52cdff348085f5 100644 --- a/libc/src/unistd/write.h +++ b/libc/src/unistd/write.h @@ -11,10 +11,10 @@ #include -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 6db888c1aa09cd..040c60eb805c72 100644 --- a/libc/src/wchar/btowc.cpp +++ b/libc/src/wchar/btowc.cpp @@ -12,7 +12,7 @@ #include // 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 ab37738e8c67cb..de67f157b5729a 100644 --- a/libc/src/wchar/btowc.h +++ b/libc/src/wchar/btowc.h @@ -11,10 +11,10 @@ #include -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 274818a37773ae..538d5388e50581 100644 --- a/libc/src/wchar/wctob.cpp +++ b/libc/src/wchar/wctob.cpp @@ -12,7 +12,7 @@ #include // 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 5c0f229436d625..1cc0c211e98a52 100644 --- a/libc/src/wchar/wctob.h +++ b/libc/src/wchar/wctob.h @@ -11,10 +11,10 @@ #include -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 e6304ab243b8ff..9e642dbe3fc7d3 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,7 +41,7 @@ static void call_fini_array_callbacks() { reinterpret_cast(__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) { @@ -49,8 +49,8 @@ _begin(int argc, char **argv, char **env) { // 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 @@ -65,5 +65,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 d5d3ad2f15cac2..1ff187a577789f 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,7 +39,7 @@ static void call_fini_array_callbacks() { reinterpret_cast(__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) { @@ -47,8 +47,8 @@ _begin(int argc, char **argv, char **env) { // 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 @@ -62,5 +62,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 7b94ae64c4ced9..002af5313cc82d 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 mmap_ret_val = LIBC_NAMESPACE::syscall_impl( 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(mmap_ret_val) > -app.pageSize) - __llvm_libc::syscall_impl(SYS_exit, 1); + LIBC_NAMESPACE::syscall_impl(SYS_exit, 1); uintptr_t thread_ptr = uintptr_t(reinterpret_cast(mmap_ret_val)); uintptr_t tls_addr = thread_ptr + size_of_pointers + padding; - __llvm_libc::inline_memcpy(reinterpret_cast(tls_addr), - reinterpret_cast(app.tls.address), - app.tls.init_size); + LIBC_NAMESPACE::inline_memcpy(reinterpret_cast(tls_addr), + reinterpret_cast(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(SYS_munmap, addr, size); + LIBC_NAMESPACE::syscall_impl(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(__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(SYS_gettid); + auto tid = LIBC_NAMESPACE::syscall_impl(SYS_gettid); if (tid <= 0) - __llvm_libc::syscall_impl(SYS_exit, 1); - __llvm_libc::main_thread_attrib.tid = static_cast(tid); + LIBC_NAMESPACE::syscall_impl(SYS_exit, 1); + LIBC_NAMESPACE::main_thread_attrib.tid = static_cast(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(app.args->argc), reinterpret_cast(app.args->argv), reinterpret_cast(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( reinterpret_cast(__builtin_frame_address(0)) + 2); do_start(); } diff --git a/libc/startup/linux/riscv64/start.cpp b/libc/startup/linux/riscv64/start.cpp index 1bf05b94ad5acf..ed976d294d9421 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 mmap_ret_val = LIBC_NAMESPACE::syscall_impl( 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(mmap_ret_val) > -app.pageSize) - __llvm_libc::syscall_impl(SYS_exit, 1); + LIBC_NAMESPACE::syscall_impl(SYS_exit, 1); uintptr_t thread_ptr = uintptr_t(reinterpret_cast(mmap_ret_val)); uintptr_t tls_addr = thread_ptr + size_of_pointers + padding; - __llvm_libc::inline_memcpy(reinterpret_cast(tls_addr), - reinterpret_cast(app.tls.address), - app.tls.init_size); + LIBC_NAMESPACE::inline_memcpy(reinterpret_cast(tls_addr), + reinterpret_cast(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(SYS_munmap, addr, size); + LIBC_NAMESPACE::syscall_impl(SYS_munmap, addr, size); } static void set_thread_ptr(uintptr_t val) { @@ -112,14 +112,14 @@ static void call_fini_array_callbacks() { reinterpret_cast(__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(SYS_gettid); + auto tid = LIBC_NAMESPACE::syscall_impl(SYS_gettid); if (tid <= 0) - __llvm_libc::syscall_impl(SYS_exit, 1); - __llvm_libc::main_thread_attrib.tid = static_cast(tid); + LIBC_NAMESPACE::syscall_impl(SYS_exit, 1); + LIBC_NAMESPACE::main_thread_attrib.tid = static_cast(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(app.args->argc), reinterpret_cast(app.args->argv), reinterpret_cast(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( reinterpret_cast(__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 2f9dbfddf6bee6..4b46a4f4a7b081 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 mmapRetVal = LIBC_NAMESPACE::syscall_impl( 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(mmapRetVal) > -app.pageSize) - __llvm_libc::syscall_impl(SYS_exit, 1); + LIBC_NAMESPACE::syscall_impl(SYS_exit, 1); uintptr_t *tlsAddr = reinterpret_cast(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(tlsAddr) + tlsSize; *reinterpret_cast(endPtr) = endPtr; - __llvm_libc::inline_memcpy(reinterpret_cast(tlsAddr), - reinterpret_cast(app.tls.address), - app.tls.init_size); + LIBC_NAMESPACE::inline_memcpy(reinterpret_cast(tlsAddr), + reinterpret_cast(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(SYS_munmap, addr, size); + LIBC_NAMESPACE::syscall_impl(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(__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( reinterpret_cast(__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(SYS_gettid); + auto tid = LIBC_NAMESPACE::syscall_impl(SYS_gettid); if (tid <= 0) - __llvm_libc::syscall_impl(SYS_exit, 1); - __llvm_libc::main_thread_attrib.tid = static_cast(tid); + LIBC_NAMESPACE::syscall_impl(SYS_exit, 1); + LIBC_NAMESPACE::main_thread_attrib.tid = static_cast(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(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(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(app.args->argc), reinterpret_cast(app.args->argv), reinterpret_cast(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 8e2feccd0dac71..3bdbe89a3fb62d 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 8dff1980f9236e..1e5ad1cfef0d7b 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 7bee46c4029e57..79730868ecdf3f 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 1e89167a002755..2a7d1c39d3205c 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 e55beb52d79ae3..b748c29751c328 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 { @@ -170,6 +170,6 @@ returns(internal::Comparator cmp) { } // 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 335720fdba2c7b..2129e63a3a0029 100644 --- a/libc/test/UnitTest/ExecuteFunction.h +++ b/libc/test/UnitTest/ExecuteFunction.h @@ -11,7 +11,7 @@ #include -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 1caaa24b8d4146..b244337f9c6fcd 100644 --- a/libc/test/UnitTest/ExecuteFunctionUnix.cpp +++ b/libc/test/UnitTest/ExecuteFunctionUnix.cpp @@ -17,7 +17,7 @@ #include #include -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 c712fec01d485c..1601b7e53f2be1 100644 --- a/libc/test/UnitTest/FPExceptMatcher.cpp +++ b/libc/test/UnitTest/FPExceptMatcher.cpp @@ -13,7 +13,7 @@ #include #include -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 1563561854abdb..98c4f737d17275 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 { }; } // 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 d8d032b3ef530d..0c1f340449236e 100644 --- a/libc/test/UnitTest/FPMatcher.h +++ b/libc/test/UnitTest/FPMatcher.h @@ -18,7 +18,7 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace testing { template class FPMatcher : public Matcher { @@ -60,10 +60,10 @@ template FPMatcher getMatcher(T expectedValue) { } } // namespace testing -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #define DECLARE_SPECIAL_CONSTANTS(T) \ - using FPBits = __llvm_libc::fputil::FPBits; \ + using FPBits = LIBC_NAMESPACE::fputil::FPBits; \ using UIntType = typename FPBits::UIntType; \ const T zero = T(FPBits::zero()); \ const T neg_zero = T(FPBits::neg_zero()); \ @@ -72,35 +72,27 @@ template FPMatcher 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( \ 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 FPMatcher 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 FPMatcher 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 f711e83bdf2602..07a6e9b3f6bde5 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 3d88b0ed64e81e..73d54b9eeb5ecc 100644 --- a/libc/test/UnitTest/HermeticTestUtils.cpp +++ b/libc/test/UnitTest/HermeticTestUtils.cpp @@ -9,7 +9,7 @@ #include #include -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 f25c0f77240024..e891c4e3c0b586 100644 --- a/libc/test/UnitTest/LibcDeathTestExecutors.cpp +++ b/libc/test/UnitTest/LibcDeathTestExecutors.cpp @@ -13,7 +13,7 @@ #include -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 d9a9e50ca9a65b..2f18d5778e71d8 100644 --- a/libc/test/UnitTest/LibcTest.cpp +++ b/libc/test/UnitTest/LibcTest.cpp @@ -17,21 +17,21 @@ #include #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>( + 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>( + 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>( + 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>( + 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>( + 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( + 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(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 d01618d008c709..dc17c3c49d4277 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, - int> = 0> + cpp::enable_if_t< + cpp::is_same_v, 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 , - int> = 0> + cpp::enable_if_t< + cpp::is_same_v, 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 struct TypeList { } // namespace internal -// Make TypeList visible in __llvm_libc::testing. +// Make TypeList visible in LIBC_NAMESPACE::testing. template using TypeList = internal::TypeList; 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() { \ + constexpr const char * \ + LIBC_NAMESPACE::testing::internal::GetTypeName() { \ 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 \ - 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( \ + LIBC_NAMESPACE::testing::internal::GenerateName( \ name, sizeof(name), #SuiteName "." #TestName); \ } \ void Run() override; \ @@ -332,7 +334,7 @@ CString libc_make_test_file_path_func(const char *file_name); template void SuiteName##_##TestName::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 class SuiteClass##_##TestName : public SuiteClass { \ @@ -341,7 +343,7 @@ CString libc_make_test_file_path_func(const char *file_name); char name[256]; \ SuiteClass##_##TestName() { \ SuiteClass::addTest(this); \ - __llvm_libc::testing::internal::GenerateName( \ + LIBC_NAMESPACE::testing::internal::GenerateName( \ name, sizeof(name), #SuiteClass "." #TestName); \ } \ void Run() override; \ @@ -352,9 +354,9 @@ CString libc_make_test_file_path_func(const char *file_name); template void SuiteClass##_##TestName::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 756d1196bc3656..bf1a921c04ca98 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 32f7d5e17e0208..d9d89504dbeba7 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 @@ -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 e3df4c09315c9f..cf861a6757ae17 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; +using MemoryView = LIBC_NAMESPACE::cpp::span; } // 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 expected; @@ -57,12 +57,12 @@ class MemoryMatcher : public Matcher { 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 f3b33b76be4bd3..855633527fb359 100644 --- a/libc/test/UnitTest/PigweedTest.h +++ b/libc/test/UnitTest/PigweedTest.h @@ -11,7 +11,7 @@ #include -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 019eafcfb4b220..e895da2be120f8 100644 --- a/libc/test/UnitTest/PrintfMatcher.cpp +++ b/libc/test/UnitTest/PrintfMatcher.cpp @@ -16,7 +16,7 @@ #include -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 148c9ff80931db..a4fbeda4d585a6 100644 --- a/libc/test/UnitTest/PrintfMatcher.h +++ b/libc/test/UnitTest/PrintfMatcher.h @@ -14,7 +14,7 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace testing { class FormatSectionMatcher : public Matcher { @@ -31,12 +31,12 @@ class FormatSectionMatcher : public Matcher { }; } // 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 f880effd75a351..c8f32f81e7134a 100644 --- a/libc/test/UnitTest/RoundingModeUtils.cpp +++ b/libc/test/UnitTest/RoundingModeUtils.cpp @@ -12,7 +12,7 @@ #include -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 e8611c34b54033..d1c3c6ff400a54 100644 --- a/libc/test/UnitTest/RoundingModeUtils.h +++ b/libc/test/UnitTest/RoundingModeUtils.h @@ -11,7 +11,7 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace fputil { namespace testing { @@ -32,6 +32,6 @@ template 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 7374858910d548..91cb73fb332ed3 100644 --- a/libc/test/UnitTest/ScanfMatcher.cpp +++ b/libc/test/UnitTest/ScanfMatcher.cpp @@ -16,7 +16,7 @@ #include -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 864a35d74adeb8..0b9a8868bf0b81 100644 --- a/libc/test/UnitTest/ScanfMatcher.h +++ b/libc/test/UnitTest/ScanfMatcher.h @@ -14,7 +14,7 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace testing { class FormatSectionMatcher : public Matcher { @@ -31,12 +31,12 @@ class FormatSectionMatcher : public Matcher { }; } // 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 8f517a5ec9c8f4..ac28926d51cd89 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 @@ -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 02be4bdf5de811..6bb0e17dc3888e 100644 --- a/libc/test/UnitTest/TestLogger.cpp +++ b/libc/test/UnitTest/TestLogger.cpp @@ -6,13 +6,13 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace testing { // cpp::string_view specialization template <> TestLogger &TestLogger::operator<< (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>); 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 2d46ea1ca14657..6188bcf4434afa 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 300cf2c7be3b7a..697d991d07547c 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 2574f1f8b25002..d7ad54e52b81c0 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 c8d512343586f6..6a9b44cc1422cc 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 global_thr_count = 0; +static LIBC_NAMESPACE::AllocChecker global_ac; +static LIBC_NAMESPACE::cpp::Atomic 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(&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(__llvm_libc::DetachState::JOINABLE)); + static_cast(LIBC_NAMESPACE::DetachState::JOINABLE)); ASSERT_EQ(expec_detached == PTHREAD_CREATE_DETACHED, thread->attrib->detach_state.load() == - static_cast(__llvm_libc::DetachState::DETACHED)); + static_cast(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(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(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(th_arg)), + ASSERT_EQ(LIBC_NAMESPACE::pthread_create(&tid, attr, successThread, + reinterpret_cast(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 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(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(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 08d89892d22a94..82f5a494e1bdfb 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(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 e60fe67d2a2a0b..48e6c81713a403 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 7397fa89a9f47e..f4126357a0579d 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 67300872dc60a2..ce2a3538924da8 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(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(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 fa227b3074988b..d341792d11d6cb 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 #include // 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(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(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(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 201982460c5ea2..8e0f234ee8c6b1 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 // uintptr_t static constexpr unsigned int NUM_THREADS = 5; -static __llvm_libc::cpp::Atomic thread_count; +static LIBC_NAMESPACE::cpp::Atomic 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 start_count; -static __llvm_libc::cpp::Atomic done_count; +static LIBC_NAMESPACE::cpp::Atomic start_count; +static LIBC_NAMESPACE::cpp::Atomic 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 fa6a828d9208b9..3565a7cb08685a 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(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(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(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 b5843d226ff10f..c90525a0000ee1 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(__llvm_libc::pthread_getspecific(key)); + ASSERT_EQ(LIBC_NAMESPACE::pthread_setspecific(key, &child_thread_data), 0); + int *d = reinterpret_cast(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(__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(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 69b60a4138762a..104096c40c3abe 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 117a059ecfe090..833159436d49cb 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 9c292bfaebf1f3..82a9b89533d2eb 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(nullptr))); - ASSERT_TRUE(my_streq(__llvm_libc::getenv("="), static_cast(nullptr))); - ASSERT_TRUE(my_streq(__llvm_libc::getenv("MISSING ENV VARIABLE"), + ASSERT_TRUE( + my_streq(LIBC_NAMESPACE::getenv(""), static_cast(nullptr))); + ASSERT_TRUE( + my_streq(LIBC_NAMESPACE::getenv("="), static_cast(nullptr))); + ASSERT_TRUE(my_streq(LIBC_NAMESPACE::getenv("MISSING ENV VARIABLE"), static_cast(nullptr))); ASSERT_FALSE( - my_streq(__llvm_libc::getenv("PATH"), static_cast(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(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(nullptr))); - ASSERT_TRUE( - my_streq(__llvm_libc::getenv("FRANCE1"), static_cast(nullptr))); + my_streq(LIBC_NAMESPACE::getenv("FRANC"), static_cast(nullptr))); + ASSERT_TRUE(my_streq(LIBC_NAMESPACE::getenv("FRANCE1"), + static_cast(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 a84eca2e5b0bb4..efb920d00723a4 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 static constexpr unsigned int NUM_THREADS = 5; -static __llvm_libc::cpp::Atomic thread_count; +static LIBC_NAMESPACE::cpp::Atomic 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(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(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 start_count; -static __llvm_libc::cpp::Atomic done_count; +static LIBC_NAMESPACE::cpp::Atomic start_count; +static LIBC_NAMESPACE::cpp::Atomic 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(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(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(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(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(thrd_success)); int retval; - ASSERT_EQ(__llvm_libc::thrd_join(t1, &retval), + ASSERT_EQ(LIBC_NAMESPACE::thrd_join(t1, &retval), static_cast(thrd_success)); ASSERT_EQ(retval, 0); - ASSERT_EQ(__llvm_libc::thrd_join(t2, &retval), + ASSERT_EQ(LIBC_NAMESPACE::thrd_join(t2, &retval), static_cast(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 ecc04ffa780eb4..8791c6adbaa69f 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 broadcast_count(0); +static LIBC_NAMESPACE::cpp::Atomic 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 5887e1132f56b1..82b0350af97afc 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(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(thrd_success)); + ASSERT_EQ(LIBC_NAMESPACE::mtx_lock(&mutex), static_cast(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(thrd_success)); + ASSERT_EQ(LIBC_NAMESPACE::mtx_unlock(&mutex), + static_cast(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(thrd_success)); - ASSERT_EQ(__llvm_libc::mtx_init(&step_lock, mtx_plain), + ASSERT_EQ(LIBC_NAMESPACE::mtx_init(&step_lock, mtx_plain), static_cast(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(thrd_success)); + ASSERT_EQ(LIBC_NAMESPACE::mtx_lock(&step_lock), + static_cast(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(thrd_success)); bool s = started; - ASSERT_EQ(__llvm_libc::mtx_unlock(&start_lock), + ASSERT_EQ(LIBC_NAMESPACE::mtx_unlock(&start_lock), static_cast(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(thrd_success)); while (true) { - ASSERT_EQ(__llvm_libc::mtx_lock(&step_lock), + ASSERT_EQ(LIBC_NAMESPACE::mtx_lock(&step_lock), static_cast(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(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 8b4a00dff32313..4f8866f088b925 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(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 6e7baa9d0da670..0939a7621f443c 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 33d230c1ec028b..58728366b53ee6 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 df0954d5e2e461..c1c91c810bdf2d 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(__llvm_libc::tss_get(key)); + ASSERT_EQ(LIBC_NAMESPACE::tss_set(key, &child_thread_data), thrd_success); + int *d = reinterpret_cast(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(__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(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 4a3969058485d6..254ef955f2720e 100644 --- a/libc/test/integration/src/unistd/execv_test.cpp +++ b/libc/test/integration/src/unistd/execv_test.cpp @@ -16,36 +16,36 @@ #include 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("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("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 409fec74f4d8df..fb1a83da638566 100644 --- a/libc/test/integration/src/unistd/execve_test.cpp +++ b/libc/test/integration/src/unistd/execve_test.cpp @@ -16,36 +16,36 @@ #include 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("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("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 16798627ad9ab6..9c9213ed46316d 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 3214ebf7085cf0..3d8f5821a69efc 100644 --- a/libc/test/integration/src/unistd/getcwd_test.cpp +++ b/libc/test/integration/src/unistd/getcwd_test.cpp @@ -15,26 +15,26 @@ #include // 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 3aa1346e940c91..674e2cc1ed7499 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 afde3dd863db12..09a4ae67256e3a 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 75e9574e613dab..4032d890c53ec8 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 d8315af6b987ac..5f235a96006d65 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 16408f7ad1467b..5b105c8eb3d56c 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 aint(123); - ASSERT_EQ(aint.load(__llvm_libc::cpp::MemoryOrder::RELAXED), 123); + LIBC_NAMESPACE::cpp::Atomic 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 aint(desired); + LIBC_NAMESPACE::cpp::Atomic 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 9983cfc8bbbd48..f1d4e4c2f96364 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 ffae423f4fd003..8337081345a02d 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 1d040e6bc3e3c3..fe378522b446b9 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 fea428e66eff85..12641b7b51b6ce 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>::max(); auto umax64 = - __llvm_libc::cpp::UInt<128>(cpp::numeric_limits::max()); + LIBC_NAMESPACE::cpp::UInt<128>(cpp::numeric_limits::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 c59175d59a2c43..f9254d42c9a9ea 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 4476f4e98b94ea..6da06c31e7adfd 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 s; diff --git a/libc/test/src/__support/CPP/string_test.cpp b/libc/test/src/__support/CPP/string_test.cpp index 928277fe2e9cc7..e606ab127adc21 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 c6bfd775e3460b..e285fc5715bce2 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 59a0d396095d0a..33eb8ab4765728 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 4e1eb41b739920..0e5f4a1f738b7a 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 b1ef7111867fc8..8fafa767ae38e3 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 f910eb1d876379..916523e2826693 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::inf()).c_str(), "(+Infinity)"); - EXPECT_STREQ(__llvm_libc::str(FPBits::neg_inf()).c_str(), + EXPECT_STREQ(LIBC_NAMESPACE::str(FPBits::inf()).c_str(), + "(+Infinity)"); + EXPECT_STREQ(LIBC_NAMESPACE::str(FPBits::neg_inf()).c_str(), "(-Infinity)"); EXPECT_STREQ( - __llvm_libc::str(FPBits(FPBits::build_nan(1))).c_str(), + LIBC_NAMESPACE::str(FPBits(FPBits::build_nan(1))).c_str(), "(NaN)"); FPBits zero(0.0f); @@ -25,7 +26,7 @@ TEST(LlvmLibcFPBitsTest, FloatType) { EXPECT_EQ(zero.get_unbiased_exponent(), static_cast(0)); EXPECT_EQ(zero.get_mantissa(), static_cast(0)); EXPECT_EQ(zero.uintval(), static_cast(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 negzero(-0.0f); @@ -33,7 +34,7 @@ TEST(LlvmLibcFPBitsTest, FloatType) { EXPECT_EQ(negzero.get_unbiased_exponent(), static_cast(0)); EXPECT_EQ(negzero.get_mantissa(), static_cast(0)); EXPECT_EQ(negzero.uintval(), static_cast(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 one(1.0f); @@ -41,7 +42,7 @@ TEST(LlvmLibcFPBitsTest, FloatType) { EXPECT_EQ(one.get_unbiased_exponent(), static_cast(0x7F)); EXPECT_EQ(one.get_mantissa(), static_cast(0)); EXPECT_EQ(one.uintval(), static_cast(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 negone(-1.0f); @@ -49,7 +50,7 @@ TEST(LlvmLibcFPBitsTest, FloatType) { EXPECT_EQ(negone.get_unbiased_exponent(), static_cast(0x7F)); EXPECT_EQ(negone.get_mantissa(), static_cast(0)); EXPECT_EQ(negone.uintval(), static_cast(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 num(1.125f); @@ -57,7 +58,7 @@ TEST(LlvmLibcFPBitsTest, FloatType) { EXPECT_EQ(num.get_unbiased_exponent(), static_cast(0x7F)); EXPECT_EQ(num.get_mantissa(), static_cast(0x00100000)); EXPECT_EQ(num.uintval(), static_cast(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 negnum(-1.125f); @@ -65,16 +66,17 @@ TEST(LlvmLibcFPBitsTest, FloatType) { EXPECT_EQ(negnum.get_unbiased_exponent(), static_cast(0x7F)); EXPECT_EQ(negnum.get_mantissa(), static_cast(0x00100000)); EXPECT_EQ(negnum.uintval(), static_cast(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::inf()).c_str(), "(+Infinity)"); - EXPECT_STREQ(__llvm_libc::str(FPBits::neg_inf()).c_str(), + EXPECT_STREQ(LIBC_NAMESPACE::str(FPBits::inf()).c_str(), + "(+Infinity)"); + EXPECT_STREQ(LIBC_NAMESPACE::str(FPBits::neg_inf()).c_str(), "(-Infinity)"); EXPECT_STREQ( - __llvm_libc::str(FPBits(FPBits::build_nan(1))).c_str(), + LIBC_NAMESPACE::str(FPBits(FPBits::build_nan(1))).c_str(), "(NaN)"); FPBits zero(0.0); @@ -82,7 +84,7 @@ TEST(LlvmLibcFPBitsTest, DoubleType) { EXPECT_EQ(zero.get_unbiased_exponent(), static_cast(0x0000)); EXPECT_EQ(zero.get_mantissa(), static_cast(0x0000000000000000)); EXPECT_EQ(zero.uintval(), static_cast(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 negzero(-0.0); @@ -90,7 +92,7 @@ TEST(LlvmLibcFPBitsTest, DoubleType) { EXPECT_EQ(negzero.get_unbiased_exponent(), static_cast(0x0000)); EXPECT_EQ(negzero.get_mantissa(), static_cast(0x0000000000000000)); EXPECT_EQ(negzero.uintval(), static_cast(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 one(1.0); @@ -98,7 +100,7 @@ TEST(LlvmLibcFPBitsTest, DoubleType) { EXPECT_EQ(one.get_unbiased_exponent(), static_cast(0x03FF)); EXPECT_EQ(one.get_mantissa(), static_cast(0x0000000000000000)); EXPECT_EQ(one.uintval(), static_cast(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 negone(-1.0); @@ -106,7 +108,7 @@ TEST(LlvmLibcFPBitsTest, DoubleType) { EXPECT_EQ(negone.get_unbiased_exponent(), static_cast(0x03FF)); EXPECT_EQ(negone.get_mantissa(), static_cast(0x0000000000000000)); EXPECT_EQ(negone.uintval(), static_cast(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 num(1.125); @@ -114,7 +116,7 @@ TEST(LlvmLibcFPBitsTest, DoubleType) { EXPECT_EQ(num.get_unbiased_exponent(), static_cast(0x03FF)); EXPECT_EQ(num.get_mantissa(), static_cast(0x0002000000000000)); EXPECT_EQ(num.uintval(), static_cast(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 negnum(-1.125); @@ -122,7 +124,7 @@ TEST(LlvmLibcFPBitsTest, DoubleType) { EXPECT_EQ(negnum.get_unbiased_exponent(), static_cast(0x03FF)); EXPECT_EQ(negnum.get_mantissa(), static_cast(0x0002000000000000)); EXPECT_EQ(negnum.uintval(), static_cast(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::inf()).c_str(), + EXPECT_STREQ(LIBC_NAMESPACE::str(FPBits::inf()).c_str(), "(+Infinity)"); - EXPECT_STREQ(__llvm_libc::str(FPBits::neg_inf()).c_str(), + EXPECT_STREQ(LIBC_NAMESPACE::str(FPBits::neg_inf()).c_str(), "(-Infinity)"); - EXPECT_STREQ( - __llvm_libc::str(FPBits(FPBits::build_nan(1))) - .c_str(), - "(NaN)"); + EXPECT_STREQ(LIBC_NAMESPACE::str( + FPBits(FPBits::build_nan(1))) + .c_str(), + "(NaN)"); FPBits zero(0.0l); EXPECT_EQ(zero.get_sign(), false); @@ -147,7 +149,7 @@ TEST(LlvmLibcFPBitsTest, X86LongDoubleType) { << 64); EXPECT_EQ(zero.uintval(), static_cast(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(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(0x0000000000000000) << 64); EXPECT_EQ(one.uintval(), static_cast(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(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(0x1) << 60); EXPECT_EQ(num.uintval(), static_cast(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(0x1) << 60); EXPECT_EQ(negnum.uintval(), static_cast(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::inf()).c_str(), + EXPECT_STREQ(LIBC_NAMESPACE::str(FPBits::inf()).c_str(), "(+Infinity)"); - EXPECT_STREQ(__llvm_libc::str(FPBits::neg_inf()).c_str(), + EXPECT_STREQ(LIBC_NAMESPACE::str(FPBits::neg_inf()).c_str(), "(-Infinity)"); - EXPECT_STREQ( - __llvm_libc::str(FPBits(FPBits::build_nan(1))) - .c_str(), - "(NaN)"); + EXPECT_STREQ(LIBC_NAMESPACE::str( + FPBits(FPBits::build_nan(1))) + .c_str(), + "(NaN)"); FPBits zero(0.0l); EXPECT_EQ(zero.get_sign(), false); @@ -223,7 +225,7 @@ TEST(LlvmLibcFPBitsTest, LongDoubleType) { EXPECT_EQ(zero.get_mantissa(), static_cast(0x0000000000000000) << 64); EXPECT_EQ(zero.uintval(), static_cast(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(0x0000000000000000) << 64); EXPECT_EQ(negzero.uintval(), static_cast(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(0x3FFF)); EXPECT_EQ(one.get_mantissa(), static_cast(0x0000000000000000) << 64); EXPECT_EQ(one.uintval(), static_cast(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(0x0000000000000000) << 64); EXPECT_EQ(negone.uintval(), static_cast(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(0x3FFF)); EXPECT_EQ(num.get_mantissa(), static_cast(0x2) << 108); EXPECT_EQ(num.uintval(), static_cast(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(0x3FFF)); EXPECT_EQ(negnum.get_mantissa(), static_cast(0x2) << 108); EXPECT_EQ(negnum.uintval(), static_cast(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 01c1b3c2a9ffaf..e73d10d9658841 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 -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 1a67ebdd501543..fbcedc163de10a 100644 --- a/libc/test/src/__support/File/file_test.cpp +++ b/libc/test/src/__support/File/file_test.cpp @@ -15,11 +15,11 @@ #include #include -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 str_seek(__llvm_libc::File *f, long offset, int whence); - static int str_close(__llvm_libc::File *f) { + static ErrorOr str_seek(LIBC_NAMESPACE::File *f, long offset, + int whence); + static int str_close(LIBC_NAMESPACE::File *f) { delete reinterpret_cast(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(buffer), buflen, bufmode, - owned, modeflags), + : LIBC_NAMESPACE::File(&str_write, &str_read, &str_seek, &str_close, + reinterpret_cast(buffer), buflen, + bufmode, owned, modeflags), pos(0), eof_marker(0), write_append(false) { - if (modeflags & static_cast(__llvm_libc::File::OpenMode::APPEND)) + if (modeflags & + static_cast(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(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(f); if (sf->write_append) @@ -91,7 +93,7 @@ FileIOResult StringFile::str_write(__llvm_libc::File *f, const void *data, return i; } -ErrorOr StringFile::str_seek(__llvm_libc::File *f, long offset, +ErrorOr StringFile::str_seek(LIBC_NAMESPACE::File *f, long offset, int whence) { StringFile *sf = static_cast(f); if (whence == SEEK_SET) @@ -105,11 +107,11 @@ ErrorOr 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 022c8afa44109b..469d7500032b93 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 // 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 ac79572fdb82f2..1311d729026ef8 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 c0c41d54c39956..2fdf71623ae460 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 a47281a7532d8f..b479e8d287f794 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 84e750a1b9d509..9dd1a6ad9ef236 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 f( - [](long n) { return __llvm_libc::syscall_impl(n); }); - function f1( - [](long n, long a1) { return __llvm_libc::syscall_impl(n, a1); }); + [](long n) { return LIBC_NAMESPACE::syscall_impl(n); }); + function f1([](long n, long a1) { + return LIBC_NAMESPACE::syscall_impl(n, a1); + }); function f2([](long n, long a1, long a2) { - return __llvm_libc::syscall_impl(n, a1, a2); + return LIBC_NAMESPACE::syscall_impl(n, a1, a2); }); function f3( [](long n, long a1, long a2, long a3) { - return __llvm_libc::syscall_impl(n, a1, a2, a3); + return LIBC_NAMESPACE::syscall_impl(n, a1, a2, a3); }); function f4( [](long n, long a1, long a2, long a3, long a4) { - return __llvm_libc::syscall_impl(n, a1, a2, a3, a4); + return LIBC_NAMESPACE::syscall_impl(n, a1, a2, a3, a4); }); function f5( [](long n, long a1, long a2, long a3, long a4, long a5) { - return __llvm_libc::syscall_impl(n, a1, a2, a3, a4, a5); + return LIBC_NAMESPACE::syscall_impl(n, a1, a2, a3, a4, a5); }); function f6( [](long n, long a1, long a2, long a3, long a4, long a5, long a6) { - return __llvm_libc::syscall_impl(n, a1, a2, a3, a4, a5, a6); + return LIBC_NAMESPACE::syscall_impl(n, a1, a2, a3, a4, a5, a6); }); - function not_long_type( - [](long n, void *a1) { return __llvm_libc::syscall_impl(n, a1); }); + function not_long_type([](long n, void *a1) { + return LIBC_NAMESPACE::syscall_impl(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 b575e01bcb9ba0..54821e21f9ccf7 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; -using ProcBType = __llvm_libc::rpc::Process; +using ProcAType = LIBC_NAMESPACE::rpc::Process; +using ProcBType = LIBC_NAMESPACE::rpc::Process; 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 f266ccfdd1ff68..1876cf7f70b4b8 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(); @@ -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(); diff --git a/libc/test/src/__support/blockstore_test.cpp b/libc/test/src/__support/blockstore_test.cpp index 10277af49116d6..f62857275fe4c9 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 void populate_and_iterate() { - __llvm_libc::cpp::BlockStore block_store; + LIBC_NAMESPACE::cpp::BlockStore 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::destroy( + LIBC_NAMESPACE::cpp::BlockStore::destroy( &block_store); } template void back_test() { - using __llvm_libc::cpp::BlockStore; + using LIBC_NAMESPACE::cpp::BlockStore; BlockStore 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 void empty_test() { - using __llvm_libc::cpp::BlockStore; + using LIBC_NAMESPACE::cpp::BlockStore; BlockStore 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 3d60092b504ef4..ea41d534e64cc6 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 42296a68240207..4d95c03cf1398d 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 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 bc1ee3819c4793..a70ebfabed2270 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 fixed_vector; + LIBC_NAMESPACE::FixedVector 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 fixed_vector; + LIBC_NAMESPACE::FixedVector 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 fixed_vector; + LIBC_NAMESPACE::FixedVector 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::destroy(&fixed_vector); + LIBC_NAMESPACE::FixedVector::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 abe4a604b4a390..a9c039e45774e9 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(1)); EXPECT_EQ(hpd.round_to_integer_type(), uint64_t(1)); @@ -360,7 +360,7 @@ TEST(LlvmLibcHighPrecisionDecimalTest, RoundingTest) { EXPECT_EQ(hpd.round_to_integer_type(), 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(2)); EXPECT_EQ(hpd.round_to_integer_type(), 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(1099511627776)); EXPECT_EQ(hpd.round_to_integer_type(), 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 991582e896d2fe..c8913bf461bb36 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>; EXPECT(type, static_cast(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 4ebdb33549ef62..ae729418ebe363 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 void clinger_fast_path_test( - const typename __llvm_libc::fputil::FPBits::UIntType inputMantissa, + const typename LIBC_NAMESPACE::fputil::FPBits::UIntType inputMantissa, const int32_t inputExp10, - const typename __llvm_libc::fputil::FPBits::UIntType + const typename LIBC_NAMESPACE::fputil::FPBits::UIntType expectedOutputMantissa, const uint32_t expectedOutputExp2) { - typename __llvm_libc::fputil::FPBits::UIntType actual_output_mantissa = - 0; + typename LIBC_NAMESPACE::fputil::FPBits::UIntType + actual_output_mantissa = 0; uint32_t actual_output_exp2 = 0; - auto result = __llvm_libc::internal::clinger_fast_path( + auto result = LIBC_NAMESPACE::internal::clinger_fast_path( {inputMantissa, inputExp10}); ASSERT_TRUE(result.has_value()); @@ -40,26 +40,26 @@ class LlvmLibcStrToFloatTest : public __llvm_libc::testing::Test { template void clinger_fast_path_fails_test( - const typename __llvm_libc::fputil::FPBits::UIntType inputMantissa, + const typename LIBC_NAMESPACE::fputil::FPBits::UIntType inputMantissa, const int32_t inputExp10) { - ASSERT_FALSE( - __llvm_libc::internal::clinger_fast_path({inputMantissa, inputExp10}) - .has_value()); + ASSERT_FALSE(LIBC_NAMESPACE::internal::clinger_fast_path( + {inputMantissa, inputExp10}) + .has_value()); } template void eisel_lemire_test( - const typename __llvm_libc::fputil::FPBits::UIntType inputMantissa, + const typename LIBC_NAMESPACE::fputil::FPBits::UIntType inputMantissa, const int32_t inputExp10, - const typename __llvm_libc::fputil::FPBits::UIntType + const typename LIBC_NAMESPACE::fputil::FPBits::UIntType expectedOutputMantissa, const uint32_t expectedOutputExp2) { - typename __llvm_libc::fputil::FPBits::UIntType actual_output_mantissa = - 0; + typename LIBC_NAMESPACE::fputil::FPBits::UIntType + actual_output_mantissa = 0; uint32_t actual_output_exp2 = 0; auto result = - __llvm_libc::internal::eisel_lemire({inputMantissa, inputExp10}); + LIBC_NAMESPACE::internal::eisel_lemire({inputMantissa, inputExp10}); ASSERT_TRUE(result.has_value()); @@ -73,15 +73,16 @@ class LlvmLibcStrToFloatTest : public __llvm_libc::testing::Test { template void simple_decimal_conversion_test( const char *__restrict numStart, - const typename __llvm_libc::fputil::FPBits::UIntType + const typename LIBC_NAMESPACE::fputil::FPBits::UIntType expectedOutputMantissa, const uint32_t expectedOutputExp2, const int expectedErrno = 0) { - typename __llvm_libc::fputil::FPBits::UIntType actual_output_mantissa = - 0; + typename LIBC_NAMESPACE::fputil::FPBits::UIntType + actual_output_mantissa = 0; uint32_t actual_output_exp2 = 0; libc_errno = 0; - auto result = __llvm_libc::internal::simple_decimal_conversion(numStart); + auto result = + LIBC_NAMESPACE::internal::simple_decimal_conversion(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(0), 64u); + EXPECT_EQ(LIBC_NAMESPACE::internal::leading_zeroes(0), 64u); for (; num_of_zeroes < 64; test_num64 <<= 1, num_of_zeroes--) { - EXPECT_EQ(__llvm_libc::internal::leading_zeroes(test_num64), + EXPECT_EQ(LIBC_NAMESPACE::internal::leading_zeroes(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(test_num64), + EXPECT_EQ(LIBC_NAMESPACE::internal::leading_zeroes(test_num64), num_of_zeroes); } - EXPECT_EQ(__llvm_libc::internal::leading_zeroes(0xffffffffffffffff), - 0u); + EXPECT_EQ( + LIBC_NAMESPACE::internal::leading_zeroes(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(test_num64), + EXPECT_EQ(LIBC_NAMESPACE::internal::leading_zeroes(test_num64), num_of_zeroes); } uint64_t test_num32 = 1; num_of_zeroes = 31; - EXPECT_EQ(__llvm_libc::internal::leading_zeroes(0), 32u); + EXPECT_EQ(LIBC_NAMESPACE::internal::leading_zeroes(0), 32u); for (; num_of_zeroes < 32; test_num32 <<= 1, num_of_zeroes--) { - EXPECT_EQ(__llvm_libc::internal::leading_zeroes(test_num32), + EXPECT_EQ(LIBC_NAMESPACE::internal::leading_zeroes(test_num32), num_of_zeroes); } - EXPECT_EQ(__llvm_libc::internal::leading_zeroes(0xffffffff), 0u); + EXPECT_EQ(LIBC_NAMESPACE::internal::leading_zeroes(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({12345678901234549760u, 0}) + LIBC_NAMESPACE::internal::eisel_lemire({12345678901234549760u, 0}) .has_value()); ASSERT_FALSE( - __llvm_libc::internal::eisel_lemire({20040229, 0}).has_value()); + LIBC_NAMESPACE::internal::eisel_lemire({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( - "123456789012345678900"); + auto float_result = + LIBC_NAMESPACE::internal::simple_decimal_conversion( + "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( - "123456789012345678900"); + auto double_result = + LIBC_NAMESPACE::internal::simple_decimal_conversion( + "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( + ASSERT_FALSE(LIBC_NAMESPACE::internal::eisel_lemire( {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({1, 1000}).has_value()); - ASSERT_FALSE( - __llvm_libc::internal::eisel_lemire({1, -1000}).has_value()); + ASSERT_FALSE(LIBC_NAMESPACE::internal::eisel_lemire({1, 1000}) + .has_value()); + ASSERT_FALSE(LIBC_NAMESPACE::internal::eisel_lemire({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( + LIBC_NAMESPACE::internal::eisel_lemire( {(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 3fe9b26bc42560..971bac55bd9d3f 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 8a896494e29f74..d5d25506053405 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 d44263a6ea7d15..b71d36111d7256 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 916aae3ecd05e5..10cdb962ee2ee5 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 80b0b1c162675f..646756eb0861b5 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 f34e0cb37be97b..97041fbc8fd863 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 89b0c9a1490791..f8a0804cefbd2f 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 fd49475f5bc0c9..a9f84db3ef7e87 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 7c3ed36d9ec9e2..4d57d677fc4ba5 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 c399cc4e6d59ad..ba7caf65b6fd39 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 08963209c1d4cb..48378c45e1ef98 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 3b82e1958d768a..ecf78e1eb9b469 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 9777bb24fc1a7a..6e11919100ec98 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 5407c763528e72..05b2fd069ef069 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 b98d3bde6d064a..b8f27a968540cb 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 d5dde8c85d6176..92f80724261772 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 2c2b7d966202af..3770ce4ea68b69 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 d0879d48e77fde..0413b43fb6009b 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 72f9f4632c8dc7..ff1a30a2639fe2 100644 --- a/libc/test/src/dirent/dirent_test.cpp +++ b/libc/test/src/dirent/dirent_test.cpp @@ -17,20 +17,20 @@ #include -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 1b0e8cb43a92ff..ca926b30e62faf 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 73cce41563b909..b95f3f21272011 100644 --- a/libc/test/src/fcntl/openat_test.cpp +++ b/libc/test/src/fcntl/openat_test.cpp @@ -17,27 +17,27 @@ #include 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 bb0c572da7541d..f9509202ab680e 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 9d26fe7b93ba65..434adc06b1a36a 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 3563187c917e04..e4e2240fc374c8 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 80414b2d2cd850..fa3e856d1ba200 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 c27a2bff6a0387..c891a552d40cfe 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 40e336ef41af3b..fe23ef23226ad4 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 1b3884a7337fe7..96f253f76077a0 100644 --- a/libc/test/src/fenv/feupdateenv_test.cpp +++ b/libc/test/src/fenv/feupdateenv_test.cpp @@ -15,13 +15,13 @@ #include 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 5fe21325e1e791..8184a5c3bb9997 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 0f03b5f50cf915..4560160e8e2e9b 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 7c9870495c35a4..8d3a8a2984bb46 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 321aad5d0ebc51..59eb1d71158d09 100644 --- a/libc/test/src/inttypes/imaxdiv_test.cpp +++ b/libc/test/src/inttypes/imaxdiv_test.cpp @@ -12,4 +12,4 @@ #include -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 3947e684fbbcab..de76d621d268dc 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 77c6dedf6b98d1..82d7be92bb1d35 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 78c1a08b9c82ea..d1e2b2e6fd17d4 100644 --- a/libc/test/src/math/CeilTest.h +++ b/libc/test/src/math/CeilTest.h @@ -12,9 +12,9 @@ #include -namespace mpfr = __llvm_libc::testing::mpfr; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; -template class CeilTest : public __llvm_libc::testing::Test { +template 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 3d1eed1b066242..aecd012d1d524a 100644 --- a/libc/test/src/math/CopySignTest.h +++ b/libc/test/src/math/CopySignTest.h @@ -12,9 +12,10 @@ #include -namespace mpfr = __llvm_libc::testing::mpfr; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; -template class CopySignTest : public __llvm_libc::testing::Test { +template +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 38b09cff19e2dd..3342926142ff1f 100644 --- a/libc/test/src/math/FAbsTest.h +++ b/libc/test/src/math/FAbsTest.h @@ -12,9 +12,9 @@ #include -namespace mpfr = __llvm_libc::testing::mpfr; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; -template class FAbsTest : public __llvm_libc::testing::Test { +template 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 c0dbda10b318b9..3118c3661013e7 100644 --- a/libc/test/src/math/FDimTest.h +++ b/libc/test/src/math/FDimTest.h @@ -13,10 +13,10 @@ #include template -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; + using FPBits = LIBC_NAMESPACE::fputil::FPBits; 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::build_quiet_nan(1)); - const T inf = T(__llvm_libc::fputil::FPBits::inf()); - const T neg_inf = T(__llvm_libc::fputil::FPBits::neg_inf()); - const T zero = T(__llvm_libc::fputil::FPBits::zero()); - const T neg_zero = T(__llvm_libc::fputil::FPBits::neg_zero()); + const T nan = T(LIBC_NAMESPACE::fputil::FPBits::build_quiet_nan(1)); + const T inf = T(LIBC_NAMESPACE::fputil::FPBits::inf()); + const T neg_inf = T(LIBC_NAMESPACE::fputil::FPBits::neg_inf()); + const T zero = T(LIBC_NAMESPACE::fputil::FPBits::zero()); + const T neg_zero = T(LIBC_NAMESPACE::fputil::FPBits::neg_zero()); }; diff --git a/libc/test/src/math/FMaxTest.h b/libc/test/src/math/FMaxTest.h index 0a6c767588c11d..e371086274acf7 100644 --- a/libc/test/src/math/FMaxTest.h +++ b/libc/test/src/math/FMaxTest.h @@ -12,9 +12,9 @@ #include -namespace mpfr = __llvm_libc::testing::mpfr; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; -template class FMaxTest : public __llvm_libc::testing::Test { +template 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 10c87f9d6a102d..7f8393ac2b5e91 100644 --- a/libc/test/src/math/FMinTest.h +++ b/libc/test/src/math/FMinTest.h @@ -12,9 +12,9 @@ #include -namespace mpfr = __llvm_libc::testing::mpfr; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; -template class FMinTest : public __llvm_libc::testing::Test { +template 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 6bff888294d2b0..5fc0ebf6d33e40 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 class FmodTest : public __llvm_libc::testing::Test { +template 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 ce1075af769957..843c70ba2baeb3 100644 --- a/libc/test/src/math/FloorTest.h +++ b/libc/test/src/math/FloorTest.h @@ -12,9 +12,9 @@ #include -namespace mpfr = __llvm_libc::testing::mpfr; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; -template class FloorTest : public __llvm_libc::testing::Test { +template 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 3a5ed2bf3e53bf..c2573d03792692 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 -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; + using FPBits = LIBC_NAMESPACE::fputil::FPBits; using UIntType = typename FPBits::UIntType; - const T nan = T(__llvm_libc::fputil::FPBits::build_quiet_nan(1)); - const T inf = T(__llvm_libc::fputil::FPBits::inf()); - const T neg_inf = T(__llvm_libc::fputil::FPBits::neg_inf()); - const T zero = T(__llvm_libc::fputil::FPBits::zero()); - const T neg_zero = T(__llvm_libc::fputil::FPBits::neg_zero()); + const T nan = T(LIBC_NAMESPACE::fputil::FPBits::build_quiet_nan(1)); + const T inf = T(LIBC_NAMESPACE::fputil::FPBits::inf()); + const T neg_inf = T(LIBC_NAMESPACE::fputil::FPBits::neg_inf()); + const T zero = T(LIBC_NAMESPACE::fputil::FPBits::zero()); + const T neg_zero = T(LIBC_NAMESPACE::fputil::FPBits::neg_zero()); UIntType get_random_bit_pattern() { UIntType bits{0}; for (UIntType i = 0; i < sizeof(UIntType) / 2; ++i) { - bits = - (bits << 2) + static_cast(__llvm_libc::testutils::rand()); + bits = (bits << 2) + + static_cast(LIBC_NAMESPACE::testutils::rand()); } return bits; } diff --git a/libc/test/src/math/FrexpTest.h b/libc/test/src/math/FrexpTest.h index 6bfb4d276e9854..19c98872e04116 100644 --- a/libc/test/src/math/FrexpTest.h +++ b/libc/test/src/math/FrexpTest.h @@ -13,14 +13,14 @@ #include -namespace mpfr = __llvm_libc::testing::mpfr; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; -template class FrexpTest : public __llvm_libc::testing::Test { +template class FrexpTest : public LIBC_NAMESPACE::testing::Test { DECLARE_SPECIAL_CONSTANTS(T) static constexpr UIntType HIDDEN_BIT = - UIntType(1) << __llvm_libc::fputil::MantissaWidth::VALUE; + UIntType(1) << LIBC_NAMESPACE::fputil::MantissaWidth::VALUE; public: typedef T (*FrexpFunc)(T, int *); @@ -103,8 +103,8 @@ template class FrexpTest : public __llvm_libc::testing::Test { mpfr::BinaryOutput 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 d1409265c6709a..c01a771b9505fa 100644 --- a/libc/test/src/math/HypotTest.h +++ b/libc/test/src/math/HypotTest.h @@ -16,13 +16,13 @@ #include -namespace mpfr = __llvm_libc::testing::mpfr; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; template -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; + using FPBits = LIBC_NAMESPACE::fputil::FPBits; 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 6ad5eb065c8aa4..e51a5d7a2544cd 100644 --- a/libc/test/src/math/ILogbTest.h +++ b/libc/test/src/math/ILogbTest.h @@ -16,7 +16,7 @@ #include -class LlvmLibcILogbTest : public __llvm_libc::testing::Test { +class LlvmLibcILogbTest : public LIBC_NAMESPACE::testing::Test { public: template struct ILogbFunc { typedef int (*Func)(T); @@ -24,14 +24,15 @@ class LlvmLibcILogbTest : public __llvm_libc::testing::Test { template void test_special_numbers(typename ILogbFunc::Func func) { - EXPECT_EQ(FP_ILOGB0, func(T(__llvm_libc::fputil::FPBits::zero()))); - EXPECT_EQ(FP_ILOGB0, func(T(__llvm_libc::fputil::FPBits::neg_zero()))); + EXPECT_EQ(FP_ILOGB0, func(T(LIBC_NAMESPACE::fputil::FPBits::zero()))); + EXPECT_EQ(FP_ILOGB0, + func(T(LIBC_NAMESPACE::fputil::FPBits::neg_zero()))); EXPECT_EQ(FP_ILOGBNAN, - func(T(__llvm_libc::fputil::FPBits::build_quiet_nan(1)))); + func(T(LIBC_NAMESPACE::fputil::FPBits::build_quiet_nan(1)))); - EXPECT_EQ(INT_MAX, func(T(__llvm_libc::fputil::FPBits::inf()))); - EXPECT_EQ(INT_MAX, func(T(__llvm_libc::fputil::FPBits::neg_inf()))); + EXPECT_EQ(INT_MAX, func(T(LIBC_NAMESPACE::fputil::FPBits::inf()))); + EXPECT_EQ(INT_MAX, func(T(LIBC_NAMESPACE::fputil::FPBits::neg_inf()))); } template @@ -75,7 +76,7 @@ class LlvmLibcILogbTest : public __llvm_libc::testing::Test { template void test_subnormal_range(typename ILogbFunc::Func func) { - using FPBits = __llvm_libc::fputil::FPBits; + using FPBits = LIBC_NAMESPACE::fputil::FPBits; 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 void test_normal_range(typename ILogbFunc::Func func) { - using FPBits = __llvm_libc::fputil::FPBits; + using FPBits = LIBC_NAMESPACE::fputil::FPBits; 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 2e592995ae792e..bffa7335fb25b1 100644 --- a/libc/test/src/math/LdExpTest.h +++ b/libc/test/src/math/LdExpTest.h @@ -19,20 +19,20 @@ #include template -class LdExpTestTemplate : public __llvm_libc::testing::Test { - using FPBits = __llvm_libc::fputil::FPBits; - using NormalFloat = __llvm_libc::fputil::NormalFloat; +class LdExpTestTemplate : public LIBC_NAMESPACE::testing::Test { + using FPBits = LIBC_NAMESPACE::fputil::FPBits; + using NormalFloat = LIBC_NAMESPACE::fputil::NormalFloat; using UIntType = typename FPBits::UIntType; static constexpr UIntType MANTISSA_WIDTH = - __llvm_libc::fputil::MantissaWidth::VALUE; + LIBC_NAMESPACE::fputil::MantissaWidth::VALUE; // A normalized mantissa to be used with tests. static constexpr UIntType MANTISSA = NormalFloat::ONE + 0x1234; - const T zero = T(__llvm_libc::fputil::FPBits::zero()); - const T neg_zero = T(__llvm_libc::fputil::FPBits::neg_zero()); - const T inf = T(__llvm_libc::fputil::FPBits::inf()); - const T neg_inf = T(__llvm_libc::fputil::FPBits::neg_inf()); - const T nan = T(__llvm_libc::fputil::FPBits::build_quiet_nan(1)); + const T zero = T(LIBC_NAMESPACE::fputil::FPBits::zero()); + const T neg_zero = T(LIBC_NAMESPACE::fputil::FPBits::neg_zero()); + const T inf = T(LIBC_NAMESPACE::fputil::FPBits::inf()); + const T neg_inf = T(LIBC_NAMESPACE::fputil::FPBits::neg_inf()); + const T nan = T(LIBC_NAMESPACE::fputil::FPBits::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 b4a17fd9b0c34f..c2cf4f1f148333 100644 --- a/libc/test/src/math/LogbTest.h +++ b/libc/test/src/math/LogbTest.h @@ -13,14 +13,14 @@ #include -namespace mpfr = __llvm_libc::testing::mpfr; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; -template class LogbTest : public __llvm_libc::testing::Test { +template class LogbTest : public LIBC_NAMESPACE::testing::Test { DECLARE_SPECIAL_CONSTANTS(T) static constexpr UIntType HIDDEN_BIT = - UIntType(1) << __llvm_libc::fputil::MantissaWidth::VALUE; + UIntType(1) << LIBC_NAMESPACE::fputil::MantissaWidth::VALUE; public: typedef T (*LogbFunc)(T); @@ -80,7 +80,7 @@ template 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 e4596c232287a3..21adef8a08d8d4 100644 --- a/libc/test/src/math/ModfTest.h +++ b/libc/test/src/math/ModfTest.h @@ -14,9 +14,9 @@ #include -namespace mpfr = __llvm_libc::testing::mpfr; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; -template class ModfTest : public __llvm_libc::testing::Test { +template class ModfTest : public LIBC_NAMESPACE::testing::Test { DECLARE_SPECIAL_CONSTANTS(T) @@ -93,8 +93,8 @@ template 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 e6de9419d99040..4e450cf5bc1e9e 100644 --- a/libc/test/src/math/NextAfterTest.h +++ b/libc/test/src/math/NextAfterTest.h @@ -18,13 +18,13 @@ #include template -class NextAfterTestTemplate : public __llvm_libc::testing::Test { - using FPBits = __llvm_libc::fputil::FPBits; - using MantissaWidth = __llvm_libc::fputil::MantissaWidth; +class NextAfterTestTemplate : public LIBC_NAMESPACE::testing::Test { + using FPBits = LIBC_NAMESPACE::fputil::FPBits; + using MantissaWidth = LIBC_NAMESPACE::fputil::MantissaWidth; using UIntType = typename FPBits::UIntType; static constexpr int BIT_WIDTH_OF_TYPE = - __llvm_libc::fputil::FloatProperties::BIT_WIDTH; + LIBC_NAMESPACE::fputil::FloatProperties::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(expected_bits); + T expected = LIBC_NAMESPACE::cpp::bit_cast(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(expected_bits); + expected = LIBC_NAMESPACE::cpp::bit_cast(expected_bits); ASSERT_FP_EQ(result, expected); x = neg_zero; result = func(x, 1); expected_bits = 1; - expected = __llvm_libc::cpp::bit_cast(expected_bits); + expected = LIBC_NAMESPACE::cpp::bit_cast(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(expected_bits); + expected = LIBC_NAMESPACE::cpp::bit_cast(expected_bits); ASSERT_FP_EQ(result, expected); // 'from' is max subnormal value. - x = __llvm_libc::cpp::bit_cast(max_subnormal); + x = LIBC_NAMESPACE::cpp::bit_cast(max_subnormal); result = func(x, 1); - expected = __llvm_libc::cpp::bit_cast(min_normal); + expected = LIBC_NAMESPACE::cpp::bit_cast(min_normal); ASSERT_FP_EQ(result, expected); result = func(x, 0); expected_bits = max_subnormal - 1; - expected = __llvm_libc::cpp::bit_cast(expected_bits); + expected = LIBC_NAMESPACE::cpp::bit_cast(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(expected_bits); + expected = LIBC_NAMESPACE::cpp::bit_cast(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(expected_bits); + expected = LIBC_NAMESPACE::cpp::bit_cast(expected_bits); ASSERT_FP_EQ(result, expected); // 'from' is min subnormal value. - x = __llvm_libc::cpp::bit_cast(min_subnormal); + x = LIBC_NAMESPACE::cpp::bit_cast(min_subnormal); result = func(x, 1); expected_bits = min_subnormal + 1; - expected = __llvm_libc::cpp::bit_cast(expected_bits); + expected = LIBC_NAMESPACE::cpp::bit_cast(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(expected_bits); + expected = LIBC_NAMESPACE::cpp::bit_cast(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(min_normal); + x = LIBC_NAMESPACE::cpp::bit_cast(min_normal); result = func(x, 0); expected_bits = max_subnormal; - expected = __llvm_libc::cpp::bit_cast(expected_bits); + expected = LIBC_NAMESPACE::cpp::bit_cast(expected_bits); ASSERT_FP_EQ(result, expected); result = func(x, inf); expected_bits = min_normal + 1; - expected = __llvm_libc::cpp::bit_cast(expected_bits); + expected = LIBC_NAMESPACE::cpp::bit_cast(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(expected_bits); + expected = LIBC_NAMESPACE::cpp::bit_cast(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(expected_bits); + expected = LIBC_NAMESPACE::cpp::bit_cast(expected_bits); ASSERT_FP_EQ(result, expected); // 'from' is max normal and 'to' is infinity. - x = __llvm_libc::cpp::bit_cast(max_normal); + x = LIBC_NAMESPACE::cpp::bit_cast(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(expected_bits); + expected = LIBC_NAMESPACE::cpp::bit_cast(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(expected_bits); + expected = LIBC_NAMESPACE::cpp::bit_cast(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 b18123139d8cac..272112142e21e0 100644 --- a/libc/test/src/math/RIntTest.h +++ b/libc/test/src/math/RIntTest.h @@ -19,18 +19,18 @@ #include #include -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 -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; + using FPBits = LIBC_NAMESPACE::fputil::FPBits; 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 0ccc62327f0591..0d09764f6056d6 100644 --- a/libc/test/src/math/RandUtils.cpp +++ b/libc/test/src/math/RandUtils.cpp @@ -10,10 +10,10 @@ #include -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 b65a98bfed21d9..05236ead2aced1 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 5766beff2cebac..6da0756c3a1b3d 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 -namespace mpfr = __llvm_libc::testing::mpfr; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; template -class RemQuoTestTemplate : public __llvm_libc::testing::Test { - using FPBits = __llvm_libc::fputil::FPBits; +class RemQuoTestTemplate : public LIBC_NAMESPACE::testing::Test { + using FPBits = LIBC_NAMESPACE::fputil::FPBits; using UIntType = typename FPBits::UIntType; - const T zero = T(__llvm_libc::fputil::FPBits::zero()); - const T neg_zero = T(__llvm_libc::fputil::FPBits::neg_zero()); - const T inf = T(__llvm_libc::fputil::FPBits::inf()); - const T neg_inf = T(__llvm_libc::fputil::FPBits::neg_inf()); - const T nan = T(__llvm_libc::fputil::FPBits::build_quiet_nan(1)); + const T zero = T(LIBC_NAMESPACE::fputil::FPBits::zero()); + const T neg_zero = T(LIBC_NAMESPACE::fputil::FPBits::neg_zero()); + const T inf = T(LIBC_NAMESPACE::fputil::FPBits::inf()); + const T neg_inf = T(LIBC_NAMESPACE::fputil::FPBits::neg_inf()); + const T nan = T(LIBC_NAMESPACE::fputil::FPBits::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 0e104e22444b58..e99491ccf380f8 100644 --- a/libc/test/src/math/RoundTest.h +++ b/libc/test/src/math/RoundTest.h @@ -12,9 +12,9 @@ #include -namespace mpfr = __llvm_libc::testing::mpfr; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; -template class RoundTest : public __llvm_libc::testing::Test { +template 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 a7b85edac63721..6b205869e7a7a7 100644 --- a/libc/test/src/math/RoundToIntegerTest.h +++ b/libc/test/src/math/RoundToIntegerTest.h @@ -18,32 +18,32 @@ #include #include -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 -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; + using FPBits = LIBC_NAMESPACE::fputil::FPBits; using UIntType = typename FPBits::UIntType; - const F zero = F(__llvm_libc::fputil::FPBits::zero()); - const F neg_zero = F(__llvm_libc::fputil::FPBits::neg_zero()); - const F inf = F(__llvm_libc::fputil::FPBits::inf()); - const F neg_inf = F(__llvm_libc::fputil::FPBits::neg_inf()); - const F nan = F(__llvm_libc::fputil::FPBits::build_quiet_nan(1)); + const F zero = F(LIBC_NAMESPACE::fputil::FPBits::zero()); + const F neg_zero = F(LIBC_NAMESPACE::fputil::FPBits::neg_zero()); + const F inf = F(LIBC_NAMESPACE::fputil::FPBits::inf()); + const F neg_inf = F(LIBC_NAMESPACE::fputil::FPBits::neg_inf()); + const F nan = F(LIBC_NAMESPACE::fputil::FPBits::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::VALUE - 1)); + << (LIBC_NAMESPACE::fputil::MantissaWidth::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 f73a14ac4c19d3..24f14b78d2f0f5 100644 --- a/libc/test/src/math/SqrtTest.h +++ b/libc/test/src/math/SqrtTest.h @@ -13,14 +13,14 @@ #include -namespace mpfr = __llvm_libc::testing::mpfr; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; -template class SqrtTest : public __llvm_libc::testing::Test { +template class SqrtTest : public LIBC_NAMESPACE::testing::Test { DECLARE_SPECIAL_CONSTANTS(T) static constexpr UIntType HIDDEN_BIT = - UIntType(1) << __llvm_libc::fputil::MantissaWidth::VALUE; + UIntType(1) << LIBC_NAMESPACE::fputil::MantissaWidth::VALUE; public: typedef T (*SqrtFunc)(T); @@ -48,7 +48,7 @@ template 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(v); + T x = LIBC_NAMESPACE::cpp::bit_cast(v); EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Sqrt, x, func(x), 0.5); } } @@ -57,7 +57,7 @@ template 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(v); + T x = LIBC_NAMESPACE::cpp::bit_cast(v); if (isnan(x) || (x < 0)) { continue; } diff --git a/libc/test/src/math/TruncTest.h b/libc/test/src/math/TruncTest.h index 7d9e1cbb5ae2fc..fa29ee1ce8c3a4 100644 --- a/libc/test/src/math/TruncTest.h +++ b/libc/test/src/math/TruncTest.h @@ -12,9 +12,9 @@ #include -namespace mpfr = __llvm_libc::testing::mpfr; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; -template class TruncTest : public __llvm_libc::testing::Test { +template 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 63895ec3e30aef..cb1a07448b471f 100644 --- a/libc/test/src/math/acosf_test.cpp +++ b/libc/test/src/math/acosf_test.cpp @@ -17,31 +17,31 @@ #include #include -using FPBits = __llvm_libc::fputil::FPBits; +using FPBits = LIBC_NAMESPACE::fputil::FPBits; -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 895503c6bc73cd..846f5033fb39a0 100644 --- a/libc/test/src/math/acoshf_test.cpp +++ b/libc/test/src/math/acoshf_test.cpp @@ -17,28 +17,28 @@ #include #include -using FPBits_t = __llvm_libc::fputil::FPBits; +using FPBits_t = LIBC_NAMESPACE::fputil::FPBits; -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 cc99e5b7b6cac8..49dcd38e82bf59 100644 --- a/libc/test/src/math/asinf_test.cpp +++ b/libc/test/src/math/asinf_test.cpp @@ -18,28 +18,28 @@ #include #include -using FPBits = __llvm_libc::fputil::FPBits; +using FPBits = LIBC_NAMESPACE::fputil::FPBits; -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 cadb9572c372e8..0bbd5db031e079 100644 --- a/libc/test/src/math/asinhf_test.cpp +++ b/libc/test/src/math/asinhf_test.cpp @@ -17,28 +17,28 @@ #include #include -using FPBits_t = __llvm_libc::fputil::FPBits; +using FPBits_t = LIBC_NAMESPACE::fputil::FPBits; -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 cd60b8d8a775e6..c7eab7b6687239 100644 --- a/libc/test/src/math/atanf_test.cpp +++ b/libc/test/src/math/atanf_test.cpp @@ -19,26 +19,26 @@ #include -using FPBits = __llvm_libc::fputil::FPBits; +using FPBits = LIBC_NAMESPACE::fputil::FPBits; -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 021a3f177b821e..c1a8d199718772 100644 --- a/libc/test/src/math/atanhf_test.cpp +++ b/libc/test/src/math/atanhf_test.cpp @@ -17,70 +17,70 @@ #include #include -using FPBits = __llvm_libc::fputil::FPBits; +using FPBits = LIBC_NAMESPACE::fputil::FPBits; -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 2a592e3ee85b0c..800452a43426c7 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 cfa8cb2c5aa6dd..2a2504228adb0a 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 6fe30465edc857..0f766602a0f6d4 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 37bfa0d90c3789..5b3d812c02da4d 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 fec283ccd0c7ac..344ffee2359ec8 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 d1de911196b62b..bed60678dc161d 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 f93d8699e73025..6d8aeaf2230dae 100644 --- a/libc/test/src/math/cos_test.cpp +++ b/libc/test/src/math/cos_test.cpp @@ -13,7 +13,7 @@ #include -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 e9a7ea5db7429f..7b2fdf9f1b6bff 100644 --- a/libc/test/src/math/cosf_test.cpp +++ b/libc/test/src/math/cosf_test.cpp @@ -18,29 +18,29 @@ #include #include -using __llvm_libc::testing::SDCOMP26094_VALUES; -using FPBits = __llvm_libc::fputil::FPBits; +using LIBC_NAMESPACE::testing::SDCOMP26094_VALUES; +using FPBits = LIBC_NAMESPACE::fputil::FPBits; -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 90ce3044b2c11c..f45f35ad3ea058 100644 --- a/libc/test/src/math/coshf_test.cpp +++ b/libc/test/src/math/coshf_test.cpp @@ -18,43 +18,43 @@ #include #include -using FPBits = __llvm_libc::fputil::FPBits; +using FPBits = LIBC_NAMESPACE::fputil::FPBits; -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 ccab38e5287909..1ea50deccb7eaf 100644 --- a/libc/test/src/math/differential_testing/BinaryOpSingleOutputDiff.h +++ b/libc/test/src/math/differential_testing/BinaryOpSingleOutputDiff.h @@ -11,7 +11,7 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace testing { template class BinaryOpSingleOutputDiff { @@ -141,18 +141,18 @@ template 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::run_diff( \ + LIBC_NAMESPACE::testing::BinaryOpSingleOutputDiff::run_diff( \ &myFunc, &otherFunc, filename); \ return 0; \ } #define BINARY_OP_SINGLE_OUTPUT_PERF(T, myFunc, otherFunc, filename) \ int main() { \ - __llvm_libc::testing::BinaryOpSingleOutputDiff::run_perf( \ + LIBC_NAMESPACE::testing::BinaryOpSingleOutputDiff::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 4805e1acac2002..c20cf3152f6220 100644 --- a/libc/test/src/math/differential_testing/SingleInputSingleOutputDiff.h +++ b/libc/test/src/math/differential_testing/SingleInputSingleOutputDiff.h @@ -11,7 +11,7 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace testing { template class SingleInputSingleOutputDiff { @@ -100,18 +100,18 @@ template 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::runDiff( \ + LIBC_NAMESPACE::testing::SingleInputSingleOutputDiff::runDiff( \ &myFunc, &otherFunc, filename); \ return 0; \ } #define SINGLE_INPUT_SINGLE_OUTPUT_PERF(T, myFunc, otherFunc, filename) \ int main() { \ - __llvm_libc::testing::SingleInputSingleOutputDiff::runPerf( \ + LIBC_NAMESPACE::testing::SingleInputSingleOutputDiff::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 6780389d5322d8..979196ae6b8359 100644 --- a/libc/test/src/math/differential_testing/Timer.cpp +++ b/libc/test/src/math/differential_testing/Timer.cpp @@ -11,7 +11,7 @@ #include #include -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 9df13a0d407460..d4acff7ba0eb18 100644 --- a/libc/test/src/math/differential_testing/Timer.h +++ b/libc/test/src/math/differential_testing/Timer.h @@ -11,7 +11,7 @@ #include -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 af911b4cc26228..7c0bb1e95a03fd 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 -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 23420390d15346..c304231e0678de 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 -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 232a3ceb11418b..ee3102384a8e6b 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 -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 3107d199431033..981a94133b8040 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 -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 c1f279a2b466d3..545c6de320fc7c 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 -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 2ffa593c9f6e44..4aae5220e6a516 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 -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 a69efde44c1cab..7c2e90744bc915 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 -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 1a28fd125af071..c34173b21b4f60 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 -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 e12072efec57dd..3cbd8a99690fb4 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 -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 9e8e2dfb8cd92a..3c25ef81d4808c 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 -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 6bf11f654c71cd..9bf9eff888fb51 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 -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 2fcf72de348e23..f9f9cea72c6dae 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 -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 788214fb26407d..6d72927b5010c5 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 -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 498cdc960c66d1..abd1cd7885ffd2 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 -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 c20a7c5140f009..026e529c6cae2a 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 -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 37878bee99c3af..219ee7860a242b 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 -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 634c6399877b0f..7029b1ee42cd0e 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 -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 36d0fe56d964af..c2927bb1ea9d9f 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 -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 28dbd2bfc35e3d..c61e589bdb2dff 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 -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 f90605455f768c..01a72e6fbc3d79 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 -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 e1ee9f28cc55a6..d1c70fc2b6edbd 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 -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 75c61cb0592af2..ed57b186f889ba 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 -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 e890d0393e0af8..60c1161a31cf96 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 -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 9904aba10d35e4..5cd523d82184cc 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 -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 48aec5cb7a8c57..aef431dce48701 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 -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 5bab271fc49e00..ee899394c421ed 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 -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 93439c7fc89816..37441eb40a4dfa 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 -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 38fa331d266448..89d5bd13f9316b 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 -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 6f5c1ef907e706..4ed1307f712081 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 -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 ed907ed61048f5..f1b3f986bd40a3 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 -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 dfcf2fd1cc0e5f..14200116883db4 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 -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 6ee98a967a7064..9c5736fb4ab048 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 -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 2ed954dde5484c..e60f66085e5d70 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 -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 517f04b688e561..432e5da77f3789 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 -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 803566a9e4b843..e1401a01af3574 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 -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 51be6f187e26be..091c7b2b86800f 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 -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 d69db9b1a136bf..cb4557e6796b55 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 -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 b32821a9483236..7247bca2853d88 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 -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 3fdcf930d2582b..22ddeaac9caf99 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 -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 d3ceb9d46fb273..5ae586ba31267d 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 -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 30ed0fab1d898c..7f6ac4e6a92694 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 -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 f5cee930003eac..e07db1320fddd7 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 -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 a25ac6f0fca4c9..3cb24778d96a15 100644 --- a/libc/test/src/math/erff_test.cpp +++ b/libc/test/src/math/erff_test.cpp @@ -16,17 +16,17 @@ #include #include -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 4cece0b76ecacb..df4adae5fd0e64 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; + 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 1dd993c26b8cac..eff8b64a7dae1a 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; + 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 5dcb625304a1f5..f88d254b075041 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; + 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 6af0ec0d6b03d1..8bc62bd393dac4 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; + 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 c7c891ecbbd1ec..508c288b050c55 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; + 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 17bd6ec9dda04b..d2e63b33a0b990 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; +using FPBits = LIBC_NAMESPACE::fputil::FPBits; using LlvmLibcAtanhfExhaustiveTest = LlvmLibcUnaryOpExhaustiveMathTest; + 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 465d8242bc8543..89b75199ba1225 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; + 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 5fb4856b0cf79c..cbfa654800bfd7 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; + 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 f8e1a1b3106317..5b8884a9d4d0c1 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; + 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 00dad034dd6cc4..c4e68d40e8e91e 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. -namespace mpfr = __llvm_libc::testing::mpfr; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; template using UnaryOp = T(T); template 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; + using FPBits = LIBC_NAMESPACE::fputil::FPBits; using UIntType = typename FPBits::UIntType; static constexpr UnaryOp *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 -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 eba0f65de1a8fc..0daad67847b332 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; + 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 8c9b88988ba68c..6b91c36b29e330 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; + 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 75002a2de96538..79ab79433362ae 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; + 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 2cd27f1e88f276..9c50f1a70aa74d 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; + 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 1273cf0b588bd1..b47d24c54869bb 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 #include -namespace mpfr = __llvm_libc::testing::mpfr; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; template -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, - __llvm_libc::fputil::generic::FModDivisionSimpleHelper>; + LIBC_NAMESPACE::fputil::generic::FModDivisionInvMultHelper, + LIBC_NAMESPACE::fputil::generic::FModDivisionSimpleHelper>; static constexpr std::array 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, + using FMod = LIBC_NAMESPACE::fputil::generic::FMod< + T, LIBC_NAMESPACE::fputil::generic::FModFastMathWrapper, DivisionHelper>; using nl = std::numeric_limits; 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 c45e7412a7b126..8812f0e5dcde34 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; + using FPBits = LIBC_NAMESPACE::fputil::FPBits; 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 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 912fda144be674..d626df07e28f41 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; + 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 992781571f0354..698e08e543871c 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; + 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 249ea2e1dfaa14..a84b0964c6045c 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; + 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 cf54ba5e78c23f..2f0ff201e56224 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; + 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 19179243047c08..f73a1a64c5e4dd 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; + using FPBits = LIBC_NAMESPACE::fputil::FPBits; 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 1c0ce568eadf73..72255ae2d64212 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; + 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 50f1094abf14f3..51505afb8c3bf1 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; + 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 e475182a9359a2..6f761320554e37 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; + 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 9e1278b4c3ea51..09e63ea0d89c7c 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; + 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 3c3951c14ffdc0..e341064d5a9ecd 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; + 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 2b4c5ccc13f5d8..86d902eaad306b 100644 --- a/libc/test/src/math/exp10_test.cpp +++ b/libc/test/src/math/exp10_test.cpp @@ -17,20 +17,21 @@ #include #include -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(0.25).uintval(); - uint64_t STOP = __llvm_libc::fputil::FPBits(4.0).uintval(); + uint64_t START = LIBC_NAMESPACE::fputil::FPBits(0.25).uintval(); + uint64_t STOP = LIBC_NAMESPACE::fputil::FPBits(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 384f9064db107f..ac8f5515347054 100644 --- a/libc/test/src/math/exp10f_test.cpp +++ b/libc/test/src/math/exp10f_test.cpp @@ -16,58 +16,58 @@ #include -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 61081690880c50..6a90c9ba911bd3 100644 --- a/libc/test/src/math/exp2_test.cpp +++ b/libc/test/src/math/exp2_test.cpp @@ -17,19 +17,20 @@ #include #include -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(0.25).uintval(); - uint64_t STOP = __llvm_libc::fputil::FPBits(4.0).uintval(); + uint64_t START = LIBC_NAMESPACE::fputil::FPBits(0.25).uintval(); + uint64_t STOP = LIBC_NAMESPACE::fputil::FPBits(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 afd2c0f700514c..987e1b9f59cbb7 100644 --- a/libc/test/src/math/exp2f_test.cpp +++ b/libc/test/src/math/exp2f_test.cpp @@ -17,41 +17,41 @@ #include -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 7ff149acdb32f8..06894bce70699e 100644 --- a/libc/test/src/math/exp_test.cpp +++ b/libc/test/src/math/exp_test.cpp @@ -17,19 +17,20 @@ #include #include -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(0.25).uintval(); - uint64_t STOP = __llvm_libc::fputil::FPBits(4.0).uintval(); + uint64_t START = LIBC_NAMESPACE::fputil::FPBits(0.25).uintval(); + uint64_t STOP = LIBC_NAMESPACE::fputil::FPBits(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 acc0e645a4186a..f015e46d50b6b2 100644 --- a/libc/test/src/math/expf_test.cpp +++ b/libc/test/src/math/expf_test.cpp @@ -16,58 +16,58 @@ #include -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 d6d646db9c89b9..7b402e17fbc7f3 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 -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(x); + double r = LIBC_NAMESPACE::ExpBase::powb_lo(result.lo); return static_cast(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 c05edf8da3cd78..f63c9f464c6d7d 100644 --- a/libc/test/src/math/expm1f_test.cpp +++ b/libc/test/src/math/expm1f_test.cpp @@ -16,53 +16,53 @@ #include -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 2bf0ddda44ade3..0447040ddae306 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 6374a1018f1da4..9f1e2a66d47655 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 ff1320225452a9..37d2b54a4c53e1 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 80174b79b95b83..2f00a30ad1ee6f 100644 --- a/libc/test/src/math/fdim_test.cpp +++ b/libc/test/src/math/fdim_test.cpp @@ -16,16 +16,18 @@ using LlvmLibcFDimTest = FDimTestTemplate; -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 531b89b81ffc9e..27511baf25b6da 100644 --- a/libc/test/src/math/fdimf_test.cpp +++ b/libc/test/src/math/fdimf_test.cpp @@ -16,18 +16,20 @@ using LlvmLibcFDimTest = FDimTestTemplate; -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 bb6c54d567a0b2..45aedb0a1cdea6 100644 --- a/libc/test/src/math/fdiml_test.cpp +++ b/libc/test/src/math/fdiml_test.cpp @@ -16,18 +16,20 @@ using LlvmLibcFDimTest = FDimTestTemplate; -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 e68ed3ecbb603e..9231d07aeb7f8f 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 f0538f7b97b22f..cbb11f36f58da3 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 1b244fd62a117b..26f6a7703ed0f6 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 be6b138342d5c8..20224d99894be6 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 c = (signs & 1) ? -INPUTS[i].c : INPUTS[i].c; mpfr::TernaryInput 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 8d1cf254701c90..b607d4a66f8eb0 100644 --- a/libc/test/src/math/fmaf_test.cpp +++ b/libc/test/src/math/fmaf_test.cpp @@ -13,11 +13,13 @@ using LlvmLibcFmafTest = FmaTestTemplate; 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 9c81c09414f013..6800939625ebc0 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 cf337d4f07e030..25c6f7339e8c95 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 636bc4208caef6..9ac986c00012a0 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 3515f97faca33c..5d241519021d43 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 1a762478af613b..1af5b79155b1dc 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 ce8b705b0385e2..0791f8c4ad8595 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 03790e4941e191..ec39e0567a7ca0 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 2b13379eba2523..5c3c6286e88fef 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 a44aefc7d8b4e3..4d078baffcb393 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 5d78f94ec1e596..577eb9609cfcc5 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 4904ccd14907bb..e5184cd225bcfa 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 cecfc0ee3de3ae..d0ab31ffd0fe63 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) +LIST_SQRT_TESTS(double, LIBC_NAMESPACE::fputil::sqrt) diff --git a/libc/test/src/math/generic_sqrtf_test.cpp b/libc/test/src/math/generic_sqrtf_test.cpp index 64bf92133b98f3..f22ac8829d5ac8 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) +LIST_SQRT_TESTS(float, LIBC_NAMESPACE::fputil::sqrt) diff --git a/libc/test/src/math/generic_sqrtl_test.cpp b/libc/test/src/math/generic_sqrtl_test.cpp index 6b68aaed970048..ddc6a23695be43 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) +LIST_SQRT_TESTS(long double, LIBC_NAMESPACE::fputil::sqrt) diff --git a/libc/test/src/math/hypot_test.cpp b/libc/test/src/math/hypot_test.cpp index 2d7b640adf10ac..8f560f053326b6 100644 --- a/libc/test/src/math/hypot_test.cpp +++ b/libc/test/src/math/hypot_test.cpp @@ -13,13 +13,13 @@ using LlvmLibcHypotTest = HypotTestTemplate; 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 1b2abfd2fb909b..f85be91ca3ec4a 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 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 437e0fc29b76b3..ee16e3dbcd1113 100644 --- a/libc/test/src/math/hypotf_test.cpp +++ b/libc/test/src/math/hypotf_test.cpp @@ -14,17 +14,18 @@ using LlvmLibcHypotfTest = HypotTestTemplate; 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 a77adec4adba44..7011c43386e66a 100644 --- a/libc/test/src/math/ilogb_test.cpp +++ b/libc/test/src/math/ilogb_test.cpp @@ -16,21 +16,21 @@ #include TEST_F(LlvmLibcILogbTest, SpecialNumbers_ilogb) { - test_special_numbers(&__llvm_libc::ilogb); + test_special_numbers(&LIBC_NAMESPACE::ilogb); } TEST_F(LlvmLibcILogbTest, PowersOfTwo_ilogb) { - test_powers_of_two(&__llvm_libc::ilogb); + test_powers_of_two(&LIBC_NAMESPACE::ilogb); } TEST_F(LlvmLibcILogbTest, SomeIntegers_ilogb) { - test_some_integers(&__llvm_libc::ilogb); + test_some_integers(&LIBC_NAMESPACE::ilogb); } TEST_F(LlvmLibcILogbTest, SubnormalRange_ilogb) { - test_subnormal_range(&__llvm_libc::ilogb); + test_subnormal_range(&LIBC_NAMESPACE::ilogb); } TEST_F(LlvmLibcILogbTest, NormalRange_ilogb) { - test_normal_range(&__llvm_libc::ilogb); + test_normal_range(&LIBC_NAMESPACE::ilogb); } diff --git a/libc/test/src/math/ilogbf_test.cpp b/libc/test/src/math/ilogbf_test.cpp index 20904a13c98a81..dcff8eeb151805 100644 --- a/libc/test/src/math/ilogbf_test.cpp +++ b/libc/test/src/math/ilogbf_test.cpp @@ -16,21 +16,21 @@ #include TEST_F(LlvmLibcILogbTest, SpecialNumbers_ilogbf) { - test_special_numbers(&__llvm_libc::ilogbf); + test_special_numbers(&LIBC_NAMESPACE::ilogbf); } TEST_F(LlvmLibcILogbTest, PowersOfTwo_ilogbf) { - test_powers_of_two(&__llvm_libc::ilogbf); + test_powers_of_two(&LIBC_NAMESPACE::ilogbf); } TEST_F(LlvmLibcILogbTest, SomeIntegers_ilogbf) { - test_some_integers(&__llvm_libc::ilogbf); + test_some_integers(&LIBC_NAMESPACE::ilogbf); } TEST_F(LlvmLibcILogbTest, SubnormalRange_ilogbf) { - test_subnormal_range(&__llvm_libc::ilogbf); + test_subnormal_range(&LIBC_NAMESPACE::ilogbf); } TEST_F(LlvmLibcILogbTest, NormalRange_ilogbf) { - test_normal_range(&__llvm_libc::ilogbf); + test_normal_range(&LIBC_NAMESPACE::ilogbf); } diff --git a/libc/test/src/math/ilogbl_test.cpp b/libc/test/src/math/ilogbl_test.cpp index 9647f232245dc3..29a221ad7f08f7 100644 --- a/libc/test/src/math/ilogbl_test.cpp +++ b/libc/test/src/math/ilogbl_test.cpp @@ -16,21 +16,21 @@ #include TEST_F(LlvmLibcILogbTest, SpecialNumbers_ilogbl) { - test_special_numbers(&__llvm_libc::ilogbl); + test_special_numbers(&LIBC_NAMESPACE::ilogbl); } TEST_F(LlvmLibcILogbTest, PowersOfTwo_ilogbl) { - test_powers_of_two(&__llvm_libc::ilogbl); + test_powers_of_two(&LIBC_NAMESPACE::ilogbl); } TEST_F(LlvmLibcILogbTest, SomeIntegers_ilogbl) { - test_some_integers(&__llvm_libc::ilogbl); + test_some_integers(&LIBC_NAMESPACE::ilogbl); } TEST_F(LlvmLibcILogbTest, SubnormalRange_ilogbl) { - test_subnormal_range(&__llvm_libc::ilogbl); + test_subnormal_range(&LIBC_NAMESPACE::ilogbl); } TEST_F(LlvmLibcILogbTest, NormalRange_ilogbl) { - test_normal_range(&__llvm_libc::ilogbl); + test_normal_range(&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 ffcca5cce42039..4f50027bf82a83 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 -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 c078aa4b7ef84c..aad580f95fb99d 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 4fe80fc79151cd..f4cce37b9277dc 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 5e6e6e75ae0855..405e53390e8c34 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 8027004bd50a5d..8cf7d92095891b 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 9ad710e4698350..0d9d3c4111bb24 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 948e961e57bd4d..1ceb9fecc40391 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 c86095dc9aae03..bda2fca6e8659f 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 5e36258c246ae1..a35b5fabbac34c 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 8fbc840c4f2acc..e43d49f4cbe1bf 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 f841fbed8a9f8b..46458c324673b0 100644 --- a/libc/test/src/math/log10_test.cpp +++ b/libc/test/src/math/log10_test.cpp @@ -17,19 +17,21 @@ #include #include -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 444a742003235f..05c42b9265ad92 100644 --- a/libc/test/src/math/log10f_test.cpp +++ b/libc/test/src/math/log10f_test.cpp @@ -16,19 +16,20 @@ #include #include -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 c128c5e6c918f4..b677e7b416e1a6 100644 --- a/libc/test/src/math/log1p_test.cpp +++ b/libc/test/src/math/log1p_test.cpp @@ -17,19 +17,20 @@ #include #include -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 264687d5fc2b0e..d8132e479e83db 100644 --- a/libc/test/src/math/log1pf_test.cpp +++ b/libc/test/src/math/log1pf_test.cpp @@ -17,17 +17,17 @@ #include #include -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 c4756875d6a54b..42643fa7083fc1 100644 --- a/libc/test/src/math/log2_test.cpp +++ b/libc/test/src/math/log2_test.cpp @@ -17,19 +17,20 @@ #include #include -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 afc7a748c63d5f..d4f4b937c95543 100644 --- a/libc/test/src/math/log2f_test.cpp +++ b/libc/test/src/math/log2f_test.cpp @@ -16,18 +16,20 @@ #include -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 5b662534bbf580..caa274828fd66a 100644 --- a/libc/test/src/math/log_test.cpp +++ b/libc/test/src/math/log_test.cpp @@ -17,19 +17,19 @@ #include #include -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 b90348522aa3aa..2dc56c2e613ccb 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 727eefffbb1740..c25485ca78b065 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 1c7b0d4e66e84e..b26cee65783c42 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 6f8983c4645dff..832bdd21edd417 100644 --- a/libc/test/src/math/logf_test.cpp +++ b/libc/test/src/math/logf_test.cpp @@ -15,18 +15,20 @@ #include -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 0dbfa3dd466d99..9cff2661225361 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 407813aa83c0fe..9c696a39e6928c 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 a4551c38de1066..e44dd30d2c6ccc 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 0ee580f316b44a..1fb2fc71e20ccb 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 7a2aad20e4f664..38fe5c7d1a52dc 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 c0ea3397820523..8a29ba95a61732 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 ff89517506b4f2..b4b03bad848de5 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 440304ab95ac78..068dbc3f531359 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 c98678b3e9243e..ae8a72642c5871 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 2dde48ceb053c6..998b19fb1dccd3 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 14234c717797eb..31770bc591ec1f 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 db85d83edc690e..4c8577f2690a1f 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 8efec397f39d33..4358331a8f76e2 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 1af4ba4e0153b5..590b4ffb4595fd 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 e4438e83fe18ce..ae2db449304105 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 eafa1a7fe6119f..9c89b7acec56d5 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 c15a697fac9208..f875bab2556cad 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 6c50873a272d04..458ca05a985af5 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 87ce079e89afc2..dbcb56717e2083 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 0a182dd02deee6..053596a16e22f6 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 32cf724fb7c4f3..2a2a213a8181cd 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 d4d60bf8afca18..413a2395ca3c57 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 cbf2e7e1361e10..e97781c2b23546 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 197887b2448c05..b0e00537909024 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 284578b8f78568..4a77b2a4cd078a 100644 --- a/libc/test/src/math/sdcomp26094.h +++ b/libc/test/src/math/sdcomp26094.h @@ -13,15 +13,15 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace testing { -static constexpr __llvm_libc::cpp::array SDCOMP26094_VALUES{ +static constexpr LIBC_NAMESPACE::cpp::array 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 d92bd8553a2ef0..ee8451f5008106 100644 --- a/libc/test/src/math/sin_test.cpp +++ b/libc/test/src/math/sin_test.cpp @@ -14,7 +14,7 @@ #include -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 3a5bdd12fbc38a..f67fba1d31dfcd 100644 --- a/libc/test/src/math/sincosf_test.cpp +++ b/libc/test/src/math/sincosf_test.cpp @@ -18,10 +18,10 @@ #include #include -using __llvm_libc::testing::SDCOMP26094_VALUES; -using FPBits = __llvm_libc::fputil::FPBits; +using LIBC_NAMESPACE::testing::SDCOMP26094_VALUES; +using FPBits = LIBC_NAMESPACE::fputil::FPBits; -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 3c94ae86a21c4e..24251104421269 100644 --- a/libc/test/src/math/sinf_test.cpp +++ b/libc/test/src/math/sinf_test.cpp @@ -18,29 +18,29 @@ #include #include -using __llvm_libc::testing::SDCOMP26094_VALUES; -using FPBits = __llvm_libc::fputil::FPBits; +using LIBC_NAMESPACE::testing::SDCOMP26094_VALUES; +using FPBits = LIBC_NAMESPACE::fputil::FPBits; -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 f42b8318af8241..92284ca7d0988d 100644 --- a/libc/test/src/math/sinhf_test.cpp +++ b/libc/test/src/math/sinhf_test.cpp @@ -18,28 +18,28 @@ #include #include -using FPBits = __llvm_libc::fputil::FPBits; +using FPBits = LIBC_NAMESPACE::fputil::FPBits; -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 053218386cbcf3..c10fd281601435 100644 --- a/libc/test/src/math/smoke/CeilTest.h +++ b/libc/test/src/math/smoke/CeilTest.h @@ -11,7 +11,7 @@ #include -template class CeilTest : public __llvm_libc::testing::Test { +template 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 2d50dd4877b10a..c33f78038a3cff 100644 --- a/libc/test/src/math/smoke/CopySignTest.h +++ b/libc/test/src/math/smoke/CopySignTest.h @@ -11,7 +11,8 @@ #include -template class CopySignTest : public __llvm_libc::testing::Test { +template +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 df79703d42b1eb..7d905baefe8514 100644 --- a/libc/test/src/math/smoke/FAbsTest.h +++ b/libc/test/src/math/smoke/FAbsTest.h @@ -11,7 +11,7 @@ #include -template class FAbsTest : public __llvm_libc::testing::Test { +template 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 c0dbda10b318b9..3118c3661013e7 100644 --- a/libc/test/src/math/smoke/FDimTest.h +++ b/libc/test/src/math/smoke/FDimTest.h @@ -13,10 +13,10 @@ #include template -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; + using FPBits = LIBC_NAMESPACE::fputil::FPBits; 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::build_quiet_nan(1)); - const T inf = T(__llvm_libc::fputil::FPBits::inf()); - const T neg_inf = T(__llvm_libc::fputil::FPBits::neg_inf()); - const T zero = T(__llvm_libc::fputil::FPBits::zero()); - const T neg_zero = T(__llvm_libc::fputil::FPBits::neg_zero()); + const T nan = T(LIBC_NAMESPACE::fputil::FPBits::build_quiet_nan(1)); + const T inf = T(LIBC_NAMESPACE::fputil::FPBits::inf()); + const T neg_inf = T(LIBC_NAMESPACE::fputil::FPBits::neg_inf()); + const T zero = T(LIBC_NAMESPACE::fputil::FPBits::zero()); + const T neg_zero = T(LIBC_NAMESPACE::fputil::FPBits::neg_zero()); }; diff --git a/libc/test/src/math/smoke/FMaxTest.h b/libc/test/src/math/smoke/FMaxTest.h index 5c353a6b7e0efc..e1192a4e0a7d1a 100644 --- a/libc/test/src/math/smoke/FMaxTest.h +++ b/libc/test/src/math/smoke/FMaxTest.h @@ -11,7 +11,7 @@ #include -template class FMaxTest : public __llvm_libc::testing::Test { +template 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 071ab75928c4bc..f0764ec3855b23 100644 --- a/libc/test/src/math/smoke/FMinTest.h +++ b/libc/test/src/math/smoke/FMinTest.h @@ -11,7 +11,7 @@ #include -template class FMinTest : public __llvm_libc::testing::Test { +template 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 6bff888294d2b0..5fc0ebf6d33e40 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 class FmodTest : public __llvm_libc::testing::Test { +template 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 b1125b0517e5e3..1c1b62c2dcda2a 100644 --- a/libc/test/src/math/smoke/FloorTest.h +++ b/libc/test/src/math/smoke/FloorTest.h @@ -11,7 +11,7 @@ #include -template class FloorTest : public __llvm_libc::testing::Test { +template 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 d276dba4291a67..3c1c120d77d450 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 -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; + using FPBits = LIBC_NAMESPACE::fputil::FPBits; using UIntType = typename FPBits::UIntType; - const T nan = T(__llvm_libc::fputil::FPBits::build_quiet_nan(1)); - const T inf = T(__llvm_libc::fputil::FPBits::inf()); - const T neg_inf = T(__llvm_libc::fputil::FPBits::neg_inf()); - const T zero = T(__llvm_libc::fputil::FPBits::zero()); - const T neg_zero = T(__llvm_libc::fputil::FPBits::neg_zero()); + const T nan = T(LIBC_NAMESPACE::fputil::FPBits::build_quiet_nan(1)); + const T inf = T(LIBC_NAMESPACE::fputil::FPBits::inf()); + const T neg_inf = T(LIBC_NAMESPACE::fputil::FPBits::neg_inf()); + const T zero = T(LIBC_NAMESPACE::fputil::FPBits::zero()); + const T neg_zero = T(LIBC_NAMESPACE::fputil::FPBits::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 7a3a948912bb87..1740770fd6c478 100644 --- a/libc/test/src/math/smoke/FrexpTest.h +++ b/libc/test/src/math/smoke/FrexpTest.h @@ -12,12 +12,12 @@ #include -template class FrexpTest : public __llvm_libc::testing::Test { +template class FrexpTest : public LIBC_NAMESPACE::testing::Test { DECLARE_SPECIAL_CONSTANTS(T) static constexpr UIntType HIDDEN_BIT = - UIntType(1) << __llvm_libc::fputil::MantissaWidth::VALUE; + UIntType(1) << LIBC_NAMESPACE::fputil::MantissaWidth::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 084dbc4d83d750..22c2fe4d1c3593 100644 --- a/libc/test/src/math/smoke/HypotTest.h +++ b/libc/test/src/math/smoke/HypotTest.h @@ -16,10 +16,10 @@ #include template -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; + using FPBits = LIBC_NAMESPACE::fputil::FPBits; 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 6ad5eb065c8aa4..e51a5d7a2544cd 100644 --- a/libc/test/src/math/smoke/ILogbTest.h +++ b/libc/test/src/math/smoke/ILogbTest.h @@ -16,7 +16,7 @@ #include -class LlvmLibcILogbTest : public __llvm_libc::testing::Test { +class LlvmLibcILogbTest : public LIBC_NAMESPACE::testing::Test { public: template struct ILogbFunc { typedef int (*Func)(T); @@ -24,14 +24,15 @@ class LlvmLibcILogbTest : public __llvm_libc::testing::Test { template void test_special_numbers(typename ILogbFunc::Func func) { - EXPECT_EQ(FP_ILOGB0, func(T(__llvm_libc::fputil::FPBits::zero()))); - EXPECT_EQ(FP_ILOGB0, func(T(__llvm_libc::fputil::FPBits::neg_zero()))); + EXPECT_EQ(FP_ILOGB0, func(T(LIBC_NAMESPACE::fputil::FPBits::zero()))); + EXPECT_EQ(FP_ILOGB0, + func(T(LIBC_NAMESPACE::fputil::FPBits::neg_zero()))); EXPECT_EQ(FP_ILOGBNAN, - func(T(__llvm_libc::fputil::FPBits::build_quiet_nan(1)))); + func(T(LIBC_NAMESPACE::fputil::FPBits::build_quiet_nan(1)))); - EXPECT_EQ(INT_MAX, func(T(__llvm_libc::fputil::FPBits::inf()))); - EXPECT_EQ(INT_MAX, func(T(__llvm_libc::fputil::FPBits::neg_inf()))); + EXPECT_EQ(INT_MAX, func(T(LIBC_NAMESPACE::fputil::FPBits::inf()))); + EXPECT_EQ(INT_MAX, func(T(LIBC_NAMESPACE::fputil::FPBits::neg_inf()))); } template @@ -75,7 +76,7 @@ class LlvmLibcILogbTest : public __llvm_libc::testing::Test { template void test_subnormal_range(typename ILogbFunc::Func func) { - using FPBits = __llvm_libc::fputil::FPBits; + using FPBits = LIBC_NAMESPACE::fputil::FPBits; 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 void test_normal_range(typename ILogbFunc::Func func) { - using FPBits = __llvm_libc::fputil::FPBits; + using FPBits = LIBC_NAMESPACE::fputil::FPBits; 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 2e592995ae792e..bffa7335fb25b1 100644 --- a/libc/test/src/math/smoke/LdExpTest.h +++ b/libc/test/src/math/smoke/LdExpTest.h @@ -19,20 +19,20 @@ #include template -class LdExpTestTemplate : public __llvm_libc::testing::Test { - using FPBits = __llvm_libc::fputil::FPBits; - using NormalFloat = __llvm_libc::fputil::NormalFloat; +class LdExpTestTemplate : public LIBC_NAMESPACE::testing::Test { + using FPBits = LIBC_NAMESPACE::fputil::FPBits; + using NormalFloat = LIBC_NAMESPACE::fputil::NormalFloat; using UIntType = typename FPBits::UIntType; static constexpr UIntType MANTISSA_WIDTH = - __llvm_libc::fputil::MantissaWidth::VALUE; + LIBC_NAMESPACE::fputil::MantissaWidth::VALUE; // A normalized mantissa to be used with tests. static constexpr UIntType MANTISSA = NormalFloat::ONE + 0x1234; - const T zero = T(__llvm_libc::fputil::FPBits::zero()); - const T neg_zero = T(__llvm_libc::fputil::FPBits::neg_zero()); - const T inf = T(__llvm_libc::fputil::FPBits::inf()); - const T neg_inf = T(__llvm_libc::fputil::FPBits::neg_inf()); - const T nan = T(__llvm_libc::fputil::FPBits::build_quiet_nan(1)); + const T zero = T(LIBC_NAMESPACE::fputil::FPBits::zero()); + const T neg_zero = T(LIBC_NAMESPACE::fputil::FPBits::neg_zero()); + const T inf = T(LIBC_NAMESPACE::fputil::FPBits::inf()); + const T neg_inf = T(LIBC_NAMESPACE::fputil::FPBits::neg_inf()); + const T nan = T(LIBC_NAMESPACE::fputil::FPBits::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 885bd7c8a6371c..34cf92c19ed8b1 100644 --- a/libc/test/src/math/smoke/LogbTest.h +++ b/libc/test/src/math/smoke/LogbTest.h @@ -12,12 +12,12 @@ #include -template class LogbTest : public __llvm_libc::testing::Test { +template class LogbTest : public LIBC_NAMESPACE::testing::Test { DECLARE_SPECIAL_CONSTANTS(T) static constexpr UIntType HIDDEN_BIT = - UIntType(1) << __llvm_libc::fputil::MantissaWidth::VALUE; + UIntType(1) << LIBC_NAMESPACE::fputil::MantissaWidth::VALUE; public: typedef T (*LogbFunc)(T); @@ -77,7 +77,7 @@ template 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 687d0dd74ab67b..012a3247f92ead 100644 --- a/libc/test/src/math/smoke/ModfTest.h +++ b/libc/test/src/math/smoke/ModfTest.h @@ -13,7 +13,7 @@ #include -template class ModfTest : public __llvm_libc::testing::Test { +template class ModfTest : public LIBC_NAMESPACE::testing::Test { DECLARE_SPECIAL_CONSTANTS(T) @@ -90,8 +90,8 @@ template 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 e6de9419d99040..4e450cf5bc1e9e 100644 --- a/libc/test/src/math/smoke/NextAfterTest.h +++ b/libc/test/src/math/smoke/NextAfterTest.h @@ -18,13 +18,13 @@ #include template -class NextAfterTestTemplate : public __llvm_libc::testing::Test { - using FPBits = __llvm_libc::fputil::FPBits; - using MantissaWidth = __llvm_libc::fputil::MantissaWidth; +class NextAfterTestTemplate : public LIBC_NAMESPACE::testing::Test { + using FPBits = LIBC_NAMESPACE::fputil::FPBits; + using MantissaWidth = LIBC_NAMESPACE::fputil::MantissaWidth; using UIntType = typename FPBits::UIntType; static constexpr int BIT_WIDTH_OF_TYPE = - __llvm_libc::fputil::FloatProperties::BIT_WIDTH; + LIBC_NAMESPACE::fputil::FloatProperties::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(expected_bits); + T expected = LIBC_NAMESPACE::cpp::bit_cast(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(expected_bits); + expected = LIBC_NAMESPACE::cpp::bit_cast(expected_bits); ASSERT_FP_EQ(result, expected); x = neg_zero; result = func(x, 1); expected_bits = 1; - expected = __llvm_libc::cpp::bit_cast(expected_bits); + expected = LIBC_NAMESPACE::cpp::bit_cast(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(expected_bits); + expected = LIBC_NAMESPACE::cpp::bit_cast(expected_bits); ASSERT_FP_EQ(result, expected); // 'from' is max subnormal value. - x = __llvm_libc::cpp::bit_cast(max_subnormal); + x = LIBC_NAMESPACE::cpp::bit_cast(max_subnormal); result = func(x, 1); - expected = __llvm_libc::cpp::bit_cast(min_normal); + expected = LIBC_NAMESPACE::cpp::bit_cast(min_normal); ASSERT_FP_EQ(result, expected); result = func(x, 0); expected_bits = max_subnormal - 1; - expected = __llvm_libc::cpp::bit_cast(expected_bits); + expected = LIBC_NAMESPACE::cpp::bit_cast(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(expected_bits); + expected = LIBC_NAMESPACE::cpp::bit_cast(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(expected_bits); + expected = LIBC_NAMESPACE::cpp::bit_cast(expected_bits); ASSERT_FP_EQ(result, expected); // 'from' is min subnormal value. - x = __llvm_libc::cpp::bit_cast(min_subnormal); + x = LIBC_NAMESPACE::cpp::bit_cast(min_subnormal); result = func(x, 1); expected_bits = min_subnormal + 1; - expected = __llvm_libc::cpp::bit_cast(expected_bits); + expected = LIBC_NAMESPACE::cpp::bit_cast(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(expected_bits); + expected = LIBC_NAMESPACE::cpp::bit_cast(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(min_normal); + x = LIBC_NAMESPACE::cpp::bit_cast(min_normal); result = func(x, 0); expected_bits = max_subnormal; - expected = __llvm_libc::cpp::bit_cast(expected_bits); + expected = LIBC_NAMESPACE::cpp::bit_cast(expected_bits); ASSERT_FP_EQ(result, expected); result = func(x, inf); expected_bits = min_normal + 1; - expected = __llvm_libc::cpp::bit_cast(expected_bits); + expected = LIBC_NAMESPACE::cpp::bit_cast(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(expected_bits); + expected = LIBC_NAMESPACE::cpp::bit_cast(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(expected_bits); + expected = LIBC_NAMESPACE::cpp::bit_cast(expected_bits); ASSERT_FP_EQ(result, expected); // 'from' is max normal and 'to' is infinity. - x = __llvm_libc::cpp::bit_cast(max_normal); + x = LIBC_NAMESPACE::cpp::bit_cast(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(expected_bits); + expected = LIBC_NAMESPACE::cpp::bit_cast(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(expected_bits); + expected = LIBC_NAMESPACE::cpp::bit_cast(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 7a6d5c7ed78c96..839240fa9c9820 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 -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; + using FPBits = LIBC_NAMESPACE::fputil::FPBits; 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 4d49fd7dedc402..5a5d1437775023 100644 --- a/libc/test/src/math/smoke/RemQuoTest.h +++ b/libc/test/src/math/smoke/RemQuoTest.h @@ -16,15 +16,15 @@ #include template -class RemQuoTestTemplate : public __llvm_libc::testing::Test { - using FPBits = __llvm_libc::fputil::FPBits; +class RemQuoTestTemplate : public LIBC_NAMESPACE::testing::Test { + using FPBits = LIBC_NAMESPACE::fputil::FPBits; using UIntType = typename FPBits::UIntType; - const T zero = T(__llvm_libc::fputil::FPBits::zero()); - const T neg_zero = T(__llvm_libc::fputil::FPBits::neg_zero()); - const T inf = T(__llvm_libc::fputil::FPBits::inf()); - const T neg_inf = T(__llvm_libc::fputil::FPBits::neg_inf()); - const T nan = T(__llvm_libc::fputil::FPBits::build_quiet_nan(1)); + const T zero = T(LIBC_NAMESPACE::fputil::FPBits::zero()); + const T neg_zero = T(LIBC_NAMESPACE::fputil::FPBits::neg_zero()); + const T inf = T(LIBC_NAMESPACE::fputil::FPBits::inf()); + const T neg_inf = T(LIBC_NAMESPACE::fputil::FPBits::neg_inf()); + const T nan = T(LIBC_NAMESPACE::fputil::FPBits::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 c67f1ce48220a9..2e95f182ce948b 100644 --- a/libc/test/src/math/smoke/RoundTest.h +++ b/libc/test/src/math/smoke/RoundTest.h @@ -11,7 +11,7 @@ #include -template class RoundTest : public __llvm_libc::testing::Test { +template 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 c37186bff57b3c..31ce852fb75df2 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 -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; + using FPBits = LIBC_NAMESPACE::fputil::FPBits; using UIntType = typename FPBits::UIntType; - const F zero = F(__llvm_libc::fputil::FPBits::zero()); - const F neg_zero = F(__llvm_libc::fputil::FPBits::neg_zero()); - const F inf = F(__llvm_libc::fputil::FPBits::inf()); - const F neg_inf = F(__llvm_libc::fputil::FPBits::neg_inf()); - const F nan = F(__llvm_libc::fputil::FPBits::build_quiet_nan(1)); + const F zero = F(LIBC_NAMESPACE::fputil::FPBits::zero()); + const F neg_zero = F(LIBC_NAMESPACE::fputil::FPBits::neg_zero()); + const F inf = F(LIBC_NAMESPACE::fputil::FPBits::inf()); + const F neg_inf = F(LIBC_NAMESPACE::fputil::FPBits::neg_inf()); + const F nan = F(LIBC_NAMESPACE::fputil::FPBits::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 c3896e302373a2..d4b2f9dd2624f1 100644 --- a/libc/test/src/math/smoke/SqrtTest.h +++ b/libc/test/src/math/smoke/SqrtTest.h @@ -12,12 +12,12 @@ #include -template class SqrtTest : public __llvm_libc::testing::Test { +template class SqrtTest : public LIBC_NAMESPACE::testing::Test { DECLARE_SPECIAL_CONSTANTS(T) static constexpr UIntType HIDDEN_BIT = - UIntType(1) << __llvm_libc::fputil::MantissaWidth::VALUE; + UIntType(1) << LIBC_NAMESPACE::fputil::MantissaWidth::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 32b5503589ca7a..8334a7b7c0f90d 100644 --- a/libc/test/src/math/smoke/TruncTest.h +++ b/libc/test/src/math/smoke/TruncTest.h @@ -11,7 +11,7 @@ #include -template class TruncTest : public __llvm_libc::testing::Test { +template 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 0fc20970232f7b..b8ba3d5f85cee7 100644 --- a/libc/test/src/math/smoke/acosf_test.cpp +++ b/libc/test/src/math/smoke/acosf_test.cpp @@ -16,28 +16,28 @@ #include #include -using FPBits = __llvm_libc::fputil::FPBits; +using FPBits = LIBC_NAMESPACE::fputil::FPBits; 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 ac3021ff3154e4..b8d7453bfdb212 100644 --- a/libc/test/src/math/smoke/acoshf_test.cpp +++ b/libc/test/src/math/smoke/acoshf_test.cpp @@ -16,25 +16,25 @@ #include #include -using FPBits_t = __llvm_libc::fputil::FPBits; +using FPBits_t = LIBC_NAMESPACE::fputil::FPBits; 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 f6455475947a3e..e2eca352e1d882 100644 --- a/libc/test/src/math/smoke/asinf_test.cpp +++ b/libc/test/src/math/smoke/asinf_test.cpp @@ -16,31 +16,31 @@ #include #include -using FPBits = __llvm_libc::fputil::FPBits; +using FPBits = LIBC_NAMESPACE::fputil::FPBits; 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 6b5f9437b4149a..f10cf934c533af 100644 --- a/libc/test/src/math/smoke/asinhf_test.cpp +++ b/libc/test/src/math/smoke/asinhf_test.cpp @@ -16,25 +16,25 @@ #include #include -using FPBits_t = __llvm_libc::fputil::FPBits; +using FPBits_t = LIBC_NAMESPACE::fputil::FPBits; 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 7d3f38682e8c01..6e6f854002cc50 100644 --- a/libc/test/src/math/smoke/atanf_test.cpp +++ b/libc/test/src/math/smoke/atanf_test.cpp @@ -16,25 +16,25 @@ #include #include -using FPBits = __llvm_libc::fputil::FPBits; +using FPBits = LIBC_NAMESPACE::fputil::FPBits; 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 ac2d47babe4eb0..841cb884c37fe5 100644 --- a/libc/test/src/math/smoke/atanhf_test.cpp +++ b/libc/test/src/math/smoke/atanhf_test.cpp @@ -16,57 +16,57 @@ #include #include -using FPBits = __llvm_libc::fputil::FPBits; +using FPBits = LIBC_NAMESPACE::fputil::FPBits; 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 2a592e3ee85b0c..800452a43426c7 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 cfa8cb2c5aa6dd..2a2504228adb0a 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 6fe30465edc857..0f766602a0f6d4 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 37bfa0d90c3789..5b3d812c02da4d 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 fec283ccd0c7ac..344ffee2359ec8 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 d1de911196b62b..bed60678dc161d 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 4ef96677eb4d1c..6a2c6a5b252995 100644 --- a/libc/test/src/math/smoke/cosf_test.cpp +++ b/libc/test/src/math/smoke/cosf_test.cpp @@ -16,25 +16,25 @@ #include #include -using FPBits = __llvm_libc::fputil::FPBits; +using FPBits = LIBC_NAMESPACE::fputil::FPBits; 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 7198aa266aa8d3..dd08f1924abc38 100644 --- a/libc/test/src/math/smoke/coshf_test.cpp +++ b/libc/test/src/math/smoke/coshf_test.cpp @@ -17,40 +17,40 @@ #include #include -using FPBits = __llvm_libc::fputil::FPBits; +using FPBits = LIBC_NAMESPACE::fputil::FPBits; 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 c2a247b6e6672f..9c9105167b8c71 100644 --- a/libc/test/src/math/smoke/erff_test.cpp +++ b/libc/test/src/math/smoke/erff_test.cpp @@ -15,14 +15,14 @@ #include #include -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 21ba51d32345a7..cf699bab6ebeee 100644 --- a/libc/test/src/math/smoke/exp10_test.cpp +++ b/libc/test/src/math/smoke/exp10_test.cpp @@ -16,21 +16,22 @@ #include #include -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 4de0074ab82692..c4d3cb6002df97 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 13b24b01261096..ec076c15fed019 100644 --- a/libc/test/src/math/smoke/exp2_test.cpp +++ b/libc/test/src/math/smoke/exp2_test.cpp @@ -16,20 +16,21 @@ #include #include -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 c22a5eb294100b..f26f155cc870a5 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 3406f0afd73ebe..7973c37257c53d 100644 --- a/libc/test/src/math/smoke/exp_test.cpp +++ b/libc/test/src/math/smoke/exp_test.cpp @@ -16,16 +16,17 @@ #include #include -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 174d58013cc064..e5c5afbd182238 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 f34562434eb348..03fe1413e95e12 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 2bf0ddda44ade3..0447040ddae306 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 6374a1018f1da4..9f1e2a66d47655 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 ff1320225452a9..37d2b54a4c53e1 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 80174b79b95b83..2f00a30ad1ee6f 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; -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 531b89b81ffc9e..27511baf25b6da 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; -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 bb6c54d567a0b2..45aedb0a1cdea6 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; -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 e68ed3ecbb603e..9231d07aeb7f8f 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 f0538f7b97b22f..cbb11f36f58da3 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 1b244fd62a117b..26f6a7703ed0f6 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 f33860f65236bd..4460b80d9ad650 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; 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 38c2ea35db056d..a645efb8776d0f 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; 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 9c81c09414f013..6800939625ebc0 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 cf337d4f07e030..25c6f7339e8c95 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 636bc4208caef6..9ac986c00012a0 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 3515f97faca33c..5d241519021d43 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 1a762478af613b..1af5b79155b1dc 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 ce8b705b0385e2..0791f8c4ad8595 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 03790e4941e191..ec39e0567a7ca0 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 2b13379eba2523..5c3c6286e88fef 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 a44aefc7d8b4e3..4d078baffcb393 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 5d78f94ec1e596..577eb9609cfcc5 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 4904ccd14907bb..e5184cd225bcfa 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 cecfc0ee3de3ae..d0ab31ffd0fe63 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) +LIST_SQRT_TESTS(double, LIBC_NAMESPACE::fputil::sqrt) diff --git a/libc/test/src/math/smoke/generic_sqrtf_test.cpp b/libc/test/src/math/smoke/generic_sqrtf_test.cpp index 64bf92133b98f3..f22ac8829d5ac8 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) +LIST_SQRT_TESTS(float, LIBC_NAMESPACE::fputil::sqrt) diff --git a/libc/test/src/math/smoke/generic_sqrtl_test.cpp b/libc/test/src/math/smoke/generic_sqrtl_test.cpp index 6b68aaed970048..ddc6a23695be43 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) +LIST_SQRT_TESTS(long double, LIBC_NAMESPACE::fputil::sqrt) diff --git a/libc/test/src/math/smoke/hypot_test.cpp b/libc/test/src/math/smoke/hypot_test.cpp index f865b9f903e356..dd127909fafc52 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; 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 0c0ee3127cd440..768e7f75e9d678 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; 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 a77adec4adba44..7011c43386e66a 100644 --- a/libc/test/src/math/smoke/ilogb_test.cpp +++ b/libc/test/src/math/smoke/ilogb_test.cpp @@ -16,21 +16,21 @@ #include TEST_F(LlvmLibcILogbTest, SpecialNumbers_ilogb) { - test_special_numbers(&__llvm_libc::ilogb); + test_special_numbers(&LIBC_NAMESPACE::ilogb); } TEST_F(LlvmLibcILogbTest, PowersOfTwo_ilogb) { - test_powers_of_two(&__llvm_libc::ilogb); + test_powers_of_two(&LIBC_NAMESPACE::ilogb); } TEST_F(LlvmLibcILogbTest, SomeIntegers_ilogb) { - test_some_integers(&__llvm_libc::ilogb); + test_some_integers(&LIBC_NAMESPACE::ilogb); } TEST_F(LlvmLibcILogbTest, SubnormalRange_ilogb) { - test_subnormal_range(&__llvm_libc::ilogb); + test_subnormal_range(&LIBC_NAMESPACE::ilogb); } TEST_F(LlvmLibcILogbTest, NormalRange_ilogb) { - test_normal_range(&__llvm_libc::ilogb); + test_normal_range(&LIBC_NAMESPACE::ilogb); } diff --git a/libc/test/src/math/smoke/ilogbf_test.cpp b/libc/test/src/math/smoke/ilogbf_test.cpp index 20904a13c98a81..dcff8eeb151805 100644 --- a/libc/test/src/math/smoke/ilogbf_test.cpp +++ b/libc/test/src/math/smoke/ilogbf_test.cpp @@ -16,21 +16,21 @@ #include TEST_F(LlvmLibcILogbTest, SpecialNumbers_ilogbf) { - test_special_numbers(&__llvm_libc::ilogbf); + test_special_numbers(&LIBC_NAMESPACE::ilogbf); } TEST_F(LlvmLibcILogbTest, PowersOfTwo_ilogbf) { - test_powers_of_two(&__llvm_libc::ilogbf); + test_powers_of_two(&LIBC_NAMESPACE::ilogbf); } TEST_F(LlvmLibcILogbTest, SomeIntegers_ilogbf) { - test_some_integers(&__llvm_libc::ilogbf); + test_some_integers(&LIBC_NAMESPACE::ilogbf); } TEST_F(LlvmLibcILogbTest, SubnormalRange_ilogbf) { - test_subnormal_range(&__llvm_libc::ilogbf); + test_subnormal_range(&LIBC_NAMESPACE::ilogbf); } TEST_F(LlvmLibcILogbTest, NormalRange_ilogbf) { - test_normal_range(&__llvm_libc::ilogbf); + test_normal_range(&LIBC_NAMESPACE::ilogbf); } diff --git a/libc/test/src/math/smoke/ilogbl_test.cpp b/libc/test/src/math/smoke/ilogbl_test.cpp index 9647f232245dc3..29a221ad7f08f7 100644 --- a/libc/test/src/math/smoke/ilogbl_test.cpp +++ b/libc/test/src/math/smoke/ilogbl_test.cpp @@ -16,21 +16,21 @@ #include TEST_F(LlvmLibcILogbTest, SpecialNumbers_ilogbl) { - test_special_numbers(&__llvm_libc::ilogbl); + test_special_numbers(&LIBC_NAMESPACE::ilogbl); } TEST_F(LlvmLibcILogbTest, PowersOfTwo_ilogbl) { - test_powers_of_two(&__llvm_libc::ilogbl); + test_powers_of_two(&LIBC_NAMESPACE::ilogbl); } TEST_F(LlvmLibcILogbTest, SomeIntegers_ilogbl) { - test_some_integers(&__llvm_libc::ilogbl); + test_some_integers(&LIBC_NAMESPACE::ilogbl); } TEST_F(LlvmLibcILogbTest, SubnormalRange_ilogbl) { - test_subnormal_range(&__llvm_libc::ilogbl); + test_subnormal_range(&LIBC_NAMESPACE::ilogbl); } TEST_F(LlvmLibcILogbTest, NormalRange_ilogbl) { - test_normal_range(&__llvm_libc::ilogbl); + test_normal_range(&LIBC_NAMESPACE::ilogbl); } diff --git a/libc/test/src/math/smoke/ldexp_test.cpp b/libc/test/src/math/smoke/ldexp_test.cpp index c078aa4b7ef84c..aad580f95fb99d 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 4fe80fc79151cd..f4cce37b9277dc 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 5e6e6e75ae0855..405e53390e8c34 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 8027004bd50a5d..8cf7d92095891b 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 9ad710e4698350..0d9d3c4111bb24 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 948e961e57bd4d..1ceb9fecc40391 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 c86095dc9aae03..bda2fca6e8659f 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 5e36258c246ae1..a35b5fabbac34c 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 8fbc840c4f2acc..e43d49f4cbe1bf 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 8a214748fb2e0b..be4900a6a4dd6b 100644 --- a/libc/test/src/math/smoke/log10_test.cpp +++ b/libc/test/src/math/smoke/log10_test.cpp @@ -16,21 +16,23 @@ #include #include -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(i), __llvm_libc::log10(x)); + EXPECT_FP_EQ_ALL_ROUNDING(static_cast(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 d7838140bec27f..2369ab0458847a 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(i), __llvm_libc::log10f(x)); + EXPECT_FP_EQ_ALL_ROUNDING(static_cast(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 14e1977e060e7e..9cb0cf17ff797d 100644 --- a/libc/test/src/math/smoke/log1p_test.cpp +++ b/libc/test/src/math/smoke/log1p_test.cpp @@ -16,16 +16,17 @@ #include #include -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 22043ba6e278de..98360102437150 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 2726a6b1c3a726..dab8929115d726 100644 --- a/libc/test/src/math/smoke/log2_test.cpp +++ b/libc/test/src/math/smoke/log2_test.cpp @@ -16,16 +16,17 @@ #include #include -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 6b05e6cc715ebe..d388230a801591 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 4277123214a67f..34d608a81a14e0 100644 --- a/libc/test/src/math/smoke/log_test.cpp +++ b/libc/test/src/math/smoke/log_test.cpp @@ -16,16 +16,16 @@ #include #include -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 b90348522aa3aa..2dc56c2e613ccb 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 727eefffbb1740..c25485ca78b065 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 1c7b0d4e66e84e..b26cee65783c42 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 20fa51735ad75b..0edaa8da556e28 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 0dbfa3dd466d99..9cff2661225361 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 407813aa83c0fe..9c696a39e6928c 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 a4551c38de1066..e44dd30d2c6ccc 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 0ee580f316b44a..1fb2fc71e20ccb 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 7a2aad20e4f664..38fe5c7d1a52dc 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 c0ea3397820523..8a29ba95a61732 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 ff89517506b4f2..b4b03bad848de5 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 440304ab95ac78..068dbc3f531359 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 c98678b3e9243e..ae8a72642c5871 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 2dde48ceb053c6..998b19fb1dccd3 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 14234c717797eb..31770bc591ec1f 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 db85d83edc690e..4c8577f2690a1f 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 8efec397f39d33..4358331a8f76e2 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 1af4ba4e0153b5..590b4ffb4595fd 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 e4438e83fe18ce..ae2db449304105 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 eafa1a7fe6119f..9c89b7acec56d5 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 c15a697fac9208..f875bab2556cad 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 6c50873a272d04..458ca05a985af5 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 87ce079e89afc2..dbcb56717e2083 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 0a182dd02deee6..053596a16e22f6 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 32cf724fb7c4f3..2a2a213a8181cd 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 d4d60bf8afca18..413a2395ca3c57 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 cbf2e7e1361e10..e97781c2b23546 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 197887b2448c05..b0e00537909024 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 102a50c428d26a..4e2b1c69e41877 100644 --- a/libc/test/src/math/smoke/sincosf_test.cpp +++ b/libc/test/src/math/smoke/sincosf_test.cpp @@ -16,7 +16,7 @@ #include #include -using FPBits = __llvm_libc::fputil::FPBits; +using FPBits = LIBC_NAMESPACE::fputil::FPBits; 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 e67062d74190bb..b93011bbdc2baf 100644 --- a/libc/test/src/math/smoke/sinf_test.cpp +++ b/libc/test/src/math/smoke/sinf_test.cpp @@ -16,25 +16,25 @@ #include #include -using FPBits = __llvm_libc::fputil::FPBits; +using FPBits = LIBC_NAMESPACE::fputil::FPBits; 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 5926ea647490bc..b2b6bddf91c2a5 100644 --- a/libc/test/src/math/smoke/sinhf_test.cpp +++ b/libc/test/src/math/smoke/sinhf_test.cpp @@ -17,51 +17,51 @@ #include #include -using FPBits = __llvm_libc::fputil::FPBits; +using FPBits = LIBC_NAMESPACE::fputil::FPBits; 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 237264895bbd26..1551b31d6f715f 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 c7681d01569ae7..3f2e973325bd0f 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 c48ebb08444d05..f80bcfb7360782 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 62cc42c0bef1a4..60444b3ad15cc0 100644 --- a/libc/test/src/math/smoke/tanf_test.cpp +++ b/libc/test/src/math/smoke/tanf_test.cpp @@ -16,25 +16,25 @@ #include #include -using FPBits = __llvm_libc::fputil::FPBits; +using FPBits = LIBC_NAMESPACE::fputil::FPBits; 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 0152de2f5ea04c..db20be724b53f4 100644 --- a/libc/test/src/math/smoke/tanhf_test.cpp +++ b/libc/test/src/math/smoke/tanhf_test.cpp @@ -16,25 +16,25 @@ #include #include -using FPBits = __llvm_libc::fputil::FPBits; +using FPBits = LIBC_NAMESPACE::fputil::FPBits; 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 f0a808dcb23684..eb71f23e02f4b2 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 cbd672cfe2e21e..9a85b8274b0e5c 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 0cf9ab8cd5575b..d296bfe33cb077 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 237264895bbd26..1551b31d6f715f 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 c7681d01569ae7..3f2e973325bd0f 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 c48ebb08444d05..f80bcfb7360782 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 b22d49ef5f432a..a6f7dcb4329303 100644 --- a/libc/test/src/math/tan_test.cpp +++ b/libc/test/src/math/tan_test.cpp @@ -13,7 +13,7 @@ #include -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 37a1bba68412ab..3c3694a5eb6847 100644 --- a/libc/test/src/math/tanf_test.cpp +++ b/libc/test/src/math/tanf_test.cpp @@ -18,29 +18,29 @@ #include #include -using __llvm_libc::testing::SDCOMP26094_VALUES; -using FPBits = __llvm_libc::fputil::FPBits; +using LIBC_NAMESPACE::testing::SDCOMP26094_VALUES; +using FPBits = LIBC_NAMESPACE::fputil::FPBits; -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 07afe14a263d02..06ad02c3370940 100644 --- a/libc/test/src/math/tanhf_test.cpp +++ b/libc/test/src/math/tanhf_test.cpp @@ -17,28 +17,28 @@ #include #include -using FPBits = __llvm_libc::fputil::FPBits; +using FPBits = LIBC_NAMESPACE::fputil::FPBits; -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 f0a808dcb23684..eb71f23e02f4b2 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 cbd672cfe2e21e..9a85b8274b0e5c 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 0cf9ab8cd5575b..d296bfe33cb077 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 a8363d20d9767b..d3b930d0b1ea24 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 f9bd77bad25d87..d38fab8153b97c 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 bc52a97c876720..b06f8e19e4f45b 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 f10c2465539325..654a39662ac9ce 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 af9f5d07f11553..1af585a003e3b0 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(stack), uintptr_t(0)); - ASSERT_EQ(__llvm_libc::pthread_attr_setstack( + ASSERT_EQ(LIBC_NAMESPACE::pthread_attr_setstack( &attr, reinterpret_cast(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 3ecbc4f5896a46..a7acd580a6b8e5 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 ca2821bc2bafef..38433edecbd0c0 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(SYS_gettid); + using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds; + pid_t tid = LIBC_NAMESPACE::syscall_impl(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(SYS_gettid); + using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails; + pid_t tid = LIBC_NAMESPACE::syscall_impl(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 4c047779baed52..ca3e80818a5c14 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(SYS_gettid); + using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds; + pid_t tid = LIBC_NAMESPACE::syscall_impl(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 15ee958ec16f44..3a79a67802cf3e 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 2c5745432f579a..8c6485f0789712 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 160ccd5025967e..10010007950416 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 ffa7f667cadffb..45b7a7d2d81e47 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 3a8e22a68deda3..9e5f74a1734b35 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 ea98724dd09682..2033543c97a2b4 100644 --- a/libc/test/src/signal/kill_test.cpp +++ b/libc/test/src/signal/kill_test.cpp @@ -15,16 +15,16 @@ #include #include // 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(SYS_getpid); - ASSERT_THAT(__llvm_libc::kill(parent_pid, 0), Succeeds(0)); + pid_t parent_pid = LIBC_NAMESPACE::syscall_impl(SYS_getpid); + ASSERT_THAT(LIBC_NAMESPACE::kill(parent_pid, 0), Succeeds(0)); EXPECT_DEATH( [] { - pid_t child_pid = __llvm_libc::syscall_impl(SYS_getpid); - __llvm_libc::kill(child_pid, SIGKILL); + pid_t child_pid = LIBC_NAMESPACE::syscall_impl(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 080541ff2445a0..a114ac5e8379c8 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 36160f9a37cef4..262469c7600e3f 100644 --- a/libc/test/src/signal/sigaction_test.cpp +++ b/libc/test/src/signal/sigaction_test.cpp @@ -15,19 +15,20 @@ #include #include -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 dbc0a617f4208e..ac9334f4ff68c0 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 e52b3db59ddb0b..5e1a3a4e2062c3 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 80f2459e223a61..aeae66f86bf886 100644 --- a/libc/test/src/signal/sigdelset_test.cpp +++ b/libc/test/src/signal/sigdelset_test.cpp @@ -18,20 +18,21 @@ #include 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 52f1e27aa32903..7922b3a4e11902 100644 --- a/libc/test/src/signal/sigfillset_test.cpp +++ b/libc/test/src/signal/sigfillset_test.cpp @@ -17,14 +17,15 @@ #include 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 999933c2f8a424..78f8bfbd719b1d 100644 --- a/libc/test/src/signal/signal_test.cpp +++ b/libc/test/src/signal/signal_test.cpp @@ -15,15 +15,15 @@ #include -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 3c334642ce0d38..3e7e3a5c62db27 100644 --- a/libc/test/src/signal/sigprocmask_test.cpp +++ b/libc/test/src/signal/sigprocmask_test.cpp @@ -17,19 +17,19 @@ #include -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(-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 abd2d78fdd5bb1..a343710829f10b 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(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 b262dda9325da5..6e6c0ed9b26bf6 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 -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 4608be3ee35da9..0d704ecee750c0 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 -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 150a9dd5d867d7..9f9841c901f4ed 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 68a749a6c93e73..d5478e58eecbf9 100644 --- a/libc/test/src/stdio/fileop_test.cpp +++ b/libc/test/src/stdio/fileop_test.cpp @@ -22,136 +22,136 @@ #include "src/errno/libc_errno.h" #include -using __llvm_libc::testing::ErrnoSetterMatcher::EQ; -using __llvm_libc::testing::ErrnoSetterMatcher::NE; -using __llvm_libc::testing::ErrnoSetterMatcher::returns; +using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::EQ; +using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::NE; +using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::returns; 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_THAT(__llvm_libc::fread(read_data, 1, sizeof(CONTENT), file), + ASSERT_THAT(LIBC_NAMESPACE::fread(read_data, 1, sizeof(CONTENT), file), returns(EQ(size_t(0))).with_errno(NE(0))); - ASSERT_NE(__llvm_libc::ferror(file), 0); + ASSERT_NE(LIBC_NAMESPACE::ferror(file), 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_THAT(__llvm_libc::fwrite(CONTENT, 1, sizeof(CONTENT), file), + ASSERT_THAT(LIBC_NAMESPACE::fwrite(CONTENT, 1, sizeof(CONTENT), file), returns(EQ(size_t(0))).with_errno(NE(0))); - ASSERT_NE(__llvm_libc::ferror(file), 0); + ASSERT_NE(LIBC_NAMESPACE::ferror(file), 0); libc_errno = 0; - __llvm_libc::clearerr(file); + LIBC_NAMESPACE::clearerr(file); // Should be an error to puts. - ASSERT_THAT(__llvm_libc::fputs(CONTENT, file), + ASSERT_THAT(LIBC_NAMESPACE::fputs(CONTENT, file), returns(EQ(EOF)).with_errno(NE(0))); - ASSERT_NE(__llvm_libc::ferror(file), 0); + ASSERT_NE(LIBC_NAMESPACE::ferror(file), 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_THAT(__llvm_libc::fwrite("nothing", 1, 1, file), + ASSERT_THAT(LIBC_NAMESPACE::fwrite("nothing", 1, 1, file), returns(EQ(0)).with_errno(NE(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_THAT(__llvm_libc::fread(data, 1, 1, file), + ASSERT_THAT(LIBC_NAMESPACE::fread(data, 1, 1, file), returns(EQ(0)).with_errno(NE(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(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) { @@ -164,28 +164,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(size_t(0), LIBC_NAMESPACE::fwrite(WRITE_DATA, 0, 1, file)); ASSERT_THAT( - __llvm_libc::fwrite(WRITE_DATA, sizeof(MyStruct), WRITE_NMEMB, file), + LIBC_NAMESPACE::fwrite(WRITE_DATA, sizeof(MyStruct), WRITE_NMEMB, file), returns(EQ(WRITE_NMEMB)).with_errno(EQ(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(size_t(0), LIBC_NAMESPACE::fread(read_data, 0, 1, file)); ASSERT_THAT( - __llvm_libc::fread(read_data, sizeof(MyStruct), WRITE_NMEMB, file), + LIBC_NAMESPACE::fread(read_data, sizeof(MyStruct), WRITE_NMEMB, file), returns(EQ(WRITE_NMEMB)).with_errno(EQ(0))); // Trying to read more should fetch nothing. ASSERT_THAT( - __llvm_libc::fread(read_data, sizeof(MyStruct), WRITE_NMEMB, file), + LIBC_NAMESPACE::fread(read_data, sizeof(MyStruct), WRITE_NMEMB, file), returns(EQ(0)).with_errno(EQ(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 f0de8caf673cc7..42e7c57cffe04b 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 cfdaef2149f5b0..6f3c2910cfd823 100644 --- a/libc/test/src/stdio/fopencookie_test.cpp +++ b/libc/test/src/stdio/fopencookie_test.cpp @@ -22,7 +22,7 @@ #include #include -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 9a3c1f2e87206e..08b31795b435b2 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_STDIO_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_STDIO_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 e5aa7c713463bf..578403fc374b01 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(__llvm_libc::stderr)); + result = LIBC_NAMESPACE::fputc( + c, reinterpret_cast(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 8c206966b954a6..6583738acb94c1 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(__llvm_libc::stdout)); + result = LIBC_NAMESPACE::fputs( + simple, reinterpret_cast(LIBC_NAMESPACE::stdout)); EXPECT_GE(result, 0); constexpr char more[] = "A simple string written to stderr\n"; - result = - __llvm_libc::fputs(more, reinterpret_cast(__llvm_libc::stderr)); + result = LIBC_NAMESPACE::fputs( + more, reinterpret_cast(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 efb8f31ff11b56..701090788ca10c 100644 --- a/libc/test/src/stdio/fscanf_test.cpp +++ b/libc/test/src/stdio/fscanf_test.cpp @@ -23,10 +23,10 @@ namespace scanf_test { #ifndef LIBC_COPT_STDIO_USE_SYSTEM_FILE -using __llvm_libc::fclose; -using __llvm_libc::ferror; -using __llvm_libc::fopen; -using __llvm_libc::fwrite; +using LIBC_NAMESPACE::fclose; +using LIBC_NAMESPACE::ferror; +using LIBC_NAMESPACE::fopen; +using LIBC_NAMESPACE::fwrite; #else // defined(LIBC_COPT_STDIO_USE_SYSTEM_FILE) using ::fclose; using ::ferror; @@ -59,8 +59,8 @@ TEST(LlvmLibcFScanfTest, WriteToFile) { scanf_test::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, scanf_test::fclose(file)); @@ -69,21 +69,22 @@ TEST(LlvmLibcFScanfTest, WriteToFile) { 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(scanf_test::ferror(file), 0); ASSERT_EQ(scanf_test::fclose(file), 0); diff --git a/libc/test/src/stdio/ftell_test.cpp b/libc/test/src/stdio/ftell_test.cpp index fec881db4d888b..61b626f53cd26e 100644 --- a/libc/test/src/stdio/ftell_test.cpp +++ b/libc/test/src/stdio/ftell_test.cpp @@ -17,41 +17,41 @@ #include -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 69860d627f800d..8404ef6ec7db4d 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("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("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("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("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("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::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 910b611f519493..0134277c4a1b2d 100644 --- a/libc/test/src/stdio/printf_core/parser_test.cpp +++ b/libc/test/src/stdio/printf_core/parser_test.cpp @@ -16,8 +16,8 @@ #include "test/UnitTest/PrintfMatcher.h" #include "test/UnitTest/Test.h" -using __llvm_libc::cpp::string_view; -using __llvm_libc::internal::ArgList; +using LIBC_NAMESPACE::cpp::string_view; +using LIBC_NAMESPACE::internal::ArgList; void init(const char *__restrict str, ...) { va_list vlist; @@ -25,17 +25,17 @@ void init(const char *__restrict str, ...) { 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); 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(); @@ -48,11 +48,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}; @@ -62,11 +62,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}; @@ -88,12 +88,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}; @@ -104,12 +104,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}; @@ -117,21 +117,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::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'; @@ -139,12 +139,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}; @@ -156,12 +156,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}; @@ -173,12 +173,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}; @@ -190,16 +190,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'; @@ -207,16 +207,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'; @@ -224,22 +224,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::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'; @@ -247,14 +247,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}; @@ -266,7 +266,7 @@ TEST(LlvmLibcPrintfParserTest, EvalThreeArgs) { expected1.has_conv = true; expected1.raw_string = {str + 2, 2}; - expected1.conv_val_raw = __llvm_libc::cpp::bit_cast(arg2); + expected1.conv_val_raw = LIBC_NAMESPACE::cpp::bit_cast(arg2); expected1.conv_name = 'f'; ASSERT_PFORMAT_EQ(expected1, format_arr[1]); @@ -283,12 +283,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}; @@ -299,14 +299,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}; @@ -318,7 +318,7 @@ TEST(LlvmLibcPrintfParserTest, IndexModeThreeArgsSequential) { expected1.has_conv = true; expected1.raw_string = {str + 4, 4}; - expected1.conv_val_raw = __llvm_libc::cpp::bit_cast(arg2); + expected1.conv_val_raw = LIBC_NAMESPACE::cpp::bit_cast(arg2); expected1.conv_name = 'f'; ASSERT_PFORMAT_EQ(expected1, format_arr[1]); @@ -333,14 +333,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}; @@ -352,7 +352,7 @@ TEST(LlvmLibcPrintfParserTest, IndexModeThreeArgsReverse) { expected1.has_conv = true; expected1.raw_string = {str + 4, 4}; - expected1.conv_val_raw = __llvm_libc::cpp::bit_cast(arg2); + expected1.conv_val_raw = LIBC_NAMESPACE::cpp::bit_cast(arg2); expected1.conv_name = 'f'; ASSERT_PFORMAT_EQ(expected1, format_arr[1]); @@ -367,14 +367,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), @@ -386,7 +386,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; @@ -394,7 +394,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; @@ -407,7 +407,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'; @@ -435,9 +435,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(arg2); + expected5.conv_val_raw = LIBC_NAMESPACE::cpp::bit_cast(arg2); expected5.conv_name = 'f'; EXPECT_PFORMAT_EQ(expected5, format_arr[5]); @@ -451,9 +451,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(arg2); + expected7.conv_val_raw = LIBC_NAMESPACE::cpp::bit_cast(arg2); expected7.conv_name = 'f'; EXPECT_PFORMAT_EQ(expected7, format_arr[7]); @@ -476,7 +476,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; @@ -485,7 +485,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}; @@ -508,11 +508,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}; @@ -525,7 +525,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 @@ -541,7 +541,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 f31ff91d64960e..4fe5ffb4aa9891 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(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 e2e3675d443dd7..147d17bb4271f1 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(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(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(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 0bd3acc70ed85c..7349a97d80e19d 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 a9fe1717783fd3..e9ce46eaa3190a 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 dab1c80943f211..ce4a1352d1cc1a 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 97cb77e91c9b2c..c760debc1af438 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(__llvm_libc::scanf_core::READ_OK)); + ASSERT_EQ(LIBC_NAMESPACE::scanf_core::raw_match(&reader, "abc"), + static_cast(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(__llvm_libc::scanf_core::READ_OK)); + ASSERT_EQ(LIBC_NAMESPACE::scanf_core::raw_match(&reader, ""), + static_cast(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(__llvm_libc::scanf_core::READ_OK)); + ASSERT_EQ(LIBC_NAMESPACE::scanf_core::raw_match(&reader, " "), + static_cast(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(__llvm_libc::scanf_core::READ_OK)); + ASSERT_EQ(LIBC_NAMESPACE::scanf_core::raw_match(&reader, "d"), + static_cast(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(__llvm_libc::scanf_core::MATCHING_FAILURE)); + ASSERT_EQ(LIBC_NAMESPACE::scanf_core::raw_match(&reader, "z"), + static_cast(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(__llvm_libc::scanf_core::MATCHING_FAILURE)); + ASSERT_EQ(LIBC_NAMESPACE::scanf_core::raw_match(&reader, "efgh"), + static_cast(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(__llvm_libc::scanf_core::MATCHING_FAILURE)); + ASSERT_EQ(LIBC_NAMESPACE::scanf_core::raw_match(&reader, "a"), + static_cast(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(__llvm_libc::scanf_core::READ_OK)); + ASSERT_EQ(LIBC_NAMESPACE::scanf_core::raw_match(&reader, " \t\n "), + static_cast(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(__llvm_libc::scanf_core::MATCHING_FAILURE)); + ASSERT_EQ(LIBC_NAMESPACE::scanf_core::raw_match(&reader, "ab"), + static_cast(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(__llvm_libc::scanf_core::READ_OK)); + ASSERT_EQ(LIBC_NAMESPACE::scanf_core::raw_match(&reader, " b"), + static_cast(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(__llvm_libc::scanf_core::READ_OK)); + ASSERT_EQ(LIBC_NAMESPACE::scanf_core::raw_match(&reader, "\t"), + static_cast(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(__llvm_libc::scanf_core::READ_OK)); + ASSERT_EQ(LIBC_NAMESPACE::scanf_core::raw_match(&reader, "c d"), + static_cast(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(__llvm_libc::scanf_core::READ_OK)); + ASSERT_EQ(LIBC_NAMESPACE::scanf_core::convert(&reader, conv), + static_cast(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(__llvm_libc::scanf_core::READ_OK)); + ASSERT_EQ(LIBC_NAMESPACE::scanf_core::convert(&reader, conv), + static_cast(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(__llvm_libc::scanf_core::READ_OK)); + ASSERT_EQ(LIBC_NAMESPACE::scanf_core::convert(&reader, conv), + static_cast(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(__llvm_libc::scanf_core::READ_OK)); + ASSERT_EQ(LIBC_NAMESPACE::scanf_core::convert(&reader, conv), + static_cast(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(__llvm_libc::scanf_core::READ_OK)); + ASSERT_EQ(LIBC_NAMESPACE::scanf_core::convert(&reader, conv), + static_cast(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(__llvm_libc::scanf_core::READ_OK)); + ASSERT_EQ(LIBC_NAMESPACE::scanf_core::convert(&reader, conv), + static_cast(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(__llvm_libc::scanf_core::READ_OK)); + ASSERT_EQ(LIBC_NAMESPACE::scanf_core::convert(&reader, conv), + static_cast(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(__llvm_libc::scanf_core::READ_OK)); + ASSERT_EQ(LIBC_NAMESPACE::scanf_core::convert(&reader, conv), + static_cast(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(__llvm_libc::scanf_core::READ_OK)); + ASSERT_EQ(LIBC_NAMESPACE::scanf_core::convert(&reader, conv), + static_cast(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(__llvm_libc::scanf_core::READ_OK)); + ASSERT_EQ(LIBC_NAMESPACE::scanf_core::convert(&reader, conv), + static_cast(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(__llvm_libc::scanf_core::READ_OK)); + ASSERT_EQ(LIBC_NAMESPACE::scanf_core::convert(&reader, conv), + static_cast(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(__llvm_libc::scanf_core::READ_OK)); + ASSERT_EQ(LIBC_NAMESPACE::scanf_core::convert(&reader, conv), + static_cast(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(__llvm_libc::scanf_core::READ_OK)); + ASSERT_EQ(LIBC_NAMESPACE::scanf_core::convert(&reader, conv), + static_cast(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(__llvm_libc::scanf_core::READ_OK)); + ASSERT_EQ(LIBC_NAMESPACE::scanf_core::convert(&reader, conv), + static_cast(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(__llvm_libc::scanf_core::READ_OK)); + ASSERT_EQ(LIBC_NAMESPACE::scanf_core::convert(&reader, conv), + static_cast(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(__llvm_libc::scanf_core::READ_OK)); + ASSERT_EQ(LIBC_NAMESPACE::scanf_core::convert(&reader, conv), + static_cast(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(__llvm_libc::scanf_core::MATCHING_FAILURE)); + ASSERT_EQ(LIBC_NAMESPACE::scanf_core::convert(&reader, conv), + static_cast(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(__llvm_libc::scanf_core::READ_OK)); + ASSERT_EQ(LIBC_NAMESPACE::scanf_core::convert(&reader, conv), + static_cast(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(__llvm_libc::scanf_core::READ_OK)); + ASSERT_EQ(LIBC_NAMESPACE::scanf_core::convert(&reader, conv), + static_cast(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(__llvm_libc::scanf_core::READ_OK)); + ASSERT_EQ(LIBC_NAMESPACE::scanf_core::convert(&reader, conv), + static_cast(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 b1f9efa0f8a2bc..c81edbd8c0963a 100644 --- a/libc/test/src/stdio/scanf_core/parser_test.cpp +++ b/libc/test/src/stdio/scanf_core/parser_test.cpp @@ -17,8 +17,8 @@ #include "test/UnitTest/ScanfMatcher.h" #include "test/UnitTest/Test.h" -using __llvm_libc::cpp::string_view; -using __llvm_libc::internal::ArgList; +using LIBC_NAMESPACE::cpp::string_view; +using LIBC_NAMESPACE::internal::ArgList; void init(const char *__restrict str, ...) { va_list vlist; @@ -26,17 +26,17 @@ void init(const char *__restrict str, ...) { 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(); @@ -49,11 +49,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; @@ -63,11 +63,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}; @@ -89,12 +89,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; @@ -105,12 +105,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}; @@ -118,7 +118,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 @@ -126,11 +126,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]); @@ -142,12 +142,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; @@ -159,16 +159,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'; @@ -176,16 +176,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'; @@ -193,37 +193,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'); @@ -235,19 +235,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'); @@ -260,19 +260,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'); @@ -286,19 +286,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('-'); @@ -308,19 +308,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'); @@ -331,19 +331,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'); @@ -354,19 +354,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'); @@ -379,19 +379,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(); @@ -402,19 +402,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(']'); @@ -424,19 +424,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'); @@ -446,19 +446,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(); @@ -469,19 +469,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(); @@ -495,19 +495,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'); @@ -517,14 +517,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}; @@ -553,12 +553,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}; @@ -569,14 +569,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}; @@ -603,14 +603,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}; @@ -637,14 +637,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), @@ -656,7 +656,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; @@ -665,7 +665,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; @@ -679,7 +679,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'; @@ -707,7 +707,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]); @@ -748,7 +748,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/reader_test.cpp b/libc/test/src/stdio/scanf_core/reader_test.cpp index 9db916c115a242..43a14184c7650d 100644 --- a/libc/test/src/stdio/scanf_core/reader_test.cpp +++ b/libc/test/src/stdio/scanf_core/reader_test.cpp @@ -15,14 +15,14 @@ TEST(LlvmLibcScanfStringReaderTest, Constructor) { char str[10]; // buff_len justneeds to be a big number. The specific value isn't important // in the real world. - __llvm_libc::scanf_core::ReadBuffer rb{const_cast(str), 1000000}; - __llvm_libc::scanf_core::Reader reader(&rb); + LIBC_NAMESPACE::scanf_core::ReadBuffer rb{const_cast(str), 1000000}; + LIBC_NAMESPACE::scanf_core::Reader reader(&rb); } TEST(LlvmLibcScanfStringReaderTest, SimpleRead) { const char *str = "abc"; - __llvm_libc::scanf_core::ReadBuffer rb{const_cast(str), 1000000}; - __llvm_libc::scanf_core::Reader reader(&rb); + LIBC_NAMESPACE::scanf_core::ReadBuffer rb{const_cast(str), 1000000}; + LIBC_NAMESPACE::scanf_core::Reader reader(&rb); for (size_t i = 0; i < sizeof("abc"); ++i) { ASSERT_EQ(str[i], reader.getc()); @@ -31,8 +31,8 @@ TEST(LlvmLibcScanfStringReaderTest, SimpleRead) { TEST(LlvmLibcScanfStringReaderTest, ReadAndReverse) { const char *str = "abcDEF123"; - __llvm_libc::scanf_core::ReadBuffer rb{const_cast(str), 1000000}; - __llvm_libc::scanf_core::Reader reader(&rb); + LIBC_NAMESPACE::scanf_core::ReadBuffer rb{const_cast(str), 1000000}; + LIBC_NAMESPACE::scanf_core::Reader reader(&rb); 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 3c2bb379cad284..b0abca4acf731b 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 6b44f6b73b20fc..2faa01a15ec108 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 764be9a9ba48b4..d898f2b80a86f9 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 4fda76d4a4e5a7..8b9c919bed203d 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 -// 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::inf().get_val(); - double nan = __llvm_libc::fputil::FPBits::build_nan(1); + double inf = LIBC_NAMESPACE::fputil::FPBits::inf().get_val(); + double nan = LIBC_NAMESPACE::fputil::FPBits::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::inf().get_val(); - double nan = __llvm_libc::fputil::FPBits::build_nan(1); + double inf = LIBC_NAMESPACE::fputil::FPBits::inf().get_val(); + double nan = LIBC_NAMESPACE::fputil::FPBits::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,7 +1102,8 @@ TEST_F(LlvmLibcSPrintfTest, FloatDecimalConv) { "231934194956788626761834746430104077432547436359522462253411168467463134" "24896.000000"); - written = __llvm_libc::sprintf(big_buff, "%Lf", 0xf.fffffffffffffffp+16380L); + written = + LIBC_NAMESPACE::sprintf(big_buff, "%Lf", 0xf.fffffffffffffffp+16380L); ASSERT_STREQ_LEN( written, big_buff, "118973149535723176502126385303097020516906332229462420044032373389173700" @@ -1174,10 +1176,10 @@ TEST_F(LlvmLibcSPrintfTest, FloatDecimalConv) { "538580868883777725864856414593426212108664758848926003176234596076950884" "9149662444156604419552086811989770240.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." @@ -1289,7 +1291,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) @@ -1298,7 +1300,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) @@ -1307,7 +1309,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) @@ -1319,88 +1321,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 @@ -1410,13 +1412,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." @@ -1425,10 +1427,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." @@ -1449,12 +1452,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." @@ -1464,7 +1467,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." @@ -1474,7 +1477,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." @@ -1484,7 +1487,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." @@ -1494,7 +1497,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." @@ -1505,7 +1508,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) @@ -1514,8 +1517,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"); @@ -1527,319 +1530,319 @@ 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::inf().get_val(); - double nan = __llvm_libc::fputil::FPBits::build_nan(1); + double inf = LIBC_NAMESPACE::fputil::FPBits::inf().get_val(); + double nan = LIBC_NAMESPACE::fputil::FPBits::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"); - written = __llvm_libc::sprintf(buff, "%Le", 0xf.fffffffffffffffp+16380L); + written = LIBC_NAMESPACE::sprintf(buff, "%Le", 0xf.fffffffffffffffp+16380L); ASSERT_STREQ_LEN(written, buff, "1.189731e+4932"); #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" @@ -1858,7 +1861,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" @@ -1932,7 +1935,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) @@ -1941,7 +1944,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) @@ -1950,7 +1953,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) @@ -1962,81 +1965,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 @@ -2047,40 +2050,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." @@ -2090,10 +2093,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." @@ -2103,32 +2106,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) @@ -2137,8 +2140,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"); @@ -2150,325 +2153,325 @@ 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::inf().get_val(); - double nan = __llvm_libc::fputil::FPBits::build_nan(1); + double inf = LIBC_NAMESPACE::fputil::FPBits::inf().get_val(); + double nan = LIBC_NAMESPACE::fputil::FPBits::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. - written = __llvm_libc::sprintf(buff, "%Lg", 0xf.fffffffffffffffp+16380L); + written = LIBC_NAMESPACE::sprintf(buff, "%Lg", 0xf.fffffffffffffffp+16380L); ASSERT_STREQ_LEN(written, buff, "1.18973e+4932"); // 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" @@ -2487,7 +2490,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" @@ -2561,7 +2564,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) @@ -2570,7 +2573,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) @@ -2579,7 +2582,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) @@ -2591,98 +2594,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 @@ -2693,18 +2696,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." @@ -2714,10 +2717,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." @@ -2727,38 +2730,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) @@ -2767,8 +2770,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"); @@ -2780,233 +2783,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"); } @@ -3019,31 +3022,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 } @@ -3054,20 +3057,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 b6535dfde076cd..8e0ad7de4f2ea2 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::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::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::max()); + EXPECT_EQ(max_result, LIBC_NAMESPACE::cpp::numeric_limits::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::max()); + EXPECT_EQ(max_result, LIBC_NAMESPACE::cpp::numeric_limits::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::max()); + EXPECT_EQ(max_result, LIBC_NAMESPACE::cpp::numeric_limits::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::inf().get_val(); - float nan = __llvm_libc::fputil::FPBits::build_nan(1); + float inf = LIBC_NAMESPACE::fputil::FPBits::inf().get_val(); + float nan = LIBC_NAMESPACE::fputil::FPBits::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::inf().get_val(); - long double ld_nan = __llvm_libc::fputil::FPBits::build_nan(1); + double d_inf = LIBC_NAMESPACE::fputil::FPBits::inf().get_val(); + long double ld_nan = + LIBC_NAMESPACE::fputil::FPBits::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::inf().get_val(); - float nan = __llvm_libc::fputil::FPBits::build_nan(1); + float inf = LIBC_NAMESPACE::fputil::FPBits::inf().get_val(); + float nan = LIBC_NAMESPACE::fputil::FPBits::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::inf().get_val(); + float inf = LIBC_NAMESPACE::fputil::FPBits::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(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(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(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(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(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(-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(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 028343d8b97933..75eecc87ef265f 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 67ce11e25d1c5d..cf51e8caa6a550 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 49c40e0274127a..9bad2c831e5c42 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_STDIO_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_STDIO_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 0710bbffe5b137..40eba723a00707 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 08f10708b8dca3..2aef1d71917eee 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 3f0551a877f60c..ddccdfa5cef730 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 923489d6644c78..85701828c0f6b7 100644 --- a/libc/test/src/stdlib/AtoiTest.h +++ b/libc/test/src/stdlib/AtoiTest.h @@ -11,9 +11,10 @@ #include -using __llvm_libc::cpp::is_same_v; +using LIBC_NAMESPACE::cpp::is_same_v; -template struct AtoTest : public __llvm_libc::testing::Test { +template +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 5867c5b7a0231c..90fae6c4df44ff 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 -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 24726b418817d1..11794c4bfe05f8 100644 --- a/libc/test/src/stdlib/StrtolTest.h +++ b/libc/test/src/stdlib/StrtolTest.h @@ -15,7 +15,7 @@ #include #include -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 -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::max(); + LIBC_NAMESPACE::cpp::numeric_limits::max(); static constexpr ReturnT T_MIN = - __llvm_libc::cpp::numeric_limits::min(); + LIBC_NAMESPACE::cpp::numeric_limits::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 af5cd23743f6ea..9ca0fc51aab812 100644 --- a/libc/test/src/stdlib/_Exit_test.cpp +++ b/libc/test/src/stdlib/_Exit_test.cpp @@ -13,9 +13,9 @@ #include 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 6e6f1aeeb91e14..766c8d5fbb21a1 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 a402253fb0695f..171383e2c9133d 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 eb295adfb719a0..8a785ccb8cce20 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 arr; +static LIBC_NAMESPACE::cpp::array arr; template -void register_atexit_handlers(__llvm_libc::cpp::integer_sequence) { - (__llvm_libc::atexit(+[] { arr[size++] = Ts; }), ...); +void register_atexit_handlers( + LIBC_NAMESPACE::cpp::integer_sequence) { + (LIBC_NAMESPACE::atexit(+[] { arr[size++] = Ts; }), ...); } template 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 constexpr auto getTest() { __builtin_trap(); }); register_atexit_handlers( - __llvm_libc::cpp::make_integer_sequence{}); - __llvm_libc::exit(0); + LIBC_NAMESPACE::cpp::make_integer_sequence{}); + 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 efa9f6c96d365d..ed3d4c26308cb2 100644 --- a/libc/test/src/stdlib/atof_test.cpp +++ b/libc/test/src/stdlib/atof_test.cpp @@ -16,21 +16,21 @@ #include #include -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 expected_fp = - __llvm_libc::fputil::FPBits(uint64_t(0x405ec00000000000)); + LIBC_NAMESPACE::fputil::FPBits expected_fp = + LIBC_NAMESPACE::fputil::FPBits(uint64_t(0x405ec00000000000)); libc_errno = 0; - EXPECT_THAT(__llvm_libc::atof("123"), + EXPECT_THAT(LIBC_NAMESPACE::atof("123"), Succeeds(static_cast(expected_fp))); } TEST(LlvmLibcAToFTest, FailedParsingTest) { libc_errno = 0; // atof does not flag errors. - EXPECT_THAT(__llvm_libc::atof("???"), Succeeds(0.0)); + EXPECT_THAT(LIBC_NAMESPACE::atof("???"), Succeeds(0.0)); } diff --git a/libc/test/src/stdlib/atoi_test.cpp b/libc/test/src/stdlib/atoi_test.cpp index 6fbde557e1f042..4973fbb3c1da4e 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 ad1cbba9465032..cc817087d05f95 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 8052f2fb15b69a..0c7a1331da29f3 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 4726f28c129a63..689145806ba8d3 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(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(elem), ARRAY[0]); } diff --git a/libc/test/src/stdlib/div_test.cpp b/libc/test/src/stdlib/div_test.cpp index 6b1f20d1868546..d06b8348b6464e 100644 --- a/libc/test/src/stdlib/div_test.cpp +++ b/libc/test/src/stdlib/div_test.cpp @@ -12,4 +12,4 @@ #include -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 1209d174331e32..535d1da5d5f4a6 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 d28d38789a7168..6b84163d654748 100644 --- a/libc/test/src/stdlib/ldiv_test.cpp +++ b/libc/test/src/stdlib/ldiv_test.cpp @@ -12,4 +12,4 @@ #include -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 13ed4f8f1c523c..a6dfa4655f28ae 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 5fa0de23f930c7..d803894fa862cc 100644 --- a/libc/test/src/stdlib/lldiv_test.cpp +++ b/libc/test/src/stdlib/lldiv_test.cpp @@ -12,4 +12,4 @@ #include -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 579d5dca53f007..d9023cf56d9fea 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(__llvm_libc::malloc(sizeof(int))); + int *ptr = reinterpret_cast(LIBC_NAMESPACE::malloc(sizeof(int))); EXPECT_NE(reinterpret_cast(ptr), static_cast(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 ceb58fc1e896ae..2c810f411b03e2 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, - reinterpret_cast(compare_priority_val)); + LIBC_NAMESPACE::qsort_r(array, ARRAY_SIZE, sizeof(PriorityVal), + type_erased_comp, + reinterpret_cast(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 9808ad0dcc275c..0822d490e65208 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 4bebbe37ffbe11..6f25708e539053 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 70129ba0714d44..b1bdd89e41fd15 100644 --- a/libc/test/src/stdlib/strtod_test.cpp +++ b/libc/test/src/stdlib/strtod_test.cpp @@ -17,13 +17,13 @@ #include #include -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 { 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 expected_fp = - __llvm_libc::fputil::FPBits(expectedRawData); + LIBC_NAMESPACE::fputil::FPBits expected_fp = + LIBC_NAMESPACE::fputil::FPBits(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(static_cast(expected_fp))); else diff --git a/libc/test/src/stdlib/strtof_test.cpp b/libc/test/src/stdlib/strtof_test.cpp index 9151cbeb88d587..15a8a34ef4fb17 100644 --- a/libc/test/src/stdlib/strtof_test.cpp +++ b/libc/test/src/stdlib/strtof_test.cpp @@ -17,10 +17,10 @@ #include #include -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 { 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 expected_fp = - __llvm_libc::fputil::FPBits(expectedRawData); + LIBC_NAMESPACE::fputil::FPBits expected_fp = + LIBC_NAMESPACE::fputil::FPBits(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(expected_fp)); diff --git a/libc/test/src/stdlib/strtoint32_test.cpp b/libc/test/src/stdlib/strtoint32_test.cpp index fa5e57145d24ca..4ca20f3333f560 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 95e4761881f519..f8d807b146f2ec 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 fb92ee6978d9bc..a6ce262559f71f 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 dfa1fb7e939b5e..680a93188c76d1 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 expected_fp = - __llvm_libc::fputil::FPBits(expectedRawData); + LIBC_NAMESPACE::fputil::FPBits expected_fp = + LIBC_NAMESPACE::fputil::FPBits(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 actual_fp = - __llvm_libc::fputil::FPBits(); - actual_fp = __llvm_libc::fputil::FPBits(result); + LIBC_NAMESPACE::fputil::FPBits actual_fp = + LIBC_NAMESPACE::fputil::FPBits(); + actual_fp = LIBC_NAMESPACE::fputil::FPBits(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 b4b197d59ea060..8e94cdc6a38996 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 f2cd8603a9832c..7ba721139dd394 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 c2544060d8bd5b..c9a0b8de46b587 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 71903c987cacbb..74e172de95953e 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 struct StrchrTest : public __llvm_libc::testing::Test { +template struct StrchrTest : public LIBC_NAMESPACE::testing::Test { void findsFirstCharacter() { const char *src = "abcde"; @@ -82,7 +82,7 @@ template struct StrchrTest : public __llvm_libc::testing::Test { } }; -template struct StrrchrTest : public __llvm_libc::testing::Test { +template 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 72037c73b4f506..fa89e4d7b08f19 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 p1, cpp::span 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 96541797eed338..f8cb9208838f33 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 dst, cpp::span 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 d3ee64dc8ad7d3..7382490e13cbae 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 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 22202f0fc8346b..88953205009d76 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 09f24ae7cdeace..5bac86541ccff1 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 // 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 dst, - const __llvm_libc::cpp::span src, int end, + void check_memccpy(LIBC_NAMESPACE::cpp::span dst, + const LIBC_NAMESPACE::cpp::span src, int end, size_t count, - const __llvm_libc::cpp::span expected, + const LIBC_NAMESPACE::cpp::span 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(nullptr)); diff --git a/libc/test/src/string/memchr_test.cpp b/libc/test/src/string/memchr_test.cpp index 1523be8f3fc36e..343958234edcee 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(__llvm_libc::memchr(src, c, size)); + return reinterpret_cast(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(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(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(src), src_copy); } diff --git a/libc/test/src/string/memcmp_test.cpp b/libc/test/src/string/memcmp_test.cpp index ac26fd49de6f2b..03a0ac1c0ba655 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 p1, cpp::span 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 7fe0921077c33b..b05d4202ea31cd 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 dst, cpp::span 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 db6c9c05e3a0b1..56d4b7f03c264b 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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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 57ab0d40d33eaa..b076e862b6ec74 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 dst, cpp::span 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 dee375e811e758..9504230e0c3aa9 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 // uintxx_t #include // 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 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 f1223b81dac895..15ac9607bf3e3d 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 struct has_head_tail { template 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 8968e0d85ae992..8e9052de56f1b0 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 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 5259874d25d600..43ad5a0f3e1b7e 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(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(result), dest + 0); } diff --git a/libc/test/src/string/memrchr_test.cpp b/libc/test/src/string/memrchr_test.cpp index c8e81ecfbfaa73..421cb9b98516e5 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(__llvm_libc::memrchr(src, c, size)); + return reinterpret_cast(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 1aa8edd1bc65a1..3a54498498f6b2 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 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 1e5969653d5e70..10513919cffa2d 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 56e53c12f86593..523eaf16d988a8 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 2448ea5759767a..247fa92a0c7bfa 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 // 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 dst, - const __llvm_libc::cpp::span src, size_t n, - const __llvm_libc::cpp::span expected, + void check_stpncpy(LIBC_NAMESPACE::cpp::span dst, + const LIBC_NAMESPACE::cpp::span src, size_t n, + const LIBC_NAMESPACE::cpp::span 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 2eb16ee76fd8a4..df7888168c69e0 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 6345ac5e3e1c3d..5b8604a1756e43 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 2fd42123ec79ff..e4f6c1ee75992e 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 684b631a6e9bd2..6ad83446ab25ae 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 e4ca729db7e678..273cf40925d745 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(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 78dd8c1a8d4e72..ef58dc608c83b0 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 256c3c7bd281a1..a10f98f1ca4d6a 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 7508b56e23db28..1a1227aac5d2f8 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 2f3565c78f6b34..d83b3cf4fdfe8c 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 ee46882233dd37..b1d4df31603c4b 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(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(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(nullptr)); diff --git a/libc/test/src/string/strerror_r_test.cpp b/libc/test/src/string/strerror_r_test.cpp index 6ac3cdf4808518..868362edd84b11 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 20a8fba6f30fbe..ec9827b75cfc82 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(i)), message_array[i]); + EXPECT_STREQ(LIBC_NAMESPACE::strerror(static_cast(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 50c4b2e33897d8..1ffa4b0e921e2b 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 41e244b239d067..5a1e30c12963f3 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 41b5fbede0fd06..4eb9d47e9209dd 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 cf6284318cf7ef..b4173c455de91b 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 146922194eba2a..9b52788d93d120 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 b3971f6b95a280..1724a5436d1ea3 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 69265f82183b59..b71ed66f5c6a83 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 // 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 dst, - const __llvm_libc::cpp::span src, size_t n, - const __llvm_libc::cpp::span expected) { + void check_strncpy(LIBC_NAMESPACE::cpp::span dst, + const LIBC_NAMESPACE::cpp::span src, size_t n, + const LIBC_NAMESPACE::cpp::span 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 53cdd368fb42af..3adcd9bacffdb2 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(nullptr)); ASSERT_NE(empty, const_cast(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(nullptr)); ASSERT_NE(abc, const_cast(result)); ASSERT_STREQ(abc, result); ::free(result); - result = __llvm_libc::strndup(abc, 1); + result = LIBC_NAMESPACE::strndup(abc, 1); ASSERT_NE(result, static_cast(nullptr)); ASSERT_NE(abc, const_cast(result)); ASSERT_STREQ("a", result); ::free(result); - result = __llvm_libc::strndup(abc, 10); + result = LIBC_NAMESPACE::strndup(abc, 10); ASSERT_NE(result, static_cast(nullptr)); ASSERT_NE(abc, const_cast(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(nullptr)); } diff --git a/libc/test/src/string/strnlen_test.cpp b/libc/test/src/string/strnlen_test.cpp index e260cd65e878e9..bd1002c0ae0784 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(0), __llvm_libc::strnlen(empty, 0)); + ASSERT_EQ(static_cast(0), LIBC_NAMESPACE::strnlen(empty, 0)); // If N is greater than string length, this should still return 0. - ASSERT_EQ(static_cast(0), __llvm_libc::strnlen(empty, 1)); + ASSERT_EQ(static_cast(0), LIBC_NAMESPACE::strnlen(empty, 1)); } TEST(LlvmLibcStrNLenTest, OneCharacterString) { const char *single = "X"; - ASSERT_EQ(static_cast(1), __llvm_libc::strnlen(single, 1)); + ASSERT_EQ(static_cast(1), LIBC_NAMESPACE::strnlen(single, 1)); // If N is zero, this should return 0. - ASSERT_EQ(static_cast(0), __llvm_libc::strnlen(single, 0)); + ASSERT_EQ(static_cast(0), LIBC_NAMESPACE::strnlen(single, 0)); // If N is greater than string length, this should still return 1. - ASSERT_EQ(static_cast(1), __llvm_libc::strnlen(single, 2)); + ASSERT_EQ(static_cast(1), LIBC_NAMESPACE::strnlen(single, 2)); } TEST(LlvmLibcStrNLenTest, ManyCharacterString) { const char *many = "123456789"; - ASSERT_EQ(static_cast(9), __llvm_libc::strnlen(many, 9)); + ASSERT_EQ(static_cast(9), LIBC_NAMESPACE::strnlen(many, 9)); // If N is smaller than the string length, it should return N. - ASSERT_EQ(static_cast(3), __llvm_libc::strnlen(many, 3)); + ASSERT_EQ(static_cast(3), LIBC_NAMESPACE::strnlen(many, 3)); // If N is zero, this should return 0. - ASSERT_EQ(static_cast(0), __llvm_libc::strnlen(many, 0)); + ASSERT_EQ(static_cast(0), LIBC_NAMESPACE::strnlen(many, 0)); // If N is greater than the string length, this should still return 9. - ASSERT_EQ(static_cast(9), __llvm_libc::strnlen(many, 42)); + ASSERT_EQ(static_cast(9), LIBC_NAMESPACE::strnlen(many, 42)); } TEST(LlvmLibcStrNLenTest, CharactersAfterNullTerminatorShouldNotBeIncluded) { const char str[5] = {'a', 'b', 'c', '\0', 'd'}; - ASSERT_EQ(static_cast(3), __llvm_libc::strnlen(str, 3)); + ASSERT_EQ(static_cast(3), LIBC_NAMESPACE::strnlen(str, 3)); // This should only read up to the null terminator. - ASSERT_EQ(static_cast(3), __llvm_libc::strnlen(str, 4)); - ASSERT_EQ(static_cast(3), __llvm_libc::strnlen(str, 5)); + ASSERT_EQ(static_cast(3), LIBC_NAMESPACE::strnlen(str, 4)); + ASSERT_EQ(static_cast(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 fe10f87930593e..fbe14da12ac10e 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 02659c010ada14..e415eddaeca0de 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 7c0863b3266f5c..0daa29f6a7ad59 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 aa55230d5286b8..48b5d17f85c465 100644 --- a/libc/test/src/string/strsignal_test.cpp +++ b/libc/test/src/string/strsignal_test.cpp @@ -12,7 +12,7 @@ #include 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(static_cast(i)), i); - EXPECT_STREQ(__llvm_libc::strsignal(static_cast(i)), message_array[i]); + EXPECT_STREQ(LIBC_NAMESPACE::strsignal(static_cast(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 d5276091d75316..cdd12af07ee7da 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 2008d1c42e94e0..3de138cae28bd2 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 fa436e0116b37e..fdc27bae23c975 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 24033c41244357..b82065309e00c6 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 0512556d74c291..b704dbf6052fcb 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 4fdb4a2f2fde36..83c73f5454de1b 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 -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(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 d74701c5e59c97..9b13b8bd8057f2 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 -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 5f2f5f27ce0418..7127f77714d642 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 #include -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(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 b271a7185d000c..59cf01ac746959 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 -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(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 839297bc32a618..5a595afb0cdaa7 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 buffer; + LIBC_NAMESPACE::cpp::array 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 buffer; + LIBC_NAMESPACE::cpp::array 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(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 buffer; + LIBC_NAMESPACE::cpp::array 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 b385cf86ce9783..7e6bb0aaca9251 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 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 44d5b2e14c0128..61df532b3e96cc 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 #include -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 e10d1aa1709601..2e6baced801b10 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 9af01ad6337471..6e4665a1bb96b1 100644 --- a/libc/test/src/sys/sendfile/sendfile_test.cpp +++ b/libc/test/src/sys/sendfile/sendfile_test.cpp @@ -20,11 +20,11 @@ #include #include -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 6826594e52d7b2..9037888441a357 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 // 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 f12d20dedf489f..c476b92b5e4379 100644 --- a/libc/test/src/sys/stat/chmod_test.cpp +++ b/libc/test/src/sys/stat/chmod_test.cpp @@ -18,8 +18,8 @@ #include 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 0a6c9f4a4509b0..5a32b5c973db9b 100644 --- a/libc/test/src/sys/stat/fchmod_test.cpp +++ b/libc/test/src/sys/stat/fchmod_test.cpp @@ -18,8 +18,8 @@ #include 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 578d0b0f1dfa67..077d21df15af3c 100644 --- a/libc/test/src/sys/stat/fchmodat_test.cpp +++ b/libc/test/src/sys/stat/fchmodat_test.cpp @@ -18,8 +18,8 @@ #include 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 8220181e03bd5d..22e407f6d791b8 100644 --- a/libc/test/src/sys/stat/fstat_test.cpp +++ b/libc/test/src/sys/stat/fstat_test.cpp @@ -18,8 +18,8 @@ #include 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 a3edae192d2808..6eae08daeb1cff 100644 --- a/libc/test/src/sys/stat/lstat_test.cpp +++ b/libc/test/src/sys/stat/lstat_test.cpp @@ -18,8 +18,8 @@ #include 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 584f6eb18251ab..ae11af4f6b9b11 100644 --- a/libc/test/src/sys/stat/mkdirat_test.cpp +++ b/libc/test/src/sys/stat/mkdirat_test.cpp @@ -14,14 +14,16 @@ #include 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 dd9bb1cbe31715..1711c860df269d 100644 --- a/libc/test/src/sys/stat/stat_test.cpp +++ b/libc/test/src/sys/stat/stat_test.cpp @@ -18,8 +18,8 @@ #include 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 58d7db797a621f..79822c112a5b6b 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 a7ea9ee25d7ce7..70d4d436927e6b 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 64441e70ec4280..b2ace2617d2d3f 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 01a78c24de3838..3048f9cda1e059 100644 --- a/libc/test/src/termios/termios_test.cpp +++ b/libc/test/src/termios/termios_test.cpp @@ -21,8 +21,8 @@ #include -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 54d9f4eb72ce3b..19202031915df1 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 fb2d57bb99add5..7cdc2c4b90502c 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 9682f1822f0c59..1abaa135350c13 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 3df2edf1f9c9a0..4b5ceb596aa467 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 58f9c61129d206..6367ae7145a47d 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 fc7e5b54342d8c..a3dffc6bae3913 100644 --- a/libc/test/src/time/clock_test.cpp +++ b/libc/test/src/time/clock_test.cpp @@ -13,9 +13,9 @@ #include 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 dc22494114dfd1..187df4add1e727 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 expected_fp = - __llvm_libc::fputil::FPBits(); - expected_fp = __llvm_libc::fputil::FPBits( + LIBC_NAMESPACE::fputil::FPBits expected_fp = + LIBC_NAMESPACE::fputil::FPBits(); + expected_fp = LIBC_NAMESPACE::fputil::FPBits( static_cast(t1_seconds)); - double result = __llvm_libc::difftime(t1_seconds, t2_seconds); + double result = LIBC_NAMESPACE::difftime(t1_seconds, t2_seconds); - __llvm_libc::fputil::FPBits actual_fp = - __llvm_libc::fputil::FPBits(); - actual_fp = __llvm_libc::fputil::FPBits( + LIBC_NAMESPACE::fputil::FPBits actual_fp = + LIBC_NAMESPACE::fputil::FPBits(); + actual_fp = LIBC_NAMESPACE::fputil::FPBits( static_cast(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 a852d4fd30ef12..44250787c5381e 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 0d210b6f04fe6e..2276b4803f1922 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 4d990b3da5bc15..6b1d029a693c38 100644 --- a/libc/test/src/time/gmtime_test.cpp +++ b/libc/test/src/time/gmtime_test.cpp @@ -15,9 +15,9 @@ #include -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( 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( 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 6cf115e89f05ef..753363ec397586 100644 --- a/libc/test/src/time/mktime_test.cpp +++ b/libc/test/src/time/mktime_test.cpp @@ -15,9 +15,9 @@ #include -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 e89d4fdfc05763..2826ed14dfedab 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 92fd8e48a77a39..1d938e8dae7adb 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/CMakeLists.txt b/libc/test/src/unistd/CMakeLists.txt index 2fb11fed92b310..f2e2293e026f2f 100644 --- a/libc/test/src/unistd/CMakeLists.txt +++ b/libc/test/src/unistd/CMakeLists.txt @@ -414,7 +414,7 @@ add_libc_unittest( libc.include.unistd libc.include.fcntl libc.include.sys_syscall - libc.src.unistd.__llvm_libc_syscall + libc.src.unistd.LIBC_NAMESPACE_syscall libc.test.errno_setter_matcher ) diff --git a/libc/test/src/unistd/access_test.cpp b/libc/test/src/unistd/access_test.cpp index f0fa9de8e62564..ed1fe96f4f4a16 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 a19fb29c6ebaba..dfdeacdc8e42af 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 bde5b9605e6aa5..ff870db0334c93 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 11a540c44706a9..279cfbfea1b144 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 9a0f8056b8ae8e..38c439125db3d7 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 3e04acd7f42131..27d4489f6447ea 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 217ab95f1fedb5..ae743b385e220d 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 6ac6abafd60e88..aa8e2e6f217a21 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 0fcf941b5edb10..1ca7c99e1ce373 100644 --- a/libc/test/src/unistd/getopt_test.cpp +++ b/libc/test/src/unistd/getopt_test.cpp @@ -15,7 +15,7 @@ #include -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 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 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 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 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 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 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 fc8805309d43c0..9d6c926415ee40 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 e9724765a478df..3e674afab5c948 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 8f2d9d9a7be62c..a76eee64a6eef9 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 538101d3567da6..fce4a3e5f5062a 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 7acb9dc86a0549..b1b9383cb62ee0 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 dcb6bff594a789..2ef41cd4e75f6a 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 cb04db462e414b..1a13d54dbc2328 100644 --- a/libc/test/src/unistd/lseek_test.cpp +++ b/libc/test/src/unistd/lseek_test.cpp @@ -17,44 +17,45 @@ #include 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 4d0158a8173a02..6819f559424f3e 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 ed819a93d5f827..20b51bb8082b12 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(-1), 1), + EXPECT_THAT(LIBC_NAMESPACE::write(-1, "", 1), Fails(EBADF)); + EXPECT_THAT(LIBC_NAMESPACE::write(1, reinterpret_cast(-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(-1), 1), + EXPECT_THAT(LIBC_NAMESPACE::read(-1, nullptr, 1), Fails(EBADF)); + EXPECT_THAT(LIBC_NAMESPACE::read(0, reinterpret_cast(-1), 1), Fails(EFAULT)); } diff --git a/libc/test/src/unistd/readlink_test.cpp b/libc/test/src/unistd/readlink_test.cpp index dbb957f29fd05c..b2d018a50ec793 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 39127c0288b0b4..19f0ceec3cf7c5 100644 --- a/libc/test/src/unistd/readlinkat_test.cpp +++ b/libc/test/src/unistd/readlinkat_test.cpp @@ -16,10 +16,10 @@ #include -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 3fcf328b67d988..69228ce98c8224 100644 --- a/libc/test/src/unistd/rmdir_test.cpp +++ b/libc/test/src/unistd/rmdir_test.cpp @@ -15,13 +15,14 @@ #include 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 9b94924ee3cf13..f75120d192ba3b 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 7017d4bb4f941f..84d963b7a207ce 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 e629c14f0f7a17..b0308787f2052a 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 03b9a547cdcb7e..4a53f674b8f3d6 100644 --- a/libc/test/src/unistd/syscall_test.cpp +++ b/libc/test/src/unistd/syscall_test.cpp @@ -15,7 +15,7 @@ #include // For syscall numbers. #include -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 eda2e566b0257d..85bc1258a48638 100644 --- a/libc/test/src/unistd/sysconf_test.cpp +++ b/libc/test/src/unistd/sysconf_test.cpp @@ -12,6 +12,6 @@ #include 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 4885a12225854d..15940321e5ad45 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 ff55123fa0a4ea..8a64f88ee6f26d 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 ecb9d3a771392a..5953085bf12b66 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 cfac485cdecc77..b5fcb451bd07b0 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(c)); + EXPECT_EQ(LIBC_NAMESPACE::btowc(c), static_cast(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 7a8d6eea0c82a0..3f911884a7c12c 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(c)); + EXPECT_EQ(LIBC_NAMESPACE::wctob(c), static_cast(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 e116482c500a24..6ca9b16377c0b8 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 -using FPBits = __llvm_libc::fputil::FPBits; +using FPBits = LIBC_NAMESPACE::fputil::FPBits; 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 8a62f7d767101a..567b5e2bde8553 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 86f0220a510ad0..551b97caf81fd6 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 e9f13fe4d0ad40..e23a3c2034cb28 100644 --- a/libc/utils/MPFRWrapper/MPFRUtils.cpp +++ b/libc/utils/MPFRWrapper/MPFRUtils.cpp @@ -23,9 +23,9 @@ #include "mpfr_inc.h" -template using FPBits = __llvm_libc::fputil::FPBits; +template using FPBits = LIBC_NAMESPACE::fputil::FPBits; -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace testing { namespace mpfr { @@ -51,7 +51,7 @@ template <> struct ExtraPrecision { template static inline unsigned int get_precision(double ulp_tolerance) { if (ulp_tolerance <= 0.5) { - return __llvm_libc::fputil::FloatProperties::MANTISSA_PRECISION; + return LIBC_NAMESPACE::fputil::FloatProperties::MANTISSA_PRECISION; } else { return ExtraPrecision::VALUE; } @@ -1011,4 +1011,4 @@ template long double round(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 0ba5ab6888bb79..baac2d0e3a410e 100644 --- a/libc/utils/MPFRWrapper/MPFRUtils.h +++ b/libc/utils/MPFRWrapper/MPFRUtils.h @@ -15,7 +15,7 @@ #include -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 struct BinaryInput { static_assert( - __llvm_libc::cpp::is_floating_point_v, + LIBC_NAMESPACE::cpp::is_floating_point_v, "Template parameter of BinaryInput must be a floating point type."); using Type = T; @@ -101,7 +101,7 @@ template struct BinaryInput { template struct TernaryInput { static_assert( - __llvm_libc::cpp::is_floating_point_v, + LIBC_NAMESPACE::cpp::is_floating_point_v, "Template parameter of TernaryInput must be a floating point type."); using Type = T; @@ -316,7 +316,7 @@ template 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 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( \ + LIBC_NAMESPACE::testing::mpfr::get_mpfr_matcher( \ 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( \ - input, match_value, ulp_tolerance, rounding)) + EXPECT_THAT(match_value, \ + LIBC_NAMESPACE::testing::mpfr::get_mpfr_matcher( \ + input, match_value, ulp_tolerance, rounding)) #define EXPECT_MPFR_MATCH(...) \ GET_MPFR_MACRO(__VA_ARGS__, EXPECT_MPFR_MATCH_ROUNDING, \ @@ -342,8 +343,8 @@ template 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(input, match_value, \ - ulp_tolerance, rounding) \ + LIBC_NAMESPACE::testing::mpfr::get_mpfr_matcher(input, match_value, \ + ulp_tolerance, rounding) \ .match(match_value) #define TEST_MPFR_MATCH(...) \ @@ -353,7 +354,7 @@ template 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 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( \ + LIBC_NAMESPACE::testing::mpfr::get_silent_mpfr_matcher( \ 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( \ + LIBC_NAMESPACE::testing::mpfr::get_mpfr_matcher( \ 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( \ - input, match_value, ulp_tolerance, rounding)) + ASSERT_THAT(match_value, \ + LIBC_NAMESPACE::testing::mpfr::get_mpfr_matcher( \ + input, match_value, ulp_tolerance, rounding)) #define ASSERT_MPFR_MATCH(...) \ GET_MPFR_MACRO(__VA_ARGS__, ASSERT_MPFR_MATCH_ROUNDING, \ @@ -396,7 +398,7 @@ template 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 1d0247a6dc5dca..1fb67e841cfec2 100644 --- a/libc/utils/gpu/loader/amdgpu/Loader.cpp +++ b/libc/utils/gpu/loader/amdgpu/Loader.cpp @@ -477,7 +477,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 a772cd1d22e507..fa6a4e324c0c28 100644 --- a/libc/utils/gpu/server/rpc_server.cpp +++ b/libc/utils/gpu/server/rpc_server.cpp @@ -19,7 +19,7 @@ #include #include -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 2fde0001185c16..6b87830890b837 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 { diff --git a/llvm/include/llvm/Config/llvm-config.h.cmake b/llvm/include/llvm/Config/llvm-config.h.cmake index f78966b7f0b62c..182da2c0f52c3a 100644 --- a/llvm/include/llvm/Config/llvm-config.h.cmake +++ b/llvm/include/llvm/Config/llvm-config.h.cmake @@ -16,7 +16,7 @@ /* Indicate that this is LLVM compiled from the amd-gfx branch. */ #define LLVM_HAVE_BRANCH_AMD_GFX -#define LLVM_MAIN_REVISION 475920 +#define LLVM_MAIN_REVISION 475927 /* Define if LLVM_ENABLE_DUMP is enabled */ #cmakedefine LLVM_ENABLE_DUMP diff --git a/llvm/lib/Target/AMDGPU/AMDGPU.h b/llvm/lib/Target/AMDGPU/AMDGPU.h index 2801a83568d8f8..758989abceb2a1 100644 --- a/llvm/lib/Target/AMDGPU/AMDGPU.h +++ b/llvm/lib/Target/AMDGPU/AMDGPU.h @@ -50,6 +50,7 @@ FunctionPass *createSIPreAllocateWWMRegsPass(); FunctionPass *createSIFormMemoryClausesPass(); FunctionPass *createSIPostRABundlerPass(); +FunctionPass *createAMDGPUImageIntrinsicOptimizerPass(const TargetMachine *); ModulePass *createAMDGPURemoveIncompatibleFunctionsPass(const TargetMachine *); FunctionPass *createAMDGPUCodeGenPreparePass(); FunctionPass *createAMDGPULateCodeGenPreparePass(); @@ -65,6 +66,15 @@ struct AMDGPUSimplifyLibCallsPass : PassInfoMixin { PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM); }; +struct AMDGPUImageIntrinsicOptimizerPass + : PassInfoMixin { + AMDGPUImageIntrinsicOptimizerPass(TargetMachine &TM) : TM(TM) {} + PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM); + +private: + TargetMachine &TM; +}; + struct AMDGPUUseNativeCallsPass : PassInfoMixin { PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM); }; @@ -183,6 +193,9 @@ extern char &SIInsertWaterfallID; void initializeSIPreAllocateWWMRegsPass(PassRegistry &); extern char &SIPreAllocateWWMRegsID; +void initializeAMDGPUImageIntrinsicOptimizerPass(PassRegistry &); +extern char &AMDGPUImageIntrinsicOptimizerID; + void initializeAMDGPUPerfHintAnalysisPass(PassRegistry &); extern char &AMDGPUPerfHintAnalysisID; diff --git a/llvm/lib/Target/AMDGPU/AMDGPU.td b/llvm/lib/Target/AMDGPU/AMDGPU.td index e9c164a21bb56d..3cba09e496e503 100644 --- a/llvm/lib/Target/AMDGPU/AMDGPU.td +++ b/llvm/lib/Target/AMDGPU/AMDGPU.td @@ -281,6 +281,12 @@ def FeatureMADIntraFwdBug : SubtargetFeature<"mad-intra-fwd-bug", "MAD_U64/I64 intra instruction forwarding bug" >; +def FeatureMSAALoadDstSelBug : SubtargetFeature<"msaa-load-dst-sel-bug", + "HasMSAALoadDstSelBug", + "true", + "MSAA loads not honoring dst_sel bug" +>; + class SubtargetFeatureLDSBankCount : SubtargetFeature < "ldsbankcount"#Value, "LDSBankCount", @@ -1354,7 +1360,8 @@ def FeatureISAVersion11_Common : FeatureSet< def FeatureISAVersion11_0_Common : FeatureSet< !listconcat(FeatureISAVersion11_Common.Features, - [FeatureVALUTransUseHazard])>; + [FeatureMSAALoadDstSelBug, + FeatureVALUTransUseHazard])>; def FeatureISAVersion11_0_0 : FeatureSet< !listconcat(FeatureISAVersion11_0_Common.Features, diff --git a/llvm/lib/Target/AMDGPU/AMDGPUImageIntrinsicOptimizer.cpp b/llvm/lib/Target/AMDGPU/AMDGPUImageIntrinsicOptimizer.cpp new file mode 100644 index 00000000000000..acfd3407681a7f --- /dev/null +++ b/llvm/lib/Target/AMDGPU/AMDGPUImageIntrinsicOptimizer.cpp @@ -0,0 +1,341 @@ +//===- AMDGPUImageIntrinsicOptimizer.cpp ----------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// This pass tries to combine multiple image_load intrinsics with dim=2dmsaa +// or dim=2darraymsaa into a single image_msaa_load intrinsic if: +// +// - they refer to the same vaddr except for sample_id, +// - they use a constant sample_id and they fall into the same group, +// - they have the same dmask and the number of intrinsics and the number of +// vaddr/vdata dword transfers is reduced by the combine. +// +// Examples for the tradeoff (all are assuming 2DMsaa for vaddr): +// +// +----------+-----+-----+-------+---------+------------+---------+----------+ +// | popcount | a16 | d16 | #load | vaddr / | #msaa_load | vaddr / | combine? | +// | (dmask) | | | | vdata | | vdata | | +// +----------+-----+-----+-------+---------+------------+---------+----------+ +// | 1 | 0 | 0 | 4 | 12 / 4 | 1 | 3 / 4 | yes | +// +----------+-----+-----+-------+---------+------------+---------+----------+ +// | 1 | 0 | 0 | 2 | 6 / 2 | 1 | 3 / 4 | yes? | +// +----------+-----+-----+-------+---------+------------+---------+----------+ +// | 2 | 0 | 0 | 4 | 12 / 8 | 2 | 6 / 8 | yes | +// +----------+-----+-----+-------+---------+------------+---------+----------+ +// | 2 | 0 | 0 | 2 | 6 / 4 | 2 | 6 / 8 | no | +// +----------+-----+-----+-------+---------+------------+---------+----------+ +// | 1 | 0 | 1 | 2 | 6 / 2 | 1 | 3 / 2 | yes | +// +----------+-----+-----+-------+---------+------------+---------+----------+ +// +// Some cases are of questionable benefit, like the one marked with "yes?" +// above: fewer intrinsics and fewer vaddr and fewer total transfers between SP +// and TX, but higher vdata. We start by erring on the side of converting these +// to MSAA_LOAD. +// +// clang-format off +// +// This pass will combine intrinsics such as (not neccessarily consecutive): +// call float @llvm.amdgcn.image.load.2dmsaa.f32.i32(i32 1, i32 %s, i32 %t, i32 0, <8 x i32> %rsrc, i32 0, i32 0) +// call float @llvm.amdgcn.image.load.2dmsaa.f32.i32(i32 1, i32 %s, i32 %t, i32 1, <8 x i32> %rsrc, i32 0, i32 0) +// call float @llvm.amdgcn.image.load.2dmsaa.f32.i32(i32 1, i32 %s, i32 %t, i32 2, <8 x i32> %rsrc, i32 0, i32 0) +// call float @llvm.amdgcn.image.load.2dmsaa.f32.i32(i32 1, i32 %s, i32 %t, i32 3, <8 x i32> %rsrc, i32 0, i32 0) +// ==> +// call <4 x float> @llvm.amdgcn.image.msaa.load.2dmsaa.v4f32.i32(i32 1, i32 %s, i32 %t, i32 0, <8 x i32> %rsrc, i32 0, i32 0) +// +// clang-format on +// +// Future improvements: +// +// - We may occasionally not want to do the combine if it increases the maximum +// register pressure. +// +// - Ensure clausing when multiple MSAA_LOAD are generated. +// +// Note: Even though the image_msaa_load intrinsic already exists on gfx10, this +// combine only applies to gfx11, due to a limitation in gfx10: the gfx10 +// IMAGE_MSAA_LOAD only works correctly with single-channel texture formats, and +// we don't know the format at compile time. +//===----------------------------------------------------------------------===// + +#include "AMDGPU.h" +#include "AMDGPUInstrInfo.h" +#include "AMDGPUTargetMachine.h" +#include "llvm/IR/Function.h" +#include "llvm/IR/IRBuilder.h" +#include "llvm/IR/IntrinsicInst.h" +#include "llvm/IR/IntrinsicsAMDGPU.h" +#include "llvm/Pass.h" +#include "llvm/Support/raw_ostream.h" + +using namespace llvm; + +#define DEBUG_TYPE "amdgpu-image-intrinsic-opt" + +namespace { +class AMDGPUImageIntrinsicOptimizer : public FunctionPass { + const TargetMachine *TM; + +public: + static char ID; + + AMDGPUImageIntrinsicOptimizer(const TargetMachine *TM = nullptr) + : FunctionPass(ID), TM(TM) {} + + bool runOnFunction(Function &F) override; + +}; // End of class AMDGPUImageIntrinsicOptimizer +} // End anonymous namespace + +INITIALIZE_PASS(AMDGPUImageIntrinsicOptimizer, DEBUG_TYPE, + "AMDGPU Image Intrinsic Optimizer", false, false) + +char AMDGPUImageIntrinsicOptimizer::ID = 0; + +void addInstToMergeableList( + IntrinsicInst *II, + SmallVector> &MergeableInsts, + const AMDGPU::ImageDimIntrinsicInfo *ImageDimIntr) { + for (SmallVector &IIList : MergeableInsts) { + // Check Dim. + if (IIList.front()->getIntrinsicID() != II->getIntrinsicID()) + continue; + + // Check D16. + if (IIList.front()->getType() != II->getType()) + continue; + + // Check DMask. + Value *DMaskList = IIList.front()->getArgOperand(ImageDimIntr->DMaskIndex); + Value *DMask = II->getArgOperand(ImageDimIntr->DMaskIndex); + if (DMaskList != DMask) + continue; + + // Check VAddr (except FragId). + int I = ImageDimIntr->VAddrStart; + for (; I < ImageDimIntr->VAddrEnd - 1; ++I) { + if (IIList.front()->getArgOperand(I) != II->getArgOperand(I)) + break; + } + + if (I != ImageDimIntr->VAddrEnd - 1) + continue; + + // Check FragId group. + const uint8_t FragIdIndex = ImageDimIntr->VAddrEnd - 1; + Value *FragIdList = IIList.front()->getArgOperand(FragIdIndex); + auto IIListFragId = cast(FragIdList); + auto IIFragId = cast(II->getArgOperand(FragIdIndex)); + if (IIListFragId->getValue().udiv(4) != IIFragId->getValue().udiv(4)) + continue; + + // Add to the list. + IIList.emplace_back(II); + return; + } + + // Similar instruction not found, so add a new list. + MergeableInsts.emplace_back(1, II); + LLVM_DEBUG(dbgs() << "New: " << *II << "\n"); +} + +// Collect list of all instructions we know how to merge in a subset of the +// block. It returns an iterator to the instruction after the last one analyzed. +BasicBlock::iterator collectMergeableInsts( + BasicBlock::iterator I, BasicBlock::iterator E, + SmallVector> &MergeableInsts) { + for (; I != E; ++I) { + // Don't combine if there is a store in the middle or if there is a memory + // barrier. + if (I->mayHaveSideEffects()) { + ++I; + break; + } + + // Ignore non-intrinsics. + if (IntrinsicInst *II = dyn_cast(I)) { + Intrinsic::ID IntrinID = II->getIntrinsicID(); + + // Ignore other intrinsics. + if (IntrinID != Intrinsic::amdgcn_image_load_2dmsaa && + IntrinID != Intrinsic::amdgcn_image_load_2darraymsaa) + continue; + + // Check for constant FragId. + const auto *ImageDimIntr = AMDGPU::getImageDimIntrinsicInfo(IntrinID); + const uint8_t FragIdIndex = ImageDimIntr->VAddrEnd - 1; + if (!isa(II->getArgOperand(FragIdIndex))) + continue; + + LLVM_DEBUG(dbgs() << "Merge: " << *II << "\n"); + addInstToMergeableList(II, MergeableInsts, ImageDimIntr); + } + } + + return I; +} + +bool optimizeSection(ArrayRef> MergeableInsts) { + bool Modified = false; + + SmallVector InstrsToErase; + for (const auto &IIList : MergeableInsts) { + if (IIList.size() <= 1) + continue; + + // Assume the arguments are unchanged and later override them, if needed. + SmallVector Args(IIList.front()->args()); + + // Validate function argument and return types, extracting overloaded + // types along the way. + SmallVector OverloadTys; + Function *F = IIList.front()->getCalledFunction(); + if (!Intrinsic::getIntrinsicSignature(F, OverloadTys)) + continue; + + Intrinsic::ID IntrinID = IIList.front()->getIntrinsicID(); + const AMDGPU::ImageDimIntrinsicInfo *ImageDimIntr = + AMDGPU::getImageDimIntrinsicInfo(IntrinID); + + Type *EltTy = IIList.front()->getType()->getScalarType(); + Type *NewTy = FixedVectorType::get(EltTy, 4); + OverloadTys[0] = NewTy; + bool isD16 = EltTy->isHalfTy(); + + ConstantInt *DMask = cast( + IIList.front()->getArgOperand(ImageDimIntr->DMaskIndex)); + unsigned DMaskVal = DMask->getZExtValue() & 0xf; + unsigned NumElts = popcount(DMaskVal); + + // Number of instructions and the number of vaddr/vdata dword transfers + // should be reduced. + unsigned NumLoads = IIList.size(); + unsigned NumMsaas = NumElts; + unsigned NumVAddrLoads = 3 * NumLoads; + unsigned NumVDataLoads = divideCeil(NumElts, isD16 ? 2 : 1) * NumLoads; + unsigned NumVAddrMsaas = 3 * NumMsaas; + unsigned NumVDataMsaas = divideCeil(4, isD16 ? 2 : 1) * NumMsaas; + + if (NumLoads < NumMsaas || + (NumVAddrLoads + NumVDataLoads < NumVAddrMsaas + NumVDataMsaas)) + continue; + + const uint8_t FragIdIndex = ImageDimIntr->VAddrEnd - 1; + auto FragId = cast(IIList.front()->getArgOperand(FragIdIndex)); + const APInt &NewFragIdVal = FragId->getValue().udiv(4) * 4; + + // Create the new instructions. + IRBuilder<> B(IIList.front()); + + // Create the new image_msaa_load intrinsic. + SmallVector NewCalls; + while (DMaskVal != 0) { + unsigned NewMaskVal = 1 << countr_zero(DMaskVal); + + Intrinsic::ID NewIntrinID; + if (IntrinID == Intrinsic::amdgcn_image_load_2dmsaa) + NewIntrinID = Intrinsic::amdgcn_image_msaa_load_2dmsaa; + else + NewIntrinID = Intrinsic::amdgcn_image_msaa_load_2darraymsaa; + + Function *NewIntrin = Intrinsic::getDeclaration( + IIList.front()->getModule(), NewIntrinID, OverloadTys); + Args[ImageDimIntr->DMaskIndex] = + ConstantInt::get(DMask->getType(), NewMaskVal); + Args[FragIdIndex] = ConstantInt::get(FragId->getType(), NewFragIdVal); + CallInst *NewCall = B.CreateCall(NewIntrin, Args); + LLVM_DEBUG(dbgs() << "Optimize: " << *NewCall << "\n"); + + NewCalls.push_back(NewCall); + DMaskVal -= NewMaskVal; + } + + // Create the new extractelement instructions. + for (auto &II : IIList) { + Value *VecOp = nullptr; + auto Idx = cast(II->getArgOperand(FragIdIndex)); + B.SetCurrentDebugLocation(II->getDebugLoc()); + if (NumElts == 1) { + VecOp = B.CreateExtractElement(NewCalls[0], Idx->getValue().urem(4)); + LLVM_DEBUG(dbgs() << "Add: " << *VecOp << "\n"); + } else { + VecOp = UndefValue::get(II->getType()); + for (unsigned I = 0; I < NumElts; ++I) { + VecOp = B.CreateInsertElement( + VecOp, + B.CreateExtractElement(NewCalls[I], Idx->getValue().urem(4)), I); + LLVM_DEBUG(dbgs() << "Add: " << *VecOp << "\n"); + } + } + + // Replace the old instruction. + II->replaceAllUsesWith(VecOp); + VecOp->takeName(II); + InstrsToErase.push_back(II); + } + + Modified = true; + } + + for (auto I : InstrsToErase) + I->eraseFromParent(); + + return Modified; +} + +static bool imageIntrinsicOptimizerImpl(Function &F, const TargetMachine *TM) { + if (!TM) + return false; + + // This optimization only applies to GFX11 and beyond. + const GCNSubtarget &ST = TM->getSubtarget(F); + if (!AMDGPU::isGFX11Plus(ST) || ST.hasMSAALoadDstSelBug()) + return false; + + Module *M = F.getParent(); + + // Early test to determine if the intrinsics are used. + if (std::none_of(M->begin(), M->end(), [](Function &F) { + return !F.users().empty() && + (F.getIntrinsicID() == Intrinsic::amdgcn_image_load_2dmsaa || + F.getIntrinsicID() == Intrinsic::amdgcn_image_load_2darraymsaa); + })) + return false; + + bool Modified = false; + for (auto &BB : F) { + BasicBlock::iterator SectionEnd; + for (BasicBlock::iterator I = BB.begin(), E = BB.end(); I != E; + I = SectionEnd) { + SmallVector> MergeableInsts; + + SectionEnd = collectMergeableInsts(I, E, MergeableInsts); + Modified |= optimizeSection(MergeableInsts); + } + } + + return Modified; +} + +bool AMDGPUImageIntrinsicOptimizer::runOnFunction(Function &F) { + if (skipFunction(F)) + return false; + + return imageIntrinsicOptimizerImpl(F, TM); +} + +FunctionPass * +llvm::createAMDGPUImageIntrinsicOptimizerPass(const TargetMachine *TM) { + return new AMDGPUImageIntrinsicOptimizer(TM); +} + +PreservedAnalyses +AMDGPUImageIntrinsicOptimizerPass::run(Function &F, + FunctionAnalysisManager &AM) { + + bool Changed = imageIntrinsicOptimizerImpl(F, &TM); + return Changed ? PreservedAnalyses::none() : PreservedAnalyses::all(); +} diff --git a/llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp b/llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp index 1939c1de10f0bf..aad22b2a906d9e 100644 --- a/llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp +++ b/llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp @@ -333,6 +333,11 @@ static cl::opt EnablePromoteKernelArguments( cl::desc("Enable promotion of flat kernel pointer arguments to global"), cl::Hidden, cl::init(true)); +static cl::opt EnableImageIntrinsicOptimizer( + "amdgpu-enable-image-intrinsic-optimizer", + cl::desc("Enable image intrinsic optimizer pass"), cl::init(true), + cl::Hidden); + static cl::opt EnableMaxIlpSchedStrategy( "amdgpu-enable-max-ilp-scheduling-strategy", cl::desc("Enable scheduling strategy to maximize ILP for a single wave."), @@ -412,6 +417,7 @@ extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeAMDGPUTarget() { initializeAMDGPUUnifyDivergentExitNodesPass(*PR); initializeAMDGPUAAWrapperPassPass(*PR); initializeAMDGPUExternalAAWrapperPass(*PR); + initializeAMDGPUImageIntrinsicOptimizerPass(*PR); initializeAMDGPUPrintfRuntimeBindingPass(*PR); initializeAMDGPUResourceUsageAnalysisPass(*PR); initializeGCNNSAReassignPass(*PR); @@ -628,6 +634,10 @@ void AMDGPUTargetMachine::registerPassBuilderCallbacks(PassBuilder &PB) { PM.addPass(AMDGPUSimplifyLibCallsPass()); return true; } + if (PassName == "amdgpu-image-intrinsic-opt") { + PM.addPass(AMDGPUImageIntrinsicOptimizerPass(*this)); + return true; + } if (PassName == "amdgpu-usenative") { PM.addPass(AMDGPUUseNativeCallsPass()); return true; @@ -982,6 +992,9 @@ void AMDGPUPassConfig::addIRPasses() { if (LowerCtorDtor) addPass(createAMDGPUCtorDtorLoweringLegacyPass()); + if (isPassEnabled(EnableImageIntrinsicOptimizer)) + addPass(createAMDGPUImageIntrinsicOptimizerPass(&TM)); + // Function calls are not supported, so make sure we inline everything. addPass(createAMDGPUAlwaysInlinePass()); addPass(createAlwaysInlinerLegacyPass()); diff --git a/llvm/lib/Target/AMDGPU/CMakeLists.txt b/llvm/lib/Target/AMDGPU/CMakeLists.txt index 69ff83e555cb05..6d3775c7399e01 100644 --- a/llvm/lib/Target/AMDGPU/CMakeLists.txt +++ b/llvm/lib/Target/AMDGPU/CMakeLists.txt @@ -67,6 +67,7 @@ add_llvm_target(AMDGPUCodeGen AMDGPULateCodeGenPrepare.cpp AMDGPULegalizerInfo.cpp AMDGPULibCalls.cpp + AMDGPUImageIntrinsicOptimizer.cpp AMDGPULibFunc.cpp AMDGPULowerKernelArguments.cpp AMDGPULowerKernelAttributes.cpp diff --git a/llvm/lib/Target/AMDGPU/GCNSubtarget.h b/llvm/lib/Target/AMDGPU/GCNSubtarget.h index dcf09e1eaff79f..cc8f53b2f157da 100644 --- a/llvm/lib/Target/AMDGPU/GCNSubtarget.h +++ b/llvm/lib/Target/AMDGPU/GCNSubtarget.h @@ -206,6 +206,7 @@ class GCNSubtarget final : public AMDGPUGenSubtargetInfo, bool HasFlatSegmentOffsetBug = false; bool HasImageStoreD16Bug = false; bool HasImageGather4D16Bug = false; + bool HasMSAALoadDstSelBug = false; bool HasGFX11FullVGPRs = false; bool HasMADIntraFwdBug = false; bool HasVOPDInsts = false; @@ -956,6 +957,8 @@ class GCNSubtarget final : public AMDGPUGenSubtargetInfo, bool hasMADIntraFwdBug() const { return HasMADIntraFwdBug; } + bool hasMSAALoadDstSelBug() const { return HasMSAALoadDstSelBug; } + bool hasNSAEncoding() const { return HasNSAEncoding; } bool hasPartialNSAEncoding() const { return HasPartialNSAEncoding; } diff --git a/llvm/lib/Target/AMDGPU/Utils/AMDGPUBaseInfo.cpp b/llvm/lib/Target/AMDGPU/Utils/AMDGPUBaseInfo.cpp index dc7656af48a41b..da664c93d18896 100644 --- a/llvm/lib/Target/AMDGPU/Utils/AMDGPUBaseInfo.cpp +++ b/llvm/lib/Target/AMDGPU/Utils/AMDGPUBaseInfo.cpp @@ -2237,16 +2237,13 @@ bool isSISrcFPOperand(const MCInstrDesc &Desc, unsigned OpNo) { case AMDGPU::OPERAND_REG_IMM_FP16: case AMDGPU::OPERAND_REG_IMM_FP16_DEFERRED: case AMDGPU::OPERAND_REG_IMM_V2FP16: - case AMDGPU::OPERAND_REG_IMM_V2INT16: case AMDGPU::OPERAND_REG_INLINE_C_FP32: case AMDGPU::OPERAND_REG_INLINE_C_FP64: case AMDGPU::OPERAND_REG_INLINE_C_FP16: case AMDGPU::OPERAND_REG_INLINE_C_V2FP16: - case AMDGPU::OPERAND_REG_INLINE_C_V2INT16: case AMDGPU::OPERAND_REG_INLINE_AC_FP32: case AMDGPU::OPERAND_REG_INLINE_AC_FP16: case AMDGPU::OPERAND_REG_INLINE_AC_V2FP16: - case AMDGPU::OPERAND_REG_INLINE_AC_V2INT16: case AMDGPU::OPERAND_REG_IMM_V2FP32: case AMDGPU::OPERAND_REG_INLINE_C_V2FP32: case AMDGPU::OPERAND_REG_INLINE_AC_FP64: diff --git a/llvm/test/CodeGen/AMDGPU/llc-pipeline.ll b/llvm/test/CodeGen/AMDGPU/llc-pipeline.ll index 888b99a6f87321..ff5a9a1f2de306 100644 --- a/llvm/test/CodeGen/AMDGPU/llc-pipeline.ll +++ b/llvm/test/CodeGen/AMDGPU/llc-pipeline.ll @@ -756,6 +756,8 @@ ; GCN-O2-NEXT: AMDGPU Remove Incompatible Functions ; GCN-O2-NEXT: AMDGPU Printf lowering ; GCN-O2-NEXT: Lower ctors and dtors for AMDGPU +; GCN-O2-NEXT: FunctionPass Manager +; GCN-O2-NEXT: AMDGPU Image Intrinsic Optimizer ; GCN-O2-NEXT: AMDGPU Inline All Functions ; GCN-O2-NEXT: Inliner for always_inline functions ; GCN-O2-NEXT: FunctionPass Manager @@ -1067,6 +1069,8 @@ ; GCN-O3-NEXT: AMDGPU Remove Incompatible Functions ; GCN-O3-NEXT: AMDGPU Printf lowering ; GCN-O3-NEXT: Lower ctors and dtors for AMDGPU +; GCN-O3-NEXT: FunctionPass Manager +; GCN-O3-NEXT: AMDGPU Image Intrinsic Optimizer ; GCN-O3-NEXT: AMDGPU Inline All Functions ; GCN-O3-NEXT: Inliner for always_inline functions ; GCN-O3-NEXT: FunctionPass Manager diff --git a/llvm/test/CodeGen/AMDGPU/llvm.amdgcn.image.load.2dmsaa.ll b/llvm/test/CodeGen/AMDGPU/llvm.amdgcn.image.load.2dmsaa.ll new file mode 100644 index 00000000000000..853ca53767be8c --- /dev/null +++ b/llvm/test/CodeGen/AMDGPU/llvm.amdgcn.image.load.2dmsaa.ll @@ -0,0 +1,1199 @@ +; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 3 +; RUN: opt -S -passes=amdgpu-image-intrinsic-opt -mtriple=amdgcn-unknown-amdhsa -mcpu=gfx1010 < %s | FileCheck -check-prefixes=NO-MSAA %s +; RUN: opt -S -passes=amdgpu-image-intrinsic-opt -mtriple=amdgcn-unknown-amdhsa -mcpu=gfx1100 < %s | FileCheck -check-prefixes=NO-MSAA %s +; RUN: opt -S -passes=amdgpu-image-intrinsic-opt -mtriple=amdgcn-unknown-amdhsa -mcpu=gfx1150 < %s | FileCheck -check-prefixes=MSAA %s + +define amdgpu_ps [4 x float] @load_2dmsaa_v4f32_dmask1(<8 x i32> inreg %rsrc, i32 %s, i32 %t) { +; NO-MSAA-LABEL: define amdgpu_ps [4 x float] @load_2dmsaa_v4f32_dmask1( +; NO-MSAA-SAME: <8 x i32> inreg [[RSRC:%.*]], i32 [[S:%.*]], i32 [[T:%.*]]) #[[ATTR0:[0-9]+]] { +; NO-MSAA-NEXT: main_body: +; NO-MSAA-NEXT: [[I:%.*]] = call float @llvm.amdgcn.image.load.2dmsaa.f32.i32(i32 1, i32 [[S]], i32 [[T]], i32 0, <8 x i32> [[RSRC]], i32 0, i32 0) +; NO-MSAA-NEXT: [[I1:%.*]] = call float @llvm.amdgcn.image.load.2dmsaa.f32.i32(i32 1, i32 [[S]], i32 [[T]], i32 1, <8 x i32> [[RSRC]], i32 0, i32 0) +; NO-MSAA-NEXT: [[I2:%.*]] = call float @llvm.amdgcn.image.load.2dmsaa.f32.i32(i32 1, i32 [[S]], i32 [[T]], i32 2, <8 x i32> [[RSRC]], i32 0, i32 0) +; NO-MSAA-NEXT: [[I3:%.*]] = call float @llvm.amdgcn.image.load.2dmsaa.f32.i32(i32 1, i32 [[S]], i32 [[T]], i32 3, <8 x i32> [[RSRC]], i32 0, i32 0) +; NO-MSAA-NEXT: [[I4:%.*]] = insertvalue [4 x float] undef, float [[I]], 0 +; NO-MSAA-NEXT: [[I5:%.*]] = insertvalue [4 x float] [[I4]], float [[I1]], 1 +; NO-MSAA-NEXT: [[I6:%.*]] = insertvalue [4 x float] [[I5]], float [[I2]], 2 +; NO-MSAA-NEXT: [[I7:%.*]] = insertvalue [4 x float] [[I6]], float [[I3]], 3 +; NO-MSAA-NEXT: ret [4 x float] [[I7]] +; +; MSAA-LABEL: define amdgpu_ps [4 x float] @load_2dmsaa_v4f32_dmask1( +; MSAA-SAME: <8 x i32> inreg [[RSRC:%.*]], i32 [[S:%.*]], i32 [[T:%.*]]) #[[ATTR0:[0-9]+]] { +; MSAA-NEXT: main_body: +; MSAA-NEXT: [[TMP0:%.*]] = call <4 x float> @llvm.amdgcn.image.msaa.load.2dmsaa.v4f32.i32(i32 1, i32 [[S]], i32 [[T]], i32 0, <8 x i32> [[RSRC]], i32 0, i32 0) +; MSAA-NEXT: [[I:%.*]] = extractelement <4 x float> [[TMP0]], i64 0 +; MSAA-NEXT: [[I1:%.*]] = extractelement <4 x float> [[TMP0]], i64 1 +; MSAA-NEXT: [[I2:%.*]] = extractelement <4 x float> [[TMP0]], i64 2 +; MSAA-NEXT: [[I3:%.*]] = extractelement <4 x float> [[TMP0]], i64 3 +; MSAA-NEXT: [[I4:%.*]] = insertvalue [4 x float] undef, float [[I]], 0 +; MSAA-NEXT: [[I5:%.*]] = insertvalue [4 x float] [[I4]], float [[I1]], 1 +; MSAA-NEXT: [[I6:%.*]] = insertvalue [4 x float] [[I5]], float [[I2]], 2 +; MSAA-NEXT: [[I7:%.*]] = insertvalue [4 x float] [[I6]], float [[I3]], 3 +; MSAA-NEXT: ret [4 x float] [[I7]] +; +main_body: + %i = call float @llvm.amdgcn.image.load.2dmsaa.f32.i32(i32 1, i32 %s, i32 %t, i32 0, <8 x i32> %rsrc, i32 0, i32 0) + %i1 = call float @llvm.amdgcn.image.load.2dmsaa.f32.i32(i32 1, i32 %s, i32 %t, i32 1, <8 x i32> %rsrc, i32 0, i32 0) + %i2 = call float @llvm.amdgcn.image.load.2dmsaa.f32.i32(i32 1, i32 %s, i32 %t, i32 2, <8 x i32> %rsrc, i32 0, i32 0) + %i3 = call float @llvm.amdgcn.image.load.2dmsaa.f32.i32(i32 1, i32 %s, i32 %t, i32 3, <8 x i32> %rsrc, i32 0, i32 0) + %i4 = insertvalue [4 x float] undef, float %i, 0 + %i5 = insertvalue [4 x float] %i4, float %i1, 1 + %i6 = insertvalue [4 x float] %i5, float %i2, 2 + %i7 = insertvalue [4 x float] %i6, float %i3, 3 + ret [4 x float] %i7 +} + +define amdgpu_ps [4 x float] @load_2dmsaa_v4f32_dmask2(<8 x i32> inreg %rsrc, i32 %s, i32 %t) { +; NO-MSAA-LABEL: define amdgpu_ps [4 x float] @load_2dmsaa_v4f32_dmask2( +; NO-MSAA-SAME: <8 x i32> inreg [[RSRC:%.*]], i32 [[S:%.*]], i32 [[T:%.*]]) #[[ATTR0]] { +; NO-MSAA-NEXT: main_body: +; NO-MSAA-NEXT: [[I:%.*]] = call float @llvm.amdgcn.image.load.2dmsaa.f32.i32(i32 2, i32 [[S]], i32 [[T]], i32 0, <8 x i32> [[RSRC]], i32 0, i32 0) +; NO-MSAA-NEXT: [[I1:%.*]] = call float @llvm.amdgcn.image.load.2dmsaa.f32.i32(i32 2, i32 [[S]], i32 [[T]], i32 1, <8 x i32> [[RSRC]], i32 0, i32 0) +; NO-MSAA-NEXT: [[I2:%.*]] = call float @llvm.amdgcn.image.load.2dmsaa.f32.i32(i32 2, i32 [[S]], i32 [[T]], i32 2, <8 x i32> [[RSRC]], i32 0, i32 0) +; NO-MSAA-NEXT: [[I3:%.*]] = call float @llvm.amdgcn.image.load.2dmsaa.f32.i32(i32 2, i32 [[S]], i32 [[T]], i32 3, <8 x i32> [[RSRC]], i32 0, i32 0) +; NO-MSAA-NEXT: [[I4:%.*]] = insertvalue [4 x float] undef, float [[I]], 0 +; NO-MSAA-NEXT: [[I5:%.*]] = insertvalue [4 x float] [[I4]], float [[I1]], 1 +; NO-MSAA-NEXT: [[I6:%.*]] = insertvalue [4 x float] [[I5]], float [[I2]], 2 +; NO-MSAA-NEXT: [[I7:%.*]] = insertvalue [4 x float] [[I6]], float [[I3]], 3 +; NO-MSAA-NEXT: ret [4 x float] [[I7]] +; +; MSAA-LABEL: define amdgpu_ps [4 x float] @load_2dmsaa_v4f32_dmask2( +; MSAA-SAME: <8 x i32> inreg [[RSRC:%.*]], i32 [[S:%.*]], i32 [[T:%.*]]) #[[ATTR0]] { +; MSAA-NEXT: main_body: +; MSAA-NEXT: [[TMP0:%.*]] = call <4 x float> @llvm.amdgcn.image.msaa.load.2dmsaa.v4f32.i32(i32 2, i32 [[S]], i32 [[T]], i32 0, <8 x i32> [[RSRC]], i32 0, i32 0) +; MSAA-NEXT: [[I:%.*]] = extractelement <4 x float> [[TMP0]], i64 0 +; MSAA-NEXT: [[I1:%.*]] = extractelement <4 x float> [[TMP0]], i64 1 +; MSAA-NEXT: [[I2:%.*]] = extractelement <4 x float> [[TMP0]], i64 2 +; MSAA-NEXT: [[I3:%.*]] = extractelement <4 x float> [[TMP0]], i64 3 +; MSAA-NEXT: [[I4:%.*]] = insertvalue [4 x float] undef, float [[I]], 0 +; MSAA-NEXT: [[I5:%.*]] = insertvalue [4 x float] [[I4]], float [[I1]], 1 +; MSAA-NEXT: [[I6:%.*]] = insertvalue [4 x float] [[I5]], float [[I2]], 2 +; MSAA-NEXT: [[I7:%.*]] = insertvalue [4 x float] [[I6]], float [[I3]], 3 +; MSAA-NEXT: ret [4 x float] [[I7]] +; +main_body: + %i = call float @llvm.amdgcn.image.load.2dmsaa.f32.i32(i32 2, i32 %s, i32 %t, i32 0, <8 x i32> %rsrc, i32 0, i32 0) + %i1 = call float @llvm.amdgcn.image.load.2dmsaa.f32.i32(i32 2, i32 %s, i32 %t, i32 1, <8 x i32> %rsrc, i32 0, i32 0) + %i2 = call float @llvm.amdgcn.image.load.2dmsaa.f32.i32(i32 2, i32 %s, i32 %t, i32 2, <8 x i32> %rsrc, i32 0, i32 0) + %i3 = call float @llvm.amdgcn.image.load.2dmsaa.f32.i32(i32 2, i32 %s, i32 %t, i32 3, <8 x i32> %rsrc, i32 0, i32 0) + %i4 = insertvalue [4 x float] undef, float %i, 0 + %i5 = insertvalue [4 x float] %i4, float %i1, 1 + %i6 = insertvalue [4 x float] %i5, float %i2, 2 + %i7 = insertvalue [4 x float] %i6, float %i3, 3 + ret [4 x float] %i7 +} + +define amdgpu_ps [4 x float] @load_2dmsaa_v4f32_dmask4(<8 x i32> inreg %rsrc, i32 %s, i32 %t) { +; NO-MSAA-LABEL: define amdgpu_ps [4 x float] @load_2dmsaa_v4f32_dmask4( +; NO-MSAA-SAME: <8 x i32> inreg [[RSRC:%.*]], i32 [[S:%.*]], i32 [[T:%.*]]) #[[ATTR0]] { +; NO-MSAA-NEXT: main_body: +; NO-MSAA-NEXT: [[I:%.*]] = call float @llvm.amdgcn.image.load.2dmsaa.f32.i32(i32 4, i32 [[S]], i32 [[T]], i32 0, <8 x i32> [[RSRC]], i32 0, i32 0) +; NO-MSAA-NEXT: [[I1:%.*]] = call float @llvm.amdgcn.image.load.2dmsaa.f32.i32(i32 4, i32 [[S]], i32 [[T]], i32 1, <8 x i32> [[RSRC]], i32 0, i32 0) +; NO-MSAA-NEXT: [[I2:%.*]] = call float @llvm.amdgcn.image.load.2dmsaa.f32.i32(i32 4, i32 [[S]], i32 [[T]], i32 2, <8 x i32> [[RSRC]], i32 0, i32 0) +; NO-MSAA-NEXT: [[I3:%.*]] = call float @llvm.amdgcn.image.load.2dmsaa.f32.i32(i32 4, i32 [[S]], i32 [[T]], i32 3, <8 x i32> [[RSRC]], i32 0, i32 0) +; NO-MSAA-NEXT: [[I4:%.*]] = insertvalue [4 x float] undef, float [[I]], 0 +; NO-MSAA-NEXT: [[I5:%.*]] = insertvalue [4 x float] [[I4]], float [[I1]], 1 +; NO-MSAA-NEXT: [[I6:%.*]] = insertvalue [4 x float] [[I5]], float [[I2]], 2 +; NO-MSAA-NEXT: [[I7:%.*]] = insertvalue [4 x float] [[I6]], float [[I3]], 3 +; NO-MSAA-NEXT: ret [4 x float] [[I7]] +; +; MSAA-LABEL: define amdgpu_ps [4 x float] @load_2dmsaa_v4f32_dmask4( +; MSAA-SAME: <8 x i32> inreg [[RSRC:%.*]], i32 [[S:%.*]], i32 [[T:%.*]]) #[[ATTR0]] { +; MSAA-NEXT: main_body: +; MSAA-NEXT: [[TMP0:%.*]] = call <4 x float> @llvm.amdgcn.image.msaa.load.2dmsaa.v4f32.i32(i32 4, i32 [[S]], i32 [[T]], i32 0, <8 x i32> [[RSRC]], i32 0, i32 0) +; MSAA-NEXT: [[I:%.*]] = extractelement <4 x float> [[TMP0]], i64 0 +; MSAA-NEXT: [[I1:%.*]] = extractelement <4 x float> [[TMP0]], i64 1 +; MSAA-NEXT: [[I2:%.*]] = extractelement <4 x float> [[TMP0]], i64 2 +; MSAA-NEXT: [[I3:%.*]] = extractelement <4 x float> [[TMP0]], i64 3 +; MSAA-NEXT: [[I4:%.*]] = insertvalue [4 x float] undef, float [[I]], 0 +; MSAA-NEXT: [[I5:%.*]] = insertvalue [4 x float] [[I4]], float [[I1]], 1 +; MSAA-NEXT: [[I6:%.*]] = insertvalue [4 x float] [[I5]], float [[I2]], 2 +; MSAA-NEXT: [[I7:%.*]] = insertvalue [4 x float] [[I6]], float [[I3]], 3 +; MSAA-NEXT: ret [4 x float] [[I7]] +; +main_body: + %i = call float @llvm.amdgcn.image.load.2dmsaa.f32.i32(i32 4, i32 %s, i32 %t, i32 0, <8 x i32> %rsrc, i32 0, i32 0) + %i1 = call float @llvm.amdgcn.image.load.2dmsaa.f32.i32(i32 4, i32 %s, i32 %t, i32 1, <8 x i32> %rsrc, i32 0, i32 0) + %i2 = call float @llvm.amdgcn.image.load.2dmsaa.f32.i32(i32 4, i32 %s, i32 %t, i32 2, <8 x i32> %rsrc, i32 0, i32 0) + %i3 = call float @llvm.amdgcn.image.load.2dmsaa.f32.i32(i32 4, i32 %s, i32 %t, i32 3, <8 x i32> %rsrc, i32 0, i32 0) + %i4 = insertvalue [4 x float] undef, float %i, 0 + %i5 = insertvalue [4 x float] %i4, float %i1, 1 + %i6 = insertvalue [4 x float] %i5, float %i2, 2 + %i7 = insertvalue [4 x float] %i6, float %i3, 3 + ret [4 x float] %i7 +} + +define amdgpu_ps [4 x float] @load_2dmsaa_v4f32_dmask8(<8 x i32> inreg %rsrc, i32 %s, i32 %t) { +; NO-MSAA-LABEL: define amdgpu_ps [4 x float] @load_2dmsaa_v4f32_dmask8( +; NO-MSAA-SAME: <8 x i32> inreg [[RSRC:%.*]], i32 [[S:%.*]], i32 [[T:%.*]]) #[[ATTR0]] { +; NO-MSAA-NEXT: main_body: +; NO-MSAA-NEXT: [[I:%.*]] = call float @llvm.amdgcn.image.load.2dmsaa.f32.i32(i32 8, i32 [[S]], i32 [[T]], i32 0, <8 x i32> [[RSRC]], i32 0, i32 0) +; NO-MSAA-NEXT: [[I1:%.*]] = call float @llvm.amdgcn.image.load.2dmsaa.f32.i32(i32 8, i32 [[S]], i32 [[T]], i32 1, <8 x i32> [[RSRC]], i32 0, i32 0) +; NO-MSAA-NEXT: [[I2:%.*]] = call float @llvm.amdgcn.image.load.2dmsaa.f32.i32(i32 8, i32 [[S]], i32 [[T]], i32 2, <8 x i32> [[RSRC]], i32 0, i32 0) +; NO-MSAA-NEXT: [[I3:%.*]] = call float @llvm.amdgcn.image.load.2dmsaa.f32.i32(i32 8, i32 [[S]], i32 [[T]], i32 3, <8 x i32> [[RSRC]], i32 0, i32 0) +; NO-MSAA-NEXT: [[I4:%.*]] = insertvalue [4 x float] undef, float [[I]], 0 +; NO-MSAA-NEXT: [[I5:%.*]] = insertvalue [4 x float] [[I4]], float [[I1]], 1 +; NO-MSAA-NEXT: [[I6:%.*]] = insertvalue [4 x float] [[I5]], float [[I2]], 2 +; NO-MSAA-NEXT: [[I7:%.*]] = insertvalue [4 x float] [[I6]], float [[I3]], 3 +; NO-MSAA-NEXT: ret [4 x float] [[I7]] +; +; MSAA-LABEL: define amdgpu_ps [4 x float] @load_2dmsaa_v4f32_dmask8( +; MSAA-SAME: <8 x i32> inreg [[RSRC:%.*]], i32 [[S:%.*]], i32 [[T:%.*]]) #[[ATTR0]] { +; MSAA-NEXT: main_body: +; MSAA-NEXT: [[TMP0:%.*]] = call <4 x float> @llvm.amdgcn.image.msaa.load.2dmsaa.v4f32.i32(i32 8, i32 [[S]], i32 [[T]], i32 0, <8 x i32> [[RSRC]], i32 0, i32 0) +; MSAA-NEXT: [[I:%.*]] = extractelement <4 x float> [[TMP0]], i64 0 +; MSAA-NEXT: [[I1:%.*]] = extractelement <4 x float> [[TMP0]], i64 1 +; MSAA-NEXT: [[I2:%.*]] = extractelement <4 x float> [[TMP0]], i64 2 +; MSAA-NEXT: [[I3:%.*]] = extractelement <4 x float> [[TMP0]], i64 3 +; MSAA-NEXT: [[I4:%.*]] = insertvalue [4 x float] undef, float [[I]], 0 +; MSAA-NEXT: [[I5:%.*]] = insertvalue [4 x float] [[I4]], float [[I1]], 1 +; MSAA-NEXT: [[I6:%.*]] = insertvalue [4 x float] [[I5]], float [[I2]], 2 +; MSAA-NEXT: [[I7:%.*]] = insertvalue [4 x float] [[I6]], float [[I3]], 3 +; MSAA-NEXT: ret [4 x float] [[I7]] +; +main_body: + %i = call float @llvm.amdgcn.image.load.2dmsaa.f32.i32(i32 8, i32 %s, i32 %t, i32 0, <8 x i32> %rsrc, i32 0, i32 0) + %i1 = call float @llvm.amdgcn.image.load.2dmsaa.f32.i32(i32 8, i32 %s, i32 %t, i32 1, <8 x i32> %rsrc, i32 0, i32 0) + %i2 = call float @llvm.amdgcn.image.load.2dmsaa.f32.i32(i32 8, i32 %s, i32 %t, i32 2, <8 x i32> %rsrc, i32 0, i32 0) + %i3 = call float @llvm.amdgcn.image.load.2dmsaa.f32.i32(i32 8, i32 %s, i32 %t, i32 3, <8 x i32> %rsrc, i32 0, i32 0) + %i4 = insertvalue [4 x float] undef, float %i, 0 + %i5 = insertvalue [4 x float] %i4, float %i1, 1 + %i6 = insertvalue [4 x float] %i5, float %i2, 2 + %i7 = insertvalue [4 x float] %i6, float %i3, 3 + ret [4 x float] %i7 +} + +define amdgpu_ps [4 x float] @load_2dmsaa_v4f32_reverse(<8 x i32> inreg %rsrc, i32 %s, i32 %t) { +; NO-MSAA-LABEL: define amdgpu_ps [4 x float] @load_2dmsaa_v4f32_reverse( +; NO-MSAA-SAME: <8 x i32> inreg [[RSRC:%.*]], i32 [[S:%.*]], i32 [[T:%.*]]) #[[ATTR0]] { +; NO-MSAA-NEXT: main_body: +; NO-MSAA-NEXT: [[I:%.*]] = call float @llvm.amdgcn.image.load.2dmsaa.f32.i32(i32 1, i32 [[S]], i32 [[T]], i32 3, <8 x i32> [[RSRC]], i32 0, i32 0) +; NO-MSAA-NEXT: [[I1:%.*]] = call float @llvm.amdgcn.image.load.2dmsaa.f32.i32(i32 1, i32 [[S]], i32 [[T]], i32 2, <8 x i32> [[RSRC]], i32 0, i32 0) +; NO-MSAA-NEXT: [[I2:%.*]] = call float @llvm.amdgcn.image.load.2dmsaa.f32.i32(i32 1, i32 [[S]], i32 [[T]], i32 1, <8 x i32> [[RSRC]], i32 0, i32 0) +; NO-MSAA-NEXT: [[I3:%.*]] = call float @llvm.amdgcn.image.load.2dmsaa.f32.i32(i32 1, i32 [[S]], i32 [[T]], i32 0, <8 x i32> [[RSRC]], i32 0, i32 0) +; NO-MSAA-NEXT: [[I4:%.*]] = insertvalue [4 x float] undef, float [[I]], 0 +; NO-MSAA-NEXT: [[I5:%.*]] = insertvalue [4 x float] [[I4]], float [[I1]], 1 +; NO-MSAA-NEXT: [[I6:%.*]] = insertvalue [4 x float] [[I5]], float [[I2]], 2 +; NO-MSAA-NEXT: [[I7:%.*]] = insertvalue [4 x float] [[I6]], float [[I3]], 3 +; NO-MSAA-NEXT: ret [4 x float] [[I7]] +; +; MSAA-LABEL: define amdgpu_ps [4 x float] @load_2dmsaa_v4f32_reverse( +; MSAA-SAME: <8 x i32> inreg [[RSRC:%.*]], i32 [[S:%.*]], i32 [[T:%.*]]) #[[ATTR0]] { +; MSAA-NEXT: main_body: +; MSAA-NEXT: [[TMP0:%.*]] = call <4 x float> @llvm.amdgcn.image.msaa.load.2dmsaa.v4f32.i32(i32 1, i32 [[S]], i32 [[T]], i32 0, <8 x i32> [[RSRC]], i32 0, i32 0) +; MSAA-NEXT: [[I:%.*]] = extractelement <4 x float> [[TMP0]], i64 3 +; MSAA-NEXT: [[I1:%.*]] = extractelement <4 x float> [[TMP0]], i64 2 +; MSAA-NEXT: [[I2:%.*]] = extractelement <4 x float> [[TMP0]], i64 1 +; MSAA-NEXT: [[I3:%.*]] = extractelement <4 x float> [[TMP0]], i64 0 +; MSAA-NEXT: [[I4:%.*]] = insertvalue [4 x float] undef, float [[I]], 0 +; MSAA-NEXT: [[I5:%.*]] = insertvalue [4 x float] [[I4]], float [[I1]], 1 +; MSAA-NEXT: [[I6:%.*]] = insertvalue [4 x float] [[I5]], float [[I2]], 2 +; MSAA-NEXT: [[I7:%.*]] = insertvalue [4 x float] [[I6]], float [[I3]], 3 +; MSAA-NEXT: ret [4 x float] [[I7]] +; +main_body: + %i = call float @llvm.amdgcn.image.load.2dmsaa.f32.i32(i32 1, i32 %s, i32 %t, i32 3, <8 x i32> %rsrc, i32 0, i32 0) + %i1 = call float @llvm.amdgcn.image.load.2dmsaa.f32.i32(i32 1, i32 %s, i32 %t, i32 2, <8 x i32> %rsrc, i32 0, i32 0) + %i2 = call float @llvm.amdgcn.image.load.2dmsaa.f32.i32(i32 1, i32 %s, i32 %t, i32 1, <8 x i32> %rsrc, i32 0, i32 0) + %i3 = call float @llvm.amdgcn.image.load.2dmsaa.f32.i32(i32 1, i32 %s, i32 %t, i32 0, <8 x i32> %rsrc, i32 0, i32 0) + %i4 = insertvalue [4 x float] undef, float %i, 0 + %i5 = insertvalue [4 x float] %i4, float %i1, 1 + %i6 = insertvalue [4 x float] %i5, float %i2, 2 + %i7 = insertvalue [4 x float] %i6, float %i3, 3 + ret [4 x float] %i7 +} + +; Don't combine because the vaddr inputs are not identical. +define amdgpu_ps [4 x float] @load_2dmsaa_v4f32_vaddr(<8 x i32> inreg %rsrc, i32 %s0, i32 %t0, i32 %s1, i32 %t1, i32 %s2, i32 %t2, i32 %s3, i32 %t3) { +; NO-MSAA-LABEL: define amdgpu_ps [4 x float] @load_2dmsaa_v4f32_vaddr( +; NO-MSAA-SAME: <8 x i32> inreg [[RSRC:%.*]], i32 [[S0:%.*]], i32 [[T0:%.*]], i32 [[S1:%.*]], i32 [[T1:%.*]], i32 [[S2:%.*]], i32 [[T2:%.*]], i32 [[S3:%.*]], i32 [[T3:%.*]]) #[[ATTR0]] { +; NO-MSAA-NEXT: main_body: +; NO-MSAA-NEXT: [[I:%.*]] = call float @llvm.amdgcn.image.load.2dmsaa.f32.i32(i32 1, i32 [[S0]], i32 [[T0]], i32 0, <8 x i32> [[RSRC]], i32 0, i32 0) +; NO-MSAA-NEXT: [[I1:%.*]] = call float @llvm.amdgcn.image.load.2dmsaa.f32.i32(i32 1, i32 [[S1]], i32 [[T1]], i32 1, <8 x i32> [[RSRC]], i32 0, i32 0) +; NO-MSAA-NEXT: [[I2:%.*]] = call float @llvm.amdgcn.image.load.2dmsaa.f32.i32(i32 1, i32 [[S2]], i32 [[T2]], i32 2, <8 x i32> [[RSRC]], i32 0, i32 0) +; NO-MSAA-NEXT: [[I3:%.*]] = call float @llvm.amdgcn.image.load.2dmsaa.f32.i32(i32 1, i32 [[S3]], i32 [[T3]], i32 3, <8 x i32> [[RSRC]], i32 0, i32 0) +; NO-MSAA-NEXT: [[I4:%.*]] = insertvalue [4 x float] undef, float [[I]], 0 +; NO-MSAA-NEXT: [[I5:%.*]] = insertvalue [4 x float] [[I4]], float [[I1]], 1 +; NO-MSAA-NEXT: [[I6:%.*]] = insertvalue [4 x float] [[I5]], float [[I2]], 2 +; NO-MSAA-NEXT: [[I7:%.*]] = insertvalue [4 x float] [[I6]], float [[I3]], 3 +; NO-MSAA-NEXT: ret [4 x float] [[I7]] +; +; MSAA-LABEL: define amdgpu_ps [4 x float] @load_2dmsaa_v4f32_vaddr( +; MSAA-SAME: <8 x i32> inreg [[RSRC:%.*]], i32 [[S0:%.*]], i32 [[T0:%.*]], i32 [[S1:%.*]], i32 [[T1:%.*]], i32 [[S2:%.*]], i32 [[T2:%.*]], i32 [[S3:%.*]], i32 [[T3:%.*]]) #[[ATTR0]] { +; MSAA-NEXT: main_body: +; MSAA-NEXT: [[I:%.*]] = call float @llvm.amdgcn.image.load.2dmsaa.f32.i32(i32 1, i32 [[S0]], i32 [[T0]], i32 0, <8 x i32> [[RSRC]], i32 0, i32 0) +; MSAA-NEXT: [[I1:%.*]] = call float @llvm.amdgcn.image.load.2dmsaa.f32.i32(i32 1, i32 [[S1]], i32 [[T1]], i32 1, <8 x i32> [[RSRC]], i32 0, i32 0) +; MSAA-NEXT: [[I2:%.*]] = call float @llvm.amdgcn.image.load.2dmsaa.f32.i32(i32 1, i32 [[S2]], i32 [[T2]], i32 2, <8 x i32> [[RSRC]], i32 0, i32 0) +; MSAA-NEXT: [[I3:%.*]] = call float @llvm.amdgcn.image.load.2dmsaa.f32.i32(i32 1, i32 [[S3]], i32 [[T3]], i32 3, <8 x i32> [[RSRC]], i32 0, i32 0) +; MSAA-NEXT: [[I4:%.*]] = insertvalue [4 x float] undef, float [[I]], 0 +; MSAA-NEXT: [[I5:%.*]] = insertvalue [4 x float] [[I4]], float [[I1]], 1 +; MSAA-NEXT: [[I6:%.*]] = insertvalue [4 x float] [[I5]], float [[I2]], 2 +; MSAA-NEXT: [[I7:%.*]] = insertvalue [4 x float] [[I6]], float [[I3]], 3 +; MSAA-NEXT: ret [4 x float] [[I7]] +; +main_body: + %i = call float @llvm.amdgcn.image.load.2dmsaa.f32.i32(i32 1, i32 %s0, i32 %t0, i32 0, <8 x i32> %rsrc, i32 0, i32 0) + %i1 = call float @llvm.amdgcn.image.load.2dmsaa.f32.i32(i32 1, i32 %s1, i32 %t1, i32 1, <8 x i32> %rsrc, i32 0, i32 0) + %i2 = call float @llvm.amdgcn.image.load.2dmsaa.f32.i32(i32 1, i32 %s2, i32 %t2, i32 2, <8 x i32> %rsrc, i32 0, i32 0) + %i3 = call float @llvm.amdgcn.image.load.2dmsaa.f32.i32(i32 1, i32 %s3, i32 %t3, i32 3, <8 x i32> %rsrc, i32 0, i32 0) + %i4 = insertvalue [4 x float] undef, float %i, 0 + %i5 = insertvalue [4 x float] %i4, float %i1, 1 + %i6 = insertvalue [4 x float] %i5, float %i2, 2 + %i7 = insertvalue [4 x float] %i6, float %i3, 3 + ret [4 x float] %i7 +} + +define amdgpu_ps [8 x float] @load_2dmsaa_v8f32(<8 x i32> inreg %rsrc, i32 %s, i32 %t) { +; NO-MSAA-LABEL: define amdgpu_ps [8 x float] @load_2dmsaa_v8f32( +; NO-MSAA-SAME: <8 x i32> inreg [[RSRC:%.*]], i32 [[S:%.*]], i32 [[T:%.*]]) #[[ATTR0]] { +; NO-MSAA-NEXT: main_body: +; NO-MSAA-NEXT: [[I:%.*]] = call float @llvm.amdgcn.image.load.2dmsaa.f32.i32(i32 1, i32 [[S]], i32 [[T]], i32 0, <8 x i32> [[RSRC]], i32 0, i32 0) +; NO-MSAA-NEXT: [[I1:%.*]] = call float @llvm.amdgcn.image.load.2dmsaa.f32.i32(i32 1, i32 [[S]], i32 [[T]], i32 1, <8 x i32> [[RSRC]], i32 0, i32 0) +; NO-MSAA-NEXT: [[I2:%.*]] = call float @llvm.amdgcn.image.load.2dmsaa.f32.i32(i32 1, i32 [[S]], i32 [[T]], i32 2, <8 x i32> [[RSRC]], i32 0, i32 0) +; NO-MSAA-NEXT: [[I3:%.*]] = call float @llvm.amdgcn.image.load.2dmsaa.f32.i32(i32 1, i32 [[S]], i32 [[T]], i32 3, <8 x i32> [[RSRC]], i32 0, i32 0) +; NO-MSAA-NEXT: [[I4:%.*]] = call float @llvm.amdgcn.image.load.2dmsaa.f32.i32(i32 1, i32 [[S]], i32 [[T]], i32 0, <8 x i32> [[RSRC]], i32 0, i32 0) +; NO-MSAA-NEXT: [[I5:%.*]] = call float @llvm.amdgcn.image.load.2dmsaa.f32.i32(i32 1, i32 [[S]], i32 [[T]], i32 1, <8 x i32> [[RSRC]], i32 0, i32 0) +; NO-MSAA-NEXT: [[I6:%.*]] = call float @llvm.amdgcn.image.load.2dmsaa.f32.i32(i32 1, i32 [[S]], i32 [[T]], i32 2, <8 x i32> [[RSRC]], i32 0, i32 0) +; NO-MSAA-NEXT: [[I7:%.*]] = call float @llvm.amdgcn.image.load.2dmsaa.f32.i32(i32 1, i32 [[S]], i32 [[T]], i32 3, <8 x i32> [[RSRC]], i32 0, i32 0) +; NO-MSAA-NEXT: [[I8:%.*]] = insertvalue [8 x float] undef, float [[I]], 0 +; NO-MSAA-NEXT: [[I9:%.*]] = insertvalue [8 x float] [[I8]], float [[I1]], 1 +; NO-MSAA-NEXT: [[I10:%.*]] = insertvalue [8 x float] [[I9]], float [[I2]], 2 +; NO-MSAA-NEXT: [[I11:%.*]] = insertvalue [8 x float] [[I10]], float [[I3]], 3 +; NO-MSAA-NEXT: [[I12:%.*]] = insertvalue [8 x float] [[I11]], float [[I4]], 4 +; NO-MSAA-NEXT: [[I13:%.*]] = insertvalue [8 x float] [[I12]], float [[I5]], 5 +; NO-MSAA-NEXT: [[I14:%.*]] = insertvalue [8 x float] [[I13]], float [[I6]], 6 +; NO-MSAA-NEXT: [[I15:%.*]] = insertvalue [8 x float] [[I14]], float [[I7]], 7 +; NO-MSAA-NEXT: ret [8 x float] [[I15]] +; +; MSAA-LABEL: define amdgpu_ps [8 x float] @load_2dmsaa_v8f32( +; MSAA-SAME: <8 x i32> inreg [[RSRC:%.*]], i32 [[S:%.*]], i32 [[T:%.*]]) #[[ATTR0]] { +; MSAA-NEXT: main_body: +; MSAA-NEXT: [[TMP0:%.*]] = call <4 x float> @llvm.amdgcn.image.msaa.load.2dmsaa.v4f32.i32(i32 1, i32 [[S]], i32 [[T]], i32 0, <8 x i32> [[RSRC]], i32 0, i32 0) +; MSAA-NEXT: [[I:%.*]] = extractelement <4 x float> [[TMP0]], i64 0 +; MSAA-NEXT: [[I1:%.*]] = extractelement <4 x float> [[TMP0]], i64 1 +; MSAA-NEXT: [[I2:%.*]] = extractelement <4 x float> [[TMP0]], i64 2 +; MSAA-NEXT: [[I3:%.*]] = extractelement <4 x float> [[TMP0]], i64 3 +; MSAA-NEXT: [[I4:%.*]] = extractelement <4 x float> [[TMP0]], i64 0 +; MSAA-NEXT: [[I5:%.*]] = extractelement <4 x float> [[TMP0]], i64 1 +; MSAA-NEXT: [[I6:%.*]] = extractelement <4 x float> [[TMP0]], i64 2 +; MSAA-NEXT: [[I7:%.*]] = extractelement <4 x float> [[TMP0]], i64 3 +; MSAA-NEXT: [[I8:%.*]] = insertvalue [8 x float] undef, float [[I]], 0 +; MSAA-NEXT: [[I9:%.*]] = insertvalue [8 x float] [[I8]], float [[I1]], 1 +; MSAA-NEXT: [[I10:%.*]] = insertvalue [8 x float] [[I9]], float [[I2]], 2 +; MSAA-NEXT: [[I11:%.*]] = insertvalue [8 x float] [[I10]], float [[I3]], 3 +; MSAA-NEXT: [[I12:%.*]] = insertvalue [8 x float] [[I11]], float [[I4]], 4 +; MSAA-NEXT: [[I13:%.*]] = insertvalue [8 x float] [[I12]], float [[I5]], 5 +; MSAA-NEXT: [[I14:%.*]] = insertvalue [8 x float] [[I13]], float [[I6]], 6 +; MSAA-NEXT: [[I15:%.*]] = insertvalue [8 x float] [[I14]], float [[I7]], 7 +; MSAA-NEXT: ret [8 x float] [[I15]] +; +main_body: + %i = call float @llvm.amdgcn.image.load.2dmsaa.f32.i32(i32 1, i32 %s, i32 %t, i32 0, <8 x i32> %rsrc, i32 0, i32 0) + %i1 = call float @llvm.amdgcn.image.load.2dmsaa.f32.i32(i32 1, i32 %s, i32 %t, i32 1, <8 x i32> %rsrc, i32 0, i32 0) + %i2 = call float @llvm.amdgcn.image.load.2dmsaa.f32.i32(i32 1, i32 %s, i32 %t, i32 2, <8 x i32> %rsrc, i32 0, i32 0) + %i3 = call float @llvm.amdgcn.image.load.2dmsaa.f32.i32(i32 1, i32 %s, i32 %t, i32 3, <8 x i32> %rsrc, i32 0, i32 0) + %i4 = call float @llvm.amdgcn.image.load.2dmsaa.f32.i32(i32 1, i32 %s, i32 %t, i32 0, <8 x i32> %rsrc, i32 0, i32 0) + %i5 = call float @llvm.amdgcn.image.load.2dmsaa.f32.i32(i32 1, i32 %s, i32 %t, i32 1, <8 x i32> %rsrc, i32 0, i32 0) + %i6 = call float @llvm.amdgcn.image.load.2dmsaa.f32.i32(i32 1, i32 %s, i32 %t, i32 2, <8 x i32> %rsrc, i32 0, i32 0) + %i7 = call float @llvm.amdgcn.image.load.2dmsaa.f32.i32(i32 1, i32 %s, i32 %t, i32 3, <8 x i32> %rsrc, i32 0, i32 0) + %i8 = insertvalue [8 x float] undef, float %i, 0 + %i9 = insertvalue [8 x float] %i8, float %i1, 1 + %i10 = insertvalue [8 x float] %i9, float %i2, 2 + %i11 = insertvalue [8 x float] %i10, float %i3, 3 + %i12 = insertvalue [8 x float] %i11, float %i4, 4 + %i13 = insertvalue [8 x float] %i12, float %i5, 5 + %i14 = insertvalue [8 x float] %i13, float %i6, 6 + %i15 = insertvalue [8 x float] %i14, float %i7, 7 + ret [8 x float] %i15 +} + +define amdgpu_ps [4 x float] @load_2dmsaa_v4f32_interleaved(<8 x i32> inreg %rsrc, i32 %s, i32 %t) { +; NO-MSAA-LABEL: define amdgpu_ps [4 x float] @load_2dmsaa_v4f32_interleaved( +; NO-MSAA-SAME: <8 x i32> inreg [[RSRC:%.*]], i32 [[S:%.*]], i32 [[T:%.*]]) #[[ATTR0]] { +; NO-MSAA-NEXT: main_body: +; NO-MSAA-NEXT: [[I:%.*]] = call float @llvm.amdgcn.image.load.2dmsaa.f32.i32(i32 1, i32 [[S]], i32 [[T]], i32 0, <8 x i32> [[RSRC]], i32 0, i32 0) +; NO-MSAA-NEXT: [[I1:%.*]] = insertvalue [4 x float] undef, float [[I]], 0 +; NO-MSAA-NEXT: [[I2:%.*]] = call float @llvm.amdgcn.image.load.2dmsaa.f32.i32(i32 1, i32 [[S]], i32 [[T]], i32 1, <8 x i32> [[RSRC]], i32 0, i32 0) +; NO-MSAA-NEXT: [[I3:%.*]] = insertvalue [4 x float] [[I1]], float [[I2]], 1 +; NO-MSAA-NEXT: [[I4:%.*]] = call float @llvm.amdgcn.image.load.2dmsaa.f32.i32(i32 1, i32 [[S]], i32 [[T]], i32 2, <8 x i32> [[RSRC]], i32 0, i32 0) +; NO-MSAA-NEXT: [[I5:%.*]] = insertvalue [4 x float] [[I3]], float [[I4]], 2 +; NO-MSAA-NEXT: [[I6:%.*]] = call float @llvm.amdgcn.image.load.2dmsaa.f32.i32(i32 1, i32 [[S]], i32 [[T]], i32 3, <8 x i32> [[RSRC]], i32 0, i32 0) +; NO-MSAA-NEXT: [[I7:%.*]] = insertvalue [4 x float] [[I5]], float [[I6]], 3 +; NO-MSAA-NEXT: ret [4 x float] [[I7]] +; +; MSAA-LABEL: define amdgpu_ps [4 x float] @load_2dmsaa_v4f32_interleaved( +; MSAA-SAME: <8 x i32> inreg [[RSRC:%.*]], i32 [[S:%.*]], i32 [[T:%.*]]) #[[ATTR0]] { +; MSAA-NEXT: main_body: +; MSAA-NEXT: [[TMP0:%.*]] = call <4 x float> @llvm.amdgcn.image.msaa.load.2dmsaa.v4f32.i32(i32 1, i32 [[S]], i32 [[T]], i32 0, <8 x i32> [[RSRC]], i32 0, i32 0) +; MSAA-NEXT: [[I:%.*]] = extractelement <4 x float> [[TMP0]], i64 0 +; MSAA-NEXT: [[I2:%.*]] = extractelement <4 x float> [[TMP0]], i64 1 +; MSAA-NEXT: [[I4:%.*]] = extractelement <4 x float> [[TMP0]], i64 2 +; MSAA-NEXT: [[I6:%.*]] = extractelement <4 x float> [[TMP0]], i64 3 +; MSAA-NEXT: [[I1:%.*]] = insertvalue [4 x float] undef, float [[I]], 0 +; MSAA-NEXT: [[I3:%.*]] = insertvalue [4 x float] [[I1]], float [[I2]], 1 +; MSAA-NEXT: [[I5:%.*]] = insertvalue [4 x float] [[I3]], float [[I4]], 2 +; MSAA-NEXT: [[I7:%.*]] = insertvalue [4 x float] [[I5]], float [[I6]], 3 +; MSAA-NEXT: ret [4 x float] [[I7]] +; +main_body: + %i = call float @llvm.amdgcn.image.load.2dmsaa.f32.i32(i32 1, i32 %s, i32 %t, i32 0, <8 x i32> %rsrc, i32 0, i32 0) + %i1 = insertvalue [4 x float] undef, float %i, 0 + %i2 = call float @llvm.amdgcn.image.load.2dmsaa.f32.i32(i32 1, i32 %s, i32 %t, i32 1, <8 x i32> %rsrc, i32 0, i32 0) + %i3 = insertvalue [4 x float] %i1, float %i2, 1 + %i4 = call float @llvm.amdgcn.image.load.2dmsaa.f32.i32(i32 1, i32 %s, i32 %t, i32 2, <8 x i32> %rsrc, i32 0, i32 0) + %i5 = insertvalue [4 x float] %i3, float %i4, 2 + %i6 = call float @llvm.amdgcn.image.load.2dmsaa.f32.i32(i32 1, i32 %s, i32 %t, i32 3, <8 x i32> %rsrc, i32 0, i32 0) + %i7 = insertvalue [4 x float] %i5, float %i6, 3 + ret [4 x float] %i7 +} + +define amdgpu_ps [2 x float] @load_2dmsaa_v2f32_fragId01(<8 x i32> inreg %rsrc, i32 %s, i32 %t) { +; NO-MSAA-LABEL: define amdgpu_ps [2 x float] @load_2dmsaa_v2f32_fragId01( +; NO-MSAA-SAME: <8 x i32> inreg [[RSRC:%.*]], i32 [[S:%.*]], i32 [[T:%.*]]) #[[ATTR0]] { +; NO-MSAA-NEXT: main_body: +; NO-MSAA-NEXT: [[I:%.*]] = call float @llvm.amdgcn.image.load.2dmsaa.f32.i32(i32 1, i32 [[S]], i32 [[T]], i32 0, <8 x i32> [[RSRC]], i32 0, i32 0) +; NO-MSAA-NEXT: [[I1:%.*]] = call float @llvm.amdgcn.image.load.2dmsaa.f32.i32(i32 1, i32 [[S]], i32 [[T]], i32 1, <8 x i32> [[RSRC]], i32 0, i32 0) +; NO-MSAA-NEXT: [[I2:%.*]] = insertvalue [2 x float] undef, float [[I]], 0 +; NO-MSAA-NEXT: [[I3:%.*]] = insertvalue [2 x float] [[I2]], float [[I1]], 1 +; NO-MSAA-NEXT: ret [2 x float] [[I3]] +; +; MSAA-LABEL: define amdgpu_ps [2 x float] @load_2dmsaa_v2f32_fragId01( +; MSAA-SAME: <8 x i32> inreg [[RSRC:%.*]], i32 [[S:%.*]], i32 [[T:%.*]]) #[[ATTR0]] { +; MSAA-NEXT: main_body: +; MSAA-NEXT: [[TMP0:%.*]] = call <4 x float> @llvm.amdgcn.image.msaa.load.2dmsaa.v4f32.i32(i32 1, i32 [[S]], i32 [[T]], i32 0, <8 x i32> [[RSRC]], i32 0, i32 0) +; MSAA-NEXT: [[I:%.*]] = extractelement <4 x float> [[TMP0]], i64 0 +; MSAA-NEXT: [[I1:%.*]] = extractelement <4 x float> [[TMP0]], i64 1 +; MSAA-NEXT: [[I2:%.*]] = insertvalue [2 x float] undef, float [[I]], 0 +; MSAA-NEXT: [[I3:%.*]] = insertvalue [2 x float] [[I2]], float [[I1]], 1 +; MSAA-NEXT: ret [2 x float] [[I3]] +; +main_body: + %i = call float @llvm.amdgcn.image.load.2dmsaa.f32.i32(i32 1, i32 %s, i32 %t, i32 0, <8 x i32> %rsrc, i32 0, i32 0) + %i1 = call float @llvm.amdgcn.image.load.2dmsaa.f32.i32(i32 1, i32 %s, i32 %t, i32 1, <8 x i32> %rsrc, i32 0, i32 0) + %i2 = insertvalue [2 x float] undef, float %i, 0 + %i3 = insertvalue [2 x float] %i2, float %i1, 1 + ret [2 x float] %i3 +} + +define amdgpu_ps [2 x float] @load_2dmsaa_v2f32_fragId23(<8 x i32> inreg %rsrc, i32 %s, i32 %t) { +; NO-MSAA-LABEL: define amdgpu_ps [2 x float] @load_2dmsaa_v2f32_fragId23( +; NO-MSAA-SAME: <8 x i32> inreg [[RSRC:%.*]], i32 [[S:%.*]], i32 [[T:%.*]]) #[[ATTR0]] { +; NO-MSAA-NEXT: main_body: +; NO-MSAA-NEXT: [[I:%.*]] = call float @llvm.amdgcn.image.load.2dmsaa.f32.i32(i32 1, i32 [[S]], i32 [[T]], i32 2, <8 x i32> [[RSRC]], i32 0, i32 0) +; NO-MSAA-NEXT: [[I1:%.*]] = call float @llvm.amdgcn.image.load.2dmsaa.f32.i32(i32 1, i32 [[S]], i32 [[T]], i32 3, <8 x i32> [[RSRC]], i32 0, i32 0) +; NO-MSAA-NEXT: [[I2:%.*]] = insertvalue [2 x float] undef, float [[I]], 0 +; NO-MSAA-NEXT: [[I3:%.*]] = insertvalue [2 x float] [[I2]], float [[I1]], 1 +; NO-MSAA-NEXT: ret [2 x float] [[I3]] +; +; MSAA-LABEL: define amdgpu_ps [2 x float] @load_2dmsaa_v2f32_fragId23( +; MSAA-SAME: <8 x i32> inreg [[RSRC:%.*]], i32 [[S:%.*]], i32 [[T:%.*]]) #[[ATTR0]] { +; MSAA-NEXT: main_body: +; MSAA-NEXT: [[TMP0:%.*]] = call <4 x float> @llvm.amdgcn.image.msaa.load.2dmsaa.v4f32.i32(i32 1, i32 [[S]], i32 [[T]], i32 0, <8 x i32> [[RSRC]], i32 0, i32 0) +; MSAA-NEXT: [[I:%.*]] = extractelement <4 x float> [[TMP0]], i64 2 +; MSAA-NEXT: [[I1:%.*]] = extractelement <4 x float> [[TMP0]], i64 3 +; MSAA-NEXT: [[I2:%.*]] = insertvalue [2 x float] undef, float [[I]], 0 +; MSAA-NEXT: [[I3:%.*]] = insertvalue [2 x float] [[I2]], float [[I1]], 1 +; MSAA-NEXT: ret [2 x float] [[I3]] +; +main_body: + %i = call float @llvm.amdgcn.image.load.2dmsaa.f32.i32(i32 1, i32 %s, i32 %t, i32 2, <8 x i32> %rsrc, i32 0, i32 0) + %i1 = call float @llvm.amdgcn.image.load.2dmsaa.f32.i32(i32 1, i32 %s, i32 %t, i32 3, <8 x i32> %rsrc, i32 0, i32 0) + %i2 = insertvalue [2 x float] undef, float %i, 0 + %i3 = insertvalue [2 x float] %i2, float %i1, 1 + ret [2 x float] %i3 +} + +; Don't combine because it's not profitable: the resulting msaa loads would +; have 8 vdata outputs. +define amdgpu_ps [2 x <2 x float>] @load_2dmsaa_v2v2f32_dmask3(<8 x i32> inreg %rsrc, i32 %s, i32 %t) { +; NO-MSAA-LABEL: define amdgpu_ps [2 x <2 x float>] @load_2dmsaa_v2v2f32_dmask3( +; NO-MSAA-SAME: <8 x i32> inreg [[RSRC:%.*]], i32 [[S:%.*]], i32 [[T:%.*]]) #[[ATTR0]] { +; NO-MSAA-NEXT: main_body: +; NO-MSAA-NEXT: [[I:%.*]] = call <2 x float> @llvm.amdgcn.image.load.2dmsaa.v2f32.i32(i32 3, i32 [[S]], i32 [[T]], i32 0, <8 x i32> [[RSRC]], i32 0, i32 0) +; NO-MSAA-NEXT: [[I1:%.*]] = call <2 x float> @llvm.amdgcn.image.load.2dmsaa.v2f32.i32(i32 3, i32 [[S]], i32 [[T]], i32 1, <8 x i32> [[RSRC]], i32 0, i32 0) +; NO-MSAA-NEXT: [[I4:%.*]] = insertvalue [2 x <2 x float>] undef, <2 x float> [[I]], 0 +; NO-MSAA-NEXT: [[I5:%.*]] = insertvalue [2 x <2 x float>] [[I4]], <2 x float> [[I1]], 1 +; NO-MSAA-NEXT: ret [2 x <2 x float>] [[I5]] +; +; MSAA-LABEL: define amdgpu_ps [2 x <2 x float>] @load_2dmsaa_v2v2f32_dmask3( +; MSAA-SAME: <8 x i32> inreg [[RSRC:%.*]], i32 [[S:%.*]], i32 [[T:%.*]]) #[[ATTR0]] { +; MSAA-NEXT: main_body: +; MSAA-NEXT: [[I:%.*]] = call <2 x float> @llvm.amdgcn.image.load.2dmsaa.v2f32.i32(i32 3, i32 [[S]], i32 [[T]], i32 0, <8 x i32> [[RSRC]], i32 0, i32 0) +; MSAA-NEXT: [[I1:%.*]] = call <2 x float> @llvm.amdgcn.image.load.2dmsaa.v2f32.i32(i32 3, i32 [[S]], i32 [[T]], i32 1, <8 x i32> [[RSRC]], i32 0, i32 0) +; MSAA-NEXT: [[I4:%.*]] = insertvalue [2 x <2 x float>] undef, <2 x float> [[I]], 0 +; MSAA-NEXT: [[I5:%.*]] = insertvalue [2 x <2 x float>] [[I4]], <2 x float> [[I1]], 1 +; MSAA-NEXT: ret [2 x <2 x float>] [[I5]] +; +main_body: + %i = call <2 x float> @llvm.amdgcn.image.load.2dmsaa.v2f32.i32(i32 3, i32 %s, i32 %t, i32 0, <8 x i32> %rsrc, i32 0, i32 0) + %i1 = call <2 x float> @llvm.amdgcn.image.load.2dmsaa.v2f32.i32(i32 3, i32 %s, i32 %t, i32 1, <8 x i32> %rsrc, i32 0, i32 0) + %i4 = insertvalue [2 x <2 x float>] undef, <2 x float> %i, 0 + %i5 = insertvalue [2 x <2 x float>] %i4, <2 x float> %i1, 1 + ret [2 x <2 x float>] %i5 +} + + + + +define amdgpu_ps [4 x <2 x float>] @load_2dmsaa_v4v2f32_dmask3(<8 x i32> inreg %rsrc, i32 %s, i32 %t) { +; NO-MSAA-LABEL: define amdgpu_ps [4 x <2 x float>] @load_2dmsaa_v4v2f32_dmask3( +; NO-MSAA-SAME: <8 x i32> inreg [[RSRC:%.*]], i32 [[S:%.*]], i32 [[T:%.*]]) #[[ATTR0]] { +; NO-MSAA-NEXT: main_body: +; NO-MSAA-NEXT: [[I:%.*]] = call <2 x float> @llvm.amdgcn.image.load.2dmsaa.v2f32.i32(i32 3, i32 [[S]], i32 [[T]], i32 0, <8 x i32> [[RSRC]], i32 0, i32 0) +; NO-MSAA-NEXT: [[I1:%.*]] = call <2 x float> @llvm.amdgcn.image.load.2dmsaa.v2f32.i32(i32 3, i32 [[S]], i32 [[T]], i32 1, <8 x i32> [[RSRC]], i32 0, i32 0) +; NO-MSAA-NEXT: [[I2:%.*]] = call <2 x float> @llvm.amdgcn.image.load.2dmsaa.v2f32.i32(i32 3, i32 [[S]], i32 [[T]], i32 2, <8 x i32> [[RSRC]], i32 0, i32 0) +; NO-MSAA-NEXT: [[I3:%.*]] = call <2 x float> @llvm.amdgcn.image.load.2dmsaa.v2f32.i32(i32 3, i32 [[S]], i32 [[T]], i32 3, <8 x i32> [[RSRC]], i32 0, i32 0) +; NO-MSAA-NEXT: [[I4:%.*]] = insertvalue [4 x <2 x float>] undef, <2 x float> [[I]], 0 +; NO-MSAA-NEXT: [[I5:%.*]] = insertvalue [4 x <2 x float>] [[I4]], <2 x float> [[I1]], 1 +; NO-MSAA-NEXT: [[I6:%.*]] = insertvalue [4 x <2 x float>] [[I5]], <2 x float> [[I2]], 2 +; NO-MSAA-NEXT: [[I7:%.*]] = insertvalue [4 x <2 x float>] [[I6]], <2 x float> [[I3]], 3 +; NO-MSAA-NEXT: ret [4 x <2 x float>] [[I7]] +; +; MSAA-LABEL: define amdgpu_ps [4 x <2 x float>] @load_2dmsaa_v4v2f32_dmask3( +; MSAA-SAME: <8 x i32> inreg [[RSRC:%.*]], i32 [[S:%.*]], i32 [[T:%.*]]) #[[ATTR0]] { +; MSAA-NEXT: main_body: +; MSAA-NEXT: [[TMP0:%.*]] = call <4 x float> @llvm.amdgcn.image.msaa.load.2dmsaa.v4f32.i32(i32 1, i32 [[S]], i32 [[T]], i32 0, <8 x i32> [[RSRC]], i32 0, i32 0) +; MSAA-NEXT: [[TMP1:%.*]] = call <4 x float> @llvm.amdgcn.image.msaa.load.2dmsaa.v4f32.i32(i32 2, i32 [[S]], i32 [[T]], i32 0, <8 x i32> [[RSRC]], i32 0, i32 0) +; MSAA-NEXT: [[TMP2:%.*]] = extractelement <4 x float> [[TMP0]], i64 0 +; MSAA-NEXT: [[TMP3:%.*]] = insertelement <2 x float> undef, float [[TMP2]], i64 0 +; MSAA-NEXT: [[TMP4:%.*]] = extractelement <4 x float> [[TMP1]], i64 0 +; MSAA-NEXT: [[I:%.*]] = insertelement <2 x float> [[TMP3]], float [[TMP4]], i64 1 +; MSAA-NEXT: [[TMP5:%.*]] = extractelement <4 x float> [[TMP0]], i64 1 +; MSAA-NEXT: [[TMP6:%.*]] = insertelement <2 x float> undef, float [[TMP5]], i64 0 +; MSAA-NEXT: [[TMP7:%.*]] = extractelement <4 x float> [[TMP1]], i64 1 +; MSAA-NEXT: [[I1:%.*]] = insertelement <2 x float> [[TMP6]], float [[TMP7]], i64 1 +; MSAA-NEXT: [[TMP8:%.*]] = extractelement <4 x float> [[TMP0]], i64 2 +; MSAA-NEXT: [[TMP9:%.*]] = insertelement <2 x float> undef, float [[TMP8]], i64 0 +; MSAA-NEXT: [[TMP10:%.*]] = extractelement <4 x float> [[TMP1]], i64 2 +; MSAA-NEXT: [[I2:%.*]] = insertelement <2 x float> [[TMP9]], float [[TMP10]], i64 1 +; MSAA-NEXT: [[TMP11:%.*]] = extractelement <4 x float> [[TMP0]], i64 3 +; MSAA-NEXT: [[TMP12:%.*]] = insertelement <2 x float> undef, float [[TMP11]], i64 0 +; MSAA-NEXT: [[TMP13:%.*]] = extractelement <4 x float> [[TMP1]], i64 3 +; MSAA-NEXT: [[I3:%.*]] = insertelement <2 x float> [[TMP12]], float [[TMP13]], i64 1 +; MSAA-NEXT: [[I4:%.*]] = insertvalue [4 x <2 x float>] undef, <2 x float> [[I]], 0 +; MSAA-NEXT: [[I5:%.*]] = insertvalue [4 x <2 x float>] [[I4]], <2 x float> [[I1]], 1 +; MSAA-NEXT: [[I6:%.*]] = insertvalue [4 x <2 x float>] [[I5]], <2 x float> [[I2]], 2 +; MSAA-NEXT: [[I7:%.*]] = insertvalue [4 x <2 x float>] [[I6]], <2 x float> [[I3]], 3 +; MSAA-NEXT: ret [4 x <2 x float>] [[I7]] +; +main_body: + %i = call <2 x float> @llvm.amdgcn.image.load.2dmsaa.v2f32.i32(i32 3, i32 %s, i32 %t, i32 0, <8 x i32> %rsrc, i32 0, i32 0) + %i1 = call <2 x float> @llvm.amdgcn.image.load.2dmsaa.v2f32.i32(i32 3, i32 %s, i32 %t, i32 1, <8 x i32> %rsrc, i32 0, i32 0) + %i2 = call <2 x float> @llvm.amdgcn.image.load.2dmsaa.v2f32.i32(i32 3, i32 %s, i32 %t, i32 2, <8 x i32> %rsrc, i32 0, i32 0) + %i3 = call <2 x float> @llvm.amdgcn.image.load.2dmsaa.v2f32.i32(i32 3, i32 %s, i32 %t, i32 3, <8 x i32> %rsrc, i32 0, i32 0) + %i4 = insertvalue [4 x <2 x float>] undef, <2 x float> %i, 0 + %i5 = insertvalue [4 x <2 x float>] %i4, <2 x float> %i1, 1 + %i6 = insertvalue [4 x <2 x float>] %i5, <2 x float> %i2, 2 + %i7 = insertvalue [4 x <2 x float>] %i6, <2 x float> %i3, 3 + ret [4 x <2 x float>] %i7 +} + + + + +define amdgpu_ps [4 x <2 x float>] @load_2dmsaa_v4v2f32_dmask5(<8 x i32> inreg %rsrc, i32 %s, i32 %t) { +; NO-MSAA-LABEL: define amdgpu_ps [4 x <2 x float>] @load_2dmsaa_v4v2f32_dmask5( +; NO-MSAA-SAME: <8 x i32> inreg [[RSRC:%.*]], i32 [[S:%.*]], i32 [[T:%.*]]) #[[ATTR0]] { +; NO-MSAA-NEXT: main_body: +; NO-MSAA-NEXT: [[I:%.*]] = call <2 x float> @llvm.amdgcn.image.load.2dmsaa.v2f32.i32(i32 5, i32 [[S]], i32 [[T]], i32 0, <8 x i32> [[RSRC]], i32 0, i32 0) +; NO-MSAA-NEXT: [[I1:%.*]] = call <2 x float> @llvm.amdgcn.image.load.2dmsaa.v2f32.i32(i32 5, i32 [[S]], i32 [[T]], i32 1, <8 x i32> [[RSRC]], i32 0, i32 0) +; NO-MSAA-NEXT: [[I2:%.*]] = call <2 x float> @llvm.amdgcn.image.load.2dmsaa.v2f32.i32(i32 5, i32 [[S]], i32 [[T]], i32 2, <8 x i32> [[RSRC]], i32 0, i32 0) +; NO-MSAA-NEXT: [[I3:%.*]] = call <2 x float> @llvm.amdgcn.image.load.2dmsaa.v2f32.i32(i32 5, i32 [[S]], i32 [[T]], i32 3, <8 x i32> [[RSRC]], i32 0, i32 0) +; NO-MSAA-NEXT: [[I4:%.*]] = insertvalue [4 x <2 x float>] undef, <2 x float> [[I]], 0 +; NO-MSAA-NEXT: [[I5:%.*]] = insertvalue [4 x <2 x float>] [[I4]], <2 x float> [[I1]], 1 +; NO-MSAA-NEXT: [[I6:%.*]] = insertvalue [4 x <2 x float>] [[I5]], <2 x float> [[I2]], 2 +; NO-MSAA-NEXT: [[I7:%.*]] = insertvalue [4 x <2 x float>] [[I6]], <2 x float> [[I3]], 3 +; NO-MSAA-NEXT: ret [4 x <2 x float>] [[I7]] +; +; MSAA-LABEL: define amdgpu_ps [4 x <2 x float>] @load_2dmsaa_v4v2f32_dmask5( +; MSAA-SAME: <8 x i32> inreg [[RSRC:%.*]], i32 [[S:%.*]], i32 [[T:%.*]]) #[[ATTR0]] { +; MSAA-NEXT: main_body: +; MSAA-NEXT: [[TMP0:%.*]] = call <4 x float> @llvm.amdgcn.image.msaa.load.2dmsaa.v4f32.i32(i32 1, i32 [[S]], i32 [[T]], i32 0, <8 x i32> [[RSRC]], i32 0, i32 0) +; MSAA-NEXT: [[TMP1:%.*]] = call <4 x float> @llvm.amdgcn.image.msaa.load.2dmsaa.v4f32.i32(i32 4, i32 [[S]], i32 [[T]], i32 0, <8 x i32> [[RSRC]], i32 0, i32 0) +; MSAA-NEXT: [[TMP2:%.*]] = extractelement <4 x float> [[TMP0]], i64 0 +; MSAA-NEXT: [[TMP3:%.*]] = insertelement <2 x float> undef, float [[TMP2]], i64 0 +; MSAA-NEXT: [[TMP4:%.*]] = extractelement <4 x float> [[TMP1]], i64 0 +; MSAA-NEXT: [[I:%.*]] = insertelement <2 x float> [[TMP3]], float [[TMP4]], i64 1 +; MSAA-NEXT: [[TMP5:%.*]] = extractelement <4 x float> [[TMP0]], i64 1 +; MSAA-NEXT: [[TMP6:%.*]] = insertelement <2 x float> undef, float [[TMP5]], i64 0 +; MSAA-NEXT: [[TMP7:%.*]] = extractelement <4 x float> [[TMP1]], i64 1 +; MSAA-NEXT: [[I1:%.*]] = insertelement <2 x float> [[TMP6]], float [[TMP7]], i64 1 +; MSAA-NEXT: [[TMP8:%.*]] = extractelement <4 x float> [[TMP0]], i64 2 +; MSAA-NEXT: [[TMP9:%.*]] = insertelement <2 x float> undef, float [[TMP8]], i64 0 +; MSAA-NEXT: [[TMP10:%.*]] = extractelement <4 x float> [[TMP1]], i64 2 +; MSAA-NEXT: [[I2:%.*]] = insertelement <2 x float> [[TMP9]], float [[TMP10]], i64 1 +; MSAA-NEXT: [[TMP11:%.*]] = extractelement <4 x float> [[TMP0]], i64 3 +; MSAA-NEXT: [[TMP12:%.*]] = insertelement <2 x float> undef, float [[TMP11]], i64 0 +; MSAA-NEXT: [[TMP13:%.*]] = extractelement <4 x float> [[TMP1]], i64 3 +; MSAA-NEXT: [[I3:%.*]] = insertelement <2 x float> [[TMP12]], float [[TMP13]], i64 1 +; MSAA-NEXT: [[I4:%.*]] = insertvalue [4 x <2 x float>] undef, <2 x float> [[I]], 0 +; MSAA-NEXT: [[I5:%.*]] = insertvalue [4 x <2 x float>] [[I4]], <2 x float> [[I1]], 1 +; MSAA-NEXT: [[I6:%.*]] = insertvalue [4 x <2 x float>] [[I5]], <2 x float> [[I2]], 2 +; MSAA-NEXT: [[I7:%.*]] = insertvalue [4 x <2 x float>] [[I6]], <2 x float> [[I3]], 3 +; MSAA-NEXT: ret [4 x <2 x float>] [[I7]] +; +main_body: + %i = call <2 x float> @llvm.amdgcn.image.load.2dmsaa.v2f32.i32(i32 5, i32 %s, i32 %t, i32 0, <8 x i32> %rsrc, i32 0, i32 0) + %i1 = call <2 x float> @llvm.amdgcn.image.load.2dmsaa.v2f32.i32(i32 5, i32 %s, i32 %t, i32 1, <8 x i32> %rsrc, i32 0, i32 0) + %i2 = call <2 x float> @llvm.amdgcn.image.load.2dmsaa.v2f32.i32(i32 5, i32 %s, i32 %t, i32 2, <8 x i32> %rsrc, i32 0, i32 0) + %i3 = call <2 x float> @llvm.amdgcn.image.load.2dmsaa.v2f32.i32(i32 5, i32 %s, i32 %t, i32 3, <8 x i32> %rsrc, i32 0, i32 0) + %i4 = insertvalue [4 x <2 x float>] undef, <2 x float> %i, 0 + %i5 = insertvalue [4 x <2 x float>] %i4, <2 x float> %i1, 1 + %i6 = insertvalue [4 x <2 x float>] %i5, <2 x float> %i2, 2 + %i7 = insertvalue [4 x <2 x float>] %i6, <2 x float> %i3, 3 + ret [4 x <2 x float>] %i7 +} + + + + +define amdgpu_ps [4 x <2 x float>] @load_2dmsaa_v4v2f32_dmask6(<8 x i32> inreg %rsrc, i32 %s, i32 %t) { +; NO-MSAA-LABEL: define amdgpu_ps [4 x <2 x float>] @load_2dmsaa_v4v2f32_dmask6( +; NO-MSAA-SAME: <8 x i32> inreg [[RSRC:%.*]], i32 [[S:%.*]], i32 [[T:%.*]]) #[[ATTR0]] { +; NO-MSAA-NEXT: main_body: +; NO-MSAA-NEXT: [[I:%.*]] = call <2 x float> @llvm.amdgcn.image.load.2dmsaa.v2f32.i32(i32 6, i32 [[S]], i32 [[T]], i32 0, <8 x i32> [[RSRC]], i32 0, i32 0) +; NO-MSAA-NEXT: [[I1:%.*]] = call <2 x float> @llvm.amdgcn.image.load.2dmsaa.v2f32.i32(i32 6, i32 [[S]], i32 [[T]], i32 1, <8 x i32> [[RSRC]], i32 0, i32 0) +; NO-MSAA-NEXT: [[I2:%.*]] = call <2 x float> @llvm.amdgcn.image.load.2dmsaa.v2f32.i32(i32 6, i32 [[S]], i32 [[T]], i32 2, <8 x i32> [[RSRC]], i32 0, i32 0) +; NO-MSAA-NEXT: [[I3:%.*]] = call <2 x float> @llvm.amdgcn.image.load.2dmsaa.v2f32.i32(i32 6, i32 [[S]], i32 [[T]], i32 3, <8 x i32> [[RSRC]], i32 0, i32 0) +; NO-MSAA-NEXT: [[I4:%.*]] = insertvalue [4 x <2 x float>] undef, <2 x float> [[I]], 0 +; NO-MSAA-NEXT: [[I5:%.*]] = insertvalue [4 x <2 x float>] [[I4]], <2 x float> [[I1]], 1 +; NO-MSAA-NEXT: [[I6:%.*]] = insertvalue [4 x <2 x float>] [[I5]], <2 x float> [[I2]], 2 +; NO-MSAA-NEXT: [[I7:%.*]] = insertvalue [4 x <2 x float>] [[I6]], <2 x float> [[I3]], 3 +; NO-MSAA-NEXT: ret [4 x <2 x float>] [[I7]] +; +; MSAA-LABEL: define amdgpu_ps [4 x <2 x float>] @load_2dmsaa_v4v2f32_dmask6( +; MSAA-SAME: <8 x i32> inreg [[RSRC:%.*]], i32 [[S:%.*]], i32 [[T:%.*]]) #[[ATTR0]] { +; MSAA-NEXT: main_body: +; MSAA-NEXT: [[TMP0:%.*]] = call <4 x float> @llvm.amdgcn.image.msaa.load.2dmsaa.v4f32.i32(i32 2, i32 [[S]], i32 [[T]], i32 0, <8 x i32> [[RSRC]], i32 0, i32 0) +; MSAA-NEXT: [[TMP1:%.*]] = call <4 x float> @llvm.amdgcn.image.msaa.load.2dmsaa.v4f32.i32(i32 4, i32 [[S]], i32 [[T]], i32 0, <8 x i32> [[RSRC]], i32 0, i32 0) +; MSAA-NEXT: [[TMP2:%.*]] = extractelement <4 x float> [[TMP0]], i64 0 +; MSAA-NEXT: [[TMP3:%.*]] = insertelement <2 x float> undef, float [[TMP2]], i64 0 +; MSAA-NEXT: [[TMP4:%.*]] = extractelement <4 x float> [[TMP1]], i64 0 +; MSAA-NEXT: [[I:%.*]] = insertelement <2 x float> [[TMP3]], float [[TMP4]], i64 1 +; MSAA-NEXT: [[TMP5:%.*]] = extractelement <4 x float> [[TMP0]], i64 1 +; MSAA-NEXT: [[TMP6:%.*]] = insertelement <2 x float> undef, float [[TMP5]], i64 0 +; MSAA-NEXT: [[TMP7:%.*]] = extractelement <4 x float> [[TMP1]], i64 1 +; MSAA-NEXT: [[I1:%.*]] = insertelement <2 x float> [[TMP6]], float [[TMP7]], i64 1 +; MSAA-NEXT: [[TMP8:%.*]] = extractelement <4 x float> [[TMP0]], i64 2 +; MSAA-NEXT: [[TMP9:%.*]] = insertelement <2 x float> undef, float [[TMP8]], i64 0 +; MSAA-NEXT: [[TMP10:%.*]] = extractelement <4 x float> [[TMP1]], i64 2 +; MSAA-NEXT: [[I2:%.*]] = insertelement <2 x float> [[TMP9]], float [[TMP10]], i64 1 +; MSAA-NEXT: [[TMP11:%.*]] = extractelement <4 x float> [[TMP0]], i64 3 +; MSAA-NEXT: [[TMP12:%.*]] = insertelement <2 x float> undef, float [[TMP11]], i64 0 +; MSAA-NEXT: [[TMP13:%.*]] = extractelement <4 x float> [[TMP1]], i64 3 +; MSAA-NEXT: [[I3:%.*]] = insertelement <2 x float> [[TMP12]], float [[TMP13]], i64 1 +; MSAA-NEXT: [[I4:%.*]] = insertvalue [4 x <2 x float>] undef, <2 x float> [[I]], 0 +; MSAA-NEXT: [[I5:%.*]] = insertvalue [4 x <2 x float>] [[I4]], <2 x float> [[I1]], 1 +; MSAA-NEXT: [[I6:%.*]] = insertvalue [4 x <2 x float>] [[I5]], <2 x float> [[I2]], 2 +; MSAA-NEXT: [[I7:%.*]] = insertvalue [4 x <2 x float>] [[I6]], <2 x float> [[I3]], 3 +; MSAA-NEXT: ret [4 x <2 x float>] [[I7]] +; +main_body: + %i = call <2 x float> @llvm.amdgcn.image.load.2dmsaa.v2f32.i32(i32 6, i32 %s, i32 %t, i32 0, <8 x i32> %rsrc, i32 0, i32 0) + %i1 = call <2 x float> @llvm.amdgcn.image.load.2dmsaa.v2f32.i32(i32 6, i32 %s, i32 %t, i32 1, <8 x i32> %rsrc, i32 0, i32 0) + %i2 = call <2 x float> @llvm.amdgcn.image.load.2dmsaa.v2f32.i32(i32 6, i32 %s, i32 %t, i32 2, <8 x i32> %rsrc, i32 0, i32 0) + %i3 = call <2 x float> @llvm.amdgcn.image.load.2dmsaa.v2f32.i32(i32 6, i32 %s, i32 %t, i32 3, <8 x i32> %rsrc, i32 0, i32 0) + %i4 = insertvalue [4 x <2 x float>] undef, <2 x float> %i, 0 + %i5 = insertvalue [4 x <2 x float>] %i4, <2 x float> %i1, 1 + %i6 = insertvalue [4 x <2 x float>] %i5, <2 x float> %i2, 2 + %i7 = insertvalue [4 x <2 x float>] %i6, <2 x float> %i3, 3 + ret [4 x <2 x float>] %i7 +} + + + + +define amdgpu_ps [4 x <2 x float>] @load_2dmsaa_v4v2f32_dmask9(<8 x i32> inreg %rsrc, i32 %s, i32 %t) { +; NO-MSAA-LABEL: define amdgpu_ps [4 x <2 x float>] @load_2dmsaa_v4v2f32_dmask9( +; NO-MSAA-SAME: <8 x i32> inreg [[RSRC:%.*]], i32 [[S:%.*]], i32 [[T:%.*]]) #[[ATTR0]] { +; NO-MSAA-NEXT: main_body: +; NO-MSAA-NEXT: [[I:%.*]] = call <2 x float> @llvm.amdgcn.image.load.2dmsaa.v2f32.i32(i32 9, i32 [[S]], i32 [[T]], i32 0, <8 x i32> [[RSRC]], i32 0, i32 0) +; NO-MSAA-NEXT: [[I1:%.*]] = call <2 x float> @llvm.amdgcn.image.load.2dmsaa.v2f32.i32(i32 9, i32 [[S]], i32 [[T]], i32 1, <8 x i32> [[RSRC]], i32 0, i32 0) +; NO-MSAA-NEXT: [[I2:%.*]] = call <2 x float> @llvm.amdgcn.image.load.2dmsaa.v2f32.i32(i32 9, i32 [[S]], i32 [[T]], i32 2, <8 x i32> [[RSRC]], i32 0, i32 0) +; NO-MSAA-NEXT: [[I3:%.*]] = call <2 x float> @llvm.amdgcn.image.load.2dmsaa.v2f32.i32(i32 9, i32 [[S]], i32 [[T]], i32 3, <8 x i32> [[RSRC]], i32 0, i32 0) +; NO-MSAA-NEXT: [[I4:%.*]] = insertvalue [4 x <2 x float>] undef, <2 x float> [[I]], 0 +; NO-MSAA-NEXT: [[I5:%.*]] = insertvalue [4 x <2 x float>] [[I4]], <2 x float> [[I1]], 1 +; NO-MSAA-NEXT: [[I6:%.*]] = insertvalue [4 x <2 x float>] [[I5]], <2 x float> [[I2]], 2 +; NO-MSAA-NEXT: [[I7:%.*]] = insertvalue [4 x <2 x float>] [[I6]], <2 x float> [[I3]], 3 +; NO-MSAA-NEXT: ret [4 x <2 x float>] [[I7]] +; +; MSAA-LABEL: define amdgpu_ps [4 x <2 x float>] @load_2dmsaa_v4v2f32_dmask9( +; MSAA-SAME: <8 x i32> inreg [[RSRC:%.*]], i32 [[S:%.*]], i32 [[T:%.*]]) #[[ATTR0]] { +; MSAA-NEXT: main_body: +; MSAA-NEXT: [[TMP0:%.*]] = call <4 x float> @llvm.amdgcn.image.msaa.load.2dmsaa.v4f32.i32(i32 1, i32 [[S]], i32 [[T]], i32 0, <8 x i32> [[RSRC]], i32 0, i32 0) +; MSAA-NEXT: [[TMP1:%.*]] = call <4 x float> @llvm.amdgcn.image.msaa.load.2dmsaa.v4f32.i32(i32 8, i32 [[S]], i32 [[T]], i32 0, <8 x i32> [[RSRC]], i32 0, i32 0) +; MSAA-NEXT: [[TMP2:%.*]] = extractelement <4 x float> [[TMP0]], i64 0 +; MSAA-NEXT: [[TMP3:%.*]] = insertelement <2 x float> undef, float [[TMP2]], i64 0 +; MSAA-NEXT: [[TMP4:%.*]] = extractelement <4 x float> [[TMP1]], i64 0 +; MSAA-NEXT: [[I:%.*]] = insertelement <2 x float> [[TMP3]], float [[TMP4]], i64 1 +; MSAA-NEXT: [[TMP5:%.*]] = extractelement <4 x float> [[TMP0]], i64 1 +; MSAA-NEXT: [[TMP6:%.*]] = insertelement <2 x float> undef, float [[TMP5]], i64 0 +; MSAA-NEXT: [[TMP7:%.*]] = extractelement <4 x float> [[TMP1]], i64 1 +; MSAA-NEXT: [[I1:%.*]] = insertelement <2 x float> [[TMP6]], float [[TMP7]], i64 1 +; MSAA-NEXT: [[TMP8:%.*]] = extractelement <4 x float> [[TMP0]], i64 2 +; MSAA-NEXT: [[TMP9:%.*]] = insertelement <2 x float> undef, float [[TMP8]], i64 0 +; MSAA-NEXT: [[TMP10:%.*]] = extractelement <4 x float> [[TMP1]], i64 2 +; MSAA-NEXT: [[I2:%.*]] = insertelement <2 x float> [[TMP9]], float [[TMP10]], i64 1 +; MSAA-NEXT: [[TMP11:%.*]] = extractelement <4 x float> [[TMP0]], i64 3 +; MSAA-NEXT: [[TMP12:%.*]] = insertelement <2 x float> undef, float [[TMP11]], i64 0 +; MSAA-NEXT: [[TMP13:%.*]] = extractelement <4 x float> [[TMP1]], i64 3 +; MSAA-NEXT: [[I3:%.*]] = insertelement <2 x float> [[TMP12]], float [[TMP13]], i64 1 +; MSAA-NEXT: [[I4:%.*]] = insertvalue [4 x <2 x float>] undef, <2 x float> [[I]], 0 +; MSAA-NEXT: [[I5:%.*]] = insertvalue [4 x <2 x float>] [[I4]], <2 x float> [[I1]], 1 +; MSAA-NEXT: [[I6:%.*]] = insertvalue [4 x <2 x float>] [[I5]], <2 x float> [[I2]], 2 +; MSAA-NEXT: [[I7:%.*]] = insertvalue [4 x <2 x float>] [[I6]], <2 x float> [[I3]], 3 +; MSAA-NEXT: ret [4 x <2 x float>] [[I7]] +; +main_body: + %i = call <2 x float> @llvm.amdgcn.image.load.2dmsaa.v2f32.i32(i32 9, i32 %s, i32 %t, i32 0, <8 x i32> %rsrc, i32 0, i32 0) + %i1 = call <2 x float> @llvm.amdgcn.image.load.2dmsaa.v2f32.i32(i32 9, i32 %s, i32 %t, i32 1, <8 x i32> %rsrc, i32 0, i32 0) + %i2 = call <2 x float> @llvm.amdgcn.image.load.2dmsaa.v2f32.i32(i32 9, i32 %s, i32 %t, i32 2, <8 x i32> %rsrc, i32 0, i32 0) + %i3 = call <2 x float> @llvm.amdgcn.image.load.2dmsaa.v2f32.i32(i32 9, i32 %s, i32 %t, i32 3, <8 x i32> %rsrc, i32 0, i32 0) + %i4 = insertvalue [4 x <2 x float>] undef, <2 x float> %i, 0 + %i5 = insertvalue [4 x <2 x float>] %i4, <2 x float> %i1, 1 + %i6 = insertvalue [4 x <2 x float>] %i5, <2 x float> %i2, 2 + %i7 = insertvalue [4 x <2 x float>] %i6, <2 x float> %i3, 3 + ret [4 x <2 x float>] %i7 +} + + + + +define amdgpu_ps [4 x <2 x float>] @load_2dmsaa_v4v2f32_dmask10(<8 x i32> inreg %rsrc, i32 %s, i32 %t) { +; NO-MSAA-LABEL: define amdgpu_ps [4 x <2 x float>] @load_2dmsaa_v4v2f32_dmask10( +; NO-MSAA-SAME: <8 x i32> inreg [[RSRC:%.*]], i32 [[S:%.*]], i32 [[T:%.*]]) #[[ATTR0]] { +; NO-MSAA-NEXT: main_body: +; NO-MSAA-NEXT: [[I:%.*]] = call <2 x float> @llvm.amdgcn.image.load.2dmsaa.v2f32.i32(i32 10, i32 [[S]], i32 [[T]], i32 0, <8 x i32> [[RSRC]], i32 0, i32 0) +; NO-MSAA-NEXT: [[I1:%.*]] = call <2 x float> @llvm.amdgcn.image.load.2dmsaa.v2f32.i32(i32 10, i32 [[S]], i32 [[T]], i32 1, <8 x i32> [[RSRC]], i32 0, i32 0) +; NO-MSAA-NEXT: [[I2:%.*]] = call <2 x float> @llvm.amdgcn.image.load.2dmsaa.v2f32.i32(i32 10, i32 [[S]], i32 [[T]], i32 2, <8 x i32> [[RSRC]], i32 0, i32 0) +; NO-MSAA-NEXT: [[I3:%.*]] = call <2 x float> @llvm.amdgcn.image.load.2dmsaa.v2f32.i32(i32 10, i32 [[S]], i32 [[T]], i32 3, <8 x i32> [[RSRC]], i32 0, i32 0) +; NO-MSAA-NEXT: [[I4:%.*]] = insertvalue [4 x <2 x float>] undef, <2 x float> [[I]], 0 +; NO-MSAA-NEXT: [[I5:%.*]] = insertvalue [4 x <2 x float>] [[I4]], <2 x float> [[I1]], 1 +; NO-MSAA-NEXT: [[I6:%.*]] = insertvalue [4 x <2 x float>] [[I5]], <2 x float> [[I2]], 2 +; NO-MSAA-NEXT: [[I7:%.*]] = insertvalue [4 x <2 x float>] [[I6]], <2 x float> [[I3]], 3 +; NO-MSAA-NEXT: ret [4 x <2 x float>] [[I7]] +; +; MSAA-LABEL: define amdgpu_ps [4 x <2 x float>] @load_2dmsaa_v4v2f32_dmask10( +; MSAA-SAME: <8 x i32> inreg [[RSRC:%.*]], i32 [[S:%.*]], i32 [[T:%.*]]) #[[ATTR0]] { +; MSAA-NEXT: main_body: +; MSAA-NEXT: [[TMP0:%.*]] = call <4 x float> @llvm.amdgcn.image.msaa.load.2dmsaa.v4f32.i32(i32 2, i32 [[S]], i32 [[T]], i32 0, <8 x i32> [[RSRC]], i32 0, i32 0) +; MSAA-NEXT: [[TMP1:%.*]] = call <4 x float> @llvm.amdgcn.image.msaa.load.2dmsaa.v4f32.i32(i32 8, i32 [[S]], i32 [[T]], i32 0, <8 x i32> [[RSRC]], i32 0, i32 0) +; MSAA-NEXT: [[TMP2:%.*]] = extractelement <4 x float> [[TMP0]], i64 0 +; MSAA-NEXT: [[TMP3:%.*]] = insertelement <2 x float> undef, float [[TMP2]], i64 0 +; MSAA-NEXT: [[TMP4:%.*]] = extractelement <4 x float> [[TMP1]], i64 0 +; MSAA-NEXT: [[I:%.*]] = insertelement <2 x float> [[TMP3]], float [[TMP4]], i64 1 +; MSAA-NEXT: [[TMP5:%.*]] = extractelement <4 x float> [[TMP0]], i64 1 +; MSAA-NEXT: [[TMP6:%.*]] = insertelement <2 x float> undef, float [[TMP5]], i64 0 +; MSAA-NEXT: [[TMP7:%.*]] = extractelement <4 x float> [[TMP1]], i64 1 +; MSAA-NEXT: [[I1:%.*]] = insertelement <2 x float> [[TMP6]], float [[TMP7]], i64 1 +; MSAA-NEXT: [[TMP8:%.*]] = extractelement <4 x float> [[TMP0]], i64 2 +; MSAA-NEXT: [[TMP9:%.*]] = insertelement <2 x float> undef, float [[TMP8]], i64 0 +; MSAA-NEXT: [[TMP10:%.*]] = extractelement <4 x float> [[TMP1]], i64 2 +; MSAA-NEXT: [[I2:%.*]] = insertelement <2 x float> [[TMP9]], float [[TMP10]], i64 1 +; MSAA-NEXT: [[TMP11:%.*]] = extractelement <4 x float> [[TMP0]], i64 3 +; MSAA-NEXT: [[TMP12:%.*]] = insertelement <2 x float> undef, float [[TMP11]], i64 0 +; MSAA-NEXT: [[TMP13:%.*]] = extractelement <4 x float> [[TMP1]], i64 3 +; MSAA-NEXT: [[I3:%.*]] = insertelement <2 x float> [[TMP12]], float [[TMP13]], i64 1 +; MSAA-NEXT: [[I4:%.*]] = insertvalue [4 x <2 x float>] undef, <2 x float> [[I]], 0 +; MSAA-NEXT: [[I5:%.*]] = insertvalue [4 x <2 x float>] [[I4]], <2 x float> [[I1]], 1 +; MSAA-NEXT: [[I6:%.*]] = insertvalue [4 x <2 x float>] [[I5]], <2 x float> [[I2]], 2 +; MSAA-NEXT: [[I7:%.*]] = insertvalue [4 x <2 x float>] [[I6]], <2 x float> [[I3]], 3 +; MSAA-NEXT: ret [4 x <2 x float>] [[I7]] +; +main_body: + %i = call <2 x float> @llvm.amdgcn.image.load.2dmsaa.v2f32.i32(i32 10, i32 %s, i32 %t, i32 0, <8 x i32> %rsrc, i32 0, i32 0) + %i1 = call <2 x float> @llvm.amdgcn.image.load.2dmsaa.v2f32.i32(i32 10, i32 %s, i32 %t, i32 1, <8 x i32> %rsrc, i32 0, i32 0) + %i2 = call <2 x float> @llvm.amdgcn.image.load.2dmsaa.v2f32.i32(i32 10, i32 %s, i32 %t, i32 2, <8 x i32> %rsrc, i32 0, i32 0) + %i3 = call <2 x float> @llvm.amdgcn.image.load.2dmsaa.v2f32.i32(i32 10, i32 %s, i32 %t, i32 3, <8 x i32> %rsrc, i32 0, i32 0) + %i4 = insertvalue [4 x <2 x float>] undef, <2 x float> %i, 0 + %i5 = insertvalue [4 x <2 x float>] %i4, <2 x float> %i1, 1 + %i6 = insertvalue [4 x <2 x float>] %i5, <2 x float> %i2, 2 + %i7 = insertvalue [4 x <2 x float>] %i6, <2 x float> %i3, 3 + ret [4 x <2 x float>] %i7 +} + + + + +define amdgpu_ps [4 x <2 x float>] @load_2dmsaa_v4v2f32_dmask12(<8 x i32> inreg %rsrc, i32 %s, i32 %t) { +; NO-MSAA-LABEL: define amdgpu_ps [4 x <2 x float>] @load_2dmsaa_v4v2f32_dmask12( +; NO-MSAA-SAME: <8 x i32> inreg [[RSRC:%.*]], i32 [[S:%.*]], i32 [[T:%.*]]) #[[ATTR0]] { +; NO-MSAA-NEXT: main_body: +; NO-MSAA-NEXT: [[I:%.*]] = call <2 x float> @llvm.amdgcn.image.load.2dmsaa.v2f32.i32(i32 12, i32 [[S]], i32 [[T]], i32 0, <8 x i32> [[RSRC]], i32 0, i32 0) +; NO-MSAA-NEXT: [[I1:%.*]] = call <2 x float> @llvm.amdgcn.image.load.2dmsaa.v2f32.i32(i32 12, i32 [[S]], i32 [[T]], i32 1, <8 x i32> [[RSRC]], i32 0, i32 0) +; NO-MSAA-NEXT: [[I2:%.*]] = call <2 x float> @llvm.amdgcn.image.load.2dmsaa.v2f32.i32(i32 12, i32 [[S]], i32 [[T]], i32 2, <8 x i32> [[RSRC]], i32 0, i32 0) +; NO-MSAA-NEXT: [[I3:%.*]] = call <2 x float> @llvm.amdgcn.image.load.2dmsaa.v2f32.i32(i32 12, i32 [[S]], i32 [[T]], i32 3, <8 x i32> [[RSRC]], i32 0, i32 0) +; NO-MSAA-NEXT: [[I4:%.*]] = insertvalue [4 x <2 x float>] undef, <2 x float> [[I]], 0 +; NO-MSAA-NEXT: [[I5:%.*]] = insertvalue [4 x <2 x float>] [[I4]], <2 x float> [[I1]], 1 +; NO-MSAA-NEXT: [[I6:%.*]] = insertvalue [4 x <2 x float>] [[I5]], <2 x float> [[I2]], 2 +; NO-MSAA-NEXT: [[I7:%.*]] = insertvalue [4 x <2 x float>] [[I6]], <2 x float> [[I3]], 3 +; NO-MSAA-NEXT: ret [4 x <2 x float>] [[I7]] +; +; MSAA-LABEL: define amdgpu_ps [4 x <2 x float>] @load_2dmsaa_v4v2f32_dmask12( +; MSAA-SAME: <8 x i32> inreg [[RSRC:%.*]], i32 [[S:%.*]], i32 [[T:%.*]]) #[[ATTR0]] { +; MSAA-NEXT: main_body: +; MSAA-NEXT: [[TMP0:%.*]] = call <4 x float> @llvm.amdgcn.image.msaa.load.2dmsaa.v4f32.i32(i32 4, i32 [[S]], i32 [[T]], i32 0, <8 x i32> [[RSRC]], i32 0, i32 0) +; MSAA-NEXT: [[TMP1:%.*]] = call <4 x float> @llvm.amdgcn.image.msaa.load.2dmsaa.v4f32.i32(i32 8, i32 [[S]], i32 [[T]], i32 0, <8 x i32> [[RSRC]], i32 0, i32 0) +; MSAA-NEXT: [[TMP2:%.*]] = extractelement <4 x float> [[TMP0]], i64 0 +; MSAA-NEXT: [[TMP3:%.*]] = insertelement <2 x float> undef, float [[TMP2]], i64 0 +; MSAA-NEXT: [[TMP4:%.*]] = extractelement <4 x float> [[TMP1]], i64 0 +; MSAA-NEXT: [[I:%.*]] = insertelement <2 x float> [[TMP3]], float [[TMP4]], i64 1 +; MSAA-NEXT: [[TMP5:%.*]] = extractelement <4 x float> [[TMP0]], i64 1 +; MSAA-NEXT: [[TMP6:%.*]] = insertelement <2 x float> undef, float [[TMP5]], i64 0 +; MSAA-NEXT: [[TMP7:%.*]] = extractelement <4 x float> [[TMP1]], i64 1 +; MSAA-NEXT: [[I1:%.*]] = insertelement <2 x float> [[TMP6]], float [[TMP7]], i64 1 +; MSAA-NEXT: [[TMP8:%.*]] = extractelement <4 x float> [[TMP0]], i64 2 +; MSAA-NEXT: [[TMP9:%.*]] = insertelement <2 x float> undef, float [[TMP8]], i64 0 +; MSAA-NEXT: [[TMP10:%.*]] = extractelement <4 x float> [[TMP1]], i64 2 +; MSAA-NEXT: [[I2:%.*]] = insertelement <2 x float> [[TMP9]], float [[TMP10]], i64 1 +; MSAA-NEXT: [[TMP11:%.*]] = extractelement <4 x float> [[TMP0]], i64 3 +; MSAA-NEXT: [[TMP12:%.*]] = insertelement <2 x float> undef, float [[TMP11]], i64 0 +; MSAA-NEXT: [[TMP13:%.*]] = extractelement <4 x float> [[TMP1]], i64 3 +; MSAA-NEXT: [[I3:%.*]] = insertelement <2 x float> [[TMP12]], float [[TMP13]], i64 1 +; MSAA-NEXT: [[I4:%.*]] = insertvalue [4 x <2 x float>] undef, <2 x float> [[I]], 0 +; MSAA-NEXT: [[I5:%.*]] = insertvalue [4 x <2 x float>] [[I4]], <2 x float> [[I1]], 1 +; MSAA-NEXT: [[I6:%.*]] = insertvalue [4 x <2 x float>] [[I5]], <2 x float> [[I2]], 2 +; MSAA-NEXT: [[I7:%.*]] = insertvalue [4 x <2 x float>] [[I6]], <2 x float> [[I3]], 3 +; MSAA-NEXT: ret [4 x <2 x float>] [[I7]] +; +main_body: + %i = call <2 x float> @llvm.amdgcn.image.load.2dmsaa.v2f32.i32(i32 12, i32 %s, i32 %t, i32 0, <8 x i32> %rsrc, i32 0, i32 0) + %i1 = call <2 x float> @llvm.amdgcn.image.load.2dmsaa.v2f32.i32(i32 12, i32 %s, i32 %t, i32 1, <8 x i32> %rsrc, i32 0, i32 0) + %i2 = call <2 x float> @llvm.amdgcn.image.load.2dmsaa.v2f32.i32(i32 12, i32 %s, i32 %t, i32 2, <8 x i32> %rsrc, i32 0, i32 0) + %i3 = call <2 x float> @llvm.amdgcn.image.load.2dmsaa.v2f32.i32(i32 12, i32 %s, i32 %t, i32 3, <8 x i32> %rsrc, i32 0, i32 0) + %i4 = insertvalue [4 x <2 x float>] undef, <2 x float> %i, 0 + %i5 = insertvalue [4 x <2 x float>] %i4, <2 x float> %i1, 1 + %i6 = insertvalue [4 x <2 x float>] %i5, <2 x float> %i2, 2 + %i7 = insertvalue [4 x <2 x float>] %i6, <2 x float> %i3, 3 + ret [4 x <2 x float>] %i7 +} + +define amdgpu_ps [2 x half] @load_2dmsaa_v2f16_fragId01(<8 x i32> inreg %rsrc, i32 %s, i32 %t) { +; NO-MSAA-LABEL: define amdgpu_ps [2 x half] @load_2dmsaa_v2f16_fragId01( +; NO-MSAA-SAME: <8 x i32> inreg [[RSRC:%.*]], i32 [[S:%.*]], i32 [[T:%.*]]) #[[ATTR0]] { +; NO-MSAA-NEXT: main_body: +; NO-MSAA-NEXT: [[I:%.*]] = call half @llvm.amdgcn.image.load.2dmsaa.f16.i32(i32 1, i32 [[S]], i32 [[T]], i32 0, <8 x i32> [[RSRC]], i32 0, i32 0) +; NO-MSAA-NEXT: [[I1:%.*]] = call half @llvm.amdgcn.image.load.2dmsaa.f16.i32(i32 1, i32 [[S]], i32 [[T]], i32 1, <8 x i32> [[RSRC]], i32 0, i32 0) +; NO-MSAA-NEXT: [[I2:%.*]] = insertvalue [2 x half] undef, half [[I]], 0 +; NO-MSAA-NEXT: [[I3:%.*]] = insertvalue [2 x half] [[I2]], half [[I1]], 1 +; NO-MSAA-NEXT: ret [2 x half] [[I3]] +; +; MSAA-LABEL: define amdgpu_ps [2 x half] @load_2dmsaa_v2f16_fragId01( +; MSAA-SAME: <8 x i32> inreg [[RSRC:%.*]], i32 [[S:%.*]], i32 [[T:%.*]]) #[[ATTR0]] { +; MSAA-NEXT: main_body: +; MSAA-NEXT: [[TMP0:%.*]] = call <4 x half> @llvm.amdgcn.image.msaa.load.2dmsaa.v4f16.i32(i32 1, i32 [[S]], i32 [[T]], i32 0, <8 x i32> [[RSRC]], i32 0, i32 0) +; MSAA-NEXT: [[I:%.*]] = extractelement <4 x half> [[TMP0]], i64 0 +; MSAA-NEXT: [[I1:%.*]] = extractelement <4 x half> [[TMP0]], i64 1 +; MSAA-NEXT: [[I2:%.*]] = insertvalue [2 x half] undef, half [[I]], 0 +; MSAA-NEXT: [[I3:%.*]] = insertvalue [2 x half] [[I2]], half [[I1]], 1 +; MSAA-NEXT: ret [2 x half] [[I3]] +; +main_body: + %i = call half @llvm.amdgcn.image.load.2dmsaa.f16.i32(i32 1, i32 %s, i32 %t, i32 0, <8 x i32> %rsrc, i32 0, i32 0) + %i1 = call half @llvm.amdgcn.image.load.2dmsaa.f16.i32(i32 1, i32 %s, i32 %t, i32 1, <8 x i32> %rsrc, i32 0, i32 0) + %i2 = insertvalue [2 x half] undef, half %i, 0 + %i3 = insertvalue [2 x half] %i2, half %i1, 1 + ret [2 x half] %i3 +} + +define amdgpu_ps [4 x float] @load_2darraymsaa_v4f32_dmask1(<8 x i32> inreg %rsrc, i32 %s, i32 %t, i32 %slice) { +; NO-MSAA-LABEL: define amdgpu_ps [4 x float] @load_2darraymsaa_v4f32_dmask1( +; NO-MSAA-SAME: <8 x i32> inreg [[RSRC:%.*]], i32 [[S:%.*]], i32 [[T:%.*]], i32 [[SLICE:%.*]]) #[[ATTR0]] { +; NO-MSAA-NEXT: main_body: +; NO-MSAA-NEXT: [[I:%.*]] = call float @llvm.amdgcn.image.load.2darraymsaa.f32.i32(i32 1, i32 [[S]], i32 [[T]], i32 [[SLICE]], i32 0, <8 x i32> [[RSRC]], i32 0, i32 0) +; NO-MSAA-NEXT: [[I1:%.*]] = call float @llvm.amdgcn.image.load.2darraymsaa.f32.i32(i32 1, i32 [[S]], i32 [[T]], i32 [[SLICE]], i32 1, <8 x i32> [[RSRC]], i32 0, i32 0) +; NO-MSAA-NEXT: [[I2:%.*]] = call float @llvm.amdgcn.image.load.2darraymsaa.f32.i32(i32 1, i32 [[S]], i32 [[T]], i32 [[SLICE]], i32 2, <8 x i32> [[RSRC]], i32 0, i32 0) +; NO-MSAA-NEXT: [[I3:%.*]] = call float @llvm.amdgcn.image.load.2darraymsaa.f32.i32(i32 1, i32 [[S]], i32 [[T]], i32 [[SLICE]], i32 3, <8 x i32> [[RSRC]], i32 0, i32 0) +; NO-MSAA-NEXT: [[I4:%.*]] = insertvalue [4 x float] undef, float [[I]], 0 +; NO-MSAA-NEXT: [[I5:%.*]] = insertvalue [4 x float] [[I4]], float [[I1]], 1 +; NO-MSAA-NEXT: [[I6:%.*]] = insertvalue [4 x float] [[I5]], float [[I2]], 2 +; NO-MSAA-NEXT: [[I7:%.*]] = insertvalue [4 x float] [[I6]], float [[I3]], 3 +; NO-MSAA-NEXT: ret [4 x float] [[I7]] +; +; MSAA-LABEL: define amdgpu_ps [4 x float] @load_2darraymsaa_v4f32_dmask1( +; MSAA-SAME: <8 x i32> inreg [[RSRC:%.*]], i32 [[S:%.*]], i32 [[T:%.*]], i32 [[SLICE:%.*]]) #[[ATTR0]] { +; MSAA-NEXT: main_body: +; MSAA-NEXT: [[TMP0:%.*]] = call <4 x float> @llvm.amdgcn.image.msaa.load.2darraymsaa.v4f32.i32(i32 1, i32 [[S]], i32 [[T]], i32 [[SLICE]], i32 0, <8 x i32> [[RSRC]], i32 0, i32 0) +; MSAA-NEXT: [[I:%.*]] = extractelement <4 x float> [[TMP0]], i64 0 +; MSAA-NEXT: [[I1:%.*]] = extractelement <4 x float> [[TMP0]], i64 1 +; MSAA-NEXT: [[I2:%.*]] = extractelement <4 x float> [[TMP0]], i64 2 +; MSAA-NEXT: [[I3:%.*]] = extractelement <4 x float> [[TMP0]], i64 3 +; MSAA-NEXT: [[I4:%.*]] = insertvalue [4 x float] undef, float [[I]], 0 +; MSAA-NEXT: [[I5:%.*]] = insertvalue [4 x float] [[I4]], float [[I1]], 1 +; MSAA-NEXT: [[I6:%.*]] = insertvalue [4 x float] [[I5]], float [[I2]], 2 +; MSAA-NEXT: [[I7:%.*]] = insertvalue [4 x float] [[I6]], float [[I3]], 3 +; MSAA-NEXT: ret [4 x float] [[I7]] +; +main_body: + %i = call float @llvm.amdgcn.image.load.2darraymsaa.f32.i32(i32 1, i32 %s, i32 %t, i32 %slice, i32 0, <8 x i32> %rsrc, i32 0, i32 0) + %i1 = call float @llvm.amdgcn.image.load.2darraymsaa.f32.i32(i32 1, i32 %s, i32 %t, i32 %slice, i32 1, <8 x i32> %rsrc, i32 0, i32 0) + %i2 = call float @llvm.amdgcn.image.load.2darraymsaa.f32.i32(i32 1, i32 %s, i32 %t, i32 %slice, i32 2, <8 x i32> %rsrc, i32 0, i32 0) + %i3 = call float @llvm.amdgcn.image.load.2darraymsaa.f32.i32(i32 1, i32 %s, i32 %t, i32 %slice, i32 3, <8 x i32> %rsrc, i32 0, i32 0) + %i4 = insertvalue [4 x float] undef, float %i, 0 + %i5 = insertvalue [4 x float] %i4, float %i1, 1 + %i6 = insertvalue [4 x float] %i5, float %i2, 2 + %i7 = insertvalue [4 x float] %i6, float %i3, 3 + ret [4 x float] %i7 +} + + + + +define amdgpu_ps [4 x <2 x float>] @load_2darraymsaa_v4v2f32_dmask3(<8 x i32> inreg %rsrc, i32 %s, i32 %t, i32 %slice) { +; NO-MSAA-LABEL: define amdgpu_ps [4 x <2 x float>] @load_2darraymsaa_v4v2f32_dmask3( +; NO-MSAA-SAME: <8 x i32> inreg [[RSRC:%.*]], i32 [[S:%.*]], i32 [[T:%.*]], i32 [[SLICE:%.*]]) #[[ATTR0]] { +; NO-MSAA-NEXT: main_body: +; NO-MSAA-NEXT: [[I:%.*]] = call <2 x float> @llvm.amdgcn.image.load.2darraymsaa.v2f32.i32(i32 3, i32 [[S]], i32 [[T]], i32 [[SLICE]], i32 0, <8 x i32> [[RSRC]], i32 0, i32 0) +; NO-MSAA-NEXT: [[I1:%.*]] = call <2 x float> @llvm.amdgcn.image.load.2darraymsaa.v2f32.i32(i32 3, i32 [[S]], i32 [[T]], i32 [[SLICE]], i32 1, <8 x i32> [[RSRC]], i32 0, i32 0) +; NO-MSAA-NEXT: [[I2:%.*]] = call <2 x float> @llvm.amdgcn.image.load.2darraymsaa.v2f32.i32(i32 3, i32 [[S]], i32 [[T]], i32 [[SLICE]], i32 2, <8 x i32> [[RSRC]], i32 0, i32 0) +; NO-MSAA-NEXT: [[I3:%.*]] = call <2 x float> @llvm.amdgcn.image.load.2darraymsaa.v2f32.i32(i32 3, i32 [[S]], i32 [[T]], i32 [[SLICE]], i32 3, <8 x i32> [[RSRC]], i32 0, i32 0) +; NO-MSAA-NEXT: [[I4:%.*]] = insertvalue [4 x <2 x float>] undef, <2 x float> [[I]], 0 +; NO-MSAA-NEXT: [[I5:%.*]] = insertvalue [4 x <2 x float>] [[I4]], <2 x float> [[I1]], 1 +; NO-MSAA-NEXT: [[I6:%.*]] = insertvalue [4 x <2 x float>] [[I5]], <2 x float> [[I2]], 2 +; NO-MSAA-NEXT: [[I7:%.*]] = insertvalue [4 x <2 x float>] [[I6]], <2 x float> [[I3]], 3 +; NO-MSAA-NEXT: ret [4 x <2 x float>] [[I7]] +; +; MSAA-LABEL: define amdgpu_ps [4 x <2 x float>] @load_2darraymsaa_v4v2f32_dmask3( +; MSAA-SAME: <8 x i32> inreg [[RSRC:%.*]], i32 [[S:%.*]], i32 [[T:%.*]], i32 [[SLICE:%.*]]) #[[ATTR0]] { +; MSAA-NEXT: main_body: +; MSAA-NEXT: [[TMP0:%.*]] = call <4 x float> @llvm.amdgcn.image.msaa.load.2darraymsaa.v4f32.i32(i32 1, i32 [[S]], i32 [[T]], i32 [[SLICE]], i32 0, <8 x i32> [[RSRC]], i32 0, i32 0) +; MSAA-NEXT: [[TMP1:%.*]] = call <4 x float> @llvm.amdgcn.image.msaa.load.2darraymsaa.v4f32.i32(i32 2, i32 [[S]], i32 [[T]], i32 [[SLICE]], i32 0, <8 x i32> [[RSRC]], i32 0, i32 0) +; MSAA-NEXT: [[TMP2:%.*]] = extractelement <4 x float> [[TMP0]], i64 0 +; MSAA-NEXT: [[TMP3:%.*]] = insertelement <2 x float> undef, float [[TMP2]], i64 0 +; MSAA-NEXT: [[TMP4:%.*]] = extractelement <4 x float> [[TMP1]], i64 0 +; MSAA-NEXT: [[I:%.*]] = insertelement <2 x float> [[TMP3]], float [[TMP4]], i64 1 +; MSAA-NEXT: [[TMP5:%.*]] = extractelement <4 x float> [[TMP0]], i64 1 +; MSAA-NEXT: [[TMP6:%.*]] = insertelement <2 x float> undef, float [[TMP5]], i64 0 +; MSAA-NEXT: [[TMP7:%.*]] = extractelement <4 x float> [[TMP1]], i64 1 +; MSAA-NEXT: [[I1:%.*]] = insertelement <2 x float> [[TMP6]], float [[TMP7]], i64 1 +; MSAA-NEXT: [[TMP8:%.*]] = extractelement <4 x float> [[TMP0]], i64 2 +; MSAA-NEXT: [[TMP9:%.*]] = insertelement <2 x float> undef, float [[TMP8]], i64 0 +; MSAA-NEXT: [[TMP10:%.*]] = extractelement <4 x float> [[TMP1]], i64 2 +; MSAA-NEXT: [[I2:%.*]] = insertelement <2 x float> [[TMP9]], float [[TMP10]], i64 1 +; MSAA-NEXT: [[TMP11:%.*]] = extractelement <4 x float> [[TMP0]], i64 3 +; MSAA-NEXT: [[TMP12:%.*]] = insertelement <2 x float> undef, float [[TMP11]], i64 0 +; MSAA-NEXT: [[TMP13:%.*]] = extractelement <4 x float> [[TMP1]], i64 3 +; MSAA-NEXT: [[I3:%.*]] = insertelement <2 x float> [[TMP12]], float [[TMP13]], i64 1 +; MSAA-NEXT: [[I4:%.*]] = insertvalue [4 x <2 x float>] undef, <2 x float> [[I]], 0 +; MSAA-NEXT: [[I5:%.*]] = insertvalue [4 x <2 x float>] [[I4]], <2 x float> [[I1]], 1 +; MSAA-NEXT: [[I6:%.*]] = insertvalue [4 x <2 x float>] [[I5]], <2 x float> [[I2]], 2 +; MSAA-NEXT: [[I7:%.*]] = insertvalue [4 x <2 x float>] [[I6]], <2 x float> [[I3]], 3 +; MSAA-NEXT: ret [4 x <2 x float>] [[I7]] +; +main_body: + %i = call <2 x float> @llvm.amdgcn.image.load.2darraymsaa.v2f32.i32(i32 3, i32 %s, i32 %t, i32 %slice, i32 0, <8 x i32> %rsrc, i32 0, i32 0) + %i1 = call <2 x float> @llvm.amdgcn.image.load.2darraymsaa.v2f32.i32(i32 3, i32 %s, i32 %t, i32 %slice, i32 1, <8 x i32> %rsrc, i32 0, i32 0) + %i2 = call <2 x float> @llvm.amdgcn.image.load.2darraymsaa.v2f32.i32(i32 3, i32 %s, i32 %t, i32 %slice, i32 2, <8 x i32> %rsrc, i32 0, i32 0) + %i3 = call <2 x float> @llvm.amdgcn.image.load.2darraymsaa.v2f32.i32(i32 3, i32 %s, i32 %t, i32 %slice, i32 3, <8 x i32> %rsrc, i32 0, i32 0) + %i4 = insertvalue [4 x <2 x float>] undef, <2 x float> %i, 0 + %i5 = insertvalue [4 x <2 x float>] %i4, <2 x float> %i1, 1 + %i6 = insertvalue [4 x <2 x float>] %i5, <2 x float> %i2, 2 + %i7 = insertvalue [4 x <2 x float>] %i6, <2 x float> %i3, 3 + ret [4 x <2 x float>] %i7 +} + + + + + + +define amdgpu_ps [4 x <3 x float>] @load_2dmsaa_v4v3f32_dmask7(<8 x i32> inreg %rsrc, i32 %s, i32 %t) { +; NO-MSAA-LABEL: define amdgpu_ps [4 x <3 x float>] @load_2dmsaa_v4v3f32_dmask7( +; NO-MSAA-SAME: <8 x i32> inreg [[RSRC:%.*]], i32 [[S:%.*]], i32 [[T:%.*]]) #[[ATTR0]] { +; NO-MSAA-NEXT: main_body: +; NO-MSAA-NEXT: [[I:%.*]] = call <3 x float> @llvm.amdgcn.image.load.2dmsaa.v3f32.i32(i32 7, i32 [[S]], i32 [[T]], i32 0, <8 x i32> [[RSRC]], i32 0, i32 0) +; NO-MSAA-NEXT: [[I1:%.*]] = call <3 x float> @llvm.amdgcn.image.load.2dmsaa.v3f32.i32(i32 7, i32 [[S]], i32 [[T]], i32 1, <8 x i32> [[RSRC]], i32 0, i32 0) +; NO-MSAA-NEXT: [[I2:%.*]] = call <3 x float> @llvm.amdgcn.image.load.2dmsaa.v3f32.i32(i32 7, i32 [[S]], i32 [[T]], i32 2, <8 x i32> [[RSRC]], i32 0, i32 0) +; NO-MSAA-NEXT: [[I3:%.*]] = call <3 x float> @llvm.amdgcn.image.load.2dmsaa.v3f32.i32(i32 7, i32 [[S]], i32 [[T]], i32 3, <8 x i32> [[RSRC]], i32 0, i32 0) +; NO-MSAA-NEXT: [[I4:%.*]] = insertvalue [4 x <3 x float>] undef, <3 x float> [[I]], 0 +; NO-MSAA-NEXT: [[I5:%.*]] = insertvalue [4 x <3 x float>] [[I4]], <3 x float> [[I1]], 1 +; NO-MSAA-NEXT: [[I6:%.*]] = insertvalue [4 x <3 x float>] [[I5]], <3 x float> [[I2]], 2 +; NO-MSAA-NEXT: [[I7:%.*]] = insertvalue [4 x <3 x float>] [[I6]], <3 x float> [[I3]], 3 +; NO-MSAA-NEXT: ret [4 x <3 x float>] [[I7]] +; +; MSAA-LABEL: define amdgpu_ps [4 x <3 x float>] @load_2dmsaa_v4v3f32_dmask7( +; MSAA-SAME: <8 x i32> inreg [[RSRC:%.*]], i32 [[S:%.*]], i32 [[T:%.*]]) #[[ATTR0]] { +; MSAA-NEXT: main_body: +; MSAA-NEXT: [[TMP0:%.*]] = call <4 x float> @llvm.amdgcn.image.msaa.load.2dmsaa.v4f32.i32(i32 1, i32 [[S]], i32 [[T]], i32 0, <8 x i32> [[RSRC]], i32 0, i32 0) +; MSAA-NEXT: [[TMP1:%.*]] = call <4 x float> @llvm.amdgcn.image.msaa.load.2dmsaa.v4f32.i32(i32 2, i32 [[S]], i32 [[T]], i32 0, <8 x i32> [[RSRC]], i32 0, i32 0) +; MSAA-NEXT: [[TMP2:%.*]] = call <4 x float> @llvm.amdgcn.image.msaa.load.2dmsaa.v4f32.i32(i32 4, i32 [[S]], i32 [[T]], i32 0, <8 x i32> [[RSRC]], i32 0, i32 0) +; MSAA-NEXT: [[TMP3:%.*]] = extractelement <4 x float> [[TMP0]], i64 0 +; MSAA-NEXT: [[TMP4:%.*]] = insertelement <3 x float> undef, float [[TMP3]], i64 0 +; MSAA-NEXT: [[TMP5:%.*]] = extractelement <4 x float> [[TMP1]], i64 0 +; MSAA-NEXT: [[TMP6:%.*]] = insertelement <3 x float> [[TMP4]], float [[TMP5]], i64 1 +; MSAA-NEXT: [[TMP7:%.*]] = extractelement <4 x float> [[TMP2]], i64 0 +; MSAA-NEXT: [[I:%.*]] = insertelement <3 x float> [[TMP6]], float [[TMP7]], i64 2 +; MSAA-NEXT: [[TMP8:%.*]] = extractelement <4 x float> [[TMP0]], i64 1 +; MSAA-NEXT: [[TMP9:%.*]] = insertelement <3 x float> undef, float [[TMP8]], i64 0 +; MSAA-NEXT: [[TMP10:%.*]] = extractelement <4 x float> [[TMP1]], i64 1 +; MSAA-NEXT: [[TMP11:%.*]] = insertelement <3 x float> [[TMP9]], float [[TMP10]], i64 1 +; MSAA-NEXT: [[TMP12:%.*]] = extractelement <4 x float> [[TMP2]], i64 1 +; MSAA-NEXT: [[I1:%.*]] = insertelement <3 x float> [[TMP11]], float [[TMP12]], i64 2 +; MSAA-NEXT: [[TMP13:%.*]] = extractelement <4 x float> [[TMP0]], i64 2 +; MSAA-NEXT: [[TMP14:%.*]] = insertelement <3 x float> undef, float [[TMP13]], i64 0 +; MSAA-NEXT: [[TMP15:%.*]] = extractelement <4 x float> [[TMP1]], i64 2 +; MSAA-NEXT: [[TMP16:%.*]] = insertelement <3 x float> [[TMP14]], float [[TMP15]], i64 1 +; MSAA-NEXT: [[TMP17:%.*]] = extractelement <4 x float> [[TMP2]], i64 2 +; MSAA-NEXT: [[I2:%.*]] = insertelement <3 x float> [[TMP16]], float [[TMP17]], i64 2 +; MSAA-NEXT: [[TMP18:%.*]] = extractelement <4 x float> [[TMP0]], i64 3 +; MSAA-NEXT: [[TMP19:%.*]] = insertelement <3 x float> undef, float [[TMP18]], i64 0 +; MSAA-NEXT: [[TMP20:%.*]] = extractelement <4 x float> [[TMP1]], i64 3 +; MSAA-NEXT: [[TMP21:%.*]] = insertelement <3 x float> [[TMP19]], float [[TMP20]], i64 1 +; MSAA-NEXT: [[TMP22:%.*]] = extractelement <4 x float> [[TMP2]], i64 3 +; MSAA-NEXT: [[I3:%.*]] = insertelement <3 x float> [[TMP21]], float [[TMP22]], i64 2 +; MSAA-NEXT: [[I4:%.*]] = insertvalue [4 x <3 x float>] undef, <3 x float> [[I]], 0 +; MSAA-NEXT: [[I5:%.*]] = insertvalue [4 x <3 x float>] [[I4]], <3 x float> [[I1]], 1 +; MSAA-NEXT: [[I6:%.*]] = insertvalue [4 x <3 x float>] [[I5]], <3 x float> [[I2]], 2 +; MSAA-NEXT: [[I7:%.*]] = insertvalue [4 x <3 x float>] [[I6]], <3 x float> [[I3]], 3 +; MSAA-NEXT: ret [4 x <3 x float>] [[I7]] +; +main_body: + %i = call <3 x float> @llvm.amdgcn.image.load.2dmsaa.v3f32.i32(i32 7, i32 %s, i32 %t, i32 0, <8 x i32> %rsrc, i32 0, i32 0) + %i1 = call <3 x float> @llvm.amdgcn.image.load.2dmsaa.v3f32.i32(i32 7, i32 %s, i32 %t, i32 1, <8 x i32> %rsrc, i32 0, i32 0) + %i2 = call <3 x float> @llvm.amdgcn.image.load.2dmsaa.v3f32.i32(i32 7, i32 %s, i32 %t, i32 2, <8 x i32> %rsrc, i32 0, i32 0) + %i3 = call <3 x float> @llvm.amdgcn.image.load.2dmsaa.v3f32.i32(i32 7, i32 %s, i32 %t, i32 3, <8 x i32> %rsrc, i32 0, i32 0) + %i4 = insertvalue [4 x <3 x float>] undef, <3 x float> %i, 0 + %i5 = insertvalue [4 x <3 x float>] %i4, <3 x float> %i1, 1 + %i6 = insertvalue [4 x <3 x float>] %i5, <3 x float> %i2, 2 + %i7 = insertvalue [4 x <3 x float>] %i6, <3 x float> %i3, 3 + ret [4 x <3 x float>] %i7 +} + + + + + + +define amdgpu_ps [4 x <3 x float>] @load_2dmsaa_v4v3f32_dmask7_group1(<8 x i32> inreg %rsrc, i32 %s, i32 %t) { +; NO-MSAA-LABEL: define amdgpu_ps [4 x <3 x float>] @load_2dmsaa_v4v3f32_dmask7_group1( +; NO-MSAA-SAME: <8 x i32> inreg [[RSRC:%.*]], i32 [[S:%.*]], i32 [[T:%.*]]) #[[ATTR0]] { +; NO-MSAA-NEXT: main_body: +; NO-MSAA-NEXT: [[I:%.*]] = call <3 x float> @llvm.amdgcn.image.load.2dmsaa.v3f32.i32(i32 7, i32 [[S]], i32 [[T]], i32 4, <8 x i32> [[RSRC]], i32 0, i32 0) +; NO-MSAA-NEXT: [[I1:%.*]] = call <3 x float> @llvm.amdgcn.image.load.2dmsaa.v3f32.i32(i32 7, i32 [[S]], i32 [[T]], i32 5, <8 x i32> [[RSRC]], i32 0, i32 0) +; NO-MSAA-NEXT: [[I2:%.*]] = call <3 x float> @llvm.amdgcn.image.load.2dmsaa.v3f32.i32(i32 7, i32 [[S]], i32 [[T]], i32 6, <8 x i32> [[RSRC]], i32 0, i32 0) +; NO-MSAA-NEXT: [[I3:%.*]] = call <3 x float> @llvm.amdgcn.image.load.2dmsaa.v3f32.i32(i32 7, i32 [[S]], i32 [[T]], i32 7, <8 x i32> [[RSRC]], i32 0, i32 0) +; NO-MSAA-NEXT: [[I4:%.*]] = insertvalue [4 x <3 x float>] undef, <3 x float> [[I]], 0 +; NO-MSAA-NEXT: [[I5:%.*]] = insertvalue [4 x <3 x float>] [[I4]], <3 x float> [[I1]], 1 +; NO-MSAA-NEXT: [[I6:%.*]] = insertvalue [4 x <3 x float>] [[I5]], <3 x float> [[I2]], 2 +; NO-MSAA-NEXT: [[I7:%.*]] = insertvalue [4 x <3 x float>] [[I6]], <3 x float> [[I3]], 3 +; NO-MSAA-NEXT: ret [4 x <3 x float>] [[I7]] +; +; MSAA-LABEL: define amdgpu_ps [4 x <3 x float>] @load_2dmsaa_v4v3f32_dmask7_group1( +; MSAA-SAME: <8 x i32> inreg [[RSRC:%.*]], i32 [[S:%.*]], i32 [[T:%.*]]) #[[ATTR0]] { +; MSAA-NEXT: main_body: +; MSAA-NEXT: [[TMP0:%.*]] = call <4 x float> @llvm.amdgcn.image.msaa.load.2dmsaa.v4f32.i32(i32 1, i32 [[S]], i32 [[T]], i32 4, <8 x i32> [[RSRC]], i32 0, i32 0) +; MSAA-NEXT: [[TMP1:%.*]] = call <4 x float> @llvm.amdgcn.image.msaa.load.2dmsaa.v4f32.i32(i32 2, i32 [[S]], i32 [[T]], i32 4, <8 x i32> [[RSRC]], i32 0, i32 0) +; MSAA-NEXT: [[TMP2:%.*]] = call <4 x float> @llvm.amdgcn.image.msaa.load.2dmsaa.v4f32.i32(i32 4, i32 [[S]], i32 [[T]], i32 4, <8 x i32> [[RSRC]], i32 0, i32 0) +; MSAA-NEXT: [[TMP3:%.*]] = extractelement <4 x float> [[TMP0]], i64 0 +; MSAA-NEXT: [[TMP4:%.*]] = insertelement <3 x float> undef, float [[TMP3]], i64 0 +; MSAA-NEXT: [[TMP5:%.*]] = extractelement <4 x float> [[TMP1]], i64 0 +; MSAA-NEXT: [[TMP6:%.*]] = insertelement <3 x float> [[TMP4]], float [[TMP5]], i64 1 +; MSAA-NEXT: [[TMP7:%.*]] = extractelement <4 x float> [[TMP2]], i64 0 +; MSAA-NEXT: [[I:%.*]] = insertelement <3 x float> [[TMP6]], float [[TMP7]], i64 2 +; MSAA-NEXT: [[TMP8:%.*]] = extractelement <4 x float> [[TMP0]], i64 1 +; MSAA-NEXT: [[TMP9:%.*]] = insertelement <3 x float> undef, float [[TMP8]], i64 0 +; MSAA-NEXT: [[TMP10:%.*]] = extractelement <4 x float> [[TMP1]], i64 1 +; MSAA-NEXT: [[TMP11:%.*]] = insertelement <3 x float> [[TMP9]], float [[TMP10]], i64 1 +; MSAA-NEXT: [[TMP12:%.*]] = extractelement <4 x float> [[TMP2]], i64 1 +; MSAA-NEXT: [[I1:%.*]] = insertelement <3 x float> [[TMP11]], float [[TMP12]], i64 2 +; MSAA-NEXT: [[TMP13:%.*]] = extractelement <4 x float> [[TMP0]], i64 2 +; MSAA-NEXT: [[TMP14:%.*]] = insertelement <3 x float> undef, float [[TMP13]], i64 0 +; MSAA-NEXT: [[TMP15:%.*]] = extractelement <4 x float> [[TMP1]], i64 2 +; MSAA-NEXT: [[TMP16:%.*]] = insertelement <3 x float> [[TMP14]], float [[TMP15]], i64 1 +; MSAA-NEXT: [[TMP17:%.*]] = extractelement <4 x float> [[TMP2]], i64 2 +; MSAA-NEXT: [[I2:%.*]] = insertelement <3 x float> [[TMP16]], float [[TMP17]], i64 2 +; MSAA-NEXT: [[TMP18:%.*]] = extractelement <4 x float> [[TMP0]], i64 3 +; MSAA-NEXT: [[TMP19:%.*]] = insertelement <3 x float> undef, float [[TMP18]], i64 0 +; MSAA-NEXT: [[TMP20:%.*]] = extractelement <4 x float> [[TMP1]], i64 3 +; MSAA-NEXT: [[TMP21:%.*]] = insertelement <3 x float> [[TMP19]], float [[TMP20]], i64 1 +; MSAA-NEXT: [[TMP22:%.*]] = extractelement <4 x float> [[TMP2]], i64 3 +; MSAA-NEXT: [[I3:%.*]] = insertelement <3 x float> [[TMP21]], float [[TMP22]], i64 2 +; MSAA-NEXT: [[I4:%.*]] = insertvalue [4 x <3 x float>] undef, <3 x float> [[I]], 0 +; MSAA-NEXT: [[I5:%.*]] = insertvalue [4 x <3 x float>] [[I4]], <3 x float> [[I1]], 1 +; MSAA-NEXT: [[I6:%.*]] = insertvalue [4 x <3 x float>] [[I5]], <3 x float> [[I2]], 2 +; MSAA-NEXT: [[I7:%.*]] = insertvalue [4 x <3 x float>] [[I6]], <3 x float> [[I3]], 3 +; MSAA-NEXT: ret [4 x <3 x float>] [[I7]] +; +main_body: + %i = call <3 x float> @llvm.amdgcn.image.load.2dmsaa.v3f32.i32(i32 7, i32 %s, i32 %t, i32 4, <8 x i32> %rsrc, i32 0, i32 0) + %i1 = call <3 x float> @llvm.amdgcn.image.load.2dmsaa.v3f32.i32(i32 7, i32 %s, i32 %t, i32 5, <8 x i32> %rsrc, i32 0, i32 0) + %i2 = call <3 x float> @llvm.amdgcn.image.load.2dmsaa.v3f32.i32(i32 7, i32 %s, i32 %t, i32 6, <8 x i32> %rsrc, i32 0, i32 0) + %i3 = call <3 x float> @llvm.amdgcn.image.load.2dmsaa.v3f32.i32(i32 7, i32 %s, i32 %t, i32 7, <8 x i32> %rsrc, i32 0, i32 0) + %i4 = insertvalue [4 x <3 x float>] undef, <3 x float> %i, 0 + %i5 = insertvalue [4 x <3 x float>] %i4, <3 x float> %i1, 1 + %i6 = insertvalue [4 x <3 x float>] %i5, <3 x float> %i2, 2 + %i7 = insertvalue [4 x <3 x float>] %i6, <3 x float> %i3, 3 + ret [4 x <3 x float>] %i7 +} + +define amdgpu_ps [4 x float] @load_2dmsaa_v4f32_sections(<8 x i32> inreg %rsrc, float %vdata, i32 %s, i32 %t, i32 %fragid) { +; NO-MSAA-LABEL: define amdgpu_ps [4 x float] @load_2dmsaa_v4f32_sections( +; NO-MSAA-SAME: <8 x i32> inreg [[RSRC:%.*]], float [[VDATA:%.*]], i32 [[S:%.*]], i32 [[T:%.*]], i32 [[FRAGID:%.*]]) #[[ATTR0]] { +; NO-MSAA-NEXT: main_body: +; NO-MSAA-NEXT: [[I:%.*]] = call float @llvm.amdgcn.image.load.2dmsaa.f32.i32(i32 1, i32 [[S]], i32 [[T]], i32 0, <8 x i32> [[RSRC]], i32 0, i32 0) +; NO-MSAA-NEXT: [[I1:%.*]] = call float @llvm.amdgcn.image.load.2dmsaa.f32.i32(i32 1, i32 [[S]], i32 [[T]], i32 1, <8 x i32> [[RSRC]], i32 0, i32 0) +; NO-MSAA-NEXT: call void @llvm.amdgcn.image.store.2dmsaa.f32.i32(float [[VDATA]], i32 1, i32 [[S]], i32 [[T]], i32 [[FRAGID]], <8 x i32> [[RSRC]], i32 0, i32 0) +; NO-MSAA-NEXT: [[I2:%.*]] = call float @llvm.amdgcn.image.load.2dmsaa.f32.i32(i32 1, i32 [[S]], i32 [[T]], i32 2, <8 x i32> [[RSRC]], i32 0, i32 0) +; NO-MSAA-NEXT: [[I3:%.*]] = call float @llvm.amdgcn.image.load.2dmsaa.f32.i32(i32 1, i32 [[S]], i32 [[T]], i32 3, <8 x i32> [[RSRC]], i32 0, i32 0) +; NO-MSAA-NEXT: [[I4:%.*]] = insertvalue [4 x float] undef, float [[I]], 0 +; NO-MSAA-NEXT: [[I5:%.*]] = insertvalue [4 x float] [[I4]], float [[I1]], 1 +; NO-MSAA-NEXT: [[I6:%.*]] = insertvalue [4 x float] [[I5]], float [[I2]], 2 +; NO-MSAA-NEXT: [[I7:%.*]] = insertvalue [4 x float] [[I6]], float [[I3]], 3 +; NO-MSAA-NEXT: ret [4 x float] [[I7]] +; +; MSAA-LABEL: define amdgpu_ps [4 x float] @load_2dmsaa_v4f32_sections( +; MSAA-SAME: <8 x i32> inreg [[RSRC:%.*]], float [[VDATA:%.*]], i32 [[S:%.*]], i32 [[T:%.*]], i32 [[FRAGID:%.*]]) #[[ATTR0]] { +; MSAA-NEXT: main_body: +; MSAA-NEXT: [[TMP0:%.*]] = call <4 x float> @llvm.amdgcn.image.msaa.load.2dmsaa.v4f32.i32(i32 1, i32 [[S]], i32 [[T]], i32 0, <8 x i32> [[RSRC]], i32 0, i32 0) +; MSAA-NEXT: [[I:%.*]] = extractelement <4 x float> [[TMP0]], i64 0 +; MSAA-NEXT: [[I1:%.*]] = extractelement <4 x float> [[TMP0]], i64 1 +; MSAA-NEXT: call void @llvm.amdgcn.image.store.2dmsaa.f32.i32(float [[VDATA]], i32 1, i32 [[S]], i32 [[T]], i32 [[FRAGID]], <8 x i32> [[RSRC]], i32 0, i32 0) +; MSAA-NEXT: [[TMP1:%.*]] = call <4 x float> @llvm.amdgcn.image.msaa.load.2dmsaa.v4f32.i32(i32 1, i32 [[S]], i32 [[T]], i32 0, <8 x i32> [[RSRC]], i32 0, i32 0) +; MSAA-NEXT: [[I2:%.*]] = extractelement <4 x float> [[TMP1]], i64 2 +; MSAA-NEXT: [[I3:%.*]] = extractelement <4 x float> [[TMP1]], i64 3 +; MSAA-NEXT: [[I4:%.*]] = insertvalue [4 x float] undef, float [[I]], 0 +; MSAA-NEXT: [[I5:%.*]] = insertvalue [4 x float] [[I4]], float [[I1]], 1 +; MSAA-NEXT: [[I6:%.*]] = insertvalue [4 x float] [[I5]], float [[I2]], 2 +; MSAA-NEXT: [[I7:%.*]] = insertvalue [4 x float] [[I6]], float [[I3]], 3 +; MSAA-NEXT: ret [4 x float] [[I7]] +; +main_body: + %i = call float @llvm.amdgcn.image.load.2dmsaa.f32.i32(i32 1, i32 %s, i32 %t, i32 0, <8 x i32> %rsrc, i32 0, i32 0) + %i1 = call float @llvm.amdgcn.image.load.2dmsaa.f32.i32(i32 1, i32 %s, i32 %t, i32 1, <8 x i32> %rsrc, i32 0, i32 0) + call void @llvm.amdgcn.image.store.2dmsaa.f32.i32(float %vdata, i32 1, i32 %s, i32 %t, i32 %fragid, <8 x i32> %rsrc, i32 0, i32 0) + %i2 = call float @llvm.amdgcn.image.load.2dmsaa.f32.i32(i32 1, i32 %s, i32 %t, i32 2, <8 x i32> %rsrc, i32 0, i32 0) + %i3 = call float @llvm.amdgcn.image.load.2dmsaa.f32.i32(i32 1, i32 %s, i32 %t, i32 3, <8 x i32> %rsrc, i32 0, i32 0) + %i4 = insertvalue [4 x float] undef, float %i, 0 + %i5 = insertvalue [4 x float] %i4, float %i1, 1 + %i6 = insertvalue [4 x float] %i5, float %i2, 2 + %i7 = insertvalue [4 x float] %i6, float %i3, 3 + ret [4 x float] %i7 +} + +define amdgpu_ps [4 x float] @load_2dmsaa_v4f32_blocks(<8 x i32> inreg %rsrc, i32 %s, i32 %t, i32 %cond) { +; NO-MSAA-LABEL: define amdgpu_ps [4 x float] @load_2dmsaa_v4f32_blocks( +; NO-MSAA-SAME: <8 x i32> inreg [[RSRC:%.*]], i32 [[S:%.*]], i32 [[T:%.*]], i32 [[COND:%.*]]) #[[ATTR0]] { +; NO-MSAA-NEXT: main_body: +; NO-MSAA-NEXT: [[I:%.*]] = call float @llvm.amdgcn.image.load.2dmsaa.f32.i32(i32 1, i32 [[S]], i32 [[T]], i32 0, <8 x i32> [[RSRC]], i32 0, i32 0) +; NO-MSAA-NEXT: [[I1:%.*]] = call float @llvm.amdgcn.image.load.2dmsaa.f32.i32(i32 1, i32 [[S]], i32 [[T]], i32 1, <8 x i32> [[RSRC]], i32 0, i32 0) +; NO-MSAA-NEXT: [[I2:%.*]] = call float @llvm.amdgcn.image.load.2dmsaa.f32.i32(i32 1, i32 [[S]], i32 [[T]], i32 2, <8 x i32> [[RSRC]], i32 0, i32 0) +; NO-MSAA-NEXT: [[I3:%.*]] = call float @llvm.amdgcn.image.load.2dmsaa.f32.i32(i32 1, i32 [[S]], i32 [[T]], i32 3, <8 x i32> [[RSRC]], i32 0, i32 0) +; NO-MSAA-NEXT: [[I4:%.*]] = insertvalue [4 x float] undef, float [[I]], 0 +; NO-MSAA-NEXT: [[I5:%.*]] = insertvalue [4 x float] [[I4]], float [[I1]], 1 +; NO-MSAA-NEXT: [[I6:%.*]] = insertvalue [4 x float] [[I5]], float [[I2]], 2 +; NO-MSAA-NEXT: [[I7:%.*]] = insertvalue [4 x float] [[I6]], float [[I3]], 3 +; NO-MSAA-NEXT: [[I8:%.*]] = trunc i32 [[COND]] to i1 +; NO-MSAA-NEXT: br i1 [[I8]], label [[IF_EQUAL:%.*]], label [[IF_UNEQUAL:%.*]] +; NO-MSAA: if_equal: +; NO-MSAA-NEXT: [[I9:%.*]] = call float @llvm.amdgcn.image.load.2dmsaa.f32.i32(i32 1, i32 [[S]], i32 [[T]], i32 0, <8 x i32> [[RSRC]], i32 0, i32 0) +; NO-MSAA-NEXT: [[I10:%.*]] = call float @llvm.amdgcn.image.load.2dmsaa.f32.i32(i32 1, i32 [[S]], i32 [[T]], i32 1, <8 x i32> [[RSRC]], i32 0, i32 0) +; NO-MSAA-NEXT: [[I11:%.*]] = call float @llvm.amdgcn.image.load.2dmsaa.f32.i32(i32 1, i32 [[S]], i32 [[T]], i32 2, <8 x i32> [[RSRC]], i32 0, i32 0) +; NO-MSAA-NEXT: [[I12:%.*]] = call float @llvm.amdgcn.image.load.2dmsaa.f32.i32(i32 1, i32 [[S]], i32 [[T]], i32 3, <8 x i32> [[RSRC]], i32 0, i32 0) +; NO-MSAA-NEXT: [[I13:%.*]] = insertvalue [4 x float] undef, float [[I9]], 0 +; NO-MSAA-NEXT: [[I14:%.*]] = insertvalue [4 x float] [[I13]], float [[I10]], 1 +; NO-MSAA-NEXT: [[I15:%.*]] = insertvalue [4 x float] [[I14]], float [[I11]], 2 +; NO-MSAA-NEXT: [[I16:%.*]] = insertvalue [4 x float] [[I15]], float [[I12]], 3 +; NO-MSAA-NEXT: br label [[MERGE:%.*]] +; NO-MSAA: if_unequal: +; NO-MSAA-NEXT: [[I17:%.*]] = call float @llvm.amdgcn.image.load.2dmsaa.f32.i32(i32 1, i32 [[S]], i32 [[T]], i32 0, <8 x i32> [[RSRC]], i32 0, i32 0) +; NO-MSAA-NEXT: [[I18:%.*]] = call float @llvm.amdgcn.image.load.2dmsaa.f32.i32(i32 1, i32 [[S]], i32 [[T]], i32 1, <8 x i32> [[RSRC]], i32 0, i32 0) +; NO-MSAA-NEXT: [[I19:%.*]] = call float @llvm.amdgcn.image.load.2dmsaa.f32.i32(i32 1, i32 [[S]], i32 [[T]], i32 2, <8 x i32> [[RSRC]], i32 0, i32 0) +; NO-MSAA-NEXT: [[I20:%.*]] = call float @llvm.amdgcn.image.load.2dmsaa.f32.i32(i32 1, i32 [[S]], i32 [[T]], i32 3, <8 x i32> [[RSRC]], i32 0, i32 0) +; NO-MSAA-NEXT: [[I21:%.*]] = insertvalue [4 x float] undef, float [[I17]], 0 +; NO-MSAA-NEXT: [[I22:%.*]] = insertvalue [4 x float] [[I21]], float [[I18]], 1 +; NO-MSAA-NEXT: [[I23:%.*]] = insertvalue [4 x float] [[I22]], float [[I19]], 2 +; NO-MSAA-NEXT: [[I24:%.*]] = insertvalue [4 x float] [[I23]], float [[I20]], 3 +; NO-MSAA-NEXT: br label [[MERGE]] +; NO-MSAA: merge: +; NO-MSAA-NEXT: [[I25:%.*]] = phi [4 x float] [ [[I16]], [[IF_EQUAL]] ], [ [[I24]], [[IF_UNEQUAL]] ] +; NO-MSAA-NEXT: ret [4 x float] [[I25]] +; +; MSAA-LABEL: define amdgpu_ps [4 x float] @load_2dmsaa_v4f32_blocks( +; MSAA-SAME: <8 x i32> inreg [[RSRC:%.*]], i32 [[S:%.*]], i32 [[T:%.*]], i32 [[COND:%.*]]) #[[ATTR0]] { +; MSAA-NEXT: main_body: +; MSAA-NEXT: [[TMP0:%.*]] = call <4 x float> @llvm.amdgcn.image.msaa.load.2dmsaa.v4f32.i32(i32 1, i32 [[S]], i32 [[T]], i32 0, <8 x i32> [[RSRC]], i32 0, i32 0) +; MSAA-NEXT: [[I:%.*]] = extractelement <4 x float> [[TMP0]], i64 0 +; MSAA-NEXT: [[I1:%.*]] = extractelement <4 x float> [[TMP0]], i64 1 +; MSAA-NEXT: [[I2:%.*]] = extractelement <4 x float> [[TMP0]], i64 2 +; MSAA-NEXT: [[I3:%.*]] = extractelement <4 x float> [[TMP0]], i64 3 +; MSAA-NEXT: [[I4:%.*]] = insertvalue [4 x float] undef, float [[I]], 0 +; MSAA-NEXT: [[I5:%.*]] = insertvalue [4 x float] [[I4]], float [[I1]], 1 +; MSAA-NEXT: [[I6:%.*]] = insertvalue [4 x float] [[I5]], float [[I2]], 2 +; MSAA-NEXT: [[I7:%.*]] = insertvalue [4 x float] [[I6]], float [[I3]], 3 +; MSAA-NEXT: [[I8:%.*]] = trunc i32 [[COND]] to i1 +; MSAA-NEXT: br i1 [[I8]], label [[IF_EQUAL:%.*]], label [[IF_UNEQUAL:%.*]] +; MSAA: if_equal: +; MSAA-NEXT: [[TMP1:%.*]] = call <4 x float> @llvm.amdgcn.image.msaa.load.2dmsaa.v4f32.i32(i32 1, i32 [[S]], i32 [[T]], i32 0, <8 x i32> [[RSRC]], i32 0, i32 0) +; MSAA-NEXT: [[I9:%.*]] = extractelement <4 x float> [[TMP1]], i64 0 +; MSAA-NEXT: [[I10:%.*]] = extractelement <4 x float> [[TMP1]], i64 1 +; MSAA-NEXT: [[I11:%.*]] = extractelement <4 x float> [[TMP1]], i64 2 +; MSAA-NEXT: [[I12:%.*]] = extractelement <4 x float> [[TMP1]], i64 3 +; MSAA-NEXT: [[I13:%.*]] = insertvalue [4 x float] undef, float [[I9]], 0 +; MSAA-NEXT: [[I14:%.*]] = insertvalue [4 x float] [[I13]], float [[I10]], 1 +; MSAA-NEXT: [[I15:%.*]] = insertvalue [4 x float] [[I14]], float [[I11]], 2 +; MSAA-NEXT: [[I16:%.*]] = insertvalue [4 x float] [[I15]], float [[I12]], 3 +; MSAA-NEXT: br label [[MERGE:%.*]] +; MSAA: if_unequal: +; MSAA-NEXT: [[TMP2:%.*]] = call <4 x float> @llvm.amdgcn.image.msaa.load.2dmsaa.v4f32.i32(i32 1, i32 [[S]], i32 [[T]], i32 0, <8 x i32> [[RSRC]], i32 0, i32 0) +; MSAA-NEXT: [[I17:%.*]] = extractelement <4 x float> [[TMP2]], i64 0 +; MSAA-NEXT: [[I18:%.*]] = extractelement <4 x float> [[TMP2]], i64 1 +; MSAA-NEXT: [[I19:%.*]] = extractelement <4 x float> [[TMP2]], i64 2 +; MSAA-NEXT: [[I20:%.*]] = extractelement <4 x float> [[TMP2]], i64 3 +; MSAA-NEXT: [[I21:%.*]] = insertvalue [4 x float] undef, float [[I17]], 0 +; MSAA-NEXT: [[I22:%.*]] = insertvalue [4 x float] [[I21]], float [[I18]], 1 +; MSAA-NEXT: [[I23:%.*]] = insertvalue [4 x float] [[I22]], float [[I19]], 2 +; MSAA-NEXT: [[I24:%.*]] = insertvalue [4 x float] [[I23]], float [[I20]], 3 +; MSAA-NEXT: br label [[MERGE]] +; MSAA: merge: +; MSAA-NEXT: [[I25:%.*]] = phi [4 x float] [ [[I16]], [[IF_EQUAL]] ], [ [[I24]], [[IF_UNEQUAL]] ] +; MSAA-NEXT: ret [4 x float] [[I25]] +; +main_body: + %i = call float @llvm.amdgcn.image.load.2dmsaa.f32.i32(i32 1, i32 %s, i32 %t, i32 0, <8 x i32> %rsrc, i32 0, i32 0) + %i1 = call float @llvm.amdgcn.image.load.2dmsaa.f32.i32(i32 1, i32 %s, i32 %t, i32 1, <8 x i32> %rsrc, i32 0, i32 0) + %i2 = call float @llvm.amdgcn.image.load.2dmsaa.f32.i32(i32 1, i32 %s, i32 %t, i32 2, <8 x i32> %rsrc, i32 0, i32 0) + %i3 = call float @llvm.amdgcn.image.load.2dmsaa.f32.i32(i32 1, i32 %s, i32 %t, i32 3, <8 x i32> %rsrc, i32 0, i32 0) + %i4 = insertvalue [4 x float] undef, float %i, 0 + %i5 = insertvalue [4 x float] %i4, float %i1, 1 + %i6 = insertvalue [4 x float] %i5, float %i2, 2 + %i7 = insertvalue [4 x float] %i6, float %i3, 3 + %i8 = trunc i32 %cond to i1 + br i1 %i8, label %if_equal, label %if_unequal +if_equal: + %i9 = call float @llvm.amdgcn.image.load.2dmsaa.f32.i32(i32 1, i32 %s, i32 %t, i32 0, <8 x i32> %rsrc, i32 0, i32 0) + %i10 = call float @llvm.amdgcn.image.load.2dmsaa.f32.i32(i32 1, i32 %s, i32 %t, i32 1, <8 x i32> %rsrc, i32 0, i32 0) + %i11 = call float @llvm.amdgcn.image.load.2dmsaa.f32.i32(i32 1, i32 %s, i32 %t, i32 2, <8 x i32> %rsrc, i32 0, i32 0) + %i12 = call float @llvm.amdgcn.image.load.2dmsaa.f32.i32(i32 1, i32 %s, i32 %t, i32 3, <8 x i32> %rsrc, i32 0, i32 0) + %i13 = insertvalue [4 x float] undef, float %i9, 0 + %i14 = insertvalue [4 x float] %i13, float %i10, 1 + %i15 = insertvalue [4 x float] %i14, float %i11, 2 + %i16 = insertvalue [4 x float] %i15, float %i12, 3 + br label %merge +if_unequal: + %i17 = call float @llvm.amdgcn.image.load.2dmsaa.f32.i32(i32 1, i32 %s, i32 %t, i32 0, <8 x i32> %rsrc, i32 0, i32 0) + %i18 = call float @llvm.amdgcn.image.load.2dmsaa.f32.i32(i32 1, i32 %s, i32 %t, i32 1, <8 x i32> %rsrc, i32 0, i32 0) + %i19 = call float @llvm.amdgcn.image.load.2dmsaa.f32.i32(i32 1, i32 %s, i32 %t, i32 2, <8 x i32> %rsrc, i32 0, i32 0) + %i20 = call float @llvm.amdgcn.image.load.2dmsaa.f32.i32(i32 1, i32 %s, i32 %t, i32 3, <8 x i32> %rsrc, i32 0, i32 0) + %i21 = insertvalue [4 x float] undef, float %i17, 0 + %i22 = insertvalue [4 x float] %i21, float %i18, 1 + %i23 = insertvalue [4 x float] %i22, float %i19, 2 + %i24 = insertvalue [4 x float] %i23, float %i20, 3 + br label %merge +merge: + %i25 = phi [4 x float] [%i16, %if_equal], [%i24, %if_unequal] + ret [4 x float] %i25 +} + +declare float @llvm.amdgcn.image.load.2dmsaa.f32.i32(i32, i32, i32, i32, <8 x i32>, i32, i32) #0 +declare <2 x float> @llvm.amdgcn.image.load.2dmsaa.v2f32.i32(i32, i32, i32, i32, <8 x i32>, i32, i32) #0 +declare <3 x float> @llvm.amdgcn.image.load.2dmsaa.v3f32.i32(i32, i32, i32, i32, <8 x i32>, i32, i32) #0 + +declare float @llvm.amdgcn.image.load.2darraymsaa.f32.i32(i32, i32, i32, i32, i32, <8 x i32>, i32, i32) #0 +declare <2 x float> @llvm.amdgcn.image.load.2darraymsaa.v2f32.i32(i32, i32, i32, i32, i32, <8 x i32>, i32, i32) #0 +declare <3 x float> @llvm.amdgcn.image.load.2darraymsaa.v3f32.i32(i32, i32, i32, i32, i32, <8 x i32>, i32, i32) #0 + +declare half @llvm.amdgcn.image.load.2dmsaa.f16.i32(i32, i32, i32, i32, <8 x i32>, i32, i32) #0 + +declare void @llvm.amdgcn.image.store.2dmsaa.f32.i32(float, i32, i32, i32, i32, <8 x i32>, i32, i32) + +attributes #0 = { nounwind readonly willreturn } diff --git a/llvm/tools/opt/opt.cpp b/llvm/tools/opt/opt.cpp index 34a0eb7a20d3c3..cf4b629ec01977 100644 --- a/llvm/tools/opt/opt.cpp +++ b/llvm/tools/opt/opt.cpp @@ -331,6 +331,7 @@ static bool shouldPinPassToLegacyPM(StringRef Pass) { "nvvm-reflect", "nvvm-intr-range", "amdgpu-simplifylib", + "amdgpu-image-intrinsic-opt", "amdgpu-usenative", "amdgpu-promote-alloca", "amdgpu-promote-alloca-to-vector", diff --git a/llvm/utils/gn/secondary/llvm/lib/Target/AMDGPU/BUILD.gn b/llvm/utils/gn/secondary/llvm/lib/Target/AMDGPU/BUILD.gn index eff99abe158ea1..eb9df8ac230f93 100644 --- a/llvm/utils/gn/secondary/llvm/lib/Target/AMDGPU/BUILD.gn +++ b/llvm/utils/gn/secondary/llvm/lib/Target/AMDGPU/BUILD.gn @@ -145,6 +145,7 @@ static_library("LLVMAMDGPUCodeGen") { "AMDGPUIGroupLP.cpp", "AMDGPUISelDAGToDAG.cpp", "AMDGPUISelLowering.cpp", + "AMDGPUImageIntrinsicOptimizer.cpp", "AMDGPUInsertDelayAlu.cpp", "AMDGPUInstCombineIntrinsic.cpp", "AMDGPUInstrInfo.cpp", diff --git a/mlir/include/mlir-c/IR.h b/mlir/include/mlir-c/IR.h index 68eccab6dbacae..a6408317db69e6 100644 --- a/mlir/include/mlir-c/IR.h +++ b/mlir/include/mlir-c/IR.h @@ -576,25 +576,77 @@ MLIR_CAPI_EXPORTED intptr_t mlirOperationGetNumSuccessors(MlirOperation op); MLIR_CAPI_EXPORTED MlirBlock mlirOperationGetSuccessor(MlirOperation op, intptr_t pos); +/// Returns true if this operation defines an inherent attribute with this name. +/// Note: the attribute can be optional, so +/// `mlirOperationGetInherentAttributeByName` can still return a null attribute. +MLIR_CAPI_EXPORTED bool +mlirOperationHasInherentAttributeByName(MlirOperation op, MlirStringRef name); + +/// Returns an inherent attribute attached to the operation given its name. +MLIR_CAPI_EXPORTED MlirAttribute +mlirOperationGetInherentAttributeByName(MlirOperation op, MlirStringRef name); + +/// Sets an inherent attribute by name, replacing the existing if it exists. +/// This has no effect if "name" does not match an inherent attribute. +MLIR_CAPI_EXPORTED void +mlirOperationSetInherentAttributeByName(MlirOperation op, MlirStringRef name, + MlirAttribute attr); + +/// Returns the number of discardable attributes attached to the operation. +MLIR_CAPI_EXPORTED intptr_t +mlirOperationGetNumDiscardableAttributes(MlirOperation op); + +/// Return `pos`-th discardable attribute of the operation. +MLIR_CAPI_EXPORTED MlirNamedAttribute +mlirOperationGetDiscardableAttribute(MlirOperation op, intptr_t pos); + +/// Returns a discardable attribute attached to the operation given its name. +MLIR_CAPI_EXPORTED MlirAttribute mlirOperationGetDiscardableAttributeByName( + MlirOperation op, MlirStringRef name); + +/// Sets a discardable attribute by name, replacing the existing if it exists or +/// adding a new one otherwise. The new `attr` Attribute is not allowed to be +/// null, use `mlirOperationRemoveDiscardableAttributeByName` to remove an +/// Attribute instead. +MLIR_CAPI_EXPORTED void +mlirOperationSetDiscardableAttributeByName(MlirOperation op, MlirStringRef name, + MlirAttribute attr); + +/// Removes a discardable attribute by name. Returns false if the attribute was +/// not found and true if removed. +MLIR_CAPI_EXPORTED bool +mlirOperationRemoveDiscardableAttributeByName(MlirOperation op, + MlirStringRef name); + /// Returns the number of attributes attached to the operation. +/// Deprecated, please use `mlirOperationGetNumInherentAttributes` or +/// `mlirOperationGetNumDiscardableAttributes`. MLIR_CAPI_EXPORTED intptr_t mlirOperationGetNumAttributes(MlirOperation op); /// Return `pos`-th attribute of the operation. +/// Deprecated, please use `mlirOperationGetInherentAttribute` or +/// `mlirOperationGetDiscardableAttribute`. MLIR_CAPI_EXPORTED MlirNamedAttribute mlirOperationGetAttribute(MlirOperation op, intptr_t pos); /// Returns an attribute attached to the operation given its name. +/// Deprecated, please use `mlirOperationGetInherentAttributeByName` or +/// `mlirOperationGetDiscardableAttributeByName`. MLIR_CAPI_EXPORTED MlirAttribute mlirOperationGetAttributeByName(MlirOperation op, MlirStringRef name); /// Sets an attribute by name, replacing the existing if it exists or /// adding a new one otherwise. +/// Deprecated, please use `mlirOperationSetInherentAttributeByName` or +/// `mlirOperationSetDiscardableAttributeByName`. MLIR_CAPI_EXPORTED void mlirOperationSetAttributeByName(MlirOperation op, MlirStringRef name, MlirAttribute attr); /// Removes an attribute by name. Returns false if the attribute was not found /// and true if removed. +/// Deprecated, please use `mlirOperationRemoveInherentAttributeByName` or +/// `mlirOperationRemoveDiscardableAttributeByName`. MLIR_CAPI_EXPORTED bool mlirOperationRemoveAttributeByName(MlirOperation op, MlirStringRef name); diff --git a/mlir/include/mlir/IR/Operation.h b/mlir/include/mlir/IR/Operation.h index b815eaf8899d6f..35e9d31a632317 100644 --- a/mlir/include/mlir/IR/Operation.h +++ b/mlir/include/mlir/IR/Operation.h @@ -457,6 +457,23 @@ class alignas(8) Operation final if (attributes.set(name, value) != value) attrs = attributes.getDictionary(getContext()); } + void setDiscardableAttr(StringRef name, Attribute value) { + setDiscardableAttr(StringAttr::get(getContext(), name), value); + } + + /// Remove the discardable attribute with the specified name if it exists. + /// Return the attribute that was erased, or nullptr if there was no attribute + /// with such name. + Attribute removeDiscardableAttr(StringAttr name) { + NamedAttrList attributes(attrs); + Attribute removedAttr = attributes.erase(name); + if (removedAttr) + attrs = attributes.getDictionary(getContext()); + return removedAttr; + } + Attribute removeDiscardableAttr(StringRef name) { + return removeDiscardableAttr(StringAttr::get(getContext(), name)); + } /// Return all of the discardable attributes on this operation. ArrayRef getDiscardableAttrs() { return attrs.getValue(); } diff --git a/mlir/lib/CAPI/IR/IR.cpp b/mlir/lib/CAPI/IR/IR.cpp index 7f5c2aaee67382..04b386b8268e8d 100644 --- a/mlir/lib/CAPI/IR/IR.cpp +++ b/mlir/lib/CAPI/IR/IR.cpp @@ -595,6 +595,53 @@ MlirBlock mlirOperationGetSuccessor(MlirOperation op, intptr_t pos) { return wrap(unwrap(op)->getSuccessor(static_cast(pos))); } +MLIR_CAPI_EXPORTED bool +mlirOperationHasInherentAttributeByName(MlirOperation op, MlirStringRef name) { + std::optional attr = unwrap(op)->getInherentAttr(unwrap(name)); + return attr.has_value(); +} + +MlirAttribute mlirOperationGetInherentAttributeByName(MlirOperation op, + MlirStringRef name) { + std::optional attr = unwrap(op)->getInherentAttr(unwrap(name)); + if (attr.has_value()) + return wrap(*attr); + return {}; +} + +void mlirOperationSetInherentAttributeByName(MlirOperation op, + MlirStringRef name, + MlirAttribute attr) { + unwrap(op)->setInherentAttr( + StringAttr::get(unwrap(op)->getContext(), unwrap(name)), unwrap(attr)); +} + +intptr_t mlirOperationGetNumDiscardableAttributes(MlirOperation op) { + return static_cast(unwrap(op)->getDiscardableAttrs().size()); +} + +MlirNamedAttribute mlirOperationGetDiscardableAttribute(MlirOperation op, + intptr_t pos) { + NamedAttribute attr = unwrap(op)->getDiscardableAttrs()[pos]; + return MlirNamedAttribute{wrap(attr.getName()), wrap(attr.getValue())}; +} + +MlirAttribute mlirOperationGetDiscardableAttributeByName(MlirOperation op, + MlirStringRef name) { + return wrap(unwrap(op)->getDiscardableAttr(unwrap(name))); +} + +void mlirOperationSetDiscardableAttributeByName(MlirOperation op, + MlirStringRef name, + MlirAttribute attr) { + unwrap(op)->setDiscardableAttr(unwrap(name), unwrap(attr)); +} + +bool mlirOperationRemoveDiscardableAttributeByName(MlirOperation op, + MlirStringRef name) { + return !!unwrap(op)->removeDiscardableAttr(unwrap(name)); +} + intptr_t mlirOperationGetNumAttributes(MlirOperation op) { return static_cast(unwrap(op)->getAttrs().size()); } diff --git a/mlir/test/CAPI/ir.c b/mlir/test/CAPI/ir.c index c031e61945d03b..a181332e219db8 100644 --- a/mlir/test/CAPI/ir.c +++ b/mlir/test/CAPI/ir.c @@ -407,24 +407,23 @@ static void printFirstOfEach(MlirContext ctx, MlirOperation operation) { fprintf(stderr, "\n"); // CHECK: Terminator: func.return - // Get the attribute by index. - MlirNamedAttribute namedAttr0 = mlirOperationGetAttribute(operation, 0); - fprintf(stderr, "Get attr 0: "); - mlirAttributePrint(namedAttr0.attribute, printToStderr, NULL); + // Get the attribute by name. + bool hasValueAttr = mlirOperationHasInherentAttributeByName( + operation, mlirStringRefCreateFromCString("value")); + if (hasValueAttr) + // CHECK: Has attr "value" + fprintf(stderr, "Has attr \"value\""); + + MlirAttribute valueAttr0 = mlirOperationGetInherentAttributeByName( + operation, mlirStringRefCreateFromCString("value")); + fprintf(stderr, "Get attr \"value\": "); + mlirAttributePrint(valueAttr0, printToStderr, NULL); fprintf(stderr, "\n"); - // CHECK: Get attr 0: 0 : index - - // Now re-get the attribute by name. - MlirAttribute attr0ByName = mlirOperationGetAttributeByName( - operation, mlirIdentifierStr(namedAttr0.name)); - fprintf(stderr, "Get attr 0 by name: "); - mlirAttributePrint(attr0ByName, printToStderr, NULL); - fprintf(stderr, "\n"); - // CHECK: Get attr 0 by name: 0 : index + // CHECK: Get attr "value": 0 : index // Get a non-existing attribute and assert that it is null (sanity). fprintf(stderr, "does_not_exist is null: %d\n", - mlirAttributeIsNull(mlirOperationGetAttributeByName( + mlirAttributeIsNull(mlirOperationGetDiscardableAttributeByName( operation, mlirStringRefCreateFromCString("does_not_exist")))); // CHECK: does_not_exist is null: 1 @@ -443,10 +442,10 @@ static void printFirstOfEach(MlirContext ctx, MlirOperation operation) { fprintf(stderr, "\n"); // CHECK: Result 0 type: index - // Set a custom attribute. - mlirOperationSetAttributeByName(operation, - mlirStringRefCreateFromCString("custom_attr"), - mlirBoolAttrGet(ctx, 1)); + // Set a discardable attribute. + mlirOperationSetDiscardableAttributeByName( + operation, mlirStringRefCreateFromCString("custom_attr"), + mlirBoolAttrGet(ctx, 1)); fprintf(stderr, "Op with set attr: "); mlirOperationPrint(operation, printToStderr, NULL); fprintf(stderr, "\n"); @@ -454,13 +453,13 @@ static void printFirstOfEach(MlirContext ctx, MlirOperation operation) { // Remove the attribute. fprintf(stderr, "Remove attr: %d\n", - mlirOperationRemoveAttributeByName( + mlirOperationRemoveDiscardableAttributeByName( operation, mlirStringRefCreateFromCString("custom_attr"))); fprintf(stderr, "Remove attr again: %d\n", - mlirOperationRemoveAttributeByName( + mlirOperationRemoveDiscardableAttributeByName( operation, mlirStringRefCreateFromCString("custom_attr"))); fprintf(stderr, "Removed attr is null: %d\n", - mlirAttributeIsNull(mlirOperationGetAttributeByName( + mlirAttributeIsNull(mlirOperationGetDiscardableAttributeByName( operation, mlirStringRefCreateFromCString("custom_attr")))); // CHECK: Remove attr: 1 // CHECK: Remove attr again: 0 @@ -469,7 +468,7 @@ static void printFirstOfEach(MlirContext ctx, MlirOperation operation) { // Add a large attribute to verify printing flags. int64_t eltsShape[] = {4}; int32_t eltsData[] = {1, 2, 3, 4}; - mlirOperationSetAttributeByName( + mlirOperationSetDiscardableAttributeByName( operation, mlirStringRefCreateFromCString("elts"), mlirDenseElementsAttrInt32Get( mlirRankedTensorTypeGet(1, eltsShape, mlirIntegerTypeGet(ctx, 32),